From: support Date: Fri, 20 Jan 2023 12:02:26 +0000 (+0000) Subject: Built motion from commit 42801a18.|2.6.28 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22%7B%7Blicense.messaging?a=commitdiff_plain;h=69f6b6177242161937cc8557bfbdb076606b9577;p=motion2.git Built motion from commit 42801a18.|2.6.28 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index f73231f..9745919 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -1,6 +1,6 @@ define({ "name": "xCALLY Motion API", - "version": "2.6.29", + "version": "2.6.28", "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-20T09:58:30.833Z", + "time": "2023-01-20T11:54:08.459Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 7623dec..9f621f1 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -1,6 +1,6 @@ { "name": "xCALLY Motion API", - "version": "2.6.29", + "version": "2.6.28", "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-20T09:58:30.833Z", + "time": "2023-01-20T11:54:08.459Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index bec345e..3ccb67c 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -1,6 +1,6 @@ { "name": "motion", - "version": "2.6.29", + "version": "2.6.28", "dependencies": { "@babel/code-frame": { "version": "7.18.6", @@ -7177,6 +7177,11 @@ "from": "ret@>=0.1.10 <0.2.0", "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz" }, + "retry": { + "version": "0.13.1", + "from": "retry@latest", + "resolved": "https://registry.npmjs.org/retry/-/retry-0.13.1.tgz" + }, "retry-as-promised": { "version": "2.3.2", "from": "retry-as-promised@>=2.0.0 <3.0.0", diff --git a/package.json b/package.json index c430d50..6d11a82 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "motion", - "version": "2.6.29", + "version": "2.6.28", "description": "xCALLY Motion is the new Realtime asynchronous solution for your multichannel contact center over Asterisk.", "main": "server/app.js", "engines": { @@ -133,6 +133,7 @@ "pm2": "2.10.4", "randomstring": "1.1.5", "request-promise": "4.2.6", + "retry": "^0.13.1", "retry-request": "^4.0.0", "rimraf": "2.7.1", "rr": "0.1.0", diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index f597d88..14b1e71 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 _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 +var _0x95c3=['integration','motionbar','jscripty','browser','bot','script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','STRING','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','VIRTUAL','getDataValue','action'];(function(_0x3e640e,_0x98e64f){var _0x133f16=function(_0x5cfbb7){while(--_0x5cfbb7){_0x3e640e['push'](_0x3e640e['shift']());}};_0x133f16(++_0x98e64f);}(_0x95c3,0xfb));var _0x395c=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0x95c3[_0x173d7e];return _0x2220d6;};'use strict';var Sequelize=require(_0x395c('0x0'));module['exports']={'name':{'type':Sequelize[_0x395c('0x1')],'get':function(_0x1be122){return this[_0x395c('0x2')](_0x395c('0x3'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0x395c('0x4'),_0x395c('0x5'),_0x395c('0x6'),'urlForward',_0x395c('0x7'),_0x395c('0x8'),_0x395c('0x9')]],'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['STRING'](0x1000),'comment':_0x395c('0xa')},'data2':{'type':Sequelize[_0x395c('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[_0x395c('0xb')](0x1000),'comment':_0x395c('0xc')},'data4':{'type':Sequelize[_0x395c('0xb')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize[_0x395c('0xb')](0x1000),'comments':_0x395c('0xd')},'data6':{'type':Sequelize[_0x395c('0xb')],'comments':_0x395c('0xe')},'data7':{'type':Sequelize[_0x395c('0xf')],'comments':_0x395c('0x10')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index fe35464..630bb28 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 _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 +var _0x3963=['undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','sendStatus','error','stack','name','send','Action','find','body','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset'];(function(_0x4fca47,_0x57e23c){var _0x130545=function(_0xdf8924){while(--_0xdf8924){_0x4fca47['push'](_0x4fca47['shift']());}};_0x130545(++_0x57e23c);}(_0x3963,0xff));var _0x3396=function(_0x39c734,_0x2f3e06){_0x39c734=_0x39c734-0x0;var _0xb2a2f9=_0x3963[_0x39c734];return _0xb2a2f9;};'use strict';var emlformat=require(_0x3396('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3396('0x1'));var jsonpatch=require(_0x3396('0x2'));var rp=require(_0x3396('0x3'));var moment=require(_0x3396('0x4'));var BPromise=require(_0x3396('0x5'));var Mustache=require(_0x3396('0x6'));var util=require(_0x3396('0x7'));var path=require('path');var sox=require(_0x3396('0x8'));var csv=require(_0x3396('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3396('0xa'));var _=require(_0x3396('0xb'));var squel=require('squel');var crypto=require(_0x3396('0xc'));var jsforce=require(_0x3396('0xd'));var deskjs=require(_0x3396('0xe'));var toCsv=require(_0x3396('0x9'));var querystring=require('querystring');var Papa=require(_0x3396('0xf'));var Redis=require('ioredis');var authService=require(_0x3396('0x10'));var qs=require(_0x3396('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3396('0x12'));var logger=require(_0x3396('0x13'))(_0x3396('0x14'));var utils=require(_0x3396('0x15'));var config=require(_0x3396('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x3396('0x17'))['db'];function respondWithStatusCode(_0x2b9285,_0x5edc9b){_0x5edc9b=_0x5edc9b||0xcc;return function(_0x4176aa){if(_0x4176aa){return _0x2b9285['sendStatus'](_0x5edc9b);}return _0x2b9285[_0x3396('0x18')](_0x5edc9b)['end']();};}function respondWithResult(_0x401169,_0x55e81b){_0x55e81b=_0x55e81b||0xc8;return function(_0x5d163f){if(_0x5d163f){return _0x401169[_0x3396('0x18')](_0x55e81b)[_0x3396('0x19')](_0x5d163f);}};}function respondWithFilteredResult(_0x1e9592,_0x495fe6){return function(_0x37f68a){if(_0x37f68a){var _0x52154a=typeof _0x495fe6[_0x3396('0x1a')]===_0x3396('0x1b')&&typeof _0x495fe6[_0x3396('0x1c')]===_0x3396('0x1b');var _0x2e3447=_0x37f68a[_0x3396('0x1d')];var _0x5a4ab7=_0x52154a?0x0:_0x495fe6[_0x3396('0x1a')];var _0x16dde8=_0x52154a?_0x37f68a['count']:_0x495fe6['offset']+_0x495fe6['limit'];var _0x57aeb2;if(_0x16dde8>=_0x2e3447){_0x16dde8=_0x2e3447;_0x57aeb2=0xc8;}else{_0x57aeb2=0xce;}_0x1e9592[_0x3396('0x18')](_0x57aeb2);return _0x1e9592[_0x3396('0x1e')](_0x3396('0x1f'),_0x5a4ab7+'-'+_0x16dde8+'/'+_0x2e3447)[_0x3396('0x19')](_0x37f68a);}return null;};}function patchUpdates(_0x4d6999){return function(_0x193fb9){try{jsonpatch[_0x3396('0x20')](_0x193fb9,_0x4d6999,!![]);}catch(_0x4557fd){return BPromise[_0x3396('0x21')](_0x4557fd);}return _0x193fb9['save']();};}function saveUpdates(_0x1ccd39,_0x2f6e67){return function(_0x1a5a15){if(_0x1a5a15){return _0x1a5a15[_0x3396('0x22')](_0x1ccd39)[_0x3396('0x23')](function(_0x414fa7){return _0x414fa7;});}return null;};}function removeEntity(_0x4caabb,_0x4938f3){return function(_0x568eae){if(_0x568eae){return _0x568eae[_0x3396('0x24')]()[_0x3396('0x23')](function(){_0x4caabb[_0x3396('0x18')](0xcc)[_0x3396('0x25')]();});}};}function handleEntityNotFound(_0x532963,_0x1387b3){return function(_0x53a966){if(!_0x53a966){_0x532963[_0x3396('0x26')](0x194);}return _0x53a966;};}function handleError(_0x2bee84,_0x12e707){_0x12e707=_0x12e707||0x1f4;return function(_0x288521){logger[_0x3396('0x27')](_0x288521[_0x3396('0x28')]);if(_0x288521[_0x3396('0x29')]){delete _0x288521[_0x3396('0x29')];}_0x2bee84[_0x3396('0x18')](_0x12e707)[_0x3396('0x2a')](_0x288521);};}exports['update']=function(_0x24fb2e,_0x5b5143){if(_0x24fb2e['body']['id']){delete _0x24fb2e['body']['id'];}return db[_0x3396('0x2b')][_0x3396('0x2c')]({'where':{'id':_0x24fb2e['params']['id']}})['then'](handleEntityNotFound(_0x5b5143,null))[_0x3396('0x23')](saveUpdates(_0x24fb2e[_0x3396('0x2d')],null))[_0x3396('0x23')](respondWithResult(_0x5b5143,null))['catch'](handleError(_0x5b5143,null));};exports[_0x3396('0x24')]=function(_0x5223f8,_0x1bc935){return db[_0x3396('0x2b')][_0x3396('0x2c')]({'where':{'id':_0x5223f8[_0x3396('0x2e')]['id']}})[_0x3396('0x23')](handleEntityNotFound(_0x1bc935,null))['then'](removeEntity(_0x1bc935,null))['catch'](handleError(_0x1bc935,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 1531542..530590f 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 _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 +var _0x4eb1=['exports','define','tools_actions','lodash','util','../../config/logger','api','moment','path','./action.attributes'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x4eb1,0x71));var _0x14eb=function(_0xce2518,_0x5dd279){_0xce2518=_0xce2518-0x0;var _0x146457=_0x4eb1[_0xce2518];return _0x146457;};'use strict';var _=require(_0x14eb('0x0'));var util=require(_0x14eb('0x1'));var logger=require(_0x14eb('0x2'))(_0x14eb('0x3'));var moment=require(_0x14eb('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x14eb('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x14eb('0x6'));module[_0x14eb('0x7')]=function(_0x51cdd6,_0x457c65){return _0x51cdd6[_0x14eb('0x8')]('Action',attributes,{'tableName':_0x14eb('0x9'),'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 d2b3c46..be5125a 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 _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 +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(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x1cb9,0x14e));var _0x91cb=function(_0xbc5ad9,_0x5d3a99){_0xbc5ad9=_0xbc5ad9-0x0;var _0x26ef9c=_0x1cb9[_0xbc5ad9];return _0x26ef9c;};'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 80af3a2..43bdb76 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 _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 +var _0x4001=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./action.controller','/:id','isAuthenticated','update','destroy','exports','multer'];(function(_0x5a2d3f,_0x27b04e){var _0x5c65d8=function(_0x2d1965){while(--_0x2d1965){_0x5a2d3f['push'](_0x5a2d3f['shift']());}};_0x5c65d8(++_0x27b04e);}(_0x4001,0x16b));var _0x1400=function(_0x34f4e3,_0x5ea27d){_0x34f4e3=_0x34f4e3-0x0;var _0x4abd77=_0x4001[_0x34f4e3];return _0x4abd77;};'use strict';var multer=require(_0x1400('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1400('0x1'));var express=require(_0x1400('0x2'));var router=express[_0x1400('0x3')]();var fs_extra=require(_0x1400('0x4'));var auth=require(_0x1400('0x5'));var interaction=require(_0x1400('0x6'));var config=require('../../config/environment');var controller=require(_0x1400('0x7'));router['put'](_0x1400('0x8'),auth[_0x1400('0x9')](),controller[_0x1400('0xa')]);router['delete']('/:id',auth[_0x1400('0x9')](),controller[_0x1400('0xb')]);module[_0x1400('0xc')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 4a392aa..ba32ab9 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 _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 +var _0x5075=['exports','STRING','TEXT','sequelize'];(function(_0x55a76a,_0x2d0203){var _0x45885a=function(_0x4348d5){while(--_0x4348d5){_0x55a76a['push'](_0x55a76a['shift']());}};_0x45885a(++_0x2d0203);}(_0x5075,0x73));var _0x5507=function(_0x11ad65,_0x352d3c){_0x11ad65=_0x11ad65-0x0;var _0x35590c=_0x5075[_0x11ad65];return _0x35590c;};'use strict';var Sequelize=require(_0x5507('0x0'));module[_0x5507('0x1')]={'name':{'type':Sequelize[_0x5507('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x5507('0x2')]},'parent':{'type':Sequelize[_0x5507('0x2')]},'table':{'type':Sequelize[_0x5507('0x2')]},'conditions':{'type':Sequelize[_0x5507('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 0591871..82d9d44 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 _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 +var _0xa37a=['fs-extra','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','dbH','sendStatus','end','undefined','limit','offset','status','set','apply','reject','then','get','CustomReports','error','name','send','index','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','order','sort','filter','where','merge','options','count','includeAll','rows','catch','show','params','include','AnalyticCustomReport','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','update','destroy','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','group','field','condition','value','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','from','table','MetricId','metric','function','format','groupBy','orderBy','DESC','alias','joins','parentKey','foreignTable','foreignKey','conditions','parse','clone','debug','Limited\x20Query:','toString','sequelize','SELECT','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','DATE(%s)','HOUR(%s)','IS\x20NOT\x20EMPTY','operator','Sequelize','replace','web','fullPath','randomstring','generate','custom','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','../../components/export/','output','savename','countTable','QueryTypes','runReport','getFields','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0xa37a,0x135));var _0xaa37=function(_0x385e66,_0x4fb091){_0x385e66=_0x385e66-0x0;var _0x105823=_0xa37a[_0x385e66];return _0x105823;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaa37('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xaa37('0x1'));var BPromise=require(_0xaa37('0x2'));var Mustache=require(_0xaa37('0x3'));var util=require(_0xaa37('0x4'));var path=require(_0xaa37('0x5'));var sox=require(_0xaa37('0x6'));var csv=require(_0xaa37('0x7'));var ejs=require(_0xaa37('0x8'));var fs=require('fs');var fs_extra=require(_0xaa37('0x9'));var _=require('lodash');var squel=require(_0xaa37('0xa'));var crypto=require(_0xaa37('0xb'));var jsforce=require(_0xaa37('0xc'));var deskjs=require(_0xaa37('0xd'));var toCsv=require(_0xaa37('0x7'));var querystring=require('querystring');var Papa=require(_0xaa37('0xe'));var Redis=require(_0xaa37('0xf'));var authService=require(_0xaa37('0x10'));var qs=require(_0xaa37('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaa37('0x12'));var logger=require(_0xaa37('0x13'))(_0xaa37('0x14'));var utils=require(_0xaa37('0x15'));var config=require(_0xaa37('0x16'));var licenseUtil=require(_0xaa37('0x17'));var db=require(_0xaa37('0x18'))['db'];var dbH=require(_0xaa37('0x18'))[_0xaa37('0x19')];function respondWithStatusCode(_0x16f29c,_0x194e53){_0x194e53=_0x194e53||0xcc;return function(_0x309699){if(_0x309699){return _0x16f29c[_0xaa37('0x1a')](_0x194e53);}return _0x16f29c['status'](_0x194e53)[_0xaa37('0x1b')]();};}function respondWithResult(_0x2b4427,_0x4390fc){_0x4390fc=_0x4390fc||0xc8;return function(_0x2ec730){if(_0x2ec730){return _0x2b4427['status'](_0x4390fc)['json'](_0x2ec730);}};}function respondWithFilteredResult(_0x4e2a45,_0x1ebcf2){return function(_0x2ebc04){if(_0x2ebc04){var _0x342e98=typeof _0x1ebcf2['offset']===_0xaa37('0x1c')&&typeof _0x1ebcf2[_0xaa37('0x1d')]===_0xaa37('0x1c');var _0x125178=_0x2ebc04['count'];var _0x646053=_0x342e98?0x0:_0x1ebcf2[_0xaa37('0x1e')];var _0x4a814a=_0x342e98?_0x2ebc04['count']:_0x1ebcf2[_0xaa37('0x1e')]+_0x1ebcf2['limit'];var _0x3e5abf;if(_0x4a814a>=_0x125178){_0x4a814a=_0x125178;_0x3e5abf=0xc8;}else{_0x3e5abf=0xce;}_0x4e2a45[_0xaa37('0x1f')](_0x3e5abf);return _0x4e2a45[_0xaa37('0x20')]('Content-Range',_0x646053+'-'+_0x4a814a+'/'+_0x125178)['json'](_0x2ebc04);}return null;};}function patchUpdates(_0x4f0781){return function(_0x52aaec){try{jsonpatch[_0xaa37('0x21')](_0x52aaec,_0x4f0781,!![]);}catch(_0x1097d4){return BPromise[_0xaa37('0x22')](_0x1097d4);}return _0x52aaec['save']();};}function saveUpdates(_0x104668,_0x31a8ed){return function(_0x53ae5e){if(_0x53ae5e){return _0x53ae5e['update'](_0x104668)['then'](function(_0xac0e0e){return _0xac0e0e;});}return null;};}function removeEntity(_0xb75470,_0x1f85f8){return function(_0x1df029){if(_0x1df029){return _0x1df029['destroy']()[_0xaa37('0x23')](function(){var _0xfc50ba=_0x1df029[_0xaa37('0x24')]({'plain':!![]});var _0x25e130=_0xaa37('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x25e130,'resourceId':_0xfc50ba['id']}})['then'](function(){return _0x1df029;});})['then'](function(){_0xb75470[_0xaa37('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x8bf85c,_0x44767b){return function(_0x160705){if(!_0x160705){_0x8bf85c[_0xaa37('0x1a')](0x194);}return _0x160705;};}function handleError(_0x22d46d,_0x4f6992){_0x4f6992=_0x4f6992||0x1f4;return function(_0x98a6e7){logger[_0xaa37('0x26')](_0x98a6e7['stack']);if(_0x98a6e7['name']){delete _0x98a6e7[_0xaa37('0x27')];}_0x22d46d[_0xaa37('0x1f')](_0x4f6992)[_0xaa37('0x28')](_0x98a6e7);};}exports[_0xaa37('0x29')]=function(_0x472ea4,_0x26d3df){var _0x548d4d={},_0x36dd97={},_0x3563b8={'count':0x0,'rows':[]};var _0x4bb250=_['map'](db['AnalyticCustomReport'][_0xaa37('0x2a')],function(_0x37c78f){return{'name':_0x37c78f[_0xaa37('0x2b')],'type':_0x37c78f[_0xaa37('0x2c')]['key']};});_0x36dd97[_0xaa37('0x2d')]=_[_0xaa37('0x2e')](_0x4bb250,_0xaa37('0x27'));_0x36dd97[_0xaa37('0x2f')]=_[_0xaa37('0x30')](_0x472ea4[_0xaa37('0x2f')]);_0x36dd97[_0xaa37('0x31')]=_[_0xaa37('0x32')](_0x36dd97[_0xaa37('0x2d')],_0x36dd97[_0xaa37('0x2f')]);_0x548d4d[_0xaa37('0x33')]=_[_0xaa37('0x32')](_0x36dd97[_0xaa37('0x2d')],qs[_0xaa37('0x34')](_0x472ea4[_0xaa37('0x2f')][_0xaa37('0x34')]));_0x548d4d[_0xaa37('0x33')]=_0x548d4d[_0xaa37('0x33')][_0xaa37('0x35')]?_0x548d4d[_0xaa37('0x33')]:_0x36dd97[_0xaa37('0x2d')];if(!_0x472ea4[_0xaa37('0x2f')]['hasOwnProperty']('nolimit')){_0x548d4d[_0xaa37('0x1d')]=qs['limit'](_0x472ea4[_0xaa37('0x2f')][_0xaa37('0x1d')]);_0x548d4d[_0xaa37('0x1e')]=qs[_0xaa37('0x1e')](_0x472ea4[_0xaa37('0x2f')][_0xaa37('0x1e')]);}_0x548d4d[_0xaa37('0x36')]=qs[_0xaa37('0x37')](_0x472ea4['query'][_0xaa37('0x37')]);_0x548d4d['where']=qs[_0xaa37('0x31')](_['pick'](_0x472ea4[_0xaa37('0x2f')],_0x36dd97[_0xaa37('0x31')]),_0x4bb250);if(_0x472ea4[_0xaa37('0x2f')][_0xaa37('0x38')]){_0x548d4d[_0xaa37('0x39')]=_[_0xaa37('0x3a')](_0x548d4d[_0xaa37('0x39')],{'$or':_['map'](_0x4bb250,function(_0x43014f){if(_0x43014f['type']!=='VIRTUAL'){var _0x4ee8dd={};_0x4ee8dd[_0x43014f[_0xaa37('0x27')]]={'$like':'%'+_0x472ea4[_0xaa37('0x2f')][_0xaa37('0x38')]+'%'};return _0x4ee8dd;}})});}_0x548d4d=_[_0xaa37('0x3a')]({},_0x548d4d,_0x472ea4[_0xaa37('0x3b')]);var _0x4ba432={'where':_0x548d4d['where']};return db['AnalyticCustomReport'][_0xaa37('0x3c')](_0x4ba432)['then'](function(_0x29e14b){_0x3563b8[_0xaa37('0x3c')]=_0x29e14b;if(_0x472ea4[_0xaa37('0x2f')][_0xaa37('0x3d')]){_0x548d4d['include']=[{'all':!![]}];}return db['AnalyticCustomReport']['findAll'](_0x548d4d);})[_0xaa37('0x23')](function(_0x37f427){_0x3563b8[_0xaa37('0x3e')]=_0x37f427;return _0x3563b8;})['then'](respondWithFilteredResult(_0x26d3df,_0x548d4d))[_0xaa37('0x3f')](handleError(_0x26d3df,null));};exports[_0xaa37('0x40')]=function(_0x425342,_0x2721de){var _0x1ee65b={'raw':![],'where':{'id':_0x425342[_0xaa37('0x41')]['id']}},_0x59d3c5={};_0x59d3c5[_0xaa37('0x2d')]=_[_0xaa37('0x30')](db['AnalyticCustomReport'][_0xaa37('0x2a')]);_0x59d3c5[_0xaa37('0x2f')]=_[_0xaa37('0x30')](_0x425342[_0xaa37('0x2f')]);_0x59d3c5[_0xaa37('0x31')]=_[_0xaa37('0x32')](_0x59d3c5[_0xaa37('0x2d')],_0x59d3c5[_0xaa37('0x2f')]);_0x1ee65b[_0xaa37('0x33')]=_['intersection'](_0x59d3c5[_0xaa37('0x2d')],qs[_0xaa37('0x34')](_0x425342[_0xaa37('0x2f')]['fields']));_0x1ee65b['attributes']=_0x1ee65b[_0xaa37('0x33')][_0xaa37('0x35')]?_0x1ee65b[_0xaa37('0x33')]:_0x59d3c5[_0xaa37('0x2d')];if(_0x425342[_0xaa37('0x2f')][_0xaa37('0x3d')]){_0x1ee65b[_0xaa37('0x42')]=[{'all':!![]}];}_0x1ee65b=_[_0xaa37('0x3a')]({},_0x1ee65b,_0x425342[_0xaa37('0x3b')]);return db[_0xaa37('0x43')][_0xaa37('0x44')](_0x1ee65b)[_0xaa37('0x23')](handleEntityNotFound(_0x2721de,null))[_0xaa37('0x23')](respondWithResult(_0x2721de,null))[_0xaa37('0x3f')](handleError(_0x2721de,null));};exports[_0xaa37('0x45')]=function(_0x50678b,_0x52f712){return db[_0xaa37('0x43')]['create'](_0x50678b[_0xaa37('0x46')],{})[_0xaa37('0x23')](function(_0x26a2cd){var _0x54cb68=_0x50678b[_0xaa37('0x47')][_0xaa37('0x24')]({'plain':!![]});if(!_0x54cb68)throw new Error(_0xaa37('0x48'));if(_0x54cb68[_0xaa37('0x49')]===_0xaa37('0x47')){var _0x130fa2=_0x26a2cd['get']({'plain':!![]});var _0x258284=_0xaa37('0x4a');return db[_0xaa37('0x4b')]['find']({'where':{'name':_0x258284,'userProfileId':_0x54cb68[_0xaa37('0x4c')]},'raw':!![]})[_0xaa37('0x23')](function(_0x49fa2a){if(_0x49fa2a&&_0x49fa2a[_0xaa37('0x4d')]===0x0){return db[_0xaa37('0x4e')]['create']({'name':_0x130fa2[_0xaa37('0x27')],'resourceId':_0x130fa2['id'],'type':_0xaa37('0x25'),'sectionId':_0x49fa2a['id']},{})['then'](function(){return _0x26a2cd;});}else{return _0x26a2cd;}})[_0xaa37('0x3f')](function(_0x103457){logger[_0xaa37('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x103457);throw _0x103457;});}return _0x26a2cd;})[_0xaa37('0x23')](respondWithResult(_0x52f712,0xc9))[_0xaa37('0x3f')](handleError(_0x52f712,null));};exports[_0xaa37('0x4f')]=function(_0x511e4c,_0x36f0b5){if(_0x511e4c[_0xaa37('0x46')]['id']){delete _0x511e4c[_0xaa37('0x46')]['id'];}return db[_0xaa37('0x43')][_0xaa37('0x44')]({'where':{'id':_0x511e4c[_0xaa37('0x41')]['id']}})[_0xaa37('0x23')](handleEntityNotFound(_0x36f0b5,null))[_0xaa37('0x23')](saveUpdates(_0x511e4c[_0xaa37('0x46')],null))[_0xaa37('0x23')](respondWithResult(_0x36f0b5,null))['catch'](handleError(_0x36f0b5,null));};exports[_0xaa37('0x50')]=function(_0x22b402,_0x1888ff){return db[_0xaa37('0x43')][_0xaa37('0x44')]({'where':{'id':_0x22b402[_0xaa37('0x41')]['id']}})['then'](handleEntityNotFound(_0x1888ff,null))[_0xaa37('0x23')](removeEntity(_0x1888ff,null))[_0xaa37('0x3f')](handleError(_0x1888ff,null));};exports['preview']=function(_0x4148d3,_0x5586af){var _0x31e8a3=0xa;var _0x172726=[_0xaa37('0x51'),_0xaa37('0x52'),_0xaa37('0x53'),_0xaa37('0x54')];var _0x28b53a={'SUM':_0xaa37('0x55'),'COUNT':_0xaa37('0x56'),'COUNT DISTINCT':_0xaa37('0x57'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0xaa37('0x58'),'GROUP_CONCAT':_0xaa37('0x59'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xaa37('0x5a')};var _0x22a9c9={'SEC_TO_TIME':_0xaa37('0x5b'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xaa37('0x5c'),'UNIX_TIMESTAMP':_0xaa37('0x5d')};var _0x1c1986=function(_0x55a06b){return!_[_0xaa37('0x5e')]([_0xaa37('0x5f'),_0xaa37('0x60'),_0xaa37('0x61'),'IS\x20NOT\x20EMPTY'],_0x55a06b);};var _0x11653e=function(_0x4b0d61){if(!_0x4b0d61||!_0x4b0d61[_0xaa37('0x62')][_0xaa37('0x35')]){return'';}for(var _0x4a7e55='(',_0x10fa7b=0x0;_0x10fa7b<_0x4b0d61[_0xaa37('0x62')][_0xaa37('0x35')];_0x10fa7b+=0x1){_0x10fa7b>0x0&&(_0x4a7e55+='\x20'+_0x4b0d61['operator']+'\x20');_0x4a7e55+=_0x4b0d61[_0xaa37('0x62')][_0x10fa7b]['group']?_0x11653e(_0x4b0d61['rules'][_0x10fa7b][_0xaa37('0x63')]):_0x4b0d61['rules'][_0x10fa7b][_0xaa37('0x64')]+'\x20'+_0x4b0d61['rules'][_0x10fa7b][_0xaa37('0x65')]+(_0x1c1986(_0x4b0d61[_0xaa37('0x62')][_0x10fa7b][_0xaa37('0x65')])?'\x20'+_0x4b0d61[_0xaa37('0x62')][_0x10fa7b][_0xaa37('0x66')]:'');}return _0x4a7e55+')';};var _0xd12a8={'where':{'id':_0x4148d3['params']['id']}},_0x4a74df,_0xd964a2,_0x2e0779,_0x4f28d0,_0x4a4ef5;_0xd12a8=_[_0xaa37('0x3a')]({},_0xd12a8,_0x4148d3[_0xaa37('0x3b')]);return db['AnalyticCustomReport'][_0xaa37('0x44')](_0xd12a8)[_0xaa37('0x23')](function(_0x4962da){if(_0x4962da){_0x4a74df=_0x4962da;return _0x4962da['getFields']();}return null;})[_0xaa37('0x23')](function(_0x2589e4){if(_0x2589e4){if(!_0x2589e4[_0xaa37('0x35')]){throw new db['Sequelize'][(_0xaa37('0x67'))](_0xaa37('0x68'),0x193);}_0xd964a2=_0x2589e4;return db[_0xaa37('0x69')][_0xaa37('0x6a')]({'raw':!![]});}return null;})['then'](function(_0x57dcea){if(_0x57dcea){_0x2e0779=_[_0xaa37('0x6b')](_0x57dcea,'id');var _0xd62dde;var _0x345eca=squel[_0xaa37('0x6c')]();_0x345eca[_0xaa37('0x6d')](_0x4a74df[_0xaa37('0x6e')]);for(var _0x50e24c=0x0;_0x50e24c<_0xd964a2[_0xaa37('0x35')];_0x50e24c+=0x1){_0xd62dde=_0xd964a2[_0x50e24c]['MetricId']?_0x2e0779[_0xd964a2[_0x50e24c][_0xaa37('0x6f')]][_0xaa37('0x70')]:_0xd964a2[_0x50e24c][_0xaa37('0x64')];_0xd62dde=_0xd964a2[_0x50e24c][_0xaa37('0x71')]?_['replace'](_0x28b53a[_0xd964a2[_0x50e24c][_0xaa37('0x71')]],'%s',_0xd62dde):_0xd62dde;_0xd62dde=_0xd964a2[_0x50e24c][_0xaa37('0x72')]?_['replace'](_0x22a9c9[_0xd964a2[_0x50e24c]['format']],'%s',_0xd62dde):_0xd62dde;if(_0xd964a2[_0x50e24c][_0xaa37('0x73')]){_0x345eca[_0xaa37('0x63')](_0xd62dde);}_0xd964a2[_0x50e24c][_0xaa37('0x74')]&&_0x345eca[_0xaa37('0x36')](_0xd62dde,_0xd964a2[_0x50e24c][_0xaa37('0x74')]===_0xaa37('0x75')?![]:!![]);_0x345eca[_0xaa37('0x64')](_0xd62dde,_0xd964a2[_0x50e24c][_0xaa37('0x76')]||_0xd62dde);}if(_0x4a74df[_0xaa37('0x77')]){_0x4a74df[_0xaa37('0x77')]=JSON['parse'](_0x4a74df[_0xaa37('0x77')]);for(var _0x2b1127=0x0;_0x2b1127<_0x4a74df['joins'][_0xaa37('0x35')];_0x2b1127+=0x1){if(_0x4a74df['joins'][_0x2b1127][_0xaa37('0x2c')]&&_[_0xaa37('0x5e')](_0x172726,_0x4a74df[_0xaa37('0x77')][_0x2b1127][_0xaa37('0x2c')])&&_0x4a74df['joins'][_0x2b1127][_0xaa37('0x78')]&&_0x4a74df[_0xaa37('0x77')][_0x2b1127][_0xaa37('0x79')]&&_0x4a74df[_0xaa37('0x77')][_0x2b1127][_0xaa37('0x7a')]){_0x345eca[_0x4a74df['joins'][_0x2b1127]['type']](_0x4a74df['joins'][_0x2b1127][_0xaa37('0x79')],null,util[_0xaa37('0x72')]('%s.%s\x20=\x20%s.%s',_0x4a74df['table'],_0x4a74df[_0xaa37('0x77')][_0x2b1127][_0xaa37('0x78')],_0x4a74df['joins'][_0x2b1127][_0xaa37('0x79')],_0x4a74df[_0xaa37('0x77')][_0x2b1127][_0xaa37('0x7a')]));}}}if(_0x4a74df[_0xaa37('0x7b')]){_0x4a74df[_0xaa37('0x7b')]=JSON[_0xaa37('0x7c')](_0x4a74df[_0xaa37('0x7b')]);_0x345eca['where'](_0x11653e(_0x4a74df[_0xaa37('0x7b')]['group']));}_0x4a4ef5=_0x345eca[_0xaa37('0x7d')]();_0x345eca[_0xaa37('0x1d')](_0x31e8a3);_0x345eca['offset'](0x0);logger[_0xaa37('0x7e')](_0xaa37('0x7f'),_0x345eca[_0xaa37('0x80')]());return dbH[_0xaa37('0x81')]['query'](_0x345eca[_0xaa37('0x80')](),{'type':dbH['sequelize']['QueryTypes'][_0xaa37('0x82')]});}})[_0xaa37('0x23')](respondWithResult(_0x5586af,null))[_0xaa37('0x3f')](handleError(_0x5586af,null));};function runReport(_0x345552,_0x178f8b,_0x1437fc){var _0x58f375=_0x178f8b[_0xaa37('0x27')];var _0x142cbf=0xa;var _0x7e1ed1=[_0xaa37('0x51'),'left_join',_0xaa37('0x53'),'cross_join'];var _0x234d28={'SUM':_0xaa37('0x55'),'COUNT':_0xaa37('0x56'),'COUNT DISTINCT':_0xaa37('0x57'),'MAX':_0xaa37('0x83'),'MIN':_0xaa37('0x84'),'AVG':_0xaa37('0x58'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xaa37('0x85'),'GROUP_CONCAT DESC':_0xaa37('0x5a')};var _0x3156a4={'SEC_TO_TIME':_0xaa37('0x5b'),'DATE':_0xaa37('0x86'),'HOUR':_0xaa37('0x87'),'ROUND':_0xaa37('0x5c'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x39f7b9=function(_0x18c2af){return!_[_0xaa37('0x5e')]([_0xaa37('0x5f'),_0xaa37('0x60'),_0xaa37('0x61'),_0xaa37('0x88')],_0x18c2af);};var _0x433a7c=function(_0x36b5df){if(!_0x36b5df||!_0x36b5df[_0xaa37('0x62')]['length']){return'';}for(var _0x3071b5='(',_0x3df706=0x0;_0x3df706<_0x36b5df[_0xaa37('0x62')][_0xaa37('0x35')];_0x3df706+=0x1){_0x3df706>0x0&&(_0x3071b5+='\x20'+_0x36b5df[_0xaa37('0x89')]+'\x20');_0x3071b5+=_0x36b5df[_0xaa37('0x62')][_0x3df706]['group']?_0x433a7c(_0x36b5df[_0xaa37('0x62')][_0x3df706]['group']):_0x36b5df[_0xaa37('0x62')][_0x3df706][_0xaa37('0x64')]+'\x20'+_0x36b5df[_0xaa37('0x62')][_0x3df706][_0xaa37('0x65')]+(_0x39f7b9(_0x36b5df[_0xaa37('0x62')][_0x3df706]['condition'])?'\x20'+_0x36b5df['rules'][_0x3df706][_0xaa37('0x66')]:'');}return _0x3071b5+')';};var _0x485591={'where':{'id':_0x345552['id']}},_0x5d4350,_0x1b21bb,_0x4c59e6,_0x5718c2,_0x541e5b;_0x485591=_[_0xaa37('0x3a')]({},_0x485591,_0x1437fc);return db[_0xaa37('0x43')][_0xaa37('0x44')](_0x485591)['then'](function(_0x2a52cf){if(_0x2a52cf){_0x5d4350=_0x2a52cf;return _0x2a52cf['getFields']();}return null;})[_0xaa37('0x23')](function(_0x501a4b){if(_0x501a4b){if(!_0x501a4b['length']){throw new db[(_0xaa37('0x8a'))]['ValidationErrorItem'](_0xaa37('0x68'),0x193);}_0x1b21bb=_0x501a4b;return db[_0xaa37('0x69')][_0xaa37('0x6a')]({'raw':!![]});}return null;})['then'](function(_0x37c9ad){if(_0x37c9ad){_0x4c59e6=_[_0xaa37('0x6b')](_0x37c9ad,'id');var _0x1651d7;var _0x310029=squel[_0xaa37('0x6c')]();_0x310029[_0xaa37('0x6d')](_0x5d4350[_0xaa37('0x6e')]);for(var _0x56b770=0x0;_0x56b770<_0x1b21bb[_0xaa37('0x35')];_0x56b770+=0x1){_0x1651d7=_0x1b21bb[_0x56b770][_0xaa37('0x6f')]?_0x4c59e6[_0x1b21bb[_0x56b770]['MetricId']][_0xaa37('0x70')]:_0x1b21bb[_0x56b770]['field'];_0x1651d7=_0x1b21bb[_0x56b770][_0xaa37('0x71')]?_[_0xaa37('0x8b')](_0x234d28[_0x1b21bb[_0x56b770]['function']],'%s',_0x1651d7):_0x1651d7;_0x1651d7=_0x1b21bb[_0x56b770][_0xaa37('0x72')]?_[_0xaa37('0x8b')](_0x3156a4[_0x1b21bb[_0x56b770][_0xaa37('0x72')]],'%s',_0x1651d7):_0x1651d7;if(_0x1b21bb[_0x56b770]['groupBy']){_0x310029[_0xaa37('0x63')](_0x1651d7);}_0x1b21bb[_0x56b770]['orderBy']&&_0x310029['order'](_0x1651d7,_0x1b21bb[_0x56b770][_0xaa37('0x74')]===_0xaa37('0x75')?![]:!![]);_0x310029['field'](_0x1651d7,_0x1b21bb[_0x56b770][_0xaa37('0x76')]||_0x1651d7);}if(_0x5d4350[_0xaa37('0x77')]){_0x5d4350[_0xaa37('0x77')]=JSON[_0xaa37('0x7c')](_0x5d4350[_0xaa37('0x77')]);for(var _0x3b9df9=0x0;_0x3b9df9<_0x5d4350[_0xaa37('0x77')]['length'];_0x3b9df9+=0x1){if(_0x5d4350[_0xaa37('0x77')][_0x3b9df9][_0xaa37('0x2c')]&&_[_0xaa37('0x5e')](_0x7e1ed1,_0x5d4350[_0xaa37('0x77')][_0x3b9df9][_0xaa37('0x2c')])&&_0x5d4350[_0xaa37('0x77')][_0x3b9df9]['parentKey']&&_0x5d4350[_0xaa37('0x77')][_0x3b9df9]['foreignTable']&&_0x5d4350[_0xaa37('0x77')][_0x3b9df9][_0xaa37('0x7a')]){_0x310029[_0x5d4350[_0xaa37('0x77')][_0x3b9df9][_0xaa37('0x2c')]](_0x5d4350[_0xaa37('0x77')][_0x3b9df9][_0xaa37('0x79')],null,util[_0xaa37('0x72')]('%s.%s\x20=\x20%s.%s',_0x5d4350[_0xaa37('0x6e')],_0x5d4350[_0xaa37('0x77')][_0x3b9df9][_0xaa37('0x78')],_0x5d4350[_0xaa37('0x77')][_0x3b9df9][_0xaa37('0x79')],_0x5d4350[_0xaa37('0x77')][_0x3b9df9][_0xaa37('0x7a')]));}}}if(_0x5d4350[_0xaa37('0x7b')]){_0x5d4350[_0xaa37('0x7b')]=JSON[_0xaa37('0x7c')](_0x5d4350['conditions']);_0x310029[_0xaa37('0x39')](_0x433a7c(_0x5d4350[_0xaa37('0x7b')][_0xaa37('0x63')]));}_0x541e5b=_0x310029['clone']();_0x310029[_0xaa37('0x1d')](_0x142cbf);_0x310029['offset'](0x0);return;}})[_0xaa37('0x23')](function(){if(_0x178f8b['output']===_0xaa37('0x8c')){return null;}var _0x5466d6=_[_0xaa37('0x3a')](_0x178f8b,{'name':_0x178f8b[_0xaa37('0x8d')]||_0x178f8b[_0xaa37('0x27')]||_0x5d4350[_0xaa37('0x27')],'basename':_0x58f375,'savename':util['format']('%s-%s.%s',_0x178f8b[_0xaa37('0x27')]||_0x5d4350[_0xaa37('0x27')],require(_0xaa37('0x8e'))[_0xaa37('0x8f')](0x4),_0x178f8b['output']||'csv'),'reportId':_0x5d4350['id'],'reportType':_0xaa37('0x90')});return db['AnalyticExtractedReport']['create'](_0x5466d6,{'raw':!![]});})[_0xaa37('0x23')](function(_0x275797){if(_0x5d4350[_0xaa37('0x6e')]===_0xaa37('0x91')){_0x541e5b[_0xaa37('0x39')](_0x5d4350['table']+_0xaa37('0x92'),_0x178f8b[_0xaa37('0x93')],_0x178f8b[_0xaa37('0x94')]);}else{_0x541e5b[_0xaa37('0x39')](_0x5d4350['table']+_0xaa37('0x95'),_0x178f8b[_0xaa37('0x93')],_0x178f8b[_0xaa37('0x94')]);}if(_0x275797){logger['info'](_0xaa37('0x96'),_0x541e5b[_0xaa37('0x80')]());require(_0xaa37('0x97'))['fork'](path[_0xaa37('0x51')](__dirname,_0xaa37('0x98'),_0x275797[_0xaa37('0x99')]),[_0x275797['id'],_0x541e5b[_0xaa37('0x80')](),path[_0xaa37('0x51')](__dirname,'../../files/reports',_0x275797[_0xaa37('0x9a')]),_0x58f375]);return _0x275797;}else{var _0x127238=squel[_0xaa37('0x6c')]();_0x127238[_0xaa37('0x6d')]('('+_0x541e5b[_0xaa37('0x80')]()+')',_0xaa37('0x9b'));_0x127238[_0xaa37('0x64')]('COUNT(*)',_0xaa37('0x3c'));_0x541e5b[_0xaa37('0x1d')](_0x178f8b[_0xaa37('0x1d')]||_0x142cbf);_0x541e5b[_0xaa37('0x1e')](_0x178f8b['offset']||0x0);return dbH['sequelize']['query'](_0x127238[_0xaa37('0x80')](),{'type':dbH[_0xaa37('0x81')]['QueryTypes']['SELECT']})['then'](function(_0x5bf1e4){if(!_0x5bf1e4[_0xaa37('0x35')]){_0x5718c2=0x0;}else{_0x5718c2=_0x5bf1e4[0x0][_0xaa37('0x3c')]||0x0;}return dbH[_0xaa37('0x81')][_0xaa37('0x2f')](_0x541e5b[_0xaa37('0x80')](),{'type':dbH[_0xaa37('0x81')][_0xaa37('0x9c')][_0xaa37('0x82')]});})[_0xaa37('0x23')](function(_0x4adf14){return{'rows':_0x4adf14||[],'count':_0x5718c2};});}});}exports['run']=function(_0x4d477a,_0xa5ef64){return runReport(_0x4d477a[_0xaa37('0x41')],_0x4d477a[_0xaa37('0x2f')],_0x4d477a[_0xaa37('0x3b')])[_0xaa37('0x23')](respondWithResult(_0xa5ef64,null))[_0xaa37('0x3f')](handleError(_0xa5ef64,null));};exports[_0xaa37('0x9d')]=runReport;exports[_0xaa37('0x2f')]=function(_0x2e9e9d,_0x49c7db){var _0x274455=0xa;var _0x25ecf=[_0xaa37('0x51'),'left_join',_0xaa37('0x53'),_0xaa37('0x54')];var _0x3417c8={'SUM':'SUM(%s)','COUNT':_0xaa37('0x56'),'COUNT DISTINCT':_0xaa37('0x57'),'MAX':_0xaa37('0x83'),'MIN':_0xaa37('0x84'),'AVG':_0xaa37('0x58'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xaa37('0x85'),'GROUP_CONCAT DESC':_0xaa37('0x5a')};var _0x6b10d0={'SEC_TO_TIME':_0xaa37('0x5b'),'DATE':_0xaa37('0x86'),'HOUR':_0xaa37('0x87'),'ROUND':_0xaa37('0x5c'),'UNIX_TIMESTAMP':_0xaa37('0x5d')};var _0x58ffb3=function(_0x140000){return!_[_0xaa37('0x5e')]([_0xaa37('0x5f'),'IS\x20NOT\x20NULL',_0xaa37('0x61'),_0xaa37('0x88')],_0x140000);};var _0x173676=function(_0x1210c7){if(!_0x1210c7||!_0x1210c7[_0xaa37('0x62')][_0xaa37('0x35')]){return'';}for(var _0x716aaa='(',_0x1cabb7=0x0;_0x1cabb7<_0x1210c7[_0xaa37('0x62')][_0xaa37('0x35')];_0x1cabb7+=0x1){_0x1cabb7>0x0&&(_0x716aaa+='\x20'+_0x1210c7[_0xaa37('0x89')]+'\x20');_0x716aaa+=_0x1210c7[_0xaa37('0x62')][_0x1cabb7][_0xaa37('0x63')]?_0x173676(_0x1210c7[_0xaa37('0x62')][_0x1cabb7]['group']):_0x1210c7[_0xaa37('0x62')][_0x1cabb7][_0xaa37('0x64')]+'\x20'+_0x1210c7['rules'][_0x1cabb7][_0xaa37('0x65')]+(_0x58ffb3(_0x1210c7[_0xaa37('0x62')][_0x1cabb7][_0xaa37('0x65')])?'\x20'+_0x1210c7[_0xaa37('0x62')][_0x1cabb7][_0xaa37('0x66')]:'');}return _0x716aaa+')';};var _0x5b6050={'where':{'id':_0x2e9e9d[_0xaa37('0x41')]['id']}},_0x546309,_0x54705b,_0x20dd73,_0x2d5ffa,_0x4b318b;_0x5b6050=_[_0xaa37('0x3a')]({},_0x5b6050,_0x2e9e9d[_0xaa37('0x3b')]);return db[_0xaa37('0x43')]['find'](_0x5b6050)[_0xaa37('0x23')](function(_0x34c902){if(_0x34c902){_0x546309=_0x34c902;return _0x34c902[_0xaa37('0x9e')]();}return null;})['then'](function(_0x166ddf){if(_0x166ddf){if(!_0x166ddf['length']){throw new db[(_0xaa37('0x8a'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x54705b=_0x166ddf;return db['AnalyticMetric'][_0xaa37('0x6a')]({'raw':!![]});}return null;})[_0xaa37('0x23')](function(_0x2c27e9){if(_0x2c27e9){_0x20dd73=_['keyBy'](_0x2c27e9,'id');var _0x5d1c5e;var _0x298739=squel[_0xaa37('0x6c')]();_0x298739[_0xaa37('0x6d')](_0x546309[_0xaa37('0x6e')]);for(var _0x5c609b=0x0;_0x5c609b<_0x54705b[_0xaa37('0x35')];_0x5c609b+=0x1){_0x5d1c5e=_0x54705b[_0x5c609b]['MetricId']?_0x20dd73[_0x54705b[_0x5c609b]['MetricId']][_0xaa37('0x70')]:_0x54705b[_0x5c609b][_0xaa37('0x64')];_0x5d1c5e=_0x54705b[_0x5c609b][_0xaa37('0x71')]?_['replace'](_0x3417c8[_0x54705b[_0x5c609b][_0xaa37('0x71')]],'%s',_0x5d1c5e):_0x5d1c5e;_0x5d1c5e=_0x54705b[_0x5c609b]['format']?_['replace'](_0x6b10d0[_0x54705b[_0x5c609b][_0xaa37('0x72')]],'%s',_0x5d1c5e):_0x5d1c5e;if(_0x54705b[_0x5c609b]['groupBy']){_0x298739[_0xaa37('0x63')](_0x5d1c5e);}_0x54705b[_0x5c609b][_0xaa37('0x74')]&&_0x298739[_0xaa37('0x36')](_0x5d1c5e,_0x54705b[_0x5c609b]['orderBy']==='DESC'?![]:!![]);_0x298739[_0xaa37('0x64')](_0x5d1c5e,_0x54705b[_0x5c609b][_0xaa37('0x76')]||_0x5d1c5e);}if(_0x546309['joins']){_0x546309[_0xaa37('0x77')]=JSON[_0xaa37('0x7c')](_0x546309[_0xaa37('0x77')]);for(var _0x4eb9c=0x0;_0x4eb9c<_0x546309['joins'][_0xaa37('0x35')];_0x4eb9c+=0x1){if(_0x546309[_0xaa37('0x77')][_0x4eb9c][_0xaa37('0x2c')]&&_['includes'](_0x25ecf,_0x546309[_0xaa37('0x77')][_0x4eb9c][_0xaa37('0x2c')])&&_0x546309[_0xaa37('0x77')][_0x4eb9c][_0xaa37('0x78')]&&_0x546309[_0xaa37('0x77')][_0x4eb9c]['foreignTable']&&_0x546309['joins'][_0x4eb9c][_0xaa37('0x7a')]){_0x298739[_0x546309['joins'][_0x4eb9c][_0xaa37('0x2c')]](_0x546309['joins'][_0x4eb9c][_0xaa37('0x79')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x546309[_0xaa37('0x6e')],_0x546309[_0xaa37('0x77')][_0x4eb9c]['parentKey'],_0x546309[_0xaa37('0x77')][_0x4eb9c][_0xaa37('0x79')],_0x546309['joins'][_0x4eb9c]['foreignKey']));}}}if(_0x546309[_0xaa37('0x7b')]){_0x546309[_0xaa37('0x7b')]=JSON[_0xaa37('0x7c')](_0x546309[_0xaa37('0x7b')]);_0x298739[_0xaa37('0x39')](_0x173676(_0x546309[_0xaa37('0x7b')][_0xaa37('0x63')]));}_0x4b318b=_0x298739[_0xaa37('0x7d')]();_0x298739[_0xaa37('0x1d')](_0x274455);_0x298739['offset'](0x0);logger[_0xaa37('0x7e')]('Limited\x20Query:',_0x298739[_0xaa37('0x80')]());return dbH[_0xaa37('0x81')]['query'](_0x298739[_0xaa37('0x80')](),{'type':dbH[_0xaa37('0x81')][_0xaa37('0x9c')]['SELECT']});}})[_0xaa37('0x23')](function(){return{'sql':_0x4b318b[_0xaa37('0x80')]()};})[_0xaa37('0x23')](respondWithResult(_0x49c7db,null))['catch'](handleError(_0x49c7db,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index e0933cc..75e2eef 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 _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 +var _0x1ec0=['request-promise','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','lodash','util','../../config/logger','api','bluebird'];(function(_0x1793de,_0x4d7233){var _0x4f0309=function(_0x229ee7){while(--_0x229ee7){_0x1793de['push'](_0x1793de['shift']());}};_0x4f0309(++_0x4d7233);}(_0x1ec0,0x150));var _0x01ec=function(_0x53c9a8,_0x5f3e3f){_0x53c9a8=_0x53c9a8-0x0;var _0x54b73a=_0x1ec0[_0x53c9a8];return _0x54b73a;};'use strict';var _=require(_0x01ec('0x0'));var util=require(_0x01ec('0x1'));var logger=require(_0x01ec('0x2'))(_0x01ec('0x3'));var moment=require('moment');var BPromise=require(_0x01ec('0x4'));var rp=require(_0x01ec('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x01ec('0x6'));var attributes=require(_0x01ec('0x7'));module[_0x01ec('0x8')]=function(_0x7d2b3,_0x3c0ddf){return _0x7d2b3[_0x01ec('0x9')](_0x01ec('0xa'),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 d5e28d9..5c35255 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 _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 +var _0x92dc=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','debug','request\x20sent','stringify','error','code','AnalyticCustomReport,\x20%s,\x20%s','message','result','util','moment'];(function(_0x3765f3,_0x131fb7){var _0x4ed0ed=function(_0xbf05df){while(--_0xbf05df){_0x3765f3['push'](_0x3765f3['shift']());}};_0x4ed0ed(++_0x131fb7);}(_0x92dc,0x1a0));var _0xc92d=function(_0xf97eb0,_0x1578b7){_0xf97eb0=_0xf97eb0-0x0;var _0xea70f4=_0x92dc[_0xf97eb0];return _0xea70f4;};'use strict';var _=require('lodash');var util=require(_0xc92d('0x0'));var moment=require(_0xc92d('0x1'));var BPromise=require(_0xc92d('0x2'));var rs=require(_0xc92d('0x3'));var fs=require('fs');var Redis=require(_0xc92d('0x4'));var db=require(_0xc92d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc92d('0x6'))(_0xc92d('0x7'));var config=require(_0xc92d('0x8'));var jayson=require(_0xc92d('0x9'));var client=jayson[_0xc92d('0xa')][_0xc92d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2f807d,_0x536172,_0x273e2b){return new BPromise(function(_0x907559,_0x1411e2){return client['request'](_0x2f807d,_0x273e2b)[_0xc92d('0xc')](function(_0x3d164b){logger[_0xc92d('0xd')]('AnalyticCustomReport,\x20%s,\x20%s',_0x536172,'request\x20sent');logger[_0xc92d('0xe')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x536172,_0xc92d('0xf'),JSON[_0xc92d('0x10')](_0x3d164b));if(_0x3d164b[_0xc92d('0x11')]){if(_0x3d164b[_0xc92d('0x11')][_0xc92d('0x12')]===0x1f4){logger[_0xc92d('0x11')](_0xc92d('0x13'),_0x536172,_0x3d164b['error'][_0xc92d('0x14')]);return _0x1411e2(_0x3d164b[_0xc92d('0x11')][_0xc92d('0x14')]);}logger[_0xc92d('0x11')](_0xc92d('0x13'),_0x536172,_0x3d164b['error'][_0xc92d('0x14')]);return _0x907559(_0x3d164b[_0xc92d('0x11')][_0xc92d('0x14')]);}else{logger[_0xc92d('0xd')](_0xc92d('0x13'),_0x536172,'request\x20sent');_0x907559(_0x3d164b[_0xc92d('0x15')][_0xc92d('0x14')]);}})['catch'](function(_0x2abbc4){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x536172,_0x2abbc4);_0x1411e2(_0x2abbc4);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 60858b6..d21cd65 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 _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 +var _0xf7c9=['/:id/query','query','put','update','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','index','/:id','isAuthenticated','get','/:id/preview','preview','/:id/run','run'];(function(_0x487939,_0x3d173a){var _0x31e946=function(_0xf0f59a){while(--_0xf0f59a){_0x487939['push'](_0x487939['shift']());}};_0x31e946(++_0x3d173a);}(_0xf7c9,0x176));var _0x9f7c=function(_0x8b13a8,_0xbe1c9e){_0x8b13a8=_0x8b13a8-0x0;var _0x3ee239=_0xf7c9[_0x8b13a8];return _0x3ee239;};'use strict';var multer=require(_0x9f7c('0x0'));var util=require(_0x9f7c('0x1'));var path=require(_0x9f7c('0x2'));var timeout=require(_0x9f7c('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x9f7c('0x4'));var auth=require(_0x9f7c('0x5'));var interaction=require(_0x9f7c('0x6'));var config=require(_0x9f7c('0x7'));var controller=require(_0x9f7c('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x9f7c('0x9')]);router['get'](_0x9f7c('0xa'),auth[_0x9f7c('0xb')](),controller['show']);router[_0x9f7c('0xc')](_0x9f7c('0xd'),auth['isAuthenticated'](),controller[_0x9f7c('0xe')]);router[_0x9f7c('0xc')](_0x9f7c('0xf'),auth[_0x9f7c('0xb')](),controller[_0x9f7c('0x10')]);router[_0x9f7c('0xc')](_0x9f7c('0x11'),auth[_0x9f7c('0xb')](),controller[_0x9f7c('0x12')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x9f7c('0x13')]('/:id',auth[_0x9f7c('0xb')](),controller[_0x9f7c('0x14')]);router[_0x9f7c('0x15')](_0x9f7c('0xa'),auth[_0x9f7c('0xb')](),controller['destroy']);module[_0x9f7c('0x16')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 612aa51..64f7fce 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 _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 +var _0x98a8=['sequelize','exports','STRING','TEXT'];(function(_0x15c094,_0x320232){var _0x529747=function(_0x3a247a){while(--_0x3a247a){_0x15c094['push'](_0x15c094['shift']());}};_0x529747(++_0x320232);}(_0x98a8,0x12c));var _0x898a=function(_0xdcbf9c,_0x27dc38){_0xdcbf9c=_0xdcbf9c-0x0;var _0x25e652=_0x98a8[_0xdcbf9c];return _0x25e652;};'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 diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 77edc0a..9fe9123 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 _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 +var _0x1cb9=['runReport','left_join','SEC_TO_TIME(%s)','IS\x20NULL','clone','debug','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','limit','undefined','count','status','set','apply','reject','then','destroy','get','UserProfileResource','stack','name','send','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','catch','body','user','role','autoAssociation','create','DefaultReports','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','orderBy','order','DESC','joins','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','COUNT(%s)','GROUP_CONCAT(%s)','HOUR(%s)','value','groupBy','alias','output','fullPath','%s-%s.%s','randomstring','generate','csv','default','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)'];(function(_0x2c5337,_0x49f3bc){var _0x2ca8a8=function(_0x5d3c92){while(--_0x5d3c92){_0x2c5337['push'](_0x2c5337['shift']());}};_0x2ca8a8(++_0x49f3bc);}(_0x1cb9,0x14e));var _0x91cb=function(_0x15bd49,_0x44c1d5){_0x15bd49=_0x15bd49-0x0;var _0x431e6f=_0x1cb9[_0x15bd49];return _0x431e6f;};'use strict';var emlformat=require(_0x91cb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x91cb('0x1'));var jsonpatch=require(_0x91cb('0x2'));var rp=require(_0x91cb('0x3'));var moment=require(_0x91cb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x91cb('0x5'));var util=require(_0x91cb('0x6'));var path=require('path');var sox=require(_0x91cb('0x7'));var csv=require(_0x91cb('0x8'));var ejs=require(_0x91cb('0x9'));var fs=require('fs');var fs_extra=require(_0x91cb('0xa'));var _=require(_0x91cb('0xb'));var squel=require(_0x91cb('0xc'));var crypto=require('crypto');var jsforce=require(_0x91cb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x91cb('0x8'));var querystring=require('querystring');var Papa=require(_0x91cb('0xe'));var Redis=require(_0x91cb('0xf'));var authService=require(_0x91cb('0x10'));var qs=require(_0x91cb('0x11'));var as=require(_0x91cb('0x12'));var hardwareService=require(_0x91cb('0x13'));var logger=require(_0x91cb('0x14'))(_0x91cb('0x15'));var utils=require(_0x91cb('0x16'));var config=require(_0x91cb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x91cb('0x18'))['db'];var dbH=require(_0x91cb('0x18'))['dbH'];function respondWithStatusCode(_0x20e6e0,_0x3ea707){_0x3ea707=_0x3ea707||0xcc;return function(_0x44f2e9){if(_0x44f2e9){return _0x20e6e0[_0x91cb('0x19')](_0x3ea707);}return _0x20e6e0['status'](_0x3ea707)['end']();};}function respondWithResult(_0x4aae25,_0x3d22b7){_0x3d22b7=_0x3d22b7||0xc8;return function(_0x585470){if(_0x585470){return _0x4aae25['status'](_0x3d22b7)[_0x91cb('0x1a')](_0x585470);}};}function respondWithFilteredResult(_0xc3629e,_0x347980){return function(_0x5ea796){if(_0x5ea796){var _0x238f11=typeof _0x347980[_0x91cb('0x1b')]==='undefined'&&typeof _0x347980[_0x91cb('0x1c')]===_0x91cb('0x1d');var _0x1cd34b=_0x5ea796[_0x91cb('0x1e')];var _0x5cc1c3=_0x238f11?0x0:_0x347980[_0x91cb('0x1b')];var _0x7dcf60=_0x238f11?_0x5ea796['count']:_0x347980[_0x91cb('0x1b')]+_0x347980['limit'];var _0x55042a;if(_0x7dcf60>=_0x1cd34b){_0x7dcf60=_0x1cd34b;_0x55042a=0xc8;}else{_0x55042a=0xce;}_0xc3629e[_0x91cb('0x1f')](_0x55042a);return _0xc3629e[_0x91cb('0x20')]('Content-Range',_0x5cc1c3+'-'+_0x7dcf60+'/'+_0x1cd34b)['json'](_0x5ea796);}return null;};}function patchUpdates(_0x5b385a){return function(_0x438162){try{jsonpatch[_0x91cb('0x21')](_0x438162,_0x5b385a,!![]);}catch(_0x20aff5){return BPromise[_0x91cb('0x22')](_0x20aff5);}return _0x438162['save']();};}function saveUpdates(_0x45c4b3,_0x43881c){return function(_0x1fa837){if(_0x1fa837){return _0x1fa837['update'](_0x45c4b3)[_0x91cb('0x23')](function(_0x1a7a54){return _0x1a7a54;});}return null;};}function removeEntity(_0x2447e7,_0x422d14){return function(_0x3ca500){if(_0x3ca500){return _0x3ca500[_0x91cb('0x24')]()[_0x91cb('0x23')](function(){var _0x423c4f=_0x3ca500[_0x91cb('0x25')]({'plain':!![]});var _0x4c8438='DefaultReports';return db[_0x91cb('0x26')]['destroy']({'where':{'type':_0x4c8438,'resourceId':_0x423c4f['id']}})[_0x91cb('0x23')](function(){return _0x3ca500;});})[_0x91cb('0x23')](function(){_0x2447e7[_0x91cb('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9b26a6,_0x4f5a7b){return function(_0x4572f6){if(!_0x4572f6){_0x9b26a6[_0x91cb('0x19')](0x194);}return _0x4572f6;};}function handleError(_0x3b3ee6,_0x2fb473){_0x2fb473=_0x2fb473||0x1f4;return function(_0x468908){logger['error'](_0x468908[_0x91cb('0x27')]);if(_0x468908['name']){delete _0x468908[_0x91cb('0x28')];}_0x3b3ee6[_0x91cb('0x1f')](_0x2fb473)[_0x91cb('0x29')](_0x468908);};}exports['index']=function(_0x775c25,_0x146e1f){var _0x25bbf9={},_0x361e4c={},_0xf296bc={'count':0x0,'rows':[]};var _0x3dab18=_[_0x91cb('0x2a')](db[_0x91cb('0x2b')][_0x91cb('0x2c')],function(_0x5e6ed3){return{'name':_0x5e6ed3[_0x91cb('0x2d')],'type':_0x5e6ed3[_0x91cb('0x2e')][_0x91cb('0x2f')]};});_0x361e4c[_0x91cb('0x30')]=_[_0x91cb('0x2a')](_0x3dab18,'name');_0x361e4c[_0x91cb('0x31')]=_[_0x91cb('0x32')](_0x775c25[_0x91cb('0x31')]);_0x361e4c[_0x91cb('0x33')]=_[_0x91cb('0x34')](_0x361e4c['model'],_0x361e4c[_0x91cb('0x31')]);_0x25bbf9['attributes']=_['intersection'](_0x361e4c['model'],qs[_0x91cb('0x35')](_0x775c25['query'][_0x91cb('0x35')]));_0x25bbf9['attributes']=_0x25bbf9['attributes'][_0x91cb('0x36')]?_0x25bbf9[_0x91cb('0x37')]:_0x361e4c[_0x91cb('0x30')];if(!_0x775c25[_0x91cb('0x31')][_0x91cb('0x38')]('nolimit')){_0x25bbf9[_0x91cb('0x1c')]=qs[_0x91cb('0x1c')](_0x775c25[_0x91cb('0x31')][_0x91cb('0x1c')]);_0x25bbf9['offset']=qs['offset'](_0x775c25[_0x91cb('0x31')][_0x91cb('0x1b')]);}_0x25bbf9['order']=qs[_0x91cb('0x39')](_0x775c25[_0x91cb('0x31')]['sort']);_0x25bbf9[_0x91cb('0x3a')]=qs[_0x91cb('0x33')](_['pick'](_0x775c25[_0x91cb('0x31')],_0x361e4c['filters']),_0x3dab18);if(_0x775c25[_0x91cb('0x31')][_0x91cb('0x3b')]){_0x25bbf9[_0x91cb('0x3a')]=_[_0x91cb('0x3c')](_0x25bbf9[_0x91cb('0x3a')],{'$or':_[_0x91cb('0x2a')](_0x3dab18,function(_0x5d0e37){if(_0x5d0e37[_0x91cb('0x2e')]!==_0x91cb('0x3d')){var _0x4e5b4b={};_0x4e5b4b[_0x5d0e37[_0x91cb('0x28')]]={'$like':'%'+_0x775c25['query'][_0x91cb('0x3b')]+'%'};return _0x4e5b4b;}})});}_0x25bbf9=_[_0x91cb('0x3c')]({},_0x25bbf9,_0x775c25[_0x91cb('0x3e')]);var _0x174794={'where':_0x25bbf9['where']};return db[_0x91cb('0x2b')][_0x91cb('0x1e')](_0x174794)[_0x91cb('0x23')](function(_0x37e777){_0xf296bc[_0x91cb('0x1e')]=_0x37e777;if(_0x775c25[_0x91cb('0x31')][_0x91cb('0x3f')]){_0x25bbf9[_0x91cb('0x40')]=[{'all':!![]}];}return db[_0x91cb('0x2b')][_0x91cb('0x41')](_0x25bbf9);})['then'](function(_0x16993f){_0xf296bc['rows']=_0x16993f;return _0xf296bc;})[_0x91cb('0x23')](respondWithFilteredResult(_0x146e1f,_0x25bbf9))['catch'](handleError(_0x146e1f,null));};exports[_0x91cb('0x42')]=function(_0x52e82c,_0x138f48){var _0x477131={'raw':!![],'where':{'id':_0x52e82c[_0x91cb('0x43')]['id']}},_0xba99ce={};_0xba99ce['model']=_[_0x91cb('0x32')](db[_0x91cb('0x2b')]['rawAttributes']);_0xba99ce[_0x91cb('0x31')]=_[_0x91cb('0x32')](_0x52e82c[_0x91cb('0x31')]);_0xba99ce[_0x91cb('0x33')]=_[_0x91cb('0x34')](_0xba99ce[_0x91cb('0x30')],_0xba99ce[_0x91cb('0x31')]);_0x477131[_0x91cb('0x37')]=_[_0x91cb('0x34')](_0xba99ce['model'],qs[_0x91cb('0x35')](_0x52e82c[_0x91cb('0x31')][_0x91cb('0x35')]));_0x477131[_0x91cb('0x37')]=_0x477131[_0x91cb('0x37')][_0x91cb('0x36')]?_0x477131[_0x91cb('0x37')]:_0xba99ce[_0x91cb('0x30')];if(_0x52e82c['query'][_0x91cb('0x3f')]){_0x477131[_0x91cb('0x40')]=[{'all':!![]}];}_0x477131=_[_0x91cb('0x3c')]({},_0x477131,_0x52e82c[_0x91cb('0x3e')]);return db['AnalyticDefaultReport'][_0x91cb('0x44')](_0x477131)[_0x91cb('0x23')](handleEntityNotFound(_0x138f48,null))['then'](respondWithResult(_0x138f48,null))[_0x91cb('0x45')](handleError(_0x138f48,null));};exports['create']=function(_0x2c419b,_0x4c0acd){return db['AnalyticDefaultReport']['create'](_0x2c419b[_0x91cb('0x46')],{})[_0x91cb('0x23')](function(_0x3d62c4){var _0x2f8384=_0x2c419b[_0x91cb('0x47')]['get']({'plain':!![]});if(!_0x2f8384)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2f8384[_0x91cb('0x48')]===_0x91cb('0x47')){var _0x140994=_0x3d62c4[_0x91cb('0x25')]({'plain':!![]});var _0x57adff='Reports';return db['UserProfileSection'][_0x91cb('0x44')]({'where':{'name':_0x57adff,'userProfileId':_0x2f8384['userProfileId']},'raw':!![]})[_0x91cb('0x23')](function(_0x4aa670){if(_0x4aa670&&_0x4aa670[_0x91cb('0x49')]===0x0){return db[_0x91cb('0x26')][_0x91cb('0x4a')]({'name':_0x140994[_0x91cb('0x28')],'resourceId':_0x140994['id'],'type':_0x91cb('0x4b'),'sectionId':_0x4aa670['id']},{})[_0x91cb('0x23')](function(){return _0x3d62c4;});}else{return _0x3d62c4;}})[_0x91cb('0x45')](function(_0x30fd4e){logger[_0x91cb('0x4c')](_0x91cb('0x4d'),_0x30fd4e);throw _0x30fd4e;});}return _0x3d62c4;})[_0x91cb('0x23')](respondWithResult(_0x4c0acd,0xc9))['catch'](handleError(_0x4c0acd,null));};exports[_0x91cb('0x4e')]=function(_0x1fa45a,_0x4d7a34){if(_0x1fa45a[_0x91cb('0x46')]['id']){delete _0x1fa45a[_0x91cb('0x46')]['id'];}return db['AnalyticDefaultReport'][_0x91cb('0x44')]({'where':{'id':_0x1fa45a[_0x91cb('0x43')]['id']}})[_0x91cb('0x23')](handleEntityNotFound(_0x4d7a34,null))[_0x91cb('0x23')](saveUpdates(_0x1fa45a[_0x91cb('0x46')],null))[_0x91cb('0x23')](respondWithResult(_0x4d7a34,null))[_0x91cb('0x45')](handleError(_0x4d7a34,null));};exports[_0x91cb('0x24')]=function(_0x3320bd,_0x93ef52){return db[_0x91cb('0x2b')]['find']({'where':{'id':_0x3320bd[_0x91cb('0x43')]['id']}})['then'](handleEntityNotFound(_0x93ef52,null))[_0x91cb('0x23')](removeEntity(_0x93ef52,null))['catch'](handleError(_0x93ef52,null));};exports[_0x91cb('0x4f')]=function(_0x1b2fec,_0x1986d7){var _0x47a6cd=0xa;var _0xe49d42=[_0x91cb('0x50'),'left_join',_0x91cb('0x51'),_0x91cb('0x52')];var _0x365afd={'SUM':_0x91cb('0x53'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x91cb('0x54'),'MAX':_0x91cb('0x55'),'MIN':_0x91cb('0x56'),'AVG':_0x91cb('0x57'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x91cb('0x58'),'GROUP_CONCAT DESC':_0x91cb('0x59')};var _0x5c2c01={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x91cb('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x91cb('0x5b'),'UNIX_TIMESTAMP':_0x91cb('0x5c')};var _0x5ae0d2=function(_0x4f19c8){return!_[_0x91cb('0x5d')](['IS\x20NULL',_0x91cb('0x5e'),_0x91cb('0x5f'),_0x91cb('0x60')],_0x4f19c8);};var _0x551836=function(_0x22fea8){if(!_0x22fea8||!_0x22fea8['rules'][_0x91cb('0x36')]){return'';}for(var _0xe08233='(',_0xd7be15=0x0;_0xd7be15<_0x22fea8[_0x91cb('0x61')]['length'];_0xd7be15+=0x1){_0xd7be15>0x0&&(_0xe08233+='\x20'+_0x22fea8[_0x91cb('0x62')]+'\x20');_0xe08233+=_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x63')]?_0x551836(_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x63')]):_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x64')]+'\x20'+_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x65')]+(_0x5ae0d2(_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x65')])?'\x20'+_0x22fea8[_0x91cb('0x61')][_0xd7be15]['value']:'');}return _0xe08233+')';};var _0x2cf4d0={'where':{'id':_0x1b2fec[_0x91cb('0x43')]['id']}},_0x2e301a,_0x474682,_0x51ab8a,_0x21c890,_0xca33a2;_0x2cf4d0=_['merge']({},_0x2cf4d0,_0x1b2fec[_0x91cb('0x3e')]);return db['AnalyticDefaultReport'][_0x91cb('0x44')](_0x2cf4d0)[_0x91cb('0x23')](function(_0x80fcc6){if(_0x80fcc6){_0x2e301a=_0x80fcc6;return _0x80fcc6[_0x91cb('0x66')]();}return null;})['then'](function(_0x1c0b66){if(_0x1c0b66){if(!_0x1c0b66[_0x91cb('0x36')]){throw new db[(_0x91cb('0x67'))][(_0x91cb('0x68'))](_0x91cb('0x69'),0x193);}_0x474682=_0x1c0b66;return db[_0x91cb('0x6a')]['findAll']({'raw':!![]});}return null;})[_0x91cb('0x23')](function(_0x28bfe5){if(_0x28bfe5){_0x51ab8a=_[_0x91cb('0x6b')](_0x28bfe5,'id');var _0x1f0ba2;var _0x891569=squel[_0x91cb('0x6c')]();_0x891569[_0x91cb('0x6d')](_0x2e301a[_0x91cb('0x6e')]);for(var _0x43629b=0x0;_0x43629b<_0x474682[_0x91cb('0x36')];_0x43629b+=0x1){_0x1f0ba2=_0x474682[_0x43629b][_0x91cb('0x6f')]?_0x51ab8a[_0x474682[_0x43629b][_0x91cb('0x6f')]][_0x91cb('0x70')]:_0x474682[_0x43629b][_0x91cb('0x64')];_0x1f0ba2=_0x474682[_0x43629b][_0x91cb('0x71')]?_[_0x91cb('0x72')](_0x365afd[_0x474682[_0x43629b][_0x91cb('0x71')]],'%s',_0x1f0ba2):_0x1f0ba2;_0x1f0ba2=_0x474682[_0x43629b]['format']?_[_0x91cb('0x72')](_0x5c2c01[_0x474682[_0x43629b][_0x91cb('0x73')]],'%s',_0x1f0ba2):_0x1f0ba2;if(_0x474682[_0x43629b]['groupBy']){_0x891569[_0x91cb('0x63')](_0x1f0ba2);}_0x474682[_0x43629b][_0x91cb('0x74')]&&_0x891569[_0x91cb('0x75')](_0x1f0ba2,_0x474682[_0x43629b]['orderBy']===_0x91cb('0x76')?![]:!![]);_0x891569[_0x91cb('0x64')](_0x1f0ba2,_0x474682[_0x43629b]['alias']||_0x1f0ba2);}if(_0x2e301a['joins']){_0x2e301a[_0x91cb('0x77')]=JSON['parse'](_0x2e301a[_0x91cb('0x77')]);for(var _0x376f56=0x0;_0x376f56<_0x2e301a['joins'][_0x91cb('0x36')];_0x376f56+=0x1){if(_0x2e301a['joins'][_0x376f56][_0x91cb('0x2e')]&&_[_0x91cb('0x5d')](_0xe49d42,_0x2e301a['joins'][_0x376f56]['type'])&&_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x78')]&&_0x2e301a[_0x91cb('0x77')][_0x376f56]['foreignTable']&&_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x79')]){_0x891569[_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x2e')]](_0x2e301a['joins'][_0x376f56][_0x91cb('0x7a')],null,util['format'](_0x91cb('0x7b'),_0x2e301a[_0x91cb('0x6e')],_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x78')],_0x2e301a['joins'][_0x376f56]['foreignTable'],_0x2e301a[_0x91cb('0x77')][_0x376f56]['foreignKey']));}}}if(_0x2e301a[_0x91cb('0x7c')]){_0x2e301a[_0x91cb('0x7c')]=JSON[_0x91cb('0x7d')](_0x2e301a[_0x91cb('0x7c')]);_0x891569[_0x91cb('0x3a')](_0x551836(_0x2e301a[_0x91cb('0x7c')][_0x91cb('0x63')]));}_0xca33a2=_0x891569['clone']();_0x891569[_0x91cb('0x1c')](_0x47a6cd);_0x891569[_0x91cb('0x1b')](0x0);logger['debug'](_0x91cb('0x7e'),_0x891569['toString']());return dbH[_0x91cb('0x7f')][_0x91cb('0x31')](_0x891569[_0x91cb('0x80')](),{'type':dbH[_0x91cb('0x7f')][_0x91cb('0x81')][_0x91cb('0x82')]});}})[_0x91cb('0x23')](respondWithResult(_0x1986d7,null))[_0x91cb('0x45')](handleError(_0x1986d7,null));};function runReport(_0x23380a,_0x14cad8,_0x20a64f){var _0x11411d=_0x14cad8[_0x91cb('0x28')];var _0x14882d=0xa;var _0x22ba54=[_0x91cb('0x50'),'left_join',_0x91cb('0x51'),'cross_join'];var _0x1235c0={'SUM':_0x91cb('0x53'),'COUNT':_0x91cb('0x83'),'COUNT DISTINCT':_0x91cb('0x54'),'MAX':_0x91cb('0x55'),'MIN':_0x91cb('0x56'),'AVG':_0x91cb('0x57'),'GROUP_CONCAT':_0x91cb('0x84'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x91cb('0x59')};var _0xdee7f={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x91cb('0x85'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x95f2de=function(_0x4d777a){return!_[_0x91cb('0x5d')](['IS\x20NULL',_0x91cb('0x5e'),_0x91cb('0x5f'),_0x91cb('0x60')],_0x4d777a);};var _0x443c01=function(_0x4e899c){if(!_0x4e899c||!_0x4e899c[_0x91cb('0x61')][_0x91cb('0x36')]){return'';}for(var _0x42d07b='(',_0x427afd=0x0;_0x427afd<_0x4e899c[_0x91cb('0x61')][_0x91cb('0x36')];_0x427afd+=0x1){_0x427afd>0x0&&(_0x42d07b+='\x20'+_0x4e899c[_0x91cb('0x62')]+'\x20');_0x42d07b+=_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x63')]?_0x443c01(_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x63')]):_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x64')]+'\x20'+_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x65')]+(_0x95f2de(_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x65')])?'\x20'+_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x86')]:'');}return _0x42d07b+')';};var _0x39b5bd={'where':{'id':_0x23380a['id']}},_0x315518,_0x3d944d,_0x43b96c,_0xe4d946,_0x32d426;_0x39b5bd=_['merge']({},_0x39b5bd,_0x20a64f);return db[_0x91cb('0x2b')][_0x91cb('0x44')](_0x39b5bd)[_0x91cb('0x23')](function(_0x1a654b){if(_0x1a654b){_0x315518=_0x1a654b;return _0x1a654b[_0x91cb('0x66')]();}return null;})[_0x91cb('0x23')](function(_0x404457){if(_0x404457){if(!_0x404457[_0x91cb('0x36')]){throw new db[(_0x91cb('0x67'))][(_0x91cb('0x68'))](_0x91cb('0x69'),0x193);}_0x3d944d=_0x404457;return db['AnalyticMetric'][_0x91cb('0x41')]({'raw':!![]});}return null;})['then'](function(_0x5689ea){if(_0x5689ea){_0x43b96c=_[_0x91cb('0x6b')](_0x5689ea,'id');var _0x265ffb;var _0x4f66f=squel[_0x91cb('0x6c')]();_0x4f66f[_0x91cb('0x6d')](_0x315518[_0x91cb('0x6e')]);for(var _0x210b46=0x0;_0x210b46<_0x3d944d[_0x91cb('0x36')];_0x210b46+=0x1){_0x265ffb=_0x3d944d[_0x210b46][_0x91cb('0x6f')]?_0x43b96c[_0x3d944d[_0x210b46][_0x91cb('0x6f')]]['metric']:_0x3d944d[_0x210b46][_0x91cb('0x64')];_0x265ffb=_0x3d944d[_0x210b46][_0x91cb('0x71')]?_['replace'](_0x1235c0[_0x3d944d[_0x210b46][_0x91cb('0x71')]],'%s',_0x265ffb):_0x265ffb;_0x265ffb=_0x3d944d[_0x210b46][_0x91cb('0x73')]?_['replace'](_0xdee7f[_0x3d944d[_0x210b46][_0x91cb('0x73')]],'%s',_0x265ffb):_0x265ffb;if(_0x3d944d[_0x210b46][_0x91cb('0x87')]){_0x4f66f[_0x91cb('0x63')](_0x265ffb);}_0x3d944d[_0x210b46][_0x91cb('0x74')]&&_0x4f66f[_0x91cb('0x75')](_0x265ffb,_0x3d944d[_0x210b46][_0x91cb('0x74')]===_0x91cb('0x76')?![]:!![]);_0x4f66f[_0x91cb('0x64')](_0x265ffb,_0x3d944d[_0x210b46][_0x91cb('0x88')]||_0x265ffb);}if(_0x315518[_0x91cb('0x77')]){_0x315518[_0x91cb('0x77')]=JSON[_0x91cb('0x7d')](_0x315518['joins']);for(var _0x5c0725=0x0;_0x5c0725<_0x315518[_0x91cb('0x77')][_0x91cb('0x36')];_0x5c0725+=0x1){if(_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x2e')]&&_[_0x91cb('0x5d')](_0x22ba54,_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x2e')])&&_0x315518['joins'][_0x5c0725][_0x91cb('0x78')]&&_0x315518['joins'][_0x5c0725][_0x91cb('0x7a')]&&_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x79')]){_0x4f66f[_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x2e')]](_0x315518['joins'][_0x5c0725][_0x91cb('0x7a')],null,util[_0x91cb('0x73')](_0x91cb('0x7b'),_0x315518[_0x91cb('0x6e')],_0x315518[_0x91cb('0x77')][_0x5c0725]['parentKey'],_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x7a')],_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x79')]));}}}if(_0x315518['conditions']){_0x315518['conditions']=JSON['parse'](_0x315518[_0x91cb('0x7c')]);_0x4f66f[_0x91cb('0x3a')](_0x443c01(_0x315518[_0x91cb('0x7c')][_0x91cb('0x63')]));}_0x32d426=_0x4f66f['clone']();_0x4f66f[_0x91cb('0x1c')](_0x14882d);_0x4f66f[_0x91cb('0x1b')](0x0);return;}})[_0x91cb('0x23')](function(){if(_0x14cad8[_0x91cb('0x89')]==='web'){return null;}var _0x4bf7c7=_[_0x91cb('0x3c')](_0x14cad8,{'name':_0x14cad8[_0x91cb('0x8a')]||_0x14cad8[_0x91cb('0x28')]||_0x315518[_0x91cb('0x28')],'basename':_0x11411d,'savename':util[_0x91cb('0x73')](_0x91cb('0x8b'),_0x14cad8[_0x91cb('0x28')]||_0x315518[_0x91cb('0x28')],require(_0x91cb('0x8c'))[_0x91cb('0x8d')](0x4),_0x14cad8[_0x91cb('0x89')]||_0x91cb('0x8e')),'reportId':_0x315518['id'],'reportType':_0x91cb('0x8f')});return db['AnalyticExtractedReport']['create'](_0x4bf7c7,{'raw':!![]});})[_0x91cb('0x23')](function(_0x48a910){if(_0x315518[_0x91cb('0x6e')]===_0x91cb('0x90')){_0x32d426[_0x91cb('0x3a')](_0x315518[_0x91cb('0x6e')]+_0x91cb('0x91'),_0x14cad8[_0x91cb('0x92')],_0x14cad8[_0x91cb('0x93')]);}else{_0x32d426[_0x91cb('0x3a')](_0x315518['table']+_0x91cb('0x94'),_0x14cad8[_0x91cb('0x92')],_0x14cad8[_0x91cb('0x93')]);}if(_0x48a910){logger[_0x91cb('0x95')](_0x91cb('0x96'),_0x32d426['toString']());require(_0x91cb('0x97'))[_0x91cb('0x98')](path[_0x91cb('0x50')](__dirname,_0x91cb('0x99'),_0x48a910[_0x91cb('0x89')]),[_0x48a910['id'],_0x32d426['toString'](),path[_0x91cb('0x50')](__dirname,_0x91cb('0x9a'),_0x48a910[_0x91cb('0x9b')]),_0x11411d]);return _0x48a910;}else{var _0x22b6d3=squel[_0x91cb('0x6c')]();_0x22b6d3[_0x91cb('0x6d')]('('+_0x32d426[_0x91cb('0x80')]()+')',_0x91cb('0x9c'));_0x22b6d3[_0x91cb('0x64')](_0x91cb('0x9d'),_0x91cb('0x1e'));_0x32d426[_0x91cb('0x1c')](_0x14cad8[_0x91cb('0x1c')]||_0x14882d);_0x32d426[_0x91cb('0x1b')](_0x14cad8[_0x91cb('0x1b')]||0x0);return dbH[_0x91cb('0x7f')][_0x91cb('0x31')](_0x22b6d3[_0x91cb('0x80')](),{'type':dbH[_0x91cb('0x7f')][_0x91cb('0x81')][_0x91cb('0x82')]})[_0x91cb('0x23')](function(_0x275c80){if(!_0x275c80[_0x91cb('0x36')]){_0xe4d946=0x0;}else{_0xe4d946=_0x275c80[0x0][_0x91cb('0x1e')]||0x0;}return dbH[_0x91cb('0x7f')]['query'](_0x32d426[_0x91cb('0x80')](),{'type':dbH[_0x91cb('0x7f')][_0x91cb('0x81')][_0x91cb('0x82')]});})[_0x91cb('0x23')](function(_0x5ca377){return{'rows':_0x5ca377||[],'count':_0xe4d946};});}});}exports['run']=function(_0x552490,_0x5174ac){return runReport(_0x552490['params'],_0x552490[_0x91cb('0x31')],_0x552490[_0x91cb('0x3e')])[_0x91cb('0x23')](respondWithResult(_0x5174ac,null))[_0x91cb('0x45')](handleError(_0x5174ac,null));};exports[_0x91cb('0x9e')]=runReport;exports[_0x91cb('0x31')]=function(_0x3462c5,_0x146346){var _0xe3d97f=0xa;var _0x3b93c3=['join',_0x91cb('0x9f'),_0x91cb('0x51'),'cross_join'];var _0x154e6a={'SUM':_0x91cb('0x53'),'COUNT':_0x91cb('0x83'),'COUNT DISTINCT':_0x91cb('0x54'),'MAX':_0x91cb('0x55'),'MIN':_0x91cb('0x56'),'AVG':_0x91cb('0x57'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x91cb('0x58'),'GROUP_CONCAT DESC':_0x91cb('0x59')};var _0x2a05af={'SEC_TO_TIME':_0x91cb('0xa0'),'DATE':_0x91cb('0x5a'),'HOUR':_0x91cb('0x85'),'ROUND':_0x91cb('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x34c1f2=function(_0x4d82b4){return!_[_0x91cb('0x5d')]([_0x91cb('0xa1'),_0x91cb('0x5e'),_0x91cb('0x5f'),_0x91cb('0x60')],_0x4d82b4);};var _0x432099=function(_0x344c95){if(!_0x344c95||!_0x344c95[_0x91cb('0x61')][_0x91cb('0x36')]){return'';}for(var _0x570cf0='(',_0xb3a6c4=0x0;_0xb3a6c4<_0x344c95[_0x91cb('0x61')][_0x91cb('0x36')];_0xb3a6c4+=0x1){_0xb3a6c4>0x0&&(_0x570cf0+='\x20'+_0x344c95[_0x91cb('0x62')]+'\x20');_0x570cf0+=_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x63')]?_0x432099(_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x63')]):_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x64')]+'\x20'+_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x65')]+(_0x34c1f2(_0x344c95[_0x91cb('0x61')][_0xb3a6c4]['condition'])?'\x20'+_0x344c95[_0x91cb('0x61')][_0xb3a6c4]['value']:'');}return _0x570cf0+')';};var _0x39ba62={'where':{'id':_0x3462c5[_0x91cb('0x43')]['id']}},_0x2ab5a3,_0x10a9f6,_0x43ad75,_0x1382ba,_0x12da14;_0x39ba62=_[_0x91cb('0x3c')]({},_0x39ba62,_0x3462c5['options']);return db[_0x91cb('0x2b')]['find'](_0x39ba62)[_0x91cb('0x23')](function(_0x2f7387){if(_0x2f7387){_0x2ab5a3=_0x2f7387;return _0x2f7387[_0x91cb('0x66')]();}return null;})['then'](function(_0x1f2ef8){if(_0x1f2ef8){if(!_0x1f2ef8[_0x91cb('0x36')]){throw new db[(_0x91cb('0x67'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x10a9f6=_0x1f2ef8;return db['AnalyticMetric'][_0x91cb('0x41')]({'raw':!![]});}return null;})[_0x91cb('0x23')](function(_0x3ac830){if(_0x3ac830){_0x43ad75=_['keyBy'](_0x3ac830,'id');var _0x469e62;var _0x1e9441=squel[_0x91cb('0x6c')]();_0x1e9441[_0x91cb('0x6d')](_0x2ab5a3[_0x91cb('0x6e')]);for(var _0x416390=0x0;_0x416390<_0x10a9f6[_0x91cb('0x36')];_0x416390+=0x1){_0x469e62=_0x10a9f6[_0x416390][_0x91cb('0x6f')]?_0x43ad75[_0x10a9f6[_0x416390]['MetricId']][_0x91cb('0x70')]:_0x10a9f6[_0x416390][_0x91cb('0x64')];_0x469e62=_0x10a9f6[_0x416390][_0x91cb('0x71')]?_[_0x91cb('0x72')](_0x154e6a[_0x10a9f6[_0x416390]['function']],'%s',_0x469e62):_0x469e62;_0x469e62=_0x10a9f6[_0x416390][_0x91cb('0x73')]?_['replace'](_0x2a05af[_0x10a9f6[_0x416390][_0x91cb('0x73')]],'%s',_0x469e62):_0x469e62;if(_0x10a9f6[_0x416390][_0x91cb('0x87')]){_0x1e9441[_0x91cb('0x63')](_0x469e62);}_0x10a9f6[_0x416390][_0x91cb('0x74')]&&_0x1e9441[_0x91cb('0x75')](_0x469e62,_0x10a9f6[_0x416390]['orderBy']===_0x91cb('0x76')?![]:!![]);_0x1e9441['field'](_0x469e62,_0x10a9f6[_0x416390]['alias']||_0x469e62);}if(_0x2ab5a3[_0x91cb('0x77')]){_0x2ab5a3[_0x91cb('0x77')]=JSON[_0x91cb('0x7d')](_0x2ab5a3[_0x91cb('0x77')]);for(var _0x286ed7=0x0;_0x286ed7<_0x2ab5a3[_0x91cb('0x77')][_0x91cb('0x36')];_0x286ed7+=0x1){if(_0x2ab5a3[_0x91cb('0x77')][_0x286ed7]['type']&&_[_0x91cb('0x5d')](_0x3b93c3,_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x2e')])&&_0x2ab5a3['joins'][_0x286ed7]['parentKey']&&_0x2ab5a3['joins'][_0x286ed7][_0x91cb('0x7a')]&&_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x79')]){_0x1e9441[_0x2ab5a3['joins'][_0x286ed7][_0x91cb('0x2e')]](_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x7a')],null,util[_0x91cb('0x73')]('%s.%s\x20=\x20%s.%s',_0x2ab5a3[_0x91cb('0x6e')],_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x78')],_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x7a')],_0x2ab5a3[_0x91cb('0x77')][_0x286ed7]['foreignKey']));}}}if(_0x2ab5a3[_0x91cb('0x7c')]){_0x2ab5a3[_0x91cb('0x7c')]=JSON[_0x91cb('0x7d')](_0x2ab5a3[_0x91cb('0x7c')]);_0x1e9441[_0x91cb('0x3a')](_0x432099(_0x2ab5a3['conditions'][_0x91cb('0x63')]));}_0x12da14=_0x1e9441[_0x91cb('0xa2')]();_0x1e9441[_0x91cb('0x1c')](_0xe3d97f);_0x1e9441[_0x91cb('0x1b')](0x0);logger[_0x91cb('0xa3')](_0x91cb('0x7e'),_0x1e9441['toString']());return dbH[_0x91cb('0x7f')][_0x91cb('0x31')](_0x1e9441[_0x91cb('0x80')](),{'type':dbH['sequelize'][_0x91cb('0x81')]['SELECT']});}})[_0x91cb('0x23')](function(){return{'sql':_0x12da14[_0x91cb('0x80')]()};})[_0x91cb('0x23')](respondWithResult(_0x146346,null))[_0x91cb('0x45')](handleError(_0x146346,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 01dee0e..6a5f490 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 _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 +var _0x2092=['define','AnalyticDefaultReport','analytics_default_reports','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./analyticDefaultReport.attributes','exports'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x2092,0x15f));var _0x2209=function(_0x2718f4,_0x1a2f6c){_0x2718f4=_0x2718f4-0x0;var _0x1ec475=_0x2092[_0x2718f4];return _0x1ec475;};'use strict';var _=require('lodash');var util=require(_0x2209('0x0'));var logger=require(_0x2209('0x1'))('api');var moment=require(_0x2209('0x2'));var BPromise=require(_0x2209('0x3'));var rp=require(_0x2209('0x4'));var fs=require('fs');var path=require(_0x2209('0x5'));var rimraf=require(_0x2209('0x6'));var config=require('../../config/environment');var attributes=require(_0x2209('0x7'));module[_0x2209('0x8')]=function(_0x147658,_0x44cd7e){return _0x147658[_0x2209('0x9')](_0x2209('0xa'),attributes,{'tableName':_0x2209('0xb'),'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 223a034..2778c52 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 _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 +var _0x6973=['debug','request\x20sent','stringify','error','code','message','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','AnalyticDefaultReport,\x20%s,\x20%s'];(function(_0x1ef8f6,_0x18a001){var _0x49bd57=function(_0x5b60c8){while(--_0x5b60c8){_0x1ef8f6['push'](_0x1ef8f6['shift']());}};_0x49bd57(++_0x18a001);}(_0x6973,0x78));var _0x3697=function(_0x48fa0a,_0x2ebf32){_0x48fa0a=_0x48fa0a-0x0;var _0x19bd11=_0x6973[_0x48fa0a];return _0x19bd11;};'use strict';var _=require('lodash');var util=require(_0x3697('0x0'));var moment=require(_0x3697('0x1'));var BPromise=require('bluebird');var rs=require(_0x3697('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3697('0x3'))['db'];var utils=require(_0x3697('0x4'));var logger=require(_0x3697('0x5'))(_0x3697('0x6'));var config=require(_0x3697('0x7'));var jayson=require(_0x3697('0x8'));var client=jayson[_0x3697('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5aa070,_0x4f519c,_0x218178){return new BPromise(function(_0x1b9f39,_0xdbaf9f){return client['request'](_0x5aa070,_0x218178)[_0x3697('0xa')](function(_0x3ccaca){logger[_0x3697('0xb')](_0x3697('0xc'),_0x4f519c,'request\x20sent');logger[_0x3697('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x4f519c,_0x3697('0xe'),JSON[_0x3697('0xf')](_0x3ccaca));if(_0x3ccaca[_0x3697('0x10')]){if(_0x3ccaca[_0x3697('0x10')][_0x3697('0x11')]===0x1f4){logger[_0x3697('0x10')](_0x3697('0xc'),_0x4f519c,_0x3ccaca[_0x3697('0x10')][_0x3697('0x12')]);return _0xdbaf9f(_0x3ccaca['error'][_0x3697('0x12')]);}logger[_0x3697('0x10')](_0x3697('0xc'),_0x4f519c,_0x3ccaca['error'][_0x3697('0x12')]);return _0x1b9f39(_0x3ccaca[_0x3697('0x10')][_0x3697('0x12')]);}else{logger[_0x3697('0xb')](_0x3697('0xc'),_0x4f519c,_0x3697('0xe'));_0x1b9f39(_0x3ccaca['result']['message']);}})['catch'](function(_0x36d23f){logger[_0x3697('0x10')](_0x3697('0xc'),_0x4f519c,_0x36d23f);_0xdbaf9f(_0x36d23f);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 4a434b2..d1a7eeb 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 _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 +var _0xcb2c=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','put','update','delete','util','connect-timeout','express'];(function(_0x5eed57,_0x224dc5){var _0x1ca877=function(_0xcdca76){while(--_0xcdca76){_0x5eed57['push'](_0x5eed57['shift']());}};_0x1ca877(++_0x224dc5);}(_0xcb2c,0x1c9));var _0xccb2=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0xcb2c[_0x5317b5];return _0x3b7ce2;};'use strict';var multer=require('multer');var util=require(_0xccb2('0x0'));var path=require('path');var timeout=require(_0xccb2('0x1'));var express=require(_0xccb2('0x2'));var router=express[_0xccb2('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xccb2('0x4'));var interaction=require(_0xccb2('0x5'));var config=require(_0xccb2('0x6'));var controller=require('./analyticDefaultReport.controller');router[_0xccb2('0x7')]('/',auth[_0xccb2('0x8')](),controller[_0xccb2('0x9')]);router[_0xccb2('0x7')](_0xccb2('0xa'),auth[_0xccb2('0x8')](),controller[_0xccb2('0xb')]);router[_0xccb2('0x7')](_0xccb2('0xc'),auth[_0xccb2('0x8')](),controller[_0xccb2('0xd')]);router[_0xccb2('0x7')](_0xccb2('0xe'),auth['isAuthenticated'](),controller[_0xccb2('0xf')]);router[_0xccb2('0x7')](_0xccb2('0x10'),auth['isAuthenticated'](),controller[_0xccb2('0x11')]);router[_0xccb2('0x12')]('/',auth[_0xccb2('0x8')](),controller[_0xccb2('0x13')]);router[_0xccb2('0x14')](_0xccb2('0xa'),auth['isAuthenticated'](),controller[_0xccb2('0x15')]);router[_0xccb2('0x16')](_0xccb2('0xa'),auth[_0xccb2('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 103c0b4..040e9e8 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 _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 +var _0x6a40=['moment','exports','STRING','ENUM','xlsx','csv','DATE','Loading','manual','scheduled','INTEGER','UNSIGNED','sequelize'];(function(_0x548872,_0x6e067e){var _0x2c7131=function(_0x205cb7){while(--_0x205cb7){_0x548872['push'](_0x548872['shift']());}};_0x2c7131(++_0x6e067e);}(_0x6a40,0x103));var _0x06a4=function(_0x3ef669,_0x43f62a){_0x3ef669=_0x3ef669-0x0;var _0x16a196=_0x6a40[_0x3ef669];return _0x16a196;};'use strict';var Sequelize=require(_0x06a4('0x0'));var moment=require(_0x06a4('0x1'));module[_0x06a4('0x2')]={'name':{'type':Sequelize[_0x06a4('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x06a4('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x06a4('0x4')]('csv','pdf',_0x06a4('0x5')),'allowNull':![],'defaultValue':_0x06a4('0x6')},'savename':{'type':Sequelize[_0x06a4('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x06a4('0x7')]},'endDate':{'type':Sequelize[_0x06a4('0x7')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0x06a4('0x8')},'type':{'type':Sequelize[_0x06a4('0x4')](_0x06a4('0x9'),_0x06a4('0xa')),'allowNull':![],'defaultValue':_0x06a4('0x9')},'reportId':{'type':Sequelize[_0x06a4('0xb')](0xb)[_0x06a4('0xc')]},'reportType':{'type':Sequelize[_0x06a4('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 0fcb08a..d23e920 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 _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 +var _0xdca3=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','get','ExtractedReports','UserProfileResource','sendStatus','stack','name','send','map','AnalyticExtractedReport','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','hasOwnProperty','order','sort','where','filter','options','include','findAll','rows','catch','show','intersection','length','includeAll','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','destroy','download','params','basename','output','existsSync','join','root','server/files/reports','ValidationError','Report\x20not\x20found\x20or\x20empty','savename','format','%s.%s','toLowerCase','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv'];(function(_0x125385,_0x105227){var _0x295d48=function(_0x4a5a23){while(--_0x4a5a23){_0x125385['push'](_0x125385['shift']());}};_0x295d48(++_0x105227);}(_0xdca3,0x10e));var _0x3dca=function(_0x13fcba,_0x120eb7){_0x13fcba=_0x13fcba-0x0;var _0x53b8a9=_0xdca3[_0x13fcba];return _0x53b8a9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3dca('0x0'));var zipdir=require(_0x3dca('0x1'));var jsonpatch=require(_0x3dca('0x2'));var rp=require(_0x3dca('0x3'));var moment=require('moment');var BPromise=require(_0x3dca('0x4'));var Mustache=require(_0x3dca('0x5'));var util=require('util');var path=require(_0x3dca('0x6'));var sox=require(_0x3dca('0x7'));var csv=require(_0x3dca('0x8'));var ejs=require(_0x3dca('0x9'));var fs=require('fs');var fs_extra=require(_0x3dca('0xa'));var _=require(_0x3dca('0xb'));var squel=require(_0x3dca('0xc'));var crypto=require(_0x3dca('0xd'));var jsforce=require(_0x3dca('0xe'));var deskjs=require(_0x3dca('0xf'));var toCsv=require(_0x3dca('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3dca('0x10'));var authService=require(_0x3dca('0x11'));var qs=require(_0x3dca('0x12'));var as=require(_0x3dca('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3dca('0x14'))(_0x3dca('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3dca('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e0461,_0x3fc5c2){_0x3fc5c2=_0x3fc5c2||0xcc;return function(_0x364c19){if(_0x364c19){return _0x2e0461['sendStatus'](_0x3fc5c2);}return _0x2e0461['status'](_0x3fc5c2)[_0x3dca('0x17')]();};}function respondWithResult(_0x5d7685,_0x9babb3){_0x9babb3=_0x9babb3||0xc8;return function(_0x3e7cf9){if(_0x3e7cf9){return _0x5d7685[_0x3dca('0x18')](_0x9babb3)[_0x3dca('0x19')](_0x3e7cf9);}};}function respondWithFilteredResult(_0x545187,_0xe551f0){return function(_0x2cf100){if(_0x2cf100){var _0xd73bbf=typeof _0xe551f0[_0x3dca('0x1a')]===_0x3dca('0x1b')&&typeof _0xe551f0[_0x3dca('0x1c')]===_0x3dca('0x1b');var _0x2e60c0=_0x2cf100[_0x3dca('0x1d')];var _0x52df62=_0xd73bbf?0x0:_0xe551f0[_0x3dca('0x1a')];var _0x9129f=_0xd73bbf?_0x2cf100['count']:_0xe551f0[_0x3dca('0x1a')]+_0xe551f0['limit'];var _0x445e87;if(_0x9129f>=_0x2e60c0){_0x9129f=_0x2e60c0;_0x445e87=0xc8;}else{_0x445e87=0xce;}_0x545187[_0x3dca('0x18')](_0x445e87);return _0x545187[_0x3dca('0x1e')](_0x3dca('0x1f'),_0x52df62+'-'+_0x9129f+'/'+_0x2e60c0)[_0x3dca('0x19')](_0x2cf100);}return null;};}function patchUpdates(_0x4ca868){return function(_0x3f9e14){try{jsonpatch[_0x3dca('0x20')](_0x3f9e14,_0x4ca868,!![]);}catch(_0x177253){return BPromise[_0x3dca('0x21')](_0x177253);}return _0x3f9e14['save']();};}function saveUpdates(_0x3fb796,_0x29f01d){return function(_0x5dad17){if(_0x5dad17){return _0x5dad17[_0x3dca('0x22')](_0x3fb796)[_0x3dca('0x23')](function(_0x1d7a45){return _0x1d7a45;});}return null;};}function removeEntity(_0x26cbe7,_0x5a612d){return function(_0x13678a){if(_0x13678a){return _0x13678a['destroy']()[_0x3dca('0x23')](function(){var _0x3a227b=_0x13678a[_0x3dca('0x24')]({'plain':!![]});var _0x333c68=_0x3dca('0x25');return db[_0x3dca('0x26')]['destroy']({'where':{'type':_0x333c68,'resourceId':_0x3a227b['id']}})['then'](function(){return _0x13678a;});})[_0x3dca('0x23')](function(){_0x26cbe7[_0x3dca('0x18')](0xcc)[_0x3dca('0x17')]();});}};}function handleEntityNotFound(_0xec4e8,_0x4fc23c){return function(_0x539a88){if(!_0x539a88){_0xec4e8[_0x3dca('0x27')](0x194);}return _0x539a88;};}function handleError(_0x1c290f,_0x3dfa2b){_0x3dfa2b=_0x3dfa2b||0x1f4;return function(_0x4d5f88){logger['error'](_0x4d5f88[_0x3dca('0x28')]);if(_0x4d5f88[_0x3dca('0x29')]){delete _0x4d5f88[_0x3dca('0x29')];}_0x1c290f['status'](_0x3dfa2b)[_0x3dca('0x2a')](_0x4d5f88);};}exports['index']=function(_0x5f3396,_0x5b4809){var _0xd45a52={},_0x70ab6c={},_0x3b60db={'count':0x0,'rows':[]};var _0x826f3a=_[_0x3dca('0x2b')](db[_0x3dca('0x2c')][_0x3dca('0x2d')],function(_0x1f9acb){return{'name':_0x1f9acb[_0x3dca('0x2e')],'type':_0x1f9acb['type'][_0x3dca('0x2f')]};});_0x70ab6c[_0x3dca('0x30')]=_[_0x3dca('0x2b')](_0x826f3a,_0x3dca('0x29'));_0x70ab6c[_0x3dca('0x31')]=_[_0x3dca('0x32')](_0x5f3396[_0x3dca('0x31')]);_0x70ab6c[_0x3dca('0x33')]=_['intersection'](_0x70ab6c[_0x3dca('0x30')],_0x70ab6c[_0x3dca('0x31')]);_0xd45a52[_0x3dca('0x34')]=_['intersection'](_0x70ab6c[_0x3dca('0x30')],qs[_0x3dca('0x35')](_0x5f3396[_0x3dca('0x31')][_0x3dca('0x35')]));_0xd45a52[_0x3dca('0x34')]=_0xd45a52[_0x3dca('0x34')]['length']?_0xd45a52[_0x3dca('0x34')]:_0x70ab6c[_0x3dca('0x30')];if(!_0x5f3396['query'][_0x3dca('0x36')]('nolimit')){_0xd45a52[_0x3dca('0x1c')]=qs[_0x3dca('0x1c')](_0x5f3396[_0x3dca('0x31')][_0x3dca('0x1c')]);_0xd45a52[_0x3dca('0x1a')]=qs[_0x3dca('0x1a')](_0x5f3396['query'][_0x3dca('0x1a')]);}_0xd45a52[_0x3dca('0x37')]=qs[_0x3dca('0x38')](_0x5f3396[_0x3dca('0x31')]['sort']);_0xd45a52[_0x3dca('0x39')]=qs[_0x3dca('0x33')](_['pick'](_0x5f3396['query'],_0x70ab6c[_0x3dca('0x33')]),_0x826f3a);if(_0x5f3396['query'][_0x3dca('0x3a')]){_0xd45a52[_0x3dca('0x39')]=_['merge'](_0xd45a52['where'],{'$or':_[_0x3dca('0x2b')](_0x826f3a,function(_0x105ebf){if(_0x105ebf['type']!=='VIRTUAL'){var _0x1b26c5={};_0x1b26c5[_0x105ebf[_0x3dca('0x29')]]={'$like':'%'+_0x5f3396[_0x3dca('0x31')]['filter']+'%'};return _0x1b26c5;}})});}_0xd45a52=_['merge']({},_0xd45a52,_0x5f3396[_0x3dca('0x3b')]);var _0x490829={'where':_0xd45a52[_0x3dca('0x39')]};return db[_0x3dca('0x2c')][_0x3dca('0x1d')](_0x490829)[_0x3dca('0x23')](function(_0x1ba6cf){_0x3b60db[_0x3dca('0x1d')]=_0x1ba6cf;if(_0x5f3396['query']['includeAll']){_0xd45a52[_0x3dca('0x3c')]=[{'all':!![]}];}return db[_0x3dca('0x2c')][_0x3dca('0x3d')](_0xd45a52);})['then'](function(_0x3b1954){_0x3b60db[_0x3dca('0x3e')]=_0x3b1954;return _0x3b60db;})[_0x3dca('0x23')](respondWithFilteredResult(_0x5b4809,_0xd45a52))[_0x3dca('0x3f')](handleError(_0x5b4809,null));};exports[_0x3dca('0x40')]=function(_0x132d09,_0x3bf572){var _0x2e1c45={'raw':!![],'where':{'id':_0x132d09['params']['id']}},_0x4eeb95={};_0x4eeb95[_0x3dca('0x30')]=_[_0x3dca('0x32')](db[_0x3dca('0x2c')][_0x3dca('0x2d')]);_0x4eeb95[_0x3dca('0x31')]=_['keys'](_0x132d09[_0x3dca('0x31')]);_0x4eeb95[_0x3dca('0x33')]=_[_0x3dca('0x41')](_0x4eeb95[_0x3dca('0x30')],_0x4eeb95['query']);_0x2e1c45[_0x3dca('0x34')]=_[_0x3dca('0x41')](_0x4eeb95[_0x3dca('0x30')],qs[_0x3dca('0x35')](_0x132d09['query']['fields']));_0x2e1c45[_0x3dca('0x34')]=_0x2e1c45[_0x3dca('0x34')][_0x3dca('0x42')]?_0x2e1c45[_0x3dca('0x34')]:_0x4eeb95['model'];if(_0x132d09['query'][_0x3dca('0x43')]){_0x2e1c45[_0x3dca('0x3c')]=[{'all':!![]}];}_0x2e1c45=_[_0x3dca('0x44')]({},_0x2e1c45,_0x132d09[_0x3dca('0x3b')]);return db[_0x3dca('0x2c')][_0x3dca('0x45')](_0x2e1c45)[_0x3dca('0x23')](handleEntityNotFound(_0x3bf572,null))['then'](respondWithResult(_0x3bf572,null))[_0x3dca('0x3f')](handleError(_0x3bf572,null));};exports[_0x3dca('0x46')]=function(_0x38fcc5,_0x35061c){return db['AnalyticExtractedReport'][_0x3dca('0x46')](_0x38fcc5[_0x3dca('0x47')],{})[_0x3dca('0x23')](function(_0xc15fd6){var _0x229fd8=_0x38fcc5[_0x3dca('0x48')][_0x3dca('0x24')]({'plain':!![]});if(!_0x229fd8)throw new Error(_0x3dca('0x49'));if(_0x229fd8[_0x3dca('0x4a')]==='user'){var _0x1bf806=_0xc15fd6[_0x3dca('0x24')]({'plain':!![]});var _0x1e6bc0=_0x3dca('0x25');return db[_0x3dca('0x4b')][_0x3dca('0x45')]({'where':{'name':_0x1e6bc0,'userProfileId':_0x229fd8['userProfileId']},'raw':!![]})[_0x3dca('0x23')](function(_0x8de921){if(_0x8de921&&_0x8de921[_0x3dca('0x4c')]===0x0){return db[_0x3dca('0x26')][_0x3dca('0x46')]({'name':_0x1bf806['name'],'resourceId':_0x1bf806['id'],'type':_0x8de921[_0x3dca('0x29')],'sectionId':_0x8de921['id']},{})['then'](function(){return _0xc15fd6;});}else{return _0xc15fd6;}})[_0x3dca('0x3f')](function(_0x5b38de){logger[_0x3dca('0x4d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b38de);throw _0x5b38de;});}return _0xc15fd6;})[_0x3dca('0x23')](respondWithResult(_0x35061c,0xc9))['catch'](handleError(_0x35061c,null));};exports[_0x3dca('0x22')]=function(_0x39a251,_0x20ca7c){if(_0x39a251[_0x3dca('0x47')]['id']){delete _0x39a251['body']['id'];}return db[_0x3dca('0x2c')][_0x3dca('0x45')]({'where':{'id':_0x39a251['params']['id']}})[_0x3dca('0x23')](handleEntityNotFound(_0x20ca7c,null))[_0x3dca('0x23')](saveUpdates(_0x39a251[_0x3dca('0x47')],null))[_0x3dca('0x23')](respondWithResult(_0x20ca7c,null))[_0x3dca('0x3f')](handleError(_0x20ca7c,null));};exports[_0x3dca('0x4e')]=function(_0xeeb2cb,_0x163d38){return db['AnalyticExtractedReport'][_0x3dca('0x45')]({'where':{'id':_0xeeb2cb['params']['id']}})[_0x3dca('0x23')](handleEntityNotFound(_0x163d38,null))[_0x3dca('0x23')](removeEntity(_0x163d38,null))[_0x3dca('0x3f')](handleError(_0x163d38,null));};exports[_0x3dca('0x4f')]=function(_0x165aeb,_0x5ead18,_0x26ccc0){return db[_0x3dca('0x2c')][_0x3dca('0x45')]({'where':{'id':_0x165aeb[_0x3dca('0x50')]['id']},'attributes':[_0x3dca('0x29'),_0x3dca('0x51'),'savename',_0x3dca('0x52')],'raw':!![]})['then'](handleEntityNotFound(_0x5ead18,null))[_0x3dca('0x23')](function(_0x3ae921){if(_0x3ae921){if(!fs[_0x3dca('0x53')](path[_0x3dca('0x54')](config[_0x3dca('0x55')],_0x3dca('0x56'),_0x3ae921['savename']))){throw new db['Sequelize'][(_0x3dca('0x57'))](_0x3dca('0x58'));}if(_0x165aeb[_0x3dca('0x31')]['exists']){return _0x5ead18[_0x3dca('0x27')](0xc8);}return _0x5ead18[_0x3dca('0x4f')](path[_0x3dca('0x54')](config[_0x3dca('0x55')],_0x3dca('0x56'),_0x3ae921[_0x3dca('0x59')]),util[_0x3dca('0x5a')](_0x3dca('0x5b'),_0x3ae921[_0x3dca('0x51')]||_0x3ae921[_0x3dca('0x29')],_0x3ae921[_0x3dca('0x52')][_0x3dca('0x5c')]()));}})[_0x3dca('0x3f')](handleError(_0x5ead18,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index d3f3016..1572cfa 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 _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 +var _0xad91=['../../config/environment','exports','analytics_extracted_reports','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0xf2d31f,_0x56d470){var _0x29091f=function(_0x174130){while(--_0x174130){_0xf2d31f['push'](_0xf2d31f['shift']());}};_0x29091f(++_0x56d470);}(_0xad91,0xf6));var _0x1ad9=function(_0x422fa5,_0x4fc338){_0x422fa5=_0x422fa5-0x0;var _0x132d59=_0xad91[_0x422fa5];return _0x132d59;};'use strict';var _=require(_0x1ad9('0x0'));var util=require(_0x1ad9('0x1'));var logger=require(_0x1ad9('0x2'))(_0x1ad9('0x3'));var moment=require('moment');var BPromise=require(_0x1ad9('0x4'));var rp=require(_0x1ad9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1ad9('0x6'));var attributes=require('./analyticExtractedReport.attributes');module[_0x1ad9('0x7')]=function(_0x38dd94,_0x7f883e){return _0x38dd94['define']('AnalyticExtractedReport',attributes,{'tableName':_0x1ad9('0x8'),'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 e6acd7e..be94179 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 _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 +var _0xcecc=['info','AnalyticExtractedReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','then'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xcecc,0x186));var _0xccec=function(_0x164894,_0x41c7f7){_0x164894=_0x164894-0x0;var _0x4c2739=_0xcecc[_0x164894];return _0x4c2739;};'use strict';var _=require(_0xccec('0x0'));var util=require('util');var moment=require(_0xccec('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xccec('0x2'));var db=require(_0xccec('0x3'))['db'];var utils=require(_0xccec('0x4'));var logger=require(_0xccec('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xccec('0x6'));var client=jayson['client'][_0xccec('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x44ed01,_0x2a66e5,_0x5788aa){return new BPromise(function(_0x372ea6,_0x3d7b1a){return client['request'](_0x44ed01,_0x5788aa)[_0xccec('0x8')](function(_0xbbf504){logger[_0xccec('0x9')](_0xccec('0xa'),_0x2a66e5,'request\x20sent');logger[_0xccec('0xb')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x2a66e5,_0xccec('0xc'),JSON[_0xccec('0xd')](_0xbbf504));if(_0xbbf504['error']){if(_0xbbf504[_0xccec('0xe')][_0xccec('0xf')]===0x1f4){logger[_0xccec('0xe')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x2a66e5,_0xbbf504[_0xccec('0xe')][_0xccec('0x10')]);return _0x3d7b1a(_0xbbf504[_0xccec('0xe')][_0xccec('0x10')]);}logger[_0xccec('0xe')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x2a66e5,_0xbbf504[_0xccec('0xe')]['message']);return _0x372ea6(_0xbbf504['error']['message']);}else{logger[_0xccec('0x9')](_0xccec('0xa'),_0x2a66e5,_0xccec('0xc'));_0x372ea6(_0xbbf504[_0xccec('0x11')][_0xccec('0x10')]);}})[_0xccec('0x12')](function(_0x7abe38){logger[_0xccec('0xe')](_0xccec('0xa'),_0x2a66e5,_0x7abe38);_0x3d7b1a(_0x7abe38);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 0bd70ee..9985e90 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 _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 +var _0x5d13=['isAuthenticated','index','/:id','show','get','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller'];(function(_0x504ff7,_0xc65bd9){var _0x2c6010=function(_0x231c0a){while(--_0x231c0a){_0x504ff7['push'](_0x504ff7['shift']());}};_0x2c6010(++_0xc65bd9);}(_0x5d13,0xbb));var _0x35d1=function(_0x9e5438,_0x2959ed){_0x9e5438=_0x9e5438-0x0;var _0x21129b=_0x5d13[_0x9e5438];return _0x21129b;};'use strict';var multer=require(_0x35d1('0x0'));var util=require(_0x35d1('0x1'));var path=require(_0x35d1('0x2'));var timeout=require(_0x35d1('0x3'));var express=require(_0x35d1('0x4'));var router=express[_0x35d1('0x5')]();var fs_extra=require(_0x35d1('0x6'));var auth=require(_0x35d1('0x7'));var interaction=require(_0x35d1('0x8'));var config=require(_0x35d1('0x9'));var controller=require(_0x35d1('0xa'));router['get']('/',auth[_0x35d1('0xb')](),controller[_0x35d1('0xc')]);router['get'](_0x35d1('0xd'),auth[_0x35d1('0xb')](),controller[_0x35d1('0xe')]);router[_0x35d1('0xf')]('/:id/download',auth[_0x35d1('0xb')](),controller['download']);router[_0x35d1('0x10')]('/',auth[_0x35d1('0xb')](),controller[_0x35d1('0x11')]);router[_0x35d1('0x12')]('/:id',auth[_0x35d1('0xb')](),controller[_0x35d1('0x13')]);router[_0x35d1('0x14')](_0x35d1('0xd'),auth[_0x35d1('0xb')](),controller[_0x35d1('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 1f067a9..d2708ec 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 _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 +var _0x7f7b=['sequelize','exports','BOOLEAN'];(function(_0x142da9,_0x45a7d3){var _0x3a665c=function(_0x2f4dde){while(--_0x2f4dde){_0x142da9['push'](_0x142da9['shift']());}};_0x3a665c(++_0x45a7d3);}(_0x7f7b,0x174));var _0xb7f7=function(_0x4a4b78,_0x2d69f1){_0x4a4b78=_0x4a4b78-0x0;var _0xa26614=_0x7f7b[_0x4a4b78];return _0xa26614;};'use strict';var Sequelize=require(_0xb7f7('0x0'));module[_0xb7f7('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0xb7f7('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index cfe6b4f..2316d75 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 _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 +var _0xa42e=['catch','create','body','bulkCreate','destroy','ids','AnalyticCustomReport','sequelize','transaction','eml-format','rimraf','zip-dir','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','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','length','find'];(function(_0x2866e2,_0x5b5fdf){var _0x44a5bb=function(_0x3d4042){while(--_0x3d4042){_0x2866e2['push'](_0x2866e2['shift']());}};_0x44a5bb(++_0x5b5fdf);}(_0xa42e,0x1ef));var _0xea42=function(_0x448d87,_0x2dc90c){_0x448d87=_0x448d87-0x0;var _0x22a682=_0xa42e[_0x448d87];return _0x22a682;};'use strict';var emlformat=require(_0xea42('0x0'));var rimraf=require(_0xea42('0x1'));var zipdir=require(_0xea42('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xea42('0x3'));var BPromise=require(_0xea42('0x4'));var Mustache=require(_0xea42('0x5'));var util=require(_0xea42('0x6'));var path=require('path');var sox=require(_0xea42('0x7'));var csv=require(_0xea42('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xea42('0x9'));var _=require(_0xea42('0xa'));var squel=require(_0xea42('0xb'));var crypto=require(_0xea42('0xc'));var jsforce=require(_0xea42('0xd'));var deskjs=require(_0xea42('0xe'));var toCsv=require('to-csv');var querystring=require(_0xea42('0xf'));var Papa=require(_0xea42('0x10'));var Redis=require(_0xea42('0x11'));var authService=require(_0xea42('0x12'));var qs=require(_0xea42('0x13'));var as=require(_0xea42('0x14'));var hardwareService=require(_0xea42('0x15'));var logger=require(_0xea42('0x16'))('api');var utils=require(_0xea42('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xea42('0x18'))['db'];function respondWithStatusCode(_0x5a687c,_0x3ab628){_0x3ab628=_0x3ab628||0xcc;return function(_0x2fa0f4){if(_0x2fa0f4){return _0x5a687c[_0xea42('0x19')](_0x3ab628);}return _0x5a687c[_0xea42('0x1a')](_0x3ab628)['end']();};}function respondWithResult(_0x1b4e78,_0x57dbb7){_0x57dbb7=_0x57dbb7||0xc8;return function(_0x40c3fa){if(_0x40c3fa){return _0x1b4e78[_0xea42('0x1a')](_0x57dbb7)[_0xea42('0x1b')](_0x40c3fa);}};}function respondWithFilteredResult(_0x4bfebe,_0x34df41){return function(_0x53544b){if(_0x53544b){var _0x4e780a=typeof _0x34df41[_0xea42('0x1c')]===_0xea42('0x1d')&&typeof _0x34df41[_0xea42('0x1e')]===_0xea42('0x1d');var _0x29c610=_0x53544b[_0xea42('0x1f')];var _0x4fa27a=_0x4e780a?0x0:_0x34df41[_0xea42('0x1c')];var _0x1654b7=_0x4e780a?_0x53544b[_0xea42('0x1f')]:_0x34df41[_0xea42('0x1c')]+_0x34df41[_0xea42('0x1e')];var _0x292e86;if(_0x1654b7>=_0x29c610){_0x1654b7=_0x29c610;_0x292e86=0xc8;}else{_0x292e86=0xce;}_0x4bfebe['status'](_0x292e86);return _0x4bfebe[_0xea42('0x20')](_0xea42('0x21'),_0x4fa27a+'-'+_0x1654b7+'/'+_0x29c610)[_0xea42('0x1b')](_0x53544b);}return null;};}function patchUpdates(_0x1c4bcb){return function(_0x3f3361){try{jsonpatch['apply'](_0x3f3361,_0x1c4bcb,!![]);}catch(_0x1360f0){return BPromise[_0xea42('0x22')](_0x1360f0);}return _0x3f3361[_0xea42('0x23')]();};}function saveUpdates(_0x522387,_0x105bbd){return function(_0xd76189){if(_0xd76189){return _0xd76189[_0xea42('0x24')](_0x522387)[_0xea42('0x25')](function(_0x281828){return _0x281828;});}return null;};}function removeEntity(_0x8b621a,_0x142be4){return function(_0x93f472){if(_0x93f472){return _0x93f472['destroy']()['then'](function(){_0x8b621a[_0xea42('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5bc599,_0x195708){return function(_0x2ffbf9){if(!_0x2ffbf9){_0x5bc599[_0xea42('0x19')](0x194);}return _0x2ffbf9;};}function handleError(_0x5f2d4e,_0x4aca7d){_0x4aca7d=_0x4aca7d||0x1f4;return function(_0x1179d9){logger['error'](_0x1179d9['stack']);if(_0x1179d9[_0xea42('0x26')]){delete _0x1179d9[_0xea42('0x26')];}_0x5f2d4e[_0xea42('0x1a')](_0x4aca7d)[_0xea42('0x27')](_0x1179d9);};}exports[_0xea42('0x28')]=function(_0x377f11,_0x238892){var _0x3ded98={},_0x3de2f0={},_0x17f1f8={'count':0x0,'rows':[]};var _0x350ff2=_[_0xea42('0x29')](db[_0xea42('0x2a')][_0xea42('0x2b')],function(_0x1f3db1){return{'name':_0x1f3db1[_0xea42('0x2c')],'type':_0x1f3db1[_0xea42('0x2d')][_0xea42('0x2e')]};});_0x3de2f0[_0xea42('0x2f')]=_[_0xea42('0x29')](_0x350ff2,'name');_0x3de2f0['query']=_[_0xea42('0x30')](_0x377f11[_0xea42('0x31')]);_0x3de2f0[_0xea42('0x32')]=_[_0xea42('0x33')](_0x3de2f0[_0xea42('0x2f')],_0x3de2f0['query']);_0x3ded98[_0xea42('0x34')]=_['intersection'](_0x3de2f0[_0xea42('0x2f')],qs['fields'](_0x377f11['query'][_0xea42('0x35')]));_0x3ded98['attributes']=_0x3ded98[_0xea42('0x34')]['length']?_0x3ded98['attributes']:_0x3de2f0[_0xea42('0x2f')];if(!_0x377f11[_0xea42('0x31')][_0xea42('0x36')](_0xea42('0x37'))){_0x3ded98[_0xea42('0x1e')]=qs[_0xea42('0x1e')](_0x377f11[_0xea42('0x31')][_0xea42('0x1e')]);_0x3ded98[_0xea42('0x1c')]=qs['offset'](_0x377f11[_0xea42('0x31')]['offset']);}_0x3ded98[_0xea42('0x38')]=qs[_0xea42('0x39')](_0x377f11[_0xea42('0x31')][_0xea42('0x39')]);_0x3ded98['where']=qs['filters'](_[_0xea42('0x3a')](_0x377f11[_0xea42('0x31')],_0x3de2f0[_0xea42('0x32')]),_0x350ff2);if(_0x377f11[_0xea42('0x31')]['filter']){_0x3ded98[_0xea42('0x3b')]=_[_0xea42('0x3c')](_0x3ded98[_0xea42('0x3b')],{'$or':_['map'](_0x350ff2,function(_0x3881a5){if(_0x3881a5[_0xea42('0x2d')]!==_0xea42('0x3d')){var _0x2294fe={};_0x2294fe[_0x3881a5['name']]={'$like':'%'+_0x377f11[_0xea42('0x31')][_0xea42('0x3e')]+'%'};return _0x2294fe;}})});}_0x3ded98=_[_0xea42('0x3c')]({},_0x3ded98,_0x377f11[_0xea42('0x3f')]);var _0x4a6e0e={'where':_0x3ded98[_0xea42('0x3b')]};return db[_0xea42('0x2a')][_0xea42('0x1f')](_0x4a6e0e)[_0xea42('0x25')](function(_0x45848a){_0x17f1f8[_0xea42('0x1f')]=_0x45848a;if(_0x377f11[_0xea42('0x31')][_0xea42('0x40')]){_0x3ded98[_0xea42('0x41')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0xea42('0x42')](_0x3ded98);})[_0xea42('0x25')](function(_0x19dd89){_0x17f1f8[_0xea42('0x43')]=_0x19dd89;return _0x17f1f8;})[_0xea42('0x25')](respondWithFilteredResult(_0x238892,_0x3ded98))['catch'](handleError(_0x238892,null));};exports[_0xea42('0x44')]=function(_0x124808,_0x42bb0e){var _0x53080f={'raw':![],'where':{'id':_0x124808[_0xea42('0x45')]['id']}},_0x253da9={};_0x253da9[_0xea42('0x2f')]=_[_0xea42('0x30')](db['AnalyticFieldReport'][_0xea42('0x2b')]);_0x253da9[_0xea42('0x31')]=_[_0xea42('0x30')](_0x124808[_0xea42('0x31')]);_0x253da9[_0xea42('0x32')]=_[_0xea42('0x33')](_0x253da9['model'],_0x253da9['query']);_0x53080f[_0xea42('0x34')]=_[_0xea42('0x33')](_0x253da9[_0xea42('0x2f')],qs['fields'](_0x124808[_0xea42('0x31')]['fields']));_0x53080f[_0xea42('0x34')]=_0x53080f['attributes'][_0xea42('0x46')]?_0x53080f[_0xea42('0x34')]:_0x253da9['model'];if(_0x124808['query']['includeAll']){_0x53080f['include']=[{'all':!![]}];}_0x53080f=_[_0xea42('0x3c')]({},_0x53080f,_0x124808['options']);return db[_0xea42('0x2a')][_0xea42('0x47')](_0x53080f)[_0xea42('0x25')](handleEntityNotFound(_0x42bb0e,null))[_0xea42('0x25')](respondWithResult(_0x42bb0e,null))[_0xea42('0x48')](handleError(_0x42bb0e,null));};exports[_0xea42('0x49')]=function(_0x1ece31,_0x150b2c){return db['AnalyticFieldReport'][_0xea42('0x49')](_0x1ece31[_0xea42('0x4a')],{})[_0xea42('0x25')](respondWithResult(_0x150b2c,0xc9))[_0xea42('0x48')](handleError(_0x150b2c,null));};exports['bulkCreate']=function(_0x129d04,_0x583716){return db['AnalyticFieldReport'][_0xea42('0x4b')](_0x129d04['body'],{'raw':![],'individualHooks':!![]})[_0xea42('0x25')](respondWithResult(_0x583716,0xc9))[_0xea42('0x48')](handleError(_0x583716,null));};exports[_0xea42('0x24')]=function(_0x1571fb,_0xa3e3ab){if(_0x1571fb['body']['id']){delete _0x1571fb[_0xea42('0x4a')]['id'];}return db[_0xea42('0x2a')]['find']({'where':{'id':_0x1571fb[_0xea42('0x45')]['id']}})[_0xea42('0x25')](handleEntityNotFound(_0xa3e3ab,null))[_0xea42('0x25')](saveUpdates(_0x1571fb[_0xea42('0x4a')],null))['then'](respondWithResult(_0xa3e3ab,null))['catch'](handleError(_0xa3e3ab,null));};exports[_0xea42('0x4c')]=function(_0x1eab23,_0x1daafb){return db[_0xea42('0x2a')][_0xea42('0x47')]({'where':{'id':_0x1eab23[_0xea42('0x45')]['id']}})[_0xea42('0x25')](handleEntityNotFound(_0x1daafb,null))[_0xea42('0x25')](removeEntity(_0x1daafb,null))['catch'](handleError(_0x1daafb,null));};exports['bulkDestroy']=function(_0x13751b,_0x3c3fec){return db['AnalyticFieldReport'][_0xea42('0x4c')]({'where':{'id':_0x13751b[_0xea42('0x31')][_0xea42('0x4d')]||[]},'raw':![],'individualHooks':!![]})[_0xea42('0x25')](respondWithResult(_0x3c3fec,0xcc))[_0xea42('0x48')](handleError(_0x3c3fec,null));};exports['addFields']=function(_0x2cbf04,_0x2e84f0,_0x456cb1){return db[_0xea42('0x4e')]['findOne']({'where':{'id':_0x2cbf04[_0xea42('0x45')]['id']}})[_0xea42('0x25')](handleEntityNotFound(_0x2e84f0,null))[_0xea42('0x25')](function(_0x2f99ba){if(_0x2f99ba){return db[_0xea42('0x4f')][_0xea42('0x50')](function(_0x220dba){return db[_0xea42('0x2a')][_0xea42('0x4c')]({'where':{'CustomReportId':_0x2cbf04[_0xea42('0x45')]['id']},'transaction':_0x220dba})[_0xea42('0x25')](function(_0x1c62d3){var _0x2bd955=_[_0xea42('0x29')](_0x2cbf04[_0xea42('0x4a')],function(_0x5e3cfa){delete _0x5e3cfa['id'];_0x5e3cfa['CustomReportId']=_0x2cbf04[_0xea42('0x45')]['id'];return _0x5e3cfa;});return db[_0xea42('0x2a')][_0xea42('0x4b')](_0x2bd955,{'transaction':_0x220dba});});})[_0xea42('0x25')](function(){return db['AnalyticFieldReport'][_0xea42('0x42')]({'where':{'CustomReportId':_0x2cbf04[_0xea42('0x45')]['id']}});});}})['then'](respondWithResult(_0x2e84f0,null))[_0xea42('0x48')](handleError(_0x2e84f0,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index f84dbdf..04ba3b5 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 _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 +var _0x81d6=['util','api','moment','bluebird','request-promise','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x81d6,0xef));var _0x681d=function(_0x10e0b1,_0xb6f575){_0x10e0b1=_0x10e0b1-0x0;var _0x4bb171=_0x81d6[_0x10e0b1];return _0x4bb171;};'use strict';var _=require(_0x681d('0x0'));var util=require(_0x681d('0x1'));var logger=require('../../config/logger')(_0x681d('0x2'));var moment=require(_0x681d('0x3'));var BPromise=require(_0x681d('0x4'));var rp=require(_0x681d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x681d('0x6'));var attributes=require(_0x681d('0x7'));module[_0x681d('0x8')]=function(_0x25445e,_0x375b87){return _0x25445e[_0x681d('0x9')](_0x681d('0xa'),attributes,{'tableName':_0x681d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 55a0a2b..b54afd9 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 _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 +var _0x60f5=['stringify','error','code','AnalyticFieldReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s'];(function(_0x5c28d3,_0x349cc2){var _0x2d0e08=function(_0x52d826){while(--_0x52d826){_0x5c28d3['push'](_0x5c28d3['shift']());}};_0x2d0e08(++_0x349cc2);}(_0x60f5,0x1a9));var _0x560f=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x60f5[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x560f('0x0'));var util=require(_0x560f('0x1'));var moment=require(_0x560f('0x2'));var BPromise=require(_0x560f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x560f('0x4'))['db'];var utils=require(_0x560f('0x5'));var logger=require(_0x560f('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x560f('0x7')][_0x560f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x13036b,_0x27dd09,_0xa8d146){return new BPromise(function(_0x25b79d,_0x116d50){return client[_0x560f('0x9')](_0x13036b,_0xa8d146)[_0x560f('0xa')](function(_0x170fb4){logger[_0x560f('0xb')]('AnalyticFieldReport,\x20%s,\x20%s',_0x27dd09,_0x560f('0xc'));logger[_0x560f('0xd')](_0x560f('0xe'),_0x27dd09,_0x560f('0xc'),JSON[_0x560f('0xf')](_0x170fb4));if(_0x170fb4[_0x560f('0x10')]){if(_0x170fb4[_0x560f('0x10')][_0x560f('0x11')]===0x1f4){logger[_0x560f('0x10')](_0x560f('0x12'),_0x27dd09,_0x170fb4[_0x560f('0x10')][_0x560f('0x13')]);return _0x116d50(_0x170fb4['error'][_0x560f('0x13')]);}logger['error'](_0x560f('0x12'),_0x27dd09,_0x170fb4[_0x560f('0x10')][_0x560f('0x13')]);return _0x25b79d(_0x170fb4['error']['message']);}else{logger[_0x560f('0xb')]('AnalyticFieldReport,\x20%s,\x20%s',_0x27dd09,_0x560f('0xc'));_0x25b79d(_0x170fb4[_0x560f('0x14')][_0x560f('0x13')]);}})[_0x560f('0x15')](function(_0x5a5543){logger[_0x560f('0x10')](_0x560f('0x12'),_0x27dd09,_0x5a5543);_0x116d50(_0x5a5543);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index e8d8d18..ed641d8 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(_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 +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(_0xd5e144,_0x2a93fe){var _0x1bb031=function(_0x43ec93){while(--_0x43ec93){_0xd5e144['push'](_0xd5e144['shift']());}};_0x1bb031(++_0x2a93fe);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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 6c751db..46324b8 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 _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 +var _0xd027=['STRING','TEXT','exports'];(function(_0x1b08d4,_0x8a710c){var _0x9aef3e=function(_0x4da607){while(--_0x4da607){_0x1b08d4['push'](_0x1b08d4['shift']());}};_0x9aef3e(++_0x8a710c);}(_0xd027,0x197));var _0x7d02=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd027[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x7d02('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x7d02('0x1')]},'metric':{'type':Sequelize[_0x7d02('0x2')]},'description':{'type':Sequelize[_0x7d02('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index c68c502..d5e3e1d 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 _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 +var _0xf2ca=['filter','merge','map','type','VIRTUAL','options','AnalyticMetric','count','includeAll','findAll','rows','catch','keys','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','then','get','Metrics','UserProfileResource','destroy','stack','name','send','index','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x363982,_0x4de044){var _0x5e6be1=function(_0x90ffb1){while(--_0x90ffb1){_0x363982['push'](_0x363982['shift']());}};_0x5e6be1(++_0x4de044);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x550e29,_0x4047f){_0x550e29=_0x550e29-0x0;var _0x3515b6=_0xf2ca[_0x550e29];return _0x3515b6;};'use strict';var emlformat=require(_0xaf2c('0x0'));var rimraf=require(_0xaf2c('0x1'));var zipdir=require(_0xaf2c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaf2c('0x3'));var moment=require(_0xaf2c('0x4'));var BPromise=require(_0xaf2c('0x5'));var Mustache=require(_0xaf2c('0x6'));var util=require(_0xaf2c('0x7'));var path=require(_0xaf2c('0x8'));var sox=require('sox');var csv=require(_0xaf2c('0x9'));var ejs=require(_0xaf2c('0xa'));var fs=require('fs');var fs_extra=require(_0xaf2c('0xb'));var _=require(_0xaf2c('0xc'));var squel=require('squel');var crypto=require(_0xaf2c('0xd'));var jsforce=require(_0xaf2c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xaf2c('0x9'));var querystring=require('querystring');var Papa=require(_0xaf2c('0xf'));var Redis=require('ioredis');var authService=require(_0xaf2c('0x10'));var qs=require(_0xaf2c('0x11'));var as=require(_0xaf2c('0x12'));var hardwareService=require(_0xaf2c('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xaf2c('0x14'));var config=require(_0xaf2c('0x15'));var licenseUtil=require(_0xaf2c('0x16'));var db=require(_0xaf2c('0x17'))['db'];function respondWithStatusCode(_0x285dac,_0x59a59b){_0x59a59b=_0x59a59b||0xcc;return function(_0x590126){if(_0x590126){return _0x285dac[_0xaf2c('0x18')](_0x59a59b);}return _0x285dac[_0xaf2c('0x19')](_0x59a59b)[_0xaf2c('0x1a')]();};}function respondWithResult(_0x18a8a5,_0x293ca6){_0x293ca6=_0x293ca6||0xc8;return function(_0x152c73){if(_0x152c73){return _0x18a8a5[_0xaf2c('0x19')](_0x293ca6)[_0xaf2c('0x1b')](_0x152c73);}};}function respondWithFilteredResult(_0x2119c8,_0x1d0633){return function(_0x6ac8e){if(_0x6ac8e){var _0x2b4d13=typeof _0x1d0633[_0xaf2c('0x1c')]===_0xaf2c('0x1d')&&typeof _0x1d0633[_0xaf2c('0x1e')]==='undefined';var _0x3ca650=_0x6ac8e['count'];var _0x278a28=_0x2b4d13?0x0:_0x1d0633[_0xaf2c('0x1c')];var _0x1d544a=_0x2b4d13?_0x6ac8e['count']:_0x1d0633[_0xaf2c('0x1c')]+_0x1d0633[_0xaf2c('0x1e')];var _0x1fec4c;if(_0x1d544a>=_0x3ca650){_0x1d544a=_0x3ca650;_0x1fec4c=0xc8;}else{_0x1fec4c=0xce;}_0x2119c8[_0xaf2c('0x19')](_0x1fec4c);return _0x2119c8[_0xaf2c('0x1f')](_0xaf2c('0x20'),_0x278a28+'-'+_0x1d544a+'/'+_0x3ca650)['json'](_0x6ac8e);}return null;};}function patchUpdates(_0x35e712){return function(_0x164bcb){try{jsonpatch[_0xaf2c('0x21')](_0x164bcb,_0x35e712,!![]);}catch(_0x3bfd3f){return BPromise[_0xaf2c('0x22')](_0x3bfd3f);}return _0x164bcb['save']();};}function saveUpdates(_0x396646,_0xbf6f62){return function(_0x18153c){if(_0x18153c){return _0x18153c['update'](_0x396646)['then'](function(_0x29cbdf){return _0x29cbdf;});}return null;};}function removeEntity(_0x303546,_0x1cafad){return function(_0x99f78d){if(_0x99f78d){return _0x99f78d['destroy']()[_0xaf2c('0x23')](function(){var _0xf1a7cf=_0x99f78d[_0xaf2c('0x24')]({'plain':!![]});var _0x3c1ae6=_0xaf2c('0x25');return db[_0xaf2c('0x26')][_0xaf2c('0x27')]({'where':{'type':_0x3c1ae6,'resourceId':_0xf1a7cf['id']}})['then'](function(){return _0x99f78d;});})[_0xaf2c('0x23')](function(){_0x303546[_0xaf2c('0x19')](0xcc)[_0xaf2c('0x1a')]();});}};}function handleEntityNotFound(_0x410536,_0x4b7cf2){return function(_0x3fb190){if(!_0x3fb190){_0x410536['sendStatus'](0x194);}return _0x3fb190;};}function handleError(_0x38db1b,_0x42f980){_0x42f980=_0x42f980||0x1f4;return function(_0x15466b){logger['error'](_0x15466b[_0xaf2c('0x28')]);if(_0x15466b[_0xaf2c('0x29')]){delete _0x15466b[_0xaf2c('0x29')];}_0x38db1b['status'](_0x42f980)[_0xaf2c('0x2a')](_0x15466b);};}exports[_0xaf2c('0x2b')]=function(_0x42e2a5,_0x19364e){var _0x59d858={},_0x3da072={},_0x4072ff={'count':0x0,'rows':[]};var _0x1be1ef=_['map'](db['AnalyticMetric'][_0xaf2c('0x2c')],function(_0x4c9b4f){return{'name':_0x4c9b4f[_0xaf2c('0x2d')],'type':_0x4c9b4f['type'][_0xaf2c('0x2e')]};});_0x3da072[_0xaf2c('0x2f')]=_['map'](_0x1be1ef,_0xaf2c('0x29'));_0x3da072[_0xaf2c('0x30')]=_['keys'](_0x42e2a5[_0xaf2c('0x30')]);_0x3da072[_0xaf2c('0x31')]=_[_0xaf2c('0x32')](_0x3da072[_0xaf2c('0x2f')],_0x3da072[_0xaf2c('0x30')]);_0x59d858[_0xaf2c('0x33')]=_['intersection'](_0x3da072[_0xaf2c('0x2f')],qs['fields'](_0x42e2a5[_0xaf2c('0x30')]['fields']));_0x59d858[_0xaf2c('0x33')]=_0x59d858['attributes'][_0xaf2c('0x34')]?_0x59d858['attributes']:_0x3da072[_0xaf2c('0x2f')];if(!_0x42e2a5['query'][_0xaf2c('0x35')](_0xaf2c('0x36'))){_0x59d858[_0xaf2c('0x1e')]=qs[_0xaf2c('0x1e')](_0x42e2a5[_0xaf2c('0x30')]['limit']);_0x59d858['offset']=qs[_0xaf2c('0x1c')](_0x42e2a5[_0xaf2c('0x30')][_0xaf2c('0x1c')]);}_0x59d858[_0xaf2c('0x37')]=qs[_0xaf2c('0x38')](_0x42e2a5[_0xaf2c('0x30')]['sort']);_0x59d858[_0xaf2c('0x39')]=qs[_0xaf2c('0x31')](_['pick'](_0x42e2a5[_0xaf2c('0x30')],_0x3da072[_0xaf2c('0x31')]),_0x1be1ef);if(_0x42e2a5[_0xaf2c('0x30')][_0xaf2c('0x3a')]){_0x59d858[_0xaf2c('0x39')]=_[_0xaf2c('0x3b')](_0x59d858[_0xaf2c('0x39')],{'$or':_[_0xaf2c('0x3c')](_0x1be1ef,function(_0x296ca8){if(_0x296ca8[_0xaf2c('0x3d')]!==_0xaf2c('0x3e')){var _0x43f606={};_0x43f606[_0x296ca8[_0xaf2c('0x29')]]={'$like':'%'+_0x42e2a5['query']['filter']+'%'};return _0x43f606;}})});}_0x59d858=_['merge']({},_0x59d858,_0x42e2a5[_0xaf2c('0x3f')]);var _0x3cb075={'where':_0x59d858[_0xaf2c('0x39')]};return db[_0xaf2c('0x40')][_0xaf2c('0x41')](_0x3cb075)[_0xaf2c('0x23')](function(_0x51c441){_0x4072ff[_0xaf2c('0x41')]=_0x51c441;if(_0x42e2a5[_0xaf2c('0x30')][_0xaf2c('0x42')]){_0x59d858['include']=[{'all':!![]}];}return db['AnalyticMetric'][_0xaf2c('0x43')](_0x59d858);})['then'](function(_0x181787){_0x4072ff[_0xaf2c('0x44')]=_0x181787;return _0x4072ff;})[_0xaf2c('0x23')](respondWithFilteredResult(_0x19364e,_0x59d858))[_0xaf2c('0x45')](handleError(_0x19364e,null));};exports['show']=function(_0x2091eb,_0x532d5f){var _0x2056b8={'raw':!![],'where':{'id':_0x2091eb['params']['id']}},_0x8ebb65={};_0x8ebb65[_0xaf2c('0x2f')]=_['keys'](db[_0xaf2c('0x40')][_0xaf2c('0x2c')]);_0x8ebb65[_0xaf2c('0x30')]=_[_0xaf2c('0x46')](_0x2091eb[_0xaf2c('0x30')]);_0x8ebb65[_0xaf2c('0x31')]=_[_0xaf2c('0x32')](_0x8ebb65[_0xaf2c('0x2f')],_0x8ebb65[_0xaf2c('0x30')]);_0x2056b8['attributes']=_['intersection'](_0x8ebb65[_0xaf2c('0x2f')],qs['fields'](_0x2091eb['query']['fields']));_0x2056b8[_0xaf2c('0x33')]=_0x2056b8[_0xaf2c('0x33')][_0xaf2c('0x34')]?_0x2056b8[_0xaf2c('0x33')]:_0x8ebb65['model'];if(_0x2091eb[_0xaf2c('0x30')]['includeAll']){_0x2056b8[_0xaf2c('0x47')]=[{'all':!![]}];}_0x2056b8=_['merge']({},_0x2056b8,_0x2091eb[_0xaf2c('0x3f')]);return db[_0xaf2c('0x40')][_0xaf2c('0x48')](_0x2056b8)[_0xaf2c('0x23')](handleEntityNotFound(_0x532d5f,null))[_0xaf2c('0x23')](respondWithResult(_0x532d5f,null))['catch'](handleError(_0x532d5f,null));};exports[_0xaf2c('0x49')]=function(_0x26afee,_0x4b3ca4){return db['AnalyticMetric'][_0xaf2c('0x49')](_0x26afee['body'],{})[_0xaf2c('0x23')](function(_0x23642b){var _0x17b9ec=_0x26afee[_0xaf2c('0x4a')][_0xaf2c('0x24')]({'plain':!![]});if(!_0x17b9ec)throw new Error(_0xaf2c('0x4b'));if(_0x17b9ec[_0xaf2c('0x4c')]===_0xaf2c('0x4a')){var _0x31ccfe=_0x23642b[_0xaf2c('0x24')]({'plain':!![]});var _0x371486='Metrics';return db[_0xaf2c('0x4d')][_0xaf2c('0x48')]({'where':{'name':_0x371486,'userProfileId':_0x17b9ec['userProfileId']},'raw':!![]})['then'](function(_0x56d7ce){if(_0x56d7ce&&_0x56d7ce[_0xaf2c('0x4e')]===0x0){return db[_0xaf2c('0x26')]['create']({'name':_0x31ccfe[_0xaf2c('0x29')],'resourceId':_0x31ccfe['id'],'type':_0x56d7ce[_0xaf2c('0x29')],'sectionId':_0x56d7ce['id']},{})[_0xaf2c('0x23')](function(){return _0x23642b;});}else{return _0x23642b;}})[_0xaf2c('0x45')](function(_0x265748){logger[_0xaf2c('0x4f')](_0xaf2c('0x50'),_0x265748);throw _0x265748;});}return _0x23642b;})['then'](respondWithResult(_0x4b3ca4,0xc9))[_0xaf2c('0x45')](handleError(_0x4b3ca4,null));};exports[_0xaf2c('0x51')]=function(_0x5771e5,_0x245797){if(_0x5771e5[_0xaf2c('0x52')]['id']){delete _0x5771e5[_0xaf2c('0x52')]['id'];}return db[_0xaf2c('0x40')][_0xaf2c('0x48')]({'where':{'id':_0x5771e5[_0xaf2c('0x53')]['id']}})[_0xaf2c('0x23')](handleEntityNotFound(_0x245797,null))[_0xaf2c('0x23')](saveUpdates(_0x5771e5[_0xaf2c('0x52')],null))[_0xaf2c('0x23')](respondWithResult(_0x245797,null))[_0xaf2c('0x45')](handleError(_0x245797,null));};exports[_0xaf2c('0x27')]=function(_0x411e84,_0x2356a0){return db[_0xaf2c('0x40')][_0xaf2c('0x48')]({'where':{'id':_0x411e84[_0xaf2c('0x53')]['id']}})[_0xaf2c('0x23')](handleEntityNotFound(_0x2356a0,null))[_0xaf2c('0x23')](removeEntity(_0x2356a0,null))[_0xaf2c('0x45')](handleError(_0x2356a0,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 40a0c54..7bbe020 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 _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 +var _0x5e0e=['../../config/environment','exports','define','AnalyticMetric','analytics_metrics','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x512ba5,_0x3520){var _0x3a0cfa=function(_0x56f50e){while(--_0x56f50e){_0x512ba5['push'](_0x512ba5['shift']());}};_0x3a0cfa(++_0x3520);}(_0x5e0e,0x89));var _0xe5e0=function(_0x536bc2,_0x35c4bf){_0x536bc2=_0x536bc2-0x0;var _0x551b56=_0x5e0e[_0x536bc2];return _0x551b56;};'use strict';var _=require(_0xe5e0('0x0'));var util=require(_0xe5e0('0x1'));var logger=require('../../config/logger')(_0xe5e0('0x2'));var moment=require(_0xe5e0('0x3'));var BPromise=require(_0xe5e0('0x4'));var rp=require(_0xe5e0('0x5'));var fs=require('fs');var path=require(_0xe5e0('0x6'));var rimraf=require('rimraf');var config=require(_0xe5e0('0x7'));var attributes=require('./analyticMetric.attributes');module[_0xe5e0('0x8')]=function(_0x3e564e,_0x2ff9ac){return _0x3e564e[_0xe5e0('0x9')](_0xe5e0('0xa'),attributes,{'tableName':_0xe5e0('0xb'),'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 a07c4ca..0a44cf1 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 _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 +var _0xe3b2=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticMetric,\x20%s,\x20%s'];(function(_0x4121a3,_0x736927){var _0x836207=function(_0x363ff5){while(--_0x363ff5){_0x4121a3['push'](_0x4121a3['shift']());}};_0x836207(++_0x736927);}(_0xe3b2,0x107));var _0x2e3b=function(_0x58b0cf,_0x23887d){_0x58b0cf=_0x58b0cf-0x0;var _0x449e1e=_0xe3b2[_0x58b0cf];return _0x449e1e;};'use strict';var _=require(_0x2e3b('0x0'));var util=require(_0x2e3b('0x1'));var moment=require(_0x2e3b('0x2'));var BPromise=require(_0x2e3b('0x3'));var rs=require(_0x2e3b('0x4'));var fs=require('fs');var Redis=require(_0x2e3b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2e3b('0x6'));var logger=require(_0x2e3b('0x7'))(_0x2e3b('0x8'));var config=require(_0x2e3b('0x9'));var jayson=require(_0x2e3b('0xa'));var client=jayson[_0x2e3b('0xb')][_0x2e3b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4523c9,_0x436415,_0x5b6f7){return new BPromise(function(_0x54ebb1,_0x340616){return client[_0x2e3b('0xd')](_0x4523c9,_0x5b6f7)[_0x2e3b('0xe')](function(_0x5b8a41){logger[_0x2e3b('0xf')]('AnalyticMetric,\x20%s,\x20%s',_0x436415,_0x2e3b('0x10'));logger[_0x2e3b('0x11')](_0x2e3b('0x12'),_0x436415,'request\x20sent',JSON[_0x2e3b('0x13')](_0x5b8a41));if(_0x5b8a41['error']){if(_0x5b8a41[_0x2e3b('0x14')][_0x2e3b('0x15')]===0x1f4){logger['error'](_0x2e3b('0x16'),_0x436415,_0x5b8a41[_0x2e3b('0x14')][_0x2e3b('0x17')]);return _0x340616(_0x5b8a41['error']['message']);}logger[_0x2e3b('0x14')](_0x2e3b('0x16'),_0x436415,_0x5b8a41[_0x2e3b('0x14')][_0x2e3b('0x17')]);return _0x54ebb1(_0x5b8a41[_0x2e3b('0x14')][_0x2e3b('0x17')]);}else{logger[_0x2e3b('0xf')](_0x2e3b('0x16'),_0x436415,_0x2e3b('0x10'));_0x54ebb1(_0x5b8a41[_0x2e3b('0x18')]['message']);}})[_0x2e3b('0x19')](function(_0x16e7b1){logger['error'](_0x2e3b('0x16'),_0x436415,_0x16e7b1);_0x340616(_0x16e7b1);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index d594626..f120de4 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 _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 +var _0x576b=['../../components/auth/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','connect-timeout','express','fs-extra'];(function(_0x1b2a78,_0xd2877c){var _0x560b1d=function(_0x1221f0){while(--_0x1221f0){_0x1b2a78['push'](_0x1b2a78['shift']());}};_0x560b1d(++_0xd2877c);}(_0x576b,0x1d9));var _0xb576=function(_0x1adc6c,_0x517db0){_0x1adc6c=_0x1adc6c-0x0;var _0x4dcb2f=_0x576b[_0x1adc6c];return _0x4dcb2f;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xb576('0x0'));var express=require(_0xb576('0x1'));var router=express['Router']();var fs_extra=require(_0xb576('0x2'));var auth=require(_0xb576('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xb576('0x4'));var controller=require(_0xb576('0x5'));router[_0xb576('0x6')]('/',auth[_0xb576('0x7')](),controller[_0xb576('0x8')]);router[_0xb576('0x6')](_0xb576('0x9'),auth[_0xb576('0x7')](),controller[_0xb576('0xa')]);router[_0xb576('0xb')]('/',auth[_0xb576('0x7')](),controller[_0xb576('0xc')]);router[_0xb576('0xd')](_0xb576('0x9'),auth[_0xb576('0x7')](),controller['update']);router[_0xb576('0xe')]('/:id',auth[_0xb576('0x7')](),controller[_0xb576('0xf')]);module[_0xb576('0x10')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 7c9c811..da84aff 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 _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 +var _0x73ef=['sequelize','exports'];(function(_0x4f1eff,_0xd310f4){var _0x182588=function(_0xc04880){while(--_0xc04880){_0x4f1eff['push'](_0x4f1eff['shift']());}};_0x182588(++_0xd310f4);}(_0x73ef,0xd4));var _0xf73e=function(_0x5d155d,_0x2392ce){_0x5d155d=_0x5d155d-0x0;var _0x5b41e6=_0x73ef[_0x5d155d];return _0x5b41e6;};'use strict';var Sequelize=require(_0xf73e('0x0'));module[_0xf73e('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 9fc6087..1e2a4be 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 _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 +var _0x0038=['findAll','rows','catch','params','find','create','body','destroy','rimraf','fast-json-patch','moment','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','send','index','map','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','name','options','AnalyticTreeReport','includeAll','include'];(function(_0x16b8e6,_0xce24fe){var _0xf5bab2=function(_0x5d21e2){while(--_0x5d21e2){_0x16b8e6['push'](_0x16b8e6['shift']());}};_0xf5bab2(++_0xce24fe);}(_0x0038,0x124));var _0x8003=function(_0x43b4f3,_0x22636e){_0x43b4f3=_0x43b4f3-0x0;var _0x31911f=_0x0038[_0x43b4f3];return _0x31911f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8003('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8003('0x1'));var rp=require('request-promise');var moment=require(_0x8003('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x8003('0x3'));var util=require(_0x8003('0x4'));var path=require(_0x8003('0x5'));var sox=require('sox');var csv=require(_0x8003('0x6'));var ejs=require(_0x8003('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8003('0x8'));var squel=require(_0x8003('0x9'));var crypto=require('crypto');var jsforce=require(_0x8003('0xa'));var deskjs=require(_0x8003('0xb'));var toCsv=require(_0x8003('0x6'));var querystring=require('querystring');var Papa=require(_0x8003('0xc'));var Redis=require(_0x8003('0xd'));var authService=require(_0x8003('0xe'));var qs=require(_0x8003('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x8003('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x8003('0x11'));var db=require(_0x8003('0x12'))['db'];function respondWithStatusCode(_0x2cc303,_0x2633d3){_0x2633d3=_0x2633d3||0xcc;return function(_0xcd86d5){if(_0xcd86d5){return _0x2cc303[_0x8003('0x13')](_0x2633d3);}return _0x2cc303[_0x8003('0x14')](_0x2633d3)[_0x8003('0x15')]();};}function respondWithResult(_0x4af77a,_0xae5de7){_0xae5de7=_0xae5de7||0xc8;return function(_0x325572){if(_0x325572){return _0x4af77a[_0x8003('0x14')](_0xae5de7)[_0x8003('0x16')](_0x325572);}};}function respondWithFilteredResult(_0xbad6b8,_0xbd4c1b){return function(_0x491028){if(_0x491028){var _0x537a0b=typeof _0xbd4c1b[_0x8003('0x17')]===_0x8003('0x18')&&typeof _0xbd4c1b[_0x8003('0x19')]===_0x8003('0x18');var _0xe70ae4=_0x491028[_0x8003('0x1a')];var _0x25334a=_0x537a0b?0x0:_0xbd4c1b[_0x8003('0x17')];var _0x2322f7=_0x537a0b?_0x491028[_0x8003('0x1a')]:_0xbd4c1b[_0x8003('0x17')]+_0xbd4c1b[_0x8003('0x19')];var _0x4caf87;if(_0x2322f7>=_0xe70ae4){_0x2322f7=_0xe70ae4;_0x4caf87=0xc8;}else{_0x4caf87=0xce;}_0xbad6b8[_0x8003('0x14')](_0x4caf87);return _0xbad6b8[_0x8003('0x1b')](_0x8003('0x1c'),_0x25334a+'-'+_0x2322f7+'/'+_0xe70ae4)[_0x8003('0x16')](_0x491028);}return null;};}function patchUpdates(_0x4e15a6){return function(_0x12aabc){try{jsonpatch[_0x8003('0x1d')](_0x12aabc,_0x4e15a6,!![]);}catch(_0x14d255){return BPromise[_0x8003('0x1e')](_0x14d255);}return _0x12aabc[_0x8003('0x1f')]();};}function saveUpdates(_0x378d3d,_0x584021){return function(_0x400f22){if(_0x400f22){return _0x400f22[_0x8003('0x20')](_0x378d3d)[_0x8003('0x21')](function(_0x68f1d2){return _0x68f1d2;});}return null;};}function removeEntity(_0x26e0de,_0x526742){return function(_0x13f421){if(_0x13f421){return _0x13f421['destroy']()[_0x8003('0x21')](function(){_0x26e0de[_0x8003('0x14')](0xcc)[_0x8003('0x15')]();});}};}function handleEntityNotFound(_0x3434f6,_0x187768){return function(_0x4fcf4d){if(!_0x4fcf4d){_0x3434f6[_0x8003('0x13')](0x194);}return _0x4fcf4d;};}function handleError(_0x8c0fad,_0x114809){_0x114809=_0x114809||0x1f4;return function(_0x454eb6){logger[_0x8003('0x22')](_0x454eb6[_0x8003('0x23')]);if(_0x454eb6['name']){delete _0x454eb6['name'];}_0x8c0fad['status'](_0x114809)[_0x8003('0x24')](_0x454eb6);};}exports[_0x8003('0x25')]=function(_0x378778,_0x3a7906){var _0x6da951={},_0x3939a6={},_0x3135ab={'count':0x0,'rows':[]};var _0x49334c=_[_0x8003('0x26')](db['AnalyticTreeReport']['rawAttributes'],function(_0x6b713d){return{'name':_0x6b713d[_0x8003('0x27')],'type':_0x6b713d[_0x8003('0x28')]['key']};});_0x3939a6[_0x8003('0x29')]=_[_0x8003('0x26')](_0x49334c,'name');_0x3939a6['query']=_[_0x8003('0x2a')](_0x378778[_0x8003('0x2b')]);_0x3939a6[_0x8003('0x2c')]=_[_0x8003('0x2d')](_0x3939a6[_0x8003('0x29')],_0x3939a6[_0x8003('0x2b')]);_0x6da951[_0x8003('0x2e')]=_['intersection'](_0x3939a6[_0x8003('0x29')],qs[_0x8003('0x2f')](_0x378778['query']['fields']));_0x6da951[_0x8003('0x2e')]=_0x6da951[_0x8003('0x2e')][_0x8003('0x30')]?_0x6da951['attributes']:_0x3939a6[_0x8003('0x29')];if(!_0x378778['query'][_0x8003('0x31')](_0x8003('0x32'))){_0x6da951[_0x8003('0x19')]=qs['limit'](_0x378778['query']['limit']);_0x6da951[_0x8003('0x17')]=qs[_0x8003('0x17')](_0x378778[_0x8003('0x2b')]['offset']);}_0x6da951[_0x8003('0x33')]=qs[_0x8003('0x34')](_0x378778['query']['sort']);_0x6da951[_0x8003('0x35')]=qs[_0x8003('0x2c')](_[_0x8003('0x36')](_0x378778[_0x8003('0x2b')],_0x3939a6['filters']),_0x49334c);if(_0x378778['query'][_0x8003('0x37')]){_0x6da951['where']=_[_0x8003('0x38')](_0x6da951[_0x8003('0x35')],{'$or':_[_0x8003('0x26')](_0x49334c,function(_0x6f0486){if(_0x6f0486[_0x8003('0x28')]!==_0x8003('0x39')){var _0x78264a={};_0x78264a[_0x6f0486[_0x8003('0x3a')]]={'$like':'%'+_0x378778['query'][_0x8003('0x37')]+'%'};return _0x78264a;}})});}_0x6da951=_['merge']({},_0x6da951,_0x378778[_0x8003('0x3b')]);var _0x1f568a={'where':_0x6da951[_0x8003('0x35')]};return db[_0x8003('0x3c')][_0x8003('0x1a')](_0x1f568a)[_0x8003('0x21')](function(_0x2e00d9){_0x3135ab['count']=_0x2e00d9;if(_0x378778[_0x8003('0x2b')][_0x8003('0x3d')]){_0x6da951[_0x8003('0x3e')]=[{'all':!![]}];}return db[_0x8003('0x3c')][_0x8003('0x3f')](_0x6da951);})[_0x8003('0x21')](function(_0x254867){_0x3135ab[_0x8003('0x40')]=_0x254867;return _0x3135ab;})['then'](respondWithFilteredResult(_0x3a7906,_0x6da951))[_0x8003('0x41')](handleError(_0x3a7906,null));};exports['show']=function(_0x4215cc,_0x8a975){var _0x102d48={'raw':!![],'where':{'id':_0x4215cc[_0x8003('0x42')]['id']}},_0xe0fcd={};_0xe0fcd['model']=_[_0x8003('0x2a')](db['AnalyticTreeReport']['rawAttributes']);_0xe0fcd['query']=_[_0x8003('0x2a')](_0x4215cc[_0x8003('0x2b')]);_0xe0fcd[_0x8003('0x2c')]=_['intersection'](_0xe0fcd[_0x8003('0x29')],_0xe0fcd['query']);_0x102d48[_0x8003('0x2e')]=_[_0x8003('0x2d')](_0xe0fcd[_0x8003('0x29')],qs[_0x8003('0x2f')](_0x4215cc[_0x8003('0x2b')][_0x8003('0x2f')]));_0x102d48[_0x8003('0x2e')]=_0x102d48[_0x8003('0x2e')][_0x8003('0x30')]?_0x102d48[_0x8003('0x2e')]:_0xe0fcd[_0x8003('0x29')];if(_0x4215cc[_0x8003('0x2b')][_0x8003('0x3d')]){_0x102d48[_0x8003('0x3e')]=[{'all':!![]}];}_0x102d48=_[_0x8003('0x38')]({},_0x102d48,_0x4215cc['options']);return db[_0x8003('0x3c')][_0x8003('0x43')](_0x102d48)[_0x8003('0x21')](handleEntityNotFound(_0x8a975,null))[_0x8003('0x21')](respondWithResult(_0x8a975,null))[_0x8003('0x41')](handleError(_0x8a975,null));};exports[_0x8003('0x44')]=function(_0x56a621,_0x40e0b8){return db[_0x8003('0x3c')]['create'](_0x56a621[_0x8003('0x45')],{})[_0x8003('0x21')](respondWithResult(_0x40e0b8,0xc9))['catch'](handleError(_0x40e0b8,null));};exports[_0x8003('0x20')]=function(_0x2e1a9b,_0x5c2119){if(_0x2e1a9b['body']['id']){delete _0x2e1a9b[_0x8003('0x45')]['id'];}return db['AnalyticTreeReport'][_0x8003('0x43')]({'where':{'id':_0x2e1a9b[_0x8003('0x42')]['id']}})['then'](handleEntityNotFound(_0x5c2119,null))['then'](saveUpdates(_0x2e1a9b['body'],null))[_0x8003('0x21')](respondWithResult(_0x5c2119,null))['catch'](handleError(_0x5c2119,null));};exports[_0x8003('0x46')]=function(_0x397a2c,_0x3f3a7f){return db[_0x8003('0x3c')][_0x8003('0x43')]({'where':{'id':_0x397a2c[_0x8003('0x42')]['id']}})['then'](handleEntityNotFound(_0x3f3a7f,null))[_0x8003('0x21')](removeEntity(_0x3f3a7f,null))[_0x8003('0x41')](handleError(_0x3f3a7f,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 0500fe7..51bbaf3 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 _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 +var _0xe011=['./analyticTreeReport.attributes','exports','analytics_report_trees','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x12b83d,_0x4bcec7){var _0x1fd39d=function(_0x449185){while(--_0x449185){_0x12b83d['push'](_0x12b83d['shift']());}};_0x1fd39d(++_0x4bcec7);}(_0xe011,0x1a7));var _0x1e01=function(_0x4ac60a,_0x503a99){_0x4ac60a=_0x4ac60a-0x0;var _0x4b22e8=_0xe011[_0x4ac60a];return _0x4b22e8;};'use strict';var _=require(_0x1e01('0x0'));var util=require(_0x1e01('0x1'));var logger=require(_0x1e01('0x2'))(_0x1e01('0x3'));var moment=require(_0x1e01('0x4'));var BPromise=require(_0x1e01('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1e01('0x6'));var rimraf=require(_0x1e01('0x7'));var config=require(_0x1e01('0x8'));var attributes=require(_0x1e01('0x9'));module[_0x1e01('0xa')]=function(_0xc56213,_0x87cc4c){return _0xc56213['define']('AnalyticTreeReport',attributes,{'tableName':_0x1e01('0xb'),'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 0f0b500..7e1da06 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 _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 +var _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x2bf526,_0x8b9522){var _0x1067ff=function(_0x5f49ae){while(--_0x5f49ae){_0x2bf526['push'](_0x2bf526['shift']());}};_0x1067ff(++_0x8b9522);}(_0x5f66,0x1a0));var _0x65f6=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x5f66[_0x5d4607];return _0x5e4a86;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('AnalyticTreeReport,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 6c6902e..2d457a3 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 _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 +var _0x7f99=['index','/:id','isAuthenticated','show','post','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./analyticTreeReport.controller'];(function(_0x282ce5,_0x19100e){var _0x13413d=function(_0x2e4b66){while(--_0x2e4b66){_0x282ce5['push'](_0x282ce5['shift']());}};_0x13413d(++_0x19100e);}(_0x7f99,0xc4));var _0x97f9=function(_0x5b6375,_0x563718){_0x5b6375=_0x5b6375-0x0;var _0x4045b4=_0x7f99[_0x5b6375];return _0x4045b4;};'use strict';var multer=require(_0x97f9('0x0'));var util=require(_0x97f9('0x1'));var path=require(_0x97f9('0x2'));var timeout=require(_0x97f9('0x3'));var express=require('express');var router=express[_0x97f9('0x4')]();var fs_extra=require(_0x97f9('0x5'));var auth=require(_0x97f9('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x97f9('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x97f9('0x8')]);router['get'](_0x97f9('0x9'),auth[_0x97f9('0xa')](),controller[_0x97f9('0xb')]);router[_0x97f9('0xc')]('/',auth[_0x97f9('0xa')](),controller['create']);router[_0x97f9('0xd')]('/:id',auth[_0x97f9('0xa')](),controller[_0x97f9('0xe')]);router['delete'](_0x97f9('0x9'),auth[_0x97f9('0xa')](),controller[_0x97f9('0xf')]);module[_0x97f9('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 97f4068..7352b26 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 _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 +var _0x639d=['STRING','sequelize','exports'];(function(_0x3fad3f,_0x4101dd){var _0x3d398d=function(_0x1e3745){while(--_0x1e3745){_0x3fad3f['push'](_0x3fad3f['shift']());}};_0x3d398d(++_0x4101dd);}(_0x639d,0xbb));var _0xd639=function(_0x4af16d,_0x374205){_0x4af16d=_0x4af16d-0x0;var _0x1e99ce=_0x639d[_0x4af16d];return _0x1e99ce;};'use strict';var Sequelize=require(_0xd639('0x0'));module[_0xd639('0x1')]={'name':{'type':Sequelize[_0xd639('0x2')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xd639('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 5a8645f..108605d 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 _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 +var _0x0c2d=['key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','includeAll','rows','catch','show','include','options','find','clone','params','get','omit','body','createdAt','create','file','originalname','filename','mimetype','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','Attachment','rawAttributes','fieldName','type'];(function(_0x54baa3,_0x52e285){var _0x103c35=function(_0xee383a){while(--_0xee383a){_0x54baa3['push'](_0x54baa3['shift']());}};_0x103c35(++_0x52e285);}(_0x0c2d,0x13a));var _0xd0c2=function(_0x1c7d86,_0x3c0301){_0x1c7d86=_0x1c7d86-0x0;var _0x5c826f=_0x0c2d[_0x1c7d86];return _0x5c826f;};'use strict';var emlformat=require(_0xd0c2('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd0c2('0x1'));var rp=require(_0xd0c2('0x2'));var moment=require('moment');var BPromise=require(_0xd0c2('0x3'));var Mustache=require(_0xd0c2('0x4'));var util=require(_0xd0c2('0x5'));var path=require('path');var sox=require(_0xd0c2('0x6'));var csv=require(_0xd0c2('0x7'));var ejs=require(_0xd0c2('0x8'));var fs=require('fs');var fs_extra=require(_0xd0c2('0x9'));var _=require(_0xd0c2('0xa'));var squel=require(_0xd0c2('0xb'));var crypto=require('crypto');var jsforce=require(_0xd0c2('0xc'));var deskjs=require(_0xd0c2('0xd'));var toCsv=require(_0xd0c2('0x7'));var querystring=require(_0xd0c2('0xe'));var Papa=require('papaparse');var Redis=require(_0xd0c2('0xf'));var authService=require(_0xd0c2('0x10'));var qs=require(_0xd0c2('0x11'));var as=require(_0xd0c2('0x12'));var hardwareService=require(_0xd0c2('0x13'));var logger=require(_0xd0c2('0x14'))(_0xd0c2('0x15'));var utils=require('../../config/utils');var config=require(_0xd0c2('0x16'));var licenseUtil=require(_0xd0c2('0x17'));var db=require(_0xd0c2('0x18'))['db'];function respondWithStatusCode(_0x40f150,_0x3f3e77){_0x3f3e77=_0x3f3e77||0xcc;return function(_0x25ba63){if(_0x25ba63){return _0x40f150[_0xd0c2('0x19')](_0x3f3e77);}return _0x40f150[_0xd0c2('0x1a')](_0x3f3e77)['end']();};}function respondWithResult(_0x3475f5,_0x7a128c){_0x7a128c=_0x7a128c||0xc8;return function(_0x4dd39c){if(_0x4dd39c){return _0x3475f5[_0xd0c2('0x1a')](_0x7a128c)[_0xd0c2('0x1b')](_0x4dd39c);}};}function respondWithFilteredResult(_0x1bb9a4,_0x20e573){return function(_0x4678a4){if(_0x4678a4){var _0x325d28=typeof _0x20e573[_0xd0c2('0x1c')]==='undefined'&&typeof _0x20e573[_0xd0c2('0x1d')]===_0xd0c2('0x1e');var _0x1ab0d4=_0x4678a4[_0xd0c2('0x1f')];var _0x47c5c7=_0x325d28?0x0:_0x20e573[_0xd0c2('0x1c')];var _0x254639=_0x325d28?_0x4678a4[_0xd0c2('0x1f')]:_0x20e573[_0xd0c2('0x1c')]+_0x20e573['limit'];var _0x44fda3;if(_0x254639>=_0x1ab0d4){_0x254639=_0x1ab0d4;_0x44fda3=0xc8;}else{_0x44fda3=0xce;}_0x1bb9a4[_0xd0c2('0x1a')](_0x44fda3);return _0x1bb9a4[_0xd0c2('0x20')](_0xd0c2('0x21'),_0x47c5c7+'-'+_0x254639+'/'+_0x1ab0d4)[_0xd0c2('0x1b')](_0x4678a4);}return null;};}function patchUpdates(_0x2fd75d){return function(_0x238c98){try{jsonpatch[_0xd0c2('0x22')](_0x238c98,_0x2fd75d,!![]);}catch(_0x3b2add){return BPromise[_0xd0c2('0x23')](_0x3b2add);}return _0x238c98[_0xd0c2('0x24')]();};}function saveUpdates(_0x152aa8,_0x1a5668){return function(_0x579dba){if(_0x579dba){return _0x579dba[_0xd0c2('0x25')](_0x152aa8)[_0xd0c2('0x26')](function(_0x4aa1c2){return _0x4aa1c2;});}return null;};}function removeEntity(_0x5d4081,_0x3e4dfb){return function(_0x46a571){if(_0x46a571){return _0x46a571[_0xd0c2('0x27')]()[_0xd0c2('0x26')](function(){_0x5d4081[_0xd0c2('0x1a')](0xcc)[_0xd0c2('0x28')]();});}};}function handleEntityNotFound(_0x3b82c1,_0x3c4064){return function(_0x29a270){if(!_0x29a270){_0x3b82c1[_0xd0c2('0x19')](0x194);}return _0x29a270;};}function handleError(_0x107fb0,_0x496d2d){_0x496d2d=_0x496d2d||0x1f4;return function(_0x1e7ba5){logger[_0xd0c2('0x29')](_0x1e7ba5['stack']);if(_0x1e7ba5['name']){delete _0x1e7ba5[_0xd0c2('0x2a')];}_0x107fb0['status'](_0x496d2d)[_0xd0c2('0x2b')](_0x1e7ba5);};}exports[_0xd0c2('0x2c')]=function(_0x1e645c,_0x19d7b9){var _0x595ab6={},_0x2b6db3={},_0x4b5c87={'count':0x0,'rows':[]};var _0x493d69=_[_0xd0c2('0x2d')](db[_0xd0c2('0x2e')][_0xd0c2('0x2f')],function(_0x1c83ea){return{'name':_0x1c83ea[_0xd0c2('0x30')],'type':_0x1c83ea[_0xd0c2('0x31')][_0xd0c2('0x32')]};});_0x2b6db3[_0xd0c2('0x33')]=_[_0xd0c2('0x2d')](_0x493d69,_0xd0c2('0x2a'));_0x2b6db3['query']=_[_0xd0c2('0x34')](_0x1e645c[_0xd0c2('0x35')]);_0x2b6db3[_0xd0c2('0x36')]=_[_0xd0c2('0x37')](_0x2b6db3[_0xd0c2('0x33')],_0x2b6db3[_0xd0c2('0x35')]);_0x595ab6['attributes']=_[_0xd0c2('0x37')](_0x2b6db3[_0xd0c2('0x33')],qs[_0xd0c2('0x38')](_0x1e645c['query']['fields']));_0x595ab6[_0xd0c2('0x39')]=_0x595ab6['attributes'][_0xd0c2('0x3a')]?_0x595ab6[_0xd0c2('0x39')]:_0x2b6db3[_0xd0c2('0x33')];if(!_0x1e645c[_0xd0c2('0x35')][_0xd0c2('0x3b')](_0xd0c2('0x3c'))){_0x595ab6[_0xd0c2('0x1d')]=qs[_0xd0c2('0x1d')](_0x1e645c[_0xd0c2('0x35')]['limit']);_0x595ab6[_0xd0c2('0x1c')]=qs[_0xd0c2('0x1c')](_0x1e645c[_0xd0c2('0x35')][_0xd0c2('0x1c')]);}_0x595ab6[_0xd0c2('0x3d')]=qs[_0xd0c2('0x3e')](_0x1e645c[_0xd0c2('0x35')][_0xd0c2('0x3e')]);_0x595ab6[_0xd0c2('0x3f')]=qs[_0xd0c2('0x36')](_['pick'](_0x1e645c['query'],_0x2b6db3[_0xd0c2('0x36')]),_0x493d69);if(_0x1e645c[_0xd0c2('0x35')][_0xd0c2('0x40')]){_0x595ab6[_0xd0c2('0x3f')]=_[_0xd0c2('0x41')](_0x595ab6['where'],{'$or':_[_0xd0c2('0x2d')](_0x493d69,function(_0x32ffea){if(_0x32ffea['type']!=='VIRTUAL'){var _0x1bd301={};_0x1bd301[_0x32ffea['name']]={'$like':'%'+_0x1e645c['query'][_0xd0c2('0x40')]+'%'};return _0x1bd301;}})});}_0x595ab6=_['merge']({},_0x595ab6,_0x1e645c['options']);var _0x17118c={'where':_0x595ab6['where']};return db[_0xd0c2('0x2e')][_0xd0c2('0x1f')](_0x17118c)['then'](function(_0x183fda){_0x4b5c87[_0xd0c2('0x1f')]=_0x183fda;if(_0x1e645c[_0xd0c2('0x35')][_0xd0c2('0x42')]){_0x595ab6['include']=[{'all':!![]}];}return db[_0xd0c2('0x2e')]['findAll'](_0x595ab6);})[_0xd0c2('0x26')](function(_0x4cb396){_0x4b5c87[_0xd0c2('0x43')]=_0x4cb396;return _0x4b5c87;})[_0xd0c2('0x26')](respondWithFilteredResult(_0x19d7b9,_0x595ab6))[_0xd0c2('0x44')](handleError(_0x19d7b9,null));};exports[_0xd0c2('0x45')]=function(_0x2d70c9,_0x1f2434){var _0x317c2c={'raw':!![],'where':{'id':_0x2d70c9['params']['id']}},_0x29930e={};_0x29930e['model']=_[_0xd0c2('0x34')](db[_0xd0c2('0x2e')]['rawAttributes']);_0x29930e[_0xd0c2('0x35')]=_[_0xd0c2('0x34')](_0x2d70c9[_0xd0c2('0x35')]);_0x29930e['filters']=_[_0xd0c2('0x37')](_0x29930e[_0xd0c2('0x33')],_0x29930e[_0xd0c2('0x35')]);_0x317c2c[_0xd0c2('0x39')]=_[_0xd0c2('0x37')](_0x29930e['model'],qs[_0xd0c2('0x38')](_0x2d70c9['query']['fields']));_0x317c2c[_0xd0c2('0x39')]=_0x317c2c[_0xd0c2('0x39')]['length']?_0x317c2c['attributes']:_0x29930e[_0xd0c2('0x33')];if(_0x2d70c9[_0xd0c2('0x35')]['includeAll']){_0x317c2c[_0xd0c2('0x46')]=[{'all':!![]}];}_0x317c2c=_['merge']({},_0x317c2c,_0x2d70c9[_0xd0c2('0x47')]);return db[_0xd0c2('0x2e')][_0xd0c2('0x48')](_0x317c2c)[_0xd0c2('0x26')](handleEntityNotFound(_0x1f2434,null))[_0xd0c2('0x26')](respondWithResult(_0x1f2434,null))['catch'](handleError(_0x1f2434,null));};exports[_0xd0c2('0x49')]=function(_0x2546b0,_0x5a80f){var _0x333cc8={'where':{'id':_0x2546b0[_0xd0c2('0x4a')]['id']}},_0x538ec4={};_0x538ec4['model']=_[_0xd0c2('0x34')](db[_0xd0c2('0x2e')][_0xd0c2('0x2f')]);_0x333cc8['attributes']=_[_0xd0c2('0x37')](_0x538ec4['model'],qs['fields'](_0x2546b0[_0xd0c2('0x35')][_0xd0c2('0x38')]));_0x333cc8['attributes']=_0x333cc8[_0xd0c2('0x39')][_0xd0c2('0x3a')]?_0x333cc8[_0xd0c2('0x39')]:_0x538ec4['model'];if(_0x2546b0['query'][_0xd0c2('0x42')]){_0x333cc8['include']=[{'all':!![]}];}_0x333cc8=_['merge']({},_0x333cc8,_0x2546b0['options']);return db[_0xd0c2('0x2e')][_0xd0c2('0x48')](_0x333cc8)[_0xd0c2('0x26')](handleEntityNotFound(_0x5a80f,null))['then'](function(_0x221050){if(_0x221050){var _0x46a918=_0x221050[_0xd0c2('0x4b')]({'plain':!![]});_0x46a918=qs[_0xd0c2('0x4c')](_0x46a918,['id','createdAt','updatedAt']);_0x2546b0[_0xd0c2('0x4d')]=_['omit'](_0x2546b0[_0xd0c2('0x4d')],['id',_0xd0c2('0x4e'),'updatedAt']);return db[_0xd0c2('0x2e')][_0xd0c2('0x4f')](_['merge'](_0x46a918,_0x2546b0['body']),{'include':_0x2546b0[_0xd0c2('0x35')]['includeAll']?[{'all':!![]}]:undefined});}})[_0xd0c2('0x26')](respondWithResult(_0x5a80f,0xc9))['catch'](handleError(_0x5a80f,null));};exports['update']=function(_0x333c17,_0x2d8e20){if(_0x333c17[_0xd0c2('0x4d')]['id']){delete _0x333c17['body']['id'];}return db[_0xd0c2('0x2e')][_0xd0c2('0x48')]({'where':{'id':_0x333c17[_0xd0c2('0x4a')]['id']}})[_0xd0c2('0x26')](handleEntityNotFound(_0x2d8e20,null))[_0xd0c2('0x26')](saveUpdates(_0x333c17[_0xd0c2('0x4d')],null))[_0xd0c2('0x26')](respondWithResult(_0x2d8e20,null))[_0xd0c2('0x44')](handleError(_0x2d8e20,null));};exports['destroy']=function(_0x554ddf,_0x530f98){return db['Attachment'][_0xd0c2('0x48')]({'where':{'id':_0x554ddf[_0xd0c2('0x4a')]['id']}})['then'](handleEntityNotFound(_0x530f98,null))[_0xd0c2('0x26')](removeEntity(_0x530f98,null))[_0xd0c2('0x44')](handleError(_0x530f98,null));};exports[_0xd0c2('0x4f')]=function(_0x4f4837,_0x4fa5b4,_0x1e4344){_0x4f4837[_0xd0c2('0x4d')][_0xd0c2('0x2a')]=_0x4f4837[_0xd0c2('0x50')][_0xd0c2('0x51')];_0x4f4837[_0xd0c2('0x4d')]['basename']=_0x4f4837[_0xd0c2('0x50')][_0xd0c2('0x52')];_0x4f4837[_0xd0c2('0x4d')][_0xd0c2('0x31')]=_0x4f4837[_0xd0c2('0x50')][_0xd0c2('0x53')];return db['Attachment']['create'](_0x4f4837['body'])[_0xd0c2('0x26')](respondWithResult(_0x4fa5b4,0xc9))[_0xd0c2('0x44')](handleError(_0x4fa5b4,null));};exports[_0xd0c2('0x54')]=function(_0x3b6889,_0x32407a,_0x167ab0){return db[_0xd0c2('0x2e')][_0xd0c2('0x55')]({'where':{'id':_0x3b6889[_0xd0c2('0x4a')]['id']},'raw':!![]})[_0xd0c2('0x26')](handleEntityNotFound(_0x32407a,null))['then'](function(_0x5f488){if(_0x5f488){var _0xa6c36d=_0x5f488[_0xd0c2('0x56')]!==null;var _0x4ea6c1=path[_0xd0c2('0x57')](config[_0xd0c2('0x58')],_0xd0c2('0x59'));if(_0xa6c36d){_0x4ea6c1=path[_0xd0c2('0x57')](_0x4ea6c1,_0xd0c2('0x5a'));}var _0x513b28=path[_0xd0c2('0x57')](_0x4ea6c1,_0x5f488['basename']);return _0x32407a[_0xd0c2('0x54')](_0x513b28);}})['catch'](handleError(_0x32407a,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index fdd407c..6c0158f 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 _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 +var _0x64f8=['request-promise','path','rimraf','../../config/environment','./attachment.attributes','exports','Attachment','attachments','util','../../config/logger','api','moment'];(function(_0x558099,_0x4be744){var _0x18ac2e=function(_0x1e1e9b){while(--_0x1e1e9b){_0x558099['push'](_0x558099['shift']());}};_0x18ac2e(++_0x4be744);}(_0x64f8,0x1b8));var _0x864f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x64f8[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x864f('0x0'));var logger=require(_0x864f('0x1'))(_0x864f('0x2'));var moment=require(_0x864f('0x3'));var BPromise=require('bluebird');var rp=require(_0x864f('0x4'));var fs=require('fs');var path=require(_0x864f('0x5'));var rimraf=require(_0x864f('0x6'));var config=require(_0x864f('0x7'));var attributes=require(_0x864f('0x8'));module[_0x864f('0x9')]=function(_0x3125eb,_0x416da7){return _0x3125eb['define'](_0x864f('0xa'),attributes,{'tableName':_0x864f('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 9a617c9..d82d1bb 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 _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 +var _0x8e0d=['CreateAttachment','Attachment','body','options','raw','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','Attachment,\x20%s,\x20%s','debug','stringify','error','message','info','request\x20sent','result','catch'];(function(_0x58965a,_0x2e71db){var _0x254efc=function(_0xf14fb4){while(--_0xf14fb4){_0x58965a['push'](_0x58965a['shift']());}};_0x254efc(++_0x2e71db);}(_0x8e0d,0x82));var _0xd8e0=function(_0x3c4a7c,_0x2f4e3c){_0x3c4a7c=_0x3c4a7c-0x0;var _0xf13d1e=_0x8e0d[_0x3c4a7c];return _0xf13d1e;};'use strict';var _=require(_0xd8e0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd8e0('0x1'));var rs=require(_0xd8e0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd8e0('0x3'))['db'];var utils=require(_0xd8e0('0x4'));var logger=require(_0xd8e0('0x5'))(_0xd8e0('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd8e0('0x7')][_0xd8e0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x42d42b,_0x1e4616,_0x5e9735){return new BPromise(function(_0xd0c45c,_0x144a8a){return client[_0xd8e0('0x9')](_0x42d42b,_0x5e9735)[_0xd8e0('0xa')](function(_0x127a32){logger['info'](_0xd8e0('0xb'),_0x1e4616,'request\x20sent');logger[_0xd8e0('0xc')]('Attachment,\x20%s,\x20%s,\x20%s',_0x1e4616,'request\x20sent',JSON[_0xd8e0('0xd')](_0x127a32));if(_0x127a32[_0xd8e0('0xe')]){if(_0x127a32[_0xd8e0('0xe')]['code']===0x1f4){logger['error'](_0xd8e0('0xb'),_0x1e4616,_0x127a32['error'][_0xd8e0('0xf')]);return _0x144a8a(_0x127a32['error']['message']);}logger['error'](_0xd8e0('0xb'),_0x1e4616,_0x127a32['error'][_0xd8e0('0xf')]);return _0xd0c45c(_0x127a32[_0xd8e0('0xe')][_0xd8e0('0xf')]);}else{logger[_0xd8e0('0x10')](_0xd8e0('0xb'),_0x1e4616,_0xd8e0('0x11'));_0xd0c45c(_0x127a32[_0xd8e0('0x12')][_0xd8e0('0xf')]);}})[_0xd8e0('0x13')](function(_0x488ed9){logger[_0xd8e0('0xe')](_0xd8e0('0xb'),_0x1e4616,_0x488ed9);_0x144a8a(_0x488ed9);});});}exports[_0xd8e0('0x14')]=function(_0x42586f){var _0x3b28bc=this;return new Promise(function(_0x2bf195,_0x2c4eaf){return db[_0xd8e0('0x15')]['create'](_0x42586f[_0xd8e0('0x16')],{'raw':_0x42586f[_0xd8e0('0x17')]?_0x42586f['options'][_0xd8e0('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x55ce9b){logger['info'](_0xd8e0('0x14'),_0x42586f);logger[_0xd8e0('0xc')]('CreateAttachment',_0x42586f,JSON[_0xd8e0('0xd')](_0x55ce9b));_0x2bf195(_0x55ce9b);})[_0xd8e0('0x13')](function(_0x1d31de){logger[_0xd8e0('0xe')](_0xd8e0('0x14'),_0x1d31de[_0xd8e0('0xf')],_0x42586f);_0x2c4eaf(_0x3b28bc['error'](0x1f4,_0x1d31de[_0xd8e0('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 0b1a689..28ea6f2 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 _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 +var _0xadb5=['root','format','%s-%s','originalname','replace','file','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','post','/:id/clone'];(function(_0x5ba97f,_0x77609c){var _0x370cf2=function(_0x2e271d){while(--_0x2e271d){_0x5ba97f['push'](_0x5ba97f['shift']());}};_0x370cf2(++_0x77609c);}(_0xadb5,0xad));var _0x5adb=function(_0x2117af,_0x491d3f){_0x2117af=_0x2117af-0x0;var _0x4583c7=_0xadb5[_0x2117af];return _0x4583c7;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./attachment.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0xe')](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller['clone']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1a8f66,_0x1ea238,_0x82e67e){_0x82e67e(null,path['join'](config[_0x5adb('0x10')],'server/files/attachments/'));},'filename':function(_0x2a0b70,_0x5433bf,_0x8cfcc6){_0x8cfcc6(null,util[_0x5adb('0x11')](_0x5adb('0x12'),Date['now'](),_0x5433bf[_0x5adb('0x13')][_0x5adb('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x5adb('0xe')]('/',upload['single'](_0x5adb('0x15')),controller['create']);router[_0x5adb('0x16')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x17')]);router[_0x5adb('0x18')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x19')]);module[_0x5adb('0x1a')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 092925e..77a667c 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 _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 +var _0x5b9b=['role','disabled','blocked','blockedAt','online','admin','then','add','blockDuration','minutes','clearBlockUser','getLicense','catch','status','send','message','login','authenticate','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','use','password','User','passport','passport-local','moment','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/logger','activedirectory','baseDN','url','domain','error','Error\x20authenticate\x20%s:\x20%s','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','findOne','adSsoEnabled','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','salt'];(function(_0x3c2b2e,_0x3e6e53){var _0x27a338=function(_0x40d29d){while(--_0x40d29d){_0x3c2b2e['push'](_0x3c2b2e['shift']());}};_0x27a338(++_0x3e6e53);}(_0x5b9b,0x1d2));var _0xb5b9=function(_0x4116ed,_0x3b8d22){_0x4116ed=_0x4116ed-0x0;var _0x5c4223=_0x5b9b[_0x4116ed];return _0x5c4223;};'use strict';var passport=require(_0xb5b9('0x0'));var LocalStrategy=require(_0xb5b9('0x1'))['Strategy'];var moment=require(_0xb5b9('0x2'));var ActiveDirectory=require(_0xb5b9('0x3'));var BPromise=require(_0xb5b9('0x4'));var util=require(_0xb5b9('0x5'));var db=require(_0xb5b9('0x6'))['db'];var authService=require(_0xb5b9('0x7'));var utils=require(_0xb5b9('0x8'));var config=require('../../config/environment');var logger=require(_0xb5b9('0x9'))('api');function isActiveDirectoryConfigured(_0x35ddf1){var _0x19a273=![];if(typeof _0x35ddf1[_0xb5b9('0xa')]!=='undefined'){_0x19a273=_0x35ddf1[_0xb5b9('0xa')][_0xb5b9('0xb')]&&_0x35ddf1[_0xb5b9('0xa')][_0xb5b9('0xc')]&&_0x35ddf1[_0xb5b9('0xa')][_0xb5b9('0xd')];}return _0x19a273;}function adAuthenticate(_0xe39681,_0x405f65,_0x1f5982){return new BPromise(function(_0x10a2fe,_0x2104cd){try{var _0x2a6f5a=new ActiveDirectory(_0xe39681);_0x2a6f5a['authenticate'](_0x405f65,_0x1f5982,function(_0x11729b,_0x51d7ae){if(_0x11729b){logger[_0xb5b9('0xe')](_0xb5b9('0xf'),_0x405f65,util['inspect'](_0x11729b,{'showHidden':![],'depth':null}));_0x2104cd(_0xb5b9('0x10'));}else if(!_0x51d7ae){logger[_0xb5b9('0xe')](_0xb5b9('0x11'),_0x405f65);_0x2104cd(_0xb5b9('0x10'));}else{_0x10a2fe(_0x51d7ae);}});}catch(_0x2c69d7){_0x2104cd(_0x2c69d7);}});}function ActiveDirectoryAuthenticate(_0xf0313c,_0x18096e,_0x121103,_0x9a962e){var _0x1f70c3,_0x4ec26d;if(!isActiveDirectoryConfigured(config)){logger[_0xb5b9('0xe')](_0xb5b9('0x12'),_0x18096e);return _0x9a962e(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db['Setting'][_0xb5b9('0x13')]({'where':{'id':0x1},'attributes':[_0xb5b9('0x14'),'blockDuration'],'raw':!![]})['then'](function(_0x4af006){_0x1f70c3=_0x4af006;if(!_0x1f70c3[_0xb5b9('0x14')]){logger[_0xb5b9('0xe')](_0xb5b9('0x15'),_0x18096e);throw new Error(_0xb5b9('0x10'));}return _0xf0313c[_0xb5b9('0x13')]({'attributes':['id',_0xb5b9('0x16'),'password',_0xb5b9('0x17'),_0xb5b9('0x18'),_0xb5b9('0x19'),_0xb5b9('0x1a'),_0xb5b9('0x1b'),_0xb5b9('0x1c')],'where':{'name':_0x18096e,'role':{'$or':[_0xb5b9('0x1d'),'user','agent']},'adSsoEnabled':!![]}});})[_0xb5b9('0x1e')](function(_0x32a9b9){if(!_0x32a9b9||_0x32a9b9&&_0x32a9b9['name']!==_0x18096e){throw new Error(_0xb5b9('0x10'));}_0x4ec26d=_0x32a9b9;var _0x3166b8=_0x4ec26d[_0xb5b9('0x16')]+'@'+config[_0xb5b9('0xa')][_0xb5b9('0xd')];return adAuthenticate(config[_0xb5b9('0xa')],_0x3166b8,_0x121103);})['then'](function(_0x3035f4){if(_0x4ec26d[_0xb5b9('0x19')]){throw new Error(_0xb5b9('0x10'));}if(_0x1f70c3['blockDuration']>0x0){if(_0x4ec26d[_0xb5b9('0x1a')]){if(moment(_0x4ec26d[_0xb5b9('0x1b')])[_0xb5b9('0x1f')](_0x1f70c3[_0xb5b9('0x20')],_0xb5b9('0x21'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils[_0xb5b9('0x22')](_0x4ec26d,0x0,![],null)[_0xb5b9('0x1e')](function(){return utils[_0xb5b9('0x23')](_0x4ec26d);})[_0xb5b9('0x1e')](function(){return _0x9a962e(null,_0x4ec26d);});}else{return utils[_0xb5b9('0x23')](_0x4ec26d)[_0xb5b9('0x1e')](function(){return _0x9a962e(null,_0x4ec26d);});}}else{return utils[_0xb5b9('0x23')](_0x4ec26d)[_0xb5b9('0x1e')](function(){return _0x9a962e(null,_0x4ec26d);});}})[_0xb5b9('0x24')](function(_0xa799ca){return _0x9a962e(null,![],_0xa799ca);});}function handleError(_0x204abe,_0x57f070,_0x46fe9a){return _0x204abe[_0xb5b9('0x25')](_0x57f070||0x1f4)[_0xb5b9('0x26')]({'message':_0x46fe9a?_0x46fe9a[_0xb5b9('0x27')]||_0x46fe9a:''});}exports[_0xb5b9('0x28')]=function(_0x45cb75,_0xa208d3,_0x1ca8a4){passport[_0xb5b9('0x29')](_0xb5b9('0x2a'),function(_0x1dc55d,_0x2a9be9,_0x3df882){var _0x293df1=_0x1dc55d||_0x3df882;if(_0x293df1){return handleError(_0xa208d3,0x191,_0x293df1);}if(!_0x2a9be9){return handleError(_0xa208d3,0x194,{'message':_0xb5b9('0x2b')});}else{var _0x2c1d97={'payload':{'id':_0x2a9be9['id'],'role':_0x2a9be9[_0xb5b9('0x18')]},'options':{'expiresIn':0x15180}};return authService[_0xb5b9('0x2c')](_0x2c1d97)[_0xb5b9('0x1e')](function(_0x4b0b5d){_0xa208d3[_0xb5b9('0x2d')]({'id':_0x2a9be9['id'],'token':_0x4b0b5d,'statusCall':'','isAlreadyLogged':_0x2a9be9[_0xb5b9('0x1c')]});});}})(_0x45cb75,_0xa208d3,_0x1ca8a4);};passport[_0xb5b9('0x2e')](_0xb5b9('0x2a'),new LocalStrategy({'usernameField':'name','passwordField':_0xb5b9('0x2f')},function(_0x4913d0,_0x19967a,_0x680df8){return ActiveDirectoryAuthenticate(db[_0xb5b9('0x30')],_0x4913d0,_0x19967a,_0x680df8);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 69927da..ad953c1 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 _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 +var _0xb6af=['Router','./authActiveDirectory.controller','login'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xb6af,0x1da));var _0xfb6a=function(_0x4e2148,_0x382a2c){_0x4e2148=_0x4e2148-0x0;var _0x323345=_0xb6af[_0x4e2148];return _0x323345;};'use strict';var express=require('express');var router=express[_0xfb6a('0x0')]();var controller=require(_0xfb6a('0x1'));router['post']('/',controller[_0xfb6a('0x2')]);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 d1ebf1a..ee13df3 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_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 +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(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0x7a54,0x106));var _0x47a5=function(_0x3a4f1e,_0x61ab68){_0x3a4f1e=_0x3a4f1e-0x0;var _0x5eab7f=_0x7a54[_0x3a4f1e];return _0x5eab7f;};'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 6967ecf..cccd899 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 _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 +var _0x06a8=['callback','passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','/callback'];(function(_0x3d0e15,_0xdb46ae){var _0x4723bc=function(_0x5a02d4){while(--_0x5a02d4){_0x3d0e15['push'](_0x3d0e15['shift']());}};_0x4723bc(++_0xdb46ae);}(_0x06a8,0x157));var _0x806a=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x06a8[_0x40a045];return _0x1a687c;};'use strict';var express=require('express');var passport=require(_0x806a('0x0'));var router=express[_0x806a('0x1')]();var controller=require(_0x806a('0x2'));var userController=require(_0x806a('0x3'));var authService=require(_0x806a('0x4'));router[_0x806a('0x5')]('/',controller[_0x806a('0x6')]);router[_0x806a('0x5')](_0x806a('0x7'),controller[_0x806a('0x8')],authService['isMiddleware'],userController[_0x806a('0x6')],authService['setTokenCookie']);module['exports']=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index a3b1652..4db2f84 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 _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 +var _0x8425=['jayson/promise','lodash','moment','../../mysqldb','../../components/auth/service','../../config/utils','Setting','allowedLoginAttempts','blockDuration','then','password','salt','role','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','add','clearBlockUser','minutes','getLicense','catch','MailAccount','find','email','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','status','send','local-login','json','online','forgot','body','generate','findOne','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','save','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','token','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','validatePasswordHistory','previousPasswords','Password\x20reset!','use','User','util','passport-local','Strategy'];(function(_0x78409a,_0x15cdd1){var _0xabcc52=function(_0x374020){while(--_0x374020){_0x78409a['push'](_0x78409a['shift']());}};_0xabcc52(++_0x15cdd1);}(_0x8425,0x9d));var _0x5842=function(_0x562142,_0x3da18f){_0x562142=_0x562142-0x0;var _0x41b344=_0x8425[_0x562142];return _0x41b344;};'use strict';var util=require(_0x5842('0x0'));var passport=require('passport');var LocalStrategy=require(_0x5842('0x1'))[_0x5842('0x2')];var jayson=require(_0x5842('0x3'));var _=require(_0x5842('0x4'));var rs=require('randomstring');var moment=require(_0x5842('0x5'));var db=require(_0x5842('0x6'))['db'];var authService=require(_0x5842('0x7'));var utils=require(_0x5842('0x8'));var client=jayson['client']['http']({'port':0x232b});function localAuthenticate(_0x5de85d,_0x285ba0,_0x5b4efd,_0x196d2d){var _0x208d64,_0x572b4e;return db[_0x5842('0x9')]['findOne']({'where':{'id':0x1},'attributes':[_0x5842('0xa'),_0x5842('0xb')],'raw':!![]})[_0x5842('0xc')](function(_0x10dd68){_0x208d64=_0x10dd68;return _0x5de85d['findOne']({'attributes':['id','name',_0x5842('0xd'),_0x5842('0xe'),_0x5842('0xf'),_0x5842('0x10'),_0x5842('0x11'),_0x5842('0x12'),_0x5842('0x13')],'where':{'name':_0x285ba0,'role':{'$or':[_0x5842('0x14'),_0x5842('0x15'),_0x5842('0x16')]}}});})['then'](function(_0xa114c){if(!_0xa114c||_0xa114c&&_0xa114c[_0x5842('0x17')]!==_0x285ba0){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x572b4e=_0xa114c;return _0x572b4e;}})['then'](function(){_0x572b4e['authenticate'](_0x5b4efd,function(_0xfcd533,_0x492ee2){var _0x358dd0=_0x572b4e[_0x5842('0x13')]+0x1;if(_0xfcd533){return _0x196d2d(_0xfcd533);}else if(!_0x492ee2){if(_0x572b4e['disabled']){return _0x196d2d(null,![],{'message':_0x5842('0x18')});}else if(_0x208d64[_0x5842('0xa')]>0x0){if(_0x572b4e['blocked']){if(_0x208d64[_0x5842('0xb')]>0x0){if(moment(_0x572b4e[_0x5842('0x12')])[_0x5842('0x19')](_0x208d64[_0x5842('0xb')],'minutes')>moment()){return _0x196d2d(null,![],{'message':_0x5842('0x18')});}else{return utils[_0x5842('0x1a')](_0x572b4e,_0x358dd0,![],null)[_0x5842('0xc')](function(){return _0x196d2d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x196d2d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x358dd0>=_0x208d64[_0x5842('0xa')]){return utils[_0x5842('0x1a')](_0x572b4e,0x0,!![],moment())[_0x5842('0xc')](function(){return _0x196d2d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0x5842('0x1a')](_0x572b4e,_0x358dd0,![],null)[_0x5842('0xc')](function(){return _0x196d2d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x196d2d(null,![],{'message':_0x5842('0x18')});}}else{if(_0x572b4e[_0x5842('0x10')]){return _0x196d2d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x208d64[_0x5842('0xa')]>0x0){if(_0x572b4e[_0x5842('0x11')]){if(_0x208d64['blockDuration']>0x0){if(moment(_0x572b4e['blockedAt'])['add'](_0x208d64[_0x5842('0xb')],_0x5842('0x1b'))>moment()){return _0x196d2d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x5842('0x1a')](_0x572b4e,0x0,![],null)[_0x5842('0xc')](function(){return utils[_0x5842('0x1c')](_0x572b4e);})[_0x5842('0xc')](function(){return _0x196d2d(null,_0x572b4e);});}}else{return _0x196d2d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x5842('0x1a')](_0x572b4e,0x0,![],null)[_0x5842('0xc')](function(){return utils['getLicense'](_0x572b4e);})[_0x5842('0xc')](function(){return _0x196d2d(null,_0x572b4e);})[_0x5842('0x1d')](function(_0x575d01){return _0x196d2d(null,![],_0x575d01);});}}else{if(_0x572b4e[_0x5842('0x11')]){return _0x196d2d(null,![],{'message':_0x5842('0x18')});}else{return utils[_0x5842('0x1c')](_0x572b4e)[_0x5842('0xc')](function(){return _0x196d2d(null,_0x572b4e);});}}}});})[_0x5842('0x1d')](function(_0x4ad179){return _0x196d2d(null,![],_0x4ad179);});}function sendServiceMail(_0x5864b5){return db[_0x5842('0x1e')][_0x5842('0x1f')]({'where':{'service':!![]},'attributes':['id',_0x5842('0x17'),_0x5842('0x20')],'include':[{'model':db['MailServerOut'],'as':_0x5842('0x21'),'include':[{'model':db[_0x5842('0x22')],'as':_0x5842('0x22')}]}]})[_0x5842('0xc')](function(_0x2f0e0a){if(!_0x2f0e0a){throw new Error(_0x5842('0x23'));}var _0x30b7a8=_0x2f0e0a[_0x5842('0x24')]();var _0x8cd85={'account':_0x30b7a8,'message':_[_0x5842('0x25')]({'from':util[_0x5842('0x26')](_0x5842('0x27'),_0x2f0e0a[_0x5842('0x17')],_0x2f0e0a[_0x5842('0x20')]||_0x2f0e0a[_0x5842('0x21')][_0x5842('0x15')])},_0x5864b5)};return client['request'](_0x5842('0x28'),_0x8cd85);})['then'](function(_0x1d486f){if(_0x1d486f[_0x5842('0x29')]){throw new Error(util['format'](_0x5842('0x2a'),_0x1d486f['error'][_0x5842('0x2b')]||JSON['stringify'](_0x1d486f[_0x5842('0x29')])));}return!![];});}function handleError(_0x5259bd,_0x42ca46,_0x2da94f){return _0x5259bd[_0x5842('0x2c')](_0x42ca46||0x1f4)[_0x5842('0x2d')]({'message':_0x2da94f?_0x2da94f['message']||_0x2da94f:''});}exports['login']=function(_0x31f17a,_0x32d6d6,_0x5e2878){passport['authenticate'](_0x5842('0x2e'),function(_0x39f629,_0x4dda05,_0x405e98){var _0x498ac1=_0x39f629||_0x405e98;if(_0x498ac1){return handleError(_0x32d6d6,0x191,_0x498ac1);}if(!_0x4dda05){return handleError(_0x32d6d6,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x2ce141={'payload':{'id':_0x4dda05['id'],'role':_0x4dda05[_0x5842('0xf')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x2ce141)['then'](function(_0x3d97a1){_0x32d6d6[_0x5842('0x2f')]({'id':_0x4dda05['id'],'token':_0x3d97a1,'statusCall':'','isAlreadyLogged':_0x4dda05[_0x5842('0x30')]});});}})(_0x31f17a,_0x32d6d6,_0x5e2878);};exports[_0x5842('0x31')]=function(_0x324cbc,_0x27d58d){if(!_0x324cbc[_0x5842('0x32')][_0x5842('0x20')]){return handleError(_0x27d58d,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x3461aa=rs[_0x5842('0x33')]();_0x324cbc[_0x5842('0x32')][_0x5842('0x20')]=_0x324cbc['body'][_0x5842('0x20')]['trim']()['toLowerCase']();var _0xe4fa0;return db['Setting'][_0x5842('0x34')]({'where':{'id':0x1},'attributes':[_0x5842('0xa'),_0x5842('0xb')],'raw':!![]})['then'](function(_0x1c2a0b){_0xe4fa0=_0x1c2a0b;return db['User'][_0x5842('0x1f')]({'where':{'email':_0x324cbc[_0x5842('0x32')][_0x5842('0x20')]}});})[_0x5842('0xc')](function(_0xde4593){if(!_0xde4593){throw new Error(_0x5842('0x35'));}if(_0xde4593[_0x5842('0x10')]){throw new Error(_0x5842('0x36'));}if(_0xde4593[_0x5842('0x11')]){if(moment(_0xde4593['blockedAt'])[_0x5842('0x19')](_0xe4fa0[_0x5842('0xb')],_0x5842('0x1b'))>moment()){throw new Error(_0x5842('0x37'));}else{_0xde4593[_0x5842('0x11')]=![];_0xde4593[_0x5842('0x12')]=null;}}_0xde4593[_0x5842('0x38')]=_0x3461aa;_0xde4593[_0x5842('0x39')]=Date['now']()+0x36ee80;return _0xde4593[_0x5842('0x3a')]();})['then'](function(){return sendServiceMail({'to':_0x324cbc[_0x5842('0x32')]['email'],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0x5842('0x3b')+_0x5842('0x3c')+_0x5842('0x3d')+_0x324cbc[_0x5842('0x3e')]['host']+_0x5842('0x3f')+_0x3461aa+'\x0a\x0a'+_0x5842('0x40')});})[_0x5842('0xc')](function(){_0x27d58d[_0x5842('0x2c')](0xc8)[_0x5842('0x2d')]({'message':_0x5842('0x41')});})[_0x5842('0x1d')](function(_0x1d4939){return handleError(_0x27d58d,0x1f4,_0x1d4939);});};exports[_0x5842('0x42')]=function(_0x225721,_0x3dc61d){return db['User'][_0x5842('0x1f')]({'where':{'resetPasswordToken':_0x225721[_0x5842('0x43')][_0x5842('0x44')],'resetPasswordExpires':{'$gt':Date[_0x5842('0x45')]()}}})[_0x5842('0xc')](function(_0x2adaf8){if(!_0x2adaf8){throw new Error(_0x5842('0x46'));}return db['Setting']['findOne']({'attributes':['id',_0x5842('0x47'),_0x5842('0x48'),_0x5842('0x49')]})[_0x5842('0xc')](function(_0x4d012f){if(_0x4d012f[_0x5842('0x47')])authService[_0x5842('0x4a')](_0x225721[_0x5842('0x32')][_0x5842('0xd')]);if(!_0x4d012f[_0x5842('0x48')]||!_0x2adaf8['previousPasswords'])return _0x2adaf8;authService[_0x5842('0x4b')](_0x225721[_0x5842('0x32')][_0x5842('0xd')],_0x2adaf8[_0x5842('0x4c')],_0x4d012f[_0x5842('0x49')]);return _0x2adaf8;})[_0x5842('0xc')](function(){_0x2adaf8['password']=_0x225721[_0x5842('0x32')][_0x5842('0xd')];_0x2adaf8[_0x5842('0x38')]=null;_0x2adaf8[_0x5842('0x39')]=null;return _0x2adaf8[_0x5842('0x3a')]();});})[_0x5842('0xc')](function(){_0x3dc61d['status'](0xc8)[_0x5842('0x2d')]({'message':_0x5842('0x4d')});})['catch'](function(_0x3f40e0){return handleError(_0x3dc61d,0x1f4,_0x3f40e0);});};passport[_0x5842('0x4e')](_0x5842('0x2e'),new LocalStrategy({'usernameField':_0x5842('0x17'),'passwordField':_0x5842('0xd')},function(_0x2d948b,_0x22f46d,_0x52cd47){return localAuthenticate(db[_0x5842('0x4f')],_0x2d948b,_0x22f46d,_0x52cd47);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 9f86a4b..ef588f7 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 _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 +var _0xfadd=['/reset/:token','reset','exports','Router','./authLocal.controller','post','login','/forgot','forgot'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xfadd,0x11a));var _0xdfad=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xfadd[_0x20a584];return _0x4b41a8;};'use strict';var express=require('express');var router=express[_0xdfad('0x0')]();var controller=require(_0xdfad('0x1'));router[_0xdfad('0x2')]('/',controller[_0xdfad('0x3')]);router[_0xdfad('0x2')](_0xdfad('0x4'),controller[_0xdfad('0x5')]);router[_0xdfad('0x2')](_0xdfad('0x6'),controller[_0xdfad('0x7')]);module[_0xdfad('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 b819448..3a82f6a 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 _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 +var _0x9bde=['exports','STRING','BOOLEAN','INTEGER','sequelize'];(function(_0x3fccbb,_0x473396){var _0x11df6e=function(_0x3de807){while(--_0x3de807){_0x3fccbb['push'](_0x3fccbb['shift']());}};_0x11df6e(++_0x473396);}(_0x9bde,0xfe));var _0xe9bd=function(_0x466996,_0x330ab7){_0x466996=_0x466996-0x0;var _0x40bcab=_0x9bde[_0x466996];return _0x40bcab;};'use strict';var Sequelize=require(_0xe9bd('0x0'));module[_0xe9bd('0x1')]={'name':{'type':Sequelize[_0xe9bd('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0xe9bd('0x2')]},'description':{'type':Sequelize[_0xe9bd('0x2')]},'status':{'type':Sequelize[_0xe9bd('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xe9bd('0x4')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index b8e4517..239c985 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 _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 +var _0x34c2=['../../config/license/util','../../mysqldb','end','json','undefined','count','offset','status','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','Automation','key','model','query','attributes','intersection','fields','length','hasOwnProperty','limit','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','create','body','find','Condition','omit','ids','findOne','rawAttributes','sort','getConditions','nolimit','addActions','Action','getActions','order','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x34c2,0x197));var _0x234c=function(_0x560250,_0x2a24f5){_0x560250=_0x560250-0x0;var _0x55e2e1=_0x34c2[_0x560250];return _0x55e2e1;};'use strict';var emlformat=require(_0x234c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x234c('0x1'));var rp=require(_0x234c('0x2'));var moment=require(_0x234c('0x3'));var BPromise=require(_0x234c('0x4'));var Mustache=require(_0x234c('0x5'));var util=require('util');var path=require(_0x234c('0x6'));var sox=require(_0x234c('0x7'));var csv=require(_0x234c('0x8'));var ejs=require(_0x234c('0x9'));var fs=require('fs');var fs_extra=require(_0x234c('0xa'));var _=require(_0x234c('0xb'));var squel=require(_0x234c('0xc'));var crypto=require(_0x234c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x234c('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x234c('0xf'));var Redis=require('ioredis');var authService=require(_0x234c('0x10'));var qs=require(_0x234c('0x11'));var as=require(_0x234c('0x12'));var hardwareService=require(_0x234c('0x13'));var logger=require(_0x234c('0x14'))(_0x234c('0x15'));var utils=require('../../config/utils');var config=require(_0x234c('0x16'));var licenseUtil=require(_0x234c('0x17'));var db=require(_0x234c('0x18'))['db'];function respondWithStatusCode(_0x76fb17,_0x3673da){_0x3673da=_0x3673da||0xcc;return function(_0x3f156a){if(_0x3f156a){return _0x76fb17['sendStatus'](_0x3673da);}return _0x76fb17['status'](_0x3673da)[_0x234c('0x19')]();};}function respondWithResult(_0x8aed1c,_0xdeba95){_0xdeba95=_0xdeba95||0xc8;return function(_0x2ec5ec){if(_0x2ec5ec){return _0x8aed1c['status'](_0xdeba95)[_0x234c('0x1a')](_0x2ec5ec);}};}function respondWithFilteredResult(_0x692d30,_0x595ed0){return function(_0x8b6b3){if(_0x8b6b3){var _0x136927=typeof _0x595ed0['offset']===_0x234c('0x1b')&&typeof _0x595ed0['limit']===_0x234c('0x1b');var _0x27c039=_0x8b6b3[_0x234c('0x1c')];var _0x4c0ac5=_0x136927?0x0:_0x595ed0[_0x234c('0x1d')];var _0x291497=_0x136927?_0x8b6b3['count']:_0x595ed0[_0x234c('0x1d')]+_0x595ed0['limit'];var _0x58faf8;if(_0x291497>=_0x27c039){_0x291497=_0x27c039;_0x58faf8=0xc8;}else{_0x58faf8=0xce;}_0x692d30[_0x234c('0x1e')](_0x58faf8);return _0x692d30[_0x234c('0x1f')](_0x234c('0x20'),_0x4c0ac5+'-'+_0x291497+'/'+_0x27c039)[_0x234c('0x1a')](_0x8b6b3);}return null;};}function patchUpdates(_0x21b5c9){return function(_0x37812f){try{jsonpatch[_0x234c('0x21')](_0x37812f,_0x21b5c9,!![]);}catch(_0x5cf5b6){return BPromise[_0x234c('0x22')](_0x5cf5b6);}return _0x37812f[_0x234c('0x23')]();};}function saveUpdates(_0x260b9a,_0x2c604d){return function(_0x147a86){if(_0x147a86){return _0x147a86[_0x234c('0x24')](_0x260b9a)[_0x234c('0x25')](function(_0x4ecf8d){return _0x4ecf8d;});}return null;};}function removeEntity(_0x1a7222,_0x2d9a0a){return function(_0x446cdd){if(_0x446cdd){return _0x446cdd[_0x234c('0x26')]()[_0x234c('0x25')](function(){_0x1a7222['status'](0xcc)[_0x234c('0x19')]();});}};}function handleEntityNotFound(_0x36bdf2,_0x459f53){return function(_0x289ac5){if(!_0x289ac5){_0x36bdf2[_0x234c('0x27')](0x194);}return _0x289ac5;};}function handleError(_0x36458f,_0x2cb2a2){_0x2cb2a2=_0x2cb2a2||0x1f4;return function(_0x4fab31){logger[_0x234c('0x28')](_0x4fab31[_0x234c('0x29')]);if(_0x4fab31[_0x234c('0x2a')]){delete _0x4fab31[_0x234c('0x2a')];}_0x36458f[_0x234c('0x1e')](_0x2cb2a2)[_0x234c('0x2b')](_0x4fab31);};}exports[_0x234c('0x2c')]=function(_0x1bfbe0,_0x4f2433){var _0x4e3d73={},_0xd291e9={},_0x2c165c={'count':0x0,'rows':[]};var _0x332aa5=_[_0x234c('0x2d')](db[_0x234c('0x2e')]['rawAttributes'],function(_0x4ba65c){return{'name':_0x4ba65c['fieldName'],'type':_0x4ba65c['type'][_0x234c('0x2f')]};});_0xd291e9[_0x234c('0x30')]=_[_0x234c('0x2d')](_0x332aa5,_0x234c('0x2a'));_0xd291e9[_0x234c('0x31')]=_['keys'](_0x1bfbe0[_0x234c('0x31')]);_0xd291e9['filters']=_['intersection'](_0xd291e9['model'],_0xd291e9[_0x234c('0x31')]);_0x4e3d73[_0x234c('0x32')]=_[_0x234c('0x33')](_0xd291e9[_0x234c('0x30')],qs['fields'](_0x1bfbe0['query'][_0x234c('0x34')]));_0x4e3d73[_0x234c('0x32')]=_0x4e3d73[_0x234c('0x32')][_0x234c('0x35')]?_0x4e3d73[_0x234c('0x32')]:_0xd291e9[_0x234c('0x30')];if(!_0x1bfbe0[_0x234c('0x31')][_0x234c('0x36')]('nolimit')){_0x4e3d73[_0x234c('0x37')]=qs[_0x234c('0x37')](_0x1bfbe0[_0x234c('0x31')]['limit']);_0x4e3d73[_0x234c('0x1d')]=qs[_0x234c('0x1d')](_0x1bfbe0[_0x234c('0x31')][_0x234c('0x1d')]);}_0x4e3d73['order']=qs['sort'](_0x1bfbe0['query']['sort']);_0x4e3d73[_0x234c('0x38')]=qs[_0x234c('0x39')](_[_0x234c('0x3a')](_0x1bfbe0[_0x234c('0x31')],_0xd291e9[_0x234c('0x39')]),_0x332aa5);if(_0x1bfbe0[_0x234c('0x31')][_0x234c('0x3b')]){_0x4e3d73[_0x234c('0x38')]=_[_0x234c('0x3c')](_0x4e3d73['where'],{'$or':_['map'](_0x332aa5,function(_0x4b2fba){if(_0x4b2fba[_0x234c('0x3d')]!==_0x234c('0x3e')){var _0x42142a={};_0x42142a[_0x4b2fba[_0x234c('0x2a')]]={'$like':'%'+_0x1bfbe0[_0x234c('0x31')][_0x234c('0x3b')]+'%'};return _0x42142a;}})});}_0x4e3d73=_[_0x234c('0x3c')]({},_0x4e3d73,_0x1bfbe0[_0x234c('0x3f')]);var _0xb5d0ea={'where':_0x4e3d73[_0x234c('0x38')]};return db[_0x234c('0x2e')][_0x234c('0x1c')](_0xb5d0ea)[_0x234c('0x25')](function(_0x3cc08c){_0x2c165c[_0x234c('0x1c')]=_0x3cc08c;if(_0x1bfbe0['query'][_0x234c('0x40')]){_0x4e3d73[_0x234c('0x41')]=[{'all':!![]}];}return db[_0x234c('0x2e')][_0x234c('0x42')](_0x4e3d73);})['then'](function(_0x322eca){_0x2c165c[_0x234c('0x43')]=_0x322eca;return _0x2c165c;})[_0x234c('0x25')](respondWithFilteredResult(_0x4f2433,_0x4e3d73))[_0x234c('0x44')](handleError(_0x4f2433,null));};exports['show']=function(_0x1922cb,_0x100bba){var _0x2783bf={'raw':![],'where':{'id':_0x1922cb[_0x234c('0x45')]['id']}},_0x3f08ea={};_0x3f08ea['model']=_[_0x234c('0x46')](db[_0x234c('0x2e')]['rawAttributes']);_0x3f08ea[_0x234c('0x31')]=_[_0x234c('0x46')](_0x1922cb[_0x234c('0x31')]);_0x3f08ea[_0x234c('0x39')]=_[_0x234c('0x33')](_0x3f08ea['model'],_0x3f08ea[_0x234c('0x31')]);_0x2783bf[_0x234c('0x32')]=_[_0x234c('0x33')](_0x3f08ea['model'],qs[_0x234c('0x34')](_0x1922cb[_0x234c('0x31')][_0x234c('0x34')]));_0x2783bf['attributes']=_0x2783bf[_0x234c('0x32')][_0x234c('0x35')]?_0x2783bf[_0x234c('0x32')]:_0x3f08ea['model'];if(_0x1922cb['query']['includeAll']){_0x2783bf[_0x234c('0x41')]=[{'all':!![]}];}_0x2783bf=_[_0x234c('0x3c')]({},_0x2783bf,_0x1922cb[_0x234c('0x3f')]);return db[_0x234c('0x2e')]['find'](_0x2783bf)[_0x234c('0x25')](handleEntityNotFound(_0x100bba,null))[_0x234c('0x25')](respondWithResult(_0x100bba,null))[_0x234c('0x44')](handleError(_0x100bba,null));};exports[_0x234c('0x47')]=function(_0x2f2e45,_0x3ffe76){return db[_0x234c('0x2e')][_0x234c('0x47')](_0x2f2e45[_0x234c('0x48')],{})[_0x234c('0x25')](respondWithResult(_0x3ffe76,0xc9))[_0x234c('0x44')](handleError(_0x3ffe76,null));};exports[_0x234c('0x24')]=function(_0x47c492,_0x42fbc4){if(_0x47c492[_0x234c('0x48')]['id']){delete _0x47c492[_0x234c('0x48')]['id'];}return db[_0x234c('0x2e')][_0x234c('0x49')]({'where':{'id':_0x47c492['params']['id']}})['then'](handleEntityNotFound(_0x42fbc4,null))[_0x234c('0x25')](saveUpdates(_0x47c492[_0x234c('0x48')],null))[_0x234c('0x25')](respondWithResult(_0x42fbc4,null))[_0x234c('0x44')](handleError(_0x42fbc4,null));};exports[_0x234c('0x26')]=function(_0x192d5d,_0x1c0e6e){return db[_0x234c('0x2e')][_0x234c('0x49')]({'where':{'id':_0x192d5d[_0x234c('0x45')]['id']}})['then'](handleEntityNotFound(_0x1c0e6e,null))[_0x234c('0x25')](removeEntity(_0x1c0e6e,null))[_0x234c('0x44')](handleError(_0x1c0e6e,null));};exports['addConditions']=function(_0xc3a0c2,_0x66452e,_0x50eb6d){return db[_0x234c('0x4a')][_0x234c('0x49')]({'where':{'id':_0xc3a0c2[_0x234c('0x45')]['id']}})[_0x234c('0x25')](handleEntityNotFound(_0x66452e,null))['then'](function(_0xc1b8ea){if(_0xc1b8ea){return _0xc1b8ea['addConditions'](_0xc3a0c2[_0x234c('0x48')]['ids'],_[_0x234c('0x4b')](_0xc3a0c2[_0x234c('0x48')],[_0x234c('0x4c'),'id'])||{});}})[_0x234c('0x25')](respondWithResult(_0x66452e,null))[_0x234c('0x44')](handleError(_0x66452e,null));};exports['getConditions']=function(_0x250882,_0x295e32,_0x216fce){var _0x3f4e06={};var _0x1de850={};var _0x44dfdb;var _0x5f4390;return db[_0x234c('0x2e')][_0x234c('0x4d')]({'where':{'id':_0x250882[_0x234c('0x45')]['id']}})[_0x234c('0x25')](handleEntityNotFound(_0x295e32,null))['then'](function(_0x25b51d){if(_0x25b51d){_0x44dfdb=_0x25b51d;_0x1de850[_0x234c('0x30')]=_[_0x234c('0x46')](db['Condition'][_0x234c('0x4e')]);_0x1de850[_0x234c('0x31')]=_[_0x234c('0x46')](_0x250882[_0x234c('0x31')]);_0x1de850[_0x234c('0x39')]=_['intersection'](_0x1de850[_0x234c('0x30')],_0x1de850[_0x234c('0x31')]);_0x3f4e06[_0x234c('0x32')]=_[_0x234c('0x33')](_0x1de850[_0x234c('0x30')],qs[_0x234c('0x34')](_0x250882[_0x234c('0x31')][_0x234c('0x34')]));_0x3f4e06[_0x234c('0x32')]=_0x3f4e06[_0x234c('0x32')][_0x234c('0x35')]?_0x3f4e06[_0x234c('0x32')]:_0x1de850[_0x234c('0x30')];_0x3f4e06['order']=qs[_0x234c('0x4f')](_0x250882[_0x234c('0x31')][_0x234c('0x4f')]);_0x3f4e06[_0x234c('0x38')]=qs[_0x234c('0x39')](_[_0x234c('0x3a')](_0x250882[_0x234c('0x31')],_0x1de850['filters']));if(_0x250882['query'][_0x234c('0x3b')]){_0x3f4e06[_0x234c('0x38')]=_['merge'](_0x3f4e06[_0x234c('0x38')],{'$or':_[_0x234c('0x2d')](_0x3f4e06['attributes'],function(_0x1fcd76){var _0x28638a={};_0x28638a[_0x1fcd76]={'$like':'%'+_0x250882[_0x234c('0x31')][_0x234c('0x3b')]+'%'};return _0x28638a;})});}_0x3f4e06=_['merge']({},_0x3f4e06,_0x250882['options']);return _0x44dfdb[_0x234c('0x50')](_0x3f4e06);}})[_0x234c('0x25')](function(_0x43c01e){if(_0x43c01e){_0x5f4390=_0x43c01e['length'];if(!_0x250882[_0x234c('0x31')][_0x234c('0x36')](_0x234c('0x51'))){_0x3f4e06[_0x234c('0x37')]=qs[_0x234c('0x37')](_0x250882[_0x234c('0x31')][_0x234c('0x37')]);_0x3f4e06[_0x234c('0x1d')]=qs[_0x234c('0x1d')](_0x250882[_0x234c('0x31')][_0x234c('0x1d')]);}return _0x44dfdb[_0x234c('0x50')](_0x3f4e06);}})[_0x234c('0x25')](function(_0x2cb0e9){if(_0x2cb0e9){return _0x2cb0e9?{'count':_0x5f4390,'rows':_0x2cb0e9}:null;}})[_0x234c('0x25')](respondWithResult(_0x295e32,null))[_0x234c('0x44')](handleError(_0x295e32,null));};exports[_0x234c('0x52')]=function(_0x4d6d7e,_0x1c07fe,_0x3965d6){return db[_0x234c('0x53')][_0x234c('0x49')]({'where':{'id':_0x4d6d7e[_0x234c('0x45')]['id']}})[_0x234c('0x25')](handleEntityNotFound(_0x1c07fe,null))[_0x234c('0x25')](function(_0x3ac5e4){if(_0x3ac5e4){return _0x3ac5e4['addActions'](_0x4d6d7e[_0x234c('0x48')][_0x234c('0x4c')],_['omit'](_0x4d6d7e['body'],['ids','id'])||{});}})[_0x234c('0x25')](respondWithResult(_0x1c07fe,null))[_0x234c('0x44')](handleError(_0x1c07fe,null));};exports[_0x234c('0x54')]=function(_0x2e2155,_0x59cef0,_0x1b32c5){var _0x6e71ad={};var _0x5da3a4={};var _0x3d464d;var _0x444b54;return db[_0x234c('0x2e')][_0x234c('0x4d')]({'where':{'id':_0x2e2155['params']['id']}})['then'](handleEntityNotFound(_0x59cef0,null))[_0x234c('0x25')](function(_0x4dd683){if(_0x4dd683){_0x3d464d=_0x4dd683;_0x5da3a4[_0x234c('0x30')]=_['keys'](db[_0x234c('0x53')][_0x234c('0x4e')]);_0x5da3a4[_0x234c('0x31')]=_['keys'](_0x2e2155[_0x234c('0x31')]);_0x5da3a4[_0x234c('0x39')]=_[_0x234c('0x33')](_0x5da3a4[_0x234c('0x30')],_0x5da3a4['query']);_0x6e71ad[_0x234c('0x32')]=_['intersection'](_0x5da3a4['model'],qs['fields'](_0x2e2155['query'][_0x234c('0x34')]));_0x6e71ad[_0x234c('0x32')]=_0x6e71ad[_0x234c('0x32')][_0x234c('0x35')]?_0x6e71ad[_0x234c('0x32')]:_0x5da3a4[_0x234c('0x30')];_0x6e71ad[_0x234c('0x55')]=qs['sort'](_0x2e2155['query'][_0x234c('0x4f')]);_0x6e71ad[_0x234c('0x38')]=qs[_0x234c('0x39')](_[_0x234c('0x3a')](_0x2e2155[_0x234c('0x31')],_0x5da3a4[_0x234c('0x39')]));if(_0x2e2155[_0x234c('0x31')]['filter']){_0x6e71ad[_0x234c('0x38')]=_[_0x234c('0x3c')](_0x6e71ad[_0x234c('0x38')],{'$or':_['map'](_0x6e71ad[_0x234c('0x32')],function(_0x14adf4){var _0x412a7e={};_0x412a7e[_0x14adf4]={'$like':'%'+_0x2e2155[_0x234c('0x31')][_0x234c('0x3b')]+'%'};return _0x412a7e;})});}_0x6e71ad=_[_0x234c('0x3c')]({},_0x6e71ad,_0x2e2155[_0x234c('0x3f')]);return _0x3d464d[_0x234c('0x54')](_0x6e71ad);}})['then'](function(_0x1f6874){if(_0x1f6874){_0x444b54=_0x1f6874[_0x234c('0x35')];if(!_0x2e2155[_0x234c('0x31')][_0x234c('0x36')]('nolimit')){_0x6e71ad[_0x234c('0x37')]=qs[_0x234c('0x37')](_0x2e2155[_0x234c('0x31')][_0x234c('0x37')]);_0x6e71ad[_0x234c('0x1d')]=qs[_0x234c('0x1d')](_0x2e2155[_0x234c('0x31')][_0x234c('0x1d')]);}return _0x3d464d[_0x234c('0x54')](_0x6e71ad);}})[_0x234c('0x25')](function(_0x2cf51d){if(_0x2cf51d){return _0x2cf51d?{'count':_0x444b54,'rows':_0x2cf51d}:null;}})[_0x234c('0x25')](respondWithResult(_0x59cef0,null))[_0x234c('0x44')](handleError(_0x59cef0,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 2f4ef2a..b6f88c5 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 _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 +var _0xb321=['rimraf','exports','define','Automation','lodash','util','api','bluebird','request-promise','path'];(function(_0x5d6e35,_0x4d1ac0){var _0x5d7ada=function(_0x2f7dd3){while(--_0x2f7dd3){_0x5d6e35['push'](_0x5d6e35['shift']());}};_0x5d7ada(++_0x4d1ac0);}(_0xb321,0xea));var _0x1b32=function(_0x3fff8b,_0x13500a){_0x3fff8b=_0x3fff8b-0x0;var _0x26aaf4=_0xb321[_0x3fff8b];return _0x26aaf4;};'use strict';var _=require(_0x1b32('0x0'));var util=require(_0x1b32('0x1'));var logger=require('../../config/logger')(_0x1b32('0x2'));var moment=require('moment');var BPromise=require(_0x1b32('0x3'));var rp=require(_0x1b32('0x4'));var fs=require('fs');var path=require(_0x1b32('0x5'));var rimraf=require(_0x1b32('0x6'));var config=require('../../config/environment');var attributes=require('./automation.attributes');module[_0x1b32('0x7')]=function(_0x300ff1,_0x6a1c3e){return _0x300ff1[_0x1b32('0x8')](_0x1b32('0x9'),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 5cf1cb0..7d78990 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 _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 +var _0x5eef=['error','message','result','catch','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x5eef,0x9c));var _0xf5ee=function(_0x21cc49,_0x2df9b8){_0x21cc49=_0x21cc49-0x0;var _0xe2d65d=_0x5eef[_0x21cc49];return _0xe2d65d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf5ee('0x0'));var BPromise=require('bluebird');var rs=require(_0xf5ee('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf5ee('0x2'))['db'];var utils=require(_0xf5ee('0x3'));var logger=require(_0xf5ee('0x4'))(_0xf5ee('0x5'));var config=require(_0xf5ee('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3ae819,_0x24e3a5,_0x4f0e34){return new BPromise(function(_0x31c9d8,_0x2e4224){return client[_0xf5ee('0x7')](_0x3ae819,_0x4f0e34)[_0xf5ee('0x8')](function(_0x125def){logger[_0xf5ee('0x9')](_0xf5ee('0xa'),_0x24e3a5,_0xf5ee('0xb'));logger[_0xf5ee('0xc')](_0xf5ee('0xd'),_0x24e3a5,'request\x20sent',JSON[_0xf5ee('0xe')](_0x125def));if(_0x125def['error']){if(_0x125def[_0xf5ee('0xf')]['code']===0x1f4){logger[_0xf5ee('0xf')](_0xf5ee('0xa'),_0x24e3a5,_0x125def[_0xf5ee('0xf')][_0xf5ee('0x10')]);return _0x2e4224(_0x125def['error'][_0xf5ee('0x10')]);}logger[_0xf5ee('0xf')](_0xf5ee('0xa'),_0x24e3a5,_0x125def[_0xf5ee('0xf')]['message']);return _0x31c9d8(_0x125def['error'][_0xf5ee('0x10')]);}else{logger[_0xf5ee('0x9')](_0xf5ee('0xa'),_0x24e3a5,_0xf5ee('0xb'));_0x31c9d8(_0x125def[_0xf5ee('0x11')]['message']);}})[_0xf5ee('0x12')](function(_0x21a35c){logger['error'](_0xf5ee('0xa'),_0x24e3a5,_0x21a35c);_0x2e4224(_0x21a35c);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index e712289..789ade4 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 _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 +var _0xfa5d=['index','/:id','isAuthenticated','getConditions','getActions','post','create','/:id/conditions','/:id/actions','addActions','put','update','delete','exports','multer','express','Router','../../components/interaction/service','./automation.controller','get'];(function(_0x15d48a,_0xba9cbf){var _0x5a74f7=function(_0x518974){while(--_0x518974){_0x15d48a['push'](_0x15d48a['shift']());}};_0x5a74f7(++_0xba9cbf);}(_0xfa5d,0x19e));var _0xdfa5=function(_0xe2d1f8,_0x572ddf){_0xe2d1f8=_0xe2d1f8-0x0;var _0x4cbcec=_0xfa5d[_0xe2d1f8];return _0x4cbcec;};'use strict';var multer=require(_0xdfa5('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xdfa5('0x1'));var router=express[_0xdfa5('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xdfa5('0x3'));var config=require('../../config/environment');var controller=require(_0xdfa5('0x4'));router[_0xdfa5('0x5')]('/',auth['isAuthenticated'](),controller[_0xdfa5('0x6')]);router['get'](_0xdfa5('0x7'),auth[_0xdfa5('0x8')](),controller['show']);router[_0xdfa5('0x5')]('/:id/conditions',auth[_0xdfa5('0x8')](),controller[_0xdfa5('0x9')]);router['get']('/:id/actions',auth[_0xdfa5('0x8')](),controller[_0xdfa5('0xa')]);router[_0xdfa5('0xb')]('/',auth[_0xdfa5('0x8')](),controller[_0xdfa5('0xc')]);router[_0xdfa5('0xb')](_0xdfa5('0xd'),auth['isAuthenticated'](),controller['addConditions']);router[_0xdfa5('0xb')](_0xdfa5('0xe'),auth[_0xdfa5('0x8')](),controller[_0xdfa5('0xf')]);router[_0xdfa5('0x10')](_0xdfa5('0x7'),auth[_0xdfa5('0x8')](),controller[_0xdfa5('0x11')]);router[_0xdfa5('0x12')](_0xdfa5('0x7'),auth[_0xdfa5('0x8')](),controller['destroy']);module[_0xdfa5('0x13')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index fb9d62f..5b5ba3b 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 _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 +var _0x885f=['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)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','name','ENUM','ivr','BOOLEAN','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\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)','STRING','07:00-22:00,*,*,*','never','onlyIfOpen','always','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)'];(function(_0x573399,_0xcc8f15){var _0x171548=function(_0x2c661f){while(--_0x2c661f){_0x573399['push'](_0x573399['shift']());}};_0x171548(++_0xcc8f15);}(_0x885f,0x185));var _0xf885=function(_0x488982,_0x3e260c){_0x488982=_0x488982-0x0;var _0xfe389c=_0x885f[_0x488982];return _0xfe389c;};'use strict';var Sequelize=require(_0xf885('0x0'));module[_0xf885('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xf885('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xf885('0x3')](_0xf885('0x4')),'allowNull':![],'defaultValue':_0xf885('0x4')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xf885('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0xf885('0x6')](0x4)[_0xf885('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xf885('0x8')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xf885('0x6')](0x3)[_0xf885('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf885('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0xf885('0x6')](0x3)[_0xf885('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf885('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xf885('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf885('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0xf885('0x6')](0x3)[_0xf885('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xf885('0x6')](0x5)[_0xf885('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf885('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xf885('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xf885('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xf885('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf885('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0xf885('0x6')](0x3)[_0xf885('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xf885('0xf')},'dialTimezone':{'type':Sequelize[_0xf885('0x10')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xf885('0x11')},'dialCheckDuplicateType':{'type':Sequelize['ENUM']('always',_0xf885('0x12'),_0xf885('0x13')),'defaultValue':_0xf885('0x14')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xf885('0x6')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xf885('0x6')](0x9)[_0xf885('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xf885('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xf885('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xf885('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xf885('0x6')](0x9)[_0xf885('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xf885('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xf885('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xf885('0x6')](0x9)[_0xf885('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xf885('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xf885('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xf885('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xf885('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xf885('0x6')](0x9)[_0xf885('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0xf885('0x3')](_0xf885('0x1a'),_0xf885('0x1b')),'defaultValue':_0xf885('0x1a')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xf885('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xf885('0x1c')},'dialCutDigit':{'type':Sequelize[_0xf885('0x6')](0x3)[_0xf885('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xf885('0x1d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xf885('0x6')](0x3)[_0xf885('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf885('0x1e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xf885('0x6')](0x5)[_0xf885('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf885('0x1f')},'dialDropMaxRetry':{'type':Sequelize[_0xf885('0x6')](0x3)[_0xf885('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf885('0x20')},'dialDropRetryFrequency':{'type':Sequelize[_0xf885('0x6')](0x5)[_0xf885('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf885('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xf885('0x6')](0x3)[_0xf885('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf885('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xf885('0x6')](0x5)[_0xf885('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf885('0x23')},'dialMachineMaxRetry':{'type':Sequelize[_0xf885('0x6')](0x3)[_0xf885('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf885('0x24')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xf885('0x6')](0x3)[_0xf885('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xf885('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf885('0x25')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 60e2821..95ac6aa 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 _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 +var _0xdb06=['json','apply','reject','save','then','get','IvrCampaigns','UserProfileResource','stack','name','index','Campaign','fieldName','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rawAttributes','createdAt','updatedAt','body','omit','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','update','getHoppers','CmHopper','pick','getHopperHistories','findOne','CampaignId','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','into','scheduledAt','ContactId','ListId','phone','field','NOW()','CmListId','toString','from','cm_contacts','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','select','COALESCE(phone,\x27\x27)','cm_hopper','insert','fromQuery','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.OrderBY','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','push','sequelize','all','removeLists','destroy','format','YYYY-MM-DD\x20HH:mm:ss','addBlackLists','cm_hopper_black','removeBlackLists','CmHopperBlack','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set'];(function(_0x16f6d6,_0x5359c0){var _0x26b4a9=function(_0xd04485){while(--_0xd04485){_0x16f6d6['push'](_0x16f6d6['shift']());}};_0x26b4a9(++_0x5359c0);}(_0xdb06,0x194));var _0x6db0=function(_0x285610,_0x443925){_0x285610=_0x285610-0x0;var _0x5e509e=_0xdb06[_0x285610];return _0x5e509e;};'use strict';var emlformat=require(_0x6db0('0x0'));var rimraf=require(_0x6db0('0x1'));var zipdir=require(_0x6db0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6db0('0x3'));var moment=require(_0x6db0('0x4'));var BPromise=require(_0x6db0('0x5'));var Mustache=require(_0x6db0('0x6'));var util=require('util');var path=require(_0x6db0('0x7'));var sox=require(_0x6db0('0x8'));var csv=require('to-csv');var ejs=require(_0x6db0('0x9'));var fs=require('fs');var fs_extra=require(_0x6db0('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6db0('0xb'));var jsforce=require(_0x6db0('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6db0('0xd'));var querystring=require(_0x6db0('0xe'));var Papa=require(_0x6db0('0xf'));var Redis=require(_0x6db0('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6db0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6db0('0x12'));var logger=require(_0x6db0('0x13'))('api');var utils=require(_0x6db0('0x14'));var config=require(_0x6db0('0x15'));var licenseUtil=require(_0x6db0('0x16'));var db=require(_0x6db0('0x17'))['db'];function respondWithStatusCode(_0x31f582,_0x5806d0){_0x5806d0=_0x5806d0||0xcc;return function(_0x445d1f){if(_0x445d1f){return _0x31f582[_0x6db0('0x18')](_0x5806d0);}return _0x31f582[_0x6db0('0x19')](_0x5806d0)['end']();};}function respondWithResult(_0x18fcc2,_0x181421){_0x181421=_0x181421||0xc8;return function(_0x1f12dd){if(_0x1f12dd){return _0x18fcc2[_0x6db0('0x19')](_0x181421)['json'](_0x1f12dd);}};}function respondWithFilteredResult(_0x439616,_0x41deee){return function(_0x5ce005){if(_0x5ce005){var _0x234e37=typeof _0x41deee[_0x6db0('0x1a')]===_0x6db0('0x1b')&&typeof _0x41deee[_0x6db0('0x1c')]===_0x6db0('0x1b');var _0x587718=_0x5ce005[_0x6db0('0x1d')];var _0x4a245a=_0x234e37?0x0:_0x41deee[_0x6db0('0x1a')];var _0x530230=_0x234e37?_0x5ce005[_0x6db0('0x1d')]:_0x41deee[_0x6db0('0x1a')]+_0x41deee[_0x6db0('0x1c')];var _0x3723e7;if(_0x530230>=_0x587718){_0x530230=_0x587718;_0x3723e7=0xc8;}else{_0x3723e7=0xce;}_0x439616[_0x6db0('0x19')](_0x3723e7);return _0x439616[_0x6db0('0x1e')]('Content-Range',_0x4a245a+'-'+_0x530230+'/'+_0x587718)[_0x6db0('0x1f')](_0x5ce005);}return null;};}function patchUpdates(_0x1cfb9d){return function(_0x1fd268){try{jsonpatch[_0x6db0('0x20')](_0x1fd268,_0x1cfb9d,!![]);}catch(_0x5a8a25){return BPromise[_0x6db0('0x21')](_0x5a8a25);}return _0x1fd268[_0x6db0('0x22')]();};}function saveUpdates(_0x139a07,_0x5c81e7){return function(_0x4c45ad){if(_0x4c45ad){return _0x4c45ad['update'](_0x139a07)[_0x6db0('0x23')](function(_0x573450){return _0x573450;});}return null;};}function removeEntity(_0x21d907,_0x4d4162){return function(_0x2671d0){if(_0x2671d0){return _0x2671d0['destroy']()[_0x6db0('0x23')](function(){var _0x368eb6=_0x2671d0[_0x6db0('0x24')]({'plain':!![]});var _0x2ea92a=_0x6db0('0x25');return db[_0x6db0('0x26')]['destroy']({'where':{'type':_0x2ea92a,'resourceId':_0x368eb6['id']}})[_0x6db0('0x23')](function(){return _0x2671d0;});})[_0x6db0('0x23')](function(){_0x21d907[_0x6db0('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x318c42,_0x22c659){return function(_0x18a791){if(!_0x18a791){_0x318c42[_0x6db0('0x18')](0x194);}return _0x18a791;};}function handleError(_0x4e2023,_0x256da8){_0x256da8=_0x256da8||0x1f4;return function(_0x327470){logger['error'](_0x327470[_0x6db0('0x27')]);if(_0x327470[_0x6db0('0x28')]){delete _0x327470[_0x6db0('0x28')];}_0x4e2023[_0x6db0('0x19')](_0x256da8)['send'](_0x327470);};}exports[_0x6db0('0x29')]=function(_0x18fb21,_0x344a8b){var _0x4c31f4={},_0x38083f={},_0x1a1b29={'count':0x0,'rows':[]};var _0x454c66=_['map'](db[_0x6db0('0x2a')]['rawAttributes'],function(_0x26ac71){return{'name':_0x26ac71[_0x6db0('0x2b')],'type':_0x26ac71['type'][_0x6db0('0x2c')]};});_0x38083f[_0x6db0('0x2d')]=_[_0x6db0('0x2e')](_0x454c66,_0x6db0('0x28'));_0x38083f[_0x6db0('0x2f')]=_[_0x6db0('0x30')](_0x18fb21[_0x6db0('0x2f')]);_0x38083f['filters']=_[_0x6db0('0x31')](_0x38083f[_0x6db0('0x2d')],_0x38083f[_0x6db0('0x2f')]);_0x4c31f4[_0x6db0('0x32')]=_[_0x6db0('0x31')](_0x38083f[_0x6db0('0x2d')],qs[_0x6db0('0x33')](_0x18fb21[_0x6db0('0x2f')][_0x6db0('0x33')]));_0x4c31f4[_0x6db0('0x32')]=_0x4c31f4['attributes'][_0x6db0('0x34')]?_0x4c31f4['attributes']:_0x38083f[_0x6db0('0x2d')];if(!_0x18fb21[_0x6db0('0x2f')][_0x6db0('0x35')](_0x6db0('0x36'))){_0x4c31f4[_0x6db0('0x1c')]=qs['limit'](_0x18fb21['query'][_0x6db0('0x1c')]);_0x4c31f4[_0x6db0('0x1a')]=qs[_0x6db0('0x1a')](_0x18fb21[_0x6db0('0x2f')][_0x6db0('0x1a')]);}_0x4c31f4[_0x6db0('0x37')]=qs[_0x6db0('0x38')](_0x18fb21[_0x6db0('0x2f')][_0x6db0('0x38')]);_0x4c31f4[_0x6db0('0x39')]=qs['filters'](_['pick'](_0x18fb21[_0x6db0('0x2f')],_0x38083f[_0x6db0('0x3a')]),_0x454c66);if(_0x18fb21[_0x6db0('0x2f')][_0x6db0('0x3b')]){_0x4c31f4[_0x6db0('0x39')]=_[_0x6db0('0x3c')](_0x4c31f4[_0x6db0('0x39')],{'$or':_[_0x6db0('0x2e')](_0x454c66,function(_0x5ddcf7){if(_0x5ddcf7[_0x6db0('0x3d')]!==_0x6db0('0x3e')){var _0x25c45a={};_0x25c45a[_0x5ddcf7['name']]={'$like':'%'+_0x18fb21[_0x6db0('0x2f')][_0x6db0('0x3b')]+'%'};return _0x25c45a;}})});}_0x4c31f4=_[_0x6db0('0x3c')]({},_0x4c31f4,_0x18fb21[_0x6db0('0x3f')]);var _0x6cde2a={'where':_0x4c31f4[_0x6db0('0x39')]};return db[_0x6db0('0x2a')][_0x6db0('0x1d')](_0x6cde2a)['then'](function(_0x3047c8){_0x1a1b29[_0x6db0('0x1d')]=_0x3047c8;if(_0x18fb21[_0x6db0('0x2f')]['includeAll']){_0x4c31f4[_0x6db0('0x40')]=[{'all':!![]}];}return db[_0x6db0('0x2a')][_0x6db0('0x41')](_0x4c31f4);})[_0x6db0('0x23')](function(_0x14e2c7){_0x1a1b29[_0x6db0('0x42')]=_0x14e2c7;return _0x1a1b29;})[_0x6db0('0x23')](respondWithFilteredResult(_0x344a8b,_0x4c31f4))[_0x6db0('0x43')](handleError(_0x344a8b,null));};exports[_0x6db0('0x44')]=function(_0x3f4359,_0x208470){var _0x6b0799={'raw':![],'where':{'id':_0x3f4359[_0x6db0('0x45')]['id']}},_0xb7a0d0={};_0xb7a0d0[_0x6db0('0x2d')]=_[_0x6db0('0x30')](db[_0x6db0('0x2a')]['rawAttributes']);_0xb7a0d0[_0x6db0('0x2f')]=_[_0x6db0('0x30')](_0x3f4359[_0x6db0('0x2f')]);_0xb7a0d0[_0x6db0('0x3a')]=_['intersection'](_0xb7a0d0[_0x6db0('0x2d')],_0xb7a0d0[_0x6db0('0x2f')]);_0x6b0799[_0x6db0('0x32')]=_[_0x6db0('0x31')](_0xb7a0d0[_0x6db0('0x2d')],qs[_0x6db0('0x33')](_0x3f4359[_0x6db0('0x2f')][_0x6db0('0x33')]));_0x6b0799[_0x6db0('0x32')]=_0x6b0799['attributes']['length']?_0x6b0799[_0x6db0('0x32')]:_0xb7a0d0[_0x6db0('0x2d')];if(_0x3f4359[_0x6db0('0x2f')][_0x6db0('0x46')]){_0x6b0799[_0x6db0('0x40')]=[{'all':!![]}];}_0x6b0799=_['merge']({},_0x6b0799,_0x3f4359[_0x6db0('0x3f')]);return db[_0x6db0('0x2a')][_0x6db0('0x47')](_0x6b0799)[_0x6db0('0x23')](handleEntityNotFound(_0x208470,null))[_0x6db0('0x23')](respondWithResult(_0x208470,null))[_0x6db0('0x43')](handleError(_0x208470,null));};exports[_0x6db0('0x48')]=function(_0x4570ca,_0x2304a9){return db[_0x6db0('0x2a')][_0x6db0('0x48')](_0x4570ca['body'],{})[_0x6db0('0x23')](function(_0x2baed6){var _0x12de8e=_0x4570ca[_0x6db0('0x49')][_0x6db0('0x24')]({'plain':!![]});if(!_0x12de8e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x12de8e['role']===_0x6db0('0x49')){var _0x406502=_0x2baed6[_0x6db0('0x24')]({'plain':!![]});var _0x560794='IvrCampaigns';return db[_0x6db0('0x4a')]['find']({'where':{'name':_0x560794,'userProfileId':_0x12de8e['userProfileId']},'raw':!![]})[_0x6db0('0x23')](function(_0x420534){if(_0x420534&&_0x420534[_0x6db0('0x4b')]===0x0){return db['UserProfileResource'][_0x6db0('0x48')]({'name':_0x406502[_0x6db0('0x28')],'resourceId':_0x406502['id'],'type':_0x420534['name'],'sectionId':_0x420534['id']},{})[_0x6db0('0x23')](function(){return _0x2baed6;});}else{return _0x2baed6;}})[_0x6db0('0x43')](function(_0x49cf10){logger[_0x6db0('0x4c')](_0x6db0('0x4d'),_0x49cf10);throw _0x49cf10;});}return _0x2baed6;})['then'](respondWithResult(_0x2304a9,0xc9))[_0x6db0('0x43')](handleError(_0x2304a9,null));};exports['clone']=function(_0x2bb7a3,_0x4f1b43){var _0xdf53bd={'where':{'id':_0x2bb7a3[_0x6db0('0x45')]['id']}},_0x21be7a={};_0x21be7a['model']=_[_0x6db0('0x30')](db[_0x6db0('0x2a')][_0x6db0('0x4e')]);_0xdf53bd[_0x6db0('0x32')]=_[_0x6db0('0x31')](_0x21be7a[_0x6db0('0x2d')],qs['fields'](_0x2bb7a3['query']['fields']));_0xdf53bd[_0x6db0('0x32')]=_0xdf53bd['attributes'][_0x6db0('0x34')]?_0xdf53bd[_0x6db0('0x32')]:_0x21be7a[_0x6db0('0x2d')];if(_0x2bb7a3[_0x6db0('0x2f')][_0x6db0('0x46')]){_0xdf53bd[_0x6db0('0x40')]=[{'all':!![]}];}_0xdf53bd=_[_0x6db0('0x3c')]({},_0xdf53bd,_0x2bb7a3[_0x6db0('0x3f')]);return db[_0x6db0('0x2a')][_0x6db0('0x47')](_0xdf53bd)[_0x6db0('0x23')](handleEntityNotFound(_0x4f1b43,null))[_0x6db0('0x23')](function(_0x3632dc){if(_0x3632dc){var _0x5a8545=_0x3632dc[_0x6db0('0x24')]({'plain':!![]});_0x5a8545=qs['omit'](_0x5a8545,['id',_0x6db0('0x4f'),_0x6db0('0x50')]);_0x2bb7a3[_0x6db0('0x51')]=_[_0x6db0('0x52')](_0x2bb7a3['body'],['id',_0x6db0('0x4f'),'updatedAt']);return db[_0x6db0('0x2a')][_0x6db0('0x48')](_[_0x6db0('0x3c')](_0x5a8545,_0x2bb7a3[_0x6db0('0x51')]),{'include':_0x2bb7a3[_0x6db0('0x2f')][_0x6db0('0x46')]?[{'all':!![]}]:undefined})['then'](function(_0x41086a){var _0x366713=_0x2bb7a3[_0x6db0('0x49')][_0x6db0('0x24')]({'plain':!![]});if(!_0x366713)throw new Error(_0x6db0('0x53'));if(_0x366713[_0x6db0('0x54')]===_0x6db0('0x49')){var _0xe4e5eb=_0x41086a[_0x6db0('0x24')]({'plain':!![]});var _0x5c5554=_0x6db0('0x25');return db[_0x6db0('0x4a')][_0x6db0('0x47')]({'where':{'name':_0x5c5554,'userProfileId':_0x366713['userProfileId']},'raw':!![]})[_0x6db0('0x23')](function(_0xe853b0){if(_0xe853b0&&_0xe853b0[_0x6db0('0x4b')]===0x0){return db[_0x6db0('0x26')][_0x6db0('0x48')]({'name':_0xe4e5eb[_0x6db0('0x28')],'resourceId':_0xe4e5eb['id'],'type':_0xe853b0[_0x6db0('0x28')],'sectionId':_0xe853b0['id']},{})[_0x6db0('0x23')](function(){return _0x41086a;});}else{return _0x41086a;}})[_0x6db0('0x43')](function(_0x13f610){logger[_0x6db0('0x4c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x13f610);throw _0x13f610;});}return _0x41086a;});}})[_0x6db0('0x23')](respondWithResult(_0x4f1b43,0xc9))[_0x6db0('0x43')](handleError(_0x4f1b43,null));};exports[_0x6db0('0x55')]=function(_0x2378c2,_0x48b539){if(_0x2378c2[_0x6db0('0x51')]['id']){delete _0x2378c2[_0x6db0('0x51')]['id'];}return db[_0x6db0('0x2a')][_0x6db0('0x47')]({'where':{'id':_0x2378c2[_0x6db0('0x45')]['id']}})[_0x6db0('0x23')](handleEntityNotFound(_0x48b539,null))['then'](saveUpdates(_0x2378c2[_0x6db0('0x51')],null))[_0x6db0('0x23')](respondWithResult(_0x48b539,null))[_0x6db0('0x43')](handleError(_0x48b539,null));};exports['destroy']=function(_0x29ac84,_0x199b55){return db[_0x6db0('0x2a')]['find']({'where':{'id':_0x29ac84[_0x6db0('0x45')]['id']}})[_0x6db0('0x23')](handleEntityNotFound(_0x199b55,null))[_0x6db0('0x23')](removeEntity(_0x199b55,null))[_0x6db0('0x43')](handleError(_0x199b55,null));};exports[_0x6db0('0x56')]=function(_0x3cd8ba,_0x49362d,_0x4f6c6d){var _0x5455a3={'raw':!![],'where':{}};var _0x5031ee={};var _0x2ffba5={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x3cd8ba[_0x6db0('0x45')]['id']}})[_0x6db0('0x23')](handleEntityNotFound(_0x49362d,null))['then'](function(_0x43842c){if(_0x43842c){_0x5031ee[_0x6db0('0x2d')]=_['keys'](db[_0x6db0('0x57')][_0x6db0('0x4e')]);_0x5031ee[_0x6db0('0x2f')]=_[_0x6db0('0x30')](_0x3cd8ba[_0x6db0('0x2f')]);_0x5031ee[_0x6db0('0x3a')]=_[_0x6db0('0x31')](_0x5031ee['model'],_0x5031ee[_0x6db0('0x2f')]);_0x5455a3[_0x6db0('0x32')]=_[_0x6db0('0x31')](_0x5031ee[_0x6db0('0x2d')],qs[_0x6db0('0x33')](_0x3cd8ba[_0x6db0('0x2f')][_0x6db0('0x33')]));_0x5455a3[_0x6db0('0x32')]=_0x5455a3[_0x6db0('0x32')][_0x6db0('0x34')]?_0x5455a3[_0x6db0('0x32')]:_0x5031ee['model'];if(!_0x3cd8ba['query']['hasOwnProperty'](_0x6db0('0x36'))){_0x5455a3[_0x6db0('0x1c')]=qs[_0x6db0('0x1c')](_0x3cd8ba[_0x6db0('0x2f')][_0x6db0('0x1c')]);_0x5455a3[_0x6db0('0x1a')]=qs[_0x6db0('0x1a')](_0x3cd8ba[_0x6db0('0x2f')][_0x6db0('0x1a')]);}_0x5455a3[_0x6db0('0x37')]=qs[_0x6db0('0x38')](_0x3cd8ba[_0x6db0('0x2f')]['sort']);_0x5455a3[_0x6db0('0x39')]=qs[_0x6db0('0x3a')](_[_0x6db0('0x58')](_0x3cd8ba[_0x6db0('0x2f')],_0x5031ee[_0x6db0('0x3a')]));_0x5455a3[_0x6db0('0x39')]['CampaignId']=_0x43842c['id'];if(_0x3cd8ba[_0x6db0('0x2f')]['filter']){_0x5455a3['where']=_[_0x6db0('0x3c')](_0x5455a3['where'],{'$or':_['map'](_0x5455a3['attributes'],function(_0x540142){var _0x2d5e22={};_0x2d5e22[_0x540142]={'$like':'%'+_0x3cd8ba[_0x6db0('0x2f')]['filter']+'%'};return _0x2d5e22;})});}_0x5455a3=_[_0x6db0('0x3c')]({},_0x5455a3,_0x3cd8ba[_0x6db0('0x3f')]);return db[_0x6db0('0x57')][_0x6db0('0x1d')]({'where':_0x5455a3[_0x6db0('0x39')]})[_0x6db0('0x23')](function(_0x376005){_0x2ffba5[_0x6db0('0x1d')]=_0x376005;if(_0x3cd8ba['query']['includeAll']){_0x5455a3['include']=[{'all':!![]}];}return db['CmHopper'][_0x6db0('0x41')](_0x5455a3);})[_0x6db0('0x23')](function(_0xc62d6c){_0x2ffba5[_0x6db0('0x42')]=_0xc62d6c;return _0x2ffba5;});}})[_0x6db0('0x23')](respondWithFilteredResult(_0x49362d,_0x5455a3))['catch'](handleError(_0x49362d,null));};exports[_0x6db0('0x59')]=function(_0x3eadd9,_0x25426b,_0x2e22fa){var _0x7a4542={'raw':!![],'where':{}};var _0x10b703={};var _0x24e038={'count':0x0,'rows':[]};return db['Campaign'][_0x6db0('0x5a')]({'where':{'id':_0x3eadd9['params']['id']}})[_0x6db0('0x23')](handleEntityNotFound(_0x25426b,null))['then'](function(_0x1295f2){if(_0x1295f2){_0x10b703[_0x6db0('0x2d')]=_['keys'](db['CmHopperHistory'][_0x6db0('0x4e')]);_0x10b703[_0x6db0('0x2f')]=_[_0x6db0('0x30')](_0x3eadd9[_0x6db0('0x2f')]);_0x10b703[_0x6db0('0x3a')]=_[_0x6db0('0x31')](_0x10b703['model'],_0x10b703[_0x6db0('0x2f')]);_0x7a4542[_0x6db0('0x32')]=_[_0x6db0('0x31')](_0x10b703[_0x6db0('0x2d')],qs[_0x6db0('0x33')](_0x3eadd9[_0x6db0('0x2f')][_0x6db0('0x33')]));_0x7a4542[_0x6db0('0x32')]=_0x7a4542[_0x6db0('0x32')][_0x6db0('0x34')]?_0x7a4542['attributes']:_0x10b703[_0x6db0('0x2d')];if(!_0x3eadd9['query']['hasOwnProperty'](_0x6db0('0x36'))){_0x7a4542[_0x6db0('0x1c')]=qs[_0x6db0('0x1c')](_0x3eadd9[_0x6db0('0x2f')]['limit']);_0x7a4542['offset']=qs[_0x6db0('0x1a')](_0x3eadd9[_0x6db0('0x2f')][_0x6db0('0x1a')]);}_0x7a4542[_0x6db0('0x37')]=qs[_0x6db0('0x38')](_0x3eadd9[_0x6db0('0x2f')][_0x6db0('0x38')]);_0x7a4542[_0x6db0('0x39')]=qs[_0x6db0('0x3a')](_[_0x6db0('0x58')](_0x3eadd9[_0x6db0('0x2f')],_0x10b703[_0x6db0('0x3a')]));_0x7a4542['where'][_0x6db0('0x5b')]=_0x1295f2['id'];if(_0x3eadd9[_0x6db0('0x2f')][_0x6db0('0x3b')]){_0x7a4542['where']=_['merge'](_0x7a4542['where'],{'$or':_[_0x6db0('0x2e')](_0x7a4542[_0x6db0('0x32')],function(_0x813f4e){var _0x12e193={};_0x12e193[_0x813f4e]={'$like':'%'+_0x3eadd9[_0x6db0('0x2f')][_0x6db0('0x3b')]+'%'};return _0x12e193;})});}_0x7a4542=_['merge']({},_0x7a4542,_0x3eadd9['options']);return db['CmHopperHistory'][_0x6db0('0x1d')]({'where':_0x7a4542[_0x6db0('0x39')]})[_0x6db0('0x23')](function(_0x4039c8){_0x24e038[_0x6db0('0x1d')]=_0x4039c8;if(_0x3eadd9[_0x6db0('0x2f')][_0x6db0('0x46')]){_0x7a4542[_0x6db0('0x40')]=[{'all':!![]}];}return db[_0x6db0('0x5c')][_0x6db0('0x41')](_0x7a4542);})[_0x6db0('0x23')](function(_0xfd713c){_0x24e038['rows']=_0xfd713c;return _0x24e038;});}})[_0x6db0('0x23')](respondWithFilteredResult(_0x25426b,_0x7a4542))['catch'](handleError(_0x25426b,null));};exports[_0x6db0('0x5d')]=function(_0x40b303,_0x3ea2d7,_0x8a8de7){var _0x1f66c3={'raw':!![],'where':{}};var _0x4be3b7={};var _0x3d353d={'count':0x0,'rows':[]};return db[_0x6db0('0x2a')][_0x6db0('0x5a')]({'where':{'id':_0x40b303[_0x6db0('0x45')]['id']}})[_0x6db0('0x23')](handleEntityNotFound(_0x3ea2d7,null))[_0x6db0('0x23')](function(_0xdb6c59){if(_0xdb6c59){_0x4be3b7[_0x6db0('0x2d')]=_['keys'](db[_0x6db0('0x5e')][_0x6db0('0x4e')]);_0x4be3b7['query']=_['keys'](_0x40b303[_0x6db0('0x2f')]);_0x4be3b7[_0x6db0('0x3a')]=_[_0x6db0('0x31')](_0x4be3b7['model'],_0x4be3b7[_0x6db0('0x2f')]);_0x1f66c3[_0x6db0('0x32')]=_[_0x6db0('0x31')](_0x4be3b7['model'],qs[_0x6db0('0x33')](_0x40b303[_0x6db0('0x2f')][_0x6db0('0x33')]));_0x1f66c3[_0x6db0('0x32')]=_0x1f66c3[_0x6db0('0x32')][_0x6db0('0x34')]?_0x1f66c3['attributes']:_0x4be3b7[_0x6db0('0x2d')];if(!_0x40b303[_0x6db0('0x2f')][_0x6db0('0x35')](_0x6db0('0x36'))){_0x1f66c3['limit']=qs[_0x6db0('0x1c')](_0x40b303['query']['limit']);_0x1f66c3[_0x6db0('0x1a')]=qs[_0x6db0('0x1a')](_0x40b303[_0x6db0('0x2f')][_0x6db0('0x1a')]);}_0x1f66c3[_0x6db0('0x37')]=qs[_0x6db0('0x38')](_0x40b303['query'][_0x6db0('0x38')]);_0x1f66c3[_0x6db0('0x39')]=qs['filters'](_['pick'](_0x40b303[_0x6db0('0x2f')],_0x4be3b7[_0x6db0('0x3a')]));_0x1f66c3[_0x6db0('0x39')][_0x6db0('0x5b')]=_0xdb6c59['id'];if(_0x40b303[_0x6db0('0x2f')][_0x6db0('0x3b')]){_0x1f66c3[_0x6db0('0x39')]=_['merge'](_0x1f66c3[_0x6db0('0x39')],{'$or':_[_0x6db0('0x2e')](_0x1f66c3[_0x6db0('0x32')],function(_0x581cad){var _0x4e38bf={};_0x4e38bf[_0x581cad]={'$like':'%'+_0x40b303[_0x6db0('0x2f')]['filter']+'%'};return _0x4e38bf;})});}_0x1f66c3=_['merge']({},_0x1f66c3,_0x40b303[_0x6db0('0x3f')]);return db['CmHopperFinal'][_0x6db0('0x1d')]({'where':_0x1f66c3['where']})[_0x6db0('0x23')](function(_0x2056a0){_0x3d353d[_0x6db0('0x1d')]=_0x2056a0;if(_0x40b303['query']['includeAll']){_0x1f66c3['include']=[{'all':!![]}];}return db[_0x6db0('0x5e')][_0x6db0('0x41')](_0x1f66c3);})['then'](function(_0x32d968){_0x3d353d['rows']=_0x32d968;return _0x3d353d;});}})[_0x6db0('0x23')](respondWithFilteredResult(_0x3ea2d7,_0x1f66c3))['catch'](handleError(_0x3ea2d7,null));};exports[_0x6db0('0x5f')]=function(_0x15cecf,_0x601120,_0x2c6174){var _0x566728={'raw':!![],'where':{}};var _0x398ad5={};var _0x2943cd={'count':0x0,'rows':[]};return db[_0x6db0('0x2a')]['findOne']({'where':{'id':_0x15cecf['params']['id']}})[_0x6db0('0x23')](handleEntityNotFound(_0x601120,null))['then'](function(_0x3e0fb6){if(_0x3e0fb6){_0x398ad5['model']=_[_0x6db0('0x30')](db['CmHopperBlack'][_0x6db0('0x4e')]);_0x398ad5['query']=_['keys'](_0x15cecf[_0x6db0('0x2f')]);_0x398ad5[_0x6db0('0x3a')]=_[_0x6db0('0x31')](_0x398ad5['model'],_0x398ad5[_0x6db0('0x2f')]);_0x566728[_0x6db0('0x32')]=_[_0x6db0('0x31')](_0x398ad5[_0x6db0('0x2d')],qs[_0x6db0('0x33')](_0x15cecf[_0x6db0('0x2f')][_0x6db0('0x33')]));_0x566728['attributes']=_0x566728[_0x6db0('0x32')][_0x6db0('0x34')]?_0x566728[_0x6db0('0x32')]:_0x398ad5[_0x6db0('0x2d')];if(!_0x15cecf[_0x6db0('0x2f')][_0x6db0('0x35')](_0x6db0('0x36'))){_0x566728[_0x6db0('0x1c')]=qs[_0x6db0('0x1c')](_0x15cecf['query'][_0x6db0('0x1c')]);_0x566728[_0x6db0('0x1a')]=qs[_0x6db0('0x1a')](_0x15cecf[_0x6db0('0x2f')][_0x6db0('0x1a')]);}_0x566728[_0x6db0('0x37')]=qs[_0x6db0('0x38')](_0x15cecf[_0x6db0('0x2f')]['sort']);_0x566728[_0x6db0('0x39')]=qs['filters'](_[_0x6db0('0x58')](_0x15cecf['query'],_0x398ad5['filters']));_0x566728[_0x6db0('0x39')][_0x6db0('0x5b')]=_0x3e0fb6['id'];if(_0x15cecf[_0x6db0('0x2f')][_0x6db0('0x3b')]){_0x566728[_0x6db0('0x39')]=_[_0x6db0('0x3c')](_0x566728[_0x6db0('0x39')],{'$or':_[_0x6db0('0x2e')](_0x566728[_0x6db0('0x32')],function(_0x2043b1){var _0x39219a={};_0x39219a[_0x2043b1]={'$like':'%'+_0x15cecf['query'][_0x6db0('0x3b')]+'%'};return _0x39219a;})});}_0x566728=_[_0x6db0('0x3c')]({},_0x566728,_0x15cecf[_0x6db0('0x3f')]);return db['CmHopperBlack'][_0x6db0('0x1d')]({'where':_0x566728[_0x6db0('0x39')]})['then'](function(_0x4ecfdd){_0x2943cd[_0x6db0('0x1d')]=_0x4ecfdd;if(_0x15cecf[_0x6db0('0x2f')][_0x6db0('0x46')]){_0x566728[_0x6db0('0x40')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x6db0('0x41')](_0x566728);})[_0x6db0('0x23')](function(_0x2874c8){_0x2943cd[_0x6db0('0x42')]=_0x2874c8;return _0x2943cd;});}})[_0x6db0('0x23')](respondWithFilteredResult(_0x601120,_0x566728))['catch'](handleError(_0x601120,null));};exports[_0x6db0('0x60')]=function(_0x74beeb,_0x39a485,_0xcf4ea0){var _0x228fab={};var _0x1bfa52={};var _0x216843;var _0x4e3776;return db[_0x6db0('0x2a')]['findOne']({'where':{'id':_0x74beeb[_0x6db0('0x45')]['id']}})['then'](handleEntityNotFound(_0x39a485,null))[_0x6db0('0x23')](function(_0x2f2bf5){if(_0x2f2bf5){_0x216843=_0x2f2bf5;_0x1bfa52[_0x6db0('0x2d')]=_[_0x6db0('0x30')](db[_0x6db0('0x61')]['rawAttributes']);_0x1bfa52[_0x6db0('0x2f')]=_[_0x6db0('0x30')](_0x74beeb[_0x6db0('0x2f')]);_0x1bfa52[_0x6db0('0x3a')]=_[_0x6db0('0x31')](_0x1bfa52[_0x6db0('0x2d')],_0x1bfa52[_0x6db0('0x2f')]);_0x228fab[_0x6db0('0x32')]=_[_0x6db0('0x31')](_0x1bfa52['model'],qs[_0x6db0('0x33')](_0x74beeb[_0x6db0('0x2f')][_0x6db0('0x33')]));_0x228fab['attributes']=_0x228fab[_0x6db0('0x32')]['length']?_0x228fab[_0x6db0('0x32')]:_0x1bfa52[_0x6db0('0x2d')];_0x228fab[_0x6db0('0x37')]=qs['sort'](_0x74beeb[_0x6db0('0x2f')]['sort']);_0x228fab[_0x6db0('0x39')]=qs[_0x6db0('0x3a')](_[_0x6db0('0x58')](_0x74beeb[_0x6db0('0x2f')],_0x1bfa52[_0x6db0('0x3a')]));if(_0x74beeb[_0x6db0('0x2f')][_0x6db0('0x3b')]){_0x228fab[_0x6db0('0x39')]=_[_0x6db0('0x3c')](_0x228fab[_0x6db0('0x39')],{'$or':_[_0x6db0('0x2e')](_0x228fab[_0x6db0('0x32')],function(_0x527118){var _0x4b31d3={};_0x4b31d3[_0x527118]={'$like':'%'+_0x74beeb['query'][_0x6db0('0x3b')]+'%'};return _0x4b31d3;})});}_0x228fab=_['merge']({},_0x228fab,_0x74beeb[_0x6db0('0x3f')]);return _0x216843[_0x6db0('0x60')](_0x228fab);}})['then'](function(_0x1e8c7b){if(_0x1e8c7b){_0x4e3776=_0x1e8c7b[_0x6db0('0x34')];if(!_0x74beeb['query'][_0x6db0('0x35')](_0x6db0('0x36'))){_0x228fab['limit']=qs['limit'](_0x74beeb['query'][_0x6db0('0x1c')]);_0x228fab['offset']=qs['offset'](_0x74beeb['query'][_0x6db0('0x1a')]);}return _0x216843[_0x6db0('0x60')](_0x228fab);}})[_0x6db0('0x23')](function(_0x37e15e){if(_0x37e15e){return _0x37e15e?{'count':_0x4e3776,'rows':_0x37e15e}:null;}})['then'](respondWithResult(_0x39a485,null))[_0x6db0('0x43')](handleError(_0x39a485,null));};exports[_0x6db0('0x62')]=function(_0x12463b,_0x501aeb,_0x4e12e9){var _0x5d5226,_0x23afda;var _0x3634e9=[];var _0x5ec701=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');return db[_0x6db0('0x2a')][_0x6db0('0x47')]({'where':{'id':_0x12463b[_0x6db0('0x45')]['id']}})[_0x6db0('0x23')](handleEntityNotFound(_0x501aeb,null))['then'](function(_0x15a671){if(_0x15a671){_0x23afda=_0x15a671;return _0x15a671[_0x6db0('0x62')](_0x12463b['body'][_0x6db0('0x63')],_[_0x6db0('0x52')](_0x12463b['body'],[_0x6db0('0x63'),'id'])||{});}return null;})[_0x6db0('0x64')](function(_0x2ede39){var _0x589907;var _0x1a1290;_0x5d5226=_0x2ede39||[];var _0x544bbe=[];if(_0x2ede39){for(var _0x3b0e1f=0x0;_0x3b0e1f<_0x2ede39[_0x6db0('0x34')];_0x3b0e1f+=0x1){var _0x51c8e9=_0x2ede39[_0x3b0e1f][_0x6db0('0x24')]({'plain':!![]});_0x23afda[_0x6db0('0x65')]=_0x12463b[_0x6db0('0x51')][_0x6db0('0x65')]?_0x12463b['body'][_0x6db0('0x65')]:_0x23afda['dialCheckDuplicateType'];switch(_0x23afda['dialCheckDuplicateType']){case _0x6db0('0x66'):_0x589907=squel['insert']()[_0x6db0('0x67')]('cm_hopper')['fromQuery'](['phone',_0x6db0('0x68'),_0x6db0('0x69'),_0x6db0('0x6a'),_0x6db0('0x5b'),_0x6db0('0x4f'),_0x6db0('0x50')],squel['select']()['field'](_0x6db0('0x6b'),_0x6db0('0x6b'))[_0x6db0('0x6c')](_0x6db0('0x6d'),'scheduledAt')[_0x6db0('0x6c')]('id','ContactId')[_0x6db0('0x6c')](_0x51c8e9[_0x6db0('0x6e')][_0x6db0('0x6f')](),_0x6db0('0x6a'))[_0x6db0('0x6c')](_0x12463b[_0x6db0('0x45')]['id'][_0x6db0('0x6f')](),'CampaignId')['field']('\x27'+_0x5ec701+'\x27',_0x6db0('0x4f'))[_0x6db0('0x6c')]('\x27'+_0x5ec701+'\x27',_0x6db0('0x50'))[_0x6db0('0x70')](_0x6db0('0x71'))[_0x6db0('0x39')]('deletedAt\x20IS\x20NULL')[_0x6db0('0x39')](_0x6db0('0x72'),_0x51c8e9[_0x6db0('0x6e')][_0x6db0('0x6f')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0x6db0('0x39')](_0x6db0('0x73'),squel['select']()[_0x6db0('0x6c')](_0x6db0('0x74'))[_0x6db0('0x70')](_0x6db0('0x75'))[_0x6db0('0x39')](_0x6db0('0x76'),_0x12463b[_0x6db0('0x45')]['id'][_0x6db0('0x6f')]()))[_0x6db0('0x39')](_0x6db0('0x73'),squel[_0x6db0('0x77')]()[_0x6db0('0x6c')](_0x6db0('0x78'))[_0x6db0('0x70')](_0x6db0('0x79'))[_0x6db0('0x39')](_0x6db0('0x76'),_0x12463b[_0x6db0('0x45')]['id']['toString']())))[_0x6db0('0x6f')]();break;case'onlyIfOpen':_0x589907=squel[_0x6db0('0x7a')]()[_0x6db0('0x67')](_0x6db0('0x79'))[_0x6db0('0x7b')](['phone','scheduledAt',_0x6db0('0x69'),_0x6db0('0x6a'),'CampaignId',_0x6db0('0x4f'),_0x6db0('0x50')],squel[_0x6db0('0x77')]()[_0x6db0('0x6c')]('phone',_0x6db0('0x6b'))['field']('NOW()',_0x6db0('0x68'))[_0x6db0('0x6c')]('id','ContactId')[_0x6db0('0x6c')](_0x51c8e9[_0x6db0('0x6e')][_0x6db0('0x6f')](),_0x6db0('0x6a'))[_0x6db0('0x6c')](_0x12463b[_0x6db0('0x45')]['id'][_0x6db0('0x6f')](),_0x6db0('0x5b'))['field']('\x27'+_0x5ec701+'\x27','createdAt')[_0x6db0('0x6c')]('\x27'+_0x5ec701+'\x27',_0x6db0('0x50'))[_0x6db0('0x70')](_0x6db0('0x71'))['where'](_0x6db0('0x7c'))[_0x6db0('0x39')]('ListId\x20=\x20?',_0x51c8e9[_0x6db0('0x6e')][_0x6db0('0x6f')]())[_0x6db0('0x39')]('phone\x20IS\x20NOT\x20NULL')[_0x6db0('0x39')](_0x6db0('0x73'),squel['select']()['field'](_0x6db0('0x78'))[_0x6db0('0x70')](_0x6db0('0x79'))[_0x6db0('0x39')](_0x6db0('0x76'),_0x12463b[_0x6db0('0x45')]['id'][_0x6db0('0x6f')]())))[_0x6db0('0x6f')]();break;default:_0x589907=squel[_0x6db0('0x7a')]()[_0x6db0('0x67')](_0x6db0('0x79'))[_0x6db0('0x7b')]([_0x6db0('0x6b'),'scheduledAt',_0x6db0('0x69'),_0x6db0('0x6a'),'CampaignId',_0x6db0('0x4f'),_0x6db0('0x50')],squel['select']()[_0x6db0('0x6c')](_0x6db0('0x6b'),'phone')[_0x6db0('0x6c')](_0x6db0('0x6d'),_0x6db0('0x68'))[_0x6db0('0x6c')]('id',_0x6db0('0x69'))[_0x6db0('0x6c')](_0x51c8e9[_0x6db0('0x6e')][_0x6db0('0x6f')](),_0x6db0('0x6a'))[_0x6db0('0x6c')](_0x12463b[_0x6db0('0x45')]['id'][_0x6db0('0x6f')](),_0x6db0('0x5b'))['field']('\x27'+_0x5ec701+'\x27','createdAt')[_0x6db0('0x6c')]('\x27'+_0x5ec701+'\x27',_0x6db0('0x50'))[_0x6db0('0x70')](_0x6db0('0x71'))[_0x6db0('0x39')]('deletedAt\x20IS\x20NULL')[_0x6db0('0x39')]('ListId\x20=\x20?',_0x51c8e9['CmListId'][_0x6db0('0x6f')]())[_0x6db0('0x39')](_0x6db0('0x7d')))[_0x6db0('0x6f')]();}_0x1a1290=squel['insert']()[_0x6db0('0x67')](_0x6db0('0x7e'))[_0x6db0('0x7b')]([_0x6db0('0x7f'),_0x6db0('0x68'),_0x6db0('0x6b'),_0x6db0('0x80'),_0x6db0('0x4f'),'updatedAt'],squel['select']()[_0x6db0('0x6c')](_0x6db0('0x81'),'id')[_0x6db0('0x6c')](_0x6db0('0x6d'),_0x6db0('0x68'))[_0x6db0('0x6c')]('ci.item',_0x6db0('0x6b'))[_0x6db0('0x6c')](_0x6db0('0x82'),_0x6db0('0x80'))[_0x6db0('0x6c')]('\x27'+_0x5ec701+'\x27',_0x6db0('0x4f'))[_0x6db0('0x6c')]('\x27'+_0x5ec701+'\x27','updatedAt')[_0x6db0('0x70')](_0x6db0('0x83'),'ci')[_0x6db0('0x84')](_0x6db0('0x79'),'h',_0x6db0('0x85'))['where']('h.ListId\x20=\x20?',_0x51c8e9[_0x6db0('0x6e')][_0x6db0('0x6f')]())['where']('h.CampaignId=?',_0x12463b[_0x6db0('0x45')]['id'][_0x6db0('0x6f')]())[_0x6db0('0x39')]('h.createdAt\x20=\x20?',_0x5ec701))['toString']();_0x544bbe[_0x6db0('0x86')](db[_0x6db0('0x87')][_0x6db0('0x2f')](_0x589907));_0x3634e9[_0x6db0('0x86')](db[_0x6db0('0x87')]['query'](_0x1a1290));}return BPromise[_0x6db0('0x88')](_0x544bbe);}})[_0x6db0('0x23')](function(){return BPromise[_0x6db0('0x88')](_0x3634e9);})[_0x6db0('0x23')](function(){return _0x5d5226;})[_0x6db0('0x23')](respondWithResult(_0x501aeb,null))[_0x6db0('0x43')](handleError(_0x501aeb,null));};exports[_0x6db0('0x89')]=function(_0x49b04e,_0x56e35e,_0x503b22){return db['Campaign']['find']({'where':{'id':_0x49b04e[_0x6db0('0x45')]['id']}})[_0x6db0('0x23')](handleEntityNotFound(_0x56e35e,null))['then'](function(_0x58dbb1){if(_0x58dbb1){return _0x58dbb1[_0x6db0('0x89')](_0x49b04e[_0x6db0('0x2f')][_0x6db0('0x63')]);}})[_0x6db0('0x23')](function(_0x8a3fa6){if(_0x8a3fa6){return db[_0x6db0('0x57')][_0x6db0('0x8a')]({'where':{'ListId':_0x49b04e[_0x6db0('0x2f')][_0x6db0('0x63')],'CampaignId':_0x49b04e[_0x6db0('0x45')]['id']}})[_0x6db0('0x23')](function(){return _0x8a3fa6;});}})[_0x6db0('0x23')](respondWithStatusCode(_0x56e35e,null))[_0x6db0('0x43')](handleError(_0x56e35e,null));};exports['getBlackLists']=function(_0x53aae4,_0x548717,_0x47955b){var _0x124431={};var _0x10fdda={};var _0x1d2b0d;var _0x1069e8;return db[_0x6db0('0x2a')][_0x6db0('0x5a')]({'where':{'id':_0x53aae4[_0x6db0('0x45')]['id']}})[_0x6db0('0x23')](handleEntityNotFound(_0x548717,null))[_0x6db0('0x23')](function(_0x1e852c){if(_0x1e852c){_0x1d2b0d=_0x1e852c;_0x10fdda[_0x6db0('0x2d')]=_[_0x6db0('0x30')](db[_0x6db0('0x61')][_0x6db0('0x4e')]);_0x10fdda[_0x6db0('0x2f')]=_[_0x6db0('0x30')](_0x53aae4[_0x6db0('0x2f')]);_0x10fdda[_0x6db0('0x3a')]=_[_0x6db0('0x31')](_0x10fdda[_0x6db0('0x2d')],_0x10fdda[_0x6db0('0x2f')]);_0x124431[_0x6db0('0x32')]=_[_0x6db0('0x31')](_0x10fdda[_0x6db0('0x2d')],qs[_0x6db0('0x33')](_0x53aae4['query'][_0x6db0('0x33')]));_0x124431['attributes']=_0x124431['attributes']['length']?_0x124431[_0x6db0('0x32')]:_0x10fdda['model'];_0x124431['order']=qs[_0x6db0('0x38')](_0x53aae4[_0x6db0('0x2f')][_0x6db0('0x38')]);_0x124431[_0x6db0('0x39')]=qs[_0x6db0('0x3a')](_[_0x6db0('0x58')](_0x53aae4[_0x6db0('0x2f')],_0x10fdda['filters']));if(_0x53aae4['query'][_0x6db0('0x3b')]){_0x124431[_0x6db0('0x39')]=_['merge'](_0x124431[_0x6db0('0x39')],{'$or':_[_0x6db0('0x2e')](_0x124431[_0x6db0('0x32')],function(_0xa2da21){var _0xdd9418={};_0xdd9418[_0xa2da21]={'$like':'%'+_0x53aae4[_0x6db0('0x2f')][_0x6db0('0x3b')]+'%'};return _0xdd9418;})});}_0x124431=_[_0x6db0('0x3c')]({},_0x124431,_0x53aae4[_0x6db0('0x3f')]);return _0x1d2b0d['getBlackLists'](_0x124431);}})[_0x6db0('0x23')](function(_0x452f93){if(_0x452f93){_0x1069e8=_0x452f93[_0x6db0('0x34')];if(!_0x53aae4[_0x6db0('0x2f')][_0x6db0('0x35')]('nolimit')){_0x124431[_0x6db0('0x1c')]=qs[_0x6db0('0x1c')](_0x53aae4['query']['limit']);_0x124431[_0x6db0('0x1a')]=qs[_0x6db0('0x1a')](_0x53aae4[_0x6db0('0x2f')]['offset']);}return _0x1d2b0d['getBlackLists'](_0x124431);}})[_0x6db0('0x23')](function(_0x376c05){if(_0x376c05){return _0x376c05?{'count':_0x1069e8,'rows':_0x376c05}:null;}})[_0x6db0('0x23')](respondWithResult(_0x548717,null))['catch'](handleError(_0x548717,null));};exports['addBlackLists']=function(_0x37750c,_0x4cd23a,_0x2ec422){var _0x1cd566,_0x5830ad;var _0x30e548=[];var _0x5e1b92=moment()[_0x6db0('0x8b')](_0x6db0('0x8c'));return db[_0x6db0('0x2a')][_0x6db0('0x47')]({'where':{'id':_0x37750c[_0x6db0('0x45')]['id']}})[_0x6db0('0x23')](handleEntityNotFound(_0x4cd23a,null))[_0x6db0('0x23')](function(_0x1c2edb){if(_0x1c2edb){_0x5830ad=_0x1c2edb;return _0x1c2edb[_0x6db0('0x8d')](_0x37750c[_0x6db0('0x51')][_0x6db0('0x63')],_['omit'](_0x37750c[_0x6db0('0x51')],['ids','id'])||{});}return null;})[_0x6db0('0x64')](function(_0x2c3ec0){var _0x13401b;var _0x316380;_0x1cd566=_0x2c3ec0||[];var _0x1c7dbc=[];if(_0x2c3ec0){for(var _0x319d9e=0x0;_0x319d9e<_0x2c3ec0['length'];_0x319d9e+=0x1){var _0x104007=_0x2c3ec0[_0x319d9e]['get']({'plain':!![]});_0x13401b=squel[_0x6db0('0x7a')]()[_0x6db0('0x67')](_0x6db0('0x8e'))[_0x6db0('0x7b')](['phone','ContactId',_0x6db0('0x6a'),_0x6db0('0x5b'),_0x6db0('0x4f'),_0x6db0('0x50')],squel[_0x6db0('0x77')]()[_0x6db0('0x6c')](_0x6db0('0x6b'),_0x6db0('0x6b'))['field']('id',_0x6db0('0x69'))[_0x6db0('0x6c')](_0x104007[_0x6db0('0x6e')][_0x6db0('0x6f')](),_0x6db0('0x6a'))['field'](_0x37750c[_0x6db0('0x45')]['id'][_0x6db0('0x6f')](),_0x6db0('0x5b'))[_0x6db0('0x6c')](_0x6db0('0x6d'),_0x6db0('0x4f'))[_0x6db0('0x6c')](_0x6db0('0x6d'),'updatedAt')['from'](_0x6db0('0x71'))['where']('deletedAt\x20IS\x20NULL')[_0x6db0('0x39')](_0x6db0('0x72'),_0x104007[_0x6db0('0x6e')][_0x6db0('0x6f')]())['where']('phone\x20IS\x20NOT\x20NULL'))[_0x6db0('0x6f')]();_0x1c7dbc[_0x6db0('0x86')](db['sequelize'][_0x6db0('0x2f')](_0x13401b));}return BPromise[_0x6db0('0x88')](_0x1c7dbc);}})[_0x6db0('0x23')](function(){return _0x1cd566;})['then'](respondWithResult(_0x4cd23a,null))['catch'](handleError(_0x4cd23a,null));};exports[_0x6db0('0x8f')]=function(_0x3979ff,_0x268996,_0x430f57){return db['Campaign'][_0x6db0('0x47')]({'where':{'id':_0x3979ff[_0x6db0('0x45')]['id']}})[_0x6db0('0x23')](handleEntityNotFound(_0x268996,null))['then'](function(_0x3dd3a0){if(_0x3dd3a0){return _0x3dd3a0['removeBlackLists'](_0x3979ff[_0x6db0('0x2f')][_0x6db0('0x63')]);}})[_0x6db0('0x23')](function(_0xef6ba0){if(_0xef6ba0){return db[_0x6db0('0x90')][_0x6db0('0x8a')]({'where':{'ListId':_0x3979ff['query']['ids'],'CampaignId':_0x3979ff['params']['id']}})['then'](function(){return _0xef6ba0;});}})[_0x6db0('0x23')](respondWithStatusCode(_0x268996,null))[_0x6db0('0x43')](handleError(_0x268996,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 6e56022..e6c81b7 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(_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 +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x8a2dae,_0x2a21a7){var _0x308f20=function(_0x701c92){while(--_0x701c92){_0x8a2dae['push'](_0x8a2dae['shift']());}};_0x308f20(++_0x2a21a7);}(_0x7a54,0x106));var _0x47a5=function(_0x576409,_0x33014a){_0x576409=_0x576409-0x0;var _0x567bdd=_0x7a54[_0x576409];return _0x567bdd;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index ced9d11..6bc92b1 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 _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 +var _0xdfe9=['findAll','options','raw','where','attributes','include','map','model','debug','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','message','GetCampaign','Campaign'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdfe9,0xc3));var _0x9dfe=function(_0x80f5ff,_0x21d636){_0x80f5ff=_0x80f5ff-0x0;var _0x1ee3b3=_0xdfe9[_0x80f5ff];return _0x1ee3b3;};'use strict';var _=require(_0x9dfe('0x0'));var util=require('util');var moment=require(_0x9dfe('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9dfe('0x2'));var db=require(_0x9dfe('0x3'))['db'];var utils=require(_0x9dfe('0x4'));var logger=require(_0x9dfe('0x5'))(_0x9dfe('0x6'));var config=require(_0x9dfe('0x7'));var jayson=require(_0x9dfe('0x8'));var client=jayson[_0x9dfe('0x9')][_0x9dfe('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3471f0,_0x13b6f8,_0x5e0faf){return new BPromise(function(_0x377c1e,_0xa21ae3){return client[_0x9dfe('0xb')](_0x3471f0,_0x5e0faf)[_0x9dfe('0xc')](function(_0xcd9ecb){logger[_0x9dfe('0xd')](_0x9dfe('0xe'),_0x13b6f8,_0x9dfe('0xf'));logger['debug'](_0x9dfe('0x10'),_0x13b6f8,_0x9dfe('0xf'),JSON[_0x9dfe('0x11')](_0xcd9ecb));if(_0xcd9ecb[_0x9dfe('0x12')]){if(_0xcd9ecb['error']['code']===0x1f4){logger[_0x9dfe('0x12')](_0x9dfe('0xe'),_0x13b6f8,_0xcd9ecb['error']['message']);return _0xa21ae3(_0xcd9ecb['error'][_0x9dfe('0x13')]);}logger[_0x9dfe('0x12')](_0x9dfe('0xe'),_0x13b6f8,_0xcd9ecb[_0x9dfe('0x12')][_0x9dfe('0x13')]);return _0x377c1e(_0xcd9ecb[_0x9dfe('0x12')][_0x9dfe('0x13')]);}else{logger[_0x9dfe('0xd')](_0x9dfe('0xe'),_0x13b6f8,'request\x20sent');_0x377c1e(_0xcd9ecb['result'][_0x9dfe('0x13')]);}})['catch'](function(_0x1a7cbe){logger[_0x9dfe('0x12')](_0x9dfe('0xe'),_0x13b6f8,_0x1a7cbe);_0xa21ae3(_0x1a7cbe);});});}exports[_0x9dfe('0x14')]=function(_0x15e32b){var _0x1bddd4=this;return new Promise(function(_0x5c7158,_0x270796){return db[_0x9dfe('0x15')][_0x9dfe('0x16')]({'raw':_0x15e32b[_0x9dfe('0x17')]?_0x15e32b[_0x9dfe('0x17')][_0x9dfe('0x18')]===undefined?!![]:![]:!![],'where':_0x15e32b[_0x9dfe('0x17')]?_0x15e32b[_0x9dfe('0x17')][_0x9dfe('0x19')]||null:null,'attributes':_0x15e32b[_0x9dfe('0x17')]?_0x15e32b[_0x9dfe('0x17')][_0x9dfe('0x1a')]||null:null,'limit':_0x15e32b[_0x9dfe('0x17')]?_0x15e32b[_0x9dfe('0x17')]['limit']||null:null,'include':_0x15e32b['options']?_0x15e32b[_0x9dfe('0x17')][_0x9dfe('0x1b')]?_[_0x9dfe('0x1c')](_0x15e32b[_0x9dfe('0x17')][_0x9dfe('0x1b')],function(_0x3da663){return{'model':db[_0x3da663[_0x9dfe('0x1d')]],'as':_0x3da663['as'],'attributes':_0x3da663[_0x9dfe('0x1a')],'include':_0x3da663[_0x9dfe('0x1b')]?_[_0x9dfe('0x1c')](_0x3da663[_0x9dfe('0x1b')],function(_0x512599){return{'model':db[_0x512599['model']],'as':_0x512599['as'],'attributes':_0x512599[_0x9dfe('0x1a')],'include':_0x512599[_0x9dfe('0x1b')]?_['map'](_0x512599[_0x9dfe('0x1b')],function(_0x332020){return{'model':db[_0x332020[_0x9dfe('0x1d')]],'as':_0x332020['as'],'attributes':_0x332020['attributes']};}):[]};}):[]};}):[]:[]})[_0x9dfe('0xc')](function(_0xac36fc){logger[_0x9dfe('0xd')](_0x9dfe('0x14'),_0x15e32b);logger[_0x9dfe('0x1e')]('GetCampaign',_0x15e32b,JSON[_0x9dfe('0x11')](_0xac36fc));_0x5c7158(_0xac36fc);})['catch'](function(_0x306426){logger[_0x9dfe('0x12')](_0x9dfe('0x14'),_0x306426[_0x9dfe('0x13')],_0x15e32b);_0x270796(_0x1bddd4[_0x9dfe('0x12')](0x1f4,_0x306426[_0x9dfe('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index e960084..449f1d3 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 _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 +var _0x982c=['/:id/lists','getBlackLists','post','create','clone','addLists','/:id/blacklists','addBlackLists','put','update','delete','destroy','removeLists','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','/:id/hopper_black'];(function(_0xf07bc4,_0x86faf9){var _0x37b1e9=function(_0x218852){while(--_0x218852){_0xf07bc4['push'](_0xf07bc4['shift']());}};_0x37b1e9(++_0x86faf9);}(_0x982c,0xd9));var _0xc982=function(_0x3a36de,_0x565c0f){_0x3a36de=_0x3a36de-0x0;var _0x36029a=_0x982c[_0x3a36de];return _0x36029a;};'use strict';var multer=require('multer');var util=require(_0xc982('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc982('0x1'));var router=express[_0xc982('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xc982('0x3'));var interaction=require(_0xc982('0x4'));var config=require(_0xc982('0x5'));var controller=require('./campaign.controller');router[_0xc982('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc982('0x6')](_0xc982('0x7'),auth[_0xc982('0x8')](),controller[_0xc982('0x9')]);router['get'](_0xc982('0xa'),auth[_0xc982('0x8')](),controller[_0xc982('0xb')]);router[_0xc982('0x6')](_0xc982('0xc'),auth[_0xc982('0x8')](),controller['getHopperHistories']);router[_0xc982('0x6')](_0xc982('0xd'),auth[_0xc982('0x8')](),controller['getHopperFinals']);router['get'](_0xc982('0xe'),auth[_0xc982('0x8')](),controller['getHopperBlacks']);router[_0xc982('0x6')](_0xc982('0xf'),auth[_0xc982('0x8')](),controller['getLists']);router[_0xc982('0x6')]('/:id/blacklists',auth[_0xc982('0x8')](),controller[_0xc982('0x10')]);router[_0xc982('0x11')]('/',auth[_0xc982('0x8')](),controller[_0xc982('0x12')]);router[_0xc982('0x11')]('/:id/clone',auth[_0xc982('0x8')](),controller[_0xc982('0x13')]);router[_0xc982('0x11')](_0xc982('0xf'),auth[_0xc982('0x8')](),controller[_0xc982('0x14')]);router[_0xc982('0x11')](_0xc982('0x15'),auth[_0xc982('0x8')](),controller[_0xc982('0x16')]);router[_0xc982('0x17')](_0xc982('0x7'),auth[_0xc982('0x8')](),controller[_0xc982('0x18')]);router[_0xc982('0x19')](_0xc982('0x7'),auth[_0xc982('0x8')](),controller[_0xc982('0x1a')]);router[_0xc982('0x19')](_0xc982('0xf'),auth['isAuthenticated'](),controller[_0xc982('0x1b')]);router[_0xc982('0x19')](_0xc982('0x15'),auth[_0xc982('0x8')](),controller['removeBlackLists']);module[_0xc982('0x1c')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 2aa316a..6726df0 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 _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 +var _0x127d=['sequelize','exports','STRING','TEXT','VIRTUAL','getDataValue','key'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0x127d,0x103));var _0xd127=function(_0x250d8a,_0x2d81c9){_0x250d8a=_0x250d8a-0x0;var _0x420d8b=_0x127d[_0x250d8a];return _0x420d8b;};'use strict';var Sequelize=require(_0xd127('0x0'));module[_0xd127('0x1')]={'key':{'type':Sequelize[_0xd127('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0xd127('0x3')],'length':'medium','allowNull':![]},'description':{'type':Sequelize[_0xd127('0x2')]},'name':{'type':Sequelize[_0xd127('0x4')],'get':function(){return this[_0xd127('0x5')](_0xd127('0x6'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 0641dce..107e847 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 _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 +var _0xa08e=['ValidationError','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','CannedAnswers','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','then','UserProfileResource','name','send','index','map','CannedAnswer','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','include','findAll','rows','catch','show','params','rawAttributes','options','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize'];(function(_0x40d26b,_0x5a4658){var _0x42a678=function(_0x5c0704){while(--_0x5c0704){_0x40d26b['push'](_0x40d26b['shift']());}};_0x42a678(++_0x5a4658);}(_0xa08e,0xbc));var _0xea08=function(_0xccf869,_0x2556a5){_0xccf869=_0xccf869-0x0;var _0x21a9db=_0xa08e[_0xccf869];return _0x21a9db;};'use strict';var emlformat=require(_0xea08('0x0'));var rimraf=require(_0xea08('0x1'));var zipdir=require(_0xea08('0x2'));var jsonpatch=require(_0xea08('0x3'));var rp=require(_0xea08('0x4'));var moment=require(_0xea08('0x5'));var BPromise=require(_0xea08('0x6'));var Mustache=require('mustache');var util=require(_0xea08('0x7'));var path=require(_0xea08('0x8'));var sox=require(_0xea08('0x9'));var csv=require(_0xea08('0xa'));var ejs=require(_0xea08('0xb'));var fs=require('fs');var fs_extra=require(_0xea08('0xc'));var _=require(_0xea08('0xd'));var squel=require(_0xea08('0xe'));var crypto=require(_0xea08('0xf'));var jsforce=require(_0xea08('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xea08('0xa'));var querystring=require(_0xea08('0x11'));var Papa=require(_0xea08('0x12'));var Redis=require(_0xea08('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xea08('0x14'));var as=require(_0xea08('0x15'));var hardwareService=require(_0xea08('0x16'));var logger=require(_0xea08('0x17'))(_0xea08('0x18'));var utils=require(_0xea08('0x19'));var config=require(_0xea08('0x1a'));var licenseUtil=require(_0xea08('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x148a90,_0x145307){_0x145307=_0x145307||0xcc;return function(_0x9c38ba){if(_0x9c38ba){return _0x148a90[_0xea08('0x1c')](_0x145307);}return _0x148a90[_0xea08('0x1d')](_0x145307)[_0xea08('0x1e')]();};}function respondWithResult(_0x2f2420,_0x4edb6f){_0x4edb6f=_0x4edb6f||0xc8;return function(_0x3093a5){if(_0x3093a5){return _0x2f2420[_0xea08('0x1d')](_0x4edb6f)['json'](_0x3093a5);}};}function respondWithFilteredResult(_0x47c0a7,_0x7797c7){return function(_0x3bc71e){if(_0x3bc71e){var _0x29da03=typeof _0x7797c7[_0xea08('0x1f')]===_0xea08('0x20')&&typeof _0x7797c7[_0xea08('0x21')]===_0xea08('0x20');var _0x1d1a52=_0x3bc71e[_0xea08('0x22')];var _0x40edcc=_0x29da03?0x0:_0x7797c7[_0xea08('0x1f')];var _0x33381c=_0x29da03?_0x3bc71e[_0xea08('0x22')]:_0x7797c7[_0xea08('0x1f')]+_0x7797c7['limit'];var _0x260fcc;if(_0x33381c>=_0x1d1a52){_0x33381c=_0x1d1a52;_0x260fcc=0xc8;}else{_0x260fcc=0xce;}_0x47c0a7[_0xea08('0x1d')](_0x260fcc);return _0x47c0a7[_0xea08('0x23')](_0xea08('0x24'),_0x40edcc+'-'+_0x33381c+'/'+_0x1d1a52)['json'](_0x3bc71e);}return null;};}function patchUpdates(_0x5e46e7){return function(_0x547bfa){try{jsonpatch[_0xea08('0x25')](_0x547bfa,_0x5e46e7,!![]);}catch(_0x1df0e0){return BPromise['reject'](_0x1df0e0);}return _0x547bfa['save']();};}function saveUpdates(_0x10d0df,_0x53704c){return function(_0x174184){if(_0x174184){return _0x174184[_0xea08('0x26')](_0x10d0df)['then'](function(_0x51d504){return _0x51d504;});}return null;};}function removeEntity(_0xfddff5,_0x1210a8){return function(_0x1d6e2d){if(_0x1d6e2d){return _0x1d6e2d[_0xea08('0x27')]()[_0xea08('0x28')](function(){var _0x2e05b9=_0x1d6e2d['get']({'plain':!![]});var _0xf5805f='CannedAnswers';return db[_0xea08('0x29')]['destroy']({'where':{'type':_0xf5805f,'resourceId':_0x2e05b9['id']}})[_0xea08('0x28')](function(){return _0x1d6e2d;});})['then'](function(){_0xfddff5[_0xea08('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e6292,_0x225f24){return function(_0x51f975){if(!_0x51f975){_0x4e6292[_0xea08('0x1c')](0x194);}return _0x51f975;};}function handleError(_0x30a6d0,_0x2e74ea){_0x2e74ea=_0x2e74ea||0x1f4;return function(_0x226718){logger['error'](_0x226718['stack']);if(_0x226718[_0xea08('0x2a')]){delete _0x226718[_0xea08('0x2a')];}_0x30a6d0[_0xea08('0x1d')](_0x2e74ea)[_0xea08('0x2b')](_0x226718);};}exports[_0xea08('0x2c')]=function(_0x4f1cb1,_0x2f76b1){var _0x2d9979={},_0x3d8c75={},_0x48f78d={'count':0x0,'rows':[]};var _0x4c303a=_[_0xea08('0x2d')](db[_0xea08('0x2e')]['rawAttributes'],function(_0x5b4568){return{'name':_0x5b4568['fieldName'],'type':_0x5b4568['type'][_0xea08('0x2f')]};});_0x3d8c75['model']=_[_0xea08('0x2d')](_0x4c303a,_0xea08('0x2a'));_0x3d8c75[_0xea08('0x30')]=_[_0xea08('0x31')](_0x4f1cb1[_0xea08('0x30')]);_0x3d8c75[_0xea08('0x32')]=_[_0xea08('0x33')](_0x3d8c75['model'],_0x3d8c75['query']);_0x2d9979[_0xea08('0x34')]=_[_0xea08('0x33')](_0x3d8c75[_0xea08('0x35')],qs[_0xea08('0x36')](_0x4f1cb1[_0xea08('0x30')][_0xea08('0x36')]));_0x2d9979['attributes']=_0x2d9979[_0xea08('0x34')][_0xea08('0x37')]?_0x2d9979['attributes']:_0x3d8c75['model'];if(!_0x4f1cb1[_0xea08('0x30')][_0xea08('0x38')]('nolimit')){_0x2d9979[_0xea08('0x21')]=qs[_0xea08('0x21')](_0x4f1cb1[_0xea08('0x30')]['limit']);_0x2d9979['offset']=qs['offset'](_0x4f1cb1[_0xea08('0x30')][_0xea08('0x1f')]);}_0x2d9979[_0xea08('0x39')]=qs[_0xea08('0x3a')](_0x4f1cb1['query'][_0xea08('0x3a')]);_0x2d9979['where']=qs[_0xea08('0x32')](_[_0xea08('0x3b')](_0x4f1cb1[_0xea08('0x30')],_0x3d8c75[_0xea08('0x32')]),_0x4c303a);if(_0x4f1cb1['query'][_0xea08('0x3c')]){_0x2d9979[_0xea08('0x3d')]=_[_0xea08('0x3e')](_0x2d9979[_0xea08('0x3d')],{'$or':[{'key':{'$like':'%'+_0x4f1cb1['query'][_0xea08('0x3c')]+'%'}},{'value':{'$like':'%'+_0x4f1cb1[_0xea08('0x30')][_0xea08('0x3c')]+'%'}}]});}_0x2d9979=_[_0xea08('0x3e')]({},_0x2d9979,_0x4f1cb1['options']);var _0x473d4c={'where':_0x2d9979[_0xea08('0x3d')]};return db[_0xea08('0x2e')]['count'](_0x473d4c)[_0xea08('0x28')](function(_0x323170){_0x48f78d[_0xea08('0x22')]=_0x323170;if(_0x4f1cb1[_0xea08('0x30')]['includeAll']){_0x2d9979[_0xea08('0x3f')]=[{'all':!![]}];}return db[_0xea08('0x2e')][_0xea08('0x40')](_0x2d9979);})[_0xea08('0x28')](function(_0x55c6d9){_0x48f78d[_0xea08('0x41')]=_0x55c6d9;return _0x48f78d;})[_0xea08('0x28')](respondWithFilteredResult(_0x2f76b1,_0x2d9979))[_0xea08('0x42')](handleError(_0x2f76b1,null));};exports[_0xea08('0x43')]=function(_0x3ee95e,_0x2167d7){var _0x3dfa8b={'raw':!![],'where':{'id':_0x3ee95e[_0xea08('0x44')]['id']}},_0x13f35b={};_0x13f35b['model']=_[_0xea08('0x31')](db['CannedAnswer'][_0xea08('0x45')]);_0x13f35b[_0xea08('0x30')]=_[_0xea08('0x31')](_0x3ee95e[_0xea08('0x30')]);_0x13f35b[_0xea08('0x32')]=_[_0xea08('0x33')](_0x13f35b['model'],_0x13f35b['query']);_0x3dfa8b[_0xea08('0x34')]=_[_0xea08('0x33')](_0x13f35b[_0xea08('0x35')],qs[_0xea08('0x36')](_0x3ee95e[_0xea08('0x30')]['fields']));_0x3dfa8b[_0xea08('0x34')]=_0x3dfa8b[_0xea08('0x34')][_0xea08('0x37')]?_0x3dfa8b['attributes']:_0x13f35b[_0xea08('0x35')];if(_0x3ee95e[_0xea08('0x30')]['includeAll']){_0x3dfa8b['include']=[{'all':!![]}];}_0x3dfa8b=_[_0xea08('0x3e')]({},_0x3dfa8b,_0x3ee95e[_0xea08('0x46')]);return db[_0xea08('0x2e')][_0xea08('0x47')](_0x3dfa8b)[_0xea08('0x28')](handleEntityNotFound(_0x2167d7,null))[_0xea08('0x28')](respondWithResult(_0x2167d7,null))[_0xea08('0x42')](handleError(_0x2167d7,null));};exports[_0xea08('0x26')]=function(_0x55cb60,_0x16d186){if(_0x55cb60[_0xea08('0x48')]['id']){delete _0x55cb60[_0xea08('0x48')]['id'];}return db[_0xea08('0x2e')][_0xea08('0x47')]({'where':{'id':_0x55cb60[_0xea08('0x44')]['id']}})[_0xea08('0x28')](handleEntityNotFound(_0x16d186,null))[_0xea08('0x28')](saveUpdates(_0x55cb60[_0xea08('0x48')],null))[_0xea08('0x28')](respondWithResult(_0x16d186,null))['catch'](handleError(_0x16d186,null));};exports[_0xea08('0x27')]=function(_0x5ddb7e,_0x53a3f4){return db[_0xea08('0x2e')][_0xea08('0x47')]({'where':{'id':_0x5ddb7e[_0xea08('0x44')]['id']}})[_0xea08('0x28')](handleEntityNotFound(_0x53a3f4,null))[_0xea08('0x28')](removeEntity(_0x53a3f4,null))[_0xea08('0x42')](handleError(_0x53a3f4,null));};exports[_0xea08('0x49')]=function(_0x24e60f,_0x5290ee){var _0x2adc46={'key':_0x24e60f[_0xea08('0x48')][_0xea08('0x2f')]};if(_0x24e60f[_0xea08('0x48')]['MailAccountId']){_0x2adc46[_0xea08('0x4a')]=_0x24e60f['body']['MailAccountId'];}else if(_0x24e60f[_0xea08('0x48')][_0xea08('0x4b')]){_0x2adc46['SmsAccountId']=_0x24e60f[_0xea08('0x48')][_0xea08('0x4b')];}else if(_0x24e60f['body'][_0xea08('0x4c')]){_0x2adc46[_0xea08('0x4c')]=_0x24e60f[_0xea08('0x48')][_0xea08('0x4c')];}else if(_0x24e60f[_0xea08('0x48')]['ChatWebsiteId']){_0x2adc46[_0xea08('0x4d')]=_0x24e60f[_0xea08('0x48')][_0xea08('0x4d')];}return db[_0xea08('0x2e')]['find']({'where':_0x2adc46})[_0xea08('0x28')](function(_0x4062ad){if(_0x4062ad){throw new db[(_0xea08('0x4e'))][(_0xea08('0x4f'))]('The\x20inserted\x20key\x20already\x20exists.');}return db['CannedAnswer']['create'](_0x24e60f[_0xea08('0x48')]);})[_0xea08('0x28')](function(_0x12dfa5){var _0x4d8ba1=_0x24e60f[_0xea08('0x50')][_0xea08('0x51')]({'plain':!![]});if(!_0x4d8ba1)throw new Error(_0xea08('0x52'));if(_0x4d8ba1[_0xea08('0x53')]===_0xea08('0x50')){var _0x2d0597=_0x12dfa5[_0xea08('0x51')]({'plain':!![]});return db[_0xea08('0x54')][_0xea08('0x47')]({'where':{'name':_0xea08('0x55'),'userProfileId':_0x4d8ba1['userProfileId']},'raw':!![]})[_0xea08('0x28')](function(_0x2a91d7){if(_0x2a91d7&&_0x2a91d7[_0xea08('0x56')]===0x0){return db[_0xea08('0x29')][_0xea08('0x49')]({'name':_0x2d0597['name'],'resourceId':_0x2d0597['id'],'type':_0x2a91d7[_0xea08('0x2a')],'sectionId':_0x2a91d7['id']},{})[_0xea08('0x28')](function(){return _0x12dfa5;});}else{return _0x12dfa5;}})['catch'](function(_0x2cf2fc){logger[_0xea08('0x57')](_0xea08('0x58'),_0x2cf2fc);throw _0x2cf2fc;});}return _0x12dfa5;})[_0xea08('0x28')](respondWithResult(_0x5290ee,0xc9))[_0xea08('0x42')](handleError(_0x5290ee,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 1e3266a..c3f9fe1 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 _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 +var _0x36da=['define','CannedAnswer','tools_canned_answers','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./cannedAnswer.attributes','exports'];(function(_0x3e4ddc,_0x52dab2){var _0x5663a0=function(_0x1e17ba){while(--_0x1e17ba){_0x3e4ddc['push'](_0x3e4ddc['shift']());}};_0x5663a0(++_0x52dab2);}(_0x36da,0x154));var _0xa36d=function(_0xf8d80e,_0x36533e){_0xf8d80e=_0xf8d80e-0x0;var _0x57324c=_0x36da[_0xf8d80e];return _0x57324c;};'use strict';var _=require(_0xa36d('0x0'));var util=require(_0xa36d('0x1'));var logger=require(_0xa36d('0x2'))(_0xa36d('0x3'));var moment=require(_0xa36d('0x4'));var BPromise=require(_0xa36d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa36d('0x6'));var rimraf=require(_0xa36d('0x7'));var config=require('../../config/environment');var attributes=require(_0xa36d('0x8'));module[_0xa36d('0x9')]=function(_0x22f112,_0x982041){return _0x22f112[_0xa36d('0xa')](_0xa36d('0xb'),attributes,{'tableName':_0xa36d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xa36d('0xd')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 59f0d24..1d1c284 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(_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 +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(_0x669553,_0xc68aab){var _0x333549=function(_0x3f8431){while(--_0x3f8431){_0x669553['push'](_0x669553['shift']());}};_0x333549(++_0xc68aab);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 295f8e8..3dab4e2 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 _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 +var _0x5db3=['/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cannedAnswer.controller','get','isAuthenticated'];(function(_0x1c1650,_0x3bf2f8){var _0x4be4ea=function(_0x595ee4){while(--_0x595ee4){_0x1c1650['push'](_0x1c1650['shift']());}};_0x4be4ea(++_0x3bf2f8);}(_0x5db3,0x1bd));var _0x35db=function(_0xf16b1,_0x33c637){_0xf16b1=_0xf16b1-0x0;var _0x26f94d=_0x5db3[_0xf16b1];return _0x26f94d;};'use strict';var multer=require(_0x35db('0x0'));var util=require('util');var path=require(_0x35db('0x1'));var timeout=require(_0x35db('0x2'));var express=require(_0x35db('0x3'));var router=express[_0x35db('0x4')]();var fs_extra=require(_0x35db('0x5'));var auth=require(_0x35db('0x6'));var interaction=require(_0x35db('0x7'));var config=require('../../config/environment');var controller=require(_0x35db('0x8'));router[_0x35db('0x9')]('/',auth[_0x35db('0xa')](),controller['index']);router[_0x35db('0x9')](_0x35db('0xb'),auth[_0x35db('0xa')](),controller[_0x35db('0xc')]);router[_0x35db('0xd')]('/',auth['isAuthenticated'](),controller[_0x35db('0xe')]);router[_0x35db('0xf')](_0x35db('0xb'),auth[_0x35db('0xa')](),controller['update']);router[_0x35db('0x10')](_0x35db('0xb'),auth[_0x35db('0xa')](),controller[_0x35db('0x11')]);module[_0x35db('0x12')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index e20c851..eab4051 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 _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 +var _0xd139=['STRING','INTEGER','sequelize','exports'];(function(_0x1a0967,_0x51bc82){var _0x5a169f=function(_0x43fda2){while(--_0x43fda2){_0x1a0967['push'](_0x1a0967['shift']());}};_0x5a169f(++_0x51bc82);}(_0xd139,0x14e));var _0x9d13=function(_0x4931fa,_0x3acd37){_0x4931fa=_0x4931fa-0x0;var _0x5e8f22=_0xd139[_0x4931fa];return _0x5e8f22;};'use strict';var Sequelize=require(_0x9d13('0x0'));module[_0x9d13('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0x9d13('0x2')]},'src':{'type':Sequelize[_0x9d13('0x2')]},'dst':{'type':Sequelize[_0x9d13('0x2')]},'dcontext':{'type':Sequelize[_0x9d13('0x2')]},'channel':{'type':Sequelize[_0x9d13('0x2')]},'dstchannel':{'type':Sequelize[_0x9d13('0x2')]},'lastapp':{'type':Sequelize[_0x9d13('0x2')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x9d13('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x9d13('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x9d13('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x9d13('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x9d13('0x2')]},'type':{'type':Sequelize[_0x9d13('0x2')]},'tag':{'type':Sequelize[_0x9d13('0x2')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 0b2aa63..48d6749 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 _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 +var _0xc21e=['length','hasOwnProperty','nolimit','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','merge','find','create','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','save','update','destroy','then','end','error','stack','name','index','map','Cdr','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes'];(function(_0x1e5e60,_0x464cb0){var _0x2dff91=function(_0x28079e){while(--_0x28079e){_0x1e5e60['push'](_0x1e5e60['shift']());}};_0x2dff91(++_0x464cb0);}(_0xc21e,0x1ca));var _0xec21=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xc21e[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xec21('0x0'));var zipdir=require(_0xec21('0x1'));var jsonpatch=require(_0xec21('0x2'));var rp=require(_0xec21('0x3'));var moment=require(_0xec21('0x4'));var BPromise=require(_0xec21('0x5'));var Mustache=require('mustache');var util=require(_0xec21('0x6'));var path=require(_0xec21('0x7'));var sox=require(_0xec21('0x8'));var csv=require(_0xec21('0x9'));var ejs=require(_0xec21('0xa'));var fs=require('fs');var fs_extra=require(_0xec21('0xb'));var _=require(_0xec21('0xc'));var squel=require(_0xec21('0xd'));var crypto=require('crypto');var jsforce=require(_0xec21('0xe'));var deskjs=require(_0xec21('0xf'));var toCsv=require(_0xec21('0x9'));var querystring=require(_0xec21('0x10'));var Papa=require(_0xec21('0x11'));var Redis=require('ioredis');var authService=require(_0xec21('0x12'));var qs=require(_0xec21('0x13'));var as=require(_0xec21('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xec21('0x15'));var utils=require(_0xec21('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xec21('0x17'));var db=require(_0xec21('0x18'))['db'];function respondWithStatusCode(_0xd9232e,_0x3a6e6a){_0x3a6e6a=_0x3a6e6a||0xcc;return function(_0xc1cca0){if(_0xc1cca0){return _0xd9232e['sendStatus'](_0x3a6e6a);}return _0xd9232e[_0xec21('0x19')](_0x3a6e6a)['end']();};}function respondWithResult(_0x3ea83f,_0x1987f4){_0x1987f4=_0x1987f4||0xc8;return function(_0x34e6af){if(_0x34e6af){return _0x3ea83f['status'](_0x1987f4)[_0xec21('0x1a')](_0x34e6af);}};}function respondWithFilteredResult(_0x3ee6f7,_0x3838c3){return function(_0x2c3124){if(_0x2c3124){var _0x324853=typeof _0x3838c3[_0xec21('0x1b')]===_0xec21('0x1c')&&typeof _0x3838c3[_0xec21('0x1d')]==='undefined';var _0x398c29=_0x2c3124[_0xec21('0x1e')];var _0x2fcbcc=_0x324853?0x0:_0x3838c3[_0xec21('0x1b')];var _0x3ab226=_0x324853?_0x2c3124[_0xec21('0x1e')]:_0x3838c3[_0xec21('0x1b')]+_0x3838c3[_0xec21('0x1d')];var _0x3c790e;if(_0x3ab226>=_0x398c29){_0x3ab226=_0x398c29;_0x3c790e=0xc8;}else{_0x3c790e=0xce;}_0x3ee6f7[_0xec21('0x19')](_0x3c790e);return _0x3ee6f7['set']('Content-Range',_0x2fcbcc+'-'+_0x3ab226+'/'+_0x398c29)[_0xec21('0x1a')](_0x2c3124);}return null;};}function patchUpdates(_0x2f4ef9){return function(_0x5ab97e){try{jsonpatch['apply'](_0x5ab97e,_0x2f4ef9,!![]);}catch(_0x176b59){return BPromise[_0xec21('0x1f')](_0x176b59);}return _0x5ab97e[_0xec21('0x20')]();};}function saveUpdates(_0x5dff00,_0x17d1ac){return function(_0x1f86d2){if(_0x1f86d2){return _0x1f86d2[_0xec21('0x21')](_0x5dff00)['then'](function(_0x20ede9){return _0x20ede9;});}return null;};}function removeEntity(_0x454d31,_0x2d521a){return function(_0x46fd9e){if(_0x46fd9e){return _0x46fd9e[_0xec21('0x22')]()[_0xec21('0x23')](function(){_0x454d31['status'](0xcc)[_0xec21('0x24')]();});}};}function handleEntityNotFound(_0x26cdae,_0x4cd699){return function(_0x19b556){if(!_0x19b556){_0x26cdae['sendStatus'](0x194);}return _0x19b556;};}function handleError(_0x27e2d,_0x49fd27){_0x49fd27=_0x49fd27||0x1f4;return function(_0x4ef840){logger[_0xec21('0x25')](_0x4ef840[_0xec21('0x26')]);if(_0x4ef840[_0xec21('0x27')]){delete _0x4ef840[_0xec21('0x27')];}_0x27e2d[_0xec21('0x19')](_0x49fd27)['send'](_0x4ef840);};}exports[_0xec21('0x28')]=function(_0x592971,_0x343f4f){var _0x233bf9={},_0x116a23={},_0x35b2bf={'count':0x0,'rows':[]};var _0x4dd56b=_[_0xec21('0x29')](db[_0xec21('0x2a')][_0xec21('0x2b')],function(_0x233231){return{'name':_0x233231[_0xec21('0x2c')],'type':_0x233231[_0xec21('0x2d')][_0xec21('0x2e')]};});_0x116a23[_0xec21('0x2f')]=_[_0xec21('0x29')](_0x4dd56b,_0xec21('0x27'));_0x116a23[_0xec21('0x30')]=_['keys'](_0x592971[_0xec21('0x30')]);_0x116a23[_0xec21('0x31')]=_[_0xec21('0x32')](_0x116a23[_0xec21('0x2f')],_0x116a23[_0xec21('0x30')]);_0x233bf9['attributes']=_[_0xec21('0x32')](_0x116a23['model'],qs['fields'](_0x592971['query'][_0xec21('0x33')]));_0x233bf9[_0xec21('0x34')]=_0x233bf9[_0xec21('0x34')][_0xec21('0x35')]?_0x233bf9[_0xec21('0x34')]:_0x116a23[_0xec21('0x2f')];if(!_0x592971[_0xec21('0x30')][_0xec21('0x36')](_0xec21('0x37'))){_0x233bf9[_0xec21('0x1d')]=qs[_0xec21('0x1d')](_0x592971[_0xec21('0x30')]['limit']);_0x233bf9[_0xec21('0x1b')]=qs[_0xec21('0x1b')](_0x592971['query'][_0xec21('0x1b')]);}_0x233bf9['order']=qs['sort'](_0x592971[_0xec21('0x30')]['sort']);_0x233bf9[_0xec21('0x38')]=qs['filters'](_[_0xec21('0x39')](_0x592971[_0xec21('0x30')],_0x116a23['filters']),_0x4dd56b);if(_0x592971[_0xec21('0x30')][_0xec21('0x3a')]){_0x233bf9[_0xec21('0x38')]=_['merge'](_0x233bf9[_0xec21('0x38')],{'$or':_[_0xec21('0x29')](_0x4dd56b,function(_0xcce304){if(_0xcce304['type']!==_0xec21('0x3b')){var _0x2cf43b={};_0x2cf43b[_0xcce304[_0xec21('0x27')]]={'$like':'%'+_0x592971[_0xec21('0x30')][_0xec21('0x3a')]+'%'};return _0x2cf43b;}})});}_0x233bf9=_['merge']({},_0x233bf9,_0x592971[_0xec21('0x3c')]);var _0xc36cc2={'where':_0x233bf9['where']};return db[_0xec21('0x2a')]['count'](_0xc36cc2)[_0xec21('0x23')](function(_0x18e20d){_0x35b2bf[_0xec21('0x1e')]=_0x18e20d;if(_0x592971['query'][_0xec21('0x3d')]){_0x233bf9[_0xec21('0x3e')]=[{'all':!![]}];}return db[_0xec21('0x2a')][_0xec21('0x3f')](_0x233bf9);})['then'](function(_0x575e99){_0x35b2bf[_0xec21('0x40')]=_0x575e99;return _0x35b2bf;})['then'](respondWithFilteredResult(_0x343f4f,_0x233bf9))[_0xec21('0x41')](handleError(_0x343f4f,null));};exports['show']=function(_0x16a794,_0x52e024){var _0x46d4f4={'raw':!![],'where':{'id':_0x16a794['params']['id']}},_0x3510dd={};_0x3510dd[_0xec21('0x2f')]=_[_0xec21('0x42')](db['Cdr'][_0xec21('0x2b')]);_0x3510dd[_0xec21('0x30')]=_[_0xec21('0x42')](_0x16a794[_0xec21('0x30')]);_0x3510dd[_0xec21('0x31')]=_[_0xec21('0x32')](_0x3510dd[_0xec21('0x2f')],_0x3510dd[_0xec21('0x30')]);_0x46d4f4[_0xec21('0x34')]=_['intersection'](_0x3510dd['model'],qs[_0xec21('0x33')](_0x16a794[_0xec21('0x30')][_0xec21('0x33')]));_0x46d4f4['attributes']=_0x46d4f4[_0xec21('0x34')][_0xec21('0x35')]?_0x46d4f4[_0xec21('0x34')]:_0x3510dd['model'];if(_0x16a794['query']['includeAll']){_0x46d4f4[_0xec21('0x3e')]=[{'all':!![]}];}_0x46d4f4=_[_0xec21('0x43')]({},_0x46d4f4,_0x16a794[_0xec21('0x3c')]);return db[_0xec21('0x2a')][_0xec21('0x44')](_0x46d4f4)[_0xec21('0x23')](handleEntityNotFound(_0x52e024,null))[_0xec21('0x23')](respondWithResult(_0x52e024,null))['catch'](handleError(_0x52e024,null));};exports[_0xec21('0x45')]=function(_0x21fe90,_0x2edf34){return db[_0xec21('0x2a')][_0xec21('0x45')](_0x21fe90[_0xec21('0x46')],{})[_0xec21('0x23')](respondWithResult(_0x2edf34,0xc9))[_0xec21('0x41')](handleError(_0x2edf34,null));};exports['update']=function(_0x4204d7,_0x21e67f){if(_0x4204d7[_0xec21('0x46')]['id']){delete _0x4204d7['body']['id'];}return db['Cdr']['find']({'where':{'id':_0x4204d7[_0xec21('0x47')]['id']}})[_0xec21('0x23')](handleEntityNotFound(_0x21e67f,null))['then'](saveUpdates(_0x4204d7[_0xec21('0x46')],null))[_0xec21('0x23')](respondWithResult(_0x21e67f,null))[_0xec21('0x41')](handleError(_0x21e67f,null));};exports['destroy']=function(_0x2d6426,_0x5e90eb){return db[_0xec21('0x2a')]['find']({'where':{'id':_0x2d6426[_0xec21('0x47')]['id']}})[_0xec21('0x23')](handleEntityNotFound(_0x5e90eb,null))[_0xec21('0x23')](removeEntity(_0x5e90eb,null))[_0xec21('0x41')](handleError(_0x5e90eb,null));};exports[_0xec21('0x48')]=function(_0x5c994d,_0x157d42){return db['Cdr'][_0xec21('0x48')]()['then'](respondWithResult(_0x157d42,null))[_0xec21('0x41')](handleError(_0x157d42,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index fdf1730..fcfb7cd 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_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 +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x10a4e4,_0x45e7de){var _0x1b9928=function(_0x470af1){while(--_0x470af1){_0x10a4e4['push'](_0x10a4e4['shift']());}};_0x1b9928(++_0x45e7de);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 5f490ff..366c732 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 _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 +var _0x0330=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','Cdr,\x20%s,\x20%s','message','catch','lodash'];(function(_0x52085b,_0x25a254){var _0x112f3a=function(_0x370a21){while(--_0x370a21){_0x52085b['push'](_0x52085b['shift']());}};_0x112f3a(++_0x25a254);}(_0x0330,0x99));var _0x0033=function(_0x314144,_0x5c3a52){_0x314144=_0x314144-0x0;var _0x4a0624=_0x0330[_0x314144];return _0x4a0624;};'use strict';var _=require(_0x0033('0x0'));var util=require('util');var moment=require(_0x0033('0x1'));var BPromise=require(_0x0033('0x2'));var rs=require(_0x0033('0x3'));var fs=require('fs');var Redis=require(_0x0033('0x4'));var db=require(_0x0033('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0033('0x6'))(_0x0033('0x7'));var config=require(_0x0033('0x8'));var jayson=require(_0x0033('0x9'));var client=jayson[_0x0033('0xa')][_0x0033('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2da41a,_0x25b8d8,_0x4c8ec9){return new BPromise(function(_0x392d7e,_0x4b0ac7){return client[_0x0033('0xc')](_0x2da41a,_0x4c8ec9)[_0x0033('0xd')](function(_0x3419f3){logger[_0x0033('0xe')]('Cdr,\x20%s,\x20%s',_0x25b8d8,_0x0033('0xf'));logger['debug'](_0x0033('0x10'),_0x25b8d8,_0x0033('0xf'),JSON[_0x0033('0x11')](_0x3419f3));if(_0x3419f3[_0x0033('0x12')]){if(_0x3419f3['error']['code']===0x1f4){logger['error'](_0x0033('0x13'),_0x25b8d8,_0x3419f3['error']['message']);return _0x4b0ac7(_0x3419f3[_0x0033('0x12')]['message']);}logger[_0x0033('0x12')](_0x0033('0x13'),_0x25b8d8,_0x3419f3[_0x0033('0x12')][_0x0033('0x14')]);return _0x392d7e(_0x3419f3['error'][_0x0033('0x14')]);}else{logger['info'](_0x0033('0x13'),_0x25b8d8,_0x0033('0xf'));_0x392d7e(_0x3419f3['result']['message']);}})[_0x0033('0x15')](function(_0x55dd2b){logger['error'](_0x0033('0x13'),_0x25b8d8,_0x55dd2b);_0x4b0ac7(_0x55dd2b);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index a6abebe..e852e03 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(_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 +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(_0x3ecf65,_0x3bac13){var _0x1907df=function(_0x247dd9){while(--_0x247dd9){_0x3ecf65['push'](_0x3ecf65['shift']());}};_0x1907df(++_0x3bac13);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index fe56a9d..07b2add 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 _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 +var _0x6236=['TEXT','sequelize','exports','STRING'];(function(_0x2072f9,_0xe8171e){var _0x3a8f99=function(_0x970d50){while(--_0x970d50){_0x2072f9['push'](_0x2072f9['shift']());}};_0x3a8f99(++_0xe8171e);}(_0x6236,0x1ad));var _0x6623=function(_0x584cab,_0x2af797){_0x584cab=_0x584cab-0x0;var _0x17e72f=_0x6236[_0x584cab];return _0x17e72f;};'use strict';var Sequelize=require(_0x6623('0x0'));module[_0x6623('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x6623('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x6623('0x3')]()},'description':{'type':Sequelize[_0x6623('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index babdb06..0d82b82 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 _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 +var _0x6e16=['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/license/util','../../mysqldb','sendStatus','end','status','undefined','limit','count','offset','set','json','apply','reject','save','update','then','destroy','error','stack','name','show','params','model','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','options','catch','body','find','zip-dir','request-promise','bluebird','mustache','path'];(function(_0x5275ce,_0x490452){var _0x13051b=function(_0x47e75a){while(--_0x47e75a){_0x5275ce['push'](_0x5275ce['shift']());}};_0x13051b(++_0x490452);}(_0x6e16,0x1d3));var _0x66e1=function(_0x43a5bd,_0x4c0964){_0x43a5bd=_0x43a5bd-0x0;var _0x52e278=_0x6e16[_0x43a5bd];return _0x52e278;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x66e1('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x66e1('0x1'));var moment=require('moment');var BPromise=require(_0x66e1('0x2'));var Mustache=require(_0x66e1('0x3'));var util=require('util');var path=require(_0x66e1('0x4'));var sox=require('sox');var csv=require(_0x66e1('0x5'));var ejs=require(_0x66e1('0x6'));var fs=require('fs');var fs_extra=require(_0x66e1('0x7'));var _=require('lodash');var squel=require(_0x66e1('0x8'));var crypto=require(_0x66e1('0x9'));var jsforce=require(_0x66e1('0xa'));var deskjs=require(_0x66e1('0xb'));var toCsv=require(_0x66e1('0x5'));var querystring=require(_0x66e1('0xc'));var Papa=require(_0x66e1('0xd'));var Redis=require(_0x66e1('0xe'));var authService=require(_0x66e1('0xf'));var qs=require(_0x66e1('0x10'));var as=require(_0x66e1('0x11'));var hardwareService=require(_0x66e1('0x12'));var logger=require(_0x66e1('0x13'))(_0x66e1('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x66e1('0x15'));var db=require(_0x66e1('0x16'))['db'];function respondWithStatusCode(_0x23e018,_0x497712){_0x497712=_0x497712||0xcc;return function(_0x58c184){if(_0x58c184){return _0x23e018[_0x66e1('0x17')](_0x497712);}return _0x23e018['status'](_0x497712)[_0x66e1('0x18')]();};}function respondWithResult(_0x3e36ff,_0x5b802b){_0x5b802b=_0x5b802b||0xc8;return function(_0x9c17f9){if(_0x9c17f9){return _0x3e36ff[_0x66e1('0x19')](_0x5b802b)['json'](_0x9c17f9);}};}function respondWithFilteredResult(_0x137f52,_0x12ca0b){return function(_0x18e2ab){if(_0x18e2ab){var _0x3a68b3=typeof _0x12ca0b['offset']===_0x66e1('0x1a')&&typeof _0x12ca0b[_0x66e1('0x1b')]===_0x66e1('0x1a');var _0x28e236=_0x18e2ab[_0x66e1('0x1c')];var _0x4f3276=_0x3a68b3?0x0:_0x12ca0b['offset'];var _0x2b5585=_0x3a68b3?_0x18e2ab['count']:_0x12ca0b[_0x66e1('0x1d')]+_0x12ca0b[_0x66e1('0x1b')];var _0x260e87;if(_0x2b5585>=_0x28e236){_0x2b5585=_0x28e236;_0x260e87=0xc8;}else{_0x260e87=0xce;}_0x137f52[_0x66e1('0x19')](_0x260e87);return _0x137f52[_0x66e1('0x1e')]('Content-Range',_0x4f3276+'-'+_0x2b5585+'/'+_0x28e236)[_0x66e1('0x1f')](_0x18e2ab);}return null;};}function patchUpdates(_0x23c6ce){return function(_0xe2822e){try{jsonpatch[_0x66e1('0x20')](_0xe2822e,_0x23c6ce,!![]);}catch(_0x28f6cf){return BPromise[_0x66e1('0x21')](_0x28f6cf);}return _0xe2822e[_0x66e1('0x22')]();};}function saveUpdates(_0x38cf5b,_0x11232c){return function(_0x350b81){if(_0x350b81){return _0x350b81[_0x66e1('0x23')](_0x38cf5b)[_0x66e1('0x24')](function(_0x43686e){return _0x43686e;});}return null;};}function removeEntity(_0x2ea42d,_0x756840){return function(_0x11b7f0){if(_0x11b7f0){return _0x11b7f0[_0x66e1('0x25')]()['then'](function(){_0x2ea42d[_0x66e1('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x203919,_0x414c30){return function(_0x181a7b){if(!_0x181a7b){_0x203919[_0x66e1('0x17')](0x194);}return _0x181a7b;};}function handleError(_0x1e0dfe,_0x4f500e){_0x4f500e=_0x4f500e||0x1f4;return function(_0x5c416d){logger[_0x66e1('0x26')](_0x5c416d[_0x66e1('0x27')]);if(_0x5c416d['name']){delete _0x5c416d[_0x66e1('0x28')];}_0x1e0dfe['status'](_0x4f500e)['send'](_0x5c416d);};}exports[_0x66e1('0x29')]=function(_0x3fcc99,_0xdd2360){var _0x2720af={'raw':!![],'where':{'id':_0x3fcc99[_0x66e1('0x2a')]['id']}},_0x218902={};_0x218902[_0x66e1('0x2b')]=_[_0x66e1('0x2c')](db[_0x66e1('0x2d')][_0x66e1('0x2e')]);_0x218902[_0x66e1('0x2f')]=_[_0x66e1('0x2c')](_0x3fcc99['query']);_0x218902[_0x66e1('0x30')]=_[_0x66e1('0x31')](_0x218902['model'],_0x218902[_0x66e1('0x2f')]);_0x2720af[_0x66e1('0x32')]=_[_0x66e1('0x31')](_0x218902[_0x66e1('0x2b')],qs['fields'](_0x3fcc99[_0x66e1('0x2f')][_0x66e1('0x33')]));_0x2720af[_0x66e1('0x32')]=_0x2720af['attributes'][_0x66e1('0x34')]?_0x2720af['attributes']:_0x218902['model'];if(_0x3fcc99['query'][_0x66e1('0x35')]){_0x2720af[_0x66e1('0x36')]=[{'all':!![]}];}_0x2720af=_['merge']({},_0x2720af,_0x3fcc99[_0x66e1('0x37')]);return db[_0x66e1('0x2d')]['find'](_0x2720af)['then'](handleEntityNotFound(_0xdd2360,null))[_0x66e1('0x24')](respondWithResult(_0xdd2360,null))[_0x66e1('0x38')](handleError(_0xdd2360,null));};exports[_0x66e1('0x23')]=function(_0x4a91b9,_0x364053){if(_0x4a91b9[_0x66e1('0x39')]['id']){delete _0x4a91b9[_0x66e1('0x39')]['id'];}return db[_0x66e1('0x2d')]['find']({'where':{'id':_0x4a91b9[_0x66e1('0x2a')]['id']}})[_0x66e1('0x24')](handleEntityNotFound(_0x364053,null))[_0x66e1('0x24')](saveUpdates(_0x4a91b9[_0x66e1('0x39')],null))[_0x66e1('0x24')](respondWithResult(_0x364053,null))[_0x66e1('0x38')](handleError(_0x364053,null));};exports[_0x66e1('0x25')]=function(_0x361f71,_0xb17802){return db[_0x66e1('0x2d')][_0x66e1('0x3a')]({'where':{'id':_0x361f71[_0x66e1('0x2a')]['id']}})[_0x66e1('0x24')](handleEntityNotFound(_0xb17802,null))[_0x66e1('0x24')](removeEntity(_0xb17802,null))[_0x66e1('0x38')](handleError(_0xb17802,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index dca2ac2..a0ad143 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 _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 +var _0xa86f=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports','chat_applications','utf8mb4_unicode_ci','lodash'];(function(_0x11f893,_0x259935){var _0x400fa8=function(_0x25933b){while(--_0x25933b){_0x11f893['push'](_0x11f893['shift']());}};_0x400fa8(++_0x259935);}(_0xa86f,0x1b7));var _0xfa86=function(_0x3f2d13,_0x4610f4){_0x3f2d13=_0x3f2d13-0x0;var _0x4a7eda=_0xa86f[_0x3f2d13];return _0x4a7eda;};'use strict';var _=require(_0xfa86('0x0'));var util=require('util');var logger=require(_0xfa86('0x1'))('api');var moment=require(_0xfa86('0x2'));var BPromise=require(_0xfa86('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfa86('0x4'));var rimraf=require(_0xfa86('0x5'));var config=require(_0xfa86('0x6'));var attributes=require(_0xfa86('0x7'));module[_0xfa86('0x8')]=function(_0x339931,_0x2d7254){return _0x339931['define']('ChatApplication',attributes,{'tableName':_0xfa86('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xfa86('0xa')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index e99b3c9..502056c 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 _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 +var _0xcec7=['message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','ChatApplication,\x20%s,\x20%s','debug','request\x20sent','error'];(function(_0x2ed7d1,_0x363741){var _0x38ae3c=function(_0x4a1b42){while(--_0x4a1b42){_0x2ed7d1['push'](_0x2ed7d1['shift']());}};_0x38ae3c(++_0x363741);}(_0xcec7,0x17f));var _0x7cec=function(_0x1e5ad0,_0x58ffe3){_0x1e5ad0=_0x1e5ad0-0x0;var _0x46da3b=_0xcec7[_0x1e5ad0];return _0x46da3b;};'use strict';var _=require('lodash');var util=require(_0x7cec('0x0'));var moment=require(_0x7cec('0x1'));var BPromise=require(_0x7cec('0x2'));var rs=require(_0x7cec('0x3'));var fs=require('fs');var Redis=require(_0x7cec('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7cec('0x5'));var logger=require(_0x7cec('0x6'))('rpc');var config=require(_0x7cec('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7cec('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x705342,_0x47028a,_0x239d23){return new BPromise(function(_0x138101,_0x5cdacd){return client[_0x7cec('0x9')](_0x705342,_0x239d23)[_0x7cec('0xa')](function(_0x3682bc){logger[_0x7cec('0xb')](_0x7cec('0xc'),_0x47028a,'request\x20sent');logger[_0x7cec('0xd')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x47028a,_0x7cec('0xe'),JSON['stringify'](_0x3682bc));if(_0x3682bc[_0x7cec('0xf')]){if(_0x3682bc[_0x7cec('0xf')]['code']===0x1f4){logger[_0x7cec('0xf')](_0x7cec('0xc'),_0x47028a,_0x3682bc[_0x7cec('0xf')][_0x7cec('0x10')]);return _0x5cdacd(_0x3682bc[_0x7cec('0xf')][_0x7cec('0x10')]);}logger[_0x7cec('0xf')](_0x7cec('0xc'),_0x47028a,_0x3682bc[_0x7cec('0xf')][_0x7cec('0x10')]);return _0x138101(_0x3682bc[_0x7cec('0xf')][_0x7cec('0x10')]);}else{logger['info'](_0x7cec('0xc'),_0x47028a,_0x7cec('0xe'));_0x138101(_0x3682bc[_0x7cec('0x11')]['message']);}})[_0x7cec('0x12')](function(_0x45238b){logger[_0x7cec('0xf')](_0x7cec('0xc'),_0x47028a,_0x45238b);_0x5cdacd(_0x45238b);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index b126f86..7aed9bd 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 _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 +var _0xbe45=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','show','put','/:id','isAuthenticated','update','delete','exports','multer','path'];(function(_0x42251b,_0x5b5a13){var _0x3de5eb=function(_0x20d973){while(--_0x20d973){_0x42251b['push'](_0x42251b['shift']());}};_0x3de5eb(++_0x5b5a13);}(_0xbe45,0x7c));var _0x5be4=function(_0x469bae,_0x1e34f4){_0x469bae=_0x469bae-0x0;var _0x563ad6=_0xbe45[_0x469bae];return _0x563ad6;};'use strict';var multer=require(_0x5be4('0x0'));var util=require('util');var path=require(_0x5be4('0x1'));var timeout=require(_0x5be4('0x2'));var express=require(_0x5be4('0x3'));var router=express[_0x5be4('0x4')]();var fs_extra=require(_0x5be4('0x5'));var auth=require(_0x5be4('0x6'));var interaction=require(_0x5be4('0x7'));var config=require(_0x5be4('0x8'));var controller=require(_0x5be4('0x9'));router[_0x5be4('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x5be4('0xb')]);router[_0x5be4('0xc')](_0x5be4('0xd'),auth[_0x5be4('0xe')](),controller[_0x5be4('0xf')]);router[_0x5be4('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x5be4('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 64bddda..62feb84 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 _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 +var _0x43a2=['exports','STRING'];(function(_0x342592,_0x2ea679){var _0x4c7d4e=function(_0x1a726e){while(--_0x1a726e){_0x342592['push'](_0x342592['shift']());}};_0x4c7d4e(++_0x2ea679);}(_0x43a2,0xd0));var _0x243a=function(_0x30a5f1,_0x3057fe){_0x30a5f1=_0x30a5f1-0x0;var _0x28f5c0=_0x43a2[_0x30a5f1];return _0x28f5c0;};'use strict';var Sequelize=require('sequelize');module[_0x243a('0x0')]={'name':{'type':Sequelize[_0x243a('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x243a('0x1')]},'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 e46f3cb..74f7624 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 _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 +var _0x2e2d=['ChatGroup','includeAll','include','findAll','rows','catch','rawAttributes','find','update','body','destroy','params','describe','getUnread','user','addMembers','ids','omit','getMembers','length','removeMembers','ChatGroupId','ChatInternalMessage','create','findOne','$gte','split','getMessages','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','./chatGroup.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','then','error','stack','name','send','index','type','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options'];(function(_0x4a209a,_0x575ff9){var _0x4b3c20=function(_0x1a50c1){while(--_0x1a50c1){_0x4a209a['push'](_0x4a209a['shift']());}};_0x4b3c20(++_0x575ff9);}(_0x2e2d,0xdc));var _0xd2e2=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x2e2d[_0x1a36a5];return _0x746243;};'use strict';var emlformat=require(_0xd2e2('0x0'));var rimraf=require(_0xd2e2('0x1'));var zipdir=require(_0xd2e2('0x2'));var jsonpatch=require(_0xd2e2('0x3'));var rp=require(_0xd2e2('0x4'));var moment=require(_0xd2e2('0x5'));var BPromise=require(_0xd2e2('0x6'));var Mustache=require(_0xd2e2('0x7'));var util=require(_0xd2e2('0x8'));var path=require(_0xd2e2('0x9'));var sox=require(_0xd2e2('0xa'));var csv=require('to-csv');var ejs=require(_0xd2e2('0xb'));var fs=require('fs');var fs_extra=require(_0xd2e2('0xc'));var _=require('lodash');var squel=require(_0xd2e2('0xd'));var crypto=require(_0xd2e2('0xe'));var jsforce=require(_0xd2e2('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xd2e2('0x10'));var querystring=require('querystring');var Papa=require(_0xd2e2('0x11'));var Redis=require(_0xd2e2('0x12'));var authService=require(_0xd2e2('0x13'));var qs=require(_0xd2e2('0x14'));var as=require(_0xd2e2('0x15'));var hardwareService=require(_0xd2e2('0x16'));var logger=require(_0xd2e2('0x17'))(_0xd2e2('0x18'));var utils=require(_0xd2e2('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xd2e2('0x1a'));var db=require(_0xd2e2('0x1b'))['db'];config['redis']=_[_0xd2e2('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd2e2('0x1d')]));require(_0xd2e2('0x1e'))[_0xd2e2('0x1f')](socket);function respondWithStatusCode(_0x432b36,_0x17613e){_0x17613e=_0x17613e||0xcc;return function(_0x50979c){if(_0x50979c){return _0x432b36[_0xd2e2('0x20')](_0x17613e);}return _0x432b36[_0xd2e2('0x21')](_0x17613e)[_0xd2e2('0x22')]();};}function respondWithResult(_0x79485e,_0x563e03){_0x563e03=_0x563e03||0xc8;return function(_0x52b989){if(_0x52b989){return _0x79485e[_0xd2e2('0x21')](_0x563e03)[_0xd2e2('0x23')](_0x52b989);}};}function respondWithFilteredResult(_0x5dd9af,_0x8b595f){return function(_0x447413){if(_0x447413){var _0xe64571=typeof _0x8b595f[_0xd2e2('0x24')]==='undefined'&&typeof _0x8b595f[_0xd2e2('0x25')]===_0xd2e2('0x26');var _0x300683=_0x447413[_0xd2e2('0x27')];var _0x3983be=_0xe64571?0x0:_0x8b595f[_0xd2e2('0x24')];var _0x5224e7=_0xe64571?_0x447413[_0xd2e2('0x27')]:_0x8b595f[_0xd2e2('0x24')]+_0x8b595f[_0xd2e2('0x25')];var _0x204110;if(_0x5224e7>=_0x300683){_0x5224e7=_0x300683;_0x204110=0xc8;}else{_0x204110=0xce;}_0x5dd9af['status'](_0x204110);return _0x5dd9af[_0xd2e2('0x28')](_0xd2e2('0x29'),_0x3983be+'-'+_0x5224e7+'/'+_0x300683)[_0xd2e2('0x23')](_0x447413);}return null;};}function patchUpdates(_0x4dc007){return function(_0x3828f0){try{jsonpatch[_0xd2e2('0x2a')](_0x3828f0,_0x4dc007,!![]);}catch(_0x3d5f61){return BPromise['reject'](_0x3d5f61);}return _0x3828f0[_0xd2e2('0x2b')]();};}function saveUpdates(_0x518391,_0x45818c){return function(_0x1a3fb4){if(_0x1a3fb4){return _0x1a3fb4['update'](_0x518391)[_0xd2e2('0x2c')](function(_0x49bf31){return _0x49bf31;});}return null;};}function removeEntity(_0x1ea050,_0x5e9129){return function(_0x44ac6d){if(_0x44ac6d){return _0x44ac6d['destroy']()['then'](function(){_0x1ea050[_0xd2e2('0x21')](0xcc)[_0xd2e2('0x22')]();});}};}function handleEntityNotFound(_0x45567f,_0x4021f1){return function(_0x46306b){if(!_0x46306b){_0x45567f[_0xd2e2('0x20')](0x194);}return _0x46306b;};}function handleError(_0x4bdb88,_0x4f69cf){_0x4f69cf=_0x4f69cf||0x1f4;return function(_0x31cccc){logger[_0xd2e2('0x2d')](_0x31cccc[_0xd2e2('0x2e')]);if(_0x31cccc['name']){delete _0x31cccc[_0xd2e2('0x2f')];}_0x4bdb88['status'](_0x4f69cf)[_0xd2e2('0x30')](_0x31cccc);};}exports[_0xd2e2('0x31')]=function(_0x30c38d,_0x4743ce){var _0x4dd9c1={},_0xcfdd7d={},_0x30d603={'count':0x0,'rows':[]};var _0x15009c=_['map'](db['ChatGroup']['rawAttributes'],function(_0x1e68e1){return{'name':_0x1e68e1['fieldName'],'type':_0x1e68e1[_0xd2e2('0x32')]['key']};});_0xcfdd7d[_0xd2e2('0x33')]=_[_0xd2e2('0x34')](_0x15009c,_0xd2e2('0x2f'));_0xcfdd7d[_0xd2e2('0x35')]=_[_0xd2e2('0x36')](_0x30c38d[_0xd2e2('0x35')]);_0xcfdd7d[_0xd2e2('0x37')]=_[_0xd2e2('0x38')](_0xcfdd7d[_0xd2e2('0x33')],_0xcfdd7d[_0xd2e2('0x35')]);_0x4dd9c1[_0xd2e2('0x39')]=_[_0xd2e2('0x38')](_0xcfdd7d['model'],qs[_0xd2e2('0x3a')](_0x30c38d[_0xd2e2('0x35')][_0xd2e2('0x3a')]));_0x4dd9c1['attributes']=_0x4dd9c1['attributes']['length']?_0x4dd9c1[_0xd2e2('0x39')]:_0xcfdd7d[_0xd2e2('0x33')];if(!_0x30c38d['query'][_0xd2e2('0x3b')](_0xd2e2('0x3c'))){_0x4dd9c1[_0xd2e2('0x25')]=qs[_0xd2e2('0x25')](_0x30c38d[_0xd2e2('0x35')][_0xd2e2('0x25')]);_0x4dd9c1[_0xd2e2('0x24')]=qs[_0xd2e2('0x24')](_0x30c38d[_0xd2e2('0x35')][_0xd2e2('0x24')]);}_0x4dd9c1[_0xd2e2('0x3d')]=qs[_0xd2e2('0x3e')](_0x30c38d['query']['sort']);_0x4dd9c1['where']=qs[_0xd2e2('0x37')](_[_0xd2e2('0x3f')](_0x30c38d[_0xd2e2('0x35')],_0xcfdd7d[_0xd2e2('0x37')]),_0x15009c);if(_0x30c38d[_0xd2e2('0x35')][_0xd2e2('0x40')]){_0x4dd9c1[_0xd2e2('0x41')]=_[_0xd2e2('0x42')](_0x4dd9c1[_0xd2e2('0x41')],{'$or':_[_0xd2e2('0x34')](_0x15009c,function(_0x132460){if(_0x132460[_0xd2e2('0x32')]!=='VIRTUAL'){var _0xa5c5f6={};_0xa5c5f6[_0x132460[_0xd2e2('0x2f')]]={'$like':'%'+_0x30c38d[_0xd2e2('0x35')][_0xd2e2('0x40')]+'%'};return _0xa5c5f6;}})});}_0x4dd9c1=_[_0xd2e2('0x42')]({},_0x4dd9c1,_0x30c38d[_0xd2e2('0x43')]);var _0x57026e={'where':_0x4dd9c1[_0xd2e2('0x41')]};return db[_0xd2e2('0x44')]['count'](_0x57026e)[_0xd2e2('0x2c')](function(_0x52ed67){_0x30d603[_0xd2e2('0x27')]=_0x52ed67;if(_0x30c38d[_0xd2e2('0x35')][_0xd2e2('0x45')]){_0x4dd9c1[_0xd2e2('0x46')]=[{'all':!![]}];}return db[_0xd2e2('0x44')][_0xd2e2('0x47')](_0x4dd9c1);})['then'](function(_0x55eb58){_0x30d603[_0xd2e2('0x48')]=_0x55eb58;return _0x30d603;})[_0xd2e2('0x2c')](respondWithFilteredResult(_0x4743ce,_0x4dd9c1))[_0xd2e2('0x49')](handleError(_0x4743ce,null));};exports['show']=function(_0x26c20c,_0x162d68){var _0x21f4b8={'raw':!![],'where':{'id':_0x26c20c['params']['id']}},_0x21c48f={};_0x21c48f[_0xd2e2('0x33')]=_['keys'](db['ChatGroup'][_0xd2e2('0x4a')]);_0x21c48f[_0xd2e2('0x35')]=_[_0xd2e2('0x36')](_0x26c20c['query']);_0x21c48f['filters']=_[_0xd2e2('0x38')](_0x21c48f['model'],_0x21c48f[_0xd2e2('0x35')]);_0x21f4b8['attributes']=_[_0xd2e2('0x38')](_0x21c48f[_0xd2e2('0x33')],qs[_0xd2e2('0x3a')](_0x26c20c[_0xd2e2('0x35')][_0xd2e2('0x3a')]));_0x21f4b8[_0xd2e2('0x39')]=_0x21f4b8[_0xd2e2('0x39')]['length']?_0x21f4b8[_0xd2e2('0x39')]:_0x21c48f[_0xd2e2('0x33')];if(_0x26c20c[_0xd2e2('0x35')]['includeAll']){_0x21f4b8[_0xd2e2('0x46')]=[{'all':!![]}];}_0x21f4b8=_[_0xd2e2('0x42')]({},_0x21f4b8,_0x26c20c[_0xd2e2('0x43')]);return db['ChatGroup'][_0xd2e2('0x4b')](_0x21f4b8)[_0xd2e2('0x2c')](handleEntityNotFound(_0x162d68,null))[_0xd2e2('0x2c')](respondWithResult(_0x162d68,null))[_0xd2e2('0x49')](handleError(_0x162d68,null));};exports['create']=function(_0x56bf28,_0x359f37){return db[_0xd2e2('0x44')]['create'](_0x56bf28['body'],{})[_0xd2e2('0x2c')](respondWithResult(_0x359f37,0xc9))[_0xd2e2('0x49')](handleError(_0x359f37,null));};exports[_0xd2e2('0x4c')]=function(_0x57597d,_0x234b9b){if(_0x57597d[_0xd2e2('0x4d')]['id']){delete _0x57597d[_0xd2e2('0x4d')]['id'];}return db[_0xd2e2('0x44')][_0xd2e2('0x4b')]({'where':{'id':_0x57597d['params']['id']}})[_0xd2e2('0x2c')](handleEntityNotFound(_0x234b9b,null))[_0xd2e2('0x2c')](saveUpdates(_0x57597d[_0xd2e2('0x4d')],null))[_0xd2e2('0x2c')](respondWithResult(_0x234b9b,null))[_0xd2e2('0x49')](handleError(_0x234b9b,null));};exports[_0xd2e2('0x4e')]=function(_0x4d4c0d,_0x49cb6c){return db[_0xd2e2('0x44')][_0xd2e2('0x4b')]({'where':{'id':_0x4d4c0d[_0xd2e2('0x4f')]['id']}})[_0xd2e2('0x2c')](handleEntityNotFound(_0x49cb6c,null))['then'](removeEntity(_0x49cb6c,null))[_0xd2e2('0x49')](handleError(_0x49cb6c,null));};exports['describe']=function(_0x4e8f28,_0x3f54ed){return db[_0xd2e2('0x44')][_0xd2e2('0x50')]()[_0xd2e2('0x2c')](respondWithResult(_0x3f54ed,null))[_0xd2e2('0x49')](handleError(_0x3f54ed,null));};exports[_0xd2e2('0x51')]=function(_0x16f41f,_0x5b91ac,_0x558b29){return db['ChatInternalMessage'][_0xd2e2('0x27')]({'where':{'ChatGroupId':_0x16f41f['params']['id'],'ToId':_0x16f41f[_0xd2e2('0x52')]['id'],'read':![]}})[_0xd2e2('0x2c')](function(_0x4af403){return{'id':_['toInteger'](_0x16f41f[_0xd2e2('0x4f')]['id']),'count':_0x4af403};})['then'](respondWithResult(_0x5b91ac,null))['catch'](handleError(_0x5b91ac,null));};exports[_0xd2e2('0x53')]=function(_0x37d1e1,_0x4a3f34,_0x1859a0){return db[_0xd2e2('0x44')][_0xd2e2('0x4b')]({'where':{'id':_0x37d1e1[_0xd2e2('0x4f')]['id']}})[_0xd2e2('0x2c')](handleEntityNotFound(_0x4a3f34,null))[_0xd2e2('0x2c')](function(_0x31e71b){if(_0x31e71b){return _0x31e71b['addMembers'](_0x37d1e1['body'][_0xd2e2('0x54')],_[_0xd2e2('0x55')](_0x37d1e1['body'],[_0xd2e2('0x54'),'id'])||{});}})[_0xd2e2('0x2c')](respondWithResult(_0x4a3f34,null))['catch'](handleError(_0x4a3f34,null));};exports[_0xd2e2('0x56')]=function(_0x43ff5e,_0x13f9b1,_0x1c95d9){var _0x13b7ce={};var _0x17bf64={};var _0xf4419b;var _0x112312;return db[_0xd2e2('0x44')]['findOne']({'where':{'id':_0x43ff5e['params']['id']}})['then'](handleEntityNotFound(_0x13f9b1,null))['then'](function(_0x280601){if(_0x280601){_0xf4419b=_0x280601;_0x17bf64[_0xd2e2('0x33')]=_[_0xd2e2('0x36')](db['User']['rawAttributes']);_0x17bf64['query']=_[_0xd2e2('0x36')](_0x43ff5e[_0xd2e2('0x35')]);_0x17bf64[_0xd2e2('0x37')]=_['intersection'](_0x17bf64[_0xd2e2('0x33')],_0x17bf64['query']);_0x13b7ce['attributes']=_[_0xd2e2('0x38')](_0x17bf64[_0xd2e2('0x33')],qs[_0xd2e2('0x3a')](_0x43ff5e[_0xd2e2('0x35')][_0xd2e2('0x3a')]));_0x13b7ce[_0xd2e2('0x39')]=_0x13b7ce[_0xd2e2('0x39')][_0xd2e2('0x57')]?_0x13b7ce[_0xd2e2('0x39')]:_0x17bf64['model'];_0x13b7ce['order']=qs[_0xd2e2('0x3e')](_0x43ff5e['query']['sort']);_0x13b7ce[_0xd2e2('0x41')]=qs['filters'](_[_0xd2e2('0x3f')](_0x43ff5e[_0xd2e2('0x35')],_0x17bf64[_0xd2e2('0x37')]));if(_0x43ff5e['query'][_0xd2e2('0x40')]){_0x13b7ce[_0xd2e2('0x41')]=_[_0xd2e2('0x42')](_0x13b7ce['where'],{'$or':_[_0xd2e2('0x34')](_0x13b7ce[_0xd2e2('0x39')],function(_0x1a7d5c){var _0x35e648={};_0x35e648[_0x1a7d5c]={'$like':'%'+_0x43ff5e['query'][_0xd2e2('0x40')]+'%'};return _0x35e648;})});}_0x13b7ce=_[_0xd2e2('0x42')]({},_0x13b7ce,_0x43ff5e['options']);return _0xf4419b['getMembers'](_0x13b7ce);}})['then'](function(_0x4fd8a5){if(_0x4fd8a5){_0x112312=_0x4fd8a5[_0xd2e2('0x57')];if(!_0x43ff5e['query'][_0xd2e2('0x3b')](_0xd2e2('0x3c'))){_0x13b7ce[_0xd2e2('0x25')]=qs[_0xd2e2('0x25')](_0x43ff5e[_0xd2e2('0x35')][_0xd2e2('0x25')]);_0x13b7ce['offset']=qs[_0xd2e2('0x24')](_0x43ff5e[_0xd2e2('0x35')][_0xd2e2('0x24')]);}return _0xf4419b[_0xd2e2('0x56')](_0x13b7ce);}})[_0xd2e2('0x2c')](function(_0x2200a0){if(_0x2200a0){return _0x2200a0?{'count':_0x112312,'rows':_0x2200a0}:null;}})[_0xd2e2('0x2c')](respondWithResult(_0x13f9b1,null))[_0xd2e2('0x49')](handleError(_0x13f9b1,null));};exports['removeMembers']=function(_0x4f945c,_0x271af4,_0x2287b3){return db[_0xd2e2('0x44')][_0xd2e2('0x4b')]({'where':{'id':_0x4f945c['params']['id']}})[_0xd2e2('0x2c')](handleEntityNotFound(_0x271af4,null))[_0xd2e2('0x2c')](function(_0x4a3671){if(_0x4a3671){return _0x4a3671[_0xd2e2('0x58')](_0x4f945c[_0xd2e2('0x35')][_0xd2e2('0x54')]);}})['then'](respondWithStatusCode(_0x271af4,null))['catch'](handleError(_0x271af4,null));};exports['addMessage']=function(_0x8b6324,_0x1e8bee,_0xed1301){if(_0x8b6324['body']['id']){delete _0x8b6324[_0xd2e2('0x4d')]['id'];}return db[_0xd2e2('0x44')][_0xd2e2('0x4b')]({'where':{'id':_0x8b6324[_0xd2e2('0x4f')]['id']}})[_0xd2e2('0x2c')](handleEntityNotFound(_0x1e8bee,null))['then'](function(_0x55f897){if(_0x55f897){_0x8b6324[_0xd2e2('0x4d')][_0xd2e2('0x59')]=_0x55f897['id'];return db[_0xd2e2('0x5a')][_0xd2e2('0x5b')](_0x8b6324[_0xd2e2('0x4d')]);}})[_0xd2e2('0x2c')](respondWithResult(_0x1e8bee,null))[_0xd2e2('0x49')](handleError(_0x1e8bee,null));};exports['getMessages']=function(_0x5c8ae6,_0x14e83d,_0x4aa84b){var _0x3a149c={};var _0x47db12={};var _0x121a28;var _0x5af47c;return db[_0xd2e2('0x44')][_0xd2e2('0x5c')]({'where':{'id':_0x5c8ae6[_0xd2e2('0x4f')]['id']}})[_0xd2e2('0x2c')](handleEntityNotFound(_0x14e83d,null))['then'](function(_0x1f48e2){if(_0x1f48e2){_0x121a28=_0x1f48e2;_0x47db12['model']=_[_0xd2e2('0x36')](db[_0xd2e2('0x5a')]['rawAttributes']);_0x47db12['query']=_[_0xd2e2('0x36')](_0x5c8ae6[_0xd2e2('0x35')]);_0x47db12['filters']=_[_0xd2e2('0x38')](_0x47db12[_0xd2e2('0x33')],_0x47db12[_0xd2e2('0x35')]);_0x3a149c[_0xd2e2('0x39')]=_['intersection'](_0x47db12['model'],qs[_0xd2e2('0x3a')](_0x5c8ae6[_0xd2e2('0x35')][_0xd2e2('0x3a')]));_0x3a149c[_0xd2e2('0x39')]=_0x3a149c[_0xd2e2('0x39')][_0xd2e2('0x57')]?_0x3a149c[_0xd2e2('0x39')]:_0x47db12['model'];_0x3a149c[_0xd2e2('0x3d')]=qs[_0xd2e2('0x3e')](_0x5c8ae6[_0xd2e2('0x35')]['sort']);_0x3a149c['where']=qs[_0xd2e2('0x37')](_[_0xd2e2('0x3f')](_0x5c8ae6[_0xd2e2('0x35')],_0x47db12[_0xd2e2('0x37')]));if(_0x5c8ae6[_0xd2e2('0x35')][_0xd2e2('0x40')]){_0x3a149c[_0xd2e2('0x41')]=_[_0xd2e2('0x42')](_0x3a149c[_0xd2e2('0x41')],{'$or':_['map'](_0x3a149c['attributes'],function(_0x1010a8){var _0x92c855={};_0x92c855[_0x1010a8]={'$like':'%'+_0x5c8ae6[_0xd2e2('0x35')][_0xd2e2('0x40')]+'%'};return _0x92c855;})});}if(_0x5c8ae6[_0xd2e2('0x35')][_0xd2e2('0x5d')]){var _0x2a5c53=_0x5c8ae6['query'][_0xd2e2('0x5d')][_0xd2e2('0x5e')](',');var _0x3e77bd={};_0x3e77bd[_0x2a5c53[0x0]]={'$gte':moment(_0x2a5c53[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x3a149c['where']=_[_0xd2e2('0x42')](_0x3a149c[_0xd2e2('0x41')],_0x3e77bd);}_0x3a149c=_[_0xd2e2('0x42')]({},_0x3a149c,_0x5c8ae6[_0xd2e2('0x43')]);return _0x121a28[_0xd2e2('0x5f')](_0x3a149c);}})['then'](function(_0x40d5ba){if(_0x40d5ba){_0x5af47c=_0x40d5ba['length'];if(!_0x5c8ae6[_0xd2e2('0x35')]['hasOwnProperty'](_0xd2e2('0x3c'))){_0x3a149c[_0xd2e2('0x25')]=qs[_0xd2e2('0x25')](_0x5c8ae6[_0xd2e2('0x35')]['limit']);_0x3a149c[_0xd2e2('0x24')]=qs[_0xd2e2('0x24')](_0x5c8ae6['query']['offset']);}return _0x121a28['getMessages'](_0x3a149c);}})['then'](function(_0x16243c){if(_0x16243c){return _0x16243c?{'count':_0x5af47c,'rows':_0x16243c}:null;}})[_0xd2e2('0x2c')](respondWithResult(_0x14e83d,null))['catch'](handleError(_0x14e83d,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 82abe47..a0f7a75 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 _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 +var _0xcd40=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','ChatGroup','save'];(function(_0x5be1ac,_0x4aad5d){var _0x105d3c=function(_0x1a5bb2){while(--_0x1a5bb2){_0x5be1ac['push'](_0x5be1ac['shift']());}};_0x105d3c(++_0x4aad5d);}(_0xcd40,0x101));var _0x0cd4=function(_0x2cd796,_0x47d578){_0x2cd796=_0x2cd796-0x0;var _0x42e314=_0xcd40[_0x2cd796];return _0x42e314;};'use strict';var EventEmitter=require(_0x0cd4('0x0'));var ChatGroup=require(_0x0cd4('0x1'))['db'][_0x0cd4('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0cd4('0x3'),'afterUpdate':_0x0cd4('0x4'),'afterDestroy':_0x0cd4('0x5')};function emitEvent(_0x330d96){return function(_0x58ea00,_0x3669b8,_0x314596){ChatGroupEvents[_0x0cd4('0x6')](_0x330d96+':'+_0x58ea00['id'],_0x58ea00);ChatGroupEvents['emit'](_0x330d96,_0x58ea00);_0x314596(null);};}for(var e in events){if(events[_0x0cd4('0x7')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x0cd4('0x8')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 89451ce..5e82b1b 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 _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 +var _0x1b02=['api','moment','request-promise','path','rimraf','../../config/environment','./chatGroup.attributes','exports','lodash','util','../../config/logger'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x1b02,0x1ec));var _0x21b0=function(_0x14b9ab,_0x4b5bb2){_0x14b9ab=_0x14b9ab-0x0;var _0x6a7e2f=_0x1b02[_0x14b9ab];return _0x6a7e2f;};'use strict';var _=require(_0x21b0('0x0'));var util=require(_0x21b0('0x1'));var logger=require(_0x21b0('0x2'))(_0x21b0('0x3'));var moment=require(_0x21b0('0x4'));var BPromise=require('bluebird');var rp=require(_0x21b0('0x5'));var fs=require('fs');var path=require(_0x21b0('0x6'));var rimraf=require(_0x21b0('0x7'));var config=require(_0x21b0('0x8'));var attributes=require(_0x21b0('0x9'));module[_0x21b0('0xa')]=function(_0x44122f,_0xd919a3){return _0x44122f['define']('ChatGroup',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 7a1bfd7..231af36 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 _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 +var _0x26d1=['ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','ChatGroup,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatGroup.socket','register','request','then','info','request\x20sent','debug'];(function(_0x2a327c,_0x5d1964){var _0x3567b7=function(_0x10df41){while(--_0x10df41){_0x2a327c['push'](_0x2a327c['shift']());}};_0x3567b7(++_0x5d1964);}(_0x26d1,0x8e));var _0x126d=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x26d1[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0x126d('0x0'));var util=require('util');var moment=require(_0x126d('0x1'));var BPromise=require(_0x126d('0x2'));var rs=require(_0x126d('0x3'));var fs=require('fs');var Redis=require(_0x126d('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x126d('0x5'))('rpc');var config=require(_0x126d('0x6'));var jayson=require(_0x126d('0x7'));var client=jayson[_0x126d('0x8')][_0x126d('0x9')]({'port':0x232a});config[_0x126d('0xa')]=_['defaults'](config[_0x126d('0xa')],{'host':_0x126d('0xb'),'port':0x18eb});var socket=require(_0x126d('0xc'))(new Redis(config[_0x126d('0xa')]));require(_0x126d('0xd'))[_0x126d('0xe')](socket);function respondWithRpcPromise(_0x157013,_0x5caa7f,_0x41f211){return new BPromise(function(_0x3cfc3b,_0x2e7a25){return client[_0x126d('0xf')](_0x157013,_0x41f211)[_0x126d('0x10')](function(_0x521ab7){logger[_0x126d('0x11')]('ChatGroup,\x20%s,\x20%s',_0x5caa7f,_0x126d('0x12'));logger[_0x126d('0x13')](_0x126d('0x14'),_0x5caa7f,'request\x20sent',JSON[_0x126d('0x15')](_0x521ab7));if(_0x521ab7[_0x126d('0x16')]){if(_0x521ab7[_0x126d('0x16')]['code']===0x1f4){logger['error'](_0x126d('0x17'),_0x5caa7f,_0x521ab7[_0x126d('0x16')][_0x126d('0x18')]);return _0x2e7a25(_0x521ab7[_0x126d('0x16')][_0x126d('0x18')]);}logger[_0x126d('0x16')]('ChatGroup,\x20%s,\x20%s',_0x5caa7f,_0x521ab7[_0x126d('0x16')]['message']);return _0x3cfc3b(_0x521ab7[_0x126d('0x16')]['message']);}else{logger[_0x126d('0x11')](_0x126d('0x17'),_0x5caa7f,'request\x20sent');_0x3cfc3b(_0x521ab7[_0x126d('0x19')]['message']);}})[_0x126d('0x1a')](function(_0x57152a){logger['error']('ChatGroup,\x20%s,\x20%s',_0x5caa7f,_0x57152a);_0x2e7a25(_0x57152a);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index fb41fe5..505055b 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 _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 +var _0xe3b0=['emit','removeListener','register','chatGroup:','./chatGroup.events','remove','update'];(function(_0x5d8660,_0x3368e3){var _0x304e37=function(_0x30df2b){while(--_0x30df2b){_0x5d8660['push'](_0x5d8660['shift']());}};_0x304e37(++_0x3368e3);}(_0xe3b0,0x1bd));var _0x0e3b=function(_0x349367,_0x1cede2){_0x349367=_0x349367-0x0;var _0x14179b=_0xe3b0[_0x349367];return _0x14179b;};'use strict';var ChatGroupEvents=require(_0x0e3b('0x0'));var events=['save',_0x0e3b('0x1'),_0x0e3b('0x2')];function createListener(_0x5bcde0,_0xaa4169){return function(_0x36fba0){_0xaa4169[_0x0e3b('0x3')](_0x5bcde0,_0x36fba0);};}function removeListener(_0x4eb254,_0x22acb0){return function(){ChatGroupEvents[_0x0e3b('0x4')](_0x4eb254,_0x22acb0);};}exports[_0x0e3b('0x5')]=function(_0x3b90d4){for(var _0x52f0c1=0x0,_0x50ab64=events['length'];_0x52f0c1<_0x50ab64;_0x52f0c1++){var _0x490407=events[_0x52f0c1];var _0x516fed=createListener(_0x0e3b('0x6')+_0x490407,_0x3b90d4);ChatGroupEvents['on'](_0x490407,_0x516fed);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index bd9b94e..1f8a659 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 _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 +var _0x027f=['getMembers','/:id/messages','getMessages','post','create','addMessage','put','update','delete','destroy','removeMembers','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','./chatGroup.controller','get','isAuthenticated','describe','/:id','show','/:id/unread','getUnread','/:id/members'];(function(_0x27c2f0,_0x2b0f28){var _0x85cc95=function(_0x5a99ce){while(--_0x5a99ce){_0x27c2f0['push'](_0x27c2f0['shift']());}};_0x85cc95(++_0x2b0f28);}(_0x027f,0xdb));var _0xf027=function(_0x571ce8,_0x453d89){_0x571ce8=_0x571ce8-0x0;var _0x4cfa1d=_0x027f[_0x571ce8];return _0x4cfa1d;};'use strict';var multer=require(_0xf027('0x0'));var util=require(_0xf027('0x1'));var path=require(_0xf027('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf027('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf027('0x4'));var interaction=require(_0xf027('0x5'));var config=require('../../config/environment');var controller=require(_0xf027('0x6'));router[_0xf027('0x7')]('/',auth[_0xf027('0x8')](),controller['index']);router[_0xf027('0x7')]('/describe',auth['isAuthenticated'](),controller[_0xf027('0x9')]);router[_0xf027('0x7')](_0xf027('0xa'),auth['isAuthenticated'](),controller[_0xf027('0xb')]);router[_0xf027('0x7')](_0xf027('0xc'),auth[_0xf027('0x8')](),controller[_0xf027('0xd')]);router[_0xf027('0x7')](_0xf027('0xe'),auth[_0xf027('0x8')](),controller[_0xf027('0xf')]);router['get'](_0xf027('0x10'),auth[_0xf027('0x8')](),controller[_0xf027('0x11')]);router[_0xf027('0x12')]('/',auth[_0xf027('0x8')](),controller[_0xf027('0x13')]);router[_0xf027('0x12')]('/:id/members',auth[_0xf027('0x8')](),controller['addMembers']);router[_0xf027('0x12')](_0xf027('0x10'),auth[_0xf027('0x8')](),controller[_0xf027('0x14')]);router[_0xf027('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xf027('0x16')]);router[_0xf027('0x17')]('/:id',auth[_0xf027('0x8')](),controller[_0xf027('0x18')]);router[_0xf027('0x17')](_0xf027('0xe'),auth[_0xf027('0x8')](),controller[_0xf027('0x19')]);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 c02b8ee..e473370 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 _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 +var _0x83e8=['BOOLEAN','INTEGER','ENUM','thumb','star','TEXT','STRING','DATE','long','out','sequelize'];(function(_0x2992f2,_0xa83eff){var _0x2f9410=function(_0x17da71){while(--_0x17da71){_0x2992f2['push'](_0x2992f2['shift']());}};_0x2f9410(++_0xa83eff);}(_0x83e8,0xa4));var _0x883e=function(_0x3fcf54,_0x2b2553){_0x3fcf54=_0x3fcf54-0x0;var _0x19a093=_0x83e8[_0x3fcf54];return _0x19a093;};'use strict';var Sequelize=require(_0x883e('0x0'));module['exports']={'closed':{'type':Sequelize[_0x883e('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x883e('0x2')]},'ratingType':{'type':Sequelize[_0x883e('0x3')]('star',_0x883e('0x4')),'defaultValue':_0x883e('0x5')},'ratingMessage':{'type':Sequelize[_0x883e('0x6')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x883e('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x883e('0x8')]},'disposition':{'type':Sequelize[_0x883e('0x7')]},'secondDisposition':{'type':Sequelize[_0x883e('0x7')]},'thirdDisposition':{'type':Sequelize[_0x883e('0x7')]},'note':{'type':Sequelize[_0x883e('0x7')]},'browserName':{'type':Sequelize[_0x883e('0x7')]},'browserVersion':{'type':Sequelize[_0x883e('0x7')]},'osName':{'type':Sequelize[_0x883e('0x7')]},'osVersion':{'type':Sequelize[_0x883e('0x7')]},'deviceModel':{'type':Sequelize[_0x883e('0x7')]},'deviceVendor':{'type':Sequelize[_0x883e('0x7')]},'deviceType':{'type':Sequelize[_0x883e('0x7')]},'referer':{'type':Sequelize[_0x883e('0x6')]},'customerIp':{'type':Sequelize[_0x883e('0x7')]},'formData':{'type':Sequelize[_0x883e('0x6')](_0x883e('0x9'))},'read1stAt':{'type':Sequelize[_0x883e('0x8')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x883e('0x3')]('in',_0x883e('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x883e('0x7')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0x883e('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0x883e('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x883e('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index c78d35e..8f702a4 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 _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 +var _0xbdf9=['api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','update','destroy','end','stack','name','send','contact','agent','interaction','account','map','ChatInteraction','type','key','chat','query','user','show','params','model','keys','rawAttributes','filters','attributes','intersection','fields','length','include','merge','find','create','body','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooMetadata','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','vidaooNote','follow','parse','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','customUpdate','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','file','originalname','basename','filename','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','join','root','offline-chat/','download','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','User','ContactId','UserId','agentAlias','%s%d','Visitor','website_alias','System','agent_alias','alias','fullname','agent_fullname','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','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','getMessages','order','sort','pick','ChatInteractionId','where','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','rows','getMyMessages','hasOwnProperty','nolimit','push','findAll','setTags','omit','ids','spread','Tag','color','emit','chatInteractionTags:save','removeTags','unix','toString','server','tmp','files','attachments','transcript-%d-%s.zip','read','Account','get','mkdirSync','Chat','Owner','N.A.','browserName','osName','referer','customerIp','customerPort','tail','createReadStream','firstName','lastName','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','err','unlinkSync','zip-dir','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger'];(function(_0x26b462,_0x4a2fe2){var _0x5050af=function(_0xf22d68){while(--_0xf22d68){_0x26b462['push'](_0x26b462['shift']());}};_0x5050af(++_0x4a2fe2);}(_0xbdf9,0x19f));var _0x9bdf=function(_0x1c4951,_0x2038ee){_0x1c4951=_0x1c4951-0x0;var _0x345e1b=_0xbdf9[_0x1c4951];return _0x345e1b;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x9bdf('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9bdf('0x1'));var path=require(_0x9bdf('0x2'));var ejs=require(_0x9bdf('0x3'));var fs=require('fs');var _=require(_0x9bdf('0x4'));var Redis=require(_0x9bdf('0x5'));var interaction=require(_0x9bdf('0x6'));var qs=require('../../components/parsers/qs');var pdf=require(_0x9bdf('0x7'));var logger=require(_0x9bdf('0x8'))(_0x9bdf('0x9'));var config=require(_0x9bdf('0xa'));var db=require('../../mysqldb')['db'];config[_0x9bdf('0xb')]=_[_0x9bdf('0xc')](config[_0x9bdf('0xb')],{'host':_0x9bdf('0xd'),'port':0x18eb});var socket=require(_0x9bdf('0xe'))(new Redis(config[_0x9bdf('0xb')]));require(_0x9bdf('0xf'))['register'](socket);var jayson=require(_0x9bdf('0x10'));var client=jayson['client']['http']({'port':0x232b});var client9004=jayson[_0x9bdf('0x11')][_0x9bdf('0x12')]({'port':0x232c});function respondWithRpcPromise(_0x51cfc3,_0x5f5a19,_0x39c426,_0x4e75f4){return new BPromise(function(_0x4e9015,_0x229f23){var _0x11cae7=_0x4e75f4||client;return _0x11cae7[_0x9bdf('0x13')](_0x51cfc3,_0x39c426)[_0x9bdf('0x14')](function(_0x43f0c5){logger[_0x9bdf('0x15')](_0x9bdf('0x16'),_0x5f5a19,_0x9bdf('0x17'));logger[_0x9bdf('0x18')](_0x9bdf('0x19'),_0x5f5a19,_0x9bdf('0x17'),JSON[_0x9bdf('0x1a')](_0x43f0c5));if(_0x43f0c5[_0x9bdf('0x1b')]){if(_0x43f0c5[_0x9bdf('0x1b')]['code']===0x1f4){logger[_0x9bdf('0x1b')](_0x9bdf('0x16'),_0x5f5a19,_0x43f0c5[_0x9bdf('0x1b')]['message']);return _0x229f23(_0x43f0c5[_0x9bdf('0x1b')][_0x9bdf('0x1c')]);}logger[_0x9bdf('0x1b')](_0x9bdf('0x16'),_0x5f5a19,_0x43f0c5[_0x9bdf('0x1b')][_0x9bdf('0x1c')]);return _0x4e9015(_0x43f0c5[_0x9bdf('0x1b')][_0x9bdf('0x1c')]);}else{logger[_0x9bdf('0x15')](_0x9bdf('0x16'),_0x5f5a19,_0x9bdf('0x17'));_0x4e9015(_0x43f0c5[_0x9bdf('0x1d')][_0x9bdf('0x1c')]);}})[_0x9bdf('0x1e')](function(_0x219995){logger['error'](_0x9bdf('0x16'),_0x5f5a19,_0x219995);_0x229f23(_0x219995);});});}function respondWithStatusCode(_0x2aabdd,_0x45e96c){_0x45e96c=_0x45e96c||0xcc;return function(_0x119ecb){if(_0x119ecb){return _0x2aabdd[_0x9bdf('0x1f')](_0x45e96c);}return _0x2aabdd[_0x9bdf('0x20')](_0x45e96c)['end']();};}function respondWithResult(_0x1bc90f,_0x54404b){_0x54404b=_0x54404b||0xc8;return function(_0x4e9c14){if(_0x4e9c14){return _0x1bc90f['status'](_0x54404b)['json'](_0x4e9c14);}};}function respondWithFilteredResult(_0x5a61e0,_0x5a4223){return function(_0x7c892e){if(_0x7c892e){var _0x163234=typeof _0x5a4223[_0x9bdf('0x21')]===_0x9bdf('0x22')&&typeof _0x5a4223[_0x9bdf('0x23')]===_0x9bdf('0x22');var _0x4fe6ce=_0x7c892e['count'];var _0x1d4cc7=_0x163234?0x0:_0x5a4223[_0x9bdf('0x21')];var _0x7cdcf8=_0x163234?_0x7c892e[_0x9bdf('0x24')]:_0x5a4223['offset']+_0x5a4223[_0x9bdf('0x23')];var _0x112059;if(_0x7cdcf8>=_0x4fe6ce){_0x7cdcf8=_0x4fe6ce;_0x112059=0xc8;}else{_0x112059=0xce;}_0x5a61e0['status'](_0x112059);return _0x5a61e0[_0x9bdf('0x25')](_0x9bdf('0x26'),_0x1d4cc7+'-'+_0x7cdcf8+'/'+_0x4fe6ce)[_0x9bdf('0x27')](_0x7c892e);}return null;};}function saveUpdates(_0x3a9720){return function(_0x44cbc1){if(_0x44cbc1){return _0x44cbc1[_0x9bdf('0x28')](_0x3a9720)[_0x9bdf('0x14')](function(_0x2cfe86){return _0x2cfe86;});}return null;};}function removeEntity(_0xf4e682){return function(_0x169c97){if(_0x169c97){return _0x169c97[_0x9bdf('0x29')]()[_0x9bdf('0x14')](function(){_0xf4e682[_0x9bdf('0x20')](0xcc)[_0x9bdf('0x2a')]();});}};}function handleEntityNotFound(_0x265af4){return function(_0x574d1b){if(!_0x574d1b){_0x265af4[_0x9bdf('0x1f')](0x194);}return _0x574d1b;};}function handleError(_0x37a149,_0x3ac304){_0x3ac304=_0x3ac304||0x1f4;return function(_0x35efcd){logger[_0x9bdf('0x1b')](_0x35efcd[_0x9bdf('0x2b')]);if(_0x35efcd[_0x9bdf('0x2c')]){delete _0x35efcd[_0x9bdf('0x2c')];}_0x37a149['status'](_0x3ac304)[_0x9bdf('0x2d')](_0x35efcd);};}function getMustacheRender(_0x3dd50a,_0x4deec7){return Mustache['render'](_0x3dd50a,_['merge'](_0x4deec7['body'],{'contact':_0x4deec7[_0x9bdf('0x2e')],'message':_0x4deec7[_0x9bdf('0x1c')],'agent':_0x4deec7[_0x9bdf('0x2f')],'interaction':_0x4deec7[_0x9bdf('0x30')],'account':_0x4deec7[_0x9bdf('0x31')]}))||'';}exports['index']=function(_0xc5438,_0x22077a){var _0x410717={};var _0x45ef94=_[_0x9bdf('0x32')](db[_0x9bdf('0x33')]['rawAttributes'],function(_0x1b5f9f){return{'name':_0x1b5f9f['fieldName'],'type':_0x1b5f9f[_0x9bdf('0x34')][_0x9bdf('0x35')]};});_0x410717=qs['getOptions'](_0x45ef94,_0xc5438);return interaction['findAll'](_0x9bdf('0x36'),_0xc5438[_0x9bdf('0x37')],_0xc5438[_0x9bdf('0x38')],_0x410717,_0x45ef94)['then'](respondWithFilteredResult(_0x22077a,_0x410717))[_0x9bdf('0x1e')](handleError(_0x22077a,null));};exports[_0x9bdf('0x39')]=function(_0xe37965,_0x85bb7d){var _0x1ec632={'raw':![],'where':{'id':_0xe37965[_0x9bdf('0x3a')]['id']}},_0x33fdd5={};_0x33fdd5[_0x9bdf('0x3b')]=_[_0x9bdf('0x3c')](db[_0x9bdf('0x33')][_0x9bdf('0x3d')]);_0x33fdd5['query']=_[_0x9bdf('0x3c')](_0xe37965[_0x9bdf('0x37')]);_0x33fdd5[_0x9bdf('0x3e')]=_['intersection'](_0x33fdd5[_0x9bdf('0x3b')],_0x33fdd5[_0x9bdf('0x37')]);_0x1ec632[_0x9bdf('0x3f')]=_[_0x9bdf('0x40')](_0x33fdd5[_0x9bdf('0x3b')],qs[_0x9bdf('0x41')](_0xe37965[_0x9bdf('0x37')][_0x9bdf('0x41')]));_0x1ec632[_0x9bdf('0x3f')]=_0x1ec632[_0x9bdf('0x3f')][_0x9bdf('0x42')]?_0x1ec632[_0x9bdf('0x3f')]:_0x33fdd5['model'];if(_0xe37965['query']['includeAll']){_0x1ec632[_0x9bdf('0x43')]=[{'all':!![]}];}_0x1ec632=_[_0x9bdf('0x44')]({},_0x1ec632,_0xe37965['options']);return db['ChatInteraction'][_0x9bdf('0x45')](_0x1ec632)['then'](handleEntityNotFound(_0x85bb7d,null))[_0x9bdf('0x14')](respondWithResult(_0x85bb7d,null))[_0x9bdf('0x1e')](handleError(_0x85bb7d,null));};exports[_0x9bdf('0x46')]=function(_0x134c2c,_0x3d3fb7){return db[_0x9bdf('0x33')]['create'](_0x134c2c[_0x9bdf('0x47')],{})[_0x9bdf('0x14')](respondWithResult(_0x3d3fb7,0xc9))[_0x9bdf('0x1e')](handleError(_0x3d3fb7,null));};exports[_0x9bdf('0x28')]=function(_0x58aae0,_0x506030){if(_0x58aae0[_0x9bdf('0x47')]['id']){delete _0x58aae0[_0x9bdf('0x47')]['id'];}return db[_0x9bdf('0x33')]['find']({'where':{'id':_0x58aae0[_0x9bdf('0x3a')]['id']}})[_0x9bdf('0x14')](handleEntityNotFound(_0x506030,null))['then'](saveUpdates(_0x58aae0['body'],null))[_0x9bdf('0x14')](respondWithResult(_0x506030,null))['catch'](handleError(_0x506030,null));};exports[_0x9bdf('0x29')]=function(_0x2b8985,_0x56f6e6){return db[_0x9bdf('0x33')][_0x9bdf('0x45')]({'where':{'id':_0x2b8985[_0x9bdf('0x3a')]['id']}})[_0x9bdf('0x14')](handleEntityNotFound(_0x56f6e6,null))[_0x9bdf('0x14')](removeEntity(_0x56f6e6,null))[_0x9bdf('0x1e')](handleError(_0x56f6e6,null));};exports[_0x9bdf('0x48')]=function(_0x13bcf5,_0x4bbdf4){return db[_0x9bdf('0x33')][_0x9bdf('0x48')]()[_0x9bdf('0x14')](respondWithResult(_0x4bbdf4,null))[_0x9bdf('0x1e')](handleError(_0x4bbdf4,null));};exports[_0x9bdf('0x49')]=function(_0x155f2d,_0x36ec09){var _0x1d3949=_0x155f2d[_0x9bdf('0x3a')]['id'];var _0x45c4ea;var _0x571005;var _0x3e6f60;return db[_0x9bdf('0x33')][_0x9bdf('0x4a')]({'where':{'id':_0x1d3949}})[_0x9bdf('0x14')](function(_0xe419dc){_0x45c4ea=_0xe419dc;return db[_0x9bdf('0x4b')][_0x9bdf('0x4a')]({'where':{'id':_0xe419dc[_0x9bdf('0x4c')]},'attributes':['id',_0x9bdf('0x4d'),_0x9bdf('0x4e'),_0x9bdf('0x4f'),'vidaooNote',_0x9bdf('0x50')],'raw':!![]});})[_0x9bdf('0x14')](function(_0x154ce3){if(_0x154ce3&&_0x154ce3[_0x9bdf('0x4d')]&&_0x154ce3['vidaooEscalation']){_0x571005=_0x154ce3;var _0x457344={'interaction':{'id':_0x1d3949},'agent':{'id':_0x155f2d[_0x9bdf('0x38')]['id'],'name':_0x155f2d[_0x9bdf('0x38')]['name'],'fullname':_0x155f2d['user']['fullname'],'email':_0x155f2d[_0x9bdf('0x38')][_0x9bdf('0x51')]},'contact':_0x155f2d[_0x9bdf('0x47')]['contact'],'account':_0x155f2d[_0x9bdf('0x47')][_0x9bdf('0x31')]};var _0x348e3f={'rejectUnauthorized':![],'method':_0x9bdf('0x52'),'url':_0x9bdf('0x53'),'headers':{'X-APIKEY':_0x154ce3[_0x9bdf('0x4d')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x155f2d['user'][_0x9bdf('0x51')]],'buttons':null,'topic':_0x571005['vidaooTopic'],'note':_[_0x9bdf('0x54')](_0x571005[_0x9bdf('0x55')])?null:getMustacheRender(_0x571005[_0x9bdf('0x55')],_0x457344),'metadata':null},'redirect':_0x9bdf('0x56'),'json':!![]};try{if(!_[_0x9bdf('0x54')](_0x571005[_0x9bdf('0x50')])){var _0x3da218=getMustacheRender(_0x571005[_0x9bdf('0x50')],_0x457344);var _0x45ebf6=JSON[_0x9bdf('0x57')](_0x3da218);_0x348e3f[_0x9bdf('0x47')][_0x9bdf('0x58')]=_0x45ebf6;}}catch(_0x2f2422){throw new db[(_0x9bdf('0x59'))][(_0x9bdf('0x5a'))](_0x9bdf('0x5b'));}return rp(_0x348e3f);}else{throw new db[(_0x9bdf('0x59'))][(_0x9bdf('0x5a'))](_0x9bdf('0x5c'));}})['then'](function(_0x15b46d){_0x3e6f60=_0x15b46d;if(_0x3e6f60['id']){var _0x5016fe={'body':_0x3e6f60[_0x9bdf('0x5d')],'ChatWebsiteId':_0x571005['id'],'ChatInteractionId':_0x45c4ea['id'],'direction':_0x9bdf('0x5e'),'UserId':_0x155f2d['user']['id']};return db[_0x9bdf('0x5f')][_0x9bdf('0x46')](_0x5016fe,{});}else{throw new db[(_0x9bdf('0x59'))][(_0x9bdf('0x5a'))](_0x9bdf('0x60'));}})[_0x9bdf('0x14')](function(){return _0x45c4ea['updateAttributes']({'vidaooSessionId':_0x3e6f60['id']});})[_0x9bdf('0x14')](respondWithResult(_0x36ec09,null))[_0x9bdf('0x1e')](handleError(_0x36ec09,null));};exports[_0x9bdf('0x61')]=function(_0x18ddd0,_0x286e20){if(_0x18ddd0[_0x9bdf('0x47')]['id']){delete _0x18ddd0[_0x9bdf('0x47')]['id'];}return db[_0x9bdf('0x33')]['find']({'where':{'id':_0x18ddd0[_0x9bdf('0x3a')]['id']},'include':[{'model':db[_0x9bdf('0x62')],'as':_0x9bdf('0x63')}]})[_0x9bdf('0x14')](handleEntityNotFound(_0x286e20,null))[_0x9bdf('0x14')](saveUpdates(_0x18ddd0[_0x9bdf('0x47')],null))['then'](respondWithResult(_0x286e20,null))[_0x9bdf('0x1e')](handleError(_0x286e20,null));};exports[_0x9bdf('0x64')]=function(_0x2e4371,_0x1eb52a){if(_0x2e4371['body']['id']){delete _0x2e4371[_0x9bdf('0x47')]['id'];}return db[_0x9bdf('0x33')]['find']({'where':{'id':_0x2e4371[_0x9bdf('0x3a')]['id']}})[_0x9bdf('0x14')](function(_0x11d600){if(!_0x11d600){logger[_0x9bdf('0x1b')](_0x9bdf('0x65'),_0x9bdf('0x64'),0x194,_0x9bdf('0x66'));_0x1eb52a[_0x9bdf('0x1f')](0x194);}else{if(_0x11d600['UserId']){throw new db['Sequelize'][(_0x9bdf('0x5a'))](_0x9bdf('0x67'));}}return _0x11d600;})[_0x9bdf('0x14')](function(_0x214cdf){if(_0x214cdf){return _0x214cdf[_0x9bdf('0x28')]({'closed':_0x2e4371[_0x9bdf('0x47')][_0x9bdf('0x68')],'disposition':_0x2e4371[_0x9bdf('0x47')][_0x9bdf('0x69')]})['then'](function(_0x43b2eb){return _0x43b2eb;});}})[_0x9bdf('0x14')](function(){return respondWithRpcPromise('AbandonInteraction',_0x9bdf('0x64'),_0x2e4371[_0x9bdf('0x47')],client9004);})['then'](respondWithResult(_0x1eb52a,null))[_0x9bdf('0x1e')](handleError(_0x1eb52a,null));};exports['attachmentUpload']=function(_0x3561b1,_0x44826e){_0x3561b1['body'][_0x9bdf('0x2c')]=_0x3561b1[_0x9bdf('0x6a')][_0x9bdf('0x6b')];_0x3561b1[_0x9bdf('0x47')][_0x9bdf('0x6c')]=_0x3561b1[_0x9bdf('0x6a')][_0x9bdf('0x6d')];_0x3561b1[_0x9bdf('0x47')][_0x9bdf('0x34')]=_0x3561b1[_0x9bdf('0x6a')][_0x9bdf('0x6e')];return db[_0x9bdf('0x6f')][_0x9bdf('0x46')](_0x3561b1['body'])[_0x9bdf('0x14')](respondWithResult(_0x44826e,0xc9))[_0x9bdf('0x1e')](handleError(_0x44826e,null));};exports[_0x9bdf('0x70')]=function(_0x62ee3e,_0x4c57f4){return db[_0x9bdf('0x33')]['findOne']({'where':{'id':_0x62ee3e[_0x9bdf('0x3a')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x4c57f4,null))[_0x9bdf('0x14')](function(_0x3753c6){if(_0x3753c6){if(_0x3753c6[_0x9bdf('0x68')]){return _0x4c57f4['status'](0x193)['json']({'status':0x193,'message':_0x9bdf('0x71')});}return db[_0x9bdf('0x6f')][_0x9bdf('0x4a')]({'where':{'id':_0x62ee3e[_0x9bdf('0x37')][_0x9bdf('0x72')]},'raw':!![]})['then'](handleEntityNotFound(_0x4c57f4,null));}})[_0x9bdf('0x14')](function(_0x3bbd7c){if(_0x3bbd7c){var _0x3b5dd8=_0x3bbd7c[_0x9bdf('0x73')]!==null;var _0x3f47fc=path[_0x9bdf('0x74')](config[_0x9bdf('0x75')],'server/files/attachments/');if(_0x3b5dd8){_0x3f47fc=path['join'](_0x3f47fc,_0x9bdf('0x76'));}var _0x5b65cd=path['join'](_0x3f47fc,_0x3bbd7c[_0x9bdf('0x6c')]);return _0x4c57f4[_0x9bdf('0x77')](_0x5b65cd);}})[_0x9bdf('0x1e')](handleError(_0x4c57f4,null));};exports['close']=function(_0x2c39fe,_0x189f43){var _0x20c3f0=null;var _0xee64cf=null;var _0x11b5f2=null;if(_0x2c39fe[_0x9bdf('0x47')]['id']){delete _0x2c39fe[_0x9bdf('0x47')]['id'];}if(_0x2c39fe[_0x9bdf('0x47')][_0x9bdf('0x78')]){_0x11b5f2=path[_0x9bdf('0x74')](config[_0x9bdf('0x75')],_0x9bdf('0x79'),util[_0x9bdf('0x7a')](_0x9bdf('0x7b'),Date[_0x9bdf('0x7c')]()));_0x2c39fe[_0x9bdf('0x47')][_0x9bdf('0x7d')]=_0x11b5f2;}return db['ChatInteraction'][_0x9bdf('0x45')]({'where':{'id':_0x2c39fe[_0x9bdf('0x3a')]['id']},'include':[{'model':db['ChatMessage'],'as':_0x9bdf('0x7e'),'include':[{'model':db[_0x9bdf('0x7f')],'as':_0x9bdf('0x7f')}]}]})['then'](handleEntityNotFound(_0x189f43,null))[_0x9bdf('0x14')](saveUpdates(_0x2c39fe[_0x9bdf('0x47')],null))[_0x9bdf('0x14')](function(_0x5e56c5){if(_0x5e56c5){_0x20c3f0=_0x5e56c5;return db[_0x9bdf('0x4b')][_0x9bdf('0x45')]({'where':{'id':_0x20c3f0[_0x9bdf('0x4c')]}});}})['then'](function(_0x2e1985){if(_0x2e1985){_0xee64cf=_0x2e1985;return db[_0x9bdf('0x62')]['find']({'where':{'id':_0x20c3f0[_0x9bdf('0x80')]}});}})[_0x9bdf('0x14')](function(_0x17a807){if(_0x17a807){if(_0x11b5f2){var _0x3b7511=null;for(var _0x243974=0x1;_0x243974<_0x20c3f0[_0x9bdf('0x7e')][_0x9bdf('0x42')];++_0x243974){_0x3b7511=_0x20c3f0['Messages'][_0x243974];var _0x30c6c3=_0x3b7511[_0x9bdf('0x81')]?util[_0x9bdf('0x7a')]('%s%d',_0xee64cf[_0x9bdf('0x82')],_0x3b7511[_0x9bdf('0x81')]):'System';var _0x3b3170=_0x2c39fe[_0x9bdf('0x47')]['customer']||util[_0x9bdf('0x7a')](_0x9bdf('0x83'),_0x9bdf('0x84'),_0x3b7511['ContactId']);switch(_0xee64cf['agentIdentifier']){case _0x9bdf('0x85'):_0x30c6c3=_0x3b7511[_0x9bdf('0x81')]?util[_0x9bdf('0x7a')]('%s%d',_0xee64cf[_0x9bdf('0x82')],_0x3b7511[_0x9bdf('0x81')]):_0x9bdf('0x86');break;case _0x9bdf('0x87'):_0x30c6c3=_0x3b7511[_0x9bdf('0x81')]?_0x3b7511[_0x9bdf('0x7f')][_0x9bdf('0x88')]||_0x3b7511[_0x9bdf('0x7f')][_0x9bdf('0x89')]:'System';break;case _0x9bdf('0x8a'):_0x30c6c3=_0x3b7511[_0x9bdf('0x81')]?_0x3b7511[_0x9bdf('0x7f')][_0x9bdf('0x89')]:'System';break;default:_0x30c6c3=_0x3b7511[_0x9bdf('0x81')]?util[_0x9bdf('0x7a')](_0x9bdf('0x83'),_0xee64cf[_0x9bdf('0x82')],_0x3b7511[_0x9bdf('0x81')]):_0x9bdf('0x86');}var _0x362395=util[_0x9bdf('0x7a')]('[%s]\x20%s:\x20%s\x0a',moment(_0x3b7511[_0x9bdf('0x8b')])['format'](_0x9bdf('0x8c')),_0x3b7511[_0x9bdf('0x8d')]==='in'?_0x3b3170:_0x30c6c3,_0x3b7511[_0x9bdf('0x47')]);if(!_0x3b7511[_0x9bdf('0x8e')]){fs[_0x9bdf('0x8f')](_0x11b5f2,_0x362395);}}return db[_0x9bdf('0x90')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x9bdf('0x91')],'as':_0x9bdf('0x92'),'raw':!![],'include':[{'model':db[_0x9bdf('0x93')],'as':_0x9bdf('0x93'),'raw':!![]}]}]});}}})[_0x9bdf('0x14')](function(_0x226b2c){if(!_0x226b2c||!_0x226b2c['Smtp']||!_0x2c39fe[_0x9bdf('0x47')])return _0x20c3f0;var _0x380644=_0x226b2c[_0x9bdf('0x94')]();return respondWithRpcPromise('SendMail',_0x9bdf('0x95'),{'account':_0x380644,'message':{'from':util[_0x9bdf('0x7a')](_0x9bdf('0x96'),_0x226b2c[_0x9bdf('0x2c')],_0x226b2c[_0x9bdf('0x51')]||_0x226b2c[_0x9bdf('0x92')][_0x9bdf('0x38')]),'to':_0x2c39fe[_0x9bdf('0x47')][_0x9bdf('0x78')],'subject':_0x9bdf('0x97'),'text':util[_0x9bdf('0x7a')](_0x9bdf('0x98'),_0x2c39fe[_0x9bdf('0x47')][_0x9bdf('0x78')]),'attachments':[{'path':_0x11b5f2}]}})[_0x9bdf('0x14')](function(){return _0x20c3f0;})[_0x9bdf('0x1e')](function(_0x1a4f0f){logger['error'](_0x1a4f0f);});})['then'](respondWithStatusCode(_0x189f43,0xc8))[_0x9bdf('0x1e')](handleError(_0x189f43,null));};exports[_0x9bdf('0x99')]=function(_0x5ba533,_0x2f7c1c){return db[_0x9bdf('0x5f')][_0x9bdf('0x45')]({'where':{'id':_0x5ba533['params']['id']}})[_0x9bdf('0x14')](handleEntityNotFound(_0x2f7c1c,null))[_0x9bdf('0x14')](function(_0x7339d){if(_0x7339d){return _0x7339d[_0x9bdf('0x99')](_0x5ba533[_0x9bdf('0x47')]['ids'],_['omit'](_0x5ba533['body'],['ids','id'])||{});}})[_0x9bdf('0x14')](respondWithResult(_0x2f7c1c,null))['catch'](handleError(_0x2f7c1c,null));};exports[_0x9bdf('0x9a')]=function(_0x315b39,_0x53451b){var _0x2c1a9e={'raw':![],'where':{}};var _0x16e85e={};var _0x14205d={'count':0x0,'rows':[]};return db[_0x9bdf('0x33')]['findOne']({'where':{'id':_0x315b39['params']['id']}})[_0x9bdf('0x14')](handleEntityNotFound(_0x53451b,null))['then'](function(_0x54c75e){if(_0x54c75e){_0x16e85e[_0x9bdf('0x3b')]=_['keys'](db[_0x9bdf('0x5f')][_0x9bdf('0x3d')]);_0x16e85e[_0x9bdf('0x37')]=_[_0x9bdf('0x3c')](_0x315b39[_0x9bdf('0x37')]);_0x16e85e[_0x9bdf('0x3e')]=_[_0x9bdf('0x40')](_0x16e85e['model'],_0x16e85e[_0x9bdf('0x37')]);_0x2c1a9e[_0x9bdf('0x3f')]=_[_0x9bdf('0x40')](_0x16e85e[_0x9bdf('0x3b')],qs[_0x9bdf('0x41')](_0x315b39[_0x9bdf('0x37')][_0x9bdf('0x41')]));_0x2c1a9e[_0x9bdf('0x3f')]=_0x2c1a9e[_0x9bdf('0x3f')][_0x9bdf('0x42')]?_0x2c1a9e[_0x9bdf('0x3f')]:_0x16e85e[_0x9bdf('0x3b')];if(!_0x315b39[_0x9bdf('0x37')]['hasOwnProperty']('nolimit')){_0x2c1a9e[_0x9bdf('0x23')]=qs[_0x9bdf('0x23')](_0x315b39[_0x9bdf('0x37')][_0x9bdf('0x23')]);_0x2c1a9e[_0x9bdf('0x21')]=qs[_0x9bdf('0x21')](_0x315b39[_0x9bdf('0x37')][_0x9bdf('0x21')]);}_0x2c1a9e[_0x9bdf('0x9b')]=qs['sort'](_0x315b39[_0x9bdf('0x37')][_0x9bdf('0x9c')]);_0x2c1a9e['where']=qs[_0x9bdf('0x3e')](_[_0x9bdf('0x9d')](_0x315b39['query'],_0x16e85e[_0x9bdf('0x3e')]));_0x2c1a9e['where'][_0x9bdf('0x9e')]=_0x54c75e['id'];if(_0x315b39[_0x9bdf('0x37')]['filter']){_0x2c1a9e[_0x9bdf('0x9f')]=_[_0x9bdf('0x44')](_0x2c1a9e[_0x9bdf('0x9f')],{'$or':_[_0x9bdf('0x32')](_0x2c1a9e[_0x9bdf('0x3f')],function(_0x1d448f){var _0x4de40d={};_0x4de40d[_0x1d448f]={'$like':'%'+_0x315b39[_0x9bdf('0x37')][_0x9bdf('0xa0')]+'%'};return _0x4de40d;})});}if(_0x315b39[_0x9bdf('0x37')][_0x9bdf('0xa1')]){var _0x19e109=_0x315b39['query'][_0x9bdf('0xa1')][_0x9bdf('0xa2')](',');var _0x4f45be={};_0x4f45be[_0x19e109[0x0]]={'$gte':moment(_0x19e109[0x1])['format'](_0x9bdf('0xa3'))};_0x2c1a9e['where']=_[_0x9bdf('0x44')](_0x2c1a9e[_0x9bdf('0x9f')],_0x4f45be);}_0x2c1a9e=_[_0x9bdf('0x44')]({},_0x2c1a9e,_0x315b39[_0x9bdf('0xa4')]);return db[_0x9bdf('0x5f')][_0x9bdf('0x24')]({'where':_0x2c1a9e['where']})[_0x9bdf('0x14')](function(_0x4352dd){_0x14205d[_0x9bdf('0x24')]=_0x4352dd;if(_0x315b39[_0x9bdf('0x37')][_0x9bdf('0xa5')]){_0x2c1a9e[_0x9bdf('0x43')]=[{'all':!![]}];}return db[_0x9bdf('0x5f')]['findAll'](_0x2c1a9e);})['then'](function(_0x56eb36){_0x14205d[_0x9bdf('0xa6')]=_0x56eb36;return _0x14205d;});}})[_0x9bdf('0x14')](respondWithFilteredResult(_0x53451b,_0x2c1a9e))[_0x9bdf('0x1e')](handleError(_0x53451b,null));};exports[_0x9bdf('0xa7')]=function(_0x139eb6,_0x2d9f74){var _0x12e298={'where':{}},_0x20374f={},_0x26e7b0={'count':0x0,'rows':[]};return db[_0x9bdf('0x33')]['findOne']({'where':{'id':_0x139eb6['params']['id']}})[_0x9bdf('0x14')](handleEntityNotFound(_0x2d9f74,null))[_0x9bdf('0x14')](function(_0x5c65d5){if(_0x5c65d5){_0x20374f[_0x9bdf('0x3b')]=_['keys'](db[_0x9bdf('0x5f')][_0x9bdf('0x3d')]);_0x20374f['query']=_[_0x9bdf('0x3c')](_0x139eb6['query']);_0x20374f['filters']=_[_0x9bdf('0x40')](_0x20374f['model'],_0x20374f[_0x9bdf('0x37')]);_0x12e298['attributes']=_[_0x9bdf('0x40')](_0x20374f[_0x9bdf('0x3b')],qs[_0x9bdf('0x41')](_0x139eb6[_0x9bdf('0x37')]['fields']));_0x12e298[_0x9bdf('0x3f')]=_0x12e298[_0x9bdf('0x3f')][_0x9bdf('0x42')]?_0x12e298[_0x9bdf('0x3f')]:_0x20374f[_0x9bdf('0x3b')];if(!_0x139eb6['query'][_0x9bdf('0xa8')](_0x9bdf('0xa9'))){_0x12e298[_0x9bdf('0x23')]=qs[_0x9bdf('0x23')](_0x139eb6[_0x9bdf('0x37')][_0x9bdf('0x23')]);_0x12e298[_0x9bdf('0x21')]=qs[_0x9bdf('0x21')](_0x139eb6[_0x9bdf('0x37')][_0x9bdf('0x21')]);}_0x12e298[_0x9bdf('0x9b')]=qs[_0x9bdf('0x9c')](_0x139eb6['query'][_0x9bdf('0x9c')]);_0x12e298['where']=qs[_0x9bdf('0x3e')](_[_0x9bdf('0x9d')](_0x139eb6[_0x9bdf('0x37')],_0x20374f[_0x9bdf('0x3e')]));_0x12e298[_0x9bdf('0x9f')][_0x9bdf('0x9e')]=_0x5c65d5['id'];if(_0x139eb6[_0x9bdf('0x37')][_0x9bdf('0xa0')]){_0x12e298['where']=_[_0x9bdf('0x44')](_0x12e298[_0x9bdf('0x9f')],{'$or':_[_0x9bdf('0x32')](_0x12e298[_0x9bdf('0x3f')],function(_0x4d2c51){var _0x13959c={};_0x13959c[_0x4d2c51]={'$like':'%'+_0x139eb6['query'][_0x9bdf('0xa0')]+'%'};return _0x13959c;})});}_0x12e298[_0x9bdf('0x9f')][_0x9bdf('0x8e')]=![];if(_0x139eb6['query']['id']){_0x12e298[_0x9bdf('0x9f')]['id']={'$gt':_0x139eb6[_0x9bdf('0x37')]['id']};}_0x12e298=_['merge']({},_0x12e298,_0x139eb6[_0x9bdf('0xa4')]);return db['ChatMessage']['count']({'where':_0x12e298[_0x9bdf('0x9f')]})[_0x9bdf('0x14')](function(_0x311fd8){_0x26e7b0[_0x9bdf('0x24')]=_0x311fd8;_0x12e298[_0x9bdf('0x43')]=[];if(_0x139eb6[_0x9bdf('0x37')]['includeAgent']){_0x12e298[_0x9bdf('0x43')][_0x9bdf('0xaa')]({'model':db[_0x9bdf('0x7f')],'as':_0x9bdf('0x7f'),'attributes':['id','fullname','alias']});}if(_0x139eb6[_0x9bdf('0x37')][_0x9bdf('0xa5')]){_0x12e298[_0x9bdf('0x43')]=[{'all':!![]}];}return db[_0x9bdf('0x5f')][_0x9bdf('0xab')](_0x12e298);})[_0x9bdf('0x14')](function(_0x39992c){_0x26e7b0['rows']=_0x39992c;return _0x26e7b0;});}})[_0x9bdf('0x14')](respondWithFilteredResult(_0x2d9f74,_0x12e298))[_0x9bdf('0x1e')](handleError(_0x2d9f74,null));};exports['addTags']=function(_0x347290,_0x234268){return db[_0x9bdf('0x33')][_0x9bdf('0x45')]({'where':{'id':_0x347290[_0x9bdf('0x3a')]['id']}})['then'](handleEntityNotFound(_0x234268,null))['then'](function(_0x3dbeb8){if(_0x3dbeb8){return _0x3dbeb8[_0x9bdf('0xac')](_0x347290[_0x9bdf('0x47')]['ids'],_[_0x9bdf('0xad')](_0x347290['body'],[_0x9bdf('0xae'),'id'])||{})[_0x9bdf('0xaf')](function(){return db[_0x9bdf('0xb0')][_0x9bdf('0xab')]({'attributes':['id','name',_0x9bdf('0xb1')],'where':{'id':_0x347290[_0x9bdf('0x47')][_0x9bdf('0xae')]}});})['then'](function(_0x2d9af8){socket[_0x9bdf('0xb2')](_0x9bdf('0xb3'),{'id':Number(_0x347290[_0x9bdf('0x3a')]['id']),'tags':_0x2d9af8||[]});return{'id':Number(_0x347290[_0x9bdf('0x3a')]['id']),'tags':_0x2d9af8||[]};});}})['then'](respondWithResult(_0x234268,null))[_0x9bdf('0x1e')](handleError(_0x234268,null));};exports[_0x9bdf('0xb4')]=function(_0x1117fe,_0x2adcc4){return db[_0x9bdf('0x33')][_0x9bdf('0x45')]({'where':{'id':_0x1117fe[_0x9bdf('0x3a')]['id']}})[_0x9bdf('0x14')](handleEntityNotFound(_0x2adcc4,null))['then'](function(_0xdfaba2){if(_0xdfaba2){return _0xdfaba2['removeTags'](_0x1117fe[_0x9bdf('0x37')][_0x9bdf('0xae')]);}})[_0x9bdf('0x14')](respondWithStatusCode(_0x2adcc4,null))['catch'](handleError(_0x2adcc4,null));};exports['download']=function(_0xee22a7,_0x473cec){var _0x117eed=moment()[_0x9bdf('0xb5')]()[_0x9bdf('0xb6')]();var _0x44806d=path[_0x9bdf('0x74')](config[_0x9bdf('0x75')],_0x9bdf('0xb7'),'files',_0x9bdf('0xb8'));var _0x1f5a06=path[_0x9bdf('0x74')](config['root'],_0x9bdf('0xb7'),_0x9bdf('0xb9'),_0x9bdf('0xba'));var _0x5a228e=path['join'](_0x44806d,_0x117eed);var _0x451adb=util[_0x9bdf('0x7a')](_0x9bdf('0xbb'),_0xee22a7[_0x9bdf('0x3a')]['id'],_0x117eed);var _0x4a0239=path[_0x9bdf('0x74')](_0x44806d,_0x451adb);var _0x14b0d0=[];_0x14b0d0[_0x9bdf('0xaa')]({'model':db[_0x9bdf('0x7f')],'as':'User','attributes':['id',_0x9bdf('0x89')],'raw':!![]});_0x14b0d0[_0x9bdf('0xaa')]({'model':db['CmContact'],'as':'Contact','attributes':['id','firstName','lastName'],'raw':!![]});if(_0xee22a7[_0x9bdf('0x37')][_0x9bdf('0xba')]){_0x14b0d0['push']({'model':db['Attachment'],'as':_0x9bdf('0x6f'),'raw':!![]});}var _0xceff64=[{'model':db[_0x9bdf('0x5f')],'as':_0x9bdf('0x7e'),'attributes':['id',_0x9bdf('0x47'),_0x9bdf('0x8b'),_0x9bdf('0x8d'),'secret',_0x9bdf('0xbc')],'include':_0x14b0d0}];_0xceff64[_0x9bdf('0xaa')]({'model':db[_0x9bdf('0x4b')],'as':_0x9bdf('0xbd'),'attributes':['id',_0x9bdf('0x2c')]});_0xceff64[_0x9bdf('0xaa')]({'model':db[_0x9bdf('0x7f')],'as':'Owner','attributes':['id','fullname']});return db[_0x9bdf('0x33')][_0x9bdf('0x45')]({'where':{'id':_0xee22a7[_0x9bdf('0x3a')]['id']},'include':_0xceff64})['then'](handleEntityNotFound(_0x473cec,null))[_0x9bdf('0x14')](function(_0x29f236){if(_0x29f236){var _0x293a89=_0x29f236[_0x9bdf('0xbe')]({'plain':!![]});fs[_0x9bdf('0xbf')](_0x5a228e);var _0x1feb03={'channel':_0x9bdf('0xc0'),'account':_0x293a89[_0x9bdf('0xbd')][_0x9bdf('0x2c')],'agent':_0x293a89[_0x9bdf('0xc1')]?_0x293a89[_0x9bdf('0xc1')][_0x9bdf('0x89')]:_0x9bdf('0xc2'),'createdAt':moment(_0x293a89[_0x9bdf('0x8b')])[_0x9bdf('0x7a')](_0x9bdf('0xa3'))[_0x9bdf('0xb6')](),'closedAt':_0x293a89[_0x9bdf('0x68')]?moment(_0x293a89['closedAt'])[_0x9bdf('0x7a')](_0x9bdf('0xa3'))[_0x9bdf('0xb6')]():'','disposition':_0x293a89[_0x9bdf('0x69')],'chatInfo':{'browser':_0x293a89[_0x9bdf('0xc3')],'os':_0x293a89[_0x9bdf('0xc4')],'referer':_0x293a89[_0x9bdf('0xc5')],'customerIp':_0x293a89[_0x9bdf('0xc6')],'customerPort':_0x293a89[_0x9bdf('0xc7')]?_0x293a89[_0x9bdf('0xc7')]:_0x9bdf('0xc2')},'messages':_(_0x293a89[_0x9bdf('0x7e')])[_0x9bdf('0xc8')]()['filter']({'secret':![]})[_0x9bdf('0x32')](function(_0x14c865){if(_0x14c865[_0x9bdf('0x6f')]){var _0x5a0715=path['join'](_0x1f5a06,_0x14c865['Attachment'][_0x9bdf('0x6c')]);if(fs['existsSync'](_0x5a0715)){fs[_0x9bdf('0xc9')](_0x5a0715)['pipe'](fs['createWriteStream'](path[_0x9bdf('0x74')](_0x5a228e,_0x14c865[_0x9bdf('0x6f')][_0x9bdf('0x6c')])));}}return{'date':moment(_0x14c865['createdAt'])[_0x9bdf('0x7a')](_0x9bdf('0xa3'))[_0x9bdf('0xb6')](),'sender':_0x14c865[_0x9bdf('0x8d')]===_0x9bdf('0x5e')?_0x14c865[_0x9bdf('0x7f')]?_0x14c865['User'][_0x9bdf('0x89')]:_0x9bdf('0x86'):_0x14c865['Contact'][_0x9bdf('0xca')]+(_0x14c865[_0x9bdf('0x63')]['lastName']?'\x20'+_0x14c865['Contact'][_0x9bdf('0xcb')]:''),'body':_0x14c865[_0x9bdf('0x6f')]?_0x14c865[_0x9bdf('0x6f')][_0x9bdf('0x6c')]:_0x14c865[_0x9bdf('0x47')],'direction':_0x14c865[_0x9bdf('0x8d')]==='out'?'A':'C','secret':_0x14c865['secret'],'read':_0x14c865[_0x9bdf('0xbc')],'attachment':_0x14c865['Attachment']};})[_0x9bdf('0xcc')]()};return ejs[_0x9bdf('0xcd')](path['join'](config['root'],_0x9bdf('0xb7'),_0x9bdf('0xce'),_0x9bdf('0xcf')),{'interaction':_0x1feb03})[_0x9bdf('0x14')](function(_0x139ee5){var _0x246ac2=path[_0x9bdf('0x74')](_0x5a228e,_0x9bdf('0xd0')+_0x293a89['id']+'-'+_0x117eed+_0x9bdf('0xd1'));var _0x2ef079={'path':_0x246ac2,'channel':'Chat','interactionId':_0x293a89['id']};return pdf['createPdfFromHTML'](_0x139ee5,_0x2ef079);})[_0x9bdf('0x14')](function(){return new Promise(function(_0x3a395b,_0x3c8254){zipdir(_0x5a228e,{'saveTo':_0x4a0239},function(_0x138635,_0x5bda06){if(_0x138635)return _0x3c8254(_0x138635);return _0x3a395b(_0x5bda06);});})[_0x9bdf('0x14')](function(){return new BPromise(function(_0x317dd5,_0x4e7f2b){rimraf(_0x5a228e,function(_0x456286){if(_0x456286)_0x4e7f2b(_0x456286);return _0x317dd5();});});})[_0x9bdf('0x14')](function(){return _0x473cec[_0x9bdf('0x77')](_0x4a0239,_0x451adb,function(_0x147419){if(_0x147419){logger[_0x9bdf('0x1b')](_0x9bdf('0xd2'),_0x147419);}else{fs[_0x9bdf('0xd3')](_0x4a0239);}});});});}else{return _0x473cec['sendStatus'](0xc8);}})[_0x9bdf('0x1e')](handleError(_0x473cec,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 856877b..59669f7 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 _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 +var _0x4e56=['hook','exports','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','catch','hasOwnProperty'];(function(_0x1e25db,_0x383fb4){var _0x3232b1=function(_0x31f684){while(--_0x31f684){_0x1e25db['push'](_0x1e25db['shift']());}};_0x3232b1(++_0x383fb4);}(_0x4e56,0x80));var _0x64e5=function(_0x20bbe5,_0x189723){_0x20bbe5=_0x20bbe5-0x0;var _0x1d94c7=_0x4e56[_0x20bbe5];return _0x1d94c7;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0x64e5('0x0'))['db'][_0x64e5('0x1')];var ChatMessage=require(_0x64e5('0x0'))['db'][_0x64e5('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x64e5('0x3')](0x0);var events={'afterCreate':_0x64e5('0x4'),'afterUpdate':_0x64e5('0x5'),'afterDestroy':_0x64e5('0x6')};function emitEvent(_0x4a0ebb){return function(_0x4a6e2f,_0x261d1e,_0x2e25d0){_0x4a6e2f[_0x64e5('0x7')]({'attributes':['id'],'raw':!![]})[_0x64e5('0x8')](function(_0x5ed784){_0x4a6e2f[_0x64e5('0x9')](_0x64e5('0xa'),_0x5ed784[_0x64e5('0xb')](function(_0x29c221){return{'id':_0x29c221['id']};}));return ChatMessage[_0x64e5('0xc')]({'where':{'ChatInteractionId':_0x4a6e2f['id'],'direction':'in','read':![]},'raw':!![]});})[_0x64e5('0x8')](function(_0x19922d){_0x4a6e2f[_0x64e5('0x9')](_0x64e5('0xd'),_0x19922d['length']);ChatInteractionEvents['emit'](_0x4a0ebb+':'+_0x4a6e2f['id'],_0x4a6e2f);ChatInteractionEvents['emit'](_0x4a0ebb,_0x4a6e2f);_0x2e25d0(null);})[_0x64e5('0xe')](_0x2e25d0(null));};}for(var e in events){if(events[_0x64e5('0xf')](e)){var event=events[e];ChatInteraction[_0x64e5('0x10')](e,emitEvent(event));}}module[_0x64e5('0x11')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 98a6d2f..43e5caa 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 _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 +var _0x4256=['rimraf','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x1897f3,_0x444b8e){var _0x48055c=function(_0x59a60b){while(--_0x59a60b){_0x1897f3['push'](_0x1897f3['shift']());}};_0x48055c(++_0x444b8e);}(_0x4256,0x11e));var _0x6425=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x4256[_0x45d55e];return _0x29812a;};'use strict';var _=require(_0x6425('0x0'));var util=require(_0x6425('0x1'));var logger=require(_0x6425('0x2'))(_0x6425('0x3'));var moment=require(_0x6425('0x4'));var BPromise=require(_0x6425('0x5'));var rp=require(_0x6425('0x6'));var fs=require('fs');var path=require(_0x6425('0x7'));var rimraf=require(_0x6425('0x8'));var config=require('../../config/environment');var attributes=require(_0x6425('0x9'));module[_0x6425('0xa')]=function(_0x451019,_0x4cab1a){return _0x451019[_0x6425('0xb')](_0x6425('0xc'),attributes,{'tableName':_0x6425('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x390997,_0x24fdc5,_0x55202f){if(_0x390997[_0x6425('0xe')](_0x6425('0xf'))){_0x390997[_0x6425('0x10')]=moment()[_0x6425('0x11')](_0x6425('0x12'));}_0x55202f(null,_0x390997);}},'charset':_0x6425('0x13'),'collate':_0x6425('0x14')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 3d5a8cf..09d22d7 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 _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 +var _0x3891=['error','code','message','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','limit','debug','AddTagsToChatInteraction','find','where','addTags','ids','omit','spread','AddTags','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','./chatInteraction.socket','register','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x3891,0x125));var _0x1389=function(_0xd0a847,_0x72562b){_0xd0a847=_0xd0a847-0x0;var _0x2536ec=_0x3891[_0xd0a847];return _0x2536ec;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1389('0x0'));var BPromise=require(_0x1389('0x1'));var rs=require(_0x1389('0x2'));var fs=require('fs');var Redis=require(_0x1389('0x3'));var db=require(_0x1389('0x4'))['db'];var utils=require(_0x1389('0x5'));var logger=require(_0x1389('0x6'))(_0x1389('0x7'));var config=require('../../config/environment');var jayson=require(_0x1389('0x8'));var client=jayson[_0x1389('0x9')][_0x1389('0xa')]({'port':0x232a});config[_0x1389('0xb')]=_['defaults'](config[_0x1389('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1389('0xb')]));require(_0x1389('0xc'))[_0x1389('0xd')](socket);function respondWithRpcPromise(_0x32c194,_0x9554db,_0x482433){return new BPromise(function(_0x15ecce,_0x57589f){return client['request'](_0x32c194,_0x482433)[_0x1389('0xe')](function(_0x18c8b8){logger[_0x1389('0xf')](_0x1389('0x10'),_0x9554db,_0x1389('0x11'));logger['debug']('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x9554db,'request\x20sent',JSON[_0x1389('0x12')](_0x18c8b8));if(_0x18c8b8[_0x1389('0x13')]){if(_0x18c8b8[_0x1389('0x13')][_0x1389('0x14')]===0x1f4){logger[_0x1389('0x13')](_0x1389('0x10'),_0x9554db,_0x18c8b8[_0x1389('0x13')][_0x1389('0x15')]);return _0x57589f(_0x18c8b8['error'][_0x1389('0x15')]);}logger[_0x1389('0x13')]('ChatInteraction,\x20%s,\x20%s',_0x9554db,_0x18c8b8[_0x1389('0x13')]['message']);return _0x15ecce(_0x18c8b8[_0x1389('0x13')]['message']);}else{logger[_0x1389('0xf')](_0x1389('0x10'),_0x9554db,_0x1389('0x11'));_0x15ecce(_0x18c8b8['result']['message']);}})[_0x1389('0x16')](function(_0x14c3aa){logger[_0x1389('0x13')](_0x1389('0x10'),_0x9554db,_0x14c3aa);_0x57589f(_0x14c3aa);});});}exports[_0x1389('0x17')]=function(_0x4be21a){var _0xc70925=this;return new Promise(function(_0x520230,_0x56782b){return db[_0x1389('0x18')][_0x1389('0x19')](_0x4be21a[_0x1389('0x1a')],{'raw':_0x4be21a[_0x1389('0x1b')]?_0x4be21a[_0x1389('0x1b')][_0x1389('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4be21a[_0x1389('0x1b')]?_0x4be21a[_0x1389('0x1b')]['where']||null:null,'attributes':_0x4be21a['options']?_0x4be21a[_0x1389('0x1b')]['attributes']||null:null,'limit':_0x4be21a[_0x1389('0x1b')]?_0x4be21a[_0x1389('0x1b')][_0x1389('0x1d')]||null:null})[_0x1389('0xe')](function(_0x947e1d){logger[_0x1389('0xf')](_0x1389('0x17'),_0x4be21a);logger[_0x1389('0x1e')](_0x1389('0x17'),_0x4be21a,JSON[_0x1389('0x12')](_0x947e1d));_0x520230(_0x947e1d);})['catch'](function(_0x5d1151){logger[_0x1389('0x13')](_0x1389('0x17'),_0x5d1151[_0x1389('0x15')],_0x4be21a);_0x56782b(_0xc70925[_0x1389('0x13')](0x1f4,_0x5d1151[_0x1389('0x15')]));});});};exports[_0x1389('0x1f')]=function(_0x50a313){return new Promise(function(_0x492d15,_0x412229){return db[_0x1389('0x18')][_0x1389('0x20')]({'where':_0x50a313[_0x1389('0x1b')]?_0x50a313[_0x1389('0x1b')][_0x1389('0x21')]||null:null})[_0x1389('0xe')](function(_0x301317){if(_0x301317){return _0x301317[_0x1389('0x22')](_0x50a313[_0x1389('0x1a')][_0x1389('0x23')],_[_0x1389('0x24')](_0x50a313['body'],[_0x1389('0x23'),'id'])||{});}})[_0x1389('0x25')](function(_0x31a56f){logger[_0x1389('0xf')](_0x1389('0x26'),_0x50a313);logger[_0x1389('0x1e')]('AddTags',_0x50a313,JSON[_0x1389('0x12')](_0x31a56f));_0x492d15(_0x31a56f);})[_0x1389('0x16')](function(_0x113c4f){logger[_0x1389('0x13')](_0x1389('0x26'),_0x113c4f[_0x1389('0x15')],_0x50a313);_0x412229(_this[_0x1389('0x13')](0x1f4,_0x113c4f[_0x1389('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index c2c0d26..d8d05a1 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 _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 +var _0x3279=['save','remove','update','emit','removeListener','register','chatInteraction:','./chatInteraction.events'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x3279,0xc7));var _0x9327=function(_0x26a2fa,_0x50975e){_0x26a2fa=_0x26a2fa-0x0;var _0xcf48e3=_0x3279[_0x26a2fa];return _0xcf48e3;};'use strict';var ChatInteractionEvents=require(_0x9327('0x0'));var events=[_0x9327('0x1'),_0x9327('0x2'),_0x9327('0x3')];function createListener(_0x305a93,_0x58630a){return function(_0x4abf7b){_0x58630a[_0x9327('0x4')](_0x305a93,_0x4abf7b);};}function removeListener(_0x173b7d,_0x8f2bf5){return function(){ChatInteractionEvents[_0x9327('0x5')](_0x173b7d,_0x8f2bf5);};}exports[_0x9327('0x6')]=function(_0x2d0197){for(var _0x35cf99=0x0,_0x110ed8=events['length'];_0x35cf99<_0x110ed8;_0x35cf99++){var _0x1e3410=events[_0x35cf99];var _0x337059=createListener(_0x9327('0x7')+_0x1e3410,_0x2d0197);ChatInteractionEvents['on'](_0x1e3410,_0x337059);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 4205aaf..85bac88 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 _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 +var _0x3b9e=['format','%s-%s','now','originalname','replace','single','file','/:id/messages','addMessage','chat','chatinteraction:addtags','put','tracked','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','close','delete','/:id/tags','removeTags','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','isChatInteractionAuthorized','show','attachmentDownload','getMessages','/:id/my_messages','getMyMessages','download','post','/:id/vidaoo','createVidaooSession','join','root','server/files/attachments/'];(function(_0x568e98,_0x51de44){var _0x5edef0=function(_0x547901){while(--_0x547901){_0x568e98['push'](_0x568e98['shift']());}};_0x5edef0(++_0x51de44);}(_0x3b9e,0x1d8));var _0xe3b9=function(_0x399581,_0x222785){_0x399581=_0x399581-0x0;var _0x4d1834=_0x3b9e[_0x399581];return _0x4d1834;};'use strict';var multer=require(_0xe3b9('0x0'));var util=require(_0xe3b9('0x1'));var path=require(_0xe3b9('0x2'));var timeout=require(_0xe3b9('0x3'));var express=require(_0xe3b9('0x4'));var router=express[_0xe3b9('0x5')]();var fs_extra=require(_0xe3b9('0x6'));var auth=require(_0xe3b9('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xe3b9('0x8'));var controller=require('./chatInteraction.controller');router[_0xe3b9('0x9')]('/',auth[_0xe3b9('0xa')](),controller[_0xe3b9('0xb')]);router[_0xe3b9('0x9')](_0xe3b9('0xc'),auth[_0xe3b9('0xa')](),controller[_0xe3b9('0xd')]);router['get'](_0xe3b9('0xe'),auth[_0xe3b9('0xf')](),controller[_0xe3b9('0x10')]);router[_0xe3b9('0x9')]('/:id/attachment_download',auth['isChatInteractionAuthorized'](),controller[_0xe3b9('0x11')]);router['get']('/:id/messages',auth[_0xe3b9('0xa')](),controller[_0xe3b9('0x12')]);router[_0xe3b9('0x9')](_0xe3b9('0x13'),auth['isChatInteractionAuthorized'](),controller[_0xe3b9('0x14')]);router['get']('/:id/download',auth[_0xe3b9('0xa')](),controller[_0xe3b9('0x15')]);router[_0xe3b9('0x16')]('/',auth[_0xe3b9('0xa')](),controller['create']);router[_0xe3b9('0x16')](_0xe3b9('0x17'),auth[_0xe3b9('0xa')](),controller[_0xe3b9('0x18')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x185b4b,_0x1d5446,_0x1ded97){_0x1ded97(null,path[_0xe3b9('0x19')](config[_0xe3b9('0x1a')],_0xe3b9('0x1b')));},'filename':function(_0x51355b,_0x24f9df,_0x297bf1){_0x297bf1(null,util[_0xe3b9('0x1c')](_0xe3b9('0x1d'),Date[_0xe3b9('0x1e')](),_0x24f9df[_0xe3b9('0x1f')][_0xe3b9('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe3b9('0x16')]('/:id/attachment_upload',upload[_0xe3b9('0x21')](_0xe3b9('0x22')),controller['attachmentUpload']);router[_0xe3b9('0x16')](_0xe3b9('0x23'),auth['isChatInteractionAuthorized'](),controller[_0xe3b9('0x24')]);router[_0xe3b9('0x16')]('/:id/tags',auth[_0xe3b9('0xa')](),interaction['tracked'](_0xe3b9('0x25'),_0xe3b9('0x26')),controller['addTags']);router[_0xe3b9('0x27')]('/:id',auth[_0xe3b9('0xa')](),interaction[_0xe3b9('0x28')]('chat','chatinteraction:update'),controller[_0xe3b9('0x29')]);router[_0xe3b9('0x27')](_0xe3b9('0x2a'),controller[_0xe3b9('0x2b')]);router[_0xe3b9('0x27')](_0xe3b9('0x2c'),auth[_0xe3b9('0xf')](),controller[_0xe3b9('0x2d')]);router[_0xe3b9('0x27')]('/:id/close',controller[_0xe3b9('0x2e')]);router['delete'](_0xe3b9('0xe'),auth[_0xe3b9('0xa')](),interaction[_0xe3b9('0x28')]('chat','chatinteraction:destroy'),controller['destroy']);router[_0xe3b9('0x2f')](_0xe3b9('0x30'),auth[_0xe3b9('0xa')](),controller[_0xe3b9('0x31')]);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 39e37e6..7ed6819 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 _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 +var _0x8f3a=['exports','TEXT','BOOLEAN','INTEGER','sequelize'];(function(_0x449fa2,_0x57cf0b){var _0xb3a2c2=function(_0x1ec935){while(--_0x1ec935){_0x449fa2['push'](_0x449fa2['shift']());}};_0xb3a2c2(++_0x57cf0b);}(_0x8f3a,0x135));var _0xa8f3=function(_0x9a8ac2,_0xf90856){_0x9a8ac2=_0x9a8ac2-0x0;var _0x100999=_0x8f3a[_0x9a8ac2];return _0x100999;};'use strict';var Sequelize=require(_0xa8f3('0x0'));module[_0xa8f3('0x1')]={'body':{'type':Sequelize[_0xa8f3('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xa8f3('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xa8f3('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 8e65d38..2aaae21 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 _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 +var _0x44ce=['name','send','index','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','map','type','VIRTUAL','filter','options','ChatInternalMessage','findAll','rows','catch','show','params','merge','find','create','body','describe','format','YYYY-MM-DD\x20HH:mm:ss','lastMessage','admin','fullname','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','VoiceQueue','VoiceQueues','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Agents','autoAssociation','UserProfileResource','isEmpty','agent','push','messages','createdAt','ToId','-createdAt','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','stack'];(function(_0x4ef10c,_0x4c61fc){var _0x3292c9=function(_0x40623d){while(--_0x40623d){_0x4ef10c['push'](_0x4ef10c['shift']());}};_0x3292c9(++_0x4c61fc);}(_0x44ce,0xaa));var _0xe44c=function(_0x5d9f73,_0x2bec46){_0x5d9f73=_0x5d9f73-0x0;var _0x3d3d20=_0x44ce[_0x5d9f73];return _0x3d3d20;};'use strict';var emlformat=require(_0xe44c('0x0'));var rimraf=require(_0xe44c('0x1'));var zipdir=require(_0xe44c('0x2'));var jsonpatch=require(_0xe44c('0x3'));var rp=require(_0xe44c('0x4'));var moment=require('moment');var BPromise=require(_0xe44c('0x5'));var Mustache=require(_0xe44c('0x6'));var util=require('util');var path=require(_0xe44c('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe44c('0x8'));var fs=require('fs');var fs_extra=require(_0xe44c('0x9'));var _=require(_0xe44c('0xa'));var squel=require(_0xe44c('0xb'));var crypto=require(_0xe44c('0xc'));var jsforce=require(_0xe44c('0xd'));var deskjs=require(_0xe44c('0xe'));var toCsv=require(_0xe44c('0xf'));var querystring=require('querystring');var Papa=require(_0xe44c('0x10'));var Redis=require(_0xe44c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe44c('0x12'));var as=require(_0xe44c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe44c('0x14'))(_0xe44c('0x15'));var utils=require(_0xe44c('0x16'));var config=require(_0xe44c('0x17'));var licenseUtil=require(_0xe44c('0x18'));var db=require('../../mysqldb')['db'];config[_0xe44c('0x19')]=_[_0xe44c('0x1a')](config[_0xe44c('0x19')],{'host':_0xe44c('0x1b'),'port':0x18eb});var socket=require(_0xe44c('0x1c'))(new Redis(config[_0xe44c('0x19')]));require('./chatInternalMessage.socket')[_0xe44c('0x1d')](socket);function respondWithStatusCode(_0x3768a8,_0x287fba){_0x287fba=_0x287fba||0xcc;return function(_0x557b11){if(_0x557b11){return _0x3768a8['sendStatus'](_0x287fba);}return _0x3768a8[_0xe44c('0x1e')](_0x287fba)[_0xe44c('0x1f')]();};}function respondWithResult(_0xb8a694,_0x163f81){_0x163f81=_0x163f81||0xc8;return function(_0x36d155){if(_0x36d155){return _0xb8a694[_0xe44c('0x1e')](_0x163f81)['json'](_0x36d155);}};}function respondWithFilteredResult(_0x2cc5f4,_0x28b531){return function(_0x15346d){if(_0x15346d){var _0x4a9e19=typeof _0x28b531[_0xe44c('0x20')]===_0xe44c('0x21')&&typeof _0x28b531[_0xe44c('0x22')]===_0xe44c('0x21');var _0x48cddc=_0x15346d[_0xe44c('0x23')];var _0x335f10=_0x4a9e19?0x0:_0x28b531[_0xe44c('0x20')];var _0x5ebf11=_0x4a9e19?_0x15346d['count']:_0x28b531['offset']+_0x28b531[_0xe44c('0x22')];var _0x37a9c8;if(_0x5ebf11>=_0x48cddc){_0x5ebf11=_0x48cddc;_0x37a9c8=0xc8;}else{_0x37a9c8=0xce;}_0x2cc5f4[_0xe44c('0x1e')](_0x37a9c8);return _0x2cc5f4['set'](_0xe44c('0x24'),_0x335f10+'-'+_0x5ebf11+'/'+_0x48cddc)[_0xe44c('0x25')](_0x15346d);}return null;};}function patchUpdates(_0x316ff7){return function(_0x3e917f){try{jsonpatch[_0xe44c('0x26')](_0x3e917f,_0x316ff7,!![]);}catch(_0x4dbfc4){return BPromise[_0xe44c('0x27')](_0x4dbfc4);}return _0x3e917f[_0xe44c('0x28')]();};}function saveUpdates(_0x4f770a,_0x50f615){return function(_0x11d6d8){if(_0x11d6d8){return _0x11d6d8[_0xe44c('0x29')](_0x4f770a)[_0xe44c('0x2a')](function(_0x491128){return _0x491128;});}return null;};}function removeEntity(_0x59fe9c,_0x3ba5b2){return function(_0xa5653b){if(_0xa5653b){return _0xa5653b[_0xe44c('0x2b')]()[_0xe44c('0x2a')](function(){_0x59fe9c[_0xe44c('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e5038,_0x320ed1){return function(_0x1baded){if(!_0x1baded){_0x3e5038[_0xe44c('0x2c')](0x194);}return _0x1baded;};}function handleError(_0x10b151,_0xab46d){_0xab46d=_0xab46d||0x1f4;return function(_0x349589){logger['error'](_0x349589[_0xe44c('0x2d')]);if(_0x349589[_0xe44c('0x2e')]){delete _0x349589[_0xe44c('0x2e')];}_0x10b151[_0xe44c('0x1e')](_0xab46d)[_0xe44c('0x2f')](_0x349589);};}exports[_0xe44c('0x30')]=function(_0x2c1c0d,_0x35f55f){var _0x50af7a={},_0x1b7dd0={},_0x1cd28a={'count':0x0,'rows':[]};var _0x348396=_['map'](db['ChatInternalMessage'][_0xe44c('0x31')],function(_0x3a6352){return{'name':_0x3a6352['fieldName'],'type':_0x3a6352['type'][_0xe44c('0x32')]};});_0x1b7dd0['model']=_['map'](_0x348396,_0xe44c('0x2e'));_0x1b7dd0[_0xe44c('0x33')]=_[_0xe44c('0x34')](_0x2c1c0d[_0xe44c('0x33')]);_0x1b7dd0[_0xe44c('0x35')]=_[_0xe44c('0x36')](_0x1b7dd0[_0xe44c('0x37')],_0x1b7dd0[_0xe44c('0x33')]);_0x50af7a[_0xe44c('0x38')]=_[_0xe44c('0x36')](_0x1b7dd0[_0xe44c('0x37')],qs[_0xe44c('0x39')](_0x2c1c0d[_0xe44c('0x33')]['fields']));_0x50af7a[_0xe44c('0x38')]=_0x50af7a[_0xe44c('0x38')][_0xe44c('0x3a')]?_0x50af7a['attributes']:_0x1b7dd0[_0xe44c('0x37')];if(!_0x2c1c0d['query']['hasOwnProperty'](_0xe44c('0x3b'))){_0x50af7a[_0xe44c('0x22')]=qs[_0xe44c('0x22')](_0x2c1c0d[_0xe44c('0x33')][_0xe44c('0x22')]);_0x50af7a[_0xe44c('0x20')]=qs[_0xe44c('0x20')](_0x2c1c0d[_0xe44c('0x33')]['offset']);}_0x50af7a[_0xe44c('0x3c')]=qs[_0xe44c('0x3d')](_0x2c1c0d[_0xe44c('0x33')]['sort']);_0x50af7a[_0xe44c('0x3e')]=qs[_0xe44c('0x35')](_[_0xe44c('0x3f')](_0x2c1c0d[_0xe44c('0x33')],_0x1b7dd0[_0xe44c('0x35')]),_0x348396);if(_0x2c1c0d[_0xe44c('0x33')]['filter']){_0x50af7a['where']=_['merge'](_0x50af7a[_0xe44c('0x3e')],{'$or':_[_0xe44c('0x40')](_0x348396,function(_0xc1f4c1){if(_0xc1f4c1[_0xe44c('0x41')]!==_0xe44c('0x42')){var _0x24888a={};_0x24888a[_0xc1f4c1[_0xe44c('0x2e')]]={'$like':'%'+_0x2c1c0d[_0xe44c('0x33')][_0xe44c('0x43')]+'%'};return _0x24888a;}})});}_0x50af7a=_['merge']({},_0x50af7a,_0x2c1c0d[_0xe44c('0x44')]);var _0x14085d={'where':_0x50af7a[_0xe44c('0x3e')]};return db['ChatInternalMessage'][_0xe44c('0x23')](_0x14085d)[_0xe44c('0x2a')](function(_0x1fdc82){_0x1cd28a[_0xe44c('0x23')]=_0x1fdc82;if(_0x2c1c0d[_0xe44c('0x33')]['includeAll']){_0x50af7a['include']=[{'all':!![]}];}return db[_0xe44c('0x45')][_0xe44c('0x46')](_0x50af7a);})[_0xe44c('0x2a')](function(_0x9cb0b0){_0x1cd28a[_0xe44c('0x47')]=_0x9cb0b0;return _0x1cd28a;})[_0xe44c('0x2a')](respondWithFilteredResult(_0x35f55f,_0x50af7a))[_0xe44c('0x48')](handleError(_0x35f55f,null));};exports[_0xe44c('0x49')]=function(_0x1afa62,_0x5312f8){var _0x5ab109={'raw':!![],'where':{'id':_0x1afa62[_0xe44c('0x4a')]['id']}},_0xda192f={};_0xda192f[_0xe44c('0x37')]=_['keys'](db['ChatInternalMessage']['rawAttributes']);_0xda192f[_0xe44c('0x33')]=_[_0xe44c('0x34')](_0x1afa62['query']);_0xda192f[_0xe44c('0x35')]=_['intersection'](_0xda192f[_0xe44c('0x37')],_0xda192f[_0xe44c('0x33')]);_0x5ab109[_0xe44c('0x38')]=_[_0xe44c('0x36')](_0xda192f[_0xe44c('0x37')],qs['fields'](_0x1afa62[_0xe44c('0x33')][_0xe44c('0x39')]));_0x5ab109['attributes']=_0x5ab109[_0xe44c('0x38')][_0xe44c('0x3a')]?_0x5ab109[_0xe44c('0x38')]:_0xda192f[_0xe44c('0x37')];if(_0x1afa62['query']['includeAll']){_0x5ab109['include']=[{'all':!![]}];}_0x5ab109=_[_0xe44c('0x4b')]({},_0x5ab109,_0x1afa62[_0xe44c('0x44')]);return db[_0xe44c('0x45')][_0xe44c('0x4c')](_0x5ab109)['then'](handleEntityNotFound(_0x5312f8,null))['then'](respondWithResult(_0x5312f8,null))[_0xe44c('0x48')](handleError(_0x5312f8,null));};exports[_0xe44c('0x4d')]=function(_0x137092,_0x2656ed){return db[_0xe44c('0x45')]['create'](_0x137092[_0xe44c('0x4e')],{})[_0xe44c('0x2a')](respondWithResult(_0x2656ed,0xc9))[_0xe44c('0x48')](handleError(_0x2656ed,null));};exports['update']=function(_0x140dae,_0x3e3a56){if(_0x140dae[_0xe44c('0x4e')]['id']){delete _0x140dae['body']['id'];}return db[_0xe44c('0x45')][_0xe44c('0x4c')]({'where':{'id':_0x140dae['params']['id']}})[_0xe44c('0x2a')](handleEntityNotFound(_0x3e3a56,null))['then'](saveUpdates(_0x140dae[_0xe44c('0x4e')],null))['then'](respondWithResult(_0x3e3a56,null))[_0xe44c('0x48')](handleError(_0x3e3a56,null));};exports[_0xe44c('0x2b')]=function(_0x2b2dc9,_0x25861c){return db[_0xe44c('0x45')][_0xe44c('0x4c')]({'where':{'id':_0x2b2dc9['params']['id']}})['then'](handleEntityNotFound(_0x25861c,null))[_0xe44c('0x2a')](removeEntity(_0x25861c,null))['catch'](handleError(_0x25861c,null));};exports[_0xe44c('0x4f')]=function(_0x14d7b8,_0x18c13d){return db['ChatInternalMessage']['describe']()[_0xe44c('0x2a')](respondWithResult(_0x18c13d,null))[_0xe44c('0x48')](handleError(_0x18c13d,null));};function wrapUser(_0x202d67){return function(_0x34b9a0){var _0x2c43a1=_0x202d67['get']({'plain':!![]});_0x2c43a1['messages']=[];if(_0x34b9a0){_0x2c43a1['lastMessageAt']=_0x34b9a0['createdAt'];_0x2c43a1['lastMessage']=_0x34b9a0;}else{_0x2c43a1['lastMessageAt']=moment(0x0)[_0xe44c('0x50')](_0xe44c('0x51'));_0x2c43a1[_0xe44c('0x52')]={};}return _0x2c43a1;};}exports['getUsers']=function(_0x3468f7,_0x38cfe5,_0x560947){var _0x13e431=[];return db['User'][_0xe44c('0x46')]({'where':{'role':['agent',_0xe44c('0x53'),'user']},'attributes':['id',_0xe44c('0x54'),_0xe44c('0x2e'),'role',_0xe44c('0x55'),_0xe44c('0x56'),_0xe44c('0x57'),_0xe44c('0x58'),_0xe44c('0x59'),_0xe44c('0x5a')],'order':qs[_0xe44c('0x3d')]('-online'),'include':[{'model':db[_0xe44c('0x5b')],'as':_0xe44c('0x5c'),'attributes':['id',_0xe44c('0x2e'),_0xe44c('0x41')],'through':{'attributes':[]}}]})['then'](function(_0x105e70){if(_0x105e70){var _0x4d4f9d=_0x3468f7[_0xe44c('0x5d')][_0xe44c('0x5e')]({'plain':!![]});if(!_0x4d4f9d)throw new Error(_0xe44c('0x5f'));if(_0x4d4f9d[_0xe44c('0x60')]===_0xe44c('0x5d')){return db[_0xe44c('0x61')][_0xe44c('0x4c')]({'where':{'name':_0xe44c('0x62'),'userProfileId':_0x4d4f9d['userProfileId']},'raw':!![]})[_0xe44c('0x2a')](function(_0x47ec6d){if(_0x47ec6d){if(_0x47ec6d[_0xe44c('0x63')]===0x0){return db[_0xe44c('0x64')][_0xe44c('0x46')]({'where':{'sectionId':_0x47ec6d['id']},'raw':!![]})[_0xe44c('0x2a')](function(_0x3b34f8){var _0x1adcc0=[];if(_[_0xe44c('0x65')](_0x3b34f8)){_0x1adcc0=_[_0xe44c('0x43')](_0x105e70,function(_0x1d6a1d){if(_0x1d6a1d[_0xe44c('0x60')]!==_0xe44c('0x66')){return _0x1d6a1d;}});return _0x1adcc0;}else{for(var _0x483ddb=0x0;_0x483ddb<_0x105e70[_0xe44c('0x3a')];_0x483ddb++){var _0x23a5a2=_0x105e70[_0x483ddb];if(_0x23a5a2[_0xe44c('0x60')]===_0xe44c('0x66')){var _0x127326=_[_0xe44c('0x4c')](_0x3b34f8,function(_0x2dda99){return _0x2dda99['resourceId']===_0x23a5a2['id'];});if(_0x127326)_0x1adcc0[_0xe44c('0x67')](_0x23a5a2);}else{_0x1adcc0[_0xe44c('0x67')](_0x23a5a2);}}return _0x1adcc0;}});}else{return _0x105e70;}}else{var _0x47bc2a=_[_0xe44c('0x43')](_0x105e70,function(_0x2ca4e4){if(_0x2ca4e4[_0xe44c('0x60')]!==_0xe44c('0x66')){return _0x2ca4e4;}});return _0x47bc2a;}});}else{return _0x105e70;}}})['then'](function(_0x9610e2){var _0xf54470=[];if(_0x9610e2){_0x13e431=_0x9610e2;for(var _0xe5a4b9=0x0;_0xe5a4b9<_0x9610e2[_0xe44c('0x3a')];_0xe5a4b9+=0x1){_0x13e431[_0xe5a4b9][_0xe44c('0x68')]=[];_0xf54470[_0xe44c('0x67')](db[_0xe44c('0x45')][_0xe44c('0x4c')]({'where':{'FromId':[_0x3468f7[_0xe44c('0x5d')]['id'],_0x9610e2[_0xe5a4b9]['id']],'ToId':[_0x3468f7[_0xe44c('0x5d')]['id'],_0x9610e2[_0xe5a4b9]['id']],'ChatGroupId':null},'attributes':['id',_0xe44c('0x69'),'FromId',_0xe44c('0x6a'),'read',_0xe44c('0x4e')],'order':qs['sort'](_0xe44c('0x6b')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xe44c('0x2a')](wrapUser(_0x9610e2[_0xe5a4b9])));}return BPromise['all'](_0xf54470);}return[];})[_0xe44c('0x2a')](function(_0xcccb91){return{'rows':_0xcccb91,'count':_0xcccb91[_0xe44c('0x3a')]};})[_0xe44c('0x2a')](respondWithResult(_0x38cfe5,null))[_0xe44c('0x48')](handleError(_0x38cfe5,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index a86df0e..8587321 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 _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 +var _0xb634=['exports','events','../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x354167,_0x23713f){var _0x44697c=function(_0x3a5de1){while(--_0x3a5de1){_0x354167['push'](_0x354167['shift']());}};_0x44697c(++_0x23713f);}(_0xb634,0x1c3));var _0x4b63=function(_0x473e7c,_0x365889){_0x473e7c=_0x473e7c-0x0;var _0x28be62=_0xb634[_0x473e7c];return _0x28be62;};'use strict';var EventEmitter=require(_0x4b63('0x0'));var ChatInternalMessage=require(_0x4b63('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x4b63('0x2')](0x0);var events={'afterCreate':_0x4b63('0x3'),'afterUpdate':'update','afterDestroy':_0x4b63('0x4')};function emitEvent(_0xf91e4){return function(_0x3981a7,_0x43c306,_0x2d4de0){ChatInternalMessageEvents[_0x4b63('0x5')](_0xf91e4+':'+_0x3981a7['id'],_0x3981a7);ChatInternalMessageEvents[_0x4b63('0x5')](_0xf91e4,_0x3981a7);_0x2d4de0(null);};}for(var e in events){if(events[_0x4b63('0x6')](e)){var event=events[e];ChatInternalMessage[_0x4b63('0x7')](e,emitEvent(event));}}module[_0x4b63('0x8')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index cfa18ca..339b515 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 _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 +var _0x5860=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','ChatInternalMessage','chat_internal_messages'];(function(_0x1c19f4,_0x685a68){var _0x3a7592=function(_0x263f02){while(--_0x263f02){_0x1c19f4['push'](_0x1c19f4['shift']());}};_0x3a7592(++_0x685a68);}(_0x5860,0x1a6));var _0x0586=function(_0x212fcc,_0x1a8867){_0x212fcc=_0x212fcc-0x0;var _0x4d8190=_0x5860[_0x212fcc];return _0x4d8190;};'use strict';var _=require(_0x0586('0x0'));var util=require(_0x0586('0x1'));var logger=require(_0x0586('0x2'))(_0x0586('0x3'));var moment=require(_0x0586('0x4'));var BPromise=require(_0x0586('0x5'));var rp=require(_0x0586('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0586('0x7'));var config=require(_0x0586('0x8'));var attributes=require(_0x0586('0x9'));module[_0x0586('0xa')]=function(_0x5b9f87,_0x409d78){return _0x5b9f87['define'](_0x0586('0xb'),attributes,{'tableName':_0x0586('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0586('0xd'),'collate':_0x0586('0xe')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 67f231d..7ce4c5b 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 _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 +var _0xb770=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis'];(function(_0x403401,_0x21c9aa){var _0x5df167=function(_0x39b698){while(--_0x39b698){_0x403401['push'](_0x403401['shift']());}};_0x5df167(++_0x21c9aa);}(_0xb770,0x191));var _0x0b77=function(_0x5ecf25,_0x5377ae){_0x5ecf25=_0x5ecf25-0x0;var _0x1a5ed4=_0xb770[_0x5ecf25];return _0x1a5ed4;};'use strict';var _=require(_0x0b77('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0b77('0x1'));var rs=require(_0x0b77('0x2'));var fs=require('fs');var Redis=require(_0x0b77('0x3'));var db=require(_0x0b77('0x4'))['db'];var utils=require(_0x0b77('0x5'));var logger=require('../../config/logger')(_0x0b77('0x6'));var config=require(_0x0b77('0x7'));var jayson=require(_0x0b77('0x8'));var client=jayson[_0x0b77('0x9')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x0b77('0xa')],{'host':_0x0b77('0xb'),'port':0x18eb});var socket=require(_0x0b77('0xc'))(new Redis(config['redis']));require(_0x0b77('0xd'))[_0x0b77('0xe')](socket);function respondWithRpcPromise(_0x366338,_0x47c6ef,_0x4bd643){return new BPromise(function(_0x2970b9,_0x18a547){return client[_0x0b77('0xf')](_0x366338,_0x4bd643)['then'](function(_0x437703){logger[_0x0b77('0x10')](_0x0b77('0x11'),_0x47c6ef,_0x0b77('0x12'));logger[_0x0b77('0x13')](_0x0b77('0x14'),_0x47c6ef,_0x0b77('0x12'),JSON[_0x0b77('0x15')](_0x437703));if(_0x437703['error']){if(_0x437703[_0x0b77('0x16')][_0x0b77('0x17')]===0x1f4){logger['error'](_0x0b77('0x11'),_0x47c6ef,_0x437703['error'][_0x0b77('0x18')]);return _0x18a547(_0x437703[_0x0b77('0x16')][_0x0b77('0x18')]);}logger[_0x0b77('0x16')]('ChatInternalMessage,\x20%s,\x20%s',_0x47c6ef,_0x437703[_0x0b77('0x16')][_0x0b77('0x18')]);return _0x2970b9(_0x437703[_0x0b77('0x16')][_0x0b77('0x18')]);}else{logger['info'](_0x0b77('0x11'),_0x47c6ef,_0x0b77('0x12'));_0x2970b9(_0x437703[_0x0b77('0x19')][_0x0b77('0x18')]);}})[_0x0b77('0x1a')](function(_0x49ff3f){logger['error'](_0x0b77('0x11'),_0x47c6ef,_0x49ff3f);_0x18a547(_0x49ff3f);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 3b5c05c..9adfc92 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 _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 +var _0x6928=['chatInternalMessage:','./chatInternalMessage.events','save','remove','update','emit','removeListener','length'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x6928,0x141));var _0x8692=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x6928[_0x376b45];return _0x2341b3;};'use strict';var ChatInternalMessageEvents=require(_0x8692('0x0'));var events=[_0x8692('0x1'),_0x8692('0x2'),_0x8692('0x3')];function createListener(_0x311715,_0x17535f){return function(_0x39c1bc){_0x17535f[_0x8692('0x4')](_0x311715,_0x39c1bc);};}function removeListener(_0x3f5dcf,_0x42c10a){return function(){ChatInternalMessageEvents[_0x8692('0x5')](_0x3f5dcf,_0x42c10a);};}exports['register']=function(_0x16eac3){for(var _0x54ed4d=0x0,_0x16c4ce=events[_0x8692('0x6')];_0x54ed4d<_0x16c4ce;_0x54ed4d++){var _0x42e729=events[_0x54ed4d];var _0x25bfda=createListener(_0x8692('0x7')+_0x42e729,_0x16eac3);ChatInternalMessageEvents['on'](_0x42e729,_0x25bfda);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 662b42a..b493d6c 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 _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 +var _0xfca4=['Router','fs-extra','../../components/auth/service','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users','getUsers','show','post','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout'];(function(_0x13bc89,_0x51ca59){var _0x3ba2b8=function(_0x4c2a9f){while(--_0x4c2a9f){_0x13bc89['push'](_0x13bc89['shift']());}};_0x3ba2b8(++_0x51ca59);}(_0xfca4,0x1b1));var _0x4fca=function(_0x4605a6,_0x4ee25f){_0x4605a6=_0x4605a6-0x0;var _0x18bc7a=_0xfca4[_0x4605a6];return _0x18bc7a;};'use strict';var multer=require(_0x4fca('0x0'));var util=require(_0x4fca('0x1'));var path=require(_0x4fca('0x2'));var timeout=require(_0x4fca('0x3'));var express=require('express');var router=express[_0x4fca('0x4')]();var fs_extra=require(_0x4fca('0x5'));var auth=require(_0x4fca('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4fca('0x7'));router[_0x4fca('0x8')]('/',auth[_0x4fca('0x9')](),controller[_0x4fca('0xa')]);router[_0x4fca('0x8')](_0x4fca('0xb'),auth[_0x4fca('0x9')](),controller[_0x4fca('0xc')]);router[_0x4fca('0x8')](_0x4fca('0xd'),auth[_0x4fca('0x9')](),controller[_0x4fca('0xe')]);router[_0x4fca('0x8')]('/:id',auth[_0x4fca('0x9')](),controller[_0x4fca('0xf')]);router[_0x4fca('0x10')]('/',auth['isAuthenticated'](),controller[_0x4fca('0x11')]);router[_0x4fca('0x12')](_0x4fca('0x13'),controller[_0x4fca('0x14')]);router[_0x4fca('0x15')](_0x4fca('0x13'),auth['isAuthenticated'](),controller[_0x4fca('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index c0fc6ae..9184c9d 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 _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 +var _0x43c8=['exports','medium','BOOLEAN','ENUM','out','DATE','TEXT'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x43c8,0xaf));var _0x843c=function(_0x1b945e,_0x2b08d4){_0x1b945e=_0x1b945e-0x0;var _0x385ca8=_0x43c8[_0x1b945e];return _0x385ca8;};'use strict';var Sequelize=require('sequelize');module[_0x843c('0x0')]={'body':{'type':Sequelize['TEXT'](_0x843c('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x843c('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0x843c('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x843c('0x3')]('in',_0x843c('0x4')),'defaultValue':_0x843c('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x843c('0x5')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x843c('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index a2c1670..ebf6675 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 _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 +var _0x0327=['jayson/promise','client','http','request','info','ChatMessage,\x20%s,\x20%s','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','ChatMessage','includeAll','findAll','rows','params','keys','include','find','create','body','describe','../../config/logger','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','read1stAt','interaction','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','email','internal','channel','motionChannel','accept','EventManager','acceptmessage','formData','ChatInteractionId','RejectMessage','contact','SIP/%s','rejectmessage','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./chatMessage.socket'];(function(_0x5092a0,_0x3933e2){var _0x275ea3=function(_0x291409){while(--_0x291409){_0x5092a0['push'](_0x5092a0['shift']());}};_0x275ea3(++_0x3933e2);}(_0x0327,0xe9));var _0x7032=function(_0x5610b7,_0x5095be){_0x5610b7=_0x5610b7-0x0;var _0x1c0eef=_0x0327[_0x5610b7];return _0x1c0eef;};'use strict';var emlformat=require(_0x7032('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7032('0x1'));var jsonpatch=require(_0x7032('0x2'));var rp=require(_0x7032('0x3'));var moment=require(_0x7032('0x4'));var BPromise=require(_0x7032('0x5'));var Mustache=require(_0x7032('0x6'));var util=require(_0x7032('0x7'));var path=require(_0x7032('0x8'));var sox=require(_0x7032('0x9'));var csv=require(_0x7032('0xa'));var ejs=require(_0x7032('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7032('0xc'));var squel=require(_0x7032('0xd'));var crypto=require(_0x7032('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x7032('0xf'));var toCsv=require(_0x7032('0xa'));var querystring=require(_0x7032('0x10'));var Papa=require(_0x7032('0x11'));var Redis=require(_0x7032('0x12'));var authService=require(_0x7032('0x13'));var qs=require(_0x7032('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7032('0x15'));var logger=require('../../config/logger')(_0x7032('0x16'));var utils=require(_0x7032('0x17'));var config=require(_0x7032('0x18'));var licenseUtil=require(_0x7032('0x19'));var db=require(_0x7032('0x1a'))['db'];config['redis']=_[_0x7032('0x1b')](config[_0x7032('0x1c')],{'host':_0x7032('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7032('0x1c')]));require(_0x7032('0x1e'))['register'](socket);var jayson=require(_0x7032('0x1f'));var client=jayson[_0x7032('0x20')][_0x7032('0x21')]({'port':0x232c});var client9002=jayson[_0x7032('0x20')][_0x7032('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x1f81e8,_0x2cdb81,_0x50c830,_0x3951c8){return new BPromise(function(_0x45306a,_0x4f9e36){var _0x573388=_0x3951c8||client;return _0x573388[_0x7032('0x22')](_0x1f81e8,_0x50c830)['then'](function(_0x13b713){logger[_0x7032('0x23')](_0x7032('0x24'),_0x2cdb81,'request\x20sent');logger['debug'](_0x7032('0x25'),_0x2cdb81,'request\x20sent',JSON[_0x7032('0x26')](_0x13b713));if(_0x13b713[_0x7032('0x27')]){if(_0x13b713['error'][_0x7032('0x28')]===0x1f4){logger[_0x7032('0x27')]('ChatMessage,\x20%s,\x20%s',_0x2cdb81,_0x13b713[_0x7032('0x27')]['message']);return _0x4f9e36(_0x13b713[_0x7032('0x27')]['message']);}logger[_0x7032('0x27')](_0x7032('0x24'),_0x2cdb81,_0x13b713['error'][_0x7032('0x29')]);return _0x45306a(_0x13b713[_0x7032('0x27')][_0x7032('0x29')]);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x2cdb81,_0x7032('0x2a'));_0x45306a(_0x13b713[_0x7032('0x2b')][_0x7032('0x29')]);}})[_0x7032('0x2c')](function(_0x30b1b5){logger[_0x7032('0x27')]('ChatMessage,\x20%s,\x20%s',_0x2cdb81,_0x30b1b5);_0x4f9e36(_0x30b1b5);});});}function respondWithStatusCode(_0x11e9f6,_0xcc3104){_0xcc3104=_0xcc3104||0xcc;return function(_0x37cc86){if(_0x37cc86){return _0x11e9f6[_0x7032('0x2d')](_0xcc3104);}return _0x11e9f6[_0x7032('0x2e')](_0xcc3104)[_0x7032('0x2f')]();};}function respondWithResult(_0x8201f8,_0x346fb3){_0x346fb3=_0x346fb3||0xc8;return function(_0x31318a){if(_0x31318a){return _0x8201f8['status'](_0x346fb3)[_0x7032('0x30')](_0x31318a);}};}function respondWithFilteredResult(_0x4a80c7,_0x3d5590){return function(_0x1a4886){if(_0x1a4886){var _0xe678ec=typeof _0x3d5590[_0x7032('0x31')]===_0x7032('0x32')&&typeof _0x3d5590[_0x7032('0x33')]===_0x7032('0x32');var _0x1a172d=_0x1a4886[_0x7032('0x34')];var _0x38aa4a=_0xe678ec?0x0:_0x3d5590['offset'];var _0x24b42b=_0xe678ec?_0x1a4886[_0x7032('0x34')]:_0x3d5590[_0x7032('0x31')]+_0x3d5590[_0x7032('0x33')];var _0xb7ceb9;if(_0x24b42b>=_0x1a172d){_0x24b42b=_0x1a172d;_0xb7ceb9=0xc8;}else{_0xb7ceb9=0xce;}_0x4a80c7[_0x7032('0x2e')](_0xb7ceb9);return _0x4a80c7[_0x7032('0x35')](_0x7032('0x36'),_0x38aa4a+'-'+_0x24b42b+'/'+_0x1a172d)[_0x7032('0x30')](_0x1a4886);}return null;};}function patchUpdates(_0x199792){return function(_0x9d9fc8){try{jsonpatch[_0x7032('0x37')](_0x9d9fc8,_0x199792,!![]);}catch(_0x563d25){return BPromise[_0x7032('0x38')](_0x563d25);}return _0x9d9fc8[_0x7032('0x39')]();};}function saveUpdates(_0x3b07d7,_0x3e5190){return function(_0x2e3a55){if(_0x2e3a55){return _0x2e3a55[_0x7032('0x3a')](_0x3b07d7)[_0x7032('0x3b')](function(_0x141074){return _0x141074;});}return null;};}function removeEntity(_0x4edef2,_0x560d76){return function(_0x13f4d5){if(_0x13f4d5){return _0x13f4d5[_0x7032('0x3c')]()[_0x7032('0x3b')](function(){_0x4edef2['status'](0xcc)[_0x7032('0x2f')]();});}};}function handleEntityNotFound(_0x4460c9,_0x49f853){return function(_0x1b8758){if(!_0x1b8758){_0x4460c9[_0x7032('0x2d')](0x194);}return _0x1b8758;};}function handleError(_0x595ced,_0x366ab1){_0x366ab1=_0x366ab1||0x1f4;return function(_0x5672c6){logger['error'](_0x5672c6['stack']);if(_0x5672c6[_0x7032('0x3d')]){delete _0x5672c6['name'];}_0x595ced[_0x7032('0x2e')](_0x366ab1)[_0x7032('0x3e')](_0x5672c6);};}exports[_0x7032('0x3f')]=function(_0x12ced0,_0x1e012c){var _0x335913={},_0x190f0e={},_0xc870ed={'count':0x0,'rows':[]};var _0x304660=_[_0x7032('0x40')](db['ChatMessage'][_0x7032('0x41')],function(_0x1d1096){return{'name':_0x1d1096[_0x7032('0x42')],'type':_0x1d1096[_0x7032('0x43')][_0x7032('0x44')]};});_0x190f0e[_0x7032('0x45')]=_[_0x7032('0x40')](_0x304660,_0x7032('0x3d'));_0x190f0e[_0x7032('0x46')]=_['keys'](_0x12ced0[_0x7032('0x46')]);_0x190f0e[_0x7032('0x47')]=_[_0x7032('0x48')](_0x190f0e[_0x7032('0x45')],_0x190f0e['query']);_0x335913['attributes']=_[_0x7032('0x48')](_0x190f0e[_0x7032('0x45')],qs[_0x7032('0x49')](_0x12ced0['query'][_0x7032('0x49')]));_0x335913[_0x7032('0x4a')]=_0x335913[_0x7032('0x4a')][_0x7032('0x4b')]?_0x335913[_0x7032('0x4a')]:_0x190f0e['model'];if(!_0x12ced0['query'][_0x7032('0x4c')](_0x7032('0x4d'))){_0x335913[_0x7032('0x33')]=qs[_0x7032('0x33')](_0x12ced0[_0x7032('0x46')][_0x7032('0x33')]);_0x335913[_0x7032('0x31')]=qs[_0x7032('0x31')](_0x12ced0['query']['offset']);}_0x335913['order']=qs[_0x7032('0x4e')](_0x12ced0[_0x7032('0x46')][_0x7032('0x4e')]);_0x335913['where']=qs[_0x7032('0x47')](_[_0x7032('0x4f')](_0x12ced0[_0x7032('0x46')],_0x190f0e[_0x7032('0x47')]),_0x304660);if(_0x12ced0[_0x7032('0x46')][_0x7032('0x50')]){_0x335913[_0x7032('0x51')]=_[_0x7032('0x52')](_0x335913[_0x7032('0x51')],{'$or':_[_0x7032('0x40')](_0x304660,function(_0x4ffa04){if(_0x4ffa04[_0x7032('0x43')]!=='VIRTUAL'){var _0x31b475={};_0x31b475[_0x4ffa04[_0x7032('0x3d')]]={'$like':'%'+_0x12ced0[_0x7032('0x46')]['filter']+'%'};return _0x31b475;}})});}_0x335913=_[_0x7032('0x52')]({},_0x335913,_0x12ced0[_0x7032('0x53')]);var _0x312748={'where':_0x335913[_0x7032('0x51')]};return db[_0x7032('0x54')][_0x7032('0x34')](_0x312748)['then'](function(_0x33e3dc){_0xc870ed[_0x7032('0x34')]=_0x33e3dc;if(_0x12ced0['query'][_0x7032('0x55')]){_0x335913['include']=[{'all':!![]}];}return db[_0x7032('0x54')][_0x7032('0x56')](_0x335913);})[_0x7032('0x3b')](function(_0x3fa843){_0xc870ed[_0x7032('0x57')]=_0x3fa843;return _0xc870ed;})[_0x7032('0x3b')](respondWithFilteredResult(_0x1e012c,_0x335913))[_0x7032('0x2c')](handleError(_0x1e012c,null));};exports['show']=function(_0x2f6b1f,_0x3517b2){var _0x310426={'raw':!![],'where':{'id':_0x2f6b1f[_0x7032('0x58')]['id']}},_0x24f491={};_0x24f491[_0x7032('0x45')]=_[_0x7032('0x59')](db[_0x7032('0x54')][_0x7032('0x41')]);_0x24f491[_0x7032('0x46')]=_[_0x7032('0x59')](_0x2f6b1f[_0x7032('0x46')]);_0x24f491['filters']=_['intersection'](_0x24f491[_0x7032('0x45')],_0x24f491[_0x7032('0x46')]);_0x310426[_0x7032('0x4a')]=_['intersection'](_0x24f491[_0x7032('0x45')],qs[_0x7032('0x49')](_0x2f6b1f[_0x7032('0x46')]['fields']));_0x310426['attributes']=_0x310426[_0x7032('0x4a')]['length']?_0x310426[_0x7032('0x4a')]:_0x24f491[_0x7032('0x45')];if(_0x2f6b1f[_0x7032('0x46')][_0x7032('0x55')]){_0x310426[_0x7032('0x5a')]=[{'all':!![]}];}_0x310426=_[_0x7032('0x52')]({},_0x310426,_0x2f6b1f[_0x7032('0x53')]);return db[_0x7032('0x54')][_0x7032('0x5b')](_0x310426)[_0x7032('0x3b')](handleEntityNotFound(_0x3517b2,null))[_0x7032('0x3b')](respondWithResult(_0x3517b2,null))[_0x7032('0x2c')](handleError(_0x3517b2,null));};exports[_0x7032('0x5c')]=function(_0x41ad2c,_0x4bd641){return db[_0x7032('0x54')][_0x7032('0x5c')](_0x41ad2c[_0x7032('0x5d')],{})[_0x7032('0x3b')](respondWithResult(_0x4bd641,0xc9))[_0x7032('0x2c')](handleError(_0x4bd641,null));};exports[_0x7032('0x3a')]=function(_0x3a31f1,_0xe2c53e){if(_0x3a31f1[_0x7032('0x5d')]['id']){delete _0x3a31f1[_0x7032('0x5d')]['id'];}return db['ChatMessage'][_0x7032('0x5b')]({'where':{'id':_0x3a31f1[_0x7032('0x58')]['id']}})[_0x7032('0x3b')](handleEntityNotFound(_0xe2c53e,null))[_0x7032('0x3b')](saveUpdates(_0x3a31f1[_0x7032('0x5d')],null))[_0x7032('0x3b')](respondWithResult(_0xe2c53e,null))[_0x7032('0x2c')](handleError(_0xe2c53e,null));};exports['destroy']=function(_0x1bdd6d,_0x350601){return db[_0x7032('0x54')][_0x7032('0x5b')]({'where':{'id':_0x1bdd6d[_0x7032('0x58')]['id']}})[_0x7032('0x3b')](handleEntityNotFound(_0x350601,null))['then'](removeEntity(_0x350601,null))['catch'](handleError(_0x350601,null));};exports[_0x7032('0x5e')]=function(_0x31965a,_0x285aba){return db['ChatMessage'][_0x7032('0x5e')]()[_0x7032('0x3b')](respondWithResult(_0x285aba,null))['catch'](handleError(_0x285aba,null));};var interaction_log=require(_0x7032('0x5f'))('chat-interactions');exports['accept']=function(_0x111307,_0x1d80e6,_0x31d9ea){var _0x29b3eb={'agent':{},'channel':_0x7032('0x60')};if(_0x111307['body']['id']){delete _0x111307[_0x7032('0x5d')]['id'];}_0x111307[_0x7032('0x5d')][_0x7032('0x61')]=!![];_0x111307[_0x7032('0x5d')][_0x7032('0x62')]=moment()[_0x7032('0x63')](_0x7032('0x64'));_0x111307[_0x7032('0x5d')][_0x7032('0x65')]=_0x111307['body'][_0x7032('0x65')]||_0x111307[_0x7032('0x66')]['id'];_0x29b3eb[_0x7032('0x67')]['id']=_0x111307['body']['UserId'];return db['ChatMessage'][_0x7032('0x5b')]({'where':{'id':_0x111307[_0x7032('0x58')]['id'],'UserId':null}})[_0x7032('0x3b')](handleEntityNotFound(_0x1d80e6,null))[_0x7032('0x3b')](saveUpdates(_0x111307[_0x7032('0x5d')],null))[_0x7032('0x3b')](function(_0x2ac6d7){if(_0x2ac6d7){_0x29b3eb[_0x7032('0x29')]=_0x2ac6d7[_0x7032('0x68')]({'plain':!![]});return db['ChatInteraction']['find']({'where':{'id':_0x2ac6d7['ChatInteractionId']}});}return null;})[_0x7032('0x3b')](handleEntityNotFound(_0x1d80e6,null))[_0x7032('0x3b')](function(_0x45285e){if(_0x45285e){return _0x45285e[_0x7032('0x3a')]({'UserId':_0x111307[_0x7032('0x5d')]['UserId'],'read1stAt':_['isNil'](_0x45285e[_0x7032('0x69')])?moment()[_0x7032('0x63')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x7032('0x3b')](function(_0x38412d){if(_0x38412d){_0x29b3eb[_0x7032('0x6a')]=_0x38412d[_0x7032('0x68')]({'plain':!![]});interaction_log[_0x7032('0x23')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x111307[_0x7032('0x66')]['id'],_0x111307[_0x7032('0x66')][_0x7032('0x3d')],_0x111307[_0x7032('0x66')][_0x7032('0x6b')],_0x29b3eb['interaction']['id'],_0x111307[_0x7032('0x5d')]?JSON[_0x7032('0x26')](_0x111307[_0x7032('0x5d')]):_0x7032('0x6c'));return respondWithRpcPromise(_0x7032('0x6d'),_0x7032('0x6e'),_0x29b3eb);}return null;})[_0x7032('0x3b')](function(_0x5a276a){var _0xb808f1=_0x7032('0x6f')+_0x5a276a[_0x7032('0x29')][_0x7032('0x70')];return db[_0x7032('0x71')][_0x7032('0x46')](_0xb808f1,{'type':db[_0x7032('0x72')][_0x7032('0x73')][_0x7032('0x74')],'raw':!![]})['then'](function(_0x9626be){return _0x9626be;});})['then'](function(_0x55a154){if(_0x55a154){_0x29b3eb[_0x7032('0x29')]['contact']=_0x55a154[0x0];if(!_0x111307['body'][_0x7032('0x65')])return;return db[_0x7032('0x75')][_0x7032('0x5b')]({'where':{'id':_0x111307[_0x7032('0x5d')][_0x7032('0x65')],'role':_0x7032('0x67')},'attributes':['id',_0x7032('0x3d'),_0x7032('0x76'),_0x7032('0x77'),_0x7032('0x78')],'raw':!![]});}return null;})[_0x7032('0x3b')](function(_0x38d64f){if(!_0x38d64f)return null;_0x29b3eb[_0x7032('0x29')]['agent']=_0x38d64f;return _0x29b3eb;})[_0x7032('0x3b')](function(_0x193a18){if(_0x193a18){if(_0x111307['body']['manual']){_0x29b3eb['message']['interface']=util[_0x7032('0x63')]('SIP/%s',_0x111307[_0x7032('0x66')][_0x7032('0x3d')]);_0x29b3eb['message'][_0x7032('0x79')]=_0x29b3eb[_0x7032('0x79')];_0x29b3eb['message'][_0x7032('0x7a')]=_0x29b3eb['channel'];_0x29b3eb[_0x7032('0x29')]['event']=_0x7032('0x7b');return respondWithRpcPromise(_0x7032('0x7c'),_0x7032('0x7c'),{'event':_0x7032('0x7d'),'message':_['merge'](_0x29b3eb[_0x7032('0x29')],JSON['parse'](_0x29b3eb[_0x7032('0x6a')][_0x7032('0x7e')]))},client9002)[_0x7032('0x3b')](function(){return _0x29b3eb;});}return _0x29b3eb;}return null;})[_0x7032('0x3b')](respondWithResult(_0x1d80e6,null))[_0x7032('0x2c')](handleError(_0x1d80e6,null));};var interaction_log=require(_0x7032('0x5f'))('chat-interactions');exports[_0x7032('0x38')]=function(_0x53becb,_0x3c945a,_0x2a0c0e){var _0x4aaac3={'agent':{},'channel':'chat'};if(_0x53becb[_0x7032('0x5d')]['id']){delete _0x53becb['body']['id'];}_0x53becb[_0x7032('0x5d')][_0x7032('0x65')]=_0x53becb['body'][_0x7032('0x65')]||_0x53becb['user']['id'];_0x4aaac3[_0x7032('0x67')]['id']=_0x53becb[_0x7032('0x5d')]['UserId'];return db['ChatMessage'][_0x7032('0x5b')]({'where':{'id':_0x53becb[_0x7032('0x58')]['id'],'UserId':null}})[_0x7032('0x3b')](handleEntityNotFound(_0x3c945a,null))['then'](function(_0x4696ff){if(_0x4696ff){_0x4aaac3[_0x7032('0x29')]=_0x4696ff['get']({'plain':!![]});return db['ChatInteraction'][_0x7032('0x5b')]({'where':{'id':_0x4696ff[_0x7032('0x7f')]}});}return null;})[_0x7032('0x3b')](handleEntityNotFound(_0x3c945a,null))[_0x7032('0x3b')](function(_0x233aa6){if(_0x233aa6){_0x4aaac3[_0x7032('0x6a')]=_0x233aa6[_0x7032('0x68')]({'plain':!![]});interaction_log[_0x7032('0x23')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x53becb[_0x7032('0x66')]['id'],_0x53becb[_0x7032('0x66')][_0x7032('0x3d')],_0x53becb[_0x7032('0x66')][_0x7032('0x6b')],_0x4aaac3[_0x7032('0x6a')]['id'],_0x53becb[_0x7032('0x5d')]?JSON[_0x7032('0x26')](_0x53becb[_0x7032('0x5d')]):'null');return respondWithRpcPromise(_0x7032('0x80'),'rejectMessage',_0x4aaac3);}return null;})['then'](function(_0x328fbc){var _0x3e8046=_0x7032('0x6f')+_0x328fbc[_0x7032('0x29')][_0x7032('0x70')];return db[_0x7032('0x71')][_0x7032('0x46')](_0x3e8046,{'type':db['Sequelize'][_0x7032('0x73')]['SELECT'],'raw':!![]})['then'](function(_0x47d535){return _0x47d535;});})[_0x7032('0x3b')](function(_0x14387){if(_0x14387){_0x4aaac3['message'][_0x7032('0x81')]=_0x14387[0x0];if(!_0x53becb[_0x7032('0x5d')][_0x7032('0x65')])return;return db[_0x7032('0x75')][_0x7032('0x5b')]({'where':{'id':_0x53becb[_0x7032('0x5d')][_0x7032('0x65')],'role':_0x7032('0x67')},'attributes':['id',_0x7032('0x3d'),'fullname','email',_0x7032('0x78')],'raw':!![]});}return null;})[_0x7032('0x3b')](function(_0x40c762){if(!_0x40c762)return null;_0x4aaac3[_0x7032('0x29')][_0x7032('0x67')]=_0x40c762;return _0x4aaac3;})[_0x7032('0x3b')](function(_0x399b29){if(_0x399b29){_0x399b29[_0x7032('0x29')]['interface']=util[_0x7032('0x63')](_0x7032('0x82'),_0x53becb[_0x7032('0x66')][_0x7032('0x3d')]);_0x399b29[_0x7032('0x29')][_0x7032('0x79')]=_0x4aaac3[_0x7032('0x79')];_0x399b29['message'][_0x7032('0x7a')]=_0x4aaac3['channel'];_0x399b29[_0x7032('0x29')]['event']=_0x7032('0x38');respondWithRpcPromise(_0x7032('0x7c'),_0x7032('0x7c'),{'event':_0x7032('0x83'),'message':_[_0x7032('0x52')](_0x4aaac3[_0x7032('0x29')],JSON['parse'](_0x4aaac3[_0x7032('0x6a')][_0x7032('0x7e')]))},client9002);return _0x4aaac3;}return null;})[_0x7032('0x3b')](respondWithResult(_0x3c945a,null))[_0x7032('0x2c')](handleError(_0x3c945a,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index a995e90..c107a41 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 _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 +var _0x8dd7=['../../mysqldb','ChatMessage','update','remove','emit','events'];(function(_0x35e75a,_0x5ed225){var _0xb23c7f=function(_0x2fa40c){while(--_0x2fa40c){_0x35e75a['push'](_0x35e75a['shift']());}};_0xb23c7f(++_0x5ed225);}(_0x8dd7,0x167));var _0x78dd=function(_0x25e6ef,_0x4ce9b3){_0x25e6ef=_0x25e6ef-0x0;var _0x374885=_0x8dd7[_0x25e6ef];return _0x374885;};'use strict';var EventEmitter=require(_0x78dd('0x0'));var ChatMessage=require(_0x78dd('0x1'))['db'][_0x78dd('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x78dd('0x3'),'afterDestroy':_0x78dd('0x4')};function emitEvent(_0xdbe4e8){return function(_0x1e16fe,_0x17aa76,_0x585bf1){ChatMessageEvents[_0x78dd('0x5')](_0xdbe4e8+':'+_0x1e16fe['id'],_0x1e16fe);ChatMessageEvents['emit'](_0xdbe4e8,_0x1e16fe);_0x585bf1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 3ba4591..887b2ac 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 _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 +var _0x5687=['createdAt','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatMessage.attributes','exports','ChatMessage','chat_messages','body','models','get','direction','toLowerCase','out','secret','UserId','findOne','ChatInteractionId','then'];(function(_0x185f5f,_0x21618c){var _0x2bfbc0=function(_0x408b36){while(--_0x408b36){_0x185f5f['push'](_0x185f5f['shift']());}};_0x2bfbc0(++_0x21618c);}(_0x5687,0x1ce));var _0x7568=function(_0x584059,_0x1a6c41){_0x584059=_0x584059-0x0;var _0x4ba0c4=_0x5687[_0x584059];return _0x4ba0c4;};'use strict';var _=require(_0x7568('0x0'));var util=require(_0x7568('0x1'));var logger=require(_0x7568('0x2'))(_0x7568('0x3'));var moment=require(_0x7568('0x4'));var BPromise=require(_0x7568('0x5'));var rp=require(_0x7568('0x6'));var fs=require('fs');var path=require(_0x7568('0x7'));var rimraf=require(_0x7568('0x8'));var config=require('../../config/environment');var attributes=require(_0x7568('0x9'));module[_0x7568('0xa')]=function(_0x327400,_0x248492){return _0x327400['define'](_0x7568('0xb'),attributes,{'tableName':_0x7568('0xc'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0x7568('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x11b36a,_0x53d9a5,_0xaf88a5){var _0x3d0d7c=_0x327400[_0x7568('0xe')];var _0xbe15ac=_0x11b36a[_0x7568('0xf')]({'plain':!![]});if(_0xbe15ac[_0x7568('0x10')][_0x7568('0x11')]()==='in'||_0xbe15ac[_0x7568('0x10')][_0x7568('0x11')]()===_0x7568('0x12')&&!_0xbe15ac[_0x7568('0x13')]&&!_['isNil'](_0xbe15ac[_0x7568('0x14')])){_0x3d0d7c['ChatInteraction'][_0x7568('0x15')]({'where':{'id':_0xbe15ac[_0x7568('0x16')]}})[_0x7568('0x17')](function(_0x767d9){if(_0x767d9){_0x767d9['update']({'lastMsgAt':_0xbe15ac[_0x7568('0x18')],'lastMsgDirection':_0xbe15ac[_0x7568('0x10')][_0x7568('0x11')]()});}})['catch'](function(_0x5d01a9){console[_0x7568('0x19')](_0x5d01a9);});}_0xaf88a5();}},'charset':'utf8mb4','collate':_0x7568('0x1a')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 17c513a..82df7cf 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 _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 +var _0xa10f=['info','result','catch','CreateChatMessage','ChatMessage','create','body','options','raw','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x35f53e,_0x27753a){var _0x5290e4=function(_0x494706){while(--_0x494706){_0x35f53e['push'](_0x35f53e['shift']());}};_0x5290e4(++_0x27753a);}(_0xa10f,0x6c));var _0xfa10=function(_0xcff950,_0x7038df){_0xcff950=_0xcff950-0x0;var _0x2a2d90=_0xa10f[_0xcff950];return _0x2a2d90;};'use strict';var _=require(_0xfa10('0x0'));var util=require(_0xfa10('0x1'));var moment=require(_0xfa10('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfa10('0x3'))['db'];var utils=require(_0xfa10('0x4'));var logger=require(_0xfa10('0x5'))('rpc');var config=require(_0xfa10('0x6'));var jayson=require(_0xfa10('0x7'));var client=jayson[_0xfa10('0x8')]['http']({'port':0x232a});config[_0xfa10('0x9')]=_[_0xfa10('0xa')](config[_0xfa10('0x9')],{'host':_0xfa10('0xb'),'port':0x18eb});var socket=require(_0xfa10('0xc'))(new Redis(config['redis']));require('./chatMessage.socket')[_0xfa10('0xd')](socket);function respondWithRpcPromise(_0xdfd752,_0x503595,_0x471c0c){return new BPromise(function(_0x1e9cfd,_0x479ac4){return client[_0xfa10('0xe')](_0xdfd752,_0x471c0c)[_0xfa10('0xf')](function(_0x277502){logger['info'](_0xfa10('0x10'),_0x503595,'request\x20sent');logger[_0xfa10('0x11')](_0xfa10('0x12'),_0x503595,_0xfa10('0x13'),JSON[_0xfa10('0x14')](_0x277502));if(_0x277502['error']){if(_0x277502[_0xfa10('0x15')][_0xfa10('0x16')]===0x1f4){logger[_0xfa10('0x15')](_0xfa10('0x10'),_0x503595,_0x277502[_0xfa10('0x15')][_0xfa10('0x17')]);return _0x479ac4(_0x277502[_0xfa10('0x15')]['message']);}logger[_0xfa10('0x15')](_0xfa10('0x10'),_0x503595,_0x277502[_0xfa10('0x15')][_0xfa10('0x17')]);return _0x1e9cfd(_0x277502[_0xfa10('0x15')][_0xfa10('0x17')]);}else{logger[_0xfa10('0x18')]('ChatMessage,\x20%s,\x20%s',_0x503595,_0xfa10('0x13'));_0x1e9cfd(_0x277502[_0xfa10('0x19')][_0xfa10('0x17')]);}})[_0xfa10('0x1a')](function(_0x4358bd){logger['error'](_0xfa10('0x10'),_0x503595,_0x4358bd);_0x479ac4(_0x4358bd);});});}exports[_0xfa10('0x1b')]=function(_0x503d3d){var _0x2a9d83=this;return new Promise(function(_0x3c1e4b,_0xdafe54){return db[_0xfa10('0x1c')][_0xfa10('0x1d')](_0x503d3d[_0xfa10('0x1e')],{'raw':_0x503d3d[_0xfa10('0x1f')]?_0x503d3d[_0xfa10('0x1f')][_0xfa10('0x20')]===undefined?!![]:![]:!![]})[_0xfa10('0xf')](function(_0x3bcbdd){logger[_0xfa10('0x18')]('CreateChatMessage',_0x503d3d);logger['debug'](_0xfa10('0x1b'),_0x503d3d,JSON[_0xfa10('0x14')](_0x3bcbdd));_0x3c1e4b(_0x3bcbdd);})['catch'](function(_0x80433a){logger[_0xfa10('0x15')](_0xfa10('0x1b'),_0x80433a['message'],_0x503d3d);_0xdafe54(_0x2a9d83[_0xfa10('0x15')](0x1f4,_0x80433a[_0xfa10('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index d437b32..f63118b 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 _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 +var _0xabce=['chatMessage:','./chatMessage.events','save','remove','update','emit'];(function(_0x2af49e,_0x20fba4){var _0x2a41c6=function(_0x36fcb5){while(--_0x36fcb5){_0x2af49e['push'](_0x2af49e['shift']());}};_0x2a41c6(++_0x20fba4);}(_0xabce,0x103));var _0xeabc=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xabce[_0x110c3d];return _0x226d67;};'use strict';var ChatMessageEvents=require(_0xeabc('0x0'));var events=[_0xeabc('0x1'),_0xeabc('0x2'),_0xeabc('0x3')];function createListener(_0x49dbcc,_0x5bd1a4){return function(_0x5ebc95){_0x5bd1a4[_0xeabc('0x4')](_0x49dbcc,_0x5ebc95);};}function removeListener(_0x1d9f37,_0x1a88a7){return function(){ChatMessageEvents['removeListener'](_0x1d9f37,_0x1a88a7);};}exports['register']=function(_0x1b07a8){for(var _0x52a4d7=0x0,_0x229ba4=events['length'];_0x52a4d7<_0x229ba4;_0x52a4d7++){var _0x3bdc29=events[_0x52a4d7];var _0x9417af=createListener(_0xeabc('0x5')+_0x3bdc29,_0x1b07a8);ChatMessageEvents['on'](_0x3bdc29,_0x9417af);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 41df606..78e2c41 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 _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 +var _0x7e11=['../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','post','tracked','chat','chatmessage:create','put','update','/:id/accept','accept','/:id/reject','delete','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x4bd64d,_0x3c2b8a){var _0x37db2d=function(_0x5ca98f){while(--_0x5ca98f){_0x4bd64d['push'](_0x4bd64d['shift']());}};_0x37db2d(++_0x3c2b8a);}(_0x7e11,0x1b4));var _0x17e1=function(_0x1bf338,_0x26e681){_0x1bf338=_0x1bf338-0x0;var _0x5f050e=_0x7e11[_0x1bf338];return _0x5f050e;};'use strict';var multer=require(_0x17e1('0x0'));var util=require('util');var path=require(_0x17e1('0x1'));var timeout=require(_0x17e1('0x2'));var express=require(_0x17e1('0x3'));var router=express[_0x17e1('0x4')]();var fs_extra=require(_0x17e1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x17e1('0x6'));var config=require(_0x17e1('0x7'));var controller=require(_0x17e1('0x8'));router[_0x17e1('0x9')]('/',auth[_0x17e1('0xa')](),controller['index']);router[_0x17e1('0x9')](_0x17e1('0xb'),auth[_0x17e1('0xa')](),controller[_0x17e1('0xc')]);router[_0x17e1('0x9')](_0x17e1('0xd'),auth[_0x17e1('0xa')](),controller[_0x17e1('0xe')]);router[_0x17e1('0xf')]('/',auth['isAuthenticated'](),interaction[_0x17e1('0x10')](_0x17e1('0x11'),_0x17e1('0x12')),controller['create']);router[_0x17e1('0x13')](_0x17e1('0xd'),controller[_0x17e1('0x14')]);router[_0x17e1('0x13')](_0x17e1('0x15'),auth[_0x17e1('0xa')](),controller[_0x17e1('0x16')]);router['put'](_0x17e1('0x17'),auth[_0x17e1('0xa')](),controller['reject']);router[_0x17e1('0x18')](_0x17e1('0xd'),auth[_0x17e1('0xa')](),controller['destroy']);module[_0x17e1('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index c158ece..6291ad4 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 _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 +var _0x5f66=['medium','TEXT','exports'];(function(_0x48d107,_0x34f9f3){var _0x1a63d4=function(_0x335f89){while(--_0x335f89){_0x48d107['push'](_0x48d107['shift']());}};_0x1a63d4(++_0x34f9f3);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x5f66[_0x4243a3];return _0x1b2a33;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'body':{'type':Sequelize['TEXT'](_0x65f6('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x65f6('0x2')](_0x65f6('0x1')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 13b1b31..d90f4b5 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(_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 +var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x7a54,0x106));var _0x47a5=function(_0x28ca60,_0x1ba6dc){_0x28ca60=_0x28ca60-0x0;var _0x2ae140=_0x7a54[_0x28ca60];return _0x2ae140;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index e9740ed..617496a 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 _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 +var _0xd4f7=['events','setMaxListeners','save','update','emit','hook','exports'];(function(_0x124f88,_0x3ad501){var _0xed0e3b=function(_0x43a67d){while(--_0x43a67d){_0x124f88['push'](_0x124f88['shift']());}};_0xed0e3b(++_0x3ad501);}(_0xd4f7,0x8c));var _0x7d4f=function(_0x2af053,_0x4f6d28){_0x2af053=_0x2af053-0x0;var _0x4b4001=_0xd4f7[_0x2af053];return _0x4b4001;};'use strict';var EventEmitter=require(_0x7d4f('0x0'));var ChatOfflineMessage=require('../../mysqldb')['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x7d4f('0x1')](0x0);var events={'afterCreate':_0x7d4f('0x2'),'afterUpdate':_0x7d4f('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2b4844){return function(_0x5dd1ed,_0x1d0a46,_0x4d0d59){ChatOfflineMessageEvents[_0x7d4f('0x4')](_0x2b4844+':'+_0x5dd1ed['id'],_0x5dd1ed);ChatOfflineMessageEvents[_0x7d4f('0x4')](_0x2b4844,_0x5dd1ed);_0x4d0d59(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage[_0x7d4f('0x5')](e,emitEvent(event));}}module[_0x7d4f('0x6')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index e160427..91b1449 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 _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 +var _0xd3bc=['utf8mb4','define','ChatOfflineMessage','chat_offline_messages'];(function(_0x54d486,_0x193223){var _0x3a639e=function(_0x51174c){while(--_0x51174c){_0x54d486['push'](_0x54d486['shift']());}};_0x3a639e(++_0x193223);}(_0xd3bc,0x1b1));var _0xcd3b=function(_0x276eea,_0x2eb2d3){_0x276eea=_0x276eea-0x0;var _0x5ee628=_0xd3bc[_0x276eea];return _0x5ee628;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module['exports']=function(_0xb9ff46){return _0xb9ff46[_0xcd3b('0x0')](_0xcd3b('0x1'),attributes,{'tableName':_0xcd3b('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xcd3b('0x3'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 6b81c0a..640945b 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 _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 +var _0x0810=['stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/environment','client','request','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s'];(function(_0x55ca64,_0x32e895){var _0x397e03=function(_0x308b52){while(--_0x308b52){_0x55ca64['push'](_0x55ca64['shift']());}};_0x397e03(++_0x32e895);}(_0x0810,0x95));var _0x0081=function(_0x103adf,_0x20025b){_0x103adf=_0x103adf-0x0;var _0x3e3ded=_0x0810[_0x103adf];return _0x3e3ded;};'use strict';var _=require(_0x0081('0x0'));var util=require(_0x0081('0x1'));var moment=require(_0x0081('0x2'));var BPromise=require(_0x0081('0x3'));var rs=require(_0x0081('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0081('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x0081('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x0081('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d17fb,_0x5c3918,_0x9a671a){return new BPromise(function(_0x5de626,_0x5ac877){return client[_0x0081('0x8')](_0x5d17fb,_0x9a671a)['then'](function(_0x1051c4){logger[_0x0081('0x9')](_0x0081('0xa'),_0x5c3918,_0x0081('0xb'));logger['debug'](_0x0081('0xc'),_0x5c3918,'request\x20sent',JSON[_0x0081('0xd')](_0x1051c4));if(_0x1051c4[_0x0081('0xe')]){if(_0x1051c4['error']['code']===0x1f4){logger[_0x0081('0xe')](_0x0081('0xa'),_0x5c3918,_0x1051c4['error'][_0x0081('0xf')]);return _0x5ac877(_0x1051c4[_0x0081('0xe')][_0x0081('0xf')]);}logger[_0x0081('0xe')](_0x0081('0xa'),_0x5c3918,_0x1051c4['error'][_0x0081('0xf')]);return _0x5de626(_0x1051c4[_0x0081('0xe')]['message']);}else{logger[_0x0081('0x9')](_0x0081('0xa'),_0x5c3918,_0x0081('0xb'));_0x5de626(_0x1051c4[_0x0081('0x10')][_0x0081('0xf')]);}})[_0x0081('0x11')](function(_0x5caf7b){logger['error'](_0x0081('0xa'),_0x5c3918,_0x5caf7b);_0x5ac877(_0x5caf7b);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 4baa76f..96a53a6 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 _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 +var _0xa363=['exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','index','/describe','get','isAuthenticated','show','post','put','update','/:id'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xa363,0xd9));var _0x3a36=function(_0x78ac8e,_0x34f635){_0x78ac8e=_0x78ac8e-0x0;var _0x242d93=_0xa363[_0x78ac8e];return _0x242d93;};'use strict';var multer=require(_0x3a36('0x0'));var util=require('util');var path=require(_0x3a36('0x1'));var timeout=require(_0x3a36('0x2'));var express=require(_0x3a36('0x3'));var router=express[_0x3a36('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3a36('0x5'));var config=require(_0x3a36('0x6'));var controller=require(_0x3a36('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x3a36('0x8')]);router['get'](_0x3a36('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x3a36('0xa')]('/:id',auth[_0x3a36('0xb')](),controller[_0x3a36('0xc')]);router[_0x3a36('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3a36('0xe')]('/:id',auth[_0x3a36('0xb')](),controller[_0x3a36('0xf')]);router['delete'](_0x3a36('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0x3a36('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 3f4d3cb..1057383 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 _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 +var _0x9e2b=['ENUM','timeout','mouseOver','INTEGER','STRING'];(function(_0x45d414,_0xbe8170){var _0x1e4e8b=function(_0xc886d9){while(--_0xc886d9){_0x45d414['push'](_0x45d414['shift']());}};_0x1e4e8b(++_0xbe8170);}(_0x9e2b,0x1d0));var _0xb9e2=function(_0x188b44,_0x2f75c9){_0x188b44=_0x188b44-0x0;var _0x3efb1e=_0x9e2b[_0x188b44];return _0x3efb1e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb9e2('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0xb9e2('0x1')]('mouseOver',_0xb9e2('0x2')),'defaultValue':_0xb9e2('0x3')},'selector':{'type':Sequelize[_0xb9e2('0x0')]},'timeout':{'type':Sequelize[_0xb9e2('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 3b55165..a4d5f64 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 _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 +var _0x46ed=['eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','limit','undefined','set','Content-Range','json','apply','reject','update','then','stack','name','send','show','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','options','find','catch','create','body','destroy'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x46ed,0x168));var _0xd46e=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x46ed[_0x8c43de];return _0xa6591b;};'use strict';var emlformat=require(_0xd46e('0x0'));var rimraf=require(_0xd46e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd46e('0x2'));var rp=require(_0xd46e('0x3'));var moment=require(_0xd46e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd46e('0x5'));var util=require(_0xd46e('0x6'));var path=require('path');var sox=require(_0xd46e('0x7'));var csv=require(_0xd46e('0x8'));var ejs=require(_0xd46e('0x9'));var fs=require('fs');var fs_extra=require(_0xd46e('0xa'));var _=require(_0xd46e('0xb'));var squel=require(_0xd46e('0xc'));var crypto=require(_0xd46e('0xd'));var jsforce=require(_0xd46e('0xe'));var deskjs=require(_0xd46e('0xf'));var toCsv=require(_0xd46e('0x8'));var querystring=require(_0xd46e('0x10'));var Papa=require('papaparse');var Redis=require(_0xd46e('0x11'));var authService=require(_0xd46e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd46e('0x13'));var hardwareService=require(_0xd46e('0x14'));var logger=require(_0xd46e('0x15'))(_0xd46e('0x16'));var utils=require(_0xd46e('0x17'));var config=require(_0xd46e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd46e('0x19'))['db'];function respondWithStatusCode(_0x5bc1da,_0x48550b){_0x48550b=_0x48550b||0xcc;return function(_0xf3048c){if(_0xf3048c){return _0x5bc1da[_0xd46e('0x1a')](_0x48550b);}return _0x5bc1da['status'](_0x48550b)['end']();};}function respondWithResult(_0xacd799,_0x4688ae){_0x4688ae=_0x4688ae||0xc8;return function(_0x1e9aae){if(_0x1e9aae){return _0xacd799[_0xd46e('0x1b')](_0x4688ae)['json'](_0x1e9aae);}};}function respondWithFilteredResult(_0x3b6d25,_0x44a620){return function(_0x417402){if(_0x417402){var _0x3d72ce=typeof _0x44a620[_0xd46e('0x1c')]==='undefined'&&typeof _0x44a620[_0xd46e('0x1d')]===_0xd46e('0x1e');var _0x3583a5=_0x417402['count'];var _0x5ddd04=_0x3d72ce?0x0:_0x44a620[_0xd46e('0x1c')];var _0x1bd574=_0x3d72ce?_0x417402['count']:_0x44a620['offset']+_0x44a620[_0xd46e('0x1d')];var _0x2f2571;if(_0x1bd574>=_0x3583a5){_0x1bd574=_0x3583a5;_0x2f2571=0xc8;}else{_0x2f2571=0xce;}_0x3b6d25[_0xd46e('0x1b')](_0x2f2571);return _0x3b6d25[_0xd46e('0x1f')](_0xd46e('0x20'),_0x5ddd04+'-'+_0x1bd574+'/'+_0x3583a5)[_0xd46e('0x21')](_0x417402);}return null;};}function patchUpdates(_0x3b5fa4){return function(_0x327b7e){try{jsonpatch[_0xd46e('0x22')](_0x327b7e,_0x3b5fa4,!![]);}catch(_0x3c7e91){return BPromise[_0xd46e('0x23')](_0x3c7e91);}return _0x327b7e['save']();};}function saveUpdates(_0x259072,_0x1c83fa){return function(_0x79aa51){if(_0x79aa51){return _0x79aa51[_0xd46e('0x24')](_0x259072)[_0xd46e('0x25')](function(_0xc1af7f){return _0xc1af7f;});}return null;};}function removeEntity(_0x33c2e0,_0x8a1be){return function(_0x62dea5){if(_0x62dea5){return _0x62dea5['destroy']()[_0xd46e('0x25')](function(){_0x33c2e0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x371054,_0x2a5271){return function(_0x21135f){if(!_0x21135f){_0x371054[_0xd46e('0x1a')](0x194);}return _0x21135f;};}function handleError(_0x247b9f,_0x180851){_0x180851=_0x180851||0x1f4;return function(_0x1740d1){logger['error'](_0x1740d1[_0xd46e('0x26')]);if(_0x1740d1[_0xd46e('0x27')]){delete _0x1740d1[_0xd46e('0x27')];}_0x247b9f[_0xd46e('0x1b')](_0x180851)[_0xd46e('0x28')](_0x1740d1);};}exports[_0xd46e('0x29')]=function(_0x58aeef,_0x465d54){var _0x3a1ced={'raw':!![],'where':{'id':_0x58aeef[_0xd46e('0x2a')]['id']}},_0x2d1afe={};_0x2d1afe[_0xd46e('0x2b')]=_[_0xd46e('0x2c')](db[_0xd46e('0x2d')][_0xd46e('0x2e')]);_0x2d1afe[_0xd46e('0x2f')]=_[_0xd46e('0x2c')](_0x58aeef[_0xd46e('0x2f')]);_0x2d1afe[_0xd46e('0x30')]=_[_0xd46e('0x31')](_0x2d1afe['model'],_0x2d1afe[_0xd46e('0x2f')]);_0x3a1ced[_0xd46e('0x32')]=_[_0xd46e('0x31')](_0x2d1afe[_0xd46e('0x2b')],qs['fields'](_0x58aeef[_0xd46e('0x2f')][_0xd46e('0x33')]));_0x3a1ced['attributes']=_0x3a1ced[_0xd46e('0x32')][_0xd46e('0x34')]?_0x3a1ced['attributes']:_0x2d1afe[_0xd46e('0x2b')];if(_0x58aeef[_0xd46e('0x2f')][_0xd46e('0x35')]){_0x3a1ced['include']=[{'all':!![]}];}_0x3a1ced=_['merge']({},_0x3a1ced,_0x58aeef[_0xd46e('0x36')]);return db[_0xd46e('0x2d')][_0xd46e('0x37')](_0x3a1ced)[_0xd46e('0x25')](handleEntityNotFound(_0x465d54,null))[_0xd46e('0x25')](respondWithResult(_0x465d54,null))[_0xd46e('0x38')](handleError(_0x465d54,null));};exports[_0xd46e('0x39')]=function(_0xf8b746,_0x527a2f){return db[_0xd46e('0x2d')][_0xd46e('0x39')](_0xf8b746[_0xd46e('0x3a')],{})[_0xd46e('0x25')](respondWithResult(_0x527a2f,0xc9))[_0xd46e('0x38')](handleError(_0x527a2f,null));};exports[_0xd46e('0x24')]=function(_0x42ddde,_0x5158e6){if(_0x42ddde[_0xd46e('0x3a')]['id']){delete _0x42ddde[_0xd46e('0x3a')]['id'];}return db['ChatProactiveAction'][_0xd46e('0x37')]({'where':{'id':_0x42ddde[_0xd46e('0x2a')]['id']}})[_0xd46e('0x25')](handleEntityNotFound(_0x5158e6,null))[_0xd46e('0x25')](saveUpdates(_0x42ddde['body'],null))[_0xd46e('0x25')](respondWithResult(_0x5158e6,null))[_0xd46e('0x38')](handleError(_0x5158e6,null));};exports[_0xd46e('0x3b')]=function(_0x42dbaf,_0xefe5f4){return db[_0xd46e('0x2d')][_0xd46e('0x37')]({'where':{'id':_0x42dbaf[_0xd46e('0x2a')]['id']}})['then'](handleEntityNotFound(_0xefe5f4,null))[_0xd46e('0x25')](removeEntity(_0xefe5f4,null))[_0xd46e('0x38')](handleError(_0xefe5f4,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 1dd2635..741f3ef 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 _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 +var _0xf2cc=['moment','bluebird','request-promise','path','rimraf','exports','ChatProactiveAction','chat_proactive_actions','util','api'];(function(_0x30bd2a,_0x3464cc){var _0x4b2160=function(_0x241f43){while(--_0x241f43){_0x30bd2a['push'](_0x30bd2a['shift']());}};_0x4b2160(++_0x3464cc);}(_0xf2cc,0x1f2));var _0xcf2c=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xf2cc[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require('lodash');var util=require(_0xcf2c('0x0'));var logger=require('../../config/logger')(_0xcf2c('0x1'));var moment=require(_0xcf2c('0x2'));var BPromise=require(_0xcf2c('0x3'));var rp=require(_0xcf2c('0x4'));var fs=require('fs');var path=require(_0xcf2c('0x5'));var rimraf=require(_0xcf2c('0x6'));var config=require('../../config/environment');var attributes=require('./chatProactiveAction.attributes');module[_0xcf2c('0x7')]=function(_0x47a231,_0x4e1aa4){return _0x47a231['define'](_0xcf2c('0x8'),attributes,{'tableName':_0xcf2c('0x9'),'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 5191233..290340f 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 _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 +var _0xc8af=['../../config/environment','jayson/promise','client','http','request','then','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xc8af,0x149));var _0xfc8a=function(_0x2a6691,_0x4730aa){_0x2a6691=_0x2a6691-0x0;var _0x41e9ec=_0xc8af[_0x2a6691];return _0x41e9ec;};'use strict';var _=require(_0xfc8a('0x0'));var util=require(_0xfc8a('0x1'));var moment=require(_0xfc8a('0x2'));var BPromise=require(_0xfc8a('0x3'));var rs=require(_0xfc8a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfc8a('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xfc8a('0x6'));var config=require(_0xfc8a('0x7'));var jayson=require(_0xfc8a('0x8'));var client=jayson[_0xfc8a('0x9')][_0xfc8a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ee83c,_0x3ae56f,_0x3ea13f){return new BPromise(function(_0x49daff,_0x328d3b){return client[_0xfc8a('0xb')](_0x3ee83c,_0x3ea13f)[_0xfc8a('0xc')](function(_0x11f201){logger['info'](_0xfc8a('0xd'),_0x3ae56f,_0xfc8a('0xe'));logger[_0xfc8a('0xf')](_0xfc8a('0x10'),_0x3ae56f,_0xfc8a('0xe'),JSON[_0xfc8a('0x11')](_0x11f201));if(_0x11f201[_0xfc8a('0x12')]){if(_0x11f201[_0xfc8a('0x12')][_0xfc8a('0x13')]===0x1f4){logger[_0xfc8a('0x12')](_0xfc8a('0xd'),_0x3ae56f,_0x11f201[_0xfc8a('0x12')][_0xfc8a('0x14')]);return _0x328d3b(_0x11f201[_0xfc8a('0x12')][_0xfc8a('0x14')]);}logger[_0xfc8a('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x3ae56f,_0x11f201[_0xfc8a('0x12')][_0xfc8a('0x14')]);return _0x49daff(_0x11f201['error'][_0xfc8a('0x14')]);}else{logger[_0xfc8a('0x15')](_0xfc8a('0xd'),_0x3ae56f,_0xfc8a('0xe'));_0x49daff(_0x11f201[_0xfc8a('0x16')][_0xfc8a('0x14')]);}})[_0xfc8a('0x17')](function(_0x1bfcfc){logger[_0xfc8a('0x12')](_0xfc8a('0xd'),_0x3ae56f,_0x1bfcfc);_0x328d3b(_0x1bfcfc);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index cfd992b..330315d 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 _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 +var _0xf2ca=['show','create','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated'];(function(_0x4252e5,_0x2c992f){var _0x220533=function(_0x12564b){while(--_0x12564b){_0x4252e5['push'](_0x4252e5['shift']());}};_0x220533(++_0x2c992f);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x23ca2f,_0x271c2b){_0x23ca2f=_0x23ca2f-0x0;var _0x4f4b51=_0xf2ca[_0x23ca2f];return _0x4f4b51;};'use strict';var multer=require(_0xaf2c('0x0'));var util=require(_0xaf2c('0x1'));var path=require(_0xaf2c('0x2'));var timeout=require('connect-timeout');var express=require(_0xaf2c('0x3'));var router=express[_0xaf2c('0x4')]();var fs_extra=require(_0xaf2c('0x5'));var auth=require(_0xaf2c('0x6'));var interaction=require(_0xaf2c('0x7'));var config=require(_0xaf2c('0x8'));var controller=require('./chatProactiveAction.controller');router[_0xaf2c('0x9')](_0xaf2c('0xa'),auth[_0xaf2c('0xb')](),controller[_0xaf2c('0xc')]);router['post']('/',auth[_0xaf2c('0xb')](),controller[_0xaf2c('0xd')]);router['put'](_0xaf2c('0xa'),auth['isAuthenticated'](),controller[_0xaf2c('0xe')]);router['delete'](_0xaf2c('0xa'),auth[_0xaf2c('0xb')](),controller[_0xaf2c('0xf')]);module[_0xaf2c('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index f8b0a6f..c152a5f 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 _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 +var _0x49aa=['rrmemory','beepall','roundrobin','exports','name','INTEGER','ENUM'];(function(_0x17d6a6,_0x29f38d){var _0x1593c1=function(_0x2ea3bc){while(--_0x2ea3bc){_0x17d6a6['push'](_0x17d6a6['shift']());}};_0x1593c1(++_0x29f38d);}(_0x49aa,0xe3));var _0xa49a=function(_0x56f94a,_0x46908b){_0x56f94a=_0x56f94a-0x0;var _0x2813bc=_0x49aa[_0x56f94a];return _0x2813bc;};'use strict';var Sequelize=require('sequelize');module[_0xa49a('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xa49a('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xa49a('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa49a('0x3')](_0xa49a('0x4'),_0xa49a('0x5'),_0xa49a('0x6'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 3aaa8d9..8b2a5b3 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 _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 +var _0x1dd6=['squel','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','./chatQueue.socket','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','get','ChatQueues','UserProfileResource','stack','name','index','map','rawAttributes','fieldName','type','key','getOptions','where','ChatQueue','include','query','rows','catch','show','keys','filters','intersection','model','attributes','fields','length','includeAll','merge','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','UserChatQueue','hasOwnProperty','nolimit','order','sort','ChatQueueId','filter','findAndCountAll','UserId','agent','updatedAt','createdAt','%s/%s','chatPause','getTeams','findOne','Team','pick','addTeams','ids','User','Agents','interface','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','findAll','field','tq.TeamId','from','team_has_chat_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','push','sequelize','QueryTypes','SELECT','TeamId','union','compact','value','transaction','isEmpty','removeAgents','addAgents','omit','spread','userChatQueue:remove','getAgents','bluebird','util','lodash'];(function(_0x3e7ced,_0x3d40e1){var _0x27e79b=function(_0x89fdbf){while(--_0x89fdbf){_0x3e7ced['push'](_0x3e7ced['shift']());}};_0x27e79b(++_0x3d40e1);}(_0x1dd6,0x165));var _0x61dd=function(_0x52f2ef,_0x10b33b){_0x52f2ef=_0x52f2ef-0x0;var _0x5ab00c=_0x1dd6[_0x52f2ef];return _0x5ab00c;};'use strict';var BPromise=require(_0x61dd('0x0'));var util=require(_0x61dd('0x1'));var _=require(_0x61dd('0x2'));var squel=require(_0x61dd('0x3'));var Redis=require('ioredis');var qs=require(_0x61dd('0x4'));var logger=require(_0x61dd('0x5'))(_0x61dd('0x6'));var config=require('../../config/environment');var db=require(_0x61dd('0x7'))['db'];config[_0x61dd('0x8')]=_[_0x61dd('0x9')](config['redis'],{'host':_0x61dd('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x61dd('0x8')]));require(_0x61dd('0xb'))['register'](socket);function respondWithStatusCode(_0x55d334,_0x21a39b){_0x21a39b=_0x21a39b||0xcc;return function(_0x58a77f){if(_0x58a77f){return _0x55d334[_0x61dd('0xc')](_0x21a39b);}return _0x55d334[_0x61dd('0xd')](_0x21a39b)[_0x61dd('0xe')]();};}function respondWithResult(_0x40d27f,_0x5b3c62){_0x5b3c62=_0x5b3c62||0xc8;return function(_0x48035d){if(_0x48035d){return _0x40d27f['status'](_0x5b3c62)[_0x61dd('0xf')](_0x48035d);}};}function respondWithFilteredResult(_0x20dca8,_0x590945){return function(_0x4d4a5a){if(_0x4d4a5a){var _0x421f78=typeof _0x590945['offset']===_0x61dd('0x10')&&typeof _0x590945[_0x61dd('0x11')]===_0x61dd('0x10');var _0x103459=_0x4d4a5a[_0x61dd('0x12')];var _0x22f7b1=_0x421f78?0x0:_0x590945[_0x61dd('0x13')];var _0x1d40d6=_0x421f78?_0x4d4a5a[_0x61dd('0x12')]:_0x590945['offset']+_0x590945['limit'];var _0x61de9c;if(_0x1d40d6>=_0x103459){_0x1d40d6=_0x103459;_0x61de9c=0xc8;}else{_0x61de9c=0xce;}_0x20dca8[_0x61dd('0xd')](_0x61de9c);return _0x20dca8[_0x61dd('0x14')](_0x61dd('0x15'),_0x22f7b1+'-'+_0x1d40d6+'/'+_0x103459)[_0x61dd('0xf')](_0x4d4a5a);}return null;};}function saveUpdates(_0x1165db){return function(_0x28f560){if(_0x28f560){return _0x28f560[_0x61dd('0x16')](_0x1165db)[_0x61dd('0x17')](function(_0x73cd74){return _0x73cd74;});}return null;};}function removeEntity(_0x172ad4){return function(_0x369899){if(_0x369899){return _0x369899[_0x61dd('0x18')]()[_0x61dd('0x17')](function(){var _0x160f09=_0x369899[_0x61dd('0x19')]({'plain':!![]});var _0x5b25fb=_0x61dd('0x1a');return db[_0x61dd('0x1b')][_0x61dd('0x18')]({'where':{'type':_0x5b25fb,'resourceId':_0x160f09['id']}})['then'](function(){return _0x369899;});})['then'](function(){_0x172ad4[_0x61dd('0xd')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ad644){return function(_0x4a7cd4){if(!_0x4a7cd4){_0x1ad644[_0x61dd('0xc')](0x194);}return _0x4a7cd4;};}function handleError(_0xc1a34b,_0x5b096c){_0x5b096c=_0x5b096c||0x1f4;return function(_0x5717b9){logger['error'](_0x5717b9[_0x61dd('0x1c')]);if(_0x5717b9[_0x61dd('0x1d')]){delete _0x5717b9[_0x61dd('0x1d')];}_0xc1a34b['status'](_0x5b096c)['send'](_0x5717b9);};}exports[_0x61dd('0x1e')]=function(_0x433d72,_0x51233e){var _0x3d1baf={};var _0x4176ee={'count':0x0,'rows':[]};var _0x48d7a6=_[_0x61dd('0x1f')](db['ChatQueue'][_0x61dd('0x20')],function(_0x59c9e6){return{'name':_0x59c9e6[_0x61dd('0x21')],'type':_0x59c9e6[_0x61dd('0x22')][_0x61dd('0x23')]};});_0x3d1baf=qs[_0x61dd('0x24')](_0x48d7a6,_0x433d72);var _0xe4491f={'where':_0x3d1baf[_0x61dd('0x25')]};return db[_0x61dd('0x26')][_0x61dd('0x12')](_0xe4491f)[_0x61dd('0x17')](function(_0x31e136){_0x4176ee[_0x61dd('0x12')]=_0x31e136;_0x3d1baf[_0x61dd('0x27')]=qs[_0x61dd('0x27')](_0x433d72[_0x61dd('0x28')]);return db[_0x61dd('0x26')]['findAll'](_0x3d1baf);})[_0x61dd('0x17')](function(_0x24b58a){_0x4176ee[_0x61dd('0x29')]=_0x24b58a;return _0x4176ee;})['then'](respondWithFilteredResult(_0x51233e,_0x3d1baf))[_0x61dd('0x2a')](handleError(_0x51233e,null));};exports[_0x61dd('0x2b')]=function(_0xf2e1db,_0x3ec9be){var _0x562cd8={'raw':!![],'where':{'id':_0xf2e1db['params']['id']}},_0x178104={};_0x178104['model']=_[_0x61dd('0x2c')](db['ChatQueue'][_0x61dd('0x20')]);_0x178104[_0x61dd('0x28')]=_['keys'](_0xf2e1db['query']);_0x178104[_0x61dd('0x2d')]=_[_0x61dd('0x2e')](_0x178104[_0x61dd('0x2f')],_0x178104[_0x61dd('0x28')]);_0x562cd8[_0x61dd('0x30')]=_[_0x61dd('0x2e')](_0x178104[_0x61dd('0x2f')],qs[_0x61dd('0x31')](_0xf2e1db['query'][_0x61dd('0x31')]));_0x562cd8[_0x61dd('0x30')]=_0x562cd8[_0x61dd('0x30')][_0x61dd('0x32')]?_0x562cd8[_0x61dd('0x30')]:_0x178104[_0x61dd('0x2f')];if(_0xf2e1db[_0x61dd('0x28')][_0x61dd('0x33')]){_0x562cd8['include']=[{'all':!![]}];}_0x562cd8=_[_0x61dd('0x34')]({},_0x562cd8,_0xf2e1db[_0x61dd('0x35')]);return db[_0x61dd('0x26')][_0x61dd('0x36')](_0x562cd8)[_0x61dd('0x17')](handleEntityNotFound(_0x3ec9be,null))[_0x61dd('0x17')](respondWithResult(_0x3ec9be,null))['catch'](handleError(_0x3ec9be,null));};exports[_0x61dd('0x37')]=function(_0x460361,_0x2ec98a){return db['ChatQueue']['create'](_0x460361[_0x61dd('0x38')],{})['then'](function(_0x39b94c){var _0x50d3dc=_0x460361['user']['get']({'plain':!![]});if(!_0x50d3dc)throw new Error(_0x61dd('0x39'));if(_0x50d3dc['role']===_0x61dd('0x3a')){var _0x150e18=_0x39b94c[_0x61dd('0x19')]({'plain':!![]});var _0x3459b3=_0x61dd('0x1a');return db[_0x61dd('0x3b')]['find']({'where':{'name':_0x3459b3,'userProfileId':_0x50d3dc[_0x61dd('0x3c')]},'raw':!![]})[_0x61dd('0x17')](function(_0x50ddd7){if(_0x50ddd7&&_0x50ddd7[_0x61dd('0x3d')]===0x0){return db[_0x61dd('0x1b')]['create']({'name':_0x150e18[_0x61dd('0x1d')],'resourceId':_0x150e18['id'],'type':_0x50ddd7[_0x61dd('0x1d')],'sectionId':_0x50ddd7['id']},{})['then'](function(){return _0x39b94c;});}else{return _0x39b94c;}})[_0x61dd('0x2a')](function(_0x53a7fe){logger[_0x61dd('0x3e')](_0x61dd('0x3f'),_0x53a7fe);throw _0x53a7fe;});}return _0x39b94c;})[_0x61dd('0x17')](respondWithResult(_0x2ec98a,0xc9))[_0x61dd('0x2a')](handleError(_0x2ec98a,null));};exports[_0x61dd('0x16')]=function(_0x118f56,_0x618b59){if(_0x118f56[_0x61dd('0x38')]['id']){delete _0x118f56['body']['id'];}return db[_0x61dd('0x26')][_0x61dd('0x36')]({'where':{'id':_0x118f56[_0x61dd('0x40')]['id']}})[_0x61dd('0x17')](handleEntityNotFound(_0x618b59,null))[_0x61dd('0x17')](saveUpdates(_0x118f56['body'],null))['then'](respondWithResult(_0x618b59,null))[_0x61dd('0x2a')](handleError(_0x618b59,null));};exports[_0x61dd('0x18')]=function(_0x4bf49e,_0x450bd5){return db[_0x61dd('0x26')][_0x61dd('0x36')]({'where':{'id':_0x4bf49e[_0x61dd('0x40')]['id']}})['then'](handleEntityNotFound(_0x450bd5,null))['then'](removeEntity(_0x450bd5,null))[_0x61dd('0x2a')](handleError(_0x450bd5,null));};exports[_0x61dd('0x41')]=function(_0x5bbc0a,_0x792963){return db[_0x61dd('0x26')][_0x61dd('0x41')]()[_0x61dd('0x17')](respondWithResult(_0x792963,null))[_0x61dd('0x2a')](handleError(_0x792963,null));};exports['getMembers']=function(_0x1ef0fc,_0x3fe7e1){var _0x7e3c36={'raw':!![],'where':{}},_0x325bf2={},_0x42b205;return db[_0x61dd('0x26')]['findOne']({'where':{'id':_0x1ef0fc['params']['id']}})['then'](handleEntityNotFound(_0x3fe7e1,null))[_0x61dd('0x17')](function(_0x2b74c8){if(_0x2b74c8){_0x42b205=_0x2b74c8[_0x61dd('0x19')]({'plain':!![]});_0x325bf2[_0x61dd('0x2f')]=_['keys'](db[_0x61dd('0x42')][_0x61dd('0x20')]);_0x325bf2[_0x61dd('0x28')]=_[_0x61dd('0x2c')](_0x1ef0fc[_0x61dd('0x28')]);_0x325bf2['filters']=_[_0x61dd('0x2e')](_0x325bf2[_0x61dd('0x2f')],_0x325bf2[_0x61dd('0x28')]);_0x7e3c36[_0x61dd('0x30')]=_[_0x61dd('0x2e')](_0x325bf2[_0x61dd('0x2f')],qs[_0x61dd('0x31')](_0x1ef0fc[_0x61dd('0x28')][_0x61dd('0x31')]));_0x7e3c36['attributes']=_0x7e3c36[_0x61dd('0x30')]['length']?_0x7e3c36[_0x61dd('0x30')]:_0x325bf2['model'];if(!_0x1ef0fc[_0x61dd('0x28')][_0x61dd('0x43')](_0x61dd('0x44'))){_0x7e3c36[_0x61dd('0x11')]=qs[_0x61dd('0x11')](_0x1ef0fc[_0x61dd('0x28')][_0x61dd('0x11')]);_0x7e3c36[_0x61dd('0x13')]=qs[_0x61dd('0x13')](_0x1ef0fc['query'][_0x61dd('0x13')]);}_0x7e3c36[_0x61dd('0x45')]=qs[_0x61dd('0x46')](_0x1ef0fc[_0x61dd('0x28')][_0x61dd('0x46')]);_0x7e3c36[_0x61dd('0x25')]=qs[_0x61dd('0x2d')](_['pick'](_0x1ef0fc[_0x61dd('0x28')],_0x325bf2[_0x61dd('0x2d')]));_0x7e3c36['where'][_0x61dd('0x47')]=_0x2b74c8['id'];if(_0x1ef0fc[_0x61dd('0x28')][_0x61dd('0x48')]){_0x7e3c36[_0x61dd('0x25')]=_[_0x61dd('0x34')](_0x7e3c36[_0x61dd('0x25')],{'$or':_[_0x61dd('0x1f')](_0x7e3c36[_0x61dd('0x30')],function(_0x579b80){var _0x19d0b2={};_0x19d0b2[_0x579b80]={'$like':'%'+_0x1ef0fc['query'][_0x61dd('0x48')]+'%'};return _0x19d0b2;})});}_0x7e3c36=_['merge']({},_0x7e3c36,_0x1ef0fc[_0x61dd('0x35')]);return db[_0x61dd('0x42')]['findAll'](_0x7e3c36);}})[_0x61dd('0x17')](function(_0x1045cc){if(_0x1045cc){return db['User'][_0x61dd('0x49')]({'where':{'id':_[_0x61dd('0x1f')](_0x1045cc,_0x61dd('0x4a')),'role':_0x61dd('0x4b')},'attributes':['id',_0x61dd('0x1d'),'chatPause',_0x61dd('0x4c'),_0x61dd('0x4d')]});}})['then'](function(_0x38e1bd){if(_0x38e1bd){return{'count':_0x38e1bd[_0x61dd('0x12')],'rows':_[_0x61dd('0x1f')](_0x38e1bd[_0x61dd('0x29')],function(_0x1607d1){return{'membername':_0x1607d1[_0x61dd('0x1d')],'UserId':_0x1607d1['id'],'queue_name':_0x42b205[_0x61dd('0x1d')],'ChatQueueId':_0x42b205['id'],'interface':util['format'](_0x61dd('0x4e'),'SIP',_0x1607d1[_0x61dd('0x1d')]),'penalty':0x0,'paused':_0x1607d1[_0x61dd('0x4f')],'createdAt':_0x1607d1[_0x61dd('0x4d')],'updatedAt':_0x1607d1[_0x61dd('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x61dd('0x17')](respondWithFilteredResult(_0x3fe7e1,_0x7e3c36))[_0x61dd('0x2a')](handleError(_0x3fe7e1,null));};exports[_0x61dd('0x50')]=function(_0x58d8fe,_0x3c7352){var _0x154fe9={};var _0x45a8f3={};var _0xeff673;var _0x4978db;return db['ChatQueue'][_0x61dd('0x51')]({'where':{'id':_0x58d8fe[_0x61dd('0x40')]['id']}})[_0x61dd('0x17')](handleEntityNotFound(_0x3c7352,null))[_0x61dd('0x17')](function(_0x2c4561){if(_0x2c4561){_0xeff673=_0x2c4561;_0x45a8f3[_0x61dd('0x2f')]=_[_0x61dd('0x2c')](db[_0x61dd('0x52')][_0x61dd('0x20')]);_0x45a8f3[_0x61dd('0x28')]=_['keys'](_0x58d8fe[_0x61dd('0x28')]);_0x45a8f3[_0x61dd('0x2d')]=_[_0x61dd('0x2e')](_0x45a8f3[_0x61dd('0x2f')],_0x45a8f3[_0x61dd('0x28')]);_0x154fe9['attributes']=_['intersection'](_0x45a8f3[_0x61dd('0x2f')],qs[_0x61dd('0x31')](_0x58d8fe[_0x61dd('0x28')][_0x61dd('0x31')]));_0x154fe9[_0x61dd('0x30')]=_0x154fe9[_0x61dd('0x30')][_0x61dd('0x32')]?_0x154fe9[_0x61dd('0x30')]:_0x45a8f3[_0x61dd('0x2f')];_0x154fe9[_0x61dd('0x45')]=qs[_0x61dd('0x46')](_0x58d8fe[_0x61dd('0x28')]['sort']);_0x154fe9[_0x61dd('0x25')]=qs[_0x61dd('0x2d')](_[_0x61dd('0x53')](_0x58d8fe[_0x61dd('0x28')],_0x45a8f3[_0x61dd('0x2d')]));if(_0x58d8fe[_0x61dd('0x28')][_0x61dd('0x48')]){_0x154fe9[_0x61dd('0x25')]=_[_0x61dd('0x34')](_0x154fe9[_0x61dd('0x25')],{'$or':_[_0x61dd('0x1f')](_0x154fe9[_0x61dd('0x30')],function(_0x491efe){var _0x47d4cd={};_0x47d4cd[_0x491efe]={'$like':'%'+_0x58d8fe[_0x61dd('0x28')][_0x61dd('0x48')]+'%'};return _0x47d4cd;})});}_0x154fe9=_[_0x61dd('0x34')]({},_0x154fe9,_0x58d8fe[_0x61dd('0x35')]);return _0xeff673[_0x61dd('0x50')](_0x154fe9);}})[_0x61dd('0x17')](function(_0x2ba043){if(_0x2ba043){_0x4978db=_0x2ba043[_0x61dd('0x32')];if(!_0x58d8fe[_0x61dd('0x28')][_0x61dd('0x43')](_0x61dd('0x44'))){_0x154fe9[_0x61dd('0x11')]=qs[_0x61dd('0x11')](_0x58d8fe[_0x61dd('0x28')][_0x61dd('0x11')]);_0x154fe9['offset']=qs['offset'](_0x58d8fe[_0x61dd('0x28')][_0x61dd('0x13')]);}return _0xeff673[_0x61dd('0x50')](_0x154fe9);}})[_0x61dd('0x17')](function(_0x36d53a){if(_0x36d53a){return _0x36d53a?{'count':_0x4978db,'rows':_0x36d53a}:null;}})['then'](respondWithResult(_0x3c7352,null))['catch'](handleError(_0x3c7352,null));};exports[_0x61dd('0x54')]=function(_0x5d1cc5,_0x2ef032){var _0x42cbd9=_0x5d1cc5[_0x61dd('0x38')][_0x61dd('0x55')];return db['Team']['findAll']({'where':{'id':_0x42cbd9},'attributes':['id'],'include':[{'model':db[_0x61dd('0x56')],'as':_0x61dd('0x57'),'attributes':['id',_0x61dd('0x1d'),'online','voicePause',_0x61dd('0x58')],'raw':!![]}]})['then'](function(_0xd833f4){if(_0xd833f4){var _0xc9532f=_['flatMap'](_0xd833f4,function(_0x159aa1){var _0x20087c=_0x159aa1['get']({'plain':!![]});return _0x20087c[_0x61dd('0x57')];});return db[_0x61dd('0x26')][_0x61dd('0x36')]({'where':{'id':_0x5d1cc5[_0x61dd('0x40')]['id']}})[_0x61dd('0x17')](function(_0x55f439){return db['sequelize']['transaction'](function(_0x1e63e7){return _0x55f439['addTeams'](_0x42cbd9,{'transaction':_0x1e63e7})[_0x61dd('0x17')](function(){return BPromise[_0x61dd('0x59')](_0xc9532f,function(_0x46bdbe){return db['UserChatQueue'][_0x61dd('0x5a')]({'where':{'UserId':_0x46bdbe['id'],'ChatQueueId':_0x5d1cc5[_0x61dd('0x40')]['id']},'transaction':_0x1e63e7});});})['then'](function(){_0xc9532f[_0x61dd('0x5b')](function(_0x34c439){socket[_0x61dd('0x5c')](_0x61dd('0x5d'),{'UserId':_0x34c439['id'],'ChatQueueId':_0x55f439['id']});});});});});}})[_0x61dd('0x17')](respondWithStatusCode(_0x2ef032,null))[_0x61dd('0x2a')](handleError(_0x2ef032,null));};exports[_0x61dd('0x5e')]=function(_0x3cd2c1,_0x258ca4){return db[_0x61dd('0x52')][_0x61dd('0x5f')]({'where':{'id':_0x3cd2c1[_0x61dd('0x28')][_0x61dd('0x55')]},'attributes':['id'],'include':[{'model':db[_0x61dd('0x56')],'as':_0x61dd('0x57'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x258ca4,null))[_0x61dd('0x17')](function(_0x229eb8){var _0x2da305=_[_0x61dd('0x1f')](_0x229eb8,'id');var _0x40677f=[];var _0x1ed3b6=[];var _0x59051e=squel['select']();_0x59051e[_0x61dd('0x60')](_0x61dd('0x61'))[_0x61dd('0x62')](_0x61dd('0x63'),'tq')['join'](_0x61dd('0x64'),'ut',_0x61dd('0x65'))[_0x61dd('0x25')](_0x61dd('0x66'),_0x3cd2c1[_0x61dd('0x40')]['id']);for(var _0x2559f3=0x0;_0x2559f3<_0x229eb8['length'];_0x2559f3+=0x1){let _0x2f12d4=_0x229eb8[_0x2559f3];for(var _0x46ac8f=0x0;_0x46ac8f<_0x2f12d4['Agents']['length'];_0x46ac8f+=0x1){let _0x793a81=_0x2f12d4['Agents'][_0x46ac8f];var _0x41ec66=_0x59051e[_0x61dd('0x67')]();_0x41ec66[_0x61dd('0x25')]('ut.UserId\x20=\x20?',_0x793a81['id']);_0x1ed3b6[_0x61dd('0x68')](db[_0x61dd('0x69')][_0x61dd('0x28')](_0x41ec66['toString'](),{'type':db['sequelize'][_0x61dd('0x6a')][_0x61dd('0x6b')]})['then'](function(_0x5569c3){if(_0x5569c3[_0x61dd('0x32')]===0x1){return _0x793a81['id'];}else{var _0x63f49e=_['every'](_[_0x61dd('0x1f')](_0x5569c3,_0x61dd('0x6c')),function(_0x553337){return _['includes'](_0x2da305,_0x553337);});if(_0x63f49e){return _0x793a81['id'];}}}));}}return BPromise['all'](_0x1ed3b6)[_0x61dd('0x17')](function(_0x257f4e){_0x40677f=_(_0x40677f)[_0x61dd('0x6d')](_0x257f4e)[_0x61dd('0x6e')]()[_0x61dd('0x6f')]();return db['ChatQueue']['find']({'where':{'id':_0x3cd2c1['params']['id']}})[_0x61dd('0x17')](function(_0x188738){return db['sequelize'][_0x61dd('0x70')](function(_0x3134c5){return _0x188738['removeTeams'](_0x3cd2c1[_0x61dd('0x28')][_0x61dd('0x55')],{'transaction':_0x3134c5})[_0x61dd('0x17')](function(){if(!_[_0x61dd('0x71')](_0x40677f)){return _0x188738[_0x61dd('0x72')](_0x40677f,{'transaction':_0x3134c5});}})['then'](function(){_0x40677f[_0x61dd('0x5b')](function(_0x5e5f2c){socket[_0x61dd('0x5c')]('userChatQueue:remove',{'UserId':_0x5e5f2c,'ChatQueueId':_0x188738['id']});});});});});});})[_0x61dd('0x17')](respondWithStatusCode(_0x258ca4,null))['catch'](handleError(_0x258ca4,null));};exports['addAgents']=function(_0x474e5c,_0x5da7f3){return db[_0x61dd('0x26')][_0x61dd('0x36')]({'where':{'id':_0x474e5c[_0x61dd('0x40')]['id']}})[_0x61dd('0x17')](handleEntityNotFound(_0x5da7f3,null))['then'](function(_0x4cab03){if(_0x4cab03){return _0x4cab03[_0x61dd('0x73')](_0x474e5c['body'][_0x61dd('0x55')],_[_0x61dd('0x74')](_0x474e5c[_0x61dd('0x38')],[_0x61dd('0x55'),'id'])||{})[_0x61dd('0x75')](function(_0x2a6cf2){for(var _0x2eb974=0x0;_0x2eb974<_0x474e5c[_0x61dd('0x38')][_0x61dd('0x55')]['length'];_0x2eb974+=0x1){socket['emit'](_0x61dd('0x5d'),{'UserId':Number(_0x474e5c[_0x61dd('0x38')][_0x61dd('0x55')][_0x2eb974]),'ChatQueueId':Number(_0x474e5c[_0x61dd('0x40')]['id'])});}return _0x2a6cf2;});}})[_0x61dd('0x17')](respondWithResult(_0x5da7f3,null))[_0x61dd('0x2a')](handleError(_0x5da7f3,null));};exports[_0x61dd('0x72')]=function(_0x350272,_0x250d8e){return db[_0x61dd('0x26')]['find']({'where':{'id':_0x350272[_0x61dd('0x40')]['id']}})['then'](handleEntityNotFound(_0x250d8e,null))['then'](function(_0x3b6489){if(_0x3b6489){return _0x3b6489['removeAgents'](_0x350272[_0x61dd('0x28')][_0x61dd('0x55')])['then'](function(){if(_['isArray'](_0x350272[_0x61dd('0x28')]['ids'])){for(var _0x1c178e=0x0;_0x1c178e<_0x350272[_0x61dd('0x28')][_0x61dd('0x55')][_0x61dd('0x32')];_0x1c178e+=0x1){socket[_0x61dd('0x5c')](_0x61dd('0x76'),{'UserId':Number(_0x350272[_0x61dd('0x28')]['ids'][_0x1c178e]),'ChatQueueId':Number(_0x350272[_0x61dd('0x40')]['id'])});}}else{socket[_0x61dd('0x5c')](_0x61dd('0x76'),{'UserId':Number(_0x350272[_0x61dd('0x28')][_0x61dd('0x55')]),'ChatQueueId':Number(_0x350272[_0x61dd('0x40')]['id'])});}});}})[_0x61dd('0x17')](respondWithStatusCode(_0x250d8e,null))[_0x61dd('0x2a')](handleError(_0x250d8e,null));};exports[_0x61dd('0x77')]=function(_0x411da6,_0x54e59d){var _0x5a710f={};var _0x4111df={};var _0x293b21;var _0x24f67f;return db[_0x61dd('0x26')]['findOne']({'where':{'id':_0x411da6[_0x61dd('0x40')]['id']}})[_0x61dd('0x17')](handleEntityNotFound(_0x54e59d,null))['then'](function(_0x4cbc1d){if(_0x4cbc1d){_0x293b21=_0x4cbc1d;_0x4111df['model']=_[_0x61dd('0x2c')](db[_0x61dd('0x56')][_0x61dd('0x20')]);_0x4111df[_0x61dd('0x28')]=_[_0x61dd('0x2c')](_0x411da6[_0x61dd('0x28')]);_0x4111df['filters']=_[_0x61dd('0x2e')](_0x4111df[_0x61dd('0x2f')],_0x4111df[_0x61dd('0x28')]);_0x5a710f['attributes']=_[_0x61dd('0x2e')](_0x4111df['model'],qs[_0x61dd('0x31')](_0x411da6['query'][_0x61dd('0x31')]));_0x5a710f[_0x61dd('0x30')]=_0x5a710f[_0x61dd('0x30')][_0x61dd('0x32')]?_0x5a710f[_0x61dd('0x30')]:_0x4111df['model'];_0x5a710f['order']=qs[_0x61dd('0x46')](_0x411da6[_0x61dd('0x28')][_0x61dd('0x46')]);_0x5a710f['where']=qs[_0x61dd('0x2d')](_[_0x61dd('0x53')](_0x411da6[_0x61dd('0x28')],_0x4111df[_0x61dd('0x2d')]));if(_0x411da6[_0x61dd('0x28')]['filter']){_0x5a710f[_0x61dd('0x25')]=_[_0x61dd('0x34')](_0x5a710f[_0x61dd('0x25')],{'$or':_[_0x61dd('0x1f')](_0x5a710f['attributes'],function(_0x30e9cb){var _0x2adda0={};_0x2adda0[_0x30e9cb]={'$like':'%'+_0x411da6['query'][_0x61dd('0x48')]+'%'};return _0x2adda0;})});}_0x5a710f=_[_0x61dd('0x34')]({},_0x5a710f,_0x411da6[_0x61dd('0x35')]);return _0x293b21['getAgents'](_0x5a710f);}})['then'](function(_0x5d8199){if(_0x5d8199){_0x24f67f=_0x5d8199[_0x61dd('0x32')];if(!_0x411da6[_0x61dd('0x28')]['hasOwnProperty']('nolimit')){_0x5a710f[_0x61dd('0x11')]=qs[_0x61dd('0x11')](_0x411da6[_0x61dd('0x28')][_0x61dd('0x11')]);_0x5a710f[_0x61dd('0x13')]=qs[_0x61dd('0x13')](_0x411da6['query'][_0x61dd('0x13')]);}return _0x293b21['getAgents'](_0x5a710f);}})[_0x61dd('0x17')](function(_0x2fdc34){if(_0x2fdc34){return _0x2fdc34?{'count':_0x24f67f,'rows':_0x2fdc34}:null;}})[_0x61dd('0x17')](respondWithResult(_0x54e59d,null))['catch'](handleError(_0x54e59d,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 5cceb8d..c371fc0 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 _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 +var _0x3ee0=['../../mysqldb','ChatQueue','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3ee0,0x12b));var _0x03ee=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x3ee0[_0x5b644e];return _0x49c6bf;};'use strict';var EventEmitter=require(_0x03ee('0x0'));var ChatQueue=require(_0x03ee('0x1'))['db'][_0x03ee('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x03ee('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x03ee('0x4'),'afterDestroy':_0x03ee('0x5')};function emitEvent(_0x2b8b9c){return function(_0x5cb700,_0x5a4435,_0x157ac6){ChatQueueEvents[_0x03ee('0x6')](_0x2b8b9c+':'+_0x5cb700['id'],_0x5cb700);ChatQueueEvents[_0x03ee('0x6')](_0x2b8b9c,_0x5cb700);_0x157ac6(null);};}for(var e in events){if(events[_0x03ee('0x7')](e)){var event=events[e];ChatQueue[_0x03ee('0x8')](e,emitEvent(event));}}module[_0x03ee('0x9')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 9ec7478..a102994 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 _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 +var _0xfbd6=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues'];(function(_0x1d778b,_0x29db01){var _0x582391=function(_0x2da835){while(--_0x2da835){_0x1d778b['push'](_0x1d778b['shift']());}};_0x582391(++_0x29db01);}(_0xfbd6,0x1d1));var _0x6fbd=function(_0x2faa6d,_0x4da71f){_0x2faa6d=_0x2faa6d-0x0;var _0x53099a=_0xfbd6[_0x2faa6d];return _0x53099a;};'use strict';var _=require(_0x6fbd('0x0'));var util=require(_0x6fbd('0x1'));var logger=require(_0x6fbd('0x2'))(_0x6fbd('0x3'));var moment=require(_0x6fbd('0x4'));var BPromise=require(_0x6fbd('0x5'));var rp=require(_0x6fbd('0x6'));var fs=require('fs');var path=require(_0x6fbd('0x7'));var rimraf=require(_0x6fbd('0x8'));var config=require(_0x6fbd('0x9'));var attributes=require(_0x6fbd('0xa'));module[_0x6fbd('0xb')]=function(_0x1c0b6c,_0x252c30){return _0x1c0b6c[_0x6fbd('0xc')](_0x6fbd('0xd'),attributes,{'tableName':_0x6fbd('0xe'),'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 9fb99d2..6bebfde 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 _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 +var _0xa184=['request','then','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','attributes','limit','include','model','map','find','where','ShowChatQueue','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./chatQueue.socket','register'];(function(_0x56b732,_0x203dd3){var _0x240caf=function(_0x2ffc5a){while(--_0x2ffc5a){_0x56b732['push'](_0x56b732['shift']());}};_0x240caf(++_0x203dd3);}(_0xa184,0x110));var _0x4a18=function(_0x568a61,_0x2124f8){_0x568a61=_0x568a61-0x0;var _0x334c3b=_0xa184[_0x568a61];return _0x334c3b;};'use strict';var _=require(_0x4a18('0x0'));var util=require(_0x4a18('0x1'));var moment=require(_0x4a18('0x2'));var BPromise=require(_0x4a18('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4a18('0x4'))['db'];var utils=require(_0x4a18('0x5'));var logger=require('../../config/logger')(_0x4a18('0x6'));var config=require(_0x4a18('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4a18('0x8')][_0x4a18('0x9')]({'port':0x232a});config[_0x4a18('0xa')]=_['defaults'](config[_0x4a18('0xa')],{'host':_0x4a18('0xb'),'port':0x18eb});var socket=require(_0x4a18('0xc'))(new Redis(config['redis']));require(_0x4a18('0xd'))[_0x4a18('0xe')](socket);function respondWithRpcPromise(_0x222e54,_0x156832,_0x88fc5c){return new BPromise(function(_0x3b7900,_0x4f326a){return client[_0x4a18('0xf')](_0x222e54,_0x88fc5c)[_0x4a18('0x10')](function(_0x41055e){logger['info'](_0x4a18('0x11'),_0x156832,_0x4a18('0x12'));logger[_0x4a18('0x13')](_0x4a18('0x14'),_0x156832,_0x4a18('0x12'),JSON[_0x4a18('0x15')](_0x41055e));if(_0x41055e[_0x4a18('0x16')]){if(_0x41055e[_0x4a18('0x16')][_0x4a18('0x17')]===0x1f4){logger['error'](_0x4a18('0x11'),_0x156832,_0x41055e[_0x4a18('0x16')][_0x4a18('0x18')]);return _0x4f326a(_0x41055e[_0x4a18('0x16')][_0x4a18('0x18')]);}logger['error'](_0x4a18('0x11'),_0x156832,_0x41055e[_0x4a18('0x16')]['message']);return _0x3b7900(_0x41055e[_0x4a18('0x16')]['message']);}else{logger[_0x4a18('0x19')](_0x4a18('0x11'),_0x156832,_0x4a18('0x12'));_0x3b7900(_0x41055e[_0x4a18('0x1a')][_0x4a18('0x18')]);}})[_0x4a18('0x1b')](function(_0x16bf39){logger['error'](_0x4a18('0x11'),_0x156832,_0x16bf39);_0x4f326a(_0x16bf39);});});}exports[_0x4a18('0x1c')]=function(_0x51ca74){var _0x38b97d=this;return new Promise(function(_0x20acfe,_0x38cae5){return db[_0x4a18('0x1d')][_0x4a18('0x1e')]({'raw':_0x51ca74[_0x4a18('0x1f')]?_0x51ca74[_0x4a18('0x1f')][_0x4a18('0x20')]===undefined?!![]:![]:!![],'where':_0x51ca74[_0x4a18('0x1f')]?_0x51ca74[_0x4a18('0x1f')]['where']||null:null,'attributes':_0x51ca74['options']?_0x51ca74[_0x4a18('0x1f')][_0x4a18('0x21')]||null:null,'limit':_0x51ca74[_0x4a18('0x1f')]?_0x51ca74['options'][_0x4a18('0x22')]||null:null,'include':_0x51ca74[_0x4a18('0x1f')]?_0x51ca74['options'][_0x4a18('0x23')]?_['map'](_0x51ca74[_0x4a18('0x1f')]['include'],function(_0x28bbee){return{'model':db[_0x28bbee[_0x4a18('0x24')]],'as':_0x28bbee['as'],'attributes':_0x28bbee[_0x4a18('0x21')],'include':_0x28bbee[_0x4a18('0x23')]?_[_0x4a18('0x25')](_0x28bbee['include'],function(_0x200f66){return{'model':db[_0x200f66[_0x4a18('0x24')]],'as':_0x200f66['as'],'attributes':_0x200f66[_0x4a18('0x21')],'include':_0x200f66[_0x4a18('0x23')]?_[_0x4a18('0x25')](_0x200f66[_0x4a18('0x23')],function(_0x59fd98){return{'model':db[_0x59fd98['model']],'as':_0x59fd98['as'],'attributes':_0x59fd98[_0x4a18('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3eea2b){logger['info'](_0x4a18('0x1c'),_0x51ca74);logger[_0x4a18('0x13')]('GetChatQueue',_0x51ca74,JSON[_0x4a18('0x15')](_0x3eea2b));_0x20acfe(_0x3eea2b);})[_0x4a18('0x1b')](function(_0x34fb38){logger[_0x4a18('0x16')]('GetChatQueue',_0x34fb38['message'],_0x51ca74);_0x38cae5(_0x38b97d[_0x4a18('0x16')](0x1f4,_0x34fb38[_0x4a18('0x18')]));});});};exports['ShowChatQueue']=function(_0x567da5){var _0x28f367=this;return new Promise(function(_0x477467,_0x5e835b){return db[_0x4a18('0x1d')][_0x4a18('0x26')]({'raw':_0x567da5[_0x4a18('0x1f')]?_0x567da5['options']['raw']===undefined?!![]:![]:!![],'where':_0x567da5['options']?_0x567da5[_0x4a18('0x1f')][_0x4a18('0x27')]||null:null,'attributes':_0x567da5[_0x4a18('0x1f')]?_0x567da5[_0x4a18('0x1f')][_0x4a18('0x21')]||null:null,'include':_0x567da5[_0x4a18('0x1f')]?_0x567da5[_0x4a18('0x1f')]['include']?_['map'](_0x567da5[_0x4a18('0x1f')][_0x4a18('0x23')],function(_0x59c037){return{'model':db[_0x59c037[_0x4a18('0x24')]],'as':_0x59c037['as'],'attributes':_0x59c037[_0x4a18('0x21')],'include':_0x59c037[_0x4a18('0x23')]?_[_0x4a18('0x25')](_0x59c037[_0x4a18('0x23')],function(_0x8421c9){return{'model':db[_0x8421c9['model']],'as':_0x8421c9['as'],'attributes':_0x8421c9['attributes'],'include':_0x8421c9[_0x4a18('0x23')]?_[_0x4a18('0x25')](_0x8421c9['include'],function(_0x21322c){return{'model':db[_0x21322c['model']],'as':_0x21322c['as'],'attributes':_0x21322c['attributes']};}):[]};}):[]};}):[]:[]})[_0x4a18('0x10')](function(_0xb8c39d){logger[_0x4a18('0x19')](_0x4a18('0x28'),_0x567da5);logger[_0x4a18('0x13')](_0x4a18('0x28'),_0x567da5,JSON['stringify'](_0xb8c39d));_0x477467(_0xb8c39d);})['catch'](function(_0x58dd2d){logger['error']('ShowChatQueue',_0x58dd2d[_0x4a18('0x18')],_0x567da5);_0x5e835b(_0x28f367[_0x4a18('0x16')](0x1f4,_0x58dd2d[_0x4a18('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index cb99caa..728f602 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 _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 +var _0x0c02=['save','remove','emit','removeListener','register','chatQueue:'];(function(_0x3b4922,_0x2fa365){var _0x239729=function(_0x82fd7){while(--_0x82fd7){_0x3b4922['push'](_0x3b4922['shift']());}};_0x239729(++_0x2fa365);}(_0x0c02,0x84));var _0x20c0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c02[_0x3dd15e];return _0x231fd0;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0x20c0('0x0'),_0x20c0('0x1'),'update'];function createListener(_0x1338cf,_0x5c8750){return function(_0x454922){_0x5c8750[_0x20c0('0x2')](_0x1338cf,_0x454922);};}function removeListener(_0x38022e,_0x2e9d65){return function(){ChatQueueEvents[_0x20c0('0x3')](_0x38022e,_0x2e9d65);};}exports[_0x20c0('0x4')]=function(_0x13312d){for(var _0xd25ee8=0x0,_0x5d6408=events['length'];_0xd25ee8<_0x5d6408;_0xd25ee8++){var _0x5da127=events[_0xd25ee8];var _0x4db532=createListener(_0x20c0('0x5')+_0x5da127,_0x13312d);ChatQueueEvents['on'](_0x5da127,_0x4db532);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 4b5461e..283cad7 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 _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 +var _0x55ca=['post','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','index','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','addTeams'];(function(_0x5bf9b7,_0x58ab9d){var _0xd6d3a6=function(_0x23ab1d){while(--_0x23ab1d){_0x5bf9b7['push'](_0x5bf9b7['shift']());}};_0xd6d3a6(++_0x58ab9d);}(_0x55ca,0x126));var _0xa55c=function(_0x5125cd,_0x1acb11){_0x5125cd=_0x5125cd-0x0;var _0x25777e=_0x55ca[_0x5125cd];return _0x25777e;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/describe',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['show']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getAgents']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/teams',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x13')]);router['put'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router[_0xa55c('0x15')](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x16')]);router[_0xa55c('0x15')](_0xa55c('0xe'),auth['isAuthenticated'](),controller[_0xa55c('0x17')]);router[_0xa55c('0x15')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x18')]);module[_0xa55c('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index f85332d..6ade586 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 _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 +var _0xe953=['DATE'];(function(_0x5e0ec2,_0x2dac8a){var _0x58d76f=function(_0x4c57fb){while(--_0x4c57fb){_0x5e0ec2['push'](_0x5e0ec2['shift']());}};_0x58d76f(++_0x2dac8a);}(_0xe953,0x1d0));var _0x3e95=function(_0x4eafed,_0x26e2bc){_0x4eafed=_0x4eafed-0x0;var _0x159c85=_0xe953[_0x4eafed];return _0x159c85;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x3e95('0x0')]},'leaveAt':{'type':Sequelize[_0x3e95('0x0')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x3e95('0x0')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 4e6dbfb..e7bf529 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 _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 +var _0x9541=['nolimit','order','sort','where','pick','filter','merge','includeAll','findAll','show','params','length','include','options','find','catch','create','body','describe','eml-format','rimraf','zip-dir','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/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty'];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_0x9541,0xb3));var _0x1954=function(_0x3de095,_0x542d0b){_0x3de095=_0x3de095-0x0;var _0x29f1eb=_0x9541[_0x3de095];return _0x29f1eb;};'use strict';var emlformat=require(_0x1954('0x0'));var rimraf=require(_0x1954('0x1'));var zipdir=require(_0x1954('0x2'));var jsonpatch=require(_0x1954('0x3'));var rp=require(_0x1954('0x4'));var moment=require(_0x1954('0x5'));var BPromise=require(_0x1954('0x6'));var Mustache=require(_0x1954('0x7'));var util=require('util');var path=require('path');var sox=require(_0x1954('0x8'));var csv=require(_0x1954('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1954('0xa'));var _=require(_0x1954('0xb'));var squel=require(_0x1954('0xc'));var crypto=require(_0x1954('0xd'));var jsforce=require(_0x1954('0xe'));var deskjs=require(_0x1954('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1954('0x10'));var Papa=require(_0x1954('0x11'));var Redis=require(_0x1954('0x12'));var authService=require(_0x1954('0x13'));var qs=require(_0x1954('0x14'));var as=require(_0x1954('0x15'));var hardwareService=require(_0x1954('0x16'));var logger=require(_0x1954('0x17'))('api');var utils=require(_0x1954('0x18'));var config=require(_0x1954('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x1954('0x1a'))['db'];function respondWithStatusCode(_0x5e8400,_0x289155){_0x289155=_0x289155||0xcc;return function(_0x4dc96b){if(_0x4dc96b){return _0x5e8400['sendStatus'](_0x289155);}return _0x5e8400['status'](_0x289155)[_0x1954('0x1b')]();};}function respondWithResult(_0x1b33cb,_0x96906a){_0x96906a=_0x96906a||0xc8;return function(_0x520dc7){if(_0x520dc7){return _0x1b33cb[_0x1954('0x1c')](_0x96906a)['json'](_0x520dc7);}};}function respondWithFilteredResult(_0x5daee1,_0xaeb0e3){return function(_0xf43d28){if(_0xf43d28){var _0x36565c=typeof _0xaeb0e3[_0x1954('0x1d')]===_0x1954('0x1e')&&typeof _0xaeb0e3[_0x1954('0x1f')]===_0x1954('0x1e');var _0x46b400=_0xf43d28[_0x1954('0x20')];var _0xb9c2cd=_0x36565c?0x0:_0xaeb0e3[_0x1954('0x1d')];var _0x3da757=_0x36565c?_0xf43d28[_0x1954('0x20')]:_0xaeb0e3[_0x1954('0x1d')]+_0xaeb0e3[_0x1954('0x1f')];var _0x4503d7;if(_0x3da757>=_0x46b400){_0x3da757=_0x46b400;_0x4503d7=0xc8;}else{_0x4503d7=0xce;}_0x5daee1[_0x1954('0x1c')](_0x4503d7);return _0x5daee1[_0x1954('0x21')](_0x1954('0x22'),_0xb9c2cd+'-'+_0x3da757+'/'+_0x46b400)[_0x1954('0x23')](_0xf43d28);}return null;};}function patchUpdates(_0x5e20b8){return function(_0x2105d5){try{jsonpatch[_0x1954('0x24')](_0x2105d5,_0x5e20b8,!![]);}catch(_0x3a84c0){return BPromise[_0x1954('0x25')](_0x3a84c0);}return _0x2105d5[_0x1954('0x26')]();};}function saveUpdates(_0x5e549f,_0x61107d){return function(_0x15dd0b){if(_0x15dd0b){return _0x15dd0b[_0x1954('0x27')](_0x5e549f)[_0x1954('0x28')](function(_0x6d8a2){return _0x6d8a2;});}return null;};}function removeEntity(_0x5a7256,_0x4d1b25){return function(_0x18a883){if(_0x18a883){return _0x18a883[_0x1954('0x29')]()[_0x1954('0x28')](function(){_0x5a7256[_0x1954('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21f395,_0x26484f){return function(_0x27dc66){if(!_0x27dc66){_0x21f395[_0x1954('0x2a')](0x194);}return _0x27dc66;};}function handleError(_0x3f06de,_0x1bfa18){_0x1bfa18=_0x1bfa18||0x1f4;return function(_0x46fdc1){logger['error'](_0x46fdc1[_0x1954('0x2b')]);if(_0x46fdc1[_0x1954('0x2c')]){delete _0x46fdc1['name'];}_0x3f06de[_0x1954('0x1c')](_0x1bfa18)[_0x1954('0x2d')](_0x46fdc1);};}exports[_0x1954('0x2e')]=function(_0x3a488b,_0x1d8f32){var _0x251386={},_0x41b143={},_0x41c850={'count':0x0,'rows':[]};var _0xde7055=_[_0x1954('0x2f')](db[_0x1954('0x30')][_0x1954('0x31')],function(_0x40da25){return{'name':_0x40da25[_0x1954('0x32')],'type':_0x40da25[_0x1954('0x33')][_0x1954('0x34')]};});_0x41b143[_0x1954('0x35')]=_[_0x1954('0x2f')](_0xde7055,_0x1954('0x2c'));_0x41b143[_0x1954('0x36')]=_[_0x1954('0x37')](_0x3a488b[_0x1954('0x36')]);_0x41b143[_0x1954('0x38')]=_[_0x1954('0x39')](_0x41b143['model'],_0x41b143['query']);_0x251386[_0x1954('0x3a')]=_['intersection'](_0x41b143[_0x1954('0x35')],qs[_0x1954('0x3b')](_0x3a488b['query'][_0x1954('0x3b')]));_0x251386[_0x1954('0x3a')]=_0x251386['attributes']['length']?_0x251386[_0x1954('0x3a')]:_0x41b143[_0x1954('0x35')];if(!_0x3a488b[_0x1954('0x36')][_0x1954('0x3c')](_0x1954('0x3d'))){_0x251386[_0x1954('0x1f')]=qs[_0x1954('0x1f')](_0x3a488b['query']['limit']);_0x251386[_0x1954('0x1d')]=qs[_0x1954('0x1d')](_0x3a488b[_0x1954('0x36')][_0x1954('0x1d')]);}_0x251386[_0x1954('0x3e')]=qs[_0x1954('0x3f')](_0x3a488b['query'][_0x1954('0x3f')]);_0x251386[_0x1954('0x40')]=qs['filters'](_[_0x1954('0x41')](_0x3a488b[_0x1954('0x36')],_0x41b143['filters']),_0xde7055);if(_0x3a488b['query'][_0x1954('0x42')]){_0x251386[_0x1954('0x40')]=_['merge'](_0x251386[_0x1954('0x40')],{'$or':_[_0x1954('0x2f')](_0xde7055,function(_0x13725c){if(_0x13725c[_0x1954('0x33')]!=='VIRTUAL'){var _0x339b28={};_0x339b28[_0x13725c['name']]={'$like':'%'+_0x3a488b[_0x1954('0x36')][_0x1954('0x42')]+'%'};return _0x339b28;}})});}_0x251386=_[_0x1954('0x43')]({},_0x251386,_0x3a488b['options']);var _0x1c2f3={'where':_0x251386[_0x1954('0x40')]};return db[_0x1954('0x30')][_0x1954('0x20')](_0x1c2f3)[_0x1954('0x28')](function(_0x517492){_0x41c850[_0x1954('0x20')]=_0x517492;if(_0x3a488b['query'][_0x1954('0x44')]){_0x251386['include']=[{'all':!![]}];}return db[_0x1954('0x30')][_0x1954('0x45')](_0x251386);})[_0x1954('0x28')](function(_0x4334f9){_0x41c850['rows']=_0x4334f9;return _0x41c850;})[_0x1954('0x28')](respondWithFilteredResult(_0x1d8f32,_0x251386))['catch'](handleError(_0x1d8f32,null));};exports[_0x1954('0x46')]=function(_0x1435d6,_0x59c4cb){var _0x1dede8={'raw':!![],'where':{'id':_0x1435d6[_0x1954('0x47')]['id']}},_0x45f70e={};_0x45f70e[_0x1954('0x35')]=_[_0x1954('0x37')](db[_0x1954('0x30')][_0x1954('0x31')]);_0x45f70e[_0x1954('0x36')]=_[_0x1954('0x37')](_0x1435d6['query']);_0x45f70e['filters']=_['intersection'](_0x45f70e[_0x1954('0x35')],_0x45f70e['query']);_0x1dede8[_0x1954('0x3a')]=_[_0x1954('0x39')](_0x45f70e[_0x1954('0x35')],qs[_0x1954('0x3b')](_0x1435d6[_0x1954('0x36')][_0x1954('0x3b')]));_0x1dede8[_0x1954('0x3a')]=_0x1dede8[_0x1954('0x3a')][_0x1954('0x48')]?_0x1dede8['attributes']:_0x45f70e['model'];if(_0x1435d6[_0x1954('0x36')]['includeAll']){_0x1dede8[_0x1954('0x49')]=[{'all':!![]}];}_0x1dede8=_['merge']({},_0x1dede8,_0x1435d6[_0x1954('0x4a')]);return db[_0x1954('0x30')][_0x1954('0x4b')](_0x1dede8)[_0x1954('0x28')](handleEntityNotFound(_0x59c4cb,null))[_0x1954('0x28')](respondWithResult(_0x59c4cb,null))[_0x1954('0x4c')](handleError(_0x59c4cb,null));};exports[_0x1954('0x4d')]=function(_0x15ff45,_0x15295e){return db[_0x1954('0x30')]['create'](_0x15ff45[_0x1954('0x4e')],{})[_0x1954('0x28')](respondWithResult(_0x15295e,0xc9))[_0x1954('0x4c')](handleError(_0x15295e,null));};exports[_0x1954('0x27')]=function(_0x510b62,_0x1cd2dd){if(_0x510b62[_0x1954('0x4e')]['id']){delete _0x510b62['body']['id'];}return db[_0x1954('0x30')]['find']({'where':{'id':_0x510b62[_0x1954('0x47')]['id']}})[_0x1954('0x28')](handleEntityNotFound(_0x1cd2dd,null))[_0x1954('0x28')](saveUpdates(_0x510b62[_0x1954('0x4e')],null))[_0x1954('0x28')](respondWithResult(_0x1cd2dd,null))[_0x1954('0x4c')](handleError(_0x1cd2dd,null));};exports[_0x1954('0x29')]=function(_0x49003e,_0x1b4557){return db['ChatQueueReport'][_0x1954('0x4b')]({'where':{'id':_0x49003e[_0x1954('0x47')]['id']}})[_0x1954('0x28')](handleEntityNotFound(_0x1b4557,null))['then'](removeEntity(_0x1b4557,null))[_0x1954('0x4c')](handleError(_0x1b4557,null));};exports[_0x1954('0x4f')]=function(_0x37eec3,_0x359692){return db[_0x1954('0x30')]['describe']()[_0x1954('0x28')](respondWithResult(_0x359692,null))[_0x1954('0x4c')](handleError(_0x359692,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 3a8942f..0387a8d 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['define','ChatQueueReport','report_chat_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports'];(function(_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 +var _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','define','ChatQueueReport','uniqueid','lodash'];(function(_0x14ddff,_0x30d668){var _0x5f4106=function(_0x533cb9){while(--_0x533cb9){_0x14ddff['push'](_0x14ddff['shift']());}};_0x5f4106(++_0x30d668);}(_0xb7e7,0x121));var _0x7b7e=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0xb7e7[_0x166d93];return _0xba708;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 7a3821b..0c23465 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 _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 +var _0x1729=['limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueueReport,\x20%s,\x20%s','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','UpdateChatQueueReport','where','attributes'];(function(_0x31b6a2,_0x110158){var _0x28bda1=function(_0x3315a4){while(--_0x3315a4){_0x31b6a2['push'](_0x31b6a2['shift']());}};_0x28bda1(++_0x110158);}(_0x1729,0x111));var _0x9172=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x1729[_0x5f0089];return _0x193892;};'use strict';var _=require(_0x9172('0x0'));var util=require(_0x9172('0x1'));var moment=require('moment');var BPromise=require(_0x9172('0x2'));var rs=require(_0x9172('0x3'));var fs=require('fs');var Redis=require(_0x9172('0x4'));var db=require(_0x9172('0x5'))['db'];var utils=require(_0x9172('0x6'));var logger=require(_0x9172('0x7'))(_0x9172('0x8'));var config=require(_0x9172('0x9'));var jayson=require(_0x9172('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x145561,_0x3e11a9,_0x5ac2c3){return new BPromise(function(_0x4ff2d1,_0x41f4a1){return client[_0x9172('0xb')](_0x145561,_0x5ac2c3)[_0x9172('0xc')](function(_0x216465){logger[_0x9172('0xd')]('ChatQueueReport,\x20%s,\x20%s',_0x3e11a9,_0x9172('0xe'));logger[_0x9172('0xf')](_0x9172('0x10'),_0x3e11a9,_0x9172('0xe'),JSON[_0x9172('0x11')](_0x216465));if(_0x216465[_0x9172('0x12')]){if(_0x216465[_0x9172('0x12')][_0x9172('0x13')]===0x1f4){logger[_0x9172('0x12')](_0x9172('0x14'),_0x3e11a9,_0x216465[_0x9172('0x12')][_0x9172('0x15')]);return _0x41f4a1(_0x216465[_0x9172('0x12')][_0x9172('0x15')]);}logger['error'](_0x9172('0x14'),_0x3e11a9,_0x216465[_0x9172('0x12')][_0x9172('0x15')]);return _0x4ff2d1(_0x216465[_0x9172('0x12')]['message']);}else{logger[_0x9172('0xd')](_0x9172('0x14'),_0x3e11a9,'request\x20sent');_0x4ff2d1(_0x216465[_0x9172('0x16')][_0x9172('0x15')]);}})[_0x9172('0x17')](function(_0x3a15f9){logger['error'](_0x9172('0x14'),_0x3e11a9,_0x3a15f9);_0x41f4a1(_0x3a15f9);});});}exports[_0x9172('0x18')]=function(_0x488114){var _0x290f82=this;return new Promise(function(_0x4e6bc1,_0x5a7eaf){return db[_0x9172('0x19')][_0x9172('0x1a')](_0x488114[_0x9172('0x1b')],{'raw':_0x488114[_0x9172('0x1c')]?_0x488114[_0x9172('0x1c')][_0x9172('0x1d')]===undefined?!![]:![]:!![]})[_0x9172('0xc')](function(_0x38f467){logger[_0x9172('0xd')]('CreateChatQueueReport',_0x488114);logger[_0x9172('0xf')]('CreateChatQueueReport',_0x488114,JSON[_0x9172('0x11')](_0x38f467));_0x4e6bc1(_0x38f467);})[_0x9172('0x17')](function(_0x391d05){logger[_0x9172('0x12')](_0x9172('0x18'),_0x391d05[_0x9172('0x15')],_0x488114);_0x5a7eaf(_0x290f82[_0x9172('0x12')](0x1f4,_0x391d05[_0x9172('0x15')]));});});};exports[_0x9172('0x1e')]=function(_0x57cc13){var _0x21ed05=this;return new Promise(function(_0x4c4bec,_0x2e300c){return db[_0x9172('0x19')]['update'](_0x57cc13[_0x9172('0x1b')],{'raw':_0x57cc13[_0x9172('0x1c')]?_0x57cc13[_0x9172('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x57cc13[_0x9172('0x1c')]?_0x57cc13[_0x9172('0x1c')][_0x9172('0x1f')]||null:null,'attributes':_0x57cc13[_0x9172('0x1c')]?_0x57cc13['options'][_0x9172('0x20')]||null:null,'limit':_0x57cc13[_0x9172('0x1c')]?_0x57cc13['options'][_0x9172('0x21')]||null:null})[_0x9172('0xc')](function(_0x593f60){logger[_0x9172('0xd')](_0x9172('0x1e'),_0x57cc13);logger['debug'](_0x9172('0x1e'),_0x57cc13,JSON[_0x9172('0x11')](_0x593f60));_0x4c4bec(_0x593f60);})['catch'](function(_0x24fc14){logger[_0x9172('0x12')]('UpdateChatQueueReport',_0x24fc14[_0x9172('0x15')],_0x57cc13);_0x2e300c(_0x21ed05['error'](0x1f4,_0x24fc14[_0x9172('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index bf4ddb5..f116687 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 _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 +var _0xc476=['path','express','Router','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','create','put','delete','destroy','exports','multer','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc476,0x1d9));var _0x6c47=function(_0x3b7a19,_0xeeeb06){_0x3b7a19=_0x3b7a19-0x0;var _0x970876=_0xc476[_0x3b7a19];return _0x970876;};'use strict';var multer=require(_0x6c47('0x0'));var util=require(_0x6c47('0x1'));var path=require(_0x6c47('0x2'));var timeout=require('connect-timeout');var express=require(_0x6c47('0x3'));var router=express[_0x6c47('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6c47('0x5'));var config=require(_0x6c47('0x6'));var controller=require(_0x6c47('0x7'));router[_0x6c47('0x8')]('/',auth[_0x6c47('0x9')](),controller['index']);router[_0x6c47('0x8')](_0x6c47('0xa'),auth[_0x6c47('0x9')](),controller[_0x6c47('0xb')]);router[_0x6c47('0x8')](_0x6c47('0xc'),auth[_0x6c47('0x9')](),controller[_0x6c47('0xd')]);router['post']('/',auth[_0x6c47('0x9')](),controller[_0x6c47('0xe')]);router[_0x6c47('0xf')](_0x6c47('0xc'),auth[_0x6c47('0x9')](),controller['update']);router[_0x6c47('0x10')](_0x6c47('0xc'),auth[_0x6c47('0x9')](),controller[_0x6c47('0x11')]);module[_0x6c47('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 0b65ee0..9bc2deb 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 _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 +var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x1f115d,_0x31c6f3){var _0x53da39=function(_0xbc360f){while(--_0xbc360f){_0x1f115d['push'](_0x1f115d['shift']());}};_0x53da39(++_0x31c6f3);}(_0xedd9,0xfc));var _0x9edd=function(_0x38fa77,_0x1aaaa8){_0x38fa77=_0x38fa77-0x0;var _0x32d69b=_0xedd9[_0x38fa77];return _0x32d69b;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index a5478ab..58c72ed 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 _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 +var _0x1e73=['then','stack','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','show','params','fields','catch','create','body','find','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','apply','reject','save','update'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x1e73,0x1e3));var _0x31e7=function(_0x18d5d7,_0x19074b){_0x18d5d7=_0x18d5d7-0x0;var _0x30a9ea=_0x1e73[_0x18d5d7];return _0x30a9ea;};'use strict';var emlformat=require(_0x31e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x31e7('0x1'));var jsonpatch=require(_0x31e7('0x2'));var rp=require(_0x31e7('0x3'));var moment=require(_0x31e7('0x4'));var BPromise=require(_0x31e7('0x5'));var Mustache=require('mustache');var util=require(_0x31e7('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x31e7('0x7'));var ejs=require(_0x31e7('0x8'));var fs=require('fs');var fs_extra=require(_0x31e7('0x9'));var _=require(_0x31e7('0xa'));var squel=require(_0x31e7('0xb'));var crypto=require(_0x31e7('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x31e7('0xd'));var toCsv=require(_0x31e7('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x31e7('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x31e7('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x31e7('0x10'))(_0x31e7('0x11'));var utils=require(_0x31e7('0x12'));var config=require(_0x31e7('0x13'));var licenseUtil=require(_0x31e7('0x14'));var db=require(_0x31e7('0x15'))['db'];function respondWithStatusCode(_0x68454a,_0x53ac1a){_0x53ac1a=_0x53ac1a||0xcc;return function(_0x180c43){if(_0x180c43){return _0x68454a[_0x31e7('0x16')](_0x53ac1a);}return _0x68454a[_0x31e7('0x17')](_0x53ac1a)[_0x31e7('0x18')]();};}function respondWithResult(_0x32744c,_0x2851d2){_0x2851d2=_0x2851d2||0xc8;return function(_0x48778b){if(_0x48778b){return _0x32744c[_0x31e7('0x17')](_0x2851d2)['json'](_0x48778b);}};}function respondWithFilteredResult(_0x4ded61,_0x195d74){return function(_0x3d4014){if(_0x3d4014){var _0x6f90d=typeof _0x195d74[_0x31e7('0x19')]===_0x31e7('0x1a')&&typeof _0x195d74['limit']===_0x31e7('0x1a');var _0xc67bb2=_0x3d4014[_0x31e7('0x1b')];var _0x4ec034=_0x6f90d?0x0:_0x195d74[_0x31e7('0x19')];var _0x31acb6=_0x6f90d?_0x3d4014['count']:_0x195d74[_0x31e7('0x19')]+_0x195d74[_0x31e7('0x1c')];var _0x501fca;if(_0x31acb6>=_0xc67bb2){_0x31acb6=_0xc67bb2;_0x501fca=0xc8;}else{_0x501fca=0xce;}_0x4ded61['status'](_0x501fca);return _0x4ded61['set'](_0x31e7('0x1d'),_0x4ec034+'-'+_0x31acb6+'/'+_0xc67bb2)[_0x31e7('0x1e')](_0x3d4014);}return null;};}function patchUpdates(_0x43db3a){return function(_0x349011){try{jsonpatch[_0x31e7('0x1f')](_0x349011,_0x43db3a,!![]);}catch(_0x217539){return BPromise[_0x31e7('0x20')](_0x217539);}return _0x349011[_0x31e7('0x21')]();};}function saveUpdates(_0x1a49ba,_0x42b4a6){return function(_0x3c7715){if(_0x3c7715){return _0x3c7715[_0x31e7('0x22')](_0x1a49ba)[_0x31e7('0x23')](function(_0x47c934){return _0x47c934;});}return null;};}function removeEntity(_0x3de8aa,_0x1d6bfe){return function(_0x26a12d){if(_0x26a12d){return _0x26a12d['destroy']()[_0x31e7('0x23')](function(){_0x3de8aa['status'](0xcc)[_0x31e7('0x18')]();});}};}function handleEntityNotFound(_0x634fa4,_0x4fc940){return function(_0x5571c6){if(!_0x5571c6){_0x634fa4[_0x31e7('0x16')](0x194);}return _0x5571c6;};}function handleError(_0x250e6e,_0x5b6cf0){_0x5b6cf0=_0x5b6cf0||0x1f4;return function(_0x52a7e0){logger['error'](_0x52a7e0[_0x31e7('0x24')]);if(_0x52a7e0[_0x31e7('0x25')]){delete _0x52a7e0[_0x31e7('0x25')];}_0x250e6e['status'](_0x5b6cf0)[_0x31e7('0x26')](_0x52a7e0);};}exports[_0x31e7('0x27')]=function(_0x480e72,_0x3c26ee){var _0x39d276={},_0x87bc48={},_0x571025={'count':0x0,'rows':[]};var _0x26f7c3=_[_0x31e7('0x28')](db[_0x31e7('0x29')][_0x31e7('0x2a')],function(_0x42cc09){return{'name':_0x42cc09[_0x31e7('0x2b')],'type':_0x42cc09[_0x31e7('0x2c')][_0x31e7('0x2d')]};});_0x87bc48[_0x31e7('0x2e')]=_['map'](_0x26f7c3,'name');_0x87bc48[_0x31e7('0x2f')]=_[_0x31e7('0x30')](_0x480e72[_0x31e7('0x2f')]);_0x87bc48[_0x31e7('0x31')]=_['intersection'](_0x87bc48['model'],_0x87bc48[_0x31e7('0x2f')]);_0x39d276[_0x31e7('0x32')]=_[_0x31e7('0x33')](_0x87bc48['model'],qs['fields'](_0x480e72[_0x31e7('0x2f')]['fields']));_0x39d276[_0x31e7('0x32')]=_0x39d276[_0x31e7('0x32')][_0x31e7('0x34')]?_0x39d276[_0x31e7('0x32')]:_0x87bc48[_0x31e7('0x2e')];if(!_0x480e72['query'][_0x31e7('0x35')](_0x31e7('0x36'))){_0x39d276[_0x31e7('0x1c')]=qs[_0x31e7('0x1c')](_0x480e72['query'][_0x31e7('0x1c')]);_0x39d276[_0x31e7('0x19')]=qs[_0x31e7('0x19')](_0x480e72['query'][_0x31e7('0x19')]);}_0x39d276[_0x31e7('0x37')]=qs['sort'](_0x480e72[_0x31e7('0x2f')][_0x31e7('0x38')]);_0x39d276[_0x31e7('0x39')]=qs[_0x31e7('0x31')](_[_0x31e7('0x3a')](_0x480e72[_0x31e7('0x2f')],_0x87bc48[_0x31e7('0x31')]),_0x26f7c3);if(_0x480e72[_0x31e7('0x2f')][_0x31e7('0x3b')]){_0x39d276[_0x31e7('0x39')]=_[_0x31e7('0x3c')](_0x39d276['where'],{'$or':_[_0x31e7('0x28')](_0x26f7c3,function(_0x3a27d9){if(_0x3a27d9[_0x31e7('0x2c')]!==_0x31e7('0x3d')){var _0x3aa0c5={};_0x3aa0c5[_0x3a27d9[_0x31e7('0x25')]]={'$like':'%'+_0x480e72['query'][_0x31e7('0x3b')]+'%'};return _0x3aa0c5;}})});}_0x39d276=_[_0x31e7('0x3c')]({},_0x39d276,_0x480e72[_0x31e7('0x3e')]);var _0x310af0={'where':_0x39d276[_0x31e7('0x39')]};return db[_0x31e7('0x29')][_0x31e7('0x1b')](_0x310af0)[_0x31e7('0x23')](function(_0x1689cf){_0x571025[_0x31e7('0x1b')]=_0x1689cf;if(_0x480e72[_0x31e7('0x2f')][_0x31e7('0x3f')]){_0x39d276['include']=[{'all':!![]}];}return db[_0x31e7('0x29')]['findAll'](_0x39d276);})[_0x31e7('0x23')](function(_0x5ec1dc){_0x571025[_0x31e7('0x40')]=_0x5ec1dc;return _0x571025;})['then'](respondWithFilteredResult(_0x3c26ee,_0x39d276))['catch'](handleError(_0x3c26ee,null));};exports[_0x31e7('0x41')]=function(_0x1fedd8,_0x498f12){var _0x345ae1={'raw':!![],'where':{'id':_0x1fedd8[_0x31e7('0x42')]['id']}},_0x32986b={};_0x32986b[_0x31e7('0x2e')]=_[_0x31e7('0x30')](db[_0x31e7('0x29')][_0x31e7('0x2a')]);_0x32986b[_0x31e7('0x2f')]=_[_0x31e7('0x30')](_0x1fedd8[_0x31e7('0x2f')]);_0x32986b[_0x31e7('0x31')]=_[_0x31e7('0x33')](_0x32986b[_0x31e7('0x2e')],_0x32986b[_0x31e7('0x2f')]);_0x345ae1[_0x31e7('0x32')]=_['intersection'](_0x32986b[_0x31e7('0x2e')],qs[_0x31e7('0x43')](_0x1fedd8[_0x31e7('0x2f')][_0x31e7('0x43')]));_0x345ae1[_0x31e7('0x32')]=_0x345ae1[_0x31e7('0x32')][_0x31e7('0x34')]?_0x345ae1[_0x31e7('0x32')]:_0x32986b[_0x31e7('0x2e')];if(_0x1fedd8['query'][_0x31e7('0x3f')]){_0x345ae1['include']=[{'all':!![]}];}_0x345ae1=_[_0x31e7('0x3c')]({},_0x345ae1,_0x1fedd8['options']);return db[_0x31e7('0x29')]['find'](_0x345ae1)[_0x31e7('0x23')](handleEntityNotFound(_0x498f12,null))[_0x31e7('0x23')](respondWithResult(_0x498f12,null))[_0x31e7('0x44')](handleError(_0x498f12,null));};exports[_0x31e7('0x45')]=function(_0x41ab19,_0x35204d){return db['ChatTransferReport']['create'](_0x41ab19[_0x31e7('0x46')],{})['then'](respondWithResult(_0x35204d,0xc9))[_0x31e7('0x44')](handleError(_0x35204d,null));};exports['update']=function(_0x491277,_0x5d6692){if(_0x491277[_0x31e7('0x46')]['id']){delete _0x491277[_0x31e7('0x46')]['id'];}return db['ChatTransferReport'][_0x31e7('0x47')]({'where':{'id':_0x491277['params']['id']}})['then'](handleEntityNotFound(_0x5d6692,null))[_0x31e7('0x23')](saveUpdates(_0x491277[_0x31e7('0x46')],null))[_0x31e7('0x23')](respondWithResult(_0x5d6692,null))['catch'](handleError(_0x5d6692,null));};exports[_0x31e7('0x48')]=function(_0x2ff36a,_0x4d8c33){return db[_0x31e7('0x29')][_0x31e7('0x47')]({'where':{'id':_0x2ff36a[_0x31e7('0x42')]['id']}})['then'](handleEntityNotFound(_0x4d8c33,null))[_0x31e7('0x23')](removeEntity(_0x4d8c33,null))[_0x31e7('0x44')](handleError(_0x4d8c33,null));};exports[_0x31e7('0x49')]=function(_0x2679b6,_0x3cacfa){return db['ChatTransferReport']['describe']()[_0x31e7('0x23')](respondWithResult(_0x3cacfa,null))['catch'](handleError(_0x3cacfa,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 64122e9..7d951d7 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 _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 +var _0xcefc=['util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ChatTransferReport','report_chat_transfer','uniqueid'];(function(_0x2df73a,_0x1be90d){var _0x230c2f=function(_0x54499f){while(--_0x54499f){_0x2df73a['push'](_0x2df73a['shift']());}};_0x230c2f(++_0x1be90d);}(_0xcefc,0x144));var _0xccef=function(_0x1ba6c4,_0x318dc0){_0x1ba6c4=_0x1ba6c4-0x0;var _0x3442eb=_0xcefc[_0x1ba6c4];return _0x3442eb;};'use strict';var _=require('lodash');var util=require(_0xccef('0x0'));var logger=require(_0xccef('0x1'))('api');var moment=require('moment');var BPromise=require(_0xccef('0x2'));var rp=require(_0xccef('0x3'));var fs=require('fs');var path=require(_0xccef('0x4'));var rimraf=require(_0xccef('0x5'));var config=require(_0xccef('0x6'));var attributes=require('./chatTransferReport.attributes');module[_0xccef('0x7')]=function(_0x498ab6,_0xb27e8){return _0x498ab6[_0xccef('0x8')](_0xccef('0x9'),attributes,{'tableName':_0xccef('0xa'),'paranoid':![],'indexes':[{'name':_0xccef('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 5f250d9..cdfd8f2 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 _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 +var _0xd324=['ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x32f3bc,_0x2b5218){var _0x3f8cc2=function(_0x5dca80){while(--_0x5dca80){_0x32f3bc['push'](_0x32f3bc['shift']());}};_0x3f8cc2(++_0x2b5218);}(_0xd324,0x1c1));var _0x4d32=function(_0x4cbf20,_0x1bfa66){_0x4cbf20=_0x4cbf20-0x0;var _0x582ae4=_0xd324[_0x4cbf20];return _0x582ae4;};'use strict';var _=require(_0x4d32('0x0'));var util=require(_0x4d32('0x1'));var moment=require(_0x4d32('0x2'));var BPromise=require('bluebird');var rs=require(_0x4d32('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4d32('0x4'));var logger=require(_0x4d32('0x5'))(_0x4d32('0x6'));var config=require(_0x4d32('0x7'));var jayson=require(_0x4d32('0x8'));var client=jayson[_0x4d32('0x9')][_0x4d32('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ba681,_0x29d4e4,_0x48edfd){return new BPromise(function(_0xbef76d,_0x4a86ea){return client[_0x4d32('0xb')](_0x2ba681,_0x48edfd)['then'](function(_0x1264da){logger[_0x4d32('0xc')](_0x4d32('0xd'),_0x29d4e4,_0x4d32('0xe'));logger[_0x4d32('0xf')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x29d4e4,'request\x20sent',JSON[_0x4d32('0x10')](_0x1264da));if(_0x1264da[_0x4d32('0x11')]){if(_0x1264da['error'][_0x4d32('0x12')]===0x1f4){logger['error'](_0x4d32('0xd'),_0x29d4e4,_0x1264da[_0x4d32('0x11')][_0x4d32('0x13')]);return _0x4a86ea(_0x1264da[_0x4d32('0x11')]['message']);}logger[_0x4d32('0x11')](_0x4d32('0xd'),_0x29d4e4,_0x1264da['error'][_0x4d32('0x13')]);return _0xbef76d(_0x1264da['error'][_0x4d32('0x13')]);}else{logger[_0x4d32('0xc')](_0x4d32('0xd'),_0x29d4e4,_0x4d32('0xe'));_0xbef76d(_0x1264da[_0x4d32('0x14')][_0x4d32('0x13')]);}})['catch'](function(_0x2dffef){logger[_0x4d32('0x11')](_0x4d32('0xd'),_0x29d4e4,_0x2dffef);_0x4a86ea(_0x2dffef);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 2982049..7f7c398 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 _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 +var _0x3265=['exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','./chatTransferReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','delete','destroy'];(function(_0x3b59d5,_0x1e23f2){var _0x30cc91=function(_0x54815d){while(--_0x54815d){_0x3b59d5['push'](_0x3b59d5['shift']());}};_0x30cc91(++_0x1e23f2);}(_0x3265,0x1ba));var _0x5326=function(_0x3a27a8,_0x4c5e23){_0x3a27a8=_0x3a27a8-0x0;var _0x3be69e=_0x3265[_0x3a27a8];return _0x3be69e;};'use strict';var multer=require(_0x5326('0x0'));var util=require(_0x5326('0x1'));var path=require(_0x5326('0x2'));var timeout=require('connect-timeout');var express=require(_0x5326('0x3'));var router=express[_0x5326('0x4')]();var fs_extra=require(_0x5326('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5326('0x6'));var config=require('../../config/environment');var controller=require(_0x5326('0x7'));router[_0x5326('0x8')]('/',auth[_0x5326('0x9')](),controller[_0x5326('0xa')]);router[_0x5326('0x8')](_0x5326('0xb'),auth[_0x5326('0x9')](),controller[_0x5326('0xc')]);router[_0x5326('0x8')]('/:id',auth[_0x5326('0x9')](),controller[_0x5326('0xd')]);router[_0x5326('0xe')]('/',auth[_0x5326('0x9')](),controller[_0x5326('0xf')]);router[_0x5326('0x10')](_0x5326('0x11'),auth[_0x5326('0x9')](),controller['update']);router[_0x5326('0x12')](_0x5326('0x11'),auth['isAuthenticated'](),controller[_0x5326('0x13')]);module[_0x5326('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 0022417..544a828 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 _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 +var _0xfcb4=['getDataValue','onlineForm','parse','setDataValue','textarea','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','sequelize','randomstring','exports','STRING','email','#011F6A','#ffffff','INTEGER','BOOLEAN','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Feedback','star','thumb','TEXT','stringify','input','name','text'];(function(_0x131b08,_0x4c2f04){var _0x43a2c4=function(_0x57329a){while(--_0x57329a){_0x131b08['push'](_0x131b08['shift']());}};_0x43a2c4(++_0x4c2f04);}(_0xfcb4,0x144));var _0x4fcb=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xfcb4[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0x4fcb('0x0'));var rs=require(_0x4fcb('0x1'));module[_0x4fcb('0x2')]={'name':{'type':Sequelize[_0x4fcb('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x4fcb('0x3')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0x4fcb('0x3')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0x4fcb('0x4')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':'email'},'key':{'type':Sequelize[_0x4fcb('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x4fcb('0x3')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0x4fcb('0x3')],'allowNull':![],'defaultValue':_0x4fcb('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x4fcb('0x3')],'allowNull':![],'defaultValue':_0x4fcb('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x4fcb('0x3')],'allowNull':![],'defaultValue':_0x4fcb('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x4fcb('0x3')],'allowNull':![],'defaultValue':_0x4fcb('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x4fcb('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x4fcb('0x3')]},'animation':{'type':Sequelize[_0x4fcb('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0x4fcb('0x9'),_0x4fcb('0xa')),'defaultValue':_0x4fcb('0x9')},'header_online':{'type':Sequelize[_0x4fcb('0x3')],'defaultValue':_0x4fcb('0xb')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x4fcb('0xc')},'offline_chat_button':{'type':Sequelize[_0x4fcb('0x3')],'defaultValue':_0x4fcb('0xd')},'header_offline':{'type':Sequelize[_0x4fcb('0x3')],'defaultValue':_0x4fcb('0xe')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x4fcb('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x4fcb('0x3')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0x4fcb('0x3')],'defaultValue':_0x4fcb('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0x4fcb('0x3')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x4fcb('0x3')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0x4fcb('0x3')],'defaultValue':_0x4fcb('0x10')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x4fcb('0x11')},'closingMessageButton':{'type':Sequelize[_0x4fcb('0x3')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0x4fcb('0x3')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x4fcb('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x4fcb('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x4fcb('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x4fcb('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0x4fcb('0x12')},'ratingType':{'type':Sequelize['ENUM'](_0x4fcb('0x13'),_0x4fcb('0x14')),'defaultValue':_0x4fcb('0x13')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x4fcb('0x15')],'defaultValue':function(){return JSON[_0x4fcb('0x16')]({'items':[{'type':_0x4fcb('0x17'),'variable':null,'config':{'placeholder':_0x4fcb('0x18'),'type':_0x4fcb('0x19'),'required':!![]},'props':{'title':_0x4fcb('0x18'),'helpText':''}},{'type':'input','props':{'title':_0x4fcb('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x4fcb('0x4'),'type':_0x4fcb('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x4fcb('0x1a')](_0x4fcb('0x1b'))?JSON[_0x4fcb('0x1c')](this[_0x4fcb('0x1a')](_0x4fcb('0x1b'))):{};},'set':function(_0x58b866){return this[_0x4fcb('0x1d')]('onlineForm',JSON[_0x4fcb('0x16')](_0x58b866));}},'offlineForm':{'type':Sequelize[_0x4fcb('0x15')],'defaultValue':function(){return JSON[_0x4fcb('0x16')]({'items':[{'type':_0x4fcb('0x17'),'props':{'title':_0x4fcb('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x4fcb('0x4'),'type':_0x4fcb('0x4')},'variable':null},{'type':_0x4fcb('0x1e'),'config':{'placeholder':'Comments'},'props':{'title':'Comments','helpText':_0x4fcb('0x1f')}}],'fromKey':0x0});},'get':function(){return this[_0x4fcb('0x1a')](_0x4fcb('0x20'))?JSON[_0x4fcb('0x1c')](this[_0x4fcb('0x1a')](_0x4fcb('0x20'))):{};},'set':function(_0x3b8e67){return this[_0x4fcb('0x1d')](_0x4fcb('0x20'),JSON['stringify'](_0x3b8e67));}},'token':{'type':Sequelize[_0x4fcb('0x3')],'defaultValue':function(){return rs[_0x4fcb('0x21')]();}},'autoclose':{'type':Sequelize[_0x4fcb('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x4fcb('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x4fcb('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x4fcb('0x3')]},'forwardOffline':{'type':Sequelize[_0x4fcb('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x4fcb('0x3')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0x4fcb('0x22')},'waitingMessage':{'type':Sequelize[_0x4fcb('0x3')],'defaultValue':_0x4fcb('0x23')},'offlineMessageSubject':{'type':Sequelize[_0x4fcb('0x3')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x4fcb('0x24')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x4fcb('0x25')},'skipUnmanaged':{'type':Sequelize[_0x4fcb('0x3')],'defaultValue':_0x4fcb('0x26')},'sendUnmanaged':{'type':Sequelize[_0x4fcb('0x3')],'defaultValue':_0x4fcb('0xd')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x4fcb('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x4fcb('0x15')]},'showAgentAvatar':{'type':Sequelize[_0x4fcb('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x4fcb('0x3')]},'notificationTemplate':{'type':Sequelize[_0x4fcb('0x15')],'defaultValue':function(){return _0x4fcb('0x27');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4fcb('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0x4fcb('0x28')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x4fcb('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x4fcb('0x3')],'defaultValue':_0x4fcb('0x29')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x4fcb('0x3')],'defaultValue':_0x4fcb('0x2a')},'messagesAlignment':{'type':Sequelize[_0x4fcb('0x3')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0x4fcb('0x15')]},'showCustomerAvatar':{'type':Sequelize[_0x4fcb('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x4fcb('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x4fcb('0x3')],'allowNull':![],'defaultValue':_0x4fcb('0x2b'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x4fcb('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4fcb('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4fcb('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x4fcb('0x3')],'defaultValue':_0x4fcb('0x2c')},'systemAvatar':{'type':Sequelize[_0x4fcb('0x15')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4fcb('0x7')],'comment':_0x4fcb('0x2d')},'mandatoryDisposition':{'type':Sequelize[_0x4fcb('0x8')],'defaultValue':![],'comment':_0x4fcb('0x2e'),'set':function(_0x2d4f7d){if(!_0x2d4f7d)this[_0x4fcb('0x1d')](_0x4fcb('0x2f'),null);this[_0x4fcb('0x1d')](_0x4fcb('0x30'),_0x2d4f7d);}},'vidaooEscalation':{'type':Sequelize[_0x4fcb('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x4fcb('0x3')]},'vidaooTopic':{'type':Sequelize[_0x4fcb('0x3')],'allowNull':![],'defaultValue':_0x4fcb('0x31')},'vidaooNote':{'type':Sequelize[_0x4fcb('0x3')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize[_0x4fcb('0x15')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x4fcb('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x4fcb('0x15')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 1cde8c5..bf0e3f5 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 _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 +var _0xc434=['autoclose','applications','push','close','*,*,*,*','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','ChatQueue','queueId','queue','waitForTheAssignedQueue','EventManager','notify','offline','files','Sequelize','ValidationError','difference','createdAt','from\x20is\x20mandatory','send','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','spread','utf8','render','offlineMessageBody','ChatOfflineMessage','originalname','server','attachments','offline-chat','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','openNewInteraction','MailAccountId','mimetype','subjectOffline','toPairsIn','mapValues','offlineMessageSubject','Chat','NotifyMailAccount','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','Contact','Owner','internal','Tag','Tags','tag','getSnippet','virtual','License','chatLicenseExceeded','readFileSync','server/files/chat/iframe.ejs','3.9.0','origin','replace','testWebsiteWithWildcard','remote','x-real-ip','connection','alignment','verticalAlignment','color','labelText','textButtonColor','backgroundColor','IntervalId','addApplications','ISOLATION_LEVELS','READ_COMMITTED','finally','getApplications','addProactiveActions','chatProactiveAction','getProactiveActions','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','util','path','fs-extra','lodash','querystring','html-to-text','ioredis','jayson/promise','../../components/parsers/qs','../../config/logger','api','../../errors/api','APIBadRequestError','APINotFoundError','APIOutOfIntervalError','handleError','./helpers/wildcard-expressions','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','get','ChatWebsites','UserProfileResource','destroy','stack','name','setUA','user-agent','getResult','cf-connecting-ip','x-forwarded-for','first','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','model','device','vendor','%s\x20%s\x20%s','type','index','Pause','mandatoryDispositionPause','ChatWebsite','rawAttributes','fieldName','key','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','testWildcardValidity','address','body','\x22\x20is\x20not\x20a\x20valid\x20website\x20domain','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','addDisposition','getDispositions','findOne','Disposition','nolimit','ChatWebsiteId','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addLogo','sitepic','file','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','filename','getLogo','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','isNil','existsSync','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','Interval','timezone','ifTime','From\x20is\x20mandatory','isEmpty','Body\x20is\x20mandatory','customerIp','No\x20available\x20attributes','updatedAt','includes','CompanyId','ListId','mapKey','from','CmList','List','CmContact','DESC','ChatApplication','Applications','Intervals','interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','account','orderBy','priority','asc','list','Contacts','headers','threadId','closed','Writing\x20on\x20closed\x20interaction','externalUrl','ChatInteraction','ContactId','interaction','contact','firstName','messageId','created'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0xc434,0x76));var _0x4c43=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xc434[_0x59ee6f];return _0x4c0979;};'use strict';var Mustache=require(_0x4c43('0x0'));var util=require(_0x4c43('0x1'));var path=require(_0x4c43('0x2'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4c43('0x3'));var _=require(_0x4c43('0x4'));var querystring=require(_0x4c43('0x5'));var htmlToText=require(_0x4c43('0x6'));var Redis=require(_0x4c43('0x7'));var jayson=require(_0x4c43('0x8'));var qs=require(_0x4c43('0x9'));var logger=require(_0x4c43('0xa'))(_0x4c43('0xb'));var config=require('../../config/environment');var APIBadRequestError=require(_0x4c43('0xc'))[_0x4c43('0xd')];var APINotFoundError=require(_0x4c43('0xc'))[_0x4c43('0xe')];var APIOutOfIntervalError=require(_0x4c43('0xc'))[_0x4c43('0xf')];var APIHandleError=require('../../errors/api')[_0x4c43('0x10')];var APIConflictError=require(_0x4c43('0xc'))['APIConflictError'];var wildcardUtils=require(_0x4c43('0x11'));var URL=require('url')['URL'];var db=require(_0x4c43('0x12'))['db'];config[_0x4c43('0x13')]=_[_0x4c43('0x14')](config[_0x4c43('0x13')],{'host':_0x4c43('0x15'),'port':0x18eb});var socket=require(_0x4c43('0x16'))(new Redis(config[_0x4c43('0x13')]));require('./chatWebsite.socket')[_0x4c43('0x17')](socket);var client=jayson[_0x4c43('0x18')]['http']({'port':0x232c});var client9002=jayson[_0x4c43('0x18')]['http']({'port':0x232a});var client9003=jayson[_0x4c43('0x18')]['http']({'port':0x232b});var client9001=jayson[_0x4c43('0x18')][_0x4c43('0x19')]({'port':0x2329});function respondWithRpcPromise(_0x230307,_0x5ebcf3,_0x287eed,_0xe0d1f5){return new Promise(function(_0x844746,_0x1fa207){var _0x1bf312=_0xe0d1f5||client;return _0x1bf312[_0x4c43('0x1a')](_0x230307,_0x287eed)[_0x4c43('0x1b')](function(_0x496cc5){logger[_0x4c43('0x1c')](_0x4c43('0x1d'),_0x5ebcf3,_0x4c43('0x1e'));logger[_0x4c43('0x1f')](_0x4c43('0x20'),_0x5ebcf3,_0x4c43('0x1e'),JSON[_0x4c43('0x21')](_0x496cc5));if(_0x496cc5['error']){if(_0x496cc5[_0x4c43('0x22')]['code']===0x1f4){logger['error'](_0x4c43('0x1d'),_0x5ebcf3,_0x496cc5[_0x4c43('0x22')][_0x4c43('0x23')]);return _0x1fa207(_0x496cc5[_0x4c43('0x22')]['message']);}logger[_0x4c43('0x22')]('ChatWebsite,\x20%s,\x20%s',_0x5ebcf3,_0x496cc5['error']['message']);return _0x844746(_0x496cc5[_0x4c43('0x22')]['message']);}else{logger[_0x4c43('0x1c')](_0x4c43('0x1d'),_0x5ebcf3,'request\x20sent');_0x844746(_0x496cc5[_0x4c43('0x24')][_0x4c43('0x23')]);}})[_0x4c43('0x25')](function(_0x256d0a){logger[_0x4c43('0x22')](_0x4c43('0x1d'),_0x5ebcf3,_0x256d0a);_0x1fa207(_0x256d0a);});});}function respondWithStatusCode(_0x557ab0,_0x52a7f2){_0x52a7f2=_0x52a7f2||0xcc;return function(_0x2c5ffa){if(_0x2c5ffa){return _0x557ab0[_0x4c43('0x26')](_0x52a7f2);}return _0x557ab0[_0x4c43('0x27')](_0x52a7f2)['end']();};}function respondWithResult(_0x29e0a2,_0x4eb873){_0x4eb873=_0x4eb873||0xc8;return function(_0x22af38){if(_0x22af38){return _0x29e0a2[_0x4c43('0x27')](_0x4eb873)[_0x4c43('0x28')](_0x22af38);}};}function respondWithFilteredResult(_0x32c4f3,_0x426acd){return function(_0x86f548){if(_0x86f548){var _0x2f9d7=typeof _0x426acd[_0x4c43('0x29')]===_0x4c43('0x2a')&&typeof _0x426acd[_0x4c43('0x2b')]==='undefined';var _0x2a0f1b=_0x86f548[_0x4c43('0x2c')];var _0x56a98a=_0x2f9d7?0x0:_0x426acd[_0x4c43('0x29')];var _0xb37556=_0x2f9d7?_0x86f548[_0x4c43('0x2c')]:_0x426acd['offset']+_0x426acd[_0x4c43('0x2b')];var _0x69a958;if(_0xb37556>=_0x2a0f1b){_0xb37556=_0x2a0f1b;_0x69a958=0xc8;}else{_0x69a958=0xce;}_0x32c4f3['status'](_0x69a958);return _0x32c4f3[_0x4c43('0x2d')](_0x4c43('0x2e'),_0x56a98a+'-'+_0xb37556+'/'+_0x2a0f1b)[_0x4c43('0x28')](_0x86f548);}return null;};}function saveUpdates(_0x19ad93){return function(_0x2d3387){if(_0x2d3387){return _0x2d3387[_0x4c43('0x2f')](_0x19ad93)[_0x4c43('0x1b')](function(_0x279e14){return _0x279e14;});}return null;};}function removeEntity(_0x519a2d){return function(_0x5f26f3){if(_0x5f26f3){return _0x5f26f3['destroy']()[_0x4c43('0x1b')](function(){var _0x393371=_0x5f26f3[_0x4c43('0x30')]({'plain':!![]});var _0x54ef44=_0x4c43('0x31');return db[_0x4c43('0x32')][_0x4c43('0x33')]({'where':{'type':_0x54ef44,'resourceId':_0x393371['id']}})[_0x4c43('0x1b')](function(){return _0x5f26f3;});})[_0x4c43('0x1b')](function(){_0x519a2d[_0x4c43('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a62b9){return function(_0x56e45e){if(!_0x56e45e){_0x2a62b9[_0x4c43('0x26')](0x194);}return _0x56e45e;};}function handleError(_0xd8fcc,_0x386cd2){_0x386cd2=_0x386cd2||0x1f4;return function(_0x12f1b6){logger[_0x4c43('0x22')](_0x12f1b6[_0x4c43('0x34')]);if(_0x12f1b6[_0x4c43('0x35')]){delete _0x12f1b6[_0x4c43('0x35')];}_0xd8fcc[_0x4c43('0x27')](_0x386cd2)['send'](_0x12f1b6);};}function createInteractionObject(_0x262d05,_0x318bab,_0x4f2a9b,_0x14f3d2){var _0x5564a3=require('user-agent-parser');var _0x5c48f3=new _0x5564a3();var _0x4c9cae=_0x5c48f3[_0x4c43('0x36')](_0x4f2a9b[_0x4c43('0x37')])[_0x4c43('0x38')]();var _0x4b6644=_0x318bab['customerIp'];if(_0x4f2a9b[_0x4c43('0x39')]){_0x4b6644=_0x4f2a9b['cf-connecting-ip'];}else if(_0x4f2a9b[_0x4c43('0x3a')]){_0x4b6644=_[_0x4c43('0x3b')](_0x4f2a9b[_0x4c43('0x3a')]['split'](','));}return{'ContactId':_0x14f3d2['id'],'ChatWebsiteId':_0x262d05,'from':(_0x14f3d2['firstName']||'')+'\x20'+(_0x14f3d2[_0x4c43('0x3c')]||''),'customerIp':_0x4b6644,'customerPort':_0x4f2a9b['x-real-port']?_0x4f2a9b[_0x4c43('0x3d')]:null,'referer':_0x318bab[_0x4c43('0x3e')],'browserName':_0x4c9cae[_0x4c43('0x3f')][_0x4c43('0x35')]&&_0x4c9cae[_0x4c43('0x3f')][_0x4c43('0x40')]?util[_0x4c43('0x41')](_0x4c43('0x42'),_0x4c9cae[_0x4c43('0x3f')]['name'],_0x4c9cae[_0x4c43('0x3f')][_0x4c43('0x40')]):_0x4c43('0x43'),'browserVersion':_0x4c9cae[_0x4c43('0x3f')][_0x4c43('0x40')]||_0x4c43('0x43'),'osName':util[_0x4c43('0x41')](_0x4c43('0x42'),_0x4c9cae['os'][_0x4c43('0x35')],_0x4c9cae['os']['version']),'osVersion':_0x4c9cae['os']['version'],'deviceModel':_0x4c9cae['device'][_0x4c43('0x44')]&&_0x4c9cae[_0x4c43('0x45')][_0x4c43('0x46')]?util[_0x4c43('0x41')](_0x4c43('0x47'),_0x4c9cae[_0x4c43('0x45')][_0x4c43('0x44')],_0x4c9cae[_0x4c43('0x45')][_0x4c43('0x46')],_0x4c9cae['device'][_0x4c43('0x48')]):null,'deviceVendor':_0x4c9cae['device'][_0x4c43('0x46')],'deviceType':_0x4c9cae[_0x4c43('0x45')][_0x4c43('0x48')],'formData':JSON['stringify'](_0x318bab)};}exports[_0x4c43('0x49')]=function(_0xd6b7ab,_0x19495b){var _0x16bfe0={'include':[{'model':db[_0x4c43('0x4a')],'as':_0x4c43('0x4b')}]},_0x45646c={},_0x155349={'count':0x0,'rows':[]};var _0x74dec=_['map'](db[_0x4c43('0x4c')][_0x4c43('0x4d')],function(_0x11a70b){return{'name':_0x11a70b[_0x4c43('0x4e')],'type':_0x11a70b[_0x4c43('0x48')][_0x4c43('0x4f')]};});_0x45646c[_0x4c43('0x44')]=_[_0x4c43('0x50')](_0x74dec,_0x4c43('0x35'));_0x45646c[_0x4c43('0x51')]=_[_0x4c43('0x52')](_0xd6b7ab[_0x4c43('0x51')]);_0x45646c[_0x4c43('0x53')]=_[_0x4c43('0x54')](_0x45646c['model'],_0x45646c[_0x4c43('0x51')]);_0x16bfe0[_0x4c43('0x55')]=_[_0x4c43('0x54')](_0x45646c[_0x4c43('0x44')],qs[_0x4c43('0x56')](_0xd6b7ab['query'][_0x4c43('0x56')]));_0x16bfe0[_0x4c43('0x55')]=_0x16bfe0['attributes'][_0x4c43('0x57')]?_0x16bfe0[_0x4c43('0x55')]:_0x45646c[_0x4c43('0x44')];if(!_0xd6b7ab[_0x4c43('0x51')][_0x4c43('0x58')]('nolimit')){_0x16bfe0[_0x4c43('0x2b')]=qs['limit'](_0xd6b7ab[_0x4c43('0x51')][_0x4c43('0x2b')]);_0x16bfe0['offset']=qs[_0x4c43('0x29')](_0xd6b7ab['query'][_0x4c43('0x29')]);}_0x16bfe0[_0x4c43('0x59')]=qs[_0x4c43('0x5a')](_0xd6b7ab['query']['sort']);_0x16bfe0['where']=qs[_0x4c43('0x53')](_[_0x4c43('0x5b')](_0xd6b7ab[_0x4c43('0x51')],_0x45646c[_0x4c43('0x53')]),_0x74dec);if(_0xd6b7ab[_0x4c43('0x51')][_0x4c43('0x5c')]){_0x16bfe0[_0x4c43('0x5d')]=_[_0x4c43('0x5e')](_0x16bfe0[_0x4c43('0x5d')],{'$or':_[_0x4c43('0x50')](_0x74dec,function(_0x4d3954){if(_0x4d3954[_0x4c43('0x48')]!==_0x4c43('0x5f')){var _0x3c2a2f={};_0x3c2a2f[_0x4d3954[_0x4c43('0x35')]]={'$like':'%'+_0xd6b7ab[_0x4c43('0x51')]['filter']+'%'};return _0x3c2a2f;}})});}_0x16bfe0=_['merge']({},_0x16bfe0,_0xd6b7ab[_0x4c43('0x60')]);var _0x41ce38={'where':_0x16bfe0['where']};return db['ChatWebsite'][_0x4c43('0x2c')](_0x41ce38)[_0x4c43('0x1b')](function(_0x4a0972){_0x155349[_0x4c43('0x2c')]=_0x4a0972;if(_0xd6b7ab[_0x4c43('0x51')][_0x4c43('0x61')]){_0x16bfe0[_0x4c43('0x62')]=[{'all':!![]}];}return db[_0x4c43('0x4c')][_0x4c43('0x63')](_0x16bfe0);})[_0x4c43('0x1b')](function(_0x5c010f){_0x155349[_0x4c43('0x64')]=_0x5c010f;return _0x155349;})['then'](respondWithFilteredResult(_0x19495b,_0x16bfe0))[_0x4c43('0x25')](handleError(_0x19495b,null));};exports['show']=function(_0x4ca933,_0xd3f4d9){var _0x56ebe0={'raw':![],'where':{'id':_0x4ca933[_0x4c43('0x65')]['id']},'include':[{'model':db[_0x4c43('0x4a')],'as':_0x4c43('0x4b')}]},_0x115f7c={};_0x115f7c[_0x4c43('0x44')]=_['keys'](db[_0x4c43('0x4c')][_0x4c43('0x4d')]);_0x115f7c[_0x4c43('0x51')]=_['keys'](_0x4ca933[_0x4c43('0x51')]);_0x115f7c[_0x4c43('0x53')]=_[_0x4c43('0x54')](_0x115f7c['model'],_0x115f7c[_0x4c43('0x51')]);_0x56ebe0[_0x4c43('0x55')]=_[_0x4c43('0x54')](_0x115f7c[_0x4c43('0x44')],qs[_0x4c43('0x56')](_0x4ca933[_0x4c43('0x51')]['fields']));_0x56ebe0[_0x4c43('0x55')]=_0x56ebe0[_0x4c43('0x55')]['length']?_0x56ebe0['attributes']:_0x115f7c[_0x4c43('0x44')];if(_0x4ca933[_0x4c43('0x51')]['includeAll']){_0x56ebe0[_0x4c43('0x62')]=[{'all':!![]}];}_0x56ebe0=_[_0x4c43('0x5e')]({},_0x56ebe0,_0x4ca933['options']);return db[_0x4c43('0x4c')]['find'](_0x56ebe0)[_0x4c43('0x1b')](handleEntityNotFound(_0xd3f4d9,null))[_0x4c43('0x1b')](respondWithResult(_0xd3f4d9,null))[_0x4c43('0x25')](handleError(_0xd3f4d9,null));};exports['create']=function(_0x5d448f,_0xd996ef){if(!wildcardUtils[_0x4c43('0x66')](_0x5d448f['body'][_0x4c43('0x67')])){return handleError(_0xd996ef,null)(new APIBadRequestError('\x22'+_0x5d448f[_0x4c43('0x68')][_0x4c43('0x67')]+_0x4c43('0x69')));}return db[_0x4c43('0x4c')][_0x4c43('0x6a')](_0x5d448f['body'],{})[_0x4c43('0x1b')](function(_0x592a8f){var _0x3e5dea=_0x5d448f[_0x4c43('0x6b')]['get']({'plain':!![]});if(!_0x3e5dea)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e5dea[_0x4c43('0x6c')]===_0x4c43('0x6b')){var _0x1fe32e=_0x592a8f[_0x4c43('0x30')]({'plain':!![]});var _0x39f33b=_0x4c43('0x31');return db[_0x4c43('0x6d')]['find']({'where':{'name':_0x39f33b,'userProfileId':_0x3e5dea[_0x4c43('0x6e')]},'raw':!![]})['then'](function(_0xdddf3b){if(_0xdddf3b&&_0xdddf3b[_0x4c43('0x6f')]===0x0){return db[_0x4c43('0x32')]['create']({'name':_0x1fe32e['name'],'resourceId':_0x1fe32e['id'],'type':_0xdddf3b['name'],'sectionId':_0xdddf3b['id']},{})[_0x4c43('0x1b')](function(){return _0x592a8f;});}else{return _0x592a8f;}})[_0x4c43('0x25')](function(_0x41ab25){logger['error'](_0x4c43('0x70'),_0x41ab25);throw _0x41ab25;});}return _0x592a8f;})['then'](respondWithResult(_0xd996ef,0xc9))[_0x4c43('0x25')](handleError(_0xd996ef,null));};exports[_0x4c43('0x2f')]=function(_0x53338f,_0x23dbd3){if(!wildcardUtils[_0x4c43('0x66')](_0x53338f['body'][_0x4c43('0x67')])){return handleError(_0x23dbd3,null)(new APIBadRequestError('\x22'+_0x53338f[_0x4c43('0x68')][_0x4c43('0x67')]+_0x4c43('0x69')));}if(_0x53338f[_0x4c43('0x68')]['id']){delete _0x53338f[_0x4c43('0x68')]['id'];}return db['ChatWebsite'][_0x4c43('0x71')]({'where':{'id':_0x53338f['params']['id']},'include':[{'model':db[_0x4c43('0x4a')],'as':_0x4c43('0x4b')}]})[_0x4c43('0x1b')](handleEntityNotFound(_0x23dbd3,null))[_0x4c43('0x1b')](saveUpdates(_0x53338f['body'],null))[_0x4c43('0x1b')](respondWithResult(_0x23dbd3,null))[_0x4c43('0x25')](handleError(_0x23dbd3,null));};exports[_0x4c43('0x33')]=function(_0x3f3175,_0x30d0d8){return db[_0x4c43('0x4c')][_0x4c43('0x71')]({'where':{'id':_0x3f3175[_0x4c43('0x65')]['id']}})[_0x4c43('0x1b')](handleEntityNotFound(_0x30d0d8,null))[_0x4c43('0x1b')](removeEntity(_0x30d0d8,null))[_0x4c43('0x25')](handleError(_0x30d0d8,null));};exports[_0x4c43('0x72')]=function(_0x1c71f2,_0x597e82){return db[_0x4c43('0x4c')][_0x4c43('0x72')]()[_0x4c43('0x1b')](respondWithResult(_0x597e82,null))['catch'](handleError(_0x597e82,null));};exports[_0x4c43('0x73')]=function(_0x236959,_0x9a39fa){if(_0x236959[_0x4c43('0x68')]['id']){delete _0x236959[_0x4c43('0x68')]['id'];}return db[_0x4c43('0x4c')][_0x4c43('0x71')]({'where':{'id':_0x236959[_0x4c43('0x65')]['id']}})[_0x4c43('0x1b')](handleEntityNotFound(_0x9a39fa,null))[_0x4c43('0x1b')](function(_0x18c18d){if(_0x18c18d){_0x236959[_0x4c43('0x68')]['ChatWebsiteId']=_0x18c18d['id'];return db['Disposition']['create'](_0x236959[_0x4c43('0x68')]);}})[_0x4c43('0x1b')](respondWithResult(_0x9a39fa,null))[_0x4c43('0x25')](handleError(_0x9a39fa,null));};exports[_0x4c43('0x74')]=function(_0x40a024,_0x1ed48a){var _0x194a3a={'raw':![],'where':{}};var _0x419300={};var _0x3e7b6a={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x4c43('0x75')]({'where':{'id':_0x40a024[_0x4c43('0x65')]['id']}})[_0x4c43('0x1b')](handleEntityNotFound(_0x1ed48a,null))[_0x4c43('0x1b')](function(_0x49bc6d){if(_0x49bc6d){_0x419300[_0x4c43('0x44')]=_[_0x4c43('0x52')](db[_0x4c43('0x76')]['rawAttributes']);_0x419300[_0x4c43('0x51')]=_[_0x4c43('0x52')](_0x40a024['query']);_0x419300[_0x4c43('0x53')]=_[_0x4c43('0x54')](_0x419300[_0x4c43('0x44')],_0x419300[_0x4c43('0x51')]);_0x194a3a[_0x4c43('0x55')]=_[_0x4c43('0x54')](_0x419300[_0x4c43('0x44')],qs[_0x4c43('0x56')](_0x40a024['query'][_0x4c43('0x56')]));_0x194a3a['attributes']=_0x194a3a[_0x4c43('0x55')][_0x4c43('0x57')]?_0x194a3a[_0x4c43('0x55')]:_0x419300['model'];if(!_0x40a024['query'][_0x4c43('0x58')](_0x4c43('0x77'))){_0x194a3a[_0x4c43('0x2b')]=qs[_0x4c43('0x2b')](_0x40a024['query'][_0x4c43('0x2b')]);_0x194a3a['offset']=qs[_0x4c43('0x29')](_0x40a024['query'][_0x4c43('0x29')]);}_0x194a3a['order']=qs[_0x4c43('0x5a')](_0x40a024[_0x4c43('0x51')][_0x4c43('0x5a')]);_0x194a3a['where']=qs[_0x4c43('0x53')](_[_0x4c43('0x5b')](_0x40a024[_0x4c43('0x51')],_0x419300[_0x4c43('0x53')]));_0x194a3a[_0x4c43('0x5d')][_0x4c43('0x78')]=_0x49bc6d['id'];if(_0x40a024[_0x4c43('0x51')][_0x4c43('0x5c')]){_0x194a3a[_0x4c43('0x5d')]=_[_0x4c43('0x5e')](_0x194a3a['where'],{'$or':_[_0x4c43('0x50')](_0x194a3a[_0x4c43('0x55')],function(_0x3ff678){var _0x3fb7d3={};_0x3fb7d3[_0x3ff678]={'$like':'%'+_0x40a024['query'][_0x4c43('0x5c')]+'%'};return _0x3fb7d3;})});}_0x194a3a=_[_0x4c43('0x5e')]({},_0x194a3a,_0x40a024[_0x4c43('0x60')]);return db[_0x4c43('0x76')][_0x4c43('0x2c')]({'where':_0x194a3a[_0x4c43('0x5d')]})[_0x4c43('0x1b')](function(_0x358dc9){_0x3e7b6a[_0x4c43('0x2c')]=_0x358dc9;if(_0x40a024[_0x4c43('0x51')][_0x4c43('0x61')]){_0x194a3a[_0x4c43('0x62')]=[{'all':!![]}];}return db[_0x4c43('0x76')][_0x4c43('0x63')](_0x194a3a);})[_0x4c43('0x1b')](function(_0x4a404a){_0x3e7b6a[_0x4c43('0x64')]=_0x4a404a;return _0x3e7b6a;});}})[_0x4c43('0x1b')](respondWithFilteredResult(_0x1ed48a,_0x194a3a))[_0x4c43('0x25')](handleError(_0x1ed48a,null));};exports['removeDispositions']=function(_0xa1a008,_0x5a0465){return db[_0x4c43('0x4c')][_0x4c43('0x71')]({'where':{'id':_0xa1a008[_0x4c43('0x65')]['id']}})['then'](handleEntityNotFound(_0x5a0465,null))[_0x4c43('0x1b')](function(_0x1c2fbd){if(_0x1c2fbd){return _0x1c2fbd[_0x4c43('0x79')](_0xa1a008[_0x4c43('0x51')][_0x4c43('0x7a')]);}})[_0x4c43('0x1b')](respondWithStatusCode(_0x5a0465,null))[_0x4c43('0x25')](handleError(_0x5a0465,null));};exports[_0x4c43('0x7b')]=function(_0x26db01,_0x3e1499){if(_0x26db01[_0x4c43('0x68')]['id']){delete _0x26db01['body']['id'];}return db['ChatWebsite'][_0x4c43('0x71')]({'where':{'id':_0x26db01[_0x4c43('0x65')]['id']}})[_0x4c43('0x1b')](handleEntityNotFound(_0x3e1499,null))[_0x4c43('0x1b')](function(_0x4f84f0){if(_0x4f84f0){_0x26db01[_0x4c43('0x68')][_0x4c43('0x78')]=_0x4f84f0['id'];return db[_0x4c43('0x7c')][_0x4c43('0x6a')](_0x26db01[_0x4c43('0x68')]);}})[_0x4c43('0x1b')](respondWithResult(_0x3e1499,null))['catch'](handleError(_0x3e1499,null));};exports['getAnswers']=function(_0x2bdf45,_0xf32767){var _0x31f834={'raw':![],'where':{}};var _0x35d2c0={};var _0x2788b8={'count':0x0,'rows':[]};return db[_0x4c43('0x4c')][_0x4c43('0x75')]({'where':{'id':_0x2bdf45[_0x4c43('0x65')]['id']}})['then'](handleEntityNotFound(_0xf32767,null))[_0x4c43('0x1b')](function(_0x4ead30){if(_0x4ead30){_0x35d2c0[_0x4c43('0x44')]=_[_0x4c43('0x52')](db[_0x4c43('0x7c')][_0x4c43('0x4d')]);_0x35d2c0[_0x4c43('0x51')]=_[_0x4c43('0x52')](_0x2bdf45[_0x4c43('0x51')]);_0x35d2c0[_0x4c43('0x53')]=_[_0x4c43('0x54')](_0x35d2c0[_0x4c43('0x44')],_0x35d2c0[_0x4c43('0x51')]);_0x31f834[_0x4c43('0x55')]=_['intersection'](_0x35d2c0[_0x4c43('0x44')],qs[_0x4c43('0x56')](_0x2bdf45[_0x4c43('0x51')]['fields']));_0x31f834['attributes']=_0x31f834[_0x4c43('0x55')][_0x4c43('0x57')]?_0x31f834[_0x4c43('0x55')]:_0x35d2c0[_0x4c43('0x44')];if(!_0x2bdf45[_0x4c43('0x51')][_0x4c43('0x58')](_0x4c43('0x77'))){_0x31f834[_0x4c43('0x2b')]=qs[_0x4c43('0x2b')](_0x2bdf45[_0x4c43('0x51')]['limit']);_0x31f834['offset']=qs[_0x4c43('0x29')](_0x2bdf45[_0x4c43('0x51')][_0x4c43('0x29')]);}_0x31f834['order']=qs[_0x4c43('0x5a')](_0x2bdf45[_0x4c43('0x51')][_0x4c43('0x5a')]);_0x31f834[_0x4c43('0x5d')]=qs[_0x4c43('0x53')](_[_0x4c43('0x5b')](_0x2bdf45[_0x4c43('0x51')],_0x35d2c0[_0x4c43('0x53')]));_0x31f834[_0x4c43('0x5d')][_0x4c43('0x78')]=_0x4ead30['id'];if(_0x2bdf45[_0x4c43('0x51')][_0x4c43('0x5c')]){_0x31f834[_0x4c43('0x5d')]=_[_0x4c43('0x5e')](_0x31f834[_0x4c43('0x5d')],{'$or':_['map'](_0x31f834[_0x4c43('0x55')],function(_0x2a785b){var _0xa9f0fb={};_0xa9f0fb[_0x2a785b]={'$like':'%'+_0x2bdf45[_0x4c43('0x51')][_0x4c43('0x5c')]+'%'};return _0xa9f0fb;})});}_0x31f834=_[_0x4c43('0x5e')]({},_0x31f834,_0x2bdf45['options']);return db['CannedAnswer'][_0x4c43('0x2c')]({'where':_0x31f834[_0x4c43('0x5d')]})[_0x4c43('0x1b')](function(_0x4d9f98){_0x2788b8[_0x4c43('0x2c')]=_0x4d9f98;if(_0x2bdf45[_0x4c43('0x51')]['includeAll']){_0x31f834[_0x4c43('0x62')]=[{'all':!![]}];}return db['CannedAnswer'][_0x4c43('0x63')](_0x31f834);})[_0x4c43('0x1b')](function(_0x146ea6){_0x2788b8[_0x4c43('0x64')]=_0x146ea6;return _0x2788b8;});}})[_0x4c43('0x1b')](respondWithFilteredResult(_0xf32767,_0x31f834))[_0x4c43('0x25')](handleError(_0xf32767,null));};exports[_0x4c43('0x7d')]=function(_0x1e74b2,_0x47a1c3){return db['ChatWebsite']['find']({'where':{'id':_0x1e74b2[_0x4c43('0x65')]['id']}})[_0x4c43('0x1b')](handleEntityNotFound(_0x47a1c3,null))[_0x4c43('0x1b')](function(_0x11987c){if(_0x11987c){return _0x11987c['removeAnswers'](_0x1e74b2[_0x4c43('0x51')][_0x4c43('0x7a')]);}})['then'](respondWithStatusCode(_0x47a1c3,null))[_0x4c43('0x25')](handleError(_0x47a1c3,null));};exports[_0x4c43('0x7e')]=function(_0x2c5f3a,_0x92040a){_0x2c5f3a[_0x4c43('0x68')][_0x4c43('0x7f')]=_0x2c5f3a[_0x4c43('0x80')]['filename'];return db['ChatWebsite'][_0x4c43('0x71')]({'where':{'id':_0x2c5f3a[_0x4c43('0x65')]['id']}})[_0x4c43('0x1b')](handleEntityNotFound(_0x92040a,null))[_0x4c43('0x1b')](saveUpdates(_0x2c5f3a[_0x4c43('0x68')],null))[_0x4c43('0x1b')](respondWithResult(_0x92040a,null))[_0x4c43('0x25')](handleError(_0x92040a,null));};exports[_0x4c43('0x81')]=function(_0x32ba74,_0x628577){_0x32ba74[_0x4c43('0x68')][_0x4c43('0x82')]=_0x32ba74['file']['filename'];return db[_0x4c43('0x4c')][_0x4c43('0x71')]({'where':{'id':_0x32ba74[_0x4c43('0x65')]['id']}})['then'](handleEntityNotFound(_0x628577,null))['then'](saveUpdates(_0x32ba74[_0x4c43('0x68')],null))['then'](respondWithResult(_0x628577,null))[_0x4c43('0x25')](handleError(_0x628577,null));};exports[_0x4c43('0x83')]=function(_0x35af46,_0x5692cd){_0x35af46['body'][_0x4c43('0x84')]=_0x35af46[_0x4c43('0x80')]['filename'];return db[_0x4c43('0x4c')]['find']({'where':{'id':_0x35af46['params']['id']}})[_0x4c43('0x1b')](handleEntityNotFound(_0x5692cd,null))['then'](saveUpdates(_0x35af46['body'],null))['then'](respondWithResult(_0x5692cd,null))[_0x4c43('0x25')](handleError(_0x5692cd,null));};exports[_0x4c43('0x85')]=function(_0x42be4b,_0x41f9be){_0x42be4b['body']['systemAvatar']=_0x42be4b[_0x4c43('0x80')][_0x4c43('0x86')];return db[_0x4c43('0x4c')][_0x4c43('0x71')]({'where':{'id':_0x42be4b[_0x4c43('0x65')]['id']}})[_0x4c43('0x1b')](handleEntityNotFound(_0x41f9be,null))[_0x4c43('0x1b')](saveUpdates(_0x42be4b[_0x4c43('0x68')],null))[_0x4c43('0x1b')](respondWithResult(_0x41f9be,null))[_0x4c43('0x25')](handleError(_0x41f9be,null));};exports[_0x4c43('0x87')]=function(_0x4b788b,_0x24b97d){var _0x241666=path[_0x4c43('0x88')](config[_0x4c43('0x89')],_0x4c43('0x8a'));var _0x244b07={'where':{'id':_0x4b788b[_0x4c43('0x65')]['id']},'attributes':['id',_0x4c43('0x7f')],'raw':!![]};var _0x1551e6=![];return require(_0x4c43('0x8b'))[_0x4c43('0x8c')]()[_0x4c43('0x1b')](function(_0x32eec3){if(_0x32eec3){_0x1551e6=_0x32eec3['custom'];}})[_0x4c43('0x1b')](function(){return db['ChatWebsite'][_0x4c43('0x71')](_0x244b07);})[_0x4c43('0x1b')](handleEntityNotFound(_0x24b97d,null))[_0x4c43('0x1b')](function(_0x492e05){if(_0x492e05){if(!_[_0x4c43('0x8d')](_0x492e05[_0x4c43('0x7f')])){if(fs[_0x4c43('0x8e')](path[_0x4c43('0x88')](config[_0x4c43('0x89')],'server/files/images/logos/',_0x492e05[_0x4c43('0x7f')]))&&_0x1551e6){_0x241666=path['join'](config[_0x4c43('0x89')],'server/files/images/logos/',_0x492e05[_0x4c43('0x7f')]);}}return _0x24b97d[_0x4c43('0x8f')](_0x241666);}})[_0x4c43('0x25')](handleError(_0x24b97d,null));};exports[_0x4c43('0x90')]=function(_0x45cff9,_0x251aae){var _0x5c1123=path[_0x4c43('0x88')](config[_0x4c43('0x89')],_0x4c43('0x91'));var _0x1c9d5d={'where':{'id':_0x45cff9['params']['id']},'attributes':['id',_0x4c43('0x82')],'raw':!![]};return db[_0x4c43('0x4c')][_0x4c43('0x71')](_0x1c9d5d)['then'](handleEntityNotFound(_0x251aae,null))[_0x4c43('0x1b')](function(_0x284714){if(_0x284714){if(!_['isNil'](_0x284714['agentAvatar'])){if(fs[_0x4c43('0x8e')](path['join'](config[_0x4c43('0x89')],_0x4c43('0x92'),_0x284714[_0x4c43('0x82')]))){_0x5c1123=path[_0x4c43('0x88')](config['root'],'server/files/images/avatars/',_0x284714[_0x4c43('0x82')]);}}return _0x251aae[_0x4c43('0x8f')](_0x5c1123);}})[_0x4c43('0x25')](handleError(_0x251aae,null));};exports[_0x4c43('0x93')]=function(_0x2bbb11,_0x1beb6b){var _0x53aae4=path['join'](config[_0x4c43('0x89')],'server/files/images/avatars/customer_avatar.png');var _0x478c67={'where':{'id':_0x2bbb11['params']['id']},'attributes':['id','customerAvatar','showCustomerAvatar'],'raw':!![]};return db[_0x4c43('0x4c')]['find'](_0x478c67)[_0x4c43('0x1b')](handleEntityNotFound(_0x1beb6b,null))[_0x4c43('0x1b')](function(_0x2c21e4){if(_0x2c21e4){if(!_[_0x4c43('0x8d')](_0x2c21e4['customerAvatar'])){if(fs['existsSync'](path[_0x4c43('0x88')](config[_0x4c43('0x89')],'server/files/images/avatars/',_0x2c21e4[_0x4c43('0x84')]))&&_0x2c21e4[_0x4c43('0x94')]){_0x53aae4=path[_0x4c43('0x88')](config['root'],_0x4c43('0x92'),_0x2c21e4['customerAvatar']);}}return _0x1beb6b[_0x4c43('0x8f')](_0x53aae4);}})[_0x4c43('0x25')](handleError(_0x1beb6b,null));};exports[_0x4c43('0x95')]=function(_0x787111,_0x46f428){var _0x3f12cf=path['join'](config[_0x4c43('0x89')],_0x4c43('0x96'));var _0x468748={'where':{'id':_0x787111[_0x4c43('0x65')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db['ChatWebsite']['find'](_0x468748)[_0x4c43('0x1b')](handleEntityNotFound(_0x46f428,null))[_0x4c43('0x1b')](function(_0x1423f4){if(_0x1423f4){if(!_[_0x4c43('0x8d')](_0x1423f4[_0x4c43('0x97')])){if(fs['existsSync'](path[_0x4c43('0x88')](config[_0x4c43('0x89')],'server/files/images/avatars/',_0x1423f4[_0x4c43('0x97')]))){_0x3f12cf=path[_0x4c43('0x88')](config[_0x4c43('0x89')],_0x4c43('0x92'),_0x1423f4[_0x4c43('0x97')]);}}return _0x46f428[_0x4c43('0x8f')](_0x3f12cf);}})[_0x4c43('0x25')](handleError(_0x46f428,null));};function checkWebsiteInterval(_0x24d2e7){var _0x5571ae=_0x24d2e7[_0x4c43('0x98')];if(!_0x5571ae){return Promise['resolve'](_0x24d2e7);}var _0x43da58=_0x24d2e7[_0x4c43('0x99')]||undefined;return _0x5571ae[_0x4c43('0x9a')](_0x43da58)[_0x4c43('0x1b')](function(_0x5d94a5){if(!_0x5d94a5){throw new APIOutOfIntervalError();}return _0x24d2e7;});}exports['notify']=function(_0x23083b,_0xd32541){var _0x4fd12f={'body':_0x23083b['body'],'channel':'chat'};var _0x4be9f1=[];var _0x533336=[];var _0x43b2e5={};var _0xb90642=![];if(_0x23083b[_0x4c43('0x68')]['id']){delete _0x23083b[_0x4c43('0x68')]['id'];}if(_[_0x4c43('0x8d')](_0x23083b[_0x4c43('0x68')]['from'])){throw new APIBadRequestError(_0x4c43('0x9b'));}if(_[_0x4c43('0x8d')](_0x23083b[_0x4c43('0x68')]['mapKey'])){throw new APIBadRequestError('MapKey\x20is\x20mandatory');}if(_[_0x4c43('0x9c')](_0x23083b[_0x4c43('0x68')]['body'])){throw new APIBadRequestError(_0x4c43('0x9d'));}var _0x331add=_0x23083b[_0x4c43('0x68')][_0x4c43('0x9e')]&&_0x23083b[_0x4c43('0x68')]['referer'];return db['CmContact'][_0x4c43('0x72')]()['then'](function(_0x4baebf){if(!_0x4baebf){throw new Error(_0x4c43('0x9f'));}_0x4be9f1=Object[_0x4c43('0x52')](_0x4baebf)['filter'](function(_0x20423d){return!['createdAt',_0x4c43('0xa0')][_0x4c43('0xa1')](_0x20423d);});_0x533336=Object['keys'](_0x4baebf)[_0x4c43('0x5c')](function(_0x520365){return!['createdAt','updatedAt',_0x4c43('0xa2'),_0x4c43('0xa3')][_0x4c43('0xa1')](_0x520365);});if(!_['includes'](_0x533336,_0x23083b[_0x4c43('0x68')][_0x4c43('0xa4')])){throw new APIBadRequestError('Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20'+_0x533336[_0x4c43('0x88')](',\x20'));}_0x43b2e5[_0x23083b[_0x4c43('0x68')]['mapKey']]=_0x23083b[_0x4c43('0x68')][_0x4c43('0xa5')];})[_0x4c43('0x1b')](function(){return db[_0x4c43('0x4c')][_0x4c43('0x71')]({'where':{'id':_0x23083b[_0x4c43('0x65')]['id']},'include':[{'model':db[_0x4c43('0xa6')],'as':_0x4c43('0xa7'),'include':[{'model':db[_0x4c43('0xa8')],'as':'Contacts','where':_0x43b2e5,'limit':0x1,'order':[['updatedAt',_0x4c43('0xa9')]]}]},{'model':db[_0x4c43('0xaa')],'as':_0x4c43('0xab')},{'model':db[_0x4c43('0x98')],'as':'Interval','include':[{'model':db[_0x4c43('0x98')],'as':_0x4c43('0xac'),'attributes':['id',_0x4c43('0xad')],'raw':!![]}]}]});})[_0x4c43('0x1b')](function(_0x26a31c){if(!_0x26a31c){throw new APINotFoundError(util['format'](_0x4c43('0xae'),_0x23083b[_0x4c43('0x65')]['id']));}if(_0x331add){return checkWebsiteInterval(_0x26a31c);}return _0x26a31c;})[_0x4c43('0x1b')](function(_0xd37cc1){_0x4fd12f[_0x4c43('0xaf')]=_0xd37cc1;_0x4fd12f['applications']=_[_0x4c43('0xb0')](_0xd37cc1[_0x4c43('0xab')],[_0x4c43('0xb1')],[_0x4c43('0xb2')]);if(_0x4fd12f[_0x4c43('0xaf')]['Applications']){delete _0x4fd12f[_0x4c43('0xaf')][_0x4c43('0xab')];}_0x4fd12f[_0x4c43('0xb3')]=_0xd37cc1[_0x4c43('0xa7')]||{'id':_0xd37cc1[_0x4c43('0xa3')]};if(_0x4fd12f[_0x4c43('0xb3')]&&_0x4fd12f['list'][_0x4c43('0xb4')]['length']){return _0x4fd12f['list'][_0x4c43('0xb4')][0x0];}var _0x2d8057=_['defaults'](_0x23083b[_0x4c43('0x68')],{'firstName':_0x23083b[_0x4c43('0x68')][_0x4c43('0xa5')],'ListId':_0xd37cc1[_0x4c43('0xa3')]});_0x2d8057[_0x23083b[_0x4c43('0x68')][_0x4c43('0xa4')]]=_0x23083b['body'][_0x4c43('0xa5')];return db['CmContact'][_0x4c43('0x6a')](_0x2d8057,{'fields':_0x4be9f1,'raw':!![]});})[_0x4c43('0x1b')](function(_0x1b1594){_0x4fd12f['contact']=_0x1b1594;var _0x32fa57=createInteractionObject(_0x23083b['params']['id'],_0x23083b['body'],_0x23083b[_0x4c43('0xb5')],_0x1b1594);var _0x3a1541={'ChatWebsiteId':_0x23083b[_0x4c43('0x65')]['id']};if(_0x23083b[_0x4c43('0x68')][_0x4c43('0xb6')]){_0x3a1541[_0x4c43('0xb6')]=_0x23083b[_0x4c43('0x68')][_0x4c43('0xb6')];_0x3a1541[_0x4c43('0xb7')]=![];return db['ChatInteraction'][_0x4c43('0x71')]({'where':_0x3a1541})[_0x4c43('0x1b')](function(_0x211673){var _0x32b80d=_0x23083b[_0x4c43('0x68')]['customerIp']&&_0x23083b[_0x4c43('0x68')][_0x4c43('0x3e')];if(_0x211673){_0xb90642=!![];return _0x211673;}else if(!_0x32b80d&&_0x211673&&_0x211673[_0x4c43('0xb7')]){throw new APIConflictError(_0x4c43('0xb8'));}_0x32fa57[_0x4c43('0xb6')]=_0x23083b[_0x4c43('0x68')][_0x4c43('0xb6')];_0x32fa57[_0x4c43('0xb9')]=_0x23083b[_0x4c43('0x68')][_0x4c43('0xb9')];return db[_0x4c43('0xba')]['create'](_0x32fa57);});}_0x3a1541[_0x4c43('0xbb')]=_0x1b1594['id'];if(_0x23083b[_0x4c43('0x68')][_0x4c43('0xbc')]&&_0x23083b[_0x4c43('0x68')]['interaction']['id']){_0x3a1541['id']=_0x23083b[_0x4c43('0x68')][_0x4c43('0xbc')]['id'];return db[_0x4c43('0xba')][_0x4c43('0x71')]({'where':_0x3a1541})['then'](function(_0x27167d){var _0x1355cd=_0x23083b['body'][_0x4c43('0x9e')]&&_0x23083b[_0x4c43('0x68')][_0x4c43('0x3e')];if(!_0x1355cd&&_0x27167d&&_0x27167d[_0x4c43('0xb7')]){throw new APIConflictError(_0x4c43('0xb8'));}else if(_0x27167d){_0xb90642=!![];return _0x27167d;}else{return db[_0x4c43('0xba')]['create'](_0x32fa57);}});}return db[_0x4c43('0xba')][_0x4c43('0x6a')](_0x32fa57);})[_0x4c43('0x1b')](function(_0x49231b){if(!_0xb90642){return _0x49231b;}var _0x7102e8={'from':(_0x4fd12f[_0x4c43('0xbd')][_0x4c43('0xbe')]||'')+'\x20'+(_0x4fd12f[_0x4c43('0xbd')][_0x4c43('0x3c')]||'')};if(_0x23083b['body']['threadId']&&_0x23083b[_0x4c43('0x68')][_0x4c43('0xbf')]&&_0x23083b[_0x4c43('0x68')][_0x4c43('0xb6')]!=_0x23083b[_0x4c43('0x68')][_0x4c43('0xbf')]){_0x7102e8[_0x4c43('0xb6')]=_0x23083b[_0x4c43('0x68')][_0x4c43('0xbf')];}return _0x49231b[_0x4c43('0x2f')](_0x7102e8);})[_0x4c43('0x1b')](function(_0x2f9655){_0x4fd12f[_0x4c43('0xbc')]=_0x2f9655[_0x4c43('0x30')]({'plain':!![]});_0x4fd12f[_0x4c43('0xbc')][_0x4c43('0xc0')]=!_0xb90642;if(_0x4fd12f[_0x4c43('0xbc')][_0x4c43('0xc0')]){if(_0x4fd12f[_0x4c43('0xaf')][_0x4c43('0xc1')]){_0x4fd12f[_0x4c43('0xc2')][_0x4c43('0xc3')]({'id':0x0,'priority':_0x4fd12f[_0x4c43('0xc2')][_0x4c43('0x57')]+0x1,'app':_0x4c43('0xc4'),'appdata':'unmanaged','interval':_0x4c43('0xc5')});}}return db['ChatMessage']['create']({'body':_0x23083b['body'][_0x4c43('0x68')],'ChatWebsiteId':_0x23083b[_0x4c43('0x65')]['id'],'ChatInteractionId':_0x2f9655['id'],'direction':'in','ContactId':_0x4fd12f['contact']['id'],'AttachmentId':_0x23083b[_0x4c43('0x68')][_0x4c43('0xc6')]});})['then'](function(_0x4ce020){_0x4fd12f[_0x4c43('0x23')]=_0x4ce020;if(!_0x4fd12f[_0x4c43('0xbc')]['UserId']){return;}return db[_0x4c43('0xc7')][_0x4c43('0x71')]({'attributes':['id','name'],'where':{'id':_0x4fd12f[_0x4c43('0xbc')][_0x4c43('0xc8')]}});})[_0x4c43('0x1b')](function(_0x442ae8){if(_0x442ae8){_0x4fd12f['applications'][_0x4c43('0xc9')]({'id':0x0,'priority':0x0,'app':_0x4c43('0xca'),'appdata':_0x442ae8[_0x4c43('0x35')]+','+(_0x4fd12f[_0x4c43('0xaf')][_0x4c43('0xcb')]||0xa),'interval':_0x4c43('0xc5')});_0x4fd12f[_0x4c43('0xcc')]=!![];}if(!_0x4fd12f[_0x4c43('0xbc')]['queueId']){return;}return db[_0x4c43('0xcd')][_0x4c43('0x71')]({'attributes':['id','name'],'where':{'id':_0x4fd12f[_0x4c43('0xbc')][_0x4c43('0xce')]}});})[_0x4c43('0x1b')](function(_0x103c4a){if(_0x103c4a){_0x4fd12f[_0x4c43('0xc2')][_0x4c43('0xc9')]({'id':0x0,'priority':0x1,'app':_0x4c43('0xcf'),'appdata':_0x103c4a[_0x4c43('0x35')]+','+(_0x4fd12f[_0x4c43('0xaf')][_0x4c43('0xd0')]||0x12c),'interval':_0x4c43('0xc5')});}return respondWithRpcPromise('Start','startRouting',_0x4fd12f);})[_0x4c43('0x1b')](function(_0x35cc70){respondWithRpcPromise(_0x4c43('0xd1'),'EventManager',{'event':_0x4c43('0xd2'),'message':_0x35cc70},client9002);return _0x35cc70;})[_0x4c43('0x1b')](respondWithResult(_0xd32541,null))[_0x4c43('0x25')](APIHandleError(_0xd32541));};exports[_0x4c43('0xd3')]=function(_0x4931a3,_0x50e806){var _0xc88c6,_0x16c278,_0x280fda;var _0x528980=[];var _0x2c4f5c={};var _0x170dfb=_0x4931a3[_0x4c43('0xd4')]||[];var _0x480e4b=[];var _0x3beb26;return db[_0x4c43('0xa8')][_0x4c43('0x72')]()['then'](function(_0x1351a5){if(!_0x1351a5){throw new db[(_0x4c43('0xd5'))][(_0x4c43('0xd6'))]('no\x20available\x20attributes');}_0x528980=_[_0x4c43('0xd7')](_['keys'](_0x1351a5),[_0x4c43('0xd8'),_0x4c43('0xa0'),_0x4c43('0xa2'),_0x4c43('0xa3')]);if(_0x4931a3['body']['id']){delete _0x4931a3[_0x4c43('0x68')]['id'];}if(_[_0x4c43('0x8d')](_0x4931a3[_0x4c43('0x68')]['from'])){throw _0x50e806[_0x4c43('0x27')](0x1f4)['send'](new db[(_0x4c43('0xd5'))][(_0x4c43('0xd6'))](_0x4c43('0xd9')));}if(_['isNil'](_0x4931a3[_0x4c43('0x68')]['body'])||_0x4931a3[_0x4c43('0x68')][_0x4c43('0x68')]===''){throw _0x50e806[_0x4c43('0x27')](0x1f4)[_0x4c43('0xda')](new db['Sequelize'][(_0x4c43('0xd6'))](_0x4c43('0xdb')));}if(_[_0x4c43('0x8d')](_0x4931a3[_0x4c43('0x68')]['mapKeyOffline'])){throw _0x50e806[_0x4c43('0x27')](0x1f4)[_0x4c43('0xda')](new db[(_0x4c43('0xd5'))]['ValidationError'](_0x4c43('0xdc')+_0x528980));}if(!_[_0x4c43('0xa1')](_0x528980,_0x4931a3[_0x4c43('0x68')][_0x4c43('0xdd')])){throw _0x50e806[_0x4c43('0x27')](0x1f4)[_0x4c43('0xda')](new db[(_0x4c43('0xd5'))][(_0x4c43('0xd6'))](_0x4c43('0xde')+_0x528980));}_0x2c4f5c[_0x4931a3[_0x4c43('0x68')]['mapKeyOffline']]=_0x4931a3[_0x4c43('0x68')][_0x4c43('0xa5')];})['then'](function(){return db[_0x4c43('0x4c')]['find']({'where':{'id':_0x4931a3[_0x4c43('0x65')]['id']},'include':[{'model':db['CmList'],'as':_0x4c43('0xa7')},{'model':db['MailAccount'],'as':_0x4c43('0xdf')}]});})[_0x4c43('0x1b')](handleEntityNotFound(_0x50e806,null))['then'](function(_0x1e859c){if(_0x1e859c&&_0x1e859c[_0x4c43('0xa7')]){_0x16c278=_0x1e859c;var _0x324eb0=_[_0x4c43('0x14')](_0x4931a3[_0x4c43('0x68')],{'firstName':_0x4931a3['body'][_0x4c43('0xa5')],'phone':_0x4931a3[_0x4c43('0x68')][_0x4c43('0xa5')],'ListId':_0x1e859c[_0x4c43('0xa3')]});_0x324eb0[_0x4931a3['body'][_0x4c43('0xdd')]]=_0x4931a3[_0x4c43('0x68')][_0x4c43('0xa5')];return db[_0x4c43('0xa8')]['findOrCreate']({'where':_0x2c4f5c,'defaults':_0x324eb0});}})[_0x4c43('0xe0')](function(_0x149762){if(_0x149762){_0x280fda=_0x149762;var _0x5405c1=fs['readFileSync'](path[_0x4c43('0x88')](config[_0x4c43('0x89')],'server/files/templates/chatOfflineMessage.ejs'),_0x4c43('0xe1'));var _0x4c04ae=ejs[_0x4c43('0xe2')](_0x5405c1,{'body':_['toPairs'](_0x4931a3[_0x4c43('0x68')][_0x4c43('0x68')]),'bodyTitle':_0x16c278[_0x4c43('0xe3')]});return db[_0x4c43('0xe4')][_0x4c43('0x6a')]({'body':_0x4c04ae,'plainBody':htmlToText['fromString'](_0x4c04ae),'ContactId':_0x149762['id'],'ChatWebsiteId':_0x16c278['id']});}})[_0x4c43('0x1b')](function(_0x26ecab){_0x3beb26=_0x26ecab;if(_0x170dfb['length']){var _0x1f235e=_0x170dfb['map'](function(_0x59a145){return{'name':_0x59a145[_0x4c43('0xe5')],'basename':_0x59a145['filename'],'type':_0x59a145['mimetype'],'ChatOfflineMessageId':_0x26ecab['id']};});_0x480e4b=_0x1f235e[_0x4c43('0x50')](_0x52ab84=>{var _0x44b2e4={'filename':_0x52ab84[_0x4c43('0x35')],'path':path['join'](config[_0x4c43('0x89')],_0x4c43('0xe6'),_0x4c43('0xd4'),_0x4c43('0xe7'),_0x4c43('0xe8'),_0x52ab84['basename'])};return _0x44b2e4;});if(!_0x16c278['openNewInteraction']){return db[_0x4c43('0xe9')][_0x4c43('0xea')](function(_0x36a546){return db[_0x4c43('0xeb')][_0x4c43('0xec')](_0x1f235e,{'transaction':_0x36a546});});}}})[_0x4c43('0x1b')](function(){if(_0x3beb26){_0xc88c6=_0x3beb26;return db['MailAccount']['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x4c43('0xed')],'as':_0x4c43('0xee'),'raw':!![],'include':[{'model':db[_0x4c43('0xef')],'as':_0x4c43('0xef'),'raw':!![]}]}]});}})[_0x4c43('0x1b')](function(_0xb8bde5){if(_0xb8bde5&&_0xb8bde5[_0x4c43('0xee')]&&_0x16c278[_0x4c43('0xf0')]&&_0x16c278[_0x4c43('0xf1')]){var _0x3676a6=_0xb8bde5[_0x4c43('0xf2')]();return respondWithRpcPromise(_0x4c43('0xf3'),_0x4c43('0xf4'),{'account':_0x3676a6,'message':{'from':util[_0x4c43('0x41')](_0x4c43('0xf5'),_0xb8bde5[_0x4c43('0x35')],_0xb8bde5[_0x4c43('0xf6')]||_0xb8bde5['Smtp'][_0x4c43('0x6b')]),'to':_0x16c278[_0x4c43('0xf1')],'subject':_0x16c278['offlineMessageSubject'],'html':_0xc88c6['body'],'attachments':_0x480e4b}},client9003)['then'](function(){return _0xc88c6;})[_0x4c43('0x25')](function(_0x263c5a){logger[_0x4c43('0x22')](_0x263c5a);});}})[_0x4c43('0x1b')](function(){if(_0x16c278&&_0x16c278[_0x4c43('0xf7')]&&_0x16c278[_0x4c43('0xf8')]){var _0x1ca2e3=[];if(_0x170dfb[_0x4c43('0x57')]){_0x1ca2e3=_0x170dfb[_0x4c43('0x50')](function(_0x4c8756){return{'name':_0x4c8756[_0x4c43('0xe5')],'basename':_0x4c8756[_0x4c43('0x86')],'type':_0x4c8756[_0x4c43('0xf9')],'ChatOfflineMessageId':_0x3beb26['id']};});}var _0x5cb9a0;if(!_[_0x4c43('0x8d')](_0x16c278[_0x4c43('0xfa')])){var _0x128870=_[_0x4c43('0x50')](_0x4931a3[_0x4c43('0x68')],function(_0x58f128){return _0x58f128;});var _0x2d62e9=_[_0x4c43('0xfb')](_0x128870)[0x0];var _0x39e65f=_[_0x4c43('0xfc')](_0x2d62e9,function(_0x3c47ca){return _0x3c47ca;});_0x5cb9a0=_0x39e65f[0x1][_0x16c278[_0x4c43('0xfa')]];}var _0x5c4241={'from':_0x280fda[_0x4c43('0xf6')],'firstName':_0x280fda[_0x4c43('0xbe')],'lastName':_0x280fda['lastName'],'mapKey':'email','message':{'from':_0x280fda[_0x4c43('0xf6')],'to':_0x16c278[_0x4c43('0xdf')][_0x4c43('0xf6')],'cc':'','subject':_[_0x4c43('0x8d')](_0x5cb9a0)?_0x16c278[_0x4c43('0xfd')]:_0x5cb9a0,'messageId':'','sentAt':new Date(),'attach':_0x1ca2e3[_0x4c43('0x57')],'attachments':_0x1ca2e3,'originChannel':_0x4c43('0xfe'),'ChatWebsiteId':_0x16c278['id'],'ChatOfflineMessageId':_0xc88c6['id'],'originTo':_0x16c278[_0x4c43('0xdf')][_0x4c43('0xf6')]},'body':_0xc88c6[_0x4c43('0x68')]};var _0x34cc71={'account':{'id':_0x16c278[_0x4c43('0xf8')]},'body':_0x5c4241,'log':_0x4c43('0xff')};return respondWithRpcPromise(_0x4c43('0xff'),'notifyMail',_0x34cc71,client9001)[_0x4c43('0x1b')](function(){return _0xc88c6;})[_0x4c43('0x25')](function(_0x28b0f7){logger['error'](_0x28b0f7);});}return;})[_0x4c43('0x1b')](function(){if(_0xc88c6){return _0xc88c6;}})[_0x4c43('0x1b')](respondWithResult(_0x50e806,null))[_0x4c43('0x25')](function(){for(var _0x259447 of _0x170dfb){var _0x14ab7f=path[_0x4c43('0x88')](config['root'],_0x4c43('0xe6'),'files',_0x4c43('0xe7'),_0x4c43('0xe8'),_0x259447['filename']);fs_extra[_0x4c43('0x100')](_0x14ab7f)['catch'](function(_0x190b52){logger[_0x4c43('0x22')](_0x4c43('0x101'),_0x14ab7f,_0x190b52);});}});};exports[_0x4c43('0x102')]=function(_0x31c379,_0x1f6050){return db['ChatInteraction']['find']({'where':{'id':_0x31c379[_0x4c43('0x65')]['id']}})[_0x4c43('0x1b')](handleEntityNotFound(_0x1f6050,null))[_0x4c43('0x1b')](function(_0x30b623){if(_0x30b623){return _0x30b623[_0x4c43('0x102')](_0x31c379[_0x4c43('0x68')]['ids'],_[_0x4c43('0x103')](_0x31c379[_0x4c43('0x68')],['ids','id'])||{});}})['then'](respondWithResult(_0x1f6050,null))[_0x4c43('0x25')](handleError(_0x1f6050,null));};exports['getInteractions']=function(_0x1ec6e0,_0x146456){var _0x12a285={'raw':![],'where':{}};var _0x2a247e={};var _0x5be533={'count':0x0,'rows':[]};return db[_0x4c43('0x4c')]['findOne']({'where':{'id':_0x1ec6e0[_0x4c43('0x65')]['id']}})[_0x4c43('0x1b')](handleEntityNotFound(_0x146456,null))['then'](function(_0x1588b9){if(_0x1588b9){_0x2a247e[_0x4c43('0x44')]=_['keys'](db[_0x4c43('0xba')]['rawAttributes']);_0x2a247e[_0x4c43('0x51')]=_[_0x4c43('0x52')](_0x1ec6e0[_0x4c43('0x51')]);_0x2a247e[_0x4c43('0x53')]=_[_0x4c43('0x54')](_0x2a247e[_0x4c43('0x44')],_0x2a247e[_0x4c43('0x51')]);_0x12a285[_0x4c43('0x55')]=_[_0x4c43('0x54')](_0x2a247e[_0x4c43('0x44')],qs[_0x4c43('0x56')](_0x1ec6e0[_0x4c43('0x51')][_0x4c43('0x56')]));_0x12a285[_0x4c43('0x55')]=_0x12a285[_0x4c43('0x55')][_0x4c43('0x57')]?_0x12a285[_0x4c43('0x55')]:_0x2a247e['model'];if(!_0x1ec6e0[_0x4c43('0x51')]['hasOwnProperty'](_0x4c43('0x77'))){_0x12a285['limit']=qs['limit'](_0x1ec6e0['query'][_0x4c43('0x2b')]);_0x12a285[_0x4c43('0x29')]=qs[_0x4c43('0x29')](_0x1ec6e0[_0x4c43('0x51')][_0x4c43('0x29')]);}_0x12a285[_0x4c43('0x59')]=qs[_0x4c43('0x5a')](_0x1ec6e0['query']['sort']);_0x12a285[_0x4c43('0x5d')]=qs[_0x4c43('0x53')](_[_0x4c43('0x5b')](_0x1ec6e0[_0x4c43('0x51')],_0x2a247e['filters']));_0x12a285['where']['ChatWebsiteId']=_0x1588b9['id'];if(_0x1ec6e0['query'][_0x4c43('0x5c')]){_0x12a285[_0x4c43('0x5d')]=_[_0x4c43('0x5e')](_0x12a285['where'],{'$or':_[_0x4c43('0x50')](_0x12a285[_0x4c43('0x55')],function(_0xaee59b){var _0xb48cf0={};_0xb48cf0[_0xaee59b]={'$like':'%'+_0x1ec6e0[_0x4c43('0x51')][_0x4c43('0x5c')]+'%'};return _0xb48cf0;})});}_0x12a285=_[_0x4c43('0x5e')]({},_0x12a285,_0x1ec6e0[_0x4c43('0x60')]);return db['ChatInteraction']['count']({'where':_0x12a285['where']})[_0x4c43('0x1b')](function(_0x3b0317){_0x5be533[_0x4c43('0x2c')]=_0x3b0317;if(_0x1ec6e0[_0x4c43('0x51')][_0x4c43('0x61')]){_0x12a285['include']=[{'model':db['CmContact'],'as':_0x4c43('0x104'),'required':![]},{'model':db['User'],'as':_0x4c43('0x105'),'attributes':[_0x4c43('0x35'),'fullname',_0x4c43('0x106')],'required':![]},{'model':db[_0x4c43('0x107')],'as':_0x4c43('0x108'),'attributes':['id',_0x4c43('0x35'),'color'],'where':_0x1ec6e0[_0x4c43('0x51')][_0x4c43('0x109')]?{'id':_0x1ec6e0[_0x4c43('0x51')][_0x4c43('0x109')]}:undefined,'required':_0x1ec6e0['query'][_0x4c43('0x109')]?!![]:![]}];}return db[_0x4c43('0xba')][_0x4c43('0x63')](_0x12a285);})['then'](function(_0x38e19d){_0x5be533[_0x4c43('0x64')]=_0x38e19d;return _0x5be533;});}})[_0x4c43('0x1b')](respondWithFilteredResult(_0x146456,_0x12a285))[_0x4c43('0x25')](handleError(_0x146456,null));};exports[_0x4c43('0x10a')]=function(_0x14d63c,_0x2c827d){var _0x31ba49=0x0;var _0x30aa0f=0x0;var _0x4ca944=![];var _0x27ecef;var _0x173b4e;return db[_0x4c43('0x4c')][_0x4c43('0x71')]({'where':{'id':_0x14d63c[_0x4c43('0x65')]['id']},'include':[{'model':db[_0x4c43('0x98')],'as':_0x4c43('0x98'),'include':[{'model':db['Interval'],'as':'Intervals','attributes':['id',_0x4c43('0xad')]}]}]})[_0x4c43('0x1b')](handleEntityNotFound(_0x2c827d,null))[_0x4c43('0x1b')](function(_0x2f7dca){if(_0x2f7dca){_0x27ecef=_0x2f7dca;return _0x2f7dca['getProactiveActions']({'raw':!![]});}})[_0x4c43('0x1b')](function(_0x44631d){if(_0x27ecef){if(_0x44631d){_0x173b4e=_0x44631d;}}return require(_0x4c43('0x8b'))[_0x4c43('0x8c')]();})[_0x4c43('0x1b')](function(_0x1f7393){if(_0x1f7393){_0x30aa0f=_0x1f7393[_0x4c43('0x10b')];_0x4ca944=_0x1f7393['custom'];}})['then'](function(){return db[_0x4c43('0xba')][_0x4c43('0x2c')]({'where':{'closed':![]}});})[_0x4c43('0x1b')](function(_0x4385d6){_0x31ba49=_0x4385d6;if(_0x30aa0f&&_0x4385d6>_0x30aa0f){return db[_0x4c43('0x10c')][_0x4c43('0x75')]({'where':{'id':0x1}})['then'](function(_0xb7fb21){if(_0xb7fb21){_0xb7fb21['increment'](_0x4c43('0x10d'));}});}})[_0x4c43('0x1b')](function(){var _0x1d0e68=_0x27ecef['Interval'];var _0x3582e7=_0x27ecef[_0x4c43('0x99')]||undefined;return _0x1d0e68?_0x1d0e68[_0x4c43('0x9a')](_0x3582e7):!![];})[_0x4c43('0x1b')](function(_0x579800){var _0x47b75d=fs[_0x4c43('0x10e')](path[_0x4c43('0x88')](config[_0x4c43('0x89')],_0x4c43('0x10f')),'utf8');var _0x75a08b=_0x4c43('0x110');var _0x1c88f0=![];try{const _0x257cc2=new URL(_0x27ecef[_0x4c43('0x67')]);_0x27ecef[_0x4c43('0x67')]=_0x257cc2[_0x4c43('0x111')];}catch(_0x5e68ff){}var _0x30d0ff;if(_0x14d63c[_0x4c43('0xb5')][_0x4c43('0x3e')]){_0x14d63c['headers'][_0x4c43('0x3e')]=_0x14d63c[_0x4c43('0xb5')]['referer'][_0x4c43('0x112')](/\/$/,'');_0x30d0ff=wildcardUtils[_0x4c43('0x113')](_0x27ecef[_0x4c43('0x67')],_0x14d63c['headers'][_0x4c43('0x3e')]);}else{_0x14d63c[_0x4c43('0xb5')]['referer']=_0x27ecef['address'];_0x30d0ff=!![];}var _0x49e1a6={'chatVersion':_0x75a08b,'chatWebsiteAddressOrigin':_0x30d0ff?_0x14d63c['headers'][_0x4c43('0x3e')]:_0x27ecef[_0x4c43('0x67')],'remote':_0x27ecef[_0x4c43('0x114')],'query':querystring[_0x4c43('0x21')](_[_0x4c43('0x5e')](_0x27ecef[_0x4c43('0x30')]({'plain':!![]}),{'customerIp':_0x14d63c[_0x4c43('0xb5')][_0x4c43('0x3a')]||_0x14d63c['headers'][_0x4c43('0x115')]||_0x14d63c[_0x4c43('0x116')]['remoteAddress']||_0x14d63c['ip'],'referer':_0x14d63c[_0x4c43('0xb5')]['referer'],'openedInteractions':_0x31ba49,'maxInteractions':_0x30aa0f,'virtual':_0x4ca944['virtual'],'online':_0x579800,'custom':_0x4ca944,'address':_0x30d0ff?_0x14d63c['headers'][_0x4c43('0x3e')]:null}))[_0x4c43('0x112')](/'/g,'\x5c\x27')};_0x2c827d[_0x4c43('0xda')](ejs['render'](Mustache['render'](_0x47b75d,_0x49e1a6),{'proactiveActions':_0x173b4e,'alignment':_0x27ecef[_0x4c43('0x117')],'verticalAlignment':_0x27ecef[_0x4c43('0x118')],'div_color':_0x27ecef[_0x4c43('0x119')],'labelText':_0x27ecef[_0x4c43('0x11a')],'text_color':_0x27ecef['textColor'],'text_button_color':_0x27ecef[_0x4c43('0x11b')],'button_color':_0x27ecef['color_button'],'background_color':_0x27ecef[_0x4c43('0x11c')],'hideWhenOffline':_0x27ecef['hideWhenOffline'],'intervalId':_0x27ecef[_0x4c43('0x11d')],'isDevelopment':_0x1c88f0,'chatVersion':_0x75a08b}));})[_0x4c43('0x25')](handleError(_0x2c827d,null));};exports[_0x4c43('0x11e')]=function(_0x2cdf59,_0x25b5c1){var _0x3f3620=_0x2cdf59[_0x4c43('0x65')]['id'];var _0x5239dc=_0x2cdf59[_0x4c43('0x68')];var _0x3e5c0c=0xc8;var _0x3c25fe=null;return db[_0x4c43('0xe9')][_0x4c43('0xea')]({'isolationLevel':db[_0x4c43('0xe9')]['Transaction'][_0x4c43('0x11f')][_0x4c43('0x120')]},function(_0x2879d9){return db[_0x4c43('0x4c')][_0x4c43('0x75')]({'where':{'id':_0x3f3620},'transaction':_0x2879d9})[_0x4c43('0x1b')](function(_0x42a697){if(_0x42a697){return db['ChatApplication'][_0x4c43('0x33')]({'where':{'ChatWebsiteId':_0x3f3620},'transaction':_0x2879d9})[_0x4c43('0x1b')](function(){var _0x40b0af=_[_0x4c43('0x50')](_0x5239dc,function(_0x16e38d){_0x16e38d[_0x4c43('0x78')]=_0x3f3620;return _0x16e38d;});return db[_0x4c43('0xaa')]['bulkCreate'](_0x40b0af,{'transaction':_0x2879d9});});}else{_0x3e5c0c=0x194;_0x3c25fe=[];}});})['then'](function(){if(_0x3e5c0c!==0x194){return db[_0x4c43('0xaa')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x3f3620},'order':'priority'})['then'](function(_0x59c5df){_0x3c25fe=_0x59c5df;});}})['catch'](function(_0x1901dc){_0x3e5c0c=0x1f4;logger[_0x4c43('0x22')](_0x1901dc['stack']);if(_0x1901dc['name']){delete _0x1901dc[_0x4c43('0x35')];}_0x3c25fe=_0x1901dc;})[_0x4c43('0x121')](function(){if(_0x3c25fe===null){_0x25b5c1[_0x4c43('0x26')](_0x3e5c0c);}else{if(_0x3e5c0c===0x1f4){_0x25b5c1['status'](_0x3e5c0c)[_0x4c43('0xda')](_0x3c25fe);}else{_0x25b5c1[_0x4c43('0x27')](_0x3e5c0c)[_0x4c43('0x28')](_0x3c25fe);}}});};exports[_0x4c43('0x122')]=function(_0x1ac7d1,_0x5672d0){var _0x507117={};var _0x202d28={};var _0x2a62d2;var _0x1f96a8;return db[_0x4c43('0x4c')]['findOne']({'where':{'id':_0x1ac7d1['params']['id']}})[_0x4c43('0x1b')](handleEntityNotFound(_0x5672d0,null))['then'](function(_0x27b543){if(_0x27b543){_0x2a62d2=_0x27b543;_0x202d28[_0x4c43('0x44')]=_[_0x4c43('0x52')](db[_0x4c43('0xaa')][_0x4c43('0x4d')]);_0x202d28[_0x4c43('0x51')]=_[_0x4c43('0x52')](_0x1ac7d1['query']);_0x202d28[_0x4c43('0x53')]=_[_0x4c43('0x54')](_0x202d28['model'],_0x202d28[_0x4c43('0x51')]);_0x507117['attributes']=_['intersection'](_0x202d28[_0x4c43('0x44')],qs[_0x4c43('0x56')](_0x1ac7d1[_0x4c43('0x51')]['fields']));_0x507117[_0x4c43('0x55')]=_0x507117['attributes'][_0x4c43('0x57')]?_0x507117[_0x4c43('0x55')]:_0x202d28[_0x4c43('0x44')];_0x507117[_0x4c43('0x59')]=qs[_0x4c43('0x5a')](_0x1ac7d1[_0x4c43('0x51')][_0x4c43('0x5a')]);_0x507117[_0x4c43('0x5d')]=qs['filters'](_['pick'](_0x1ac7d1['query'],_0x202d28['filters']));if(_0x1ac7d1[_0x4c43('0x51')]['filter']){_0x507117[_0x4c43('0x5d')]=_[_0x4c43('0x5e')](_0x507117[_0x4c43('0x5d')],{'$or':_[_0x4c43('0x50')](_0x507117['attributes'],function(_0x121b98){var _0x263edf={};_0x263edf[_0x121b98]={'$like':'%'+_0x1ac7d1['query'][_0x4c43('0x5c')]+'%'};return _0x263edf;})});}_0x507117=_['merge']({},_0x507117,_0x1ac7d1[_0x4c43('0x60')]);return _0x2a62d2[_0x4c43('0x122')](_0x507117);}})[_0x4c43('0x1b')](function(_0x1cfe3b){if(_0x1cfe3b){_0x1f96a8=_0x1cfe3b[_0x4c43('0x57')];if(!_0x1ac7d1['query'][_0x4c43('0x58')](_0x4c43('0x77'))){_0x507117['limit']=qs[_0x4c43('0x2b')](_0x1ac7d1['query'][_0x4c43('0x2b')]);_0x507117['offset']=qs['offset'](_0x1ac7d1[_0x4c43('0x51')][_0x4c43('0x29')]);}return _0x2a62d2['getApplications'](_0x507117);}})[_0x4c43('0x1b')](function(_0x370505){if(_0x370505){return _0x370505?{'count':_0x1f96a8,'rows':_0x370505}:null;}})[_0x4c43('0x1b')](respondWithResult(_0x5672d0,null))[_0x4c43('0x25')](handleError(_0x5672d0,null));};exports[_0x4c43('0x123')]=function(_0x3475fb,_0x50761f){return db[_0x4c43('0x124')][_0x4c43('0x71')]({'where':{'id':_0x3475fb[_0x4c43('0x65')]['id']}})[_0x4c43('0x1b')](handleEntityNotFound(_0x50761f,null))[_0x4c43('0x1b')](function(_0x5f5889){if(_0x5f5889){return _0x5f5889[_0x4c43('0x123')](_0x3475fb[_0x4c43('0x68')]['ids'],_['omit'](_0x3475fb['body'],[_0x4c43('0x7a'),'id'])||{});}})[_0x4c43('0x1b')](respondWithResult(_0x50761f,null))['catch'](handleError(_0x50761f,null));};exports[_0x4c43('0x125')]=function(_0x267515,_0x4fe0b4){var _0xd351c7={};var _0x3cc464={};var _0xaa7593;var _0x3b968a;return db[_0x4c43('0x4c')]['findOne']({'where':{'id':_0x267515['params']['id']}})[_0x4c43('0x1b')](handleEntityNotFound(_0x4fe0b4,null))[_0x4c43('0x1b')](function(_0x4f9db1){if(_0x4f9db1){_0xaa7593=_0x4f9db1;_0x3cc464['model']=_['keys'](db[_0x4c43('0x126')][_0x4c43('0x4d')]);_0x3cc464[_0x4c43('0x51')]=_['keys'](_0x267515[_0x4c43('0x51')]);_0x3cc464['filters']=_[_0x4c43('0x54')](_0x3cc464[_0x4c43('0x44')],_0x3cc464[_0x4c43('0x51')]);_0xd351c7[_0x4c43('0x55')]=_[_0x4c43('0x54')](_0x3cc464[_0x4c43('0x44')],qs['fields'](_0x267515[_0x4c43('0x51')][_0x4c43('0x56')]));_0xd351c7[_0x4c43('0x55')]=_0xd351c7[_0x4c43('0x55')][_0x4c43('0x57')]?_0xd351c7[_0x4c43('0x55')]:_0x3cc464[_0x4c43('0x44')];_0xd351c7[_0x4c43('0x59')]=qs['sort'](_0x267515['query'][_0x4c43('0x5a')]);_0xd351c7['where']=qs[_0x4c43('0x53')](_[_0x4c43('0x5b')](_0x267515[_0x4c43('0x51')],_0x3cc464[_0x4c43('0x53')]));if(_0x267515[_0x4c43('0x51')][_0x4c43('0x5c')]){_0xd351c7[_0x4c43('0x5d')]=_[_0x4c43('0x5e')](_0xd351c7[_0x4c43('0x5d')],{'$or':_['map'](_0xd351c7[_0x4c43('0x55')],function(_0x151523){var _0x5514e9={};_0x5514e9[_0x151523]={'$like':'%'+_0x267515[_0x4c43('0x51')]['filter']+'%'};return _0x5514e9;})});}_0xd351c7=_[_0x4c43('0x5e')]({},_0xd351c7,_0x267515[_0x4c43('0x60')]);return _0xaa7593[_0x4c43('0x125')](_0xd351c7);}})[_0x4c43('0x1b')](function(_0xf5db75){if(_0xf5db75){_0x3b968a=_0xf5db75[_0x4c43('0x57')];if(!_0x267515[_0x4c43('0x51')]['hasOwnProperty'](_0x4c43('0x77'))){_0xd351c7[_0x4c43('0x2b')]=qs['limit'](_0x267515[_0x4c43('0x51')]['limit']);_0xd351c7['offset']=qs[_0x4c43('0x29')](_0x267515[_0x4c43('0x51')]['offset']);}return _0xaa7593[_0x4c43('0x125')](_0xd351c7);}})[_0x4c43('0x1b')](function(_0x58ef26){if(_0x58ef26){return _0x58ef26?{'count':_0x3b968a,'rows':_0x58ef26}:null;}})['then'](respondWithResult(_0x4fe0b4,null))[_0x4c43('0x25')](handleError(_0x4fe0b4,null));};exports[_0x4c43('0x127')]=function(_0x2d47c3,_0x1e01b2){var _0x1eb112=_0x2d47c3[_0x4c43('0x51')][_0x4c43('0x128')]===_0x4c43('0x129')?_0x4c43('0x12a'):_0x4c43('0x12b');return db[_0x4c43('0x4c')][_0x4c43('0x71')]({'attributes':['id',_0x1eb112],'where':{'id':_0x2d47c3[_0x4c43('0x65')]['id']}})[_0x4c43('0x1b')](handleEntityNotFound(_0x1e01b2,null))[_0x4c43('0x1b')](function(_0x29405d){if(_0x29405d){var _0x533cee=_0x29405d[_0x1eb112];var _0x58d283=_0x533cee&&_0x533cee['items']?_0x533cee[_0x4c43('0x12c')]:[];_0x1e01b2['send']({'fromKey':_[_0x4c43('0x8d')](_0x533cee['fromKey'])?undefined:_0x533cee[_0x4c43('0x12d')],'count':_0x58d283[_0x4c43('0x57')],'rows':_0x58d283});}})[_0x4c43('0x25')](handleError(_0x1e01b2,null));};exports[_0x4c43('0x12e')]=function(_0x580675,_0x33b350){var _0xe97f74={'raw':![],'where':{}};var _0xafd508={};var _0x48c5c4={'count':0x0,'rows':[]};return db[_0x4c43('0x4c')][_0x4c43('0x75')]({'where':{'id':_0x580675['params']['id']}})[_0x4c43('0x1b')](handleEntityNotFound(_0x33b350,null))[_0x4c43('0x1b')](function(_0x53e4c9){if(_0x53e4c9){_0xafd508[_0x4c43('0x44')]=_[_0x4c43('0x52')](db[_0x4c43('0xe4')][_0x4c43('0x4d')]);_0xafd508[_0x4c43('0x51')]=_[_0x4c43('0x52')](_0x580675[_0x4c43('0x51')]);_0xafd508[_0x4c43('0x53')]=_[_0x4c43('0x54')](_0xafd508[_0x4c43('0x44')],_0xafd508['query']);_0xe97f74[_0x4c43('0x55')]=_[_0x4c43('0x54')](_0xafd508[_0x4c43('0x44')],qs['fields'](_0x580675[_0x4c43('0x51')]['fields']));_0xe97f74[_0x4c43('0x55')]=_0xe97f74['attributes'][_0x4c43('0x57')]?_0xe97f74['attributes']:_0xafd508[_0x4c43('0x44')];if(!_0x580675['query'][_0x4c43('0x58')](_0x4c43('0x77'))){_0xe97f74[_0x4c43('0x2b')]=qs[_0x4c43('0x2b')](_0x580675[_0x4c43('0x51')][_0x4c43('0x2b')]);_0xe97f74[_0x4c43('0x29')]=qs[_0x4c43('0x29')](_0x580675[_0x4c43('0x51')][_0x4c43('0x29')]);}_0xe97f74['order']=qs[_0x4c43('0x5a')](_0x580675[_0x4c43('0x51')][_0x4c43('0x5a')]);_0xe97f74[_0x4c43('0x5d')]=qs[_0x4c43('0x53')](_['pick'](_0x580675[_0x4c43('0x51')],_0xafd508[_0x4c43('0x53')]));_0xe97f74['where']['ChatWebsiteId']=_0x53e4c9['id'];if(_0x580675[_0x4c43('0x51')][_0x4c43('0x5c')]){_0xe97f74[_0x4c43('0x5d')]=_['merge'](_0xe97f74['where'],{'$or':_[_0x4c43('0x50')](_0xe97f74[_0x4c43('0x55')],function(_0x5eb327){var _0x1c1744={};_0x1c1744[_0x5eb327]={'$like':'%'+_0x580675['query'][_0x4c43('0x5c')]+'%'};return _0x1c1744;})});}_0xe97f74=_['merge']({},_0xe97f74,_0x580675[_0x4c43('0x60')]);return db[_0x4c43('0xe4')][_0x4c43('0x2c')]({'where':_0xe97f74[_0x4c43('0x5d')]})['then'](function(_0x8a826f){_0x48c5c4[_0x4c43('0x2c')]=_0x8a826f;if(_0x580675[_0x4c43('0x51')][_0x4c43('0x61')]){_0xe97f74['include']=[{'all':!![]}];}else{_0xe97f74[_0x4c43('0x62')]=[{'model':db[_0x4c43('0xa8')],'as':_0x4c43('0x104'),'required':![]},{'model':db[_0x4c43('0xeb')],'as':_0x4c43('0x12f'),'required':![]}];}return db[_0x4c43('0xe4')][_0x4c43('0x63')](_0xe97f74);})['then'](function(_0xa227e6){_0x48c5c4[_0x4c43('0x64')]=_0xa227e6;return _0x48c5c4;});}})[_0x4c43('0x1b')](respondWithFilteredResult(_0x33b350,_0xe97f74))['catch'](handleError(_0x33b350,null));};exports[_0x4c43('0x130')]=function(_0x71ce16,_0x2688e9){return db[_0x4c43('0x4c')]['find']({'where':{'id':_0x71ce16[_0x4c43('0x65')]['id']}})[_0x4c43('0x1b')](handleEntityNotFound(_0x2688e9,null))['then'](function(_0x394328){if(_0x394328){return _0x394328[_0x4c43('0x130')](_0x71ce16['body'][_0x4c43('0x7a')],_[_0x4c43('0x103')](_0x71ce16[_0x4c43('0x68')],[_0x4c43('0x7a'),'id'])||{})[_0x4c43('0xe0')](function(_0x1719eb){for(var _0x1697dc=0x0;_0x1697dc<_0x71ce16[_0x4c43('0x68')][_0x4c43('0x7a')][_0x4c43('0x57')];_0x1697dc+=0x1){socket[_0x4c43('0x131')](_0x4c43('0x132'),{'UserId':Number(_0x71ce16[_0x4c43('0x68')][_0x4c43('0x7a')][_0x1697dc]),'ChatWebsiteId':Number(_0x71ce16[_0x4c43('0x65')]['id'])});}return _0x1719eb;});}})['then'](respondWithResult(_0x2688e9,null))[_0x4c43('0x25')](handleError(_0x2688e9,null));};exports[_0x4c43('0x133')]=function(_0x3582a2,_0x1c3f72){return db[_0x4c43('0x4c')]['find']({'where':{'id':_0x3582a2[_0x4c43('0x65')]['id']}})['then'](handleEntityNotFound(_0x1c3f72,null))[_0x4c43('0x1b')](function(_0x4f1ff0){if(_0x4f1ff0){return _0x4f1ff0[_0x4c43('0x133')](_0x3582a2[_0x4c43('0x51')][_0x4c43('0x7a')])[_0x4c43('0x1b')](function(){if(_[_0x4c43('0x134')](_0x3582a2[_0x4c43('0x51')][_0x4c43('0x7a')])){for(var _0x5548bd=0x0;_0x5548bd<_0x3582a2[_0x4c43('0x51')][_0x4c43('0x7a')][_0x4c43('0x57')];_0x5548bd+=0x1){socket[_0x4c43('0x131')]('userChatWebsite:remove',{'UserId':Number(_0x3582a2[_0x4c43('0x51')]['ids'][_0x5548bd]),'ChatWebsiteId':Number(_0x3582a2['params']['id'])});}}else{socket['emit'](_0x4c43('0x135'),{'UserId':Number(_0x3582a2[_0x4c43('0x51')]['ids']),'ChatWebsiteId':Number(_0x3582a2['params']['id'])});}});}})[_0x4c43('0x1b')](respondWithStatusCode(_0x1c3f72,null))[_0x4c43('0x25')](handleError(_0x1c3f72,null));};exports['getAgents']=function(_0x42af61,_0x4b6abc){var _0xe7540c={};var _0x133dda={};var _0xee6b11;var _0x48a031;return db['ChatWebsite']['findOne']({'where':{'id':_0x42af61['params']['id']}})[_0x4c43('0x1b')](handleEntityNotFound(_0x4b6abc,null))['then'](function(_0x3f9f87){if(_0x3f9f87){_0xee6b11=_0x3f9f87;_0x133dda[_0x4c43('0x44')]=_[_0x4c43('0x52')](db[_0x4c43('0xc7')][_0x4c43('0x4d')]);_0x133dda[_0x4c43('0x51')]=_[_0x4c43('0x52')](_0x42af61['query']);_0x133dda[_0x4c43('0x53')]=_[_0x4c43('0x54')](_0x133dda[_0x4c43('0x44')],_0x133dda['query']);_0xe7540c['attributes']=_[_0x4c43('0x54')](_0x133dda[_0x4c43('0x44')],qs['fields'](_0x42af61[_0x4c43('0x51')]['fields']));_0xe7540c[_0x4c43('0x55')]=_0xe7540c[_0x4c43('0x55')][_0x4c43('0x57')]?_0xe7540c[_0x4c43('0x55')]:_0x133dda[_0x4c43('0x44')];_0xe7540c[_0x4c43('0x59')]=qs[_0x4c43('0x5a')](_0x42af61['query'][_0x4c43('0x5a')]);_0xe7540c[_0x4c43('0x5d')]=qs[_0x4c43('0x53')](_[_0x4c43('0x5b')](_0x42af61[_0x4c43('0x51')],_0x133dda['filters']));if(_0x42af61['query']['filter']){_0xe7540c[_0x4c43('0x5d')]=_[_0x4c43('0x5e')](_0xe7540c[_0x4c43('0x5d')],{'$or':_['map'](_0xe7540c[_0x4c43('0x55')],function(_0x3cd5b5){var _0x552001={};_0x552001[_0x3cd5b5]={'$like':'%'+_0x42af61['query']['filter']+'%'};return _0x552001;})});}_0xe7540c=_[_0x4c43('0x5e')]({},_0xe7540c,_0x42af61[_0x4c43('0x60')]);return _0xee6b11[_0x4c43('0x136')](_0xe7540c);}})[_0x4c43('0x1b')](function(_0x3ed530){if(_0x3ed530){_0x48a031=_0x3ed530['length'];if(!_0x42af61['query']['hasOwnProperty']('nolimit')){_0xe7540c[_0x4c43('0x2b')]=qs[_0x4c43('0x2b')](_0x42af61[_0x4c43('0x51')][_0x4c43('0x2b')]);_0xe7540c['offset']=qs[_0x4c43('0x29')](_0x42af61['query'][_0x4c43('0x29')]);}return _0xee6b11[_0x4c43('0x136')](_0xe7540c);}})[_0x4c43('0x1b')](function(_0x210a41){if(_0x210a41){return _0x210a41?{'count':_0x48a031,'rows':_0x210a41}:null;}})[_0x4c43('0x1b')](respondWithResult(_0x4b6abc,null))[_0x4c43('0x25')](handleError(_0x4b6abc,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 2557632..5c36142 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 _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 +var _0x9f5a=['events','../../mysqldb','ChatWebsite','setMaxListeners','update','remove','emit','hook','exports'];(function(_0x5a3318,_0x1782a4){var _0x27d655=function(_0x36b613){while(--_0x36b613){_0x5a3318['push'](_0x5a3318['shift']());}};_0x27d655(++_0x1782a4);}(_0x9f5a,0xbd));var _0xa9f5=function(_0x27f2d7,_0x59f047){_0x27f2d7=_0x27f2d7-0x0;var _0x1bd22e=_0x9f5a[_0x27f2d7];return _0x1bd22e;};'use strict';var EventEmitter=require(_0xa9f5('0x0'));var ChatWebsite=require(_0xa9f5('0x1'))['db'][_0xa9f5('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xa9f5('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa9f5('0x4'),'afterDestroy':_0xa9f5('0x5')};function emitEvent(_0x3cdf79){return function(_0x4eeedd,_0x20f51f,_0x4c611b){ChatWebsiteEvents[_0xa9f5('0x6')](_0x3cdf79+':'+_0x4eeedd['id'],_0x4eeedd);ChatWebsiteEvents[_0xa9f5('0x6')](_0x3cdf79,_0x4eeedd);_0x4c611b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0xa9f5('0x7')](e,emitEvent(event));}}module[_0xa9f5('0x8')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index e73aedb..bc12104 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 _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 +var _0xd322=['request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','define','ChatWebsite','chat_websites','lodash','util','../../config/logger','api','moment'];(function(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0xd322,0x15a));var _0x2d32=function(_0x39fad0,_0x3edece){_0x39fad0=_0x39fad0-0x0;var _0x1f2663=_0xd322[_0x39fad0];return _0x1f2663;};'use strict';var _=require(_0x2d32('0x0'));var util=require(_0x2d32('0x1'));var logger=require(_0x2d32('0x2'))(_0x2d32('0x3'));var moment=require(_0x2d32('0x4'));var BPromise=require('bluebird');var rp=require(_0x2d32('0x5'));var fs=require('fs');var path=require(_0x2d32('0x6'));var rimraf=require(_0x2d32('0x7'));var config=require(_0x2d32('0x8'));var attributes=require(_0x2d32('0x9'));module['exports']=function(_0x58989a,_0x42ebad){return _0x58989a[_0x2d32('0xa')](_0x2d32('0xb'),attributes,{'tableName':_0x2d32('0xc'),'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 31626b2..13fe4a7 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 _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 +var _0x1614=['socket.io-emitter','./chatWebsite.socket','register','request','then','info','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost'];(function(_0x197185,_0x251145){var _0x2c8af1=function(_0x1dbcfd){while(--_0x1dbcfd){_0x197185['push'](_0x197185['shift']());}};_0x2c8af1(++_0x251145);}(_0x1614,0x177));var _0x4161=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x1614[_0x491a7f];return _0x3d8f44;};'use strict';var _=require(_0x4161('0x0'));var util=require(_0x4161('0x1'));var moment=require('moment');var BPromise=require(_0x4161('0x2'));var rs=require(_0x4161('0x3'));var fs=require('fs');var Redis=require(_0x4161('0x4'));var db=require(_0x4161('0x5'))['db'];var utils=require(_0x4161('0x6'));var logger=require(_0x4161('0x7'))(_0x4161('0x8'));var config=require('../../config/environment');var jayson=require(_0x4161('0x9'));var client=jayson[_0x4161('0xa')][_0x4161('0xb')]({'port':0x232a});config['redis']=_[_0x4161('0xc')](config[_0x4161('0xd')],{'host':_0x4161('0xe'),'port':0x18eb});var socket=require(_0x4161('0xf'))(new Redis(config['redis']));require(_0x4161('0x10'))[_0x4161('0x11')](socket);function respondWithRpcPromise(_0x4df849,_0x11af41,_0x202b8c){return new BPromise(function(_0x30f3e5,_0x544386){return client[_0x4161('0x12')](_0x4df849,_0x202b8c)[_0x4161('0x13')](function(_0x440ed6){logger[_0x4161('0x14')]('ChatWebsite,\x20%s,\x20%s',_0x11af41,'request\x20sent');logger[_0x4161('0x15')](_0x4161('0x16'),_0x11af41,_0x4161('0x17'),JSON[_0x4161('0x18')](_0x440ed6));if(_0x440ed6['error']){if(_0x440ed6[_0x4161('0x19')][_0x4161('0x1a')]===0x1f4){logger[_0x4161('0x19')](_0x4161('0x1b'),_0x11af41,_0x440ed6[_0x4161('0x19')][_0x4161('0x1c')]);return _0x544386(_0x440ed6[_0x4161('0x19')][_0x4161('0x1c')]);}logger[_0x4161('0x19')](_0x4161('0x1b'),_0x11af41,_0x440ed6[_0x4161('0x19')][_0x4161('0x1c')]);return _0x30f3e5(_0x440ed6[_0x4161('0x19')][_0x4161('0x1c')]);}else{logger[_0x4161('0x14')](_0x4161('0x1b'),_0x11af41,'request\x20sent');_0x30f3e5(_0x440ed6['result']['message']);}})[_0x4161('0x1d')](function(_0x3b217f){logger[_0x4161('0x19')](_0x4161('0x1b'),_0x11af41,_0x3b217f);_0x544386(_0x3b217f);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 2a0d5ff..2e9d360 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 _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 +var _0xd23b=['update','removeListener','register','length','chatWebsite:','./chatWebsite.events','save','remove'];(function(_0x459a82,_0x22b263){var _0x54c4a=function(_0x3d3fae){while(--_0x3d3fae){_0x459a82['push'](_0x459a82['shift']());}};_0x54c4a(++_0x22b263);}(_0xd23b,0xbd));var _0xbd23=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xd23b[_0x37c22c];return _0x119d79;};'use strict';var ChatWebsiteEvents=require(_0xbd23('0x0'));var events=[_0xbd23('0x1'),_0xbd23('0x2'),_0xbd23('0x3')];function createListener(_0x27bc03,_0xe643ee){return function(_0x43902c){_0xe643ee['emit'](_0x27bc03,_0x43902c);};}function removeListener(_0x175f96,_0xec6bf5){return function(){ChatWebsiteEvents[_0xbd23('0x4')](_0x175f96,_0xec6bf5);};}exports[_0xbd23('0x5')]=function(_0x4d78ea){for(var _0x5c2121=0x0,_0x18568e=events[_0xbd23('0x6')];_0x5c2121<_0x18568e;_0x5c2121++){var _0x1c47d5=events[_0x5c2121];var _0x3cdaff=createListener(_0xbd23('0x7')+_0x1c47d5,_0x4d78ea);ChatWebsiteEvents['on'](_0x1c47d5,_0x3cdaff);}}; \ 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 1b6c77f..1f3d4d2 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 _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 +var _0x1da6=['replace','localhost','test','([\x5cw]+)','../../../utils/misc','escapeRegExp','url','URL'];(function(_0x246b4b,_0x285913){var _0x35c072=function(_0x288ebc){while(--_0x288ebc){_0x246b4b['push'](_0x246b4b['shift']());}};_0x35c072(++_0x285913);}(_0x1da6,0x7c));var _0x61da=function(_0x1af482,_0x1af5b7){_0x1af482=_0x1af482-0x0;var _0x7e7580=_0x1da6[_0x1af482];return _0x7e7580;};var escapeRegExp=require(_0x61da('0x0'))[_0x61da('0x1')];var URL=require(_0x61da('0x2'))[_0x61da('0x3')];function testWildcardValidity(_0x19474a){let _0xbe2d90=!![];try{new URL(_0x19474a[_0x61da('0x4')]('*',_0x61da('0x5')));}catch(_0xf7a566){_0xbe2d90=![];}return _0xbe2d90&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0x61da('0x6')](_0x19474a);}function testWebsiteWithWildcard(_0x2be3c9,_0x42f09d){let _0x16cd66;const _0x2c40c6=escapeRegExp(_0x2be3c9)[_0x61da('0x4')]('\x5c*',_0x61da('0x7'));try{new URL(_0x2be3c9[_0x61da('0x4')]('\x5c*',_0x61da('0x5')));_0x16cd66=new RegExp(_0x2c40c6)[_0x61da('0x6')](_0x42f09d);}catch(_0xf027a6){_0x16cd66=![];}return _0x16cd66;}module['exports']={'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 3364c47..35c2e86 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 _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 +var _0x520c=['/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','addAnswer','diskStorage','join','root','format','now','originalname','/:id/logo','single','file','server/files/images/avatars/','%s-%s','/:id/avatar','addCustomerAvatar','/:id/notify','attachments','ensureDir','replace','extname','any','offline','addInteraction','addApplications','addAgents','put','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id/dispositions','/:id/canned_answers','getLogo','getAvatar','/:id/customer_avatar','getCustomerAvatar'];(function(_0x2c48df,_0x46e91c){var _0x5f223a=function(_0x11f763){while(--_0x11f763){_0x2c48df['push'](_0x2c48df['shift']());}};_0x5f223a(++_0x46e91c);}(_0x520c,0xbe));var _0xc520=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x520c[_0x9cd4c3];return _0x4c9025;};'use strict';var multer=require(_0xc520('0x0'));var util=require(_0xc520('0x1'));var path=require(_0xc520('0x2'));var timeout=require(_0xc520('0x3'));var express=require(_0xc520('0x4'));var router=express[_0xc520('0x5')]();var fs_extra=require(_0xc520('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc520('0x7'));var controller=require(_0xc520('0x8'));router[_0xc520('0x9')]('/',auth[_0xc520('0xa')](),controller[_0xc520('0xb')]);router[_0xc520('0x9')](_0xc520('0xc'),auth[_0xc520('0xa')](),controller[_0xc520('0xd')]);router[_0xc520('0x9')]('/:id',auth[_0xc520('0xa')](),controller['show']);router[_0xc520('0x9')](_0xc520('0xe'),auth[_0xc520('0xa')](),controller['getDispositions']);router[_0xc520('0x9')](_0xc520('0xf'),auth[_0xc520('0xa')](),controller['getAnswers']);router[_0xc520('0x9')]('/:id/logo',controller[_0xc520('0x10')]);router[_0xc520('0x9')]('/:id/avatar',controller[_0xc520('0x11')]);router[_0xc520('0x9')](_0xc520('0x12'),controller[_0xc520('0x13')]);router[_0xc520('0x9')](_0xc520('0x14'),controller[_0xc520('0x15')]);router[_0xc520('0x9')](_0xc520('0x16'),auth[_0xc520('0xa')](),controller[_0xc520('0x17')]);router[_0xc520('0x9')](_0xc520('0x18'),controller[_0xc520('0x19')]);router['get'](_0xc520('0x1a'),auth[_0xc520('0xa')](),controller[_0xc520('0x1b')]);router[_0xc520('0x9')](_0xc520('0x1c'),auth[_0xc520('0xa')](),controller[_0xc520('0x1d')]);router[_0xc520('0x9')]('/:id/fields',controller[_0xc520('0x1e')]);router[_0xc520('0x9')](_0xc520('0x1f'),auth[_0xc520('0xa')](),controller[_0xc520('0x20')]);router[_0xc520('0x9')](_0xc520('0x21'),auth[_0xc520('0xa')](),controller[_0xc520('0x22')]);router[_0xc520('0x23')]('/',auth[_0xc520('0xa')](),controller[_0xc520('0x24')]);router[_0xc520('0x23')](_0xc520('0xe'),auth[_0xc520('0xa')](),controller[_0xc520('0x25')]);router[_0xc520('0x23')]('/:id/canned_answers',auth[_0xc520('0xa')](),controller[_0xc520('0x26')]);var upload=multer({'storage':multer[_0xc520('0x27')]({'destination':function(_0x16c02e,_0x5b6693,_0x179274){_0x179274(null,path[_0xc520('0x28')](config[_0xc520('0x29')],'server/files/images/logos/'));},'filename':function(_0x3c4918,_0x212868,_0x23bf63){_0x23bf63(null,util[_0xc520('0x2a')]('%s-%s',Date[_0xc520('0x2b')](),_0x212868[_0xc520('0x2c')]));}})});router['post'](_0xc520('0x2d'),upload[_0xc520('0x2e')](_0xc520('0x2f')),controller['addLogo']);var upload=multer({'storage':multer[_0xc520('0x27')]({'destination':function(_0x290251,_0x51882a,_0x28977b){_0x28977b(null,path[_0xc520('0x28')](config[_0xc520('0x29')],_0xc520('0x30')));},'filename':function(_0x3f13b7,_0x67d0,_0x4cda9a){_0x4cda9a(null,util[_0xc520('0x2a')](_0xc520('0x31'),Date[_0xc520('0x2b')](),_0x67d0[_0xc520('0x2c')]));}})});router[_0xc520('0x23')](_0xc520('0x32'),upload[_0xc520('0x2e')](_0xc520('0x2f')),controller['addAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2edfe3,_0x1f77a2,_0x31c064){_0x31c064(null,path['join'](config[_0xc520('0x29')],_0xc520('0x30')));},'filename':function(_0x3776d9,_0x5a0cc4,_0x50e0c6){_0x50e0c6(null,util[_0xc520('0x2a')]('%s-%s',Date['now'](),_0x5a0cc4['originalname']));}})});router['post'](_0xc520('0x12'),upload['single']('file'),controller[_0xc520('0x33')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xaca26e,_0x512000,_0x4926f5){_0x4926f5(null,path[_0xc520('0x28')](config[_0xc520('0x29')],_0xc520('0x30')));},'filename':function(_0x3e69ab,_0x4c865b,_0x41ceda){_0x41ceda(null,util[_0xc520('0x2a')]('%s-%s',Date[_0xc520('0x2b')](),_0x4c865b[_0xc520('0x2c')]));}})});router['post'](_0xc520('0x14'),upload[_0xc520('0x2e')](_0xc520('0x2f')),controller['addSystemAvatar']);router[_0xc520('0x23')](_0xc520('0x34'),controller['notify']);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x157de5,_0x1007ac,_0xf63a2e){const _0x5970fe=path[_0xc520('0x28')](config['root'],'server/files',_0xc520('0x35'),'offline-chat');fs_extra[_0xc520('0x36')](_0x5970fe,function(){_0xf63a2e(null,_0x5970fe);});},'filename':function(_0x1e51ea,_0x4ebec9,_0x4593df){const _0x1c141d=_0x4ebec9[_0xc520('0x2c')][_0xc520('0x37')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x1ebc49=path[_0xc520('0x38')](_0x1c141d);const _0x23d38c=Date[_0xc520('0x2b')]()+'-'+_0x1c141d[_0xc520('0x37')](_0x1ebc49,'')+_0x1ebc49;_0x4593df(null,_0x23d38c);}})});router[_0xc520('0x23')]('/:id/offline',offlineUploadMulter[_0xc520('0x39')](),controller[_0xc520('0x3a')]);router[_0xc520('0x23')](_0xc520('0x16'),auth[_0xc520('0xa')](),controller[_0xc520('0x3b')]);router[_0xc520('0x23')](_0xc520('0x1a'),auth[_0xc520('0xa')](),controller[_0xc520('0x3c')]);router[_0xc520('0x23')](_0xc520('0x1c'),auth['isAuthenticated'](),controller['addProactiveActions']);router[_0xc520('0x23')]('/:id/users',auth[_0xc520('0xa')](),controller[_0xc520('0x3d')]);router[_0xc520('0x3e')](_0xc520('0x3f'),auth[_0xc520('0xa')](),controller[_0xc520('0x40')]);router[_0xc520('0x41')](_0xc520('0x3f'),auth[_0xc520('0xa')](),controller[_0xc520('0x42')]);router[_0xc520('0x41')](_0xc520('0xe'),auth['isAuthenticated'](),controller[_0xc520('0x43')]);router[_0xc520('0x41')]('/:id/canned_answers',auth[_0xc520('0xa')](),controller[_0xc520('0x44')]);router['delete'](_0xc520('0x21'),auth['isAuthenticated'](),controller[_0xc520('0x45')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index f722553..4228d83 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 _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 +var _0x4cd5=['beaver-logger/server','../config/environment','Router','env','production','app','get','Client-Side\x20logger\x20not\x20found!','exports'];(function(_0x4d7379,_0x4b4e63){var _0x46d7cf=function(_0x53f5f0){while(--_0x53f5f0){_0x4d7379['push'](_0x4d7379['shift']());}};_0x46d7cf(++_0x4b4e63);}(_0x4cd5,0xb4));var _0x54cd=function(_0x5605e9,_0x2eb904){_0x5605e9=_0x5605e9-0x0;var _0x181b1c=_0x4cd5[_0x5605e9];return _0x181b1c;};var beaverLogger=require(_0x54cd('0x0'));var express=require('express');var auth=require('../components/auth/service');var config=require(_0x54cd('0x1'));var router=express[_0x54cd('0x2')]();var isProduction=config[_0x54cd('0x3')]===_0x54cd('0x4')||![];function clientSideLogs(_0x5bb7c3,_0x348df9,_0x463c96){var _0x11089e=_0x5bb7c3[_0x54cd('0x5')][_0x54cd('0x6')]('client-side-logger');if(!_0x11089e){throw new Error(_0x54cd('0x7'));}return beaverLogger['expressEndpoint']({'uri':'/client-logs','logger':_0x11089e,'enableCors':!isProduction})(_0x5bb7c3,_0x348df9,_0x463c96);}router['use'](auth['isAuthenticated'](),clientSideLogs);module[_0x54cd('0x8')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index f82685e..24112ef 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 _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 +var _0x8130=['ENUM','Google','MicrosoftAzure','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20refresh_token','STRING'];(function(_0x57a670,_0x30e402){var _0x41ce21=function(_0x11bd34){while(--_0x11bd34){_0x57a670['push'](_0x57a670['shift']());}};_0x41ce21(++_0x30e402);}(_0x8130,0x9f));var _0x0813=function(_0x22415f,_0x1d1405){_0x22415f=_0x22415f-0x0;var _0x3fc6dc=_0x8130[_0x22415f];return _0x3fc6dc;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x0813('0x0')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x0813('0x1')]('AmazonAWS',_0x0813('0x2'),_0x0813('0x3')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x0813('0x1')]('Outlook365',_0x0813('0x4'))},'data1':{'type':Sequelize[_0x0813('0x0')],'comment':_0x0813('0x5')},'data2':{'type':Sequelize[_0x0813('0x0')],'comment':_0x0813('0x6')},'data3':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize[_0x0813('0x0')],'comment':_0x0813('0x7')},'data5':{'type':Sequelize[_0x0813('0x8')],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize[_0x0813('0x8')],'comment':_0x0813('0x9')},'data7':{'type':Sequelize[_0x0813('0x8')],'comment':'MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index a0e178c..b6d2ed5 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 _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 +var _0x3b08=['filter','merge','options','includeAll','include','findAll','rows','service','MicrosoftAzure','decryptString','data3','catch','show','params','rawAttributes','find','create','body','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','encryptString','oauth2MicrosoftAuthorize','findOne','user','oauth2MicrosoftCallback','get','Invalid\x20state\x20parameter','parse','from','state','base64','toString','ascii','del','getOauth2MicrosoftAccessToken','access_token','data6','refresh_token','data5','startRefreshInterval','emit','microsoftAuthorization:success','error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','lodash','ioredis','../../config/logger','../../mysqldb','./cloudProvider.oauth','redis','defaults','socket.io-emitter','status','end','json','limit','undefined','count','offset','set','Content-Range','update','then','destroy','sendStatus','stack','name','send','slice','index','map','CloudProvider','fieldName','type','key','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x52623c,_0x9d9fda){var _0x21499c=function(_0x56bf5a){while(--_0x56bf5a){_0x52623c['push'](_0x52623c['shift']());}};_0x21499c(++_0x9d9fda);}(_0x3b08,0x1a4));var _0x83b0=function(_0x102221,_0xe0ae20){_0x102221=_0x102221-0x0;var _0x175014=_0x3b08[_0x102221];return _0x175014;};'use strict';var _=require(_0x83b0('0x0'));var Redis=require(_0x83b0('0x1'));var qs=require('../../components/parsers/qs');var encryptor=require('../../components/encryptor');var config=require('../../config/environment');var logger=require(_0x83b0('0x2'))('api');var db=require(_0x83b0('0x3'))['db'];var oauth=require(_0x83b0('0x4'));config[_0x83b0('0x5')]=_[_0x83b0('0x6')](config[_0x83b0('0x5')],{'host':'localhost','port':0x18eb});var socket=require(_0x83b0('0x7'))(new Redis(config[_0x83b0('0x5')]));var redis=new Redis(config[_0x83b0('0x5')]);function respondWithStatusCode(_0x1d2442,_0x3fddca){_0x3fddca=_0x3fddca||0xcc;return function(_0x55d32d){if(_0x55d32d){return _0x1d2442['sendStatus'](_0x3fddca);}return _0x1d2442[_0x83b0('0x8')](_0x3fddca)[_0x83b0('0x9')]();};}function respondWithResult(_0x905e4d,_0x40190f){_0x40190f=_0x40190f||0xc8;return function(_0x2800fd){if(_0x2800fd){return _0x905e4d[_0x83b0('0x8')](_0x40190f)[_0x83b0('0xa')](_0x2800fd);}};}function respondWithFilteredResult(_0xf3efe6,_0x1d2d9b){return function(_0x55ed0f){if(_0x55ed0f){var _0x5be72b=typeof _0x1d2d9b['offset']==='undefined'&&typeof _0x1d2d9b[_0x83b0('0xb')]===_0x83b0('0xc');var _0x2abf19=_0x55ed0f[_0x83b0('0xd')];var _0x1b404d=_0x5be72b?0x0:_0x1d2d9b[_0x83b0('0xe')];var _0x2397d0=_0x5be72b?_0x55ed0f['count']:_0x1d2d9b[_0x83b0('0xe')]+_0x1d2d9b[_0x83b0('0xb')];var _0x883e75;if(_0x2397d0>=_0x2abf19){_0x2397d0=_0x2abf19;_0x883e75=0xc8;}else{_0x883e75=0xce;}_0xf3efe6[_0x83b0('0x8')](_0x883e75);return _0xf3efe6[_0x83b0('0xf')](_0x83b0('0x10'),_0x1b404d+'-'+_0x2397d0+'/'+_0x2abf19)[_0x83b0('0xa')](_0x55ed0f);}return null;};}function saveUpdates(_0x519973){return function(_0xa5af41){if(_0xa5af41){return _0xa5af41[_0x83b0('0x11')](_0x519973)[_0x83b0('0x12')](function(_0x4577c0){return _0x4577c0;});}return null;};}function removeEntity(_0x16d20c){return function(_0x5229d1){if(_0x5229d1){return _0x5229d1[_0x83b0('0x13')]()['then'](function(){_0x16d20c[_0x83b0('0x8')](0xcc)[_0x83b0('0x9')]();});}};}function handleEntityNotFound(_0xa8f11c){return function(_0x7b8367){if(!_0x7b8367){_0xa8f11c[_0x83b0('0x14')](0x194);}return _0x7b8367;};}function handleError(_0x381a7b,_0x2df03f){_0x2df03f=_0x2df03f||0x1f4;return function(_0x24cd5e){logger['error'](_0x24cd5e[_0x83b0('0x15')]);if(_0x24cd5e[_0x83b0('0x16')]){delete _0x24cd5e[_0x83b0('0x16')];}_0x381a7b[_0x83b0('0x8')](_0x2df03f)[_0x83b0('0x17')](_0x24cd5e);};}function maskClientSecret(_0x1fcd63){return _['padEnd'](_0x1fcd63[_0x83b0('0x18')](0x0,0x3),0x14,'*');}exports[_0x83b0('0x19')]=function(_0x292d1f,_0x26a9a4){var _0x4b8337={},_0x145af6={},_0x3436b6={'count':0x0,'rows':[]};var _0x1adb9b=_[_0x83b0('0x1a')](db[_0x83b0('0x1b')]['rawAttributes'],function(_0x1725d0){return{'name':_0x1725d0[_0x83b0('0x1c')],'type':_0x1725d0[_0x83b0('0x1d')][_0x83b0('0x1e')]};});_0x145af6['model']=_[_0x83b0('0x1a')](_0x1adb9b,_0x83b0('0x16'));_0x145af6['query']=_[_0x83b0('0x1f')](_0x292d1f[_0x83b0('0x20')]);_0x145af6[_0x83b0('0x21')]=_[_0x83b0('0x22')](_0x145af6['model'],_0x145af6['query']);_0x4b8337[_0x83b0('0x23')]=_[_0x83b0('0x22')](_0x145af6[_0x83b0('0x24')],qs[_0x83b0('0x25')](_0x292d1f[_0x83b0('0x20')]['fields']));_0x4b8337['attributes']=_0x4b8337[_0x83b0('0x23')][_0x83b0('0x26')]?_0x4b8337[_0x83b0('0x23')]:_0x145af6[_0x83b0('0x24')];if(!_0x292d1f[_0x83b0('0x20')][_0x83b0('0x27')](_0x83b0('0x28'))){_0x4b8337[_0x83b0('0xb')]=qs[_0x83b0('0xb')](_0x292d1f['query'][_0x83b0('0xb')]);_0x4b8337['offset']=qs['offset'](_0x292d1f[_0x83b0('0x20')][_0x83b0('0xe')]);}_0x4b8337[_0x83b0('0x29')]=qs[_0x83b0('0x2a')](_0x292d1f[_0x83b0('0x20')][_0x83b0('0x2a')]);_0x4b8337[_0x83b0('0x2b')]=qs['filters'](_[_0x83b0('0x2c')](_0x292d1f[_0x83b0('0x20')],_0x145af6['filters']),_0x1adb9b);if(_0x292d1f[_0x83b0('0x20')][_0x83b0('0x2d')]){_0x4b8337[_0x83b0('0x2b')]=_[_0x83b0('0x2e')](_0x4b8337[_0x83b0('0x2b')],{'$or':_[_0x83b0('0x1a')](_0x1adb9b,function(_0x48367a){if(_0x48367a[_0x83b0('0x1d')]!=='VIRTUAL'){var _0x3eb3ff={};_0x3eb3ff[_0x48367a['name']]={'$like':'%'+_0x292d1f[_0x83b0('0x20')][_0x83b0('0x2d')]+'%'};return _0x3eb3ff;}})});}_0x4b8337=_[_0x83b0('0x2e')]({},_0x4b8337,_0x292d1f[_0x83b0('0x2f')]);var _0x34d89a={'where':_0x4b8337[_0x83b0('0x2b')]};return db['CloudProvider'][_0x83b0('0xd')](_0x34d89a)[_0x83b0('0x12')](function(_0x3db9e1){_0x3436b6[_0x83b0('0xd')]=_0x3db9e1;if(_0x292d1f[_0x83b0('0x20')][_0x83b0('0x30')]){_0x4b8337[_0x83b0('0x31')]=[{'all':!![]}];}return db[_0x83b0('0x1b')][_0x83b0('0x32')](_0x4b8337);})[_0x83b0('0x12')](function(_0x36416b){_0x3436b6[_0x83b0('0x33')]=_[_0x83b0('0x1a')](_0x36416b,function(_0x41e607){if(_0x41e607[_0x83b0('0x34')]===_0x83b0('0x35')){var _0x38322a=encryptor[_0x83b0('0x36')](_0x41e607[_0x83b0('0x37')]);_0x41e607[_0x83b0('0x37')]=maskClientSecret(_0x38322a);}return _0x41e607;});return _0x3436b6;})[_0x83b0('0x12')](respondWithFilteredResult(_0x26a9a4,_0x4b8337))[_0x83b0('0x38')](handleError(_0x26a9a4,null));};exports[_0x83b0('0x39')]=function(_0x46f9b2,_0x2af3c1){var _0x78fd85={'raw':!![],'where':{'id':_0x46f9b2[_0x83b0('0x3a')]['id']}},_0x2cdb17={};_0x2cdb17[_0x83b0('0x24')]=_[_0x83b0('0x1f')](db[_0x83b0('0x1b')][_0x83b0('0x3b')]);_0x2cdb17[_0x83b0('0x20')]=_[_0x83b0('0x1f')](_0x46f9b2[_0x83b0('0x20')]);_0x2cdb17[_0x83b0('0x21')]=_[_0x83b0('0x22')](_0x2cdb17[_0x83b0('0x24')],_0x2cdb17[_0x83b0('0x20')]);_0x78fd85[_0x83b0('0x23')]=_[_0x83b0('0x22')](_0x2cdb17[_0x83b0('0x24')],qs['fields'](_0x46f9b2['query'][_0x83b0('0x25')]));_0x78fd85['attributes']=_0x78fd85[_0x83b0('0x23')][_0x83b0('0x26')]?_0x78fd85['attributes']:_0x2cdb17[_0x83b0('0x24')];if(_0x46f9b2[_0x83b0('0x20')][_0x83b0('0x30')]){_0x78fd85[_0x83b0('0x31')]=[{'all':!![]}];}_0x78fd85=_[_0x83b0('0x2e')]({},_0x78fd85,_0x46f9b2[_0x83b0('0x2f')]);return db[_0x83b0('0x1b')][_0x83b0('0x3c')](_0x78fd85)[_0x83b0('0x12')](handleEntityNotFound(_0x2af3c1,null))[_0x83b0('0x12')](function(_0x232def){if(_0x232def[_0x83b0('0x34')]===_0x83b0('0x35')){var _0x3f1c36=encryptor[_0x83b0('0x36')](_0x232def['data3']);_0x232def[_0x83b0('0x37')]=maskClientSecret(_0x3f1c36);}return _0x232def;})['then'](respondWithResult(_0x2af3c1,null))[_0x83b0('0x38')](handleError(_0x2af3c1,null));};exports[_0x83b0('0x3d')]=function(_0x374087,_0x2c9fa5){if(!_0x374087['body']['name'])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x374087[_0x83b0('0x3e')][_0x83b0('0x34')])throw new Error(_0x83b0('0x3f'));var _0x4e01ad=db[_0x83b0('0x1b')][_0x83b0('0x3b')]['service'][_0x83b0('0x40')];if(!_0x4e01ad[_0x83b0('0x41')](_0x374087[_0x83b0('0x3e')][_0x83b0('0x34')]))throw new Error(_0x83b0('0x42')+_0x4e01ad['join'](',\x20'));if(_0x374087[_0x83b0('0x3e')][_0x83b0('0x34')]===_0x83b0('0x35')&&_0x374087['body'][_0x83b0('0x37')]){_0x374087[_0x83b0('0x3e')][_0x83b0('0x37')]=encryptor[_0x83b0('0x43')](_0x374087[_0x83b0('0x3e')][_0x83b0('0x37')]);}return db[_0x83b0('0x1b')][_0x83b0('0x3d')](_0x374087['body'],{})[_0x83b0('0x12')](respondWithResult(_0x2c9fa5,0xc9))[_0x83b0('0x38')](handleError(_0x2c9fa5,null));};exports[_0x83b0('0x11')]=function(_0x4347c4,_0x415ff0){if(_0x4347c4[_0x83b0('0x3e')]['id']){delete _0x4347c4[_0x83b0('0x3e')]['id'];}return db[_0x83b0('0x1b')][_0x83b0('0x3c')]({'where':{'id':_0x4347c4[_0x83b0('0x3a')]['id']}})[_0x83b0('0x12')](handleEntityNotFound(_0x415ff0,null))[_0x83b0('0x12')](function(_0x4039ca){if(_0x4039ca['service']===_0x83b0('0x35')&&_0x4347c4['body'][_0x83b0('0x37')]){_0x4347c4[_0x83b0('0x3e')][_0x83b0('0x37')]=encryptor[_0x83b0('0x43')](_0x4347c4['body']['data3']);}return _0x4039ca;})[_0x83b0('0x12')](saveUpdates(_0x4347c4[_0x83b0('0x3e')],null))[_0x83b0('0x12')](respondWithResult(_0x415ff0,null))[_0x83b0('0x38')](handleError(_0x415ff0,null));};exports[_0x83b0('0x13')]=function(_0x1d7ee0,_0x2cb9da){return db[_0x83b0('0x1b')][_0x83b0('0x3c')]({'where':{'id':_0x1d7ee0[_0x83b0('0x3a')]['id']}})[_0x83b0('0x12')](handleEntityNotFound(_0x2cb9da,null))[_0x83b0('0x12')](removeEntity(_0x2cb9da,null))['catch'](handleError(_0x2cb9da,null));};exports[_0x83b0('0x44')]=function(_0x27bf3a,_0x582274){return db['CloudProvider'][_0x83b0('0x45')]({'where':{'id':_0x27bf3a[_0x83b0('0x3a')]['id']},'raw':!![]})[_0x83b0('0x12')](function(_0x69cfed){if(!_0x69cfed)return _0x582274[_0x83b0('0x14')](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x69cfed,_0x27bf3a[_0x83b0('0x46')]['id'])};})[_0x83b0('0x12')](respondWithResult(_0x582274,null))['catch'](handleError(_0x582274,null));};exports[_0x83b0('0x47')]=function(_0x5c3e59,_0x36c931){var _0x641807=_0x5c3e59[_0x83b0('0x3e')];var _0x1481e9;var _0x27de13;if(_0x641807['error'])throw _0x641807;redis[_0x83b0('0x48')](_0x641807['state'])[_0x83b0('0x12')](function(_0x19c2a4){if(!_0x19c2a4)throw new Error(_0x83b0('0x49'));_0x1481e9=JSON[_0x83b0('0x4a')](_0x19c2a4);var _0x1a59f4=Buffer[_0x83b0('0x4b')](_0x641807[_0x83b0('0x4c')],_0x83b0('0x4d'))[_0x83b0('0x4e')](_0x83b0('0x4f'));_0x27de13=JSON[_0x83b0('0x4a')](_0x1a59f4);if(!oauth['isValidIdToken'](_0x641807['id_token'],_0x1481e9['oauth2Claims']))throw new Error('Unable\x20to\x20validate\x20id_token');redis[_0x83b0('0x50')](_0x641807[_0x83b0('0x4c')]);return oauth[_0x83b0('0x51')](_0x641807['code'],_0x1481e9);})[_0x83b0('0x12')](function(_0x199060){_0x1481e9['data5']=_0x199060[_0x83b0('0x52')];_0x1481e9[_0x83b0('0x53')]=_0x199060[_0x83b0('0x54')];return db[_0x83b0('0x1b')][_0x83b0('0x11')]({'data5':_0x1481e9[_0x83b0('0x55')],'data6':_0x1481e9[_0x83b0('0x53')]},{'where':{'id':_0x1481e9['id']}});})[_0x83b0('0x12')](function(){oauth[_0x83b0('0x56')](_0x1481e9);socket[_0x83b0('0x57')](_0x83b0('0x58'),{'id':_0x27de13['id']});return;})[_0x83b0('0x12')](respondWithStatusCode(_0x36c931,null))['catch'](function(_0x29775f){if(_0x27de13){socket[_0x83b0('0x57')]('microsoftAuthorization:error',{'id':_0x27de13['id']});}if(!_0x1481e9){logger[_0x83b0('0x59')](_0x83b0('0x5a'),_0x29775f);return _0x36c931[_0x83b0('0x8')](0x1f4)[_0x83b0('0x17')](_0x29775f[_0x83b0('0x5b')]);}logger[_0x83b0('0x59')](_0x83b0('0x5c'),_0x1481e9['id'],JSON['stringify'](_0x29775f));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 92eed38..bfde60b 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 _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 +var _0x755a=['define','CloudProvider','cloud_providers','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','exports'];(function(_0xcbbb35,_0x4cb0d7){var _0x150cd6=function(_0x1fc9ff){while(--_0x1fc9ff){_0xcbbb35['push'](_0xcbbb35['shift']());}};_0x150cd6(++_0x4cb0d7);}(_0x755a,0x1a7));var _0xa755=function(_0x1865fe,_0x4d0b93){_0x1865fe=_0x1865fe-0x0;var _0xd104=_0x755a[_0x1865fe];return _0xd104;};'use strict';var _=require(_0xa755('0x0'));var util=require(_0xa755('0x1'));var logger=require(_0xa755('0x2'))(_0xa755('0x3'));var moment=require(_0xa755('0x4'));var BPromise=require(_0xa755('0x5'));var rp=require(_0xa755('0x6'));var fs=require('fs');var path=require(_0xa755('0x7'));var rimraf=require(_0xa755('0x8'));var config=require(_0xa755('0x9'));var attributes=require(_0xa755('0xa'));module[_0xa755('0xb')]=function(_0x29af77,_0x3e6643){return _0x29af77[_0xa755('0xc')](_0xa755('0xd'),attributes,{'tableName':_0xa755('0xe'),'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 0196691..69f970e 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 _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 +var _0x9231=['ioredis','request-promise','util','../../config/environment','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','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','offline_access','/authorize','/token','map','type','push','/.default','join','Outlook365','{TENANT_ID}','data2','code','id_token','from','stringify','toString','base64','hex','data1','response_type','redirect_uri','response_mode','form_post','scope','nonce','prompt','login','key','value','oauth2Claims','replace','oauth2/','set','decode','iss','issuer','audience','isAfter','unix','exp','resolve','then','findOne','refresh_token','data6','data4','decryptString','data3','data5','access_token','CloudProvider','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','intervals','bind','all','inspect','jsonwebtoken'];(function(_0x3da6ae,_0x13fdf4){var _0x1aa8df=function(_0xaac51){while(--_0xaac51){_0x3da6ae['push'](_0x3da6ae['shift']());}};_0x1aa8df(++_0x13fdf4);}(_0x9231,0x95));var _0x1923=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9231[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var crypto=require('crypto');var jwt=require(_0x1923('0x0'));var moment=require('moment');var Redis=require(_0x1923('0x1'));var rp=require(_0x1923('0x2'));var util=require(_0x1923('0x3'));var encryptor=require('../../components/encryptor');var config=require(_0x1923('0x4'));var logger=require('../../config/logger')(_0x1923('0x5'));var schedule=require(_0x1923('0x6'));var db=require(_0x1923('0x7'))['db'];config[_0x1923('0x8')]=_[_0x1923('0x9')](config[_0x1923('0x8')],{'host':'localhost','port':0x18eb});var redis=new Redis(config[_0x1923('0x8')]);var MICROSOFT_AUTH_URL=_0x1923('0xa');var AZURE_AUTH_SCOPES={'Outlook365':[_0x1923('0xb'),_0x1923('0xc'),_0x1923('0xd'),'offline_access',_0x1923('0xe'),_0x1923('0xf'),'https://outlook.office.com/SMTP.Send'],'Dynamics365':[_0x1923('0xb'),_0x1923('0x10')]};var MICROSOFT_AUTH_ENDPOINT=_0x1923('0x11');var MICROSOFT_TOKEN_ENDPOINT=_0x1923('0x12');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x239abd){var _0x1a4836=_[_0x1923('0x13')](AZURE_AUTH_SCOPES[_0x239abd[_0x1923('0x14')]]);if(_0x239abd['type']==='Dynamics365')_0x1a4836[_0x1923('0x15')](_0x239abd['data7']+_0x1923('0x16'));return _0x1a4836[_0x1923('0x17')]('\x20');}function getAccessTokenScope(_0x1c4f58){if(_0x1c4f58[_0x1923('0x14')]===_0x1923('0x18'))return _0x1923('0xe');if(_0x1c4f58[_0x1923('0x14')]==='Dynamics365')return _0x1c4f58['data7']+_0x1923('0x16');}function generateMicrosoftAuthorizationUrl(_0x5ce9bf,_0x2ea5b2){var _0x2224d1=MICROSOFT_AUTH_URL['replace'](_0x1923('0x19'),_0x5ce9bf[_0x1923('0x1a')]);var _0x982629=[_0x1923('0x1b'),_0x1923('0x1c')];var _0x12cc31=Buffer[_0x1923('0x1d')](JSON[_0x1923('0x1e')]({'id':_0x2ea5b2}))[_0x1923('0x1f')](_0x1923('0x20'));var _0x648864=crypto['randomBytes'](0x10)['toString'](_0x1923('0x21'));var _0x33f642=getAuthorizationScopes(_0x5ce9bf);var _0x1c5eb4=[{'key':'client_id','value':_0x5ce9bf[_0x1923('0x22')]},{'key':_0x1923('0x23'),'value':encodeURIComponent(_0x982629[_0x1923('0x17')]('\x20'))},{'key':_0x1923('0x24'),'value':_0x5ce9bf['data4']},{'key':_0x1923('0x25'),'value':_0x1923('0x26')},{'key':_0x1923('0x27'),'value':encodeURIComponent(_0x33f642)},{'key':'state','value':_0x12cc31},{'key':_0x1923('0x28'),'value':_0x648864},{'key':_0x1923('0x29'),'value':_0x1923('0x2a')}];var _0x12d212=_0x2224d1+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x1923('0x13')](_0x1c5eb4,function(_0x1fda2e){return _0x1fda2e[_0x1923('0x2b')]+'='+_0x1fda2e[_0x1923('0x2c')];})[_0x1923('0x17')]('&');_0x5ce9bf[_0x1923('0x2d')]={'issuer':_0x2224d1[_0x1923('0x2e')](_0x1923('0x2f'),''),'audience':_0x5ce9bf[_0x1923('0x22')],'state':_0x12cc31,'nonce':_0x648864};redis[_0x1923('0x30')](_0x12cc31,JSON[_0x1923('0x1e')](_0x5ce9bf));return _0x12d212;}function isValidIdToken(_0x2c2b6e,_0x374347){try{var _0x459d40=jwt[_0x1923('0x31')](_0x2c2b6e,{'complete':!![]});var _0x40dbcc=_0x459d40['payload'];if(_0x40dbcc[_0x1923('0x32')]!==_0x374347[_0x1923('0x33')])return![];if(_0x40dbcc['aud']!==_0x374347[_0x1923('0x34')])return![];if(_0x40dbcc[_0x1923('0x28')]!==_0x374347[_0x1923('0x28')])return![];if(moment()[_0x1923('0x35')](moment[_0x1923('0x36')](_0x40dbcc[_0x1923('0x37')])))return![];return!![];}catch(_0x571947){throw _0x571947;}}function refreshOauth2MicrosoftAccessToken(_0x333d4d){return Promise[_0x1923('0x38')]()[_0x1923('0x39')](function(){if(_0x333d4d['data3'])return _0x333d4d;return db['CloudProvider'][_0x1923('0x3a')]({'where':{'id':_0x333d4d['id']},'raw':!![]});})[_0x1923('0x39')](function(_0x3464c5){var _0x40b5e2={'grant_type':_0x1923('0x3b'),'refresh_token':_0x3464c5[_0x1923('0x3c')],'scope':getAccessTokenScope(_0x3464c5),'redirect_uri':_0x3464c5[_0x1923('0x3d')],'client_id':_0x3464c5[_0x1923('0x22')],'client_secret':encryptor[_0x1923('0x3e')](_0x3464c5[_0x1923('0x3f')])};var _0xe1a4d1={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x1923('0x2e')]('{TENANT_ID}',_0x3464c5[_0x1923('0x1a')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x40b5e2,'json':!![]};return rp(_0xe1a4d1);})[_0x1923('0x39')](function(_0x20c0f7){_0x333d4d[_0x1923('0x40')]=_0x20c0f7[_0x1923('0x41')];_0x333d4d['data6']=_0x20c0f7[_0x1923('0x3b')];return db[_0x1923('0x42')]['update']({'data5':_0x333d4d['data5'],'data6':_0x333d4d[_0x1923('0x3c')]},{'where':{'id':_0x333d4d['id']}});})[_0x1923('0x39')](function(){return _0x333d4d;})[_0x1923('0x43')](function(_0x26245a){logger[_0x1923('0x44')](_0x1923('0x45'),_0x333d4d['id'],_0x26245a);});}function getOauth2MicrosoftAccessToken(_0x32df52,_0x3ef0e8){var _0x57a839={'grant_type':_0x1923('0x46'),'code':_0x32df52,'scope':getAccessTokenScope(_0x3ef0e8),'redirect_uri':_0x3ef0e8[_0x1923('0x3d')],'client_id':_0x3ef0e8[_0x1923('0x22')],'client_secret':encryptor[_0x1923('0x3e')](_0x3ef0e8[_0x1923('0x3f')])};var _0x467fc5={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x1923('0x2e')](_0x1923('0x19'),_0x3ef0e8[_0x1923('0x1a')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x57a839,'json':!![]};return rp(_0x467fc5);}function startRefreshInterval(_0x3c9990){var _0x14de45=schedule[_0x1923('0x47')];if(_0x14de45[_0x3c9990['id']])clearInterval(_0x14de45[_0x3c9990['id']]);_0x14de45[_0x3c9990['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x1923('0x48')](this,{'id':_0x3c9990['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x1923('0x47')]=_0x14de45;}function startAllRefreshIntervals(){return db['CloudProvider']['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x1923('0x39')](function(_0x2456bc){var _0x4457de=_0x2456bc[_0x1923('0x13')](function(_0x14e8eb){return refreshOauth2MicrosoftAccessToken(_0x14e8eb)[_0x1923('0x39')](function(_0x1a3d6d){startRefreshInterval(_0x1a3d6d);});});return Promise[_0x1923('0x49')](_0x4457de);})[_0x1923('0x43')](function(_0x5078bb){var _0x2d809e=_0x5078bb?util[_0x1923('0x4a')](_0x5078bb,{'showHidden':![],'depth':null}):'';logger['error']('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x2d809e);});}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 02d32c4..3a8c736 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 _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 +var _0x0598=['../../config/utils','jayson/promise','client','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','lodash','util','bluebird','../../mysqldb'];(function(_0x5893df,_0x20286f){var _0x2cf691=function(_0x1d9d02){while(--_0x1d9d02){_0x5893df['push'](_0x5893df['shift']());}};_0x2cf691(++_0x20286f);}(_0x0598,0x92));var _0x8059=function(_0x1679f5,_0x379e09){_0x1679f5=_0x1679f5-0x0;var _0x44bf93=_0x0598[_0x1679f5];return _0x44bf93;};'use strict';var _=require(_0x8059('0x0'));var util=require(_0x8059('0x1'));var moment=require('moment');var BPromise=require(_0x8059('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8059('0x3'))['db'];var utils=require(_0x8059('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x8059('0x5'));var client=jayson[_0x8059('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5996d7,_0x248273,_0x347f1b){return new BPromise(function(_0x4610d2,_0x116946){return client['request'](_0x5996d7,_0x347f1b)['then'](function(_0x89dda1){logger[_0x8059('0x7')](_0x8059('0x8'),_0x248273,_0x8059('0x9'));logger[_0x8059('0xa')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x248273,'request\x20sent',JSON[_0x8059('0xb')](_0x89dda1));if(_0x89dda1[_0x8059('0xc')]){if(_0x89dda1['error']['code']===0x1f4){logger['error'](_0x8059('0x8'),_0x248273,_0x89dda1[_0x8059('0xc')][_0x8059('0xd')]);return _0x116946(_0x89dda1[_0x8059('0xc')][_0x8059('0xd')]);}logger['error'](_0x8059('0x8'),_0x248273,_0x89dda1['error'][_0x8059('0xd')]);return _0x4610d2(_0x89dda1['error'][_0x8059('0xd')]);}else{logger[_0x8059('0x7')](_0x8059('0x8'),_0x248273,'request\x20sent');_0x4610d2(_0x89dda1['result']['message']);}})[_0x8059('0xe')](function(_0x239195){logger[_0x8059('0xc')](_0x8059('0x8'),_0x248273,_0x239195);_0x116946(_0x239195);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index c92debd..dd8e7a8 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 _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 +var _0xdb28=['delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','/oauth2/microsoft/callback','oauth2MicrosoftCallback','express','Router','../../components/auth/service','./cloudProvider.controller','isAuthenticated','index','get','/:id','post','update'];(function(_0x33a7df,_0x359ada){var _0x4a15b3=function(_0x49f2c0){while(--_0x49f2c0){_0x33a7df['push'](_0x33a7df['shift']());}};_0x4a15b3(++_0x359ada);}(_0xdb28,0x106));var _0x8db2=function(_0x3bfb7c,_0x13d943){_0x3bfb7c=_0x3bfb7c-0x0;var _0xd120ef=_0xdb28[_0x3bfb7c];return _0xd120ef;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['get']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);router[_0x8db2('0x6')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller['show']);router[_0x8db2('0x8')]('/',auth[_0x8db2('0x4')](),controller['create']);router['put'](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0x9')]);router[_0x8db2('0xa')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xb')]);router['get'](_0x8db2('0xc'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xd')]);router['post'](_0x8db2('0xe'),controller[_0x8db2('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 8744be8..176242e 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 _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 +var _0x0048=['STRING','exports'];(function(_0x412d91,_0x14d3b6){var _0x56f4c7=function(_0x2db8e6){while(--_0x2db8e6){_0x412d91['push'](_0x412d91['shift']());}};_0x56f4c7(++_0x14d3b6);}(_0x0048,0x129));var _0x8004=function(_0x5ce2b9,_0x31f8ff){_0x5ce2b9=_0x5ce2b9-0x0;var _0x70b5c1=_0x0048[_0x5ce2b9];return _0x70b5c1;};'use strict';var Sequelize=require('sequelize');module[_0x8004('0x0')]={'name':{'type':Sequelize[_0x8004('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x8004('0x1')]},'companyId':{'type':Sequelize[_0x8004('0x1')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x8004('0x1')]},'fax':{'type':Sequelize[_0x8004('0x1')]},'type':{'type':Sequelize[_0x8004('0x1')]},'street':{'type':Sequelize[_0x8004('0x1')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x8004('0x1')]},'email':{'type':Sequelize[_0x8004('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x8004('0x1')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x8004('0x1')]},'sCity':{'type':Sequelize[_0x8004('0x1')]},'sCountry':{'type':Sequelize[_0x8004('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index d2ae468..768e853 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 _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 +var _0xe20e=['find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','ids','getContacts','findOne','CmContact','length','order','hasOwnProperty','nolimit','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','count','limit','set','Content-Range','json','reject','save','update','then','destroy','get','Companies','UserProfileResource','end','error','name','send','index','CmCompany','describe','model','keys','query','filters','attributes','intersection','fields','sort','where','pick','filter','merge','map','options','includeAll','include','findAll','catch','show','params','rawAttributes'];(function(_0x2b2e28,_0x58372c){var _0x44c61f=function(_0x2869be){while(--_0x2869be){_0x2b2e28['push'](_0x2b2e28['shift']());}};_0x44c61f(++_0x58372c);}(_0xe20e,0x172));var _0xee20=function(_0x1b2cd4,_0x220d18){_0x1b2cd4=_0x1b2cd4-0x0;var _0x3e2ff5=_0xe20e[_0x1b2cd4];return _0x3e2ff5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xee20('0x0'));var zipdir=require(_0xee20('0x1'));var jsonpatch=require(_0xee20('0x2'));var rp=require(_0xee20('0x3'));var moment=require(_0xee20('0x4'));var BPromise=require(_0xee20('0x5'));var Mustache=require(_0xee20('0x6'));var util=require(_0xee20('0x7'));var path=require('path');var sox=require(_0xee20('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xee20('0x9'));var _=require('lodash');var squel=require(_0xee20('0xa'));var crypto=require(_0xee20('0xb'));var jsforce=require(_0xee20('0xc'));var deskjs=require(_0xee20('0xd'));var toCsv=require(_0xee20('0xe'));var querystring=require(_0xee20('0xf'));var Papa=require(_0xee20('0x10'));var Redis=require(_0xee20('0x11'));var authService=require(_0xee20('0x12'));var qs=require(_0xee20('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xee20('0x14'));var logger=require(_0xee20('0x15'))(_0xee20('0x16'));var utils=require(_0xee20('0x17'));var config=require(_0xee20('0x18'));var licenseUtil=require(_0xee20('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x28b4bb,_0x51506a){_0x51506a=_0x51506a||0xcc;return function(_0x6cfa7e){if(_0x6cfa7e){return _0x28b4bb[_0xee20('0x1a')](_0x51506a);}return _0x28b4bb[_0xee20('0x1b')](_0x51506a)['end']();};}function respondWithResult(_0x141552,_0x295ba6){_0x295ba6=_0x295ba6||0xc8;return function(_0x339388){if(_0x339388){return _0x141552[_0xee20('0x1b')](_0x295ba6)['json'](_0x339388);}};}function respondWithFilteredResult(_0x23ea6c,_0x1f88df){return function(_0x387100){if(_0x387100){var _0x3a78ad=typeof _0x1f88df[_0xee20('0x1c')]==='undefined'&&typeof _0x1f88df['limit']==='undefined';var _0x4a2751=_0x387100[_0xee20('0x1d')];var _0x4153b=_0x3a78ad?0x0:_0x1f88df[_0xee20('0x1c')];var _0x5ae406=_0x3a78ad?_0x387100[_0xee20('0x1d')]:_0x1f88df[_0xee20('0x1c')]+_0x1f88df[_0xee20('0x1e')];var _0x5a6103;if(_0x5ae406>=_0x4a2751){_0x5ae406=_0x4a2751;_0x5a6103=0xc8;}else{_0x5a6103=0xce;}_0x23ea6c['status'](_0x5a6103);return _0x23ea6c[_0xee20('0x1f')](_0xee20('0x20'),_0x4153b+'-'+_0x5ae406+'/'+_0x4a2751)[_0xee20('0x21')](_0x387100);}return null;};}function patchUpdates(_0x475d89){return function(_0x3beb19){try{jsonpatch['apply'](_0x3beb19,_0x475d89,!![]);}catch(_0x20454d){return BPromise[_0xee20('0x22')](_0x20454d);}return _0x3beb19[_0xee20('0x23')]();};}function saveUpdates(_0x582a01,_0x285da5){return function(_0x5de041){if(_0x5de041){return _0x5de041[_0xee20('0x24')](_0x582a01)[_0xee20('0x25')](function(_0x4fe9bf){return _0x4fe9bf;});}return null;};}function removeEntity(_0x2b325b,_0x49fa72){return function(_0x46434d){if(_0x46434d){return _0x46434d[_0xee20('0x26')]()[_0xee20('0x25')](function(){var _0x1b40ab=_0x46434d[_0xee20('0x27')]({'plain':!![]});var _0x47c1ab=_0xee20('0x28');return db[_0xee20('0x29')][_0xee20('0x26')]({'where':{'type':_0x47c1ab,'resourceId':_0x1b40ab['id']}})[_0xee20('0x25')](function(){return _0x46434d;});})[_0xee20('0x25')](function(){_0x2b325b['status'](0xcc)[_0xee20('0x2a')]();});}};}function handleEntityNotFound(_0x30b0fe,_0x2ee54d){return function(_0x17eae6){if(!_0x17eae6){_0x30b0fe[_0xee20('0x1a')](0x194);}return _0x17eae6;};}function handleError(_0xfec8ab,_0x6c0f3a){_0x6c0f3a=_0x6c0f3a||0x1f4;return function(_0x37f868){logger[_0xee20('0x2b')](_0x37f868['stack']);if(_0x37f868[_0xee20('0x2c')]){delete _0x37f868[_0xee20('0x2c')];}_0xfec8ab[_0xee20('0x1b')](_0x6c0f3a)[_0xee20('0x2d')](_0x37f868);};}exports[_0xee20('0x2e')]=function(_0x173081,_0x239ae5){var _0x1a7632={},_0x22fec0={},_0xdd681c={'count':0x0,'rows':[]};return db[_0xee20('0x2f')][_0xee20('0x30')]()[_0xee20('0x25')](function(_0x12f82e){_0x22fec0[_0xee20('0x31')]=_[_0xee20('0x32')](_0x12f82e);_0x22fec0[_0xee20('0x33')]=_[_0xee20('0x32')](_0x173081[_0xee20('0x33')]);_0x22fec0[_0xee20('0x34')]=_['intersection'](_0x22fec0['model'],_0x22fec0[_0xee20('0x33')]);_0x1a7632[_0xee20('0x35')]=_[_0xee20('0x36')](_0x22fec0['model'],qs[_0xee20('0x37')](_0x173081['query'][_0xee20('0x37')]));_0x1a7632[_0xee20('0x35')]=_0x1a7632[_0xee20('0x35')]['length']?_0x1a7632[_0xee20('0x35')]:_0x22fec0[_0xee20('0x31')];if(!_0x173081[_0xee20('0x33')]['hasOwnProperty']('nolimit')){_0x1a7632[_0xee20('0x1e')]=qs[_0xee20('0x1e')](_0x173081[_0xee20('0x33')][_0xee20('0x1e')]);_0x1a7632[_0xee20('0x1c')]=qs[_0xee20('0x1c')](_0x173081[_0xee20('0x33')][_0xee20('0x1c')]);}_0x1a7632['order']=qs[_0xee20('0x38')](_0x173081[_0xee20('0x33')]['sort']);_0x1a7632[_0xee20('0x39')]=qs[_0xee20('0x34')](_[_0xee20('0x3a')](_0x173081[_0xee20('0x33')],_0x22fec0[_0xee20('0x34')]),_0x12f82e);if(_0x173081[_0xee20('0x33')][_0xee20('0x3b')]){_0x1a7632[_0xee20('0x39')]=_[_0xee20('0x3c')](_0x1a7632['where'],{'$or':_[_0xee20('0x3d')](_0x1a7632[_0xee20('0x35')],function(_0x3b6569){var _0x4730c0={};_0x4730c0[_0x3b6569]={'$like':'%'+_0x173081[_0xee20('0x33')][_0xee20('0x3b')]+'%'};return _0x4730c0;})});}_0x1a7632=_[_0xee20('0x3c')]({},_0x1a7632,_0x173081[_0xee20('0x3e')]);var _0x326345={'where':_0x1a7632[_0xee20('0x39')]};return db[_0xee20('0x2f')]['count'](_0x326345)['then'](function(_0x3e3d1a){_0xdd681c[_0xee20('0x1d')]=_0x3e3d1a;if(_0x173081['query'][_0xee20('0x3f')]){_0x1a7632[_0xee20('0x40')]=[{'all':!![]}];}return db['CmCompany'][_0xee20('0x41')](_0x1a7632);})[_0xee20('0x25')](function(_0x3d4641){_0xdd681c['rows']=_0x3d4641;return _0xdd681c;})['then'](respondWithFilteredResult(_0x239ae5,_0x1a7632))[_0xee20('0x42')](handleError(_0x239ae5,null));})[_0xee20('0x42')](handleError(_0x239ae5,null));};exports[_0xee20('0x43')]=function(_0x3cbf14,_0x1a7293){var _0x1cf3e5={'raw':![],'where':{'id':_0x3cbf14[_0xee20('0x44')]['id']}},_0x14aee9={};_0x14aee9['model']=_['keys'](db[_0xee20('0x2f')][_0xee20('0x45')]);_0x14aee9[_0xee20('0x33')]=_['keys'](_0x3cbf14[_0xee20('0x33')]);_0x14aee9[_0xee20('0x34')]=_[_0xee20('0x36')](_0x14aee9[_0xee20('0x31')],_0x14aee9[_0xee20('0x33')]);_0x1cf3e5[_0xee20('0x35')]=_[_0xee20('0x36')](_0x14aee9[_0xee20('0x31')],qs[_0xee20('0x37')](_0x3cbf14[_0xee20('0x33')][_0xee20('0x37')]));_0x1cf3e5['attributes']=_0x1cf3e5[_0xee20('0x35')]['length']?_0x1cf3e5['attributes']:_0x14aee9[_0xee20('0x31')];if(_0x3cbf14[_0xee20('0x33')][_0xee20('0x3f')]){_0x1cf3e5[_0xee20('0x40')]=[{'all':!![]}];}_0x1cf3e5=_[_0xee20('0x3c')]({},_0x1cf3e5,_0x3cbf14[_0xee20('0x3e')]);return db[_0xee20('0x2f')][_0xee20('0x46')](_0x1cf3e5)['then'](handleEntityNotFound(_0x1a7293,null))[_0xee20('0x25')](respondWithResult(_0x1a7293,null))[_0xee20('0x42')](handleError(_0x1a7293,null));};exports[_0xee20('0x47')]=function(_0x86a8de,_0x55f034){return db[_0xee20('0x2f')][_0xee20('0x47')](_0x86a8de[_0xee20('0x48')],{})[_0xee20('0x25')](function(_0x3bb391){var _0x1edb42=_0x86a8de[_0xee20('0x49')][_0xee20('0x27')]({'plain':!![]});if(!_0x1edb42)throw new Error(_0xee20('0x4a'));if(_0x1edb42[_0xee20('0x4b')]===_0xee20('0x49')){var _0x43e5fb=_0x3bb391[_0xee20('0x27')]({'plain':!![]});var _0xd031f6=_0xee20('0x28');return db[_0xee20('0x4c')][_0xee20('0x46')]({'where':{'name':_0xd031f6,'userProfileId':_0x1edb42[_0xee20('0x4d')]},'raw':!![]})['then'](function(_0x30880c){if(_0x30880c&&_0x30880c[_0xee20('0x4e')]===0x0){return db[_0xee20('0x29')][_0xee20('0x47')]({'name':_0x43e5fb[_0xee20('0x2c')],'resourceId':_0x43e5fb['id'],'type':_0x30880c[_0xee20('0x2c')],'sectionId':_0x30880c['id']},{})[_0xee20('0x25')](function(){return _0x3bb391;});}else{return _0x3bb391;}})['catch'](function(_0x260ec7){logger[_0xee20('0x2b')](_0xee20('0x4f'),_0x260ec7);throw _0x260ec7;});}return _0x3bb391;})[_0xee20('0x25')](respondWithResult(_0x55f034,0xc9))[_0xee20('0x42')](handleError(_0x55f034,null));};exports[_0xee20('0x24')]=function(_0x51142e,_0x3d18e2){if(_0x51142e[_0xee20('0x48')]['id']){delete _0x51142e['body']['id'];}return db[_0xee20('0x2f')]['find']({'where':{'id':_0x51142e['params']['id']}})[_0xee20('0x25')](handleEntityNotFound(_0x3d18e2,null))[_0xee20('0x25')](saveUpdates(_0x51142e['body'],null))[_0xee20('0x25')](respondWithResult(_0x3d18e2,null))[_0xee20('0x42')](handleError(_0x3d18e2,null));};exports['destroy']=function(_0xb81a6,_0x3992c7){return db['CmCompany'][_0xee20('0x46')]({'where':{'id':_0xb81a6['params']['id']}})[_0xee20('0x25')](handleEntityNotFound(_0x3992c7,null))['then'](removeEntity(_0x3992c7,null))[_0xee20('0x42')](handleError(_0x3992c7,null));};exports['describe']=function(_0x3072f8,_0x596cd1){return db[_0xee20('0x2f')][_0xee20('0x30')]()['then'](respondWithResult(_0x596cd1,null))[_0xee20('0x42')](handleError(_0x596cd1,null));};exports['addContacts']=function(_0x518f1c,_0x459f6e,_0x21740a){return db['CmContact']['find']({'where':{'id':_0x518f1c[_0xee20('0x44')]['id']}})[_0xee20('0x25')](handleEntityNotFound(_0x459f6e,null))['then'](function(_0xafb7af){if(_0xafb7af){return _0xafb7af['addContacts'](_0x518f1c[_0xee20('0x48')][_0xee20('0x50')],_['omit'](_0x518f1c['body'],[_0xee20('0x50'),'id'])||{});}})[_0xee20('0x25')](respondWithResult(_0x459f6e,null))[_0xee20('0x42')](handleError(_0x459f6e,null));};exports[_0xee20('0x51')]=function(_0xa1336d,_0x586bb6,_0x1805cb){var _0x47c8dc={};var _0x44a086={};var _0x3dd1bd;var _0x4d4008;return db[_0xee20('0x2f')][_0xee20('0x52')]({'where':{'id':_0xa1336d[_0xee20('0x44')]['id']}})['then'](handleEntityNotFound(_0x586bb6,null))[_0xee20('0x25')](function(_0x28f492){if(_0x28f492){_0x3dd1bd=_0x28f492;_0x44a086['model']=_[_0xee20('0x32')](db[_0xee20('0x53')][_0xee20('0x45')]);_0x44a086['query']=_[_0xee20('0x32')](_0xa1336d['query']);_0x44a086['filters']=_[_0xee20('0x36')](_0x44a086['model'],_0x44a086[_0xee20('0x33')]);_0x47c8dc['attributes']=_['intersection'](_0x44a086[_0xee20('0x31')],qs[_0xee20('0x37')](_0xa1336d[_0xee20('0x33')]['fields']));_0x47c8dc[_0xee20('0x35')]=_0x47c8dc[_0xee20('0x35')][_0xee20('0x54')]?_0x47c8dc[_0xee20('0x35')]:_0x44a086[_0xee20('0x31')];_0x47c8dc[_0xee20('0x55')]=qs[_0xee20('0x38')](_0xa1336d[_0xee20('0x33')][_0xee20('0x38')]);_0x47c8dc[_0xee20('0x39')]=qs[_0xee20('0x34')](_['pick'](_0xa1336d[_0xee20('0x33')],_0x44a086['filters']));if(_0xa1336d[_0xee20('0x33')][_0xee20('0x3b')]){_0x47c8dc[_0xee20('0x39')]=_[_0xee20('0x3c')](_0x47c8dc[_0xee20('0x39')],{'$or':_['map'](_0x47c8dc[_0xee20('0x35')],function(_0x47a1e1){var _0x3b824a={};_0x3b824a[_0x47a1e1]={'$like':'%'+_0xa1336d[_0xee20('0x33')][_0xee20('0x3b')]+'%'};return _0x3b824a;})});}_0x47c8dc=_[_0xee20('0x3c')]({},_0x47c8dc,_0xa1336d[_0xee20('0x3e')]);return _0x3dd1bd[_0xee20('0x51')](_0x47c8dc);}})[_0xee20('0x25')](function(_0x40f5c8){if(_0x40f5c8){_0x4d4008=_0x40f5c8[_0xee20('0x54')];if(!_0xa1336d[_0xee20('0x33')][_0xee20('0x56')](_0xee20('0x57'))){_0x47c8dc['limit']=qs[_0xee20('0x1e')](_0xa1336d[_0xee20('0x33')][_0xee20('0x1e')]);_0x47c8dc[_0xee20('0x1c')]=qs[_0xee20('0x1c')](_0xa1336d[_0xee20('0x33')][_0xee20('0x1c')]);}return _0x3dd1bd['getContacts'](_0x47c8dc);}})[_0xee20('0x25')](function(_0x55d416){if(_0x55d416){return _0x55d416?{'count':_0x4d4008,'rows':_0x55d416}:null;}})['then'](respondWithResult(_0x586bb6,null))[_0xee20('0x42')](handleError(_0x586bb6,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 79f589b..7c2bca3 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 _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 +var _0x7441=['util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./cmCompany.attributes','exports','define','CmCompany','lodash'];(function(_0x30a060,_0xd97d7c){var _0x544757=function(_0x2e3869){while(--_0x2e3869){_0x30a060['push'](_0x30a060['shift']());}};_0x544757(++_0xd97d7c);}(_0x7441,0xcb));var _0x1744=function(_0x4c6716,_0x3d9cc4){_0x4c6716=_0x4c6716-0x0;var _0x2224b3=_0x7441[_0x4c6716];return _0x2224b3;};'use strict';var _=require(_0x1744('0x0'));var util=require(_0x1744('0x1'));var logger=require(_0x1744('0x2'))('api');var moment=require(_0x1744('0x3'));var BPromise=require(_0x1744('0x4'));var rp=require(_0x1744('0x5'));var fs=require('fs');var path=require(_0x1744('0x6'));var rimraf=require('rimraf');var config=require(_0x1744('0x7'));var attributes=require(_0x1744('0x8'));module[_0x1744('0x9')]=function(_0x4284ac,_0x47745d){return _0x4284ac[_0x1744('0xa')](_0x1744('0xb'),attributes,{'tableName':'cm_companies','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 9dd8f4d..ae3893c 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 _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 +var _0x3644=['request','info','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmCompany,\x20%s,\x20%s','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x30e8ee,_0x254688){var _0x2d5f9d=function(_0x26d226){while(--_0x26d226){_0x30e8ee['push'](_0x30e8ee['shift']());}};_0x2d5f9d(++_0x254688);}(_0x3644,0x1d6));var _0x4364=function(_0x2dafb2,_0xf8c650){_0x2dafb2=_0x2dafb2-0x0;var _0x37fb79=_0x3644[_0x2dafb2];return _0x37fb79;};'use strict';var _=require(_0x4364('0x0'));var util=require(_0x4364('0x1'));var moment=require(_0x4364('0x2'));var BPromise=require(_0x4364('0x3'));var rs=require(_0x4364('0x4'));var fs=require('fs');var Redis=require(_0x4364('0x5'));var db=require(_0x4364('0x6'))['db'];var utils=require(_0x4364('0x7'));var logger=require(_0x4364('0x8'))(_0x4364('0x9'));var config=require(_0x4364('0xa'));var jayson=require(_0x4364('0xb'));var client=jayson['client'][_0x4364('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5c3362,_0xdf3593,_0x25ce9b){return new BPromise(function(_0x1829b0,_0x2bf32a){return client[_0x4364('0xd')](_0x5c3362,_0x25ce9b)['then'](function(_0x4d24f4){logger[_0x4364('0xe')]('CmCompany,\x20%s,\x20%s',_0xdf3593,_0x4364('0xf'));logger[_0x4364('0x10')](_0x4364('0x11'),_0xdf3593,_0x4364('0xf'),JSON[_0x4364('0x12')](_0x4d24f4));if(_0x4d24f4['error']){if(_0x4d24f4[_0x4364('0x13')][_0x4364('0x14')]===0x1f4){logger[_0x4364('0x13')]('CmCompany,\x20%s,\x20%s',_0xdf3593,_0x4d24f4['error'][_0x4364('0x15')]);return _0x2bf32a(_0x4d24f4[_0x4364('0x13')][_0x4364('0x15')]);}logger[_0x4364('0x13')]('CmCompany,\x20%s,\x20%s',_0xdf3593,_0x4d24f4[_0x4364('0x13')]['message']);return _0x1829b0(_0x4d24f4[_0x4364('0x13')]['message']);}else{logger[_0x4364('0xe')]('CmCompany,\x20%s,\x20%s',_0xdf3593,_0x4364('0xf'));_0x1829b0(_0x4d24f4['result'][_0x4364('0x15')]);}})['catch'](function(_0x1b8afe){logger['error'](_0x4364('0x16'),_0xdf3593,_0x1b8afe);_0x2bf32a(_0x1b8afe);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 4b0be54..710012f 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 _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 +var _0x4baf=['addContacts','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','isAuthenticated','get','/describe','describe','/:id','show','getContacts','post','create','/:id/contacts'];(function(_0x8c3f14,_0xb80983){var _0x2991f2=function(_0x1d6dd8){while(--_0x1d6dd8){_0x8c3f14['push'](_0x8c3f14['shift']());}};_0x2991f2(++_0xb80983);}(_0x4baf,0xb4));var _0xf4ba=function(_0x2696aa,_0x55f59c){_0x2696aa=_0x2696aa-0x0;var _0x2a8cce=_0x4baf[_0x2696aa];return _0x2a8cce;};'use strict';var multer=require(_0xf4ba('0x0'));var util=require('util');var path=require(_0xf4ba('0x1'));var timeout=require(_0xf4ba('0x2'));var express=require(_0xf4ba('0x3'));var router=express[_0xf4ba('0x4')]();var fs_extra=require(_0xf4ba('0x5'));var auth=require(_0xf4ba('0x6'));var interaction=require(_0xf4ba('0x7'));var config=require(_0xf4ba('0x8'));var controller=require(_0xf4ba('0x9'));router['get']('/',auth[_0xf4ba('0xa')](),controller['index']);router[_0xf4ba('0xb')](_0xf4ba('0xc'),auth['isAuthenticated'](),controller[_0xf4ba('0xd')]);router[_0xf4ba('0xb')](_0xf4ba('0xe'),auth[_0xf4ba('0xa')](),controller[_0xf4ba('0xf')]);router['get']('/:id/contacts',auth[_0xf4ba('0xa')](),controller[_0xf4ba('0x10')]);router[_0xf4ba('0x11')]('/',auth['isAuthenticated'](),controller[_0xf4ba('0x12')]);router[_0xf4ba('0x11')](_0xf4ba('0x13'),auth['isAuthenticated'](),controller[_0xf4ba('0x14')]);router[_0xf4ba('0x15')](_0xf4ba('0xe'),auth[_0xf4ba('0xa')](),controller[_0xf4ba('0x16')]);router[_0xf4ba('0x17')](_0xf4ba('0xe'),auth[_0xf4ba('0xa')](),controller[_0xf4ba('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 96aa574..8194f76 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 _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 +var _0xcbdf=['exports','STRING','TEXT','INTEGER','DATE','NOW','sequelize'];(function(_0x11a55c,_0x4eced9){var _0x26c390=function(_0x5b0662){while(--_0x5b0662){_0x11a55c['push'](_0x11a55c['shift']());}};_0x26c390(++_0x4eced9);}(_0xcbdf,0x15d));var _0xfcbd=function(_0x22dc03,_0x36dda0){_0x22dc03=_0x22dc03-0x0;var _0x26c6fd=_0xcbdf[_0x22dc03];return _0x26c6fd;};'use strict';var _=require('lodash');var Sequelize=require(_0xfcbd('0x0'));module[_0xfcbd('0x1')]={'firstName':{'type':Sequelize[_0xfcbd('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0xfcbd('0x2')]},'street':{'type':Sequelize[_0xfcbd('0x2')]},'postalCode':{'type':Sequelize[_0xfcbd('0x2')]},'city':{'type':Sequelize[_0xfcbd('0x2')]},'country':{'type':Sequelize[_0xfcbd('0x2')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xfcbd('0x3')]},'phone':{'type':Sequelize[_0xfcbd('0x2')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xfcbd('0x2')]},'email':{'type':Sequelize[_0xfcbd('0x2')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0xfcbd('0x2')]},'fb_data':{'type':Sequelize[_0xfcbd('0x2')]},'twitter':{'type':Sequelize[_0xfcbd('0x2')]},'skype':{'type':Sequelize[_0xfcbd('0x2')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0xfcbd('0x2')]},'line':{'type':Sequelize[_0xfcbd('0x2')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0xfcbd('0x2')]},'UserId':{'type':Sequelize[_0xfcbd('0x4')]},'AdditionalPhones':{'type':Sequelize[_0xfcbd('0x2')]},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xfcbd('0x5')],'defaultValue':Sequelize[_0xfcbd('0x6')]},'dialTimezone':{'type':Sequelize[_0xfcbd('0x2')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 3331344..f260bac 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 _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 +var _0x1446=['attributes','fields','sort','filters','pick','filter','nolimit','setTags','ids','setAdditionalPhones','ContactItemType','OrderBy','items','item_types','ItemTypeId','description','PHONE','CmHopper','CmHopperAdditionalPhone','item','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','bulkCreate','hasOwnProperty','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers','order','options','includeAll','include','rows','getHopperHistories','getHopperFinals','ContactId','getJscriptySessions','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','zipObject','No\x20phone\x20column\x20specified','firstName','root','server/files/tmp','filename','chmodSync','child_process','fork','CompanyId','socket_timestamp','File\x20uploaded\x20correctly!','pid','upload','createReadStream','file','path','parse','User','agent','binding','No\x20firstName\x20column\x20specified','message','start\x20child\x20process\x20correctly!','exit','importUpdates','stringify','error\x20child\x20process','getJourney','mail','chat','sms','openchannel','whatsapp','channel','toLowerCase','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','voice','uniqueid','destination','starttime','duration','note','userDisposition','userThirdDisposition','UserId','fullname','DESC','createdAt','name','alias','startCase','Account','closed','disposition','secondDisposition','key','Owner','customerIp','customerPort','deviceModel','osName','ratingType','ratingValue','substatus','externalUrl','threadId','Interaction','findAndCountAll','flatten','sortBy','reverse','moment','util','lodash','squel','papaparse','../../components/contacts','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./cmContact.socket','register','json','count','offset','limit','status','set','Content-Range','then','destroy','end','sendStatus','stack','send','getOptions','findAll','query','user','catch','CmContact','params','describe','tags','keys','startsWith','columnName','analytics','CmCustomField','length','cf_','custom','type','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','merge','from','get','mergeWith','isArray','[CmContact][merge]\x20to\x20%s\x20from\x20%s','body','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelMessage','CmContactHasItem','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappQueueReport','join','isNil','dialTimezone','timezones','utcOffset','additionalPhones','each','duplicates','where','$or','push','ListId','findOrCreate','contact','all','show','find','Tag','Tags','color','Phones','ItemType','sequelize','literal','$and','omit','map','format','cf_%d','isEmpty','table','cm_contacts','setFields','toParam','text','phone','getTags','findOne','model','rawAttributes','intersection'];(function(_0x31295c,_0x2f2b82){var _0x2c150e=function(_0x957f1){while(--_0x957f1){_0x31295c['push'](_0x31295c['shift']());}};_0x2c150e(++_0x2f2b82);}(_0x1446,0x7c));var _0x6144=function(_0x1f5411,_0x5bd665){_0x1f5411=_0x1f5411-0x0;var _0x35d96e=_0x1446[_0x1f5411];return _0x35d96e;};'use strict';var moment=require(_0x6144('0x0'));var BPromise=require('bluebird');var util=require(_0x6144('0x1'));var path=require('path');var fs=require('fs');var _=require(_0x6144('0x2'));var squel=require(_0x6144('0x3'));var Papa=require(_0x6144('0x4'));var Redis=require('ioredis');var contacts=require(_0x6144('0x5'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x6144('0x6'));var config=require(_0x6144('0x7'));var shared=require('../../config/environment/shared');var db=require(_0x6144('0x8'))['db'];config[_0x6144('0x9')]=_[_0x6144('0xa')](config[_0x6144('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x6144('0xb'))(new Redis(config[_0x6144('0x9')]));require(_0x6144('0xc'))[_0x6144('0xd')](socket);function respondWithResult(_0xb88ae1,_0x47d6e5){_0x47d6e5=_0x47d6e5||0xc8;return function(_0x4f6b39){if(_0x4f6b39){return _0xb88ae1['status'](_0x47d6e5)[_0x6144('0xe')](_0x4f6b39);}};}function respondWithFilteredResult(_0x18d541,_0x56202d){return function(_0x1e0984){if(_0x1e0984){var _0x174a14=typeof _0x56202d['offset']==='undefined'&&typeof _0x56202d['limit']==='undefined';var _0x474301=_0x1e0984[_0x6144('0xf')];var _0x3877d4=_0x174a14?0x0:_0x56202d[_0x6144('0x10')];var _0x38fe2a=_0x174a14?_0x1e0984[_0x6144('0xf')]:_0x56202d['offset']+_0x56202d[_0x6144('0x11')];var _0x15c2e6;if(_0x38fe2a>=_0x474301){_0x38fe2a=_0x474301;_0x15c2e6=0xc8;}else{_0x15c2e6=0xce;}_0x18d541[_0x6144('0x12')](_0x15c2e6);return _0x18d541[_0x6144('0x13')](_0x6144('0x14'),_0x3877d4+'-'+_0x38fe2a+'/'+_0x474301)[_0x6144('0xe')](_0x1e0984);}return null;};}function saveUpdates(_0x1d2618){return function(_0x3a9b18){if(_0x3a9b18){return _0x3a9b18['update'](_0x1d2618)[_0x6144('0x15')](function(_0x559e58){return _0x559e58;});}return null;};}function removeEntity(_0x39d376){return function(_0x2b32d4){if(_0x2b32d4){return _0x2b32d4[_0x6144('0x16')]()['then'](function(){_0x39d376[_0x6144('0x12')](0xcc)[_0x6144('0x17')]();});}};}function handleEntityNotFound(_0x2662e2){return function(_0x28cc43){if(!_0x28cc43){_0x2662e2[_0x6144('0x18')](0x194);}return _0x28cc43;};}function handleError(_0x5abe26,_0x23b439){_0x23b439=_0x23b439||0x1f4;return function(_0x8447f4){logger['error'](_0x8447f4[_0x6144('0x19')]);if(_0x8447f4['name']){delete _0x8447f4['name'];}_0x5abe26[_0x6144('0x12')](_0x23b439)[_0x6144('0x1a')](_0x8447f4);};}exports['index']=function(_0x4a5a27,_0x1b2f5f){var _0x20e2d5={};return contacts['describe']()[_0x6144('0x15')](function(_0x5400bb){_0x20e2d5=qs[_0x6144('0x1b')](_0x5400bb,_0x4a5a27);return contacts[_0x6144('0x1c')](_0x4a5a27[_0x6144('0x1d')],_0x4a5a27[_0x6144('0x1e')],_0x20e2d5,_0x5400bb);})[_0x6144('0x15')](respondWithFilteredResult(_0x1b2f5f,_0x20e2d5))[_0x6144('0x1f')](handleError(_0x1b2f5f,null));};exports[_0x6144('0x16')]=function(_0x57e0d3,_0x3153c9){return db[_0x6144('0x20')]['find']({'where':{'id':_0x57e0d3[_0x6144('0x21')]['id']}})['then'](handleEntityNotFound(_0x3153c9,null))['then'](removeEntity(_0x3153c9,null))['catch'](handleError(_0x3153c9,null));};exports['describe']=function(_0x2f2b07,_0x6e282c){return db['CmContact'][_0x6144('0x22')]()['then'](function(_0xf81c7b){delete _0xf81c7b[_0x6144('0x23')];for(var _0x1a1a08=0x0;_0x1a1a080x0){return new Promise(function(_0x253f94){var _0xe38833=[];for(var _0x4e7d5f=0x0;_0x4e7d5f<_0x3f143e[_0x6144('0x29')];_0x4e7d5f++){_0xe38833[_0x6144('0x5c')](insertAdditionalPhones(_0x3f143e[_0x4e7d5f][_0x6144('0x5f')],_0x3f143e[_0x4e7d5f]['additionalPhones']));}Promise[_0x6144('0x60')](_0xe38833)[_0x6144('0x15')](function(){_0x253f94(0x1);});})[_0x6144('0x15')](function(){return{'success':_0x11a0d5,'failure':_0x551f75,'duplicates':_0x5ce1e2};});}else{return{'success':_0x11a0d5,'failure':_0x551f75,'duplicates':_0x5ce1e2};}}})[_0x6144('0x15')](respondWithResult(_0x321ac4,0xc9))[_0x6144('0x1f')](handleError(_0x321ac4,null));};exports[_0x6144('0x61')]=function(_0x4fde57,_0x2e1caf){var _0x10d0a6;return db[_0x6144('0x20')][_0x6144('0x22')]()[_0x6144('0x15')](function(_0x3bb065){return db[_0x6144('0x20')][_0x6144('0x62')]({'where':{'id':_0x4fde57[_0x6144('0x21')]['id']},'include':[{'model':db[_0x6144('0x63')],'as':_0x6144('0x64'),'attributes':['id','name',_0x6144('0x65')],'required':_0x4fde57[_0x6144('0x1d')]['tag']?!![]:![]},{'model':db[_0x6144('0x45')],'as':_0x6144('0x66'),'where':{'CmContactId':_0x4fde57['params']['id']},'required':![],'include':[{'model':db['ContactItemType'],'as':_0x6144('0x67')}]}],'order':[db[_0x6144('0x68')][_0x6144('0x69')]('Phones.OrderBy')],'attributes':_[_0x6144('0x24')](_0x3bb065)});})[_0x6144('0x15')](function(_0x1cc2ee){if(!_[_0x6144('0x53')](_0x1cc2ee)){_0x10d0a6=_0x1cc2ee['get']({'plain':!![]});var _0x42a128={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x1cc2ee&&_0x1cc2ee['ListId']){if(_0x1cc2ee[_0x6144('0x5d')]){_0x42a128[_0x6144('0x5a')][_0x6144('0x6a')][_0x6144('0x5c')]({'ListId':{'$ne':_0x1cc2ee[_0x6144('0x5d')]}});}}return db[_0x6144('0x28')][_0x6144('0x1c')](_0x42a128);}})[_0x6144('0x15')](function(_0x6a71d1){if(!_[_0x6144('0x53')](_0x6a71d1)){return _[_0x6144('0x6b')](_0x10d0a6,_[_0x6144('0x6c')](_0x6a71d1,function(_0x129ed8){return util[_0x6144('0x6d')](_0x6144('0x6e'),_0x129ed8['id']);}));}})[_0x6144('0x15')](handleEntityNotFound(_0x2e1caf,null))['then'](respondWithResult(_0x2e1caf,null))['catch'](handleError(_0x2e1caf,null));};exports[_0x6144('0x3b')]=function(_0x414751,_0x789bb){var _0x3a6ea0;if(_0x414751[_0x6144('0x36')]['id']){delete _0x414751[_0x6144('0x36')]['id'];}if(!_[_0x6144('0x53')](_0x414751[_0x6144('0x36')]['dialTimezone'])){var _0x5a851f=_0x414751[_0x6144('0x36')][_0x6144('0x54')];if(!_[_0x6144('0x53')](shared[_0x6144('0x55')][_0x5a851f]))_0x414751[_0x6144('0x36')][_0x6144('0x56')]=shared[_0x6144('0x55')][_0x5a851f]['utcOffset'];}return db[_0x6144('0x20')][_0x6144('0x62')]({'where':{'id':_0x414751[_0x6144('0x21')]['id']}})[_0x6144('0x15')](handleEntityNotFound(_0x789bb,null))[_0x6144('0x15')](saveUpdates(_0x414751[_0x6144('0x36')],null))[_0x6144('0x15')](function(_0x535311){_0x3a6ea0=_0x535311;var _0x107372={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x535311&&_0x535311[_0x6144('0x5d')]){if(_0x535311[_0x6144('0x5d')]){_0x107372[_0x6144('0x5a')][_0x6144('0x6a')][_0x6144('0x5c')]({'ListId':{'$ne':_0x535311[_0x6144('0x5d')]}});}}return db[_0x6144('0x28')][_0x6144('0x1c')](_0x107372);})[_0x6144('0x15')](function(_0x256d2d){if(_0x256d2d){return _[_0x6144('0x6b')](_['pickBy'](_0x414751[_0x6144('0x36')],function(_0x3f376e,_0xaba44b){return _[_0x6144('0x25')](_0xaba44b,_0x6144('0x2a'));}),_[_0x6144('0x6c')](_0x256d2d,function(_0x282a3d){return util[_0x6144('0x6d')]('cf_%d',_0x282a3d['id']);}));}})[_0x6144('0x15')](function(_0x5cc194){if(_0x5cc194&&!_[_0x6144('0x6f')](_0x5cc194)){var _0x5c1747=squel[_0x6144('0x3b')]()[_0x6144('0x70')](_0x6144('0x71'))[_0x6144('0x72')](_0x5cc194)['where']('id\x20=\x20?',_0x414751[_0x6144('0x21')]['id'])[_0x6144('0x73')]();return db[_0x6144('0x68')][_0x6144('0x1d')](_0x5c1747[_0x6144('0x74')],{'replacements':_0x5c1747['values']});}})[_0x6144('0x15')](function(){if(_0x414751[_0x6144('0x36')][_0x6144('0x75')]&&_0x3a6ea0){return db['CmHopper'][_0x6144('0x3b')]({'phone':_0x414751[_0x6144('0x36')][_0x6144('0x75')],'OrderBy':0x0},{'where':{'ContactId':_0x3a6ea0['id']}});}})[_0x6144('0x15')](function(){return _0x3a6ea0;})[_0x6144('0x15')](respondWithResult(_0x789bb,null))[_0x6144('0x1f')](handleError(_0x789bb,null));};exports[_0x6144('0x76')]=function(_0x1e8e7f,_0x1be75b){var _0x1c7324={};var _0x509a07={};var _0x44c54f;var _0x205951;return db[_0x6144('0x20')][_0x6144('0x77')]({'where':{'id':_0x1e8e7f[_0x6144('0x21')]['id']}})[_0x6144('0x15')](handleEntityNotFound(_0x1be75b,null))[_0x6144('0x15')](function(_0x589415){if(_0x589415){_0x44c54f=_0x589415;_0x509a07[_0x6144('0x78')]=_[_0x6144('0x24')](db[_0x6144('0x63')][_0x6144('0x79')]);_0x509a07[_0x6144('0x1d')]=_['keys'](_0x1e8e7f[_0x6144('0x1d')]);_0x509a07['filters']=_[_0x6144('0x7a')](_0x509a07['model'],_0x509a07[_0x6144('0x1d')]);_0x1c7324[_0x6144('0x7b')]=_[_0x6144('0x7a')](_0x509a07[_0x6144('0x78')],qs[_0x6144('0x7c')](_0x1e8e7f[_0x6144('0x1d')]['fields']));_0x1c7324[_0x6144('0x7b')]=_0x1c7324[_0x6144('0x7b')][_0x6144('0x29')]?_0x1c7324[_0x6144('0x7b')]:_0x509a07[_0x6144('0x78')];_0x1c7324['order']=qs[_0x6144('0x7d')](_0x1e8e7f[_0x6144('0x1d')]['sort']);_0x1c7324[_0x6144('0x5a')]=qs[_0x6144('0x7e')](_[_0x6144('0x7f')](_0x1e8e7f[_0x6144('0x1d')],_0x509a07[_0x6144('0x7e')]));if(_0x1e8e7f[_0x6144('0x1d')][_0x6144('0x80')]){_0x1c7324[_0x6144('0x5a')]=_[_0x6144('0x30')](_0x1c7324['where'],{'$or':_['map'](_0x1c7324['attributes'],function(_0x499ae5){var _0x3272e5={};_0x3272e5[_0x499ae5]={'$like':'%'+_0x1e8e7f[_0x6144('0x1d')][_0x6144('0x80')]+'%'};return _0x3272e5;})});}_0x1c7324=_[_0x6144('0x30')]({},_0x1c7324,_0x1e8e7f['options']);return _0x44c54f[_0x6144('0x76')](_0x1c7324);}})[_0x6144('0x15')](function(_0x59bfda){if(_0x59bfda){_0x205951=_0x59bfda[_0x6144('0x29')];if(!_0x1e8e7f[_0x6144('0x1d')]['hasOwnProperty'](_0x6144('0x81'))){_0x1c7324['limit']=qs[_0x6144('0x11')](_0x1e8e7f[_0x6144('0x1d')]['limit']);_0x1c7324['offset']=qs[_0x6144('0x10')](_0x1e8e7f[_0x6144('0x1d')][_0x6144('0x10')]);}return _0x44c54f[_0x6144('0x76')](_0x1c7324);}})[_0x6144('0x15')](function(_0x3dfc50){if(_0x3dfc50){return _0x3dfc50?{'count':_0x205951,'rows':_0x3dfc50}:null;}})['then'](respondWithResult(_0x1be75b,null))[_0x6144('0x1f')](handleError(_0x1be75b,null));};exports[_0x6144('0x82')]=function(_0x5dfe9e,_0x28a7d7){if(_0x5dfe9e[_0x6144('0x36')]['id']){delete _0x5dfe9e['body']['id'];}return db[_0x6144('0x20')]['findOne']({'where':{'id':_0x5dfe9e[_0x6144('0x21')]['id']}})['then'](handleEntityNotFound(_0x28a7d7,null))[_0x6144('0x15')](function(_0x96cf23){if(_0x96cf23){return _0x96cf23[_0x6144('0x82')](_0x5dfe9e[_0x6144('0x36')][_0x6144('0x83')]||[]);}return null;})[_0x6144('0x15')](respondWithResult(_0x28a7d7,null))[_0x6144('0x1f')](handleError(_0x28a7d7,null));};exports[_0x6144('0x84')]=function(_0x45d9a1,_0x1fe564){var _0x1c5a93=[];_0x1c5a93[_0x6144('0x5c')](addAdditionalPhones(_0x45d9a1[_0x6144('0x36')]));Promise[_0x6144('0x60')](_0x1c5a93)[_0x6144('0x15')](function(){_0x1c5a93=[];_0x1c5a93[_0x6144('0x5c')](deleteCmHopperPhones(_0x45d9a1[_0x6144('0x36')]['id']));_0x1c5a93[_0x6144('0x5c')](addCmHopperPhones(_0x45d9a1[_0x6144('0x36')]['id']));Promise[_0x6144('0x60')](_0x1c5a93)['then'](function(){return[0x1];})[_0x6144('0x15')](respondWithResult(_0x1fe564,null));});};function addAdditionalPhones(_0x4e259c){var _0x2c92f2;return new Promise(function(_0x4ab443){return db[_0x6144('0x45')][_0x6144('0x16')]({'where':{'CmContactId':_0x4e259c['id']}})[_0x6144('0x15')](function(){db[_0x6144('0x85')]['findAll']({'raw':!![],'attributes':['id',_0x6144('0x86')]})[_0x6144('0x15')](function(_0x1857f8){var _0x390a06=[];for(var _0x1c486a=0x0;_0x1c486a<_0x4e259c[_0x6144('0x87')]['length'];_0x1c486a++){var _0x498aa7=_0x4e259c['item_types']?_[_0x6144('0x53')](_0x4e259c[_0x6144('0x88')][_0x1c486a])?'':_0x4e259c[_0x6144('0x88')][_0x1c486a]:_0x4e259c[_0x6144('0x87')][_0x1c486a][_0x6144('0x89')]?_0x4e259c[_0x6144('0x87')][_0x1c486a]['ItemTypeId']:'';var _0x18279f=_[_0x6144('0x53')](_0x4e259c[_0x6144('0x87')][_0x1c486a][_0x6144('0x8a')])?'':_0x4e259c[_0x6144('0x87')][_0x1c486a][_0x6144('0x8a')];var _0xbddf05=_0x498aa7+':'+_0x4e259c[_0x6144('0x87')][_0x1c486a]['phone']+'§'+_0x18279f;if(_[_0x6144('0x53')](_0x2c92f2))_0x2c92f2=_0xbddf05;else _0x2c92f2+=';'+_0xbddf05;var _0x312906=null;var _0x6a9622=null;if(_0x4e259c['item_types']){if(!_['isNil'](_0x4e259c[_0x6144('0x88')][_0x1c486a])){_0x6a9622=_[_0x6144('0x62')](_0x1857f8,function(_0x1410a1){return _0x1410a1['id']===_0x4e259c[_0x6144('0x88')][_0x1c486a];});if(!_['isNil'](_0x6a9622)){_0x312906=_0x6a9622[_0x6144('0x86')];}}}else{if(!_[_0x6144('0x53')](_0x4e259c[_0x6144('0x87')][_0x1c486a])){_0x6a9622=_[_0x6144('0x62')](_0x1857f8,function(_0x18c183){return _0x18c183['id']===_0x4e259c[_0x6144('0x87')][_0x1c486a][_0x6144('0x89')];});if(!_[_0x6144('0x53')](_0x6a9622)){_0x312906=_0x1c486a;}}}if(_[_0x6144('0x53')](_0x312906)){_0x312906=0x64;}_0x390a06[_0x6144('0x5c')](addAdditionalPhone(_0x4e259c['id'],_0x4e259c[_0x6144('0x87')][_0x1c486a]['phone'],_0x4e259c[_0x6144('0x88')]?_['isNil'](_0x4e259c['item_types'][_0x1c486a])?null:_0x4e259c[_0x6144('0x88')][_0x1c486a]:_0x4e259c[_0x6144('0x87')][_0x1c486a][_0x6144('0x89')]?_0x4e259c[_0x6144('0x87')][_0x1c486a][_0x6144('0x89')]:null,_0x312906,_0x18279f));}Promise[_0x6144('0x60')](_0x390a06)[_0x6144('0x15')](function(){db['CmContact']['update']({'AdditionalPhones':_0x2c92f2},{'where':{'id':_0x4e259c['id']}})[_0x6144('0x15')](function(){_0x4ab443(0x1);});});});});});}function addAdditionalPhone(_0x208f4d,_0x1a99c2,_0x29ccd0,_0x159874,_0x277ef3){return db[_0x6144('0x45')][_0x6144('0x62')]({'where':{'CmContactId':_0x208f4d,'item':_0x1a99c2}})['then'](function(_0x3b2754){if(_0x3b2754)logger[_0x6144('0x2e')]('contact\x20phone\x20exists',_0x3b2754);else{db['CmContactHasItem'][_0x6144('0x39')]({'CmContactId':_0x208f4d,'item':_0x1a99c2,'ItemTypeId':_0x29ccd0,'OrderBy':_0x159874,'ItemClass':_0x6144('0x8b'),'description':_0x277ef3});}});}function deleteCmHopperPhones(_0x354d5d){return new Promise(function(_0x136812){return db[_0x6144('0x8c')][_0x6144('0x1c')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x354d5d}})[_0x6144('0x15')](function(_0x1d8efd){db[_0x6144('0x8d')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x6144('0x6c')](_0x1d8efd,'id')}}});})[_0x6144('0x15')](function(){_0x136812(0x1);});});}function addCmHopperPhones(_0x545f10){return new Promise(function(_0xcb6c9){return db[_0x6144('0x8c')][_0x6144('0x1c')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x545f10}})[_0x6144('0x15')](function(_0xc2e232){var _0x401c25=[];_[_0x6144('0x6c')](_0xc2e232,function(_0x3681eb){_0x401c25[_0x6144('0x5c')](createCmHopperPhone(_0x545f10,_0x3681eb['id']));});Promise[_0x6144('0x60')](_0x401c25)[_0x6144('0x15')](function(){_0xcb6c9(0x1);});});});}function createCmHopperPhone(_0x5e20b7,_0x1d74e4){return new Promise(function(_0x306630){db[_0x6144('0x45')]['findAll']({'raw':!![],'attributes':[_0x6144('0x8e'),_0x6144('0x86')],'where':{'CmContactId':_0x5e20b7,'ItemClass':'PHONE'},'include':[{'model':db['ContactItemType'],'attributes':[_0x6144('0x86')],'as':_0x6144('0x67')}],'order':[_0x6144('0x86'),db[_0x6144('0x68')][_0x6144('0x69')](_0x6144('0x8f'))]})[_0x6144('0x15')](function(_0x5939ed){var _0x2b7e62=0x1;var _0x2feba4=_[_0x6144('0x6c')](_0x5939ed,function(_0x1f5a37){_0x1f5a37[_0x6144('0x90')]=_0x1d74e4;_0x1f5a37[_0x6144('0x75')]=_0x1f5a37['item'];_0x1f5a37[_0x6144('0x86')]=_0x2b7e62;delete _0x1f5a37[_0x6144('0x91')];_0x2b7e62=_0x2b7e62+0x1;return _0x1f5a37;});return db[_0x6144('0x8d')][_0x6144('0x92')](_0x2feba4,{});})[_0x6144('0x15')](function(){_0x306630(0x1);});});}function insertAdditionalPhones(_0x2f48fb,_0x429366){return new Promise(function(_0x21a3b4){var _0x3bdf0c=[];for(var _0x1f97f5=0x0;_0x1f97f5<_0x429366['length'];_0x1f97f5++){var _0x4aa3d2=_0x429366[_0x1f97f5];_0x3bdf0c['push'](parseContactItemType(_0x4aa3d2));}Promise[_0x6144('0x60')](_0x3bdf0c)[_0x6144('0x15')](function(){var _0x4a4cad={'id':_0x2f48fb['id'],'items':_0x429366};return addAdditionalPhones(_0x4a4cad)[_0x6144('0x15')](function(){return addCmHopperPhones(_0x2f48fb['id']);});})[_0x6144('0x15')](function(){_0x21a3b4(_0x2f48fb);});});}function parseContactItemType(_0x33dfe1){return new Promise(function(_0x12a6a5){if(_0x33dfe1[_0x6144('0x93')](_0x6144('0x89'))){_0x12a6a5(_0x33dfe1);}else{return db[_0x6144('0x85')]['find']({'where':{'name':_0x33dfe1['ItemType']}})[_0x6144('0x15')](function(_0x3102bd){if(_[_0x6144('0x53')](_0x3102bd))_0x33dfe1[_0x6144('0x89')]=null;else _0x33dfe1[_0x6144('0x89')]=_0x3102bd['id'];_0x12a6a5(_0x33dfe1);});}});}exports[_0x6144('0x94')]=function(_0x568dc8,_0x4e489a){return db[_0x6144('0x45')][_0x6144('0x1c')]({'raw':!![],'where':{'CmContactId':_0x568dc8[_0x6144('0x21')]['id'],'ItemClass':'PHONE'},'include':[{'model':db[_0x6144('0x85')],'as':'ItemType'}],'order':[['OrderBy'],[db['sequelize']['literal'](_0x6144('0x8f'))]]})['then'](function(_0x5aa069){return _0x5aa069;})[_0x6144('0x15')](respondWithResult(_0x4e489a,null))['catch'](handleError(_0x4e489a,null));};exports[_0x6144('0x95')]=function(_0xb0b879,_0x45216b){return db[_0x6144('0x45')]['findAll']({'raw':!![],'where':{'CmContactId':_0xb0b879['body'][_0x6144('0x96')]}})[_0x6144('0x15')](function(_0x1fd8b4){var _0x5a8bcf=_[_0x6144('0x6c')](_0x1fd8b4,function(_0xb21468){_0xb21468[_0x6144('0x97')]=_0xb0b879[_0x6144('0x36')]['toContactId'];return _0xb21468;});return db[_0x6144('0x45')]['bulkCreate'](_0x5a8bcf,{});})[_0x6144('0x15')](function(){return addCmHopperPhones(_0xb0b879[_0x6144('0x36')][_0x6144('0x98')]);})['then'](function(){return['ok'];})[_0x6144('0x15')](respondWithResult(_0x45216b,null))[_0x6144('0x1f')](handleError(_0x45216b,null));};exports[_0x6144('0x99')]=function(_0x347e3e,_0x1abee3){var _0x497957=[];_0x497957[_0x6144('0x5c')](createCmHopperPhone(_0x347e3e['body']['id'],_0x347e3e[_0x6144('0x36')][_0x6144('0x9a')]));Promise[_0x6144('0x60')](_0x497957)['then'](function(){return[0x1];})[_0x6144('0x15')](respondWithResult(_0x1abee3,null));};exports[_0x6144('0x9b')]=function(_0x1d3c4d,_0x2e5d27){var _0x5833fa={'raw':![],'where':{}};var _0x315e1a={};var _0x27dbca={'count':0x0,'rows':[]};return db[_0x6144('0x20')]['findOne']({'where':{'id':_0x1d3c4d[_0x6144('0x21')]['id']}})[_0x6144('0x15')](handleEntityNotFound(_0x2e5d27,null))[_0x6144('0x15')](function(_0x33c1e9){if(_0x33c1e9){_0x315e1a['model']=_[_0x6144('0x24')](db[_0x6144('0x8c')][_0x6144('0x79')]);_0x315e1a[_0x6144('0x1d')]=_['keys'](_0x1d3c4d[_0x6144('0x1d')]);_0x315e1a[_0x6144('0x7e')]=_[_0x6144('0x7a')](_0x315e1a[_0x6144('0x78')],_0x315e1a[_0x6144('0x1d')]);_0x5833fa[_0x6144('0x7b')]=_[_0x6144('0x7a')](_0x315e1a[_0x6144('0x78')],qs[_0x6144('0x7c')](_0x1d3c4d['query'][_0x6144('0x7c')]));_0x5833fa[_0x6144('0x7b')]=_0x5833fa[_0x6144('0x7b')]['length']?_0x5833fa['attributes']:_0x315e1a[_0x6144('0x78')];if(!_0x1d3c4d[_0x6144('0x1d')]['hasOwnProperty'](_0x6144('0x81'))){_0x5833fa[_0x6144('0x11')]=qs[_0x6144('0x11')](_0x1d3c4d[_0x6144('0x1d')]['limit']);_0x5833fa[_0x6144('0x10')]=qs[_0x6144('0x10')](_0x1d3c4d[_0x6144('0x1d')]['offset']);}_0x5833fa[_0x6144('0x9c')]=qs[_0x6144('0x7d')](_0x1d3c4d[_0x6144('0x1d')][_0x6144('0x7d')]);_0x5833fa[_0x6144('0x5a')]=qs['filters'](_[_0x6144('0x7f')](_0x1d3c4d[_0x6144('0x1d')],_0x315e1a[_0x6144('0x7e')]));_0x5833fa[_0x6144('0x5a')]['ContactId']=_0x33c1e9['id'];if(_0x1d3c4d[_0x6144('0x1d')]['filter']){_0x5833fa[_0x6144('0x5a')]=_[_0x6144('0x30')](_0x5833fa[_0x6144('0x5a')],{'$or':_[_0x6144('0x6c')](_0x5833fa[_0x6144('0x7b')],function(_0x563e54){var _0x30c573={};_0x30c573[_0x563e54]={'$like':'%'+_0x1d3c4d[_0x6144('0x1d')][_0x6144('0x80')]+'%'};return _0x30c573;})});}_0x5833fa=_[_0x6144('0x30')]({},_0x5833fa,_0x1d3c4d[_0x6144('0x9d')]);return db[_0x6144('0x8c')]['count']({'where':_0x5833fa[_0x6144('0x5a')]})[_0x6144('0x15')](function(_0x8777a7){_0x27dbca['count']=_0x8777a7;if(_0x1d3c4d[_0x6144('0x1d')][_0x6144('0x9e')]){_0x5833fa[_0x6144('0x9f')]=[{'all':!![]}];}return db[_0x6144('0x8c')]['findAll'](_0x5833fa);})[_0x6144('0x15')](function(_0x31ecc4){_0x27dbca[_0x6144('0xa0')]=_0x31ecc4;return _0x27dbca;});}})['then'](respondWithFilteredResult(_0x2e5d27,_0x5833fa))[_0x6144('0x1f')](handleError(_0x2e5d27,null));};exports[_0x6144('0xa1')]=function(_0x4b5f81,_0x5b9177){var _0x36777a={'raw':!![],'where':{}};var _0x43d0d6={};var _0x50baeb={'count':0x0,'rows':[]};return db[_0x6144('0x20')][_0x6144('0x77')]({'where':{'id':_0x4b5f81[_0x6144('0x21')]['id']}})[_0x6144('0x15')](handleEntityNotFound(_0x5b9177,null))[_0x6144('0x15')](function(_0x46a1bc){if(_0x46a1bc){_0x43d0d6[_0x6144('0x78')]=_[_0x6144('0x24')](db[_0x6144('0x47')]['rawAttributes']);_0x43d0d6[_0x6144('0x1d')]=_[_0x6144('0x24')](_0x4b5f81[_0x6144('0x1d')]);_0x43d0d6['filters']=_[_0x6144('0x7a')](_0x43d0d6[_0x6144('0x78')],_0x43d0d6['query']);_0x36777a[_0x6144('0x7b')]=_[_0x6144('0x7a')](_0x43d0d6[_0x6144('0x78')],qs[_0x6144('0x7c')](_0x4b5f81['query']['fields']));_0x36777a[_0x6144('0x7b')]=_0x36777a[_0x6144('0x7b')]['length']?_0x36777a[_0x6144('0x7b')]:_0x43d0d6[_0x6144('0x78')];if(!_0x4b5f81['query'][_0x6144('0x93')](_0x6144('0x81'))){_0x36777a[_0x6144('0x11')]=qs[_0x6144('0x11')](_0x4b5f81[_0x6144('0x1d')][_0x6144('0x11')]);_0x36777a[_0x6144('0x10')]=qs[_0x6144('0x10')](_0x4b5f81[_0x6144('0x1d')]['offset']);}_0x36777a[_0x6144('0x9c')]=qs[_0x6144('0x7d')](_0x4b5f81[_0x6144('0x1d')]['sort']);_0x36777a[_0x6144('0x5a')]=qs[_0x6144('0x7e')](_[_0x6144('0x7f')](_0x4b5f81[_0x6144('0x1d')],_0x43d0d6[_0x6144('0x7e')]));_0x36777a[_0x6144('0x5a')]['ContactId']=_0x46a1bc['id'];if(_0x4b5f81['query'][_0x6144('0x80')]){_0x36777a[_0x6144('0x5a')]=_[_0x6144('0x30')](_0x36777a[_0x6144('0x5a')],{'$or':_[_0x6144('0x6c')](_0x36777a[_0x6144('0x7b')],function(_0x237aa1){var _0x303174={};_0x303174[_0x237aa1]={'$like':'%'+_0x4b5f81[_0x6144('0x1d')]['filter']+'%'};return _0x303174;})});}_0x36777a=_[_0x6144('0x30')]({},_0x36777a,_0x4b5f81[_0x6144('0x9d')]);return db[_0x6144('0x47')][_0x6144('0xf')]({'where':_0x36777a['where']})[_0x6144('0x15')](function(_0x5ecac7){_0x50baeb[_0x6144('0xf')]=_0x5ecac7;if(_0x4b5f81[_0x6144('0x1d')]['includeAll']){_0x36777a[_0x6144('0x9f')]=[{'all':!![]}];}return db[_0x6144('0x47')]['findAll'](_0x36777a);})['then'](function(_0x2b3e4d){_0x50baeb[_0x6144('0xa0')]=_0x2b3e4d;return _0x50baeb;});}})[_0x6144('0x15')](respondWithFilteredResult(_0x5b9177,_0x36777a))[_0x6144('0x1f')](handleError(_0x5b9177,null));};exports[_0x6144('0xa2')]=function(_0x33086d,_0x1cbabb){var _0x3495ca={'raw':!![],'where':{}};var _0x152142={};var _0x34f909={'count':0x0,'rows':[]};return db[_0x6144('0x20')][_0x6144('0x77')]({'where':{'id':_0x33086d[_0x6144('0x21')]['id']}})[_0x6144('0x15')](handleEntityNotFound(_0x1cbabb,null))['then'](function(_0x2ca088){if(_0x2ca088){_0x152142[_0x6144('0x78')]=_['keys'](db['CmHopperFinal'][_0x6144('0x79')]);_0x152142[_0x6144('0x1d')]=_[_0x6144('0x24')](_0x33086d[_0x6144('0x1d')]);_0x152142[_0x6144('0x7e')]=_[_0x6144('0x7a')](_0x152142[_0x6144('0x78')],_0x152142[_0x6144('0x1d')]);_0x3495ca[_0x6144('0x7b')]=_[_0x6144('0x7a')](_0x152142[_0x6144('0x78')],qs[_0x6144('0x7c')](_0x33086d['query'][_0x6144('0x7c')]));_0x3495ca['attributes']=_0x3495ca['attributes'][_0x6144('0x29')]?_0x3495ca[_0x6144('0x7b')]:_0x152142[_0x6144('0x78')];if(!_0x33086d['query'][_0x6144('0x93')](_0x6144('0x81'))){_0x3495ca[_0x6144('0x11')]=qs[_0x6144('0x11')](_0x33086d['query'][_0x6144('0x11')]);_0x3495ca[_0x6144('0x10')]=qs[_0x6144('0x10')](_0x33086d['query'][_0x6144('0x10')]);}_0x3495ca[_0x6144('0x9c')]=qs[_0x6144('0x7d')](_0x33086d[_0x6144('0x1d')][_0x6144('0x7d')]);_0x3495ca[_0x6144('0x5a')]=qs[_0x6144('0x7e')](_[_0x6144('0x7f')](_0x33086d[_0x6144('0x1d')],_0x152142[_0x6144('0x7e')]));_0x3495ca[_0x6144('0x5a')][_0x6144('0xa3')]=_0x2ca088['id'];if(_0x33086d[_0x6144('0x1d')][_0x6144('0x80')]){_0x3495ca[_0x6144('0x5a')]=_[_0x6144('0x30')](_0x3495ca[_0x6144('0x5a')],{'$or':_[_0x6144('0x6c')](_0x3495ca[_0x6144('0x7b')],function(_0x214bcd){var _0x266fb7={};_0x266fb7[_0x214bcd]={'$like':'%'+_0x33086d[_0x6144('0x1d')][_0x6144('0x80')]+'%'};return _0x266fb7;})});}_0x3495ca=_[_0x6144('0x30')]({},_0x3495ca,_0x33086d[_0x6144('0x9d')]);return db['CmHopperFinal'][_0x6144('0xf')]({'where':_0x3495ca[_0x6144('0x5a')]})[_0x6144('0x15')](function(_0x188fe6){_0x34f909['count']=_0x188fe6;if(_0x33086d[_0x6144('0x1d')][_0x6144('0x9e')]){_0x3495ca['include']=[{'all':!![]}];}return db[_0x6144('0x46')]['findAll'](_0x3495ca);})[_0x6144('0x15')](function(_0x4f8ca8){_0x34f909[_0x6144('0xa0')]=_0x4f8ca8;return _0x34f909;});}})[_0x6144('0x15')](respondWithFilteredResult(_0x1cbabb,_0x3495ca))['catch'](handleError(_0x1cbabb,null));};exports[_0x6144('0xa4')]=function(_0x267166,_0x241c9f){var _0xc7b10a={'raw':!![],'where':{}};var _0xa877bb={};var _0x118b7e={'count':0x0,'rows':[]};return db['CmContact'][_0x6144('0x77')]({'where':{'id':_0x267166[_0x6144('0x21')]['id']}})[_0x6144('0x15')](handleEntityNotFound(_0x241c9f,null))[_0x6144('0x15')](function(_0x5618d3){if(_0x5618d3){_0xa877bb[_0x6144('0x78')]=_[_0x6144('0x24')](db[_0x6144('0x4f')][_0x6144('0x79')]);_0xa877bb[_0x6144('0x1d')]=_[_0x6144('0x24')](_0x267166[_0x6144('0x1d')]);_0xa877bb[_0x6144('0x7e')]=_[_0x6144('0x7a')](_0xa877bb[_0x6144('0x78')],_0xa877bb[_0x6144('0x1d')]);_0xc7b10a[_0x6144('0x7b')]=_['intersection'](_0xa877bb['model'],qs[_0x6144('0x7c')](_0x267166[_0x6144('0x1d')][_0x6144('0x7c')]));_0xc7b10a[_0x6144('0x7b')]=_0xc7b10a['attributes']['length']?_0xc7b10a['attributes']:_0xa877bb['model'];if(!_0x267166[_0x6144('0x1d')][_0x6144('0x93')]('nolimit')){_0xc7b10a['limit']=qs['limit'](_0x267166['query']['limit']);_0xc7b10a[_0x6144('0x10')]=qs[_0x6144('0x10')](_0x267166[_0x6144('0x1d')][_0x6144('0x10')]);}_0xc7b10a[_0x6144('0x9c')]=qs[_0x6144('0x7d')](_0x267166[_0x6144('0x1d')]['sort']);_0xc7b10a['where']=qs['filters'](_[_0x6144('0x7f')](_0x267166['query'],_0xa877bb[_0x6144('0x7e')]));_0xc7b10a['where'][_0x6144('0xa3')]=_0x5618d3['id'];if(_0x267166['query'][_0x6144('0x80')]){_0xc7b10a[_0x6144('0x5a')]=_[_0x6144('0x30')](_0xc7b10a[_0x6144('0x5a')],{'$or':_[_0x6144('0x6c')](_0xc7b10a['attributes'],function(_0x73b5d5){var _0x615b7a={};_0x615b7a[_0x73b5d5]={'$like':'%'+_0x267166[_0x6144('0x1d')][_0x6144('0x80')]+'%'};return _0x615b7a;})});}_0xc7b10a=_[_0x6144('0x30')]({},_0xc7b10a,_0x267166[_0x6144('0x9d')]);return db['JscriptySessionReport'][_0x6144('0xf')]({'where':_0xc7b10a[_0x6144('0x5a')]})[_0x6144('0x15')](function(_0x384ca1){_0x118b7e[_0x6144('0xf')]=_0x384ca1;if(_0x267166[_0x6144('0x1d')][_0x6144('0x9e')]){_0xc7b10a['include']=[{'all':!![]}];}return db[_0x6144('0x4f')]['findAll'](_0xc7b10a);})[_0x6144('0x15')](function(_0xceda29){_0x118b7e[_0x6144('0xa0')]=_0xceda29;return _0x118b7e;});}})[_0x6144('0x15')](respondWithFilteredResult(_0x241c9f,_0xc7b10a))['catch'](handleError(_0x241c9f,null));};exports['uploadCsv']=function(_0x953e23,_0x3eeaf8){try{if(!_0x953e23[_0x6144('0x36')][_0x6144('0x5d')]){throw new Error(_0x6144('0xa5'));}if(!_0x953e23[_0x6144('0x36')][_0x6144('0xa6')]){throw new Error(_0x6144('0xa7'));}if(!_0x953e23['body'][_0x6144('0xa8')]){throw new Error('No\x20association\x20values\x20specified!');}if(!_0x953e23[_0x6144('0x36')]['socket_timestamp']){throw new Error(_0x6144('0xa9'));}var _0x264e1a=_0x953e23[_0x6144('0x36')]['binding_keys']['split'](',');var _0x29dbd0=_0x953e23['body'][_0x6144('0xa8')][_0x6144('0xaa')](',');if(!_0x264e1a[_0x6144('0x29')]||!_0x29dbd0[_0x6144('0x29')]||_0x264e1a[_0x6144('0x29')]!==_0x29dbd0['length']){throw new Error('Incorrect\x20binding\x20parameters\x20passed!');}_0x953e23[_0x6144('0x36')][_0x6144('0x7c')]=_[_0x6144('0xab')](_0x264e1a,_0x29dbd0);if(!_0x953e23[_0x6144('0x36')][_0x6144('0x7c')][_0x6144('0x75')]){throw new Error(_0x6144('0xac'));}if(!_0x953e23[_0x6144('0x36')][_0x6144('0x7c')][_0x6144('0xad')]){throw new Error('No\x20firstName\x20column\x20specified');}var _0x1138f1=path[_0x6144('0x52')](config[_0x6144('0xae')],_0x6144('0xaf'),_0x953e23['file'][_0x6144('0xb0')]);fs[_0x6144('0xb1')](_0x1138f1,parseInt('0777',0x8));var _0x5a26c2=require(_0x6144('0xb2'))[_0x6144('0xb3')](path[_0x6144('0x52')](__dirname,'../../components/import/cm/csv'),[_0x1138f1,_0x953e23['body'][_0x6144('0xa6')],_0x953e23[_0x6144('0x36')][_0x6144('0xa8')],_0x953e23[_0x6144('0x36')]['ListId'],_0x953e23[_0x6144('0x36')][_0x6144('0xb4')],_0x953e23[_0x6144('0x36')][_0x6144('0x59')],_0x953e23[_0x6144('0x36')][_0x6144('0xb5')]]);return _0x3eeaf8[_0x6144('0x12')](0xc8)[_0x6144('0xe')]({'message':_0x6144('0xb6'),'pid':_0x5a26c2[_0x6144('0xb7')]});}catch(_0x59eb68){return _0x3eeaf8[_0x6144('0x12')](0x1f4)[_0x6144('0x1a')](_0x59eb68);}};exports[_0x6144('0xb8')]=function(_0x2cb68a,_0x5eba8b){var _0x3bcc40=fs[_0x6144('0xb9')](_0x2cb68a[_0x6144('0xba')][_0x6144('0xbb')]);Papa[_0x6144('0xbc')](_0x3bcc40,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0xeeb380){return _0x5eba8b[_0x6144('0x12')](0xc8)['json']({'file':_0x2cb68a[_0x6144('0xba')],'fields':_0xeeb380['meta'][_0x6144('0x7c')]});}});};exports['import']=function(_0x19315b,_0x166242){return db[_0x6144('0xbd')][_0x6144('0x1c')]({'raw':!![],'attributes':['id'],'where':{'role':_0x6144('0xbe')}})['then'](function(_0xea5d0f){var _0x2fbf67=![];if(!_0x19315b[_0x6144('0x36')]['ListId']){throw new Error('No\x20ListId\x20specified');}if(!_0x19315b[_0x6144('0x36')][_0x6144('0xbf')][_0x6144('0x75')]){throw new Error(_0x6144('0xac'));}if(!_0x19315b[_0x6144('0x36')][_0x6144('0xbf')][_0x6144('0xad')]){throw new Error(_0x6144('0xc0'));}if(!_0x19315b[_0x6144('0x36')]['socket_timestamp']){throw new Error(_0x6144('0xa9'));}var _0x4161ec=require(_0x6144('0xb2'))[_0x6144('0xb3')](path[_0x6144('0x52')](__dirname,'../../components/import/cm/csv2'),[_0x19315b[_0x6144('0x21')]['id'],JSON['stringify'](_0x19315b['body']),JSON['stringify'](_0xea5d0f)]);_0x4161ec['on'](_0x6144('0xc1'),function(){_0x2fbf67=!![];return _0x166242[_0x6144('0x12')](0xc8)[_0x6144('0xe')]({'message':_0x6144('0xc2'),'pid':_0x4161ec['pid']});});_0x4161ec['on'](_0x6144('0xc3'),function(_0x4893ba){if(_0x4893ba&&!_0x2fbf67){return _0x166242['status'](0x1f4)['json']({'message':'error\x20child\x20process','pid':_0x4161ec[_0x6144('0xb7')]});}});})[_0x6144('0x1f')](handleError(_0x166242,null));};exports[_0x6144('0xc4')]=function(_0x16e4f4,_0x173dc1){return db[_0x6144('0xbd')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x6144('0xbe')}})[_0x6144('0x15')](function(_0x906f23){var _0x42890a=![];if(!_0x16e4f4[_0x6144('0x36')][_0x6144('0x5d')]){throw new Error(_0x6144('0xa5'));}if(!_0x16e4f4[_0x6144('0x36')][_0x6144('0xbf')]['phone']){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x16e4f4[_0x6144('0x36')][_0x6144('0xbf')][_0x6144('0xad')]){throw new Error(_0x6144('0xc0'));}if(!_0x16e4f4[_0x6144('0x36')]['socket_timestamp']){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x19e114=require('child_process')[_0x6144('0xb3')](path[_0x6144('0x52')](__dirname,'../../components/import/cm/csvUpdates'),[_0x16e4f4['params']['id'],JSON[_0x6144('0xc5')](_0x16e4f4[_0x6144('0x36')]),JSON['stringify'](_0x906f23)]);_0x19e114['on'](_0x6144('0xc1'),function(){_0x42890a=!![];return _0x173dc1['status'](0xc8)[_0x6144('0xe')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x19e114[_0x6144('0xb7')]});});_0x19e114['on'](_0x6144('0xc3'),function(_0x410a0a){if(_0x410a0a&&!_0x42890a){return _0x173dc1[_0x6144('0x12')](0x1f4)[_0x6144('0xe')]({'message':_0x6144('0xc6'),'pid':_0x19e114[_0x6144('0xb7')]});}});})[_0x6144('0x1f')](handleError(_0x173dc1,null));};exports[_0x6144('0xc7')]=function(_0x5475dc,_0x424e26){var _0x1b4198=[_0x6144('0xc8'),_0x6144('0xc9'),_0x6144('0xca'),_0x6144('0xcb'),'fax',_0x6144('0xcc'),'voice'];var _0xcdec93={'offset':0x0,'order':qs[_0x6144('0x7d')]('-createdAt')},_0x3e8b72={'count':0x0,'rows':[]};Promise['resolve']()[_0x6144('0x15')](function(){if(_0x5475dc[_0x6144('0x1d')][_0x6144('0xcd')]){if(!_['includes'](_0x1b4198,_0x5475dc[_0x6144('0x1d')][_0x6144('0xcd')][_0x6144('0xce')]())){throw new Error('Invalid\x20channel');}_0x1b4198=[_0x5475dc[_0x6144('0x1d')][_0x6144('0xcd')][_0x6144('0xce')]()];}if(_0x5475dc[_0x6144('0x1d')][_0x6144('0xcf')]){try{var _0x33a2a0=JSON[_0x6144('0xbc')](_0x5475dc['query']['range']);if(!moment(_0x33a2a0[_0x6144('0x31')])[_0x6144('0xd0')]()){throw new Error(_0x6144('0xd1'));}if(!moment(_0x33a2a0['to'])[_0x6144('0xd0')]()){throw new Error(_0x6144('0xd2'));}}catch(_0xe6125c){throw new Error(_0x6144('0xd3'));}}if(!_0x5475dc['query']['hasOwnProperty'](_0x6144('0x81'))){_0xcdec93['limit']=qs['limit'](_0x5475dc['query'][_0x6144('0x11')]||0xa);_0xcdec93[_0x6144('0x10')]=qs[_0x6144('0x10')](_0x5475dc[_0x6144('0x1d')][_0x6144('0x10')]);}var _0x56aa7f=_0x1b4198[_0x6144('0x6c')](function(_0x165e8b){if(_0x165e8b===_0x6144('0xd4')){var _0x1540b6={'attributes':['id',_0x6144('0xd5'),'type','source',_0x6144('0xd6'),'callerid',_0x6144('0xd7'),'endtime',_0x6144('0xd8'),_0x6144('0xd9'),'createdAt',_0x6144('0xda'),'userSecondDisposition',_0x6144('0xdb'),_0x6144('0xdc')],'where':{'ContactId':_0x5475dc[_0x6144('0x21')]['id']},'include':[{'model':db['User'],'as':_0x6144('0xbd'),'attributes':['id','name',_0x6144('0xdd'),'alias']}],'order':[['createdAt',_0x6144('0xde')]]};if(_0x5475dc[_0x6144('0x1d')][_0x6144('0xcf')]){_0x1540b6[_0x6144('0x5a')][_0x6144('0xdf')]={'$gte':_0x33a2a0[_0x6144('0x31')],'$lte':_0x33a2a0['to']};}return db[_0x6144('0x49')]['findAndCountAll'](_0x1540b6)[_0x6144('0x15')](function(_0x29ed38){_0x3e8b72['count']+=_0x29ed38['count'];return _['map'](_0x29ed38[_0x6144('0xa0')],function(_0x3c92e8){var _0x49c15a=_0x3c92e8[_0x6144('0x32')]({'plain':!![]});_0x49c15a['channel']=_0x165e8b;if(_0x49c15a[_0x6144('0xbd')]){_0x49c15a['User']={'id':_0x49c15a['User']['id'],'name':_0x49c15a[_0x6144('0xbd')][_0x6144('0xe0')],'fullname':_0x49c15a['User']['fullname'],'alias':_0x49c15a[_0x6144('0xbd')][_0x6144('0xe1')]};}return _0x49c15a;});});}else{var _0x212fcf=_[_0x6144('0xe2')](_0x165e8b)+(_0x165e8b===_0x6144('0xc9')?'Website':_0x6144('0xe3'));var _0x517fd7={'attributes':['id',_0x6144('0xe4'),'closedAt','createdAt',_0x6144('0xd9'),_0x6144('0xe5'),_0x6144('0xe6'),'thirdDisposition',_0x6144('0xdc'),_0x212fcf+'Id'],'where':{'ContactId':_0x5475dc['params']['id']},'include':[{'model':db[_0x212fcf],'as':_0x6144('0xe3'),'attributes':['id',_0x6144('0xe0'),_0x6144('0xe7')]},{'model':db[_0x6144('0xbd')],'as':_0x6144('0xe8'),'attributes':['id','name','fullname']},{'model':db[_0x6144('0x63')],'as':_0x6144('0x64'),'attributes':['id','name','color'],'through':{'attributes':[]}}],'order':[['createdAt','DESC']]};if(_0x5475dc[_0x6144('0x1d')]['range']){_0x517fd7[_0x6144('0x5a')][_0x6144('0xdf')]={'$gte':_0x33a2a0[_0x6144('0x31')],'$lte':_0x33a2a0['to']};}switch(_0x165e8b){case'chat':_0x517fd7[_0x6144('0x7b')]['push']('browserName',_0x6144('0xe9'),_0x6144('0xea'),_0x6144('0xeb'),_0x6144('0xec'),'ratingMessage',_0x6144('0xed'),_0x6144('0xee'),'referer');break;case _0x6144('0xc8'):_0x517fd7['attributes'][_0x6144('0x5c')]('subject',_0x6144('0xef'));break;case _0x6144('0xcb'):_0x517fd7[_0x6144('0x7b')][_0x6144('0x5c')](_0x6144('0xf0'),_0x6144('0xf1'));break;}return db[_[_0x6144('0xe2')](_0x165e8b)+_0x6144('0xf2')][_0x6144('0xf3')](_0x517fd7)[_0x6144('0x15')](function(_0x103cb4){_0x3e8b72[_0x6144('0xf')]+=_0x103cb4[_0x6144('0xf')];return _['map'](_0x103cb4['rows'],function(_0x19fe82){var _0x3aa5fe=_0x19fe82['get']({'plain':!![]});_0x3aa5fe[_0x6144('0xcd')]=_0x165e8b;if(_0x3aa5fe[_0x6144('0xe8')]){_0x3aa5fe[_0x6144('0xe8')]={'id':_0x3aa5fe[_0x6144('0xe8')]['id'],'name':_0x3aa5fe['Owner'][_0x6144('0xe0')],'fullname':_0x3aa5fe['Owner'][_0x6144('0xdd')]};}return _0x3aa5fe;});});}});return Promise[_0x6144('0x60')](_0x56aa7f);})['then'](function(_0x33892f){return _(_0x33892f)[_0x6144('0xf4')]()[_0x6144('0xf5')](_0x6144('0xdf'))[_0x6144('0xf6')]()['value']();})['then'](function(_0x148de5){_0x3e8b72[_0x6144('0xa0')]=_0xcdec93['limit']?_0x148de5['slice'](_0xcdec93['offset'],_0xcdec93[_0x6144('0x10')]+_0xcdec93[_0x6144('0x11')]):_0x148de5;return _0x3e8b72;})[_0x6144('0x15')](respondWithFilteredResult(_0x424e26,_0xcdec93))[_0x6144('0x1f')](handleError(_0x424e26,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 1c484b3..037bdf6 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 _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 +var _0x9ec9=['emit','hook','../../mysqldb','CmContact','setMaxListeners','update','remove'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x9ec9,0x1ad));var _0x99ec=function(_0x29a29f,_0x155ce7){_0x29a29f=_0x29a29f-0x0;var _0x443ea3=_0x9ec9[_0x29a29f];return _0x443ea3;};'use strict';var EventEmitter=require('events');var CmContact=require(_0x99ec('0x0'))['db'][_0x99ec('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x99ec('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x99ec('0x3'),'afterDestroy':_0x99ec('0x4')};function emitEvent(_0x1a45af){return function(_0x21032e,_0x55a24f,_0x29176f){CmContactEvents[_0x99ec('0x5')](_0x1a45af+':'+_0x21032e['id'],_0x21032e);CmContactEvents[_0x99ec('0x5')](_0x1a45af,_0x21032e);_0x29176f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact[_0x99ec('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 6f3ac70..c9e3f34 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 _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 +var _0x79f2=['CmHopperBlack','cmContact,\x20%s,\x20%s','message','Campaign','List\x20not\x20found','models','isEmpty','destroy','ContactId','VoiceQueueId','CampaignId','push','all','info','[CmContact][afterDestroy][Error]','util','../../config/logger','api','path','rimraf','exports','CmContact','phone','fti_cm_contacts','firstName','lastName','email','utf8mb4','utf8mb4_unicode_ci','get','error','cmContact','afterCreate','inspect','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','VoiceQueue','then','timezones','utcOffset','scheduledat','add','minutes','ret','CmHopper','findOne','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','ListId','priority','callbackUniqueid','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','create','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','CmHopperFinal','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','outbound','dialCheckDuplicateType','CmList','Lists','length','always','onlyIfOpen','BlackLists'];(function(_0x1b7170,_0x5981b8){var _0x4c60cf=function(_0x18c1f0){while(--_0x18c1f0){_0x1b7170['push'](_0x1b7170['shift']());}};_0x4c60cf(++_0x5981b8);}(_0x79f2,0x9b));var _0x279f=function(_0x5459d9,_0x2b0281){_0x5459d9=_0x5459d9-0x0;var _0x1b001e=_0x79f2[_0x5459d9];return _0x1b001e;};'use strict';var _=require('lodash');var util=require(_0x279f('0x0'));var logger=require(_0x279f('0x1'))(_0x279f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x279f('0x3'));var rimraf=require(_0x279f('0x4'));var config=require('../../config/environment');var shared=require('../../config/environment/shared');var attributes=require('./cmContact.attributes');module[_0x279f('0x5')]=function(_0x4d8dab,_0x5d96b1){return _0x4d8dab['define'](_0x279f('0x6'),attributes,{'tableName':'cm_contacts','paranoid':!![],'indexes':[{'name':'phone','fields':[_0x279f('0x7')]},{'name':_0x279f('0x8'),'fields':[_0x279f('0x9'),_0x279f('0xa'),_0x279f('0x7'),'mobile','fax',_0x279f('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'charset':_0x279f('0xc'),'collate':_0x279f('0xd'),'hooks':{'afterCreate':function(_0x567a20,_0x56c0a8,_0x22f45c){var _0x56e65c=_0x4d8dab['models'];var _0x2cd629=_0x567a20[_0x279f('0xe')]({'plain':!![]});function _0x101055(){return function(_0xf2b780){logger[_0x279f('0xf')](_0x279f('0x10'),_0x279f('0x11'),util[_0x279f('0x12')](_0xf2b780,{'showHidden':![],'depth':null}));};}function _0x548248(_0x5ec3cd,_0x4153e5){var _0x25e4a2=_0x4153e5['scheduledat']?_0x4153e5['scheduledat']:moment()[_0x279f('0x13')](_0x279f('0x14'));return new BPromise(function(_0x363610,_0x20a73f){if(_[_0x279f('0x15')](_0x4153e5[_0x279f('0x16')])){_0x363610({'ret':_0x25e4a2});}else{_0x56e65c[_0x279f('0x17')]['findOne']({'where':{'id':_0x5ec3cd['id']}})[_0x279f('0x18')](function(_0x18044c){if(!_[_0x279f('0x15')](_0x18044c)){var _0x47eb4f=_0x18044c[_0x279f('0x16')];if(!_[_0x279f('0x15')](_0x47eb4f)){var _0x23bc4f=shared[_0x279f('0x19')];var _0x4fc27c=_0x23bc4f[_0x47eb4f];var _0x394c33=_0x23bc4f[_0x4153e5['dialTimezone']];if(!_[_0x279f('0x15')](_0x4fc27c)&&!_['isNil'](_0x394c33)){var _0x2da09d=_0x4fc27c[_0x279f('0x1a')]-_0x394c33['utcOffset'];_0x25e4a2=_0x4153e5['scheduledat']?_0x4153e5[_0x279f('0x1b')]:moment();var _0x5561d3=moment(_0x25e4a2)[_0x279f('0x1c')](_0x2da09d,_0x279f('0x1d'));_0x363610({'ret':_0x5561d3[_0x279f('0x13')](_0x279f('0x14'))});}else _0x363610({'ret':_0x25e4a2});}else _0x363610({'ret':_0x25e4a2});}else{_0x363610({'ret':_0x25e4a2});}});}});return 0xa;}var _0x82be5e=function(_0x359215){return new BPromise(function(_0x448608,_0x59c2f2){_0x548248(_0x359215,_0x2cd629)['then'](function(_0x3dd41e){_0x2cd629[_0x279f('0x1b')]=_0x3dd41e[_0x279f('0x1e')];_0x56e65c[_0x279f('0x1f')][_0x279f('0x20')]({'where':{'phone':_0x2cd629[_0x279f('0x7')],'VoiceQueueId':_0x359215['id']}})[_0x279f('0x18')](function(_0x2a3d56){if(!_[_0x279f('0x15')](_0x2a3d56)){throw new Error(_0x279f('0x21')+_0x2cd629[_0x279f('0x7')]+_0x279f('0x22')+_0x359215['id']);}return _0x56e65c[_0x279f('0x1f')]['create']({'phone':_0x2cd629['phone'],'ContactId':_0x2cd629['id'],'ListId':_0x2cd629[_0x279f('0x23')],'priority':_0x2cd629[_0x279f('0x24')]?_0x2cd629[_0x279f('0x24')]:0x2,'scheduledat':_0x2cd629['scheduledat']?_0x2cd629[_0x279f('0x1b')]:moment()[_0x279f('0x13')](_0x279f('0x14')),'callback':_0x2cd629['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x2cd629[_0x279f('0x25')]?_0x2cd629[_0x279f('0x25')]:undefined,'callbackat':_0x2cd629[_0x279f('0x25')]?moment()[_0x279f('0x13')](_0x279f('0x14')):undefined,'VoiceQueueId':_0x359215['id']});})[_0x279f('0x26')](function(_0x3b826f){_0x59c2f2(_0x3b826f);});});});};var _0x258bda=function(_0x588f43){return new BPromise(function(_0x59887b,_0x1b3b5c){_0x548248(_0x588f43,_0x2cd629)[_0x279f('0x18')](function(_0x50db92){_0x2cd629[_0x279f('0x1b')]=_0x50db92[_0x279f('0x1e')];_0x56e65c['CmHopper'][_0x279f('0x20')]({'where':{'phone':_0x2cd629[_0x279f('0x7')],'VoiceQueueId':_0x588f43['id']}})[_0x279f('0x18')](function(_0xffe550){if(!_['isNil'](_0xffe550)){throw new Error(_0x279f('0x21')+_0x2cd629[_0x279f('0x7')]+_0x279f('0x27')+_0x588f43['id']);}return _0x56e65c['CmHopperFinal'][_0x279f('0x20')]({'where':{'calleridnum':_0x2cd629[_0x279f('0x7')],'VoiceQueueId':_0x588f43['id']}});})[_0x279f('0x18')](function(_0x3a0d4b){if(!_[_0x279f('0x15')](_0x3a0d4b)){throw new Error(_0x279f('0x28')+_0x2cd629[_0x279f('0x7')]+_0x279f('0x29')+_0x588f43['id']);}return _0x56e65c[_0x279f('0x1f')][_0x279f('0x2a')]({'phone':_0x2cd629[_0x279f('0x7')],'ContactId':_0x2cd629['id'],'ListId':_0x2cd629[_0x279f('0x23')],'priority':_0x2cd629[_0x279f('0x24')]?_0x2cd629[_0x279f('0x24')]:0x2,'scheduledat':_0x2cd629['scheduledat']?_0x2cd629['scheduledat']:moment()[_0x279f('0x13')](_0x279f('0x14')),'callback':_0x2cd629[_0x279f('0x25')]?!![]:![],'callbackuniqueid':_0x2cd629['callbackUniqueid']?_0x2cd629[_0x279f('0x25')]:undefined,'callbackat':_0x2cd629[_0x279f('0x25')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x588f43['id']});})['catch'](function(_0xb2681){_0x1b3b5c(_0xb2681);});});});};function _0x29dd82(){return function(_0x3222a2){logger[_0x279f('0xf')](_0x279f('0x10'),_0x279f('0x11'),util[_0x279f('0x12')](_0x3222a2,{'showHidden':![],'depth':null}));};}function _0x1d9f8b(_0xa4ae42,_0x520c58){var _0x5d023b=_0x520c58['scheduledat']?_0x520c58['scheduledat']:moment()[_0x279f('0x13')](_0x279f('0x14'));return new BPromise(function(_0x58da4d,_0x5cb08a){if(_[_0x279f('0x15')](_0x520c58[_0x279f('0x16')])){_0x58da4d({'ret':_0x5d023b});}else{_0x56e65c['Campaign'][_0x279f('0x20')]({'where':{'id':_0xa4ae42['id']}})[_0x279f('0x18')](function(_0x5493f8){if(!_[_0x279f('0x15')](_0x5493f8)){var _0x204f1a=_0x5493f8[_0x279f('0x16')];if(!_[_0x279f('0x15')](_0x204f1a)){var _0x329e7d=shared[_0x279f('0x19')];var _0x10fd7a=_0x329e7d[_0x204f1a];var _0x15e5ae=_0x329e7d[_0x520c58[_0x279f('0x16')]];if(!_[_0x279f('0x15')](_0x10fd7a)&&!_[_0x279f('0x15')](_0x15e5ae)){var _0x5d4d72=_0x10fd7a['utcOffset']-_0x15e5ae[_0x279f('0x1a')];_0x5d023b=_0x520c58[_0x279f('0x1b')]?_0x520c58[_0x279f('0x1b')]:moment();var _0x49b5a7=moment(_0x5d023b)['add'](_0x5d4d72,_0x279f('0x1d'));_0x58da4d({'ret':_0x49b5a7[_0x279f('0x13')](_0x279f('0x14'))});}else _0x58da4d({'ret':_0x5d023b});}else _0x58da4d({'ret':_0x5d023b});}else{_0x58da4d({'ret':_0x5d023b});}});}});return 0xa;}var _0x1ee7be=function(_0xcc6e4a){return new BPromise(function(_0x2000f6,_0x21d106){_0x1d9f8b(_0xcc6e4a,_0x2cd629)[_0x279f('0x18')](function(_0x59caeb){_0x2cd629[_0x279f('0x1b')]=_0x59caeb[_0x279f('0x1e')];_0x56e65c['CmHopper'][_0x279f('0x20')]({'where':{'phone':_0x2cd629['phone'],'CampaignId':_0xcc6e4a['id']}})[_0x279f('0x18')](function(_0x293c47){if(!_['isNil'](_0x293c47)){throw new Error(_0x279f('0x21')+_0x2cd629[_0x279f('0x7')]+_0x279f('0x2b')+_0xcc6e4a['id']);}return _0x56e65c[_0x279f('0x1f')][_0x279f('0x2a')]({'phone':_0x2cd629[_0x279f('0x7')],'ContactId':_0x2cd629['id'],'ListId':_0x2cd629[_0x279f('0x23')],'priority':_0x2cd629['priority']?_0x2cd629[_0x279f('0x24')]:0x2,'scheduledat':_0x2cd629['scheduledat']?_0x2cd629[_0x279f('0x1b')]:moment()[_0x279f('0x13')](_0x279f('0x14')),'callback':_0x2cd629[_0x279f('0x25')]?!![]:![],'callbackuniqueid':_0x2cd629[_0x279f('0x25')]?_0x2cd629[_0x279f('0x25')]:undefined,'callbackat':_0x2cd629['callbackUniqueid']?moment()['format'](_0x279f('0x14')):undefined,'CampaignId':_0xcc6e4a['id']});})[_0x279f('0x26')](function(_0x19185d){_0x21d106(_0x19185d);});});});};var _0x3b315f=function(_0x2fdb1b){return new BPromise(function(_0x1443f5,_0x31fde1){_0x1d9f8b(_0x2fdb1b,_0x2cd629)[_0x279f('0x18')](function(_0x4d38fd){_0x2cd629['scheduledat']=_0x4d38fd['ret'];_0x56e65c['CmHopper'][_0x279f('0x20')]({'where':{'phone':_0x2cd629[_0x279f('0x7')],'CampaignId':_0x2fdb1b['id']}})[_0x279f('0x18')](function(_0x55243e){if(!_['isNil'](_0x55243e)){throw new Error(_0x279f('0x21')+_0x2cd629['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x2fdb1b['id']);}return _0x56e65c[_0x279f('0x2c')][_0x279f('0x20')]({'where':{'calleridnum':_0x2cd629[_0x279f('0x7')],'CampaignId':_0x2fdb1b['id']}});})['then'](function(_0x4d4676){if(!_[_0x279f('0x15')](_0x4d4676)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x2cd629[_0x279f('0x7')]+_0x279f('0x2d')+_0x2fdb1b['id']);}return _0x56e65c[_0x279f('0x1f')][_0x279f('0x2a')]({'phone':_0x2cd629[_0x279f('0x7')],'ContactId':_0x2cd629['id'],'ListId':_0x2cd629[_0x279f('0x23')],'priority':_0x2cd629[_0x279f('0x24')]?_0x2cd629['priority']:0x2,'scheduledat':_0x2cd629['scheduledat']?_0x2cd629[_0x279f('0x1b')]:moment()[_0x279f('0x13')](_0x279f('0x14')),'callback':_0x2cd629['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x2cd629[_0x279f('0x25')]?_0x2cd629[_0x279f('0x25')]:undefined,'callbackat':_0x2cd629['callbackUniqueid']?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x2fdb1b['id']});})[_0x279f('0x26')](function(_0x3a86ce){_0x31fde1(_0x3a86ce);});});});};if(_0x2cd629['ListId']){_0x56e65c[_0x279f('0x17')][_0x279f('0x2e')]({'where':{'type':_0x279f('0x2f')},'attributes':['id',_0x279f('0x30'),_0x279f('0x16')],'include':[{'model':_0x56e65c[_0x279f('0x31')],'as':_0x279f('0x32'),'where':{'id':_0x2cd629[_0x279f('0x23')]}}]})['then'](function(_0x24d397){if(_0x24d397){var _0x316916=[];for(var _0x50f61c=0x0,_0x1130b9;_0x50f61c<_0x24d397[_0x279f('0x33')];_0x50f61c+=0x1){_0x1130b9=_0x24d397[_0x50f61c][_0x279f('0xe')]({'plain':!![]});switch(_0x1130b9[_0x279f('0x30')]){case _0x279f('0x34'):_0x258bda(_0x1130b9)[_0x279f('0x26')](_0x101055());break;case _0x279f('0x35'):_0x82be5e(_0x1130b9)[_0x279f('0x26')](_0x101055());break;default:_0x1d9f8b(_0x1130b9,_0x2cd629)[_0x279f('0x18')](function(_0x3e64e8){_0x2cd629['scheduledat']=_0x3e64e8[_0x279f('0x1e')];_0x56e65c['CmHopper'][_0x279f('0x2a')]({'phone':_0x2cd629[_0x279f('0x7')],'ContactId':_0x2cd629['id'],'ListId':_0x2cd629[_0x279f('0x23')],'scheduledat':_0x2cd629[_0x279f('0x1b')]?_0x2cd629[_0x279f('0x1b')]:moment()['format'](_0x279f('0x14')),'priority':_0x2cd629[_0x279f('0x24')]?_0x2cd629[_0x279f('0x24')]:0x2,'callback':_0x2cd629[_0x279f('0x25')]?!![]:![],'callbackuniqueid':_0x2cd629[_0x279f('0x25')]?_0x2cd629[_0x279f('0x25')]:undefined,'callbackat':_0x2cd629[_0x279f('0x25')]?moment()['format'](_0x279f('0x14')):undefined,'VoiceQueueId':_0x1130b9['id']})[_0x279f('0x26')](_0x101055());});}}}})[_0x279f('0x18')](function(){return _0x56e65c[_0x279f('0x17')][_0x279f('0x2e')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':_0x56e65c['CmList'],'as':_0x279f('0x36'),'where':{'id':_0x2cd629[_0x279f('0x23')]}}]})[_0x279f('0x18')](function(_0x579b36){if(_0x579b36){var _0x53d06b=[];for(var _0x1173c3=0x0,_0x58197e;_0x1173c3<_0x579b36['length'];_0x1173c3+=0x1){_0x58197e=_0x579b36[_0x1173c3]['get']({'plain':!![]});_0x56e65c[_0x279f('0x37')][_0x279f('0x2a')]({'phone':_0x2cd629[_0x279f('0x7')],'ContactId':_0x2cd629['id'],'ListId':_0x2cd629['ListId'],'VoiceQueueId':_0x58197e['id']})[_0x279f('0x26')](function(_0x3cea2b){logger[_0x279f('0xf')](_0x279f('0x38'),_0x279f('0x11'),_0x3cea2b[_0x279f('0x39')]);});}}});})[_0x279f('0x18')](function(){return _0x56e65c[_0x279f('0x3a')]['findAll']({'attributes':['id',_0x279f('0x30'),'dialTimezone'],'include':[{'model':_0x56e65c['CmList'],'as':_0x279f('0x32'),'where':{'id':_0x2cd629[_0x279f('0x23')]}}]})[_0x279f('0x18')](function(_0x5ec0c3){if(_0x5ec0c3){var _0x47f1fe=[];for(var _0x1f7772=0x0,_0x1d3c3c;_0x1f7772<_0x5ec0c3[_0x279f('0x33')];_0x1f7772+=0x1){_0x1d3c3c=_0x5ec0c3[_0x1f7772][_0x279f('0xe')]({'plain':!![]});switch(_0x1d3c3c[_0x279f('0x30')]){case _0x279f('0x34'):_0x3b315f(_0x1d3c3c)[_0x279f('0x26')](_0x29dd82());break;case'onlyIfOpen':_0x1ee7be(_0x1d3c3c)[_0x279f('0x26')](_0x29dd82());break;default:_0x56e65c['CmHopper'][_0x279f('0x2a')]({'phone':_0x2cd629['phone'],'ContactId':_0x2cd629['id'],'ListId':_0x2cd629['ListId'],'scheduledat':_0x2cd629[_0x279f('0x1b')]?_0x2cd629[_0x279f('0x1b')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x2cd629[_0x279f('0x24')]?_0x2cd629[_0x279f('0x24')]:0x2,'callback':_0x2cd629[_0x279f('0x25')]?!![]:![],'callbackuniqueid':_0x2cd629[_0x279f('0x25')]?_0x2cd629['callbackUniqueid']:undefined,'callbackat':_0x2cd629[_0x279f('0x25')]?moment()[_0x279f('0x13')](_0x279f('0x14')):undefined,'CampaignId':_0x1d3c3c['id']})[_0x279f('0x26')](_0x29dd82());}}}});})[_0x279f('0x18')](function(){return _0x56e65c[_0x279f('0x3a')][_0x279f('0x2e')]({'attributes':['id'],'include':[{'model':_0x56e65c[_0x279f('0x31')],'as':_0x279f('0x36'),'where':{'id':_0x2cd629[_0x279f('0x23')]}}]})[_0x279f('0x18')](function(_0x4349cd){if(_0x4349cd){var _0x458a43=[];for(var _0x131dcd=0x0,_0x1d3209;_0x131dcd<_0x4349cd[_0x279f('0x33')];_0x131dcd+=0x1){_0x1d3209=_0x4349cd[_0x131dcd][_0x279f('0xe')]({'plain':!![]});_0x56e65c[_0x279f('0x37')][_0x279f('0x2a')]({'phone':_0x2cd629[_0x279f('0x7')],'ContactId':_0x2cd629['id'],'ListId':_0x2cd629[_0x279f('0x23')],'CampaignId':_0x1d3209['id']})[_0x279f('0x26')](function(_0x1708a7){logger[_0x279f('0xf')]('cmContact,\x20%s,\x20%s','afterCreate',_0x1708a7[_0x279f('0x39')]);});}}});})[_0x279f('0x18')](function(){_0x22f45c();})[_0x279f('0x26')](function(_0x5e4628){logger['error'](_0x279f('0x38'),_0x279f('0x11'),_0x5e4628[_0x279f('0x39')]);_0x22f45c(_0x5e4628);});}else{_0x22f45c(new Error(_0x279f('0x3b')));}},'afterDestroy':function(_0x42e5bd,_0x52923e,_0x4947df){var _0x50de57=_0x4d8dab[_0x279f('0x3c')];var _0x5b0d9e=_0x42e5bd['get']({'plain':!![]});return _0x50de57[_0x279f('0x1f')][_0x279f('0x2e')]({'raw':!![],'where':{'ListId':_0x5b0d9e['ListId'],'ContactId':_0x5b0d9e['id']}})[_0x279f('0x18')](function(_0x4cda6e){if(!_[_0x279f('0x3d')](_0x4cda6e)){var _0x124ef7=[];for(var _0x53fc37=0x0;_0x53fc37<_0x4cda6e['length'];_0x53fc37+=0x1){var _0x3d0d9b=_0x50de57['CmHopper'][_0x279f('0x3e')]({'where':{'ListId':_0x4cda6e[_0x53fc37][_0x279f('0x23')],'ContactId':_0x4cda6e[_0x53fc37][_0x279f('0x3f')],'VoiceQueueId':_0x4cda6e[_0x53fc37][_0x279f('0x40')],'CampaignId':_0x4cda6e[_0x53fc37][_0x279f('0x41')]}});_0x124ef7[_0x279f('0x42')](_0x3d0d9b);}return BPromise[_0x279f('0x43')](_0x124ef7);}})['then'](function(_0x1e090a){logger[_0x279f('0x44')]('[CmContact][afterDestroy][Succesfull]',util[_0x279f('0x12')](_0x1e090a,{'showHidden':![],'depth':null}));_0x4947df();})[_0x279f('0x26')](function(_0x5c836e){logger['error'](_0x279f('0x45'),util[_0x279f('0x12')](_0x5c836e,{'showHidden':![],'depth':null}));_0x4947df(_0x5c836e);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 10d94a1..606a9db 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['phone','ListId','Contact','CmContactId','create','body','keys','length','startsWith','update','table','cm_contacts','id\x20=\x20?','sequelize','query','CreateCmContact','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./cmContact.socket','register','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmContact','CmContact','findAll','options','where','limit','include','map','model','attributes','then','stringify','CmContactHasItem','find'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var squel=require('squel');var db=require(_0x0a9e('0x4'))['db'];var utils=require(_0x0a9e('0x5'));var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var config=require(_0x0a9e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0a9e('0x9')][_0x0a9e('0xa')]({'port':0x232a});config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithRpcPromise(_0x307b3e,_0x3ab53f,_0xfeb75b){return new BPromise(function(_0xbd1168,_0x4a4c56){return client['request'](_0x307b3e,_0xfeb75b)['then'](function(_0x4cfe67){logger[_0x0a9e('0xf')](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));logger[_0x0a9e('0x12')](_0x0a9e('0x13'),_0x3ab53f,_0x0a9e('0x11'),JSON['stringify'](_0x4cfe67));if(_0x4cfe67[_0x0a9e('0x14')]){if(_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x15')]===0x1f4){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')]['message']);return _0x4a4c56(_0x4cfe67[_0x0a9e('0x14')]['message']);}logger[_0x0a9e('0x14')]('CmContact,\x20%s,\x20%s',_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x16')]);return _0xbd1168(_0x4cfe67['error'][_0x0a9e('0x16')]);}else{logger['info'](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));_0xbd1168(_0x4cfe67[_0x0a9e('0x17')][_0x0a9e('0x16')]);}})[_0x0a9e('0x18')](function(_0x2eb11f){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x2eb11f);_0x4a4c56(_0x2eb11f);});});}exports[_0x0a9e('0x19')]=function(_0x112016){var _0x1c696a=this;return new Promise(function(_0x105080,_0x4bb1e3){return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':_0x112016['options']?_0x112016[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x112016['options']?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')]||null:null,'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')]['attributes']||null:null,'limit':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1e')]||null:null,'include':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x112016['options']['include'],function(_0x197ec0){return{'model':db[_0x197ec0[_0x0a9e('0x21')]],'as':_0x197ec0['as'],'attributes':_0x197ec0[_0x0a9e('0x22')],'include':_0x197ec0[_0x0a9e('0x1f')]?_['map'](_0x197ec0[_0x0a9e('0x1f')],function(_0x479bc4){return{'model':db[_0x479bc4[_0x0a9e('0x21')]],'as':_0x479bc4['as'],'attributes':_0x479bc4['attributes'],'include':_0x479bc4[_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x479bc4[_0x0a9e('0x1f')],function(_0x14433c){return{'model':db[_0x14433c[_0x0a9e('0x21')]],'as':_0x14433c['as'],'attributes':_0x14433c[_0x0a9e('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x23')](function(_0x14de77){logger['info'](_0x0a9e('0x19'),_0x112016);logger[_0x0a9e('0x12')](_0x0a9e('0x19'),_0x112016,JSON[_0x0a9e('0x24')](_0x14de77));if(_0x14de77['length']==0x0){return db[_0x0a9e('0x25')][_0x0a9e('0x26')]({'raw':!![],'where':{'item':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x27')]},'include':[{'model':db[_0x0a9e('0x1a')],'where':{'ListId':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')][_0x0a9e('0x28')],'deletedAt':{'$eq':null}},'as':_0x0a9e('0x29')}]})['then'](function(_0x426950){if(_['isNil'](_0x426950)){_0x105080(_0x14de77);}else{var _0x2407f9=_0x426950[_0x0a9e('0x2a')];return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':!![],'where':{'id':_0x2407f9},'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016['options'][_0x0a9e('0x22')]||null:null})[_0x0a9e('0x23')](function(_0x40cb85){_0x105080(_0x40cb85);});}});}else{_0x105080(_0x14de77);}})[_0x0a9e('0x18')](function(_0x2b45ea){logger[_0x0a9e('0x14')](_0x0a9e('0x19'),_0x2b45ea[_0x0a9e('0x16')],_0x112016);_0x4bb1e3(_0x1c696a['error'](0x1f4,_0x2b45ea[_0x0a9e('0x16')]));});});};exports['CreateCmContact']=function(_0x2cc7a0){var _0x14b13f=this;return new Promise(function(_0x2b7e7f,_0x3f3d41){return db['CmContact'][_0x0a9e('0x2b')](_0x2cc7a0[_0x0a9e('0x2c')],{'raw':_0x2cc7a0[_0x0a9e('0x1c')]?_0x2cc7a0[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1e8694){var _0x5640eb;for(var _0x24936a=0x0;_0x24936a{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x3b3b71,_0x1cc064){var _0x2171d3=function(_0x2e1f11){while(--_0x2e1f11){_0x3b3b71['push'](_0x3b3b71['shift']());}};_0x2171d3(++_0x1cc064);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/phones',auth['isAuthenticated'](),controller['getAdditionalPhones']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getHopperHistories']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')]('/merge',auth[_0x0a9e('0xd')](),controller['merge']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/phones',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x1e'),auth['isAuthenticated'](),controller['duplicateAdditionalPhones']);router[_0x0a9e('0x18')](_0x0a9e('0x1f'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xfb6e48,_0x2fb0e4,_0x3b45bc){_0x3b45bc(null,path[_0x0a9e('0x21')](config[_0x0a9e('0x22')],_0x0a9e('0x23')));},'filename':function(_0x16b1ca,_0x5ea472,_0x59181e){_0x5ea472[_0x0a9e('0x24')]=_0x5ea472[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index cceaad6..671d3c8 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 _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 +var _0xc2cc=['STRING','exports','INTEGER'];(function(_0x55f97c,_0x3b1438){var _0x2d6f2c=function(_0x5d019d){while(--_0x5d019d){_0x55f97c['push'](_0x55f97c['shift']());}};_0x2d6f2c(++_0x3b1438);}(_0xc2cc,0x70));var _0xcc2c=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xc2cc[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require('sequelize');module[_0xcc2c('0x0')]={'CmContactId':{'type':Sequelize[_0xcc2c('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0xcc2c('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xcc2c('0x2')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0xcc2c('0x1')],'defaultValue':null},'description':{'type':Sequelize['STRING'],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index 70d0115..308b926 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 _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 +var _0xb47d=['set','Content-Range','apply','reject','save','update','destroy','then','get','CmContactHasItems','end','name','send','index','map','CmContactHasItem','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','length','find','catch','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit'];(function(_0x4e8f7d,_0x2299f0){var _0x2102a7=function(_0x1016b8){while(--_0x1016b8){_0x4e8f7d['push'](_0x4e8f7d['shift']());}};_0x2102a7(++_0x2299f0);}(_0xb47d,0x89));var _0xdb47=function(_0x448184,_0x2acbd1){_0x448184=_0x448184-0x0;var _0x5b23c8=_0xb47d[_0x448184];return _0x5b23c8;};'use strict';var emlformat=require(_0xdb47('0x0'));var rimraf=require(_0xdb47('0x1'));var zipdir=require(_0xdb47('0x2'));var jsonpatch=require(_0xdb47('0x3'));var rp=require(_0xdb47('0x4'));var moment=require(_0xdb47('0x5'));var BPromise=require(_0xdb47('0x6'));var Mustache=require(_0xdb47('0x7'));var util=require(_0xdb47('0x8'));var path=require(_0xdb47('0x9'));var sox=require(_0xdb47('0xa'));var csv=require(_0xdb47('0xb'));var ejs=require(_0xdb47('0xc'));var fs=require('fs');var fs_extra=require(_0xdb47('0xd'));var _=require(_0xdb47('0xe'));var squel=require(_0xdb47('0xf'));var crypto=require('crypto');var jsforce=require(_0xdb47('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xdb47('0xb'));var querystring=require(_0xdb47('0x11'));var Papa=require(_0xdb47('0x12'));var Redis=require(_0xdb47('0x13'));var authService=require(_0xdb47('0x14'));var qs=require(_0xdb47('0x15'));var as=require(_0xdb47('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xdb47('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x58e32f,_0x30e584){_0x30e584=_0x30e584||0xcc;return function(_0x3d18d3){if(_0x3d18d3){return _0x58e32f[_0xdb47('0x18')](_0x30e584);}return _0x58e32f['status'](_0x30e584)['end']();};}function respondWithResult(_0x7bd084,_0x14be97){_0x14be97=_0x14be97||0xc8;return function(_0xb315b7){if(_0xb315b7){return _0x7bd084[_0xdb47('0x19')](_0x14be97)[_0xdb47('0x1a')](_0xb315b7);}};}function respondWithFilteredResult(_0x4e00d5,_0x59438a){return function(_0x3f38b0){if(_0x3f38b0){var _0x4e28f9=typeof _0x59438a[_0xdb47('0x1b')]===_0xdb47('0x1c')&&typeof _0x59438a['limit']===_0xdb47('0x1c');var _0x191c1c=_0x3f38b0['count'];var _0x48e55f=_0x4e28f9?0x0:_0x59438a['offset'];var _0x5a9753=_0x4e28f9?_0x3f38b0[_0xdb47('0x1d')]:_0x59438a['offset']+_0x59438a[_0xdb47('0x1e')];var _0x27c499;if(_0x5a9753>=_0x191c1c){_0x5a9753=_0x191c1c;_0x27c499=0xc8;}else{_0x27c499=0xce;}_0x4e00d5[_0xdb47('0x19')](_0x27c499);return _0x4e00d5[_0xdb47('0x1f')](_0xdb47('0x20'),_0x48e55f+'-'+_0x5a9753+'/'+_0x191c1c)[_0xdb47('0x1a')](_0x3f38b0);}return null;};}function patchUpdates(_0x19835e){return function(_0x3f021d){try{jsonpatch[_0xdb47('0x21')](_0x3f021d,_0x19835e,!![]);}catch(_0xf9ec19){return BPromise[_0xdb47('0x22')](_0xf9ec19);}return _0x3f021d[_0xdb47('0x23')]();};}function saveUpdates(_0x1424de,_0x290484){return function(_0x328b37){if(_0x328b37){return _0x328b37[_0xdb47('0x24')](_0x1424de)['then'](function(_0x22fb02){return _0x22fb02;});}return null;};}function removeEntity(_0x5f57fe,_0x1735e4){return function(_0x10af13){if(_0x10af13){return _0x10af13[_0xdb47('0x25')]()[_0xdb47('0x26')](function(){var _0x55d426=_0x10af13[_0xdb47('0x27')]({'plain':!![]});var _0xac379a=_0xdb47('0x28');return db['UserProfileResource'][_0xdb47('0x25')]({'where':{'type':_0xac379a,'resourceId':_0x55d426['id']}})[_0xdb47('0x26')](function(){return _0x10af13;});})[_0xdb47('0x26')](function(){_0x5f57fe['status'](0xcc)[_0xdb47('0x29')]();});}};}function handleEntityNotFound(_0x5c5c37,_0x4ef147){return function(_0x316906){if(!_0x316906){_0x5c5c37[_0xdb47('0x18')](0x194);}return _0x316906;};}function handleError(_0x33012f,_0x14b2ad){_0x14b2ad=_0x14b2ad||0x1f4;return function(_0x594cc1){logger['error'](_0x594cc1['stack']);if(_0x594cc1[_0xdb47('0x2a')]){delete _0x594cc1[_0xdb47('0x2a')];}_0x33012f[_0xdb47('0x19')](_0x14b2ad)[_0xdb47('0x2b')](_0x594cc1);};}exports[_0xdb47('0x2c')]=function(_0xedbcb2,_0x1199dd){var _0x16c5f0={},_0x13773c={},_0x1866c5={'count':0x0,'rows':[]};var _0x5076d3=_[_0xdb47('0x2d')](db[_0xdb47('0x2e')][_0xdb47('0x2f')],function(_0xa04af2){return{'name':_0xa04af2[_0xdb47('0x30')],'type':_0xa04af2['type'][_0xdb47('0x31')]};});_0x13773c[_0xdb47('0x32')]=_[_0xdb47('0x2d')](_0x5076d3,_0xdb47('0x2a'));_0x13773c[_0xdb47('0x33')]=_[_0xdb47('0x34')](_0xedbcb2['query']);_0x13773c[_0xdb47('0x35')]=_[_0xdb47('0x36')](_0x13773c[_0xdb47('0x32')],_0x13773c[_0xdb47('0x33')]);_0x16c5f0[_0xdb47('0x37')]=_['intersection'](_0x13773c[_0xdb47('0x32')],qs['fields'](_0xedbcb2[_0xdb47('0x33')][_0xdb47('0x38')]));_0x16c5f0[_0xdb47('0x37')]=_0x16c5f0[_0xdb47('0x37')]['length']?_0x16c5f0[_0xdb47('0x37')]:_0x13773c[_0xdb47('0x32')];if(!_0xedbcb2[_0xdb47('0x33')][_0xdb47('0x39')](_0xdb47('0x3a'))){_0x16c5f0['limit']=qs[_0xdb47('0x1e')](_0xedbcb2[_0xdb47('0x33')][_0xdb47('0x1e')]);_0x16c5f0[_0xdb47('0x1b')]=qs[_0xdb47('0x1b')](_0xedbcb2[_0xdb47('0x33')][_0xdb47('0x1b')]);}_0x16c5f0[_0xdb47('0x3b')]=qs[_0xdb47('0x3c')](_0xedbcb2['query']['sort']);_0x16c5f0[_0xdb47('0x3d')]=qs[_0xdb47('0x35')](_['pick'](_0xedbcb2[_0xdb47('0x33')],_0x13773c[_0xdb47('0x35')]),_0x5076d3);if(_0xedbcb2[_0xdb47('0x33')][_0xdb47('0x3e')]){_0x16c5f0[_0xdb47('0x3d')]=_[_0xdb47('0x3f')](_0x16c5f0[_0xdb47('0x3d')],{'$or':_[_0xdb47('0x2d')](_0x5076d3,function(_0x3cf736){if(_0x3cf736[_0xdb47('0x40')]!==_0xdb47('0x41')){var _0x239780={};_0x239780[_0x3cf736['name']]={'$like':'%'+_0xedbcb2['query']['filter']+'%'};return _0x239780;}})});}_0x16c5f0=_['merge']({},_0x16c5f0,_0xedbcb2[_0xdb47('0x42')]);var _0x1abc3e={'where':_0x16c5f0[_0xdb47('0x3d')]};return db[_0xdb47('0x2e')][_0xdb47('0x1d')](_0x1abc3e)[_0xdb47('0x26')](function(_0x257bb1){_0x1866c5[_0xdb47('0x1d')]=_0x257bb1;if(_0xedbcb2['query'][_0xdb47('0x43')]){_0x16c5f0[_0xdb47('0x44')]=[{'all':!![]}];}return db['CmContactHasItem'][_0xdb47('0x45')](_0x16c5f0);})[_0xdb47('0x26')](function(_0x2d3443){_0x1866c5[_0xdb47('0x46')]=_0x2d3443;return _0x1866c5;})['then'](respondWithFilteredResult(_0x1199dd,_0x16c5f0))['catch'](handleError(_0x1199dd,null));};exports[_0xdb47('0x47')]=function(_0x4d2897,_0x5017da){var _0x4067ff={'raw':!![],'where':{'id':_0x4d2897['params']['id']}},_0x21966f={};_0x21966f['model']=_[_0xdb47('0x34')](db['CmContactHasItem']['rawAttributes']);_0x21966f[_0xdb47('0x33')]=_[_0xdb47('0x34')](_0x4d2897[_0xdb47('0x33')]);_0x21966f[_0xdb47('0x35')]=_[_0xdb47('0x36')](_0x21966f['model'],_0x21966f[_0xdb47('0x33')]);_0x4067ff[_0xdb47('0x37')]=_[_0xdb47('0x36')](_0x21966f[_0xdb47('0x32')],qs['fields'](_0x4d2897[_0xdb47('0x33')][_0xdb47('0x38')]));_0x4067ff[_0xdb47('0x37')]=_0x4067ff[_0xdb47('0x37')][_0xdb47('0x48')]?_0x4067ff[_0xdb47('0x37')]:_0x21966f[_0xdb47('0x32')];if(_0x4d2897[_0xdb47('0x33')]['includeAll']){_0x4067ff['include']=[{'all':!![]}];}_0x4067ff=_[_0xdb47('0x3f')]({},_0x4067ff,_0x4d2897[_0xdb47('0x42')]);return db[_0xdb47('0x2e')][_0xdb47('0x49')](_0x4067ff)[_0xdb47('0x26')](handleEntityNotFound(_0x5017da,null))[_0xdb47('0x26')](respondWithResult(_0x5017da,null))[_0xdb47('0x4a')](handleError(_0x5017da,null));};exports[_0xdb47('0x4b')]=function(_0x3713aa,_0x3b67f1){return db[_0xdb47('0x2e')]['create'](_0x3713aa[_0xdb47('0x4c')],{})[_0xdb47('0x26')](function(_0x1380ed){var _0x2e8fff=_0x3713aa[_0xdb47('0x4d')][_0xdb47('0x27')]({'plain':!![]});if(!_0x2e8fff)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2e8fff[_0xdb47('0x4e')]==='user'){var _0x12f88d=_0x1380ed['get']({'plain':!![]});var _0xed3929=_0xdb47('0x28');return db[_0xdb47('0x4f')][_0xdb47('0x49')]({'where':{'name':_0xed3929,'userProfileId':_0x2e8fff[_0xdb47('0x50')]},'raw':!![]})['then'](function(_0x343488){if(_0x343488&&_0x343488[_0xdb47('0x51')]===0x0){return db['UserProfileResource'][_0xdb47('0x4b')]({'name':_0x12f88d[_0xdb47('0x2a')],'resourceId':_0x12f88d['id'],'type':_0x343488[_0xdb47('0x2a')],'sectionId':_0x343488['id']},{})[_0xdb47('0x26')](function(){return _0x1380ed;});}else{return _0x1380ed;}})[_0xdb47('0x4a')](function(_0x2bf558){logger['error'](_0xdb47('0x52'),_0x2bf558);throw _0x2bf558;});}return _0x1380ed;})[_0xdb47('0x26')](respondWithResult(_0x3b67f1,0xc9))[_0xdb47('0x4a')](handleError(_0x3b67f1,null));};exports[_0xdb47('0x24')]=function(_0xc3a454,_0x4c00d0){if(_0xc3a454['body']['id']){delete _0xc3a454[_0xdb47('0x4c')]['id'];}return db[_0xdb47('0x2e')][_0xdb47('0x49')]({'where':{'id':_0xc3a454[_0xdb47('0x53')]['id']}})[_0xdb47('0x26')](handleEntityNotFound(_0x4c00d0,null))[_0xdb47('0x26')](saveUpdates(_0xc3a454[_0xdb47('0x4c')],null))[_0xdb47('0x26')](respondWithResult(_0x4c00d0,null))[_0xdb47('0x4a')](handleError(_0x4c00d0,null));};exports[_0xdb47('0x25')]=function(_0x2f003d,_0x34c7fa){return db[_0xdb47('0x2e')][_0xdb47('0x49')]({'where':{'id':_0x2f003d[_0xdb47('0x53')]['id']}})['then'](handleEntityNotFound(_0x34c7fa,null))[_0xdb47('0x26')](removeEntity(_0x34c7fa,null))[_0xdb47('0x4a')](handleError(_0x34c7fa,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index eeffe67..e0c0c6a 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 _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 +var _0x061a=['path','rimraf','../../config/environment','./cmContactHasItem.attributes','define','cm_contact_has_items','api','moment','bluebird'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x061a,0xb1));var _0xa061=function(_0x564db9,_0x4bfbb5){_0x564db9=_0x564db9-0x0;var _0x2d1faf=_0x061a[_0x564db9];return _0x2d1faf;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xa061('0x0'));var moment=require(_0xa061('0x1'));var BPromise=require(_0xa061('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa061('0x3'));var rimraf=require(_0xa061('0x4'));var config=require(_0xa061('0x5'));var attributes=require(_0xa061('0x6'));module['exports']=function(_0x349dea,_0x364f3d){return _0x349dea[_0xa061('0x7')]('CmContactHasItem',attributes,{'tableName':_0xa061('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 9206e57..6529fc2 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 _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 +var _0xf735=['error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xf0fab,_0x3aaf48){var _0x9f8fb7=function(_0x2a7853){while(--_0x2a7853){_0xf0fab['push'](_0xf0fab['shift']());}};_0x9f8fb7(++_0x3aaf48);}(_0xf735,0xeb));var _0x5f73=function(_0x15425f,_0x154f7f){_0x15425f=_0x15425f-0x0;var _0x4cdb94=_0xf735[_0x15425f];return _0x4cdb94;};'use strict';var _=require(_0x5f73('0x0'));var util=require(_0x5f73('0x1'));var moment=require(_0x5f73('0x2'));var BPromise=require('bluebird');var rs=require(_0x5f73('0x3'));var fs=require('fs');var Redis=require(_0x5f73('0x4'));var db=require(_0x5f73('0x5'))['db'];var utils=require(_0x5f73('0x6'));var logger=require(_0x5f73('0x7'))('rpc');var config=require(_0x5f73('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5f73('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2841e5,_0x4b91d6,_0x4b7a38){return new BPromise(function(_0x1741fa,_0x4557a8){return client[_0x5f73('0xa')](_0x2841e5,_0x4b7a38)['then'](function(_0x460676){logger[_0x5f73('0xb')](_0x5f73('0xc'),_0x4b91d6,_0x5f73('0xd'));logger[_0x5f73('0xe')](_0x5f73('0xf'),_0x4b91d6,_0x5f73('0xd'),JSON[_0x5f73('0x10')](_0x460676));if(_0x460676[_0x5f73('0x11')]){if(_0x460676[_0x5f73('0x11')][_0x5f73('0x12')]===0x1f4){logger[_0x5f73('0x11')](_0x5f73('0xc'),_0x4b91d6,_0x460676[_0x5f73('0x11')][_0x5f73('0x13')]);return _0x4557a8(_0x460676[_0x5f73('0x11')]['message']);}logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x4b91d6,_0x460676['error']['message']);return _0x1741fa(_0x460676[_0x5f73('0x11')]['message']);}else{logger[_0x5f73('0xb')]('CmContactHasItem,\x20%s,\x20%s',_0x4b91d6,_0x5f73('0xd'));_0x1741fa(_0x460676['result'][_0x5f73('0x13')]);}})[_0x5f73('0x14')](function(_0xb4810f){logger['error'](_0x5f73('0xc'),_0x4b91d6,_0xb4810f);_0x4557a8(_0xb4810f);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 8a1c1c1..5c1d359 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 _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 +var _0x35c8=['express','fs-extra','../../components/auth/service','../../config/environment','./cmContactHasItem.controller','isAuthenticated','get','/:id','put','update','delete','destroy','multer','util','path','connect-timeout'];(function(_0x16a05c,_0x414cd6){var _0x5382c5=function(_0x4e293f){while(--_0x4e293f){_0x16a05c['push'](_0x16a05c['shift']());}};_0x5382c5(++_0x414cd6);}(_0x35c8,0xdc));var _0x835c=function(_0x4b9fe2,_0x554581){_0x4b9fe2=_0x4b9fe2-0x0;var _0x4470f5=_0x35c8[_0x4b9fe2];return _0x4470f5;};'use strict';var multer=require(_0x835c('0x0'));var util=require(_0x835c('0x1'));var path=require(_0x835c('0x2'));var timeout=require(_0x835c('0x3'));var express=require(_0x835c('0x4'));var router=express['Router']();var fs_extra=require(_0x835c('0x5'));var auth=require(_0x835c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x835c('0x7'));var controller=require(_0x835c('0x8'));router['get']('/',auth[_0x835c('0x9')](),controller['index']);router[_0x835c('0xa')](_0x835c('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x835c('0x9')](),controller['create']);router[_0x835c('0xc')](_0x835c('0xb'),auth[_0x835c('0x9')](),controller[_0x835c('0xd')]);router[_0x835c('0xe')]('/:id',auth[_0x835c('0x9')](),controller[_0x835c('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 a36ce93..a3ae9ef 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 _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 +var _0x408c=['exports','VIRTUAL','getDataValue','alias','STRING','setDataValue','name','TEXT','select','parse','isArray','values','stringify','BOOLEAN','ENUM','voice','sequelize'];(function(_0x2ecbfd,_0x5bacbc){var _0x2c65a2=function(_0x569338){while(--_0x569338){_0x2ecbfd['push'](_0x2ecbfd['shift']());}};_0x2c65a2(++_0x5bacbc);}(_0x408c,0xed));var _0xc408=function(_0x42b8ad,_0x5f0671){_0x42b8ad=_0x42b8ad-0x0;var _0x1802fa=_0x408c[_0x42b8ad];return _0x1802fa;};'use strict';var Sequelize=require(_0xc408('0x0'));var _=require('lodash');module[_0xc408('0x1')]={'name':{'type':Sequelize[_0xc408('0x2')],'get':function(_0x36eb3d){return this[_0xc408('0x3')](_0xc408('0x4'));}},'alias':{'type':Sequelize[_0xc408('0x5')],'allowNull':![],'set':function(_0x3c43aa){this[_0xc408('0x6')]('alias',_0x3c43aa?_0x3c43aa:this[_0xc408('0x3')](_0xc408('0x7')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0xc408('0x8')]('long'),'get':function(){if(this[_0xc408('0x3')]('type')===_0xc408('0x9')){return JSON[_0xc408('0xa')](this[_0xc408('0x3')]('values'));}else{return this[_0xc408('0x3')]('values');}},'set':function(_0xbc3807){if(Array[_0xc408('0xb')](_0xbc3807)){this[_0xc408('0x6')](_0xc408('0xc'),JSON[_0xc408('0xd')](_0xbc3807));}else{this[_0xc408('0x6')](_0xc408('0xc'),_0xbc3807);}}},'required':{'type':Sequelize[_0xc408('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xc408('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xc408('0xf')](_0xc408('0x10'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 829f331..30de954 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 _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 +var _0x1a40=['util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','save','update','end','sendStatus','error','name','map','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','then','rows','params','find','catch','body','create','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','BOOLEAN','addColumn','cm_contacts','format','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache'];(function(_0x2d3bf8,_0x544a00){var _0x37ec29=function(_0x502345){while(--_0x502345){_0x2d3bf8['push'](_0x2d3bf8['shift']());}};_0x37ec29(++_0x544a00);}(_0x1a40,0xf3));var _0x01a4=function(_0x44957a,_0x13d1ed){_0x44957a=_0x44957a-0x0;var _0x1a16cd=_0x1a40[_0x44957a];return _0x1a16cd;};'use strict';var emlformat=require(_0x01a4('0x0'));var rimraf=require(_0x01a4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x01a4('0x2'));var rp=require(_0x01a4('0x3'));var moment=require('moment');var BPromise=require(_0x01a4('0x4'));var Mustache=require(_0x01a4('0x5'));var util=require(_0x01a4('0x6'));var path=require(_0x01a4('0x7'));var sox=require('sox');var csv=require(_0x01a4('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x01a4('0x9'));var _=require(_0x01a4('0xa'));var squel=require(_0x01a4('0xb'));var crypto=require(_0x01a4('0xc'));var jsforce=require(_0x01a4('0xd'));var deskjs=require(_0x01a4('0xe'));var toCsv=require('to-csv');var querystring=require(_0x01a4('0xf'));var Papa=require(_0x01a4('0x10'));var Redis=require(_0x01a4('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x01a4('0x12'));var as=require(_0x01a4('0x13'));var hardwareService=require(_0x01a4('0x14'));var logger=require(_0x01a4('0x15'))('api');var utils=require(_0x01a4('0x16'));var config=require(_0x01a4('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x01a4('0x18'))['db'];function respondWithStatusCode(_0xc2db05,_0x313455){_0x313455=_0x313455||0xcc;return function(_0x4f1ce6){if(_0x4f1ce6){return _0xc2db05['sendStatus'](_0x313455);}return _0xc2db05[_0x01a4('0x19')](_0x313455)['end']();};}function respondWithResult(_0x103f50,_0x4c98a0){_0x4c98a0=_0x4c98a0||0xc8;return function(_0x2ea346){if(_0x2ea346){return _0x103f50['status'](_0x4c98a0)[_0x01a4('0x1a')](_0x2ea346);}};}function respondWithFilteredResult(_0x31e331,_0x51821a){return function(_0x2d58d5){if(_0x2d58d5){var _0x15928b=typeof _0x51821a[_0x01a4('0x1b')]===_0x01a4('0x1c')&&typeof _0x51821a[_0x01a4('0x1d')]===_0x01a4('0x1c');var _0x4a0fe5=_0x2d58d5['count'];var _0x2c5201=_0x15928b?0x0:_0x51821a[_0x01a4('0x1b')];var _0x1c40a0=_0x15928b?_0x2d58d5[_0x01a4('0x1e')]:_0x51821a[_0x01a4('0x1b')]+_0x51821a[_0x01a4('0x1d')];var _0x469d9d;if(_0x1c40a0>=_0x4a0fe5){_0x1c40a0=_0x4a0fe5;_0x469d9d=0xc8;}else{_0x469d9d=0xce;}_0x31e331[_0x01a4('0x19')](_0x469d9d);return _0x31e331[_0x01a4('0x1f')]('Content-Range',_0x2c5201+'-'+_0x1c40a0+'/'+_0x4a0fe5)[_0x01a4('0x1a')](_0x2d58d5);}return null;};}function patchUpdates(_0x54e3f4){return function(_0x3e50ec){try{jsonpatch['apply'](_0x3e50ec,_0x54e3f4,!![]);}catch(_0x250f21){return BPromise['reject'](_0x250f21);}return _0x3e50ec[_0x01a4('0x20')]();};}function saveUpdates(_0x12179e,_0x92069c){return function(_0x2e726f){if(_0x2e726f){return _0x2e726f[_0x01a4('0x21')](_0x12179e)['then'](function(_0x5f05d4){return _0x5f05d4;});}return null;};}function removeEntity(_0x5bfa0d,_0x8cef18){return function(_0x3755d7){if(_0x3755d7){return _0x3755d7['destroy']()['then'](function(){_0x5bfa0d['status'](0xcc)[_0x01a4('0x22')]();});}};}function handleEntityNotFound(_0x23101a,_0x11efc0){return function(_0x2c8492){if(!_0x2c8492){_0x23101a[_0x01a4('0x23')](0x194);}return _0x2c8492;};}function handleError(_0x4f8f8c,_0x4d02ea){_0x4d02ea=_0x4d02ea||0x1f4;return function(_0x467ab6){logger[_0x01a4('0x24')](_0x467ab6['stack']);if(_0x467ab6[_0x01a4('0x25')]){delete _0x467ab6[_0x01a4('0x25')];}_0x4f8f8c[_0x01a4('0x19')](_0x4d02ea)['send'](_0x467ab6);};}exports['index']=function(_0x2b8c89,_0x1b6f19){var _0x31a573={},_0x5f2726={},_0x5f4be0={'count':0x0,'rows':[]};var _0x4af660=_[_0x01a4('0x26')](db[_0x01a4('0x27')][_0x01a4('0x28')],function(_0x1e6b2f){return{'name':_0x1e6b2f[_0x01a4('0x29')],'type':_0x1e6b2f[_0x01a4('0x2a')][_0x01a4('0x2b')]};});_0x5f2726[_0x01a4('0x2c')]=_[_0x01a4('0x2d')](_[_0x01a4('0x26')](_0x4af660,_0x01a4('0x25')),[_0x01a4('0x25')]);_0x5f2726[_0x01a4('0x2e')]=_[_0x01a4('0x2f')](_0x2b8c89['query']);_0x5f2726['filters']=_['intersection'](_0x5f2726[_0x01a4('0x2c')],_0x5f2726[_0x01a4('0x2e')]);_0x31a573['attributes']=_[_0x01a4('0x30')](_0x5f2726[_0x01a4('0x2c')],qs['fields'](_0x2b8c89[_0x01a4('0x2e')][_0x01a4('0x31')]));_0x31a573[_0x01a4('0x32')]=_0x31a573[_0x01a4('0x32')][_0x01a4('0x33')]?_0x31a573[_0x01a4('0x32')]:_0x5f2726[_0x01a4('0x2c')];if(!_0x2b8c89[_0x01a4('0x2e')][_0x01a4('0x34')]('nolimit')){_0x31a573[_0x01a4('0x1d')]=qs[_0x01a4('0x1d')](_0x2b8c89[_0x01a4('0x2e')][_0x01a4('0x1d')]);_0x31a573[_0x01a4('0x1b')]=qs[_0x01a4('0x1b')](_0x2b8c89[_0x01a4('0x2e')][_0x01a4('0x1b')]);}_0x31a573[_0x01a4('0x35')]=qs[_0x01a4('0x36')](_0x2b8c89[_0x01a4('0x2e')][_0x01a4('0x36')]);_0x31a573['where']=qs[_0x01a4('0x37')](_[_0x01a4('0x38')](_0x2b8c89[_0x01a4('0x2e')],_0x5f2726[_0x01a4('0x37')]),_0x4af660);if(_0x2b8c89[_0x01a4('0x2e')][_0x01a4('0x39')]){_0x31a573[_0x01a4('0x3a')]=_[_0x01a4('0x3b')](_0x31a573[_0x01a4('0x3a')],{'$or':_['map'](_0x4af660,function(_0x116a6b){if(_0x116a6b[_0x01a4('0x2a')]!==_0x01a4('0x3c')){var _0x3d1f58={};_0x3d1f58[_0x116a6b[_0x01a4('0x25')]]={'$like':'%'+_0x2b8c89[_0x01a4('0x2e')][_0x01a4('0x39')]+'%'};return _0x3d1f58;}})});}_0x31a573=_[_0x01a4('0x3b')]({},_0x31a573,_0x2b8c89[_0x01a4('0x3d')]);var _0x3070b1={'where':_0x31a573[_0x01a4('0x3a')]};return db[_0x01a4('0x27')][_0x01a4('0x1e')](_0x3070b1)['then'](function(_0x4eec25){_0x5f4be0['count']=_0x4eec25;if(_0x2b8c89[_0x01a4('0x2e')][_0x01a4('0x3e')]){_0x31a573[_0x01a4('0x3f')]=[{'all':!![]}];}return db[_0x01a4('0x27')][_0x01a4('0x40')](_0x31a573);})[_0x01a4('0x41')](function(_0x449dfd){_0x5f4be0[_0x01a4('0x42')]=_0x449dfd;return _0x5f4be0;})[_0x01a4('0x41')](respondWithFilteredResult(_0x1b6f19,_0x31a573))['catch'](handleError(_0x1b6f19,null));};exports['show']=function(_0x28e77f,_0x64167f){var _0x108038={'raw':!![],'where':{'id':_0x28e77f[_0x01a4('0x43')]['id']}},_0x21130e={};_0x21130e[_0x01a4('0x2c')]=_['keys'](db['CmCustomField'][_0x01a4('0x28')]);_0x21130e[_0x01a4('0x2e')]=_[_0x01a4('0x2f')](_0x28e77f[_0x01a4('0x2e')]);_0x21130e[_0x01a4('0x37')]=_[_0x01a4('0x30')](_0x21130e[_0x01a4('0x2c')],_0x21130e[_0x01a4('0x2e')]);_0x108038[_0x01a4('0x32')]=_[_0x01a4('0x30')](_0x21130e[_0x01a4('0x2c')],qs[_0x01a4('0x31')](_0x28e77f[_0x01a4('0x2e')]['fields']));_0x108038[_0x01a4('0x32')]=_0x108038[_0x01a4('0x32')][_0x01a4('0x33')]?_0x108038['attributes']:_0x21130e[_0x01a4('0x2c')];if(_0x28e77f['query'][_0x01a4('0x3e')]){_0x108038['include']=[{'all':!![]}];}_0x108038=_[_0x01a4('0x3b')]({},_0x108038,_0x28e77f['options']);return db[_0x01a4('0x27')][_0x01a4('0x44')](_0x108038)[_0x01a4('0x41')](handleEntityNotFound(_0x64167f,null))[_0x01a4('0x41')](respondWithResult(_0x64167f,null))[_0x01a4('0x45')](handleError(_0x64167f,null));};exports['update']=function(_0x536290,_0x2b9453){if(_0x536290['body']['id']){delete _0x536290[_0x01a4('0x46')]['id'];}return db[_0x01a4('0x27')][_0x01a4('0x44')]({'where':{'id':_0x536290[_0x01a4('0x43')]['id']}})['then'](handleEntityNotFound(_0x2b9453,null))[_0x01a4('0x41')](saveUpdates(_0x536290[_0x01a4('0x46')],null))['then'](respondWithResult(_0x2b9453,null))[_0x01a4('0x45')](handleError(_0x2b9453,null));};exports['destroy']=function(_0x2da90d,_0x3fa091){return db['CmCustomField'][_0x01a4('0x44')]({'where':{'id':_0x2da90d['params']['id']}})[_0x01a4('0x41')](handleEntityNotFound(_0x3fa091,null))['then'](removeEntity(_0x3fa091,null))['catch'](handleError(_0x3fa091,null));};exports[_0x01a4('0x47')]=function(_0x141845,_0x2b3395){var _0x57f9f0;return db[_0x01a4('0x48')][_0x01a4('0x49')](function(_0x366ad7){return db[_0x01a4('0x27')]['create'](_0x141845[_0x01a4('0x46')],{'transaction':_0x366ad7})['then'](function(_0x1c64a6){_0x57f9f0=_0x1c64a6;var _0x330699={'type':db[_0x01a4('0x4a')][_0x01a4('0x4b')],'transaction':_0x366ad7};switch(_0x141845[_0x01a4('0x46')][_0x01a4('0x2a')]){case _0x01a4('0x4c'):_0x330699[_0x01a4('0x2a')]=db[_0x01a4('0x4a')][_0x01a4('0x4b')];break;case _0x01a4('0x4d'):_0x330699['type']=db[_0x01a4('0x4a')][_0x01a4('0x4e')];break;case'switch':_0x330699['type']=db[_0x01a4('0x4a')][_0x01a4('0x4f')];_0x330699['defaultValue']=![];break;default:}return db[_0x01a4('0x48')]['queryInterface'][_0x01a4('0x50')](_0x01a4('0x51'),util[_0x01a4('0x52')]('cf_%d',_0x57f9f0['id']),_0x330699);})['then'](function(){return _0x57f9f0;});})[_0x01a4('0x41')](respondWithResult(_0x2b3395,0xc9))[_0x01a4('0x45')](handleError(_0x2b3395,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index f91e769..1919264 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 _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 +var _0xa703=['./cmCustomField.attributes','exports','define','cm_custom_fields','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0xa703,0xdc));var _0x3a70=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa703[_0x47b58b];return _0x46bebe;};'use strict';var _=require(_0x3a70('0x0'));var util=require('util');var logger=require(_0x3a70('0x1'))(_0x3a70('0x2'));var moment=require(_0x3a70('0x3'));var BPromise=require(_0x3a70('0x4'));var rp=require(_0x3a70('0x5'));var fs=require('fs');var path=require(_0x3a70('0x6'));var rimraf=require('rimraf');var config=require(_0x3a70('0x7'));var attributes=require(_0x3a70('0x8'));module[_0x3a70('0x9')]=function(_0x581c46,_0x468fd1){return _0x581c46[_0x3a70('0xa')]('CmCustomField',attributes,{'tableName':_0x3a70('0xb'),'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 9208963..c048cf6 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 _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 +var _0xb664=['CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','CmCustomField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xbda159,_0x5cce88){var _0x1483ae=function(_0x1b73f0){while(--_0x1b73f0){_0xbda159['push'](_0xbda159['shift']());}};_0x1483ae(++_0x5cce88);}(_0xb664,0x151));var _0x4b66=function(_0x239e2e,_0x19c3d9){_0x239e2e=_0x239e2e-0x0;var _0xa45666=_0xb664[_0x239e2e];return _0xa45666;};'use strict';var _=require('lodash');var util=require(_0x4b66('0x0'));var moment=require('moment');var BPromise=require(_0x4b66('0x1'));var rs=require(_0x4b66('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4b66('0x3'))['db'];var utils=require(_0x4b66('0x4'));var logger=require(_0x4b66('0x5'))(_0x4b66('0x6'));var config=require(_0x4b66('0x7'));var jayson=require(_0x4b66('0x8'));var client=jayson['client'][_0x4b66('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x482a51,_0x20fb5d,_0x2e8200){return new BPromise(function(_0x507e8c,_0x56159e){return client[_0x4b66('0xa')](_0x482a51,_0x2e8200)[_0x4b66('0xb')](function(_0x42c3f9){logger['info'](_0x4b66('0xc'),_0x20fb5d,_0x4b66('0xd'));logger[_0x4b66('0xe')](_0x4b66('0xf'),_0x20fb5d,_0x4b66('0xd'),JSON[_0x4b66('0x10')](_0x42c3f9));if(_0x42c3f9[_0x4b66('0x11')]){if(_0x42c3f9[_0x4b66('0x11')][_0x4b66('0x12')]===0x1f4){logger[_0x4b66('0x11')](_0x4b66('0xc'),_0x20fb5d,_0x42c3f9[_0x4b66('0x11')][_0x4b66('0x13')]);return _0x56159e(_0x42c3f9[_0x4b66('0x11')][_0x4b66('0x13')]);}logger[_0x4b66('0x11')](_0x4b66('0xc'),_0x20fb5d,_0x42c3f9['error']['message']);return _0x507e8c(_0x42c3f9[_0x4b66('0x11')]['message']);}else{logger[_0x4b66('0x14')](_0x4b66('0xc'),_0x20fb5d,_0x4b66('0xd'));_0x507e8c(_0x42c3f9['result'][_0x4b66('0x13')]);}})[_0x4b66('0x15')](function(_0x55e1be){logger[_0x4b66('0x11')]('CmCustomField,\x20%s,\x20%s',_0x20fb5d,_0x55e1be);_0x56159e(_0x55e1be);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 76f7d95..0161f0c 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 _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 +var _0x38ca=['/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','isAuthenticated','index','show','post','create'];(function(_0x232b67,_0x3dc89e){var _0x39fcc0=function(_0x3e20c6){while(--_0x3e20c6){_0x232b67['push'](_0x232b67['shift']());}};_0x39fcc0(++_0x3dc89e);}(_0x38ca,0xb0));var _0xa38c=function(_0x4b125b,_0x3e0a6d){_0x4b125b=_0x4b125b-0x0;var _0x4b5eff=_0x38ca[_0x4b125b];return _0x4b5eff;};'use strict';var multer=require(_0xa38c('0x0'));var util=require('util');var path=require(_0xa38c('0x1'));var timeout=require(_0xa38c('0x2'));var express=require(_0xa38c('0x3'));var router=express[_0xa38c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa38c('0x5'));var interaction=require(_0xa38c('0x6'));var config=require(_0xa38c('0x7'));var controller=require(_0xa38c('0x8'));router['get']('/',auth[_0xa38c('0x9')](),controller[_0xa38c('0xa')]);router['get']('/:id',auth[_0xa38c('0x9')](),controller[_0xa38c('0xb')]);router[_0xa38c('0xc')]('/',auth['isAuthenticated'](),controller[_0xa38c('0xd')]);router['put'](_0xa38c('0xe'),auth[_0xa38c('0x9')](),controller[_0xa38c('0xf')]);router[_0xa38c('0x10')](_0xa38c('0xe'),auth['isAuthenticated'](),controller[_0xa38c('0x11')]);module[_0xa38c('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 ff2f8e1..2369385 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 _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 +var _0xa8b6=['UNSIGNED','contactListQueue','moment','STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER'];(function(_0x4fd96e,_0x33a936){var _0x26e3b0=function(_0x1b6918){while(--_0x1b6918){_0x4fd96e['push'](_0x4fd96e['shift']());}};_0x26e3b0(++_0x33a936);}(_0xa8b6,0x1bb));var _0x6a8b=function(_0x1a90d0,_0x50802e){_0x1a90d0=_0x1a90d0-0x0;var _0x3b68d3=_0xa8b6[_0x1a90d0];return _0x3b68d3;};'use strict';var moment=require(_0x6a8b('0x0'));var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize[_0x6a8b('0x1')],'allowNull':![]},'active':{'type':Sequelize[_0x6a8b('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x6a8b('0x3')],'defaultValue':moment()[_0x6a8b('0x4')](_0x6a8b('0x5'))},'countbusyretry':{'type':Sequelize[_0x6a8b('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6a8b('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0x6a8b('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x6a8b('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x6a8b('0x3')]},'priority':{'type':Sequelize[_0x6a8b('0x6')](0x2)[_0x6a8b('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x6a8b('0x6')],'unique':_0x6a8b('0x8')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x6a8b('0x8')},'UserId':{'type':Sequelize[_0x6a8b('0x6')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x6a8b('0x8')},'CampaignId':{'type':Sequelize[_0x6a8b('0x6')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6a8b('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6a8b('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6a8b('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x6a8b('0x6')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x6a8b('0x1')]},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index a2deb4b..1272725 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 _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 +var _0xd2bb=['scheduledAt','DESC','sequelize','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','isEmpty','findOne','recallme','LOCK','UPDATE','Contact','CmCompany','CmList','List','dialActive','getPreviewRecall','scheduledat','Queue','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','timezones','push','utcOffset','lodash','../../config/logger','api','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','update','then','sendStatus','error','stack','name','send','index','map','CmHopper','fieldName','type','key','model','filters','query','$and','$lt','$lte','$ne','$eq','$not','$between','$notIn','$like','$iLike','$notILike','$overlap','$contained','attributes','intersection','fields','length','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','merge','find','create','body','params','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','omit','dataValues','createdAt','updatedAt','campaign','user','UserId','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','transaction','direction','prev','hopperIds','priority','ASC'];(function(_0x48157b,_0x3dd91e){var _0x23e206=function(_0x7367d8){while(--_0x7367d8){_0x48157b['push'](_0x48157b['shift']());}};_0x23e206(++_0x3dd91e);}(_0xd2bb,0x9a));var _0xbd2b=function(_0x53281a,_0xee3477){_0x53281a=_0x53281a-0x0;var _0x4f4c3b=_0xd2bb[_0x53281a];return _0x4f4c3b;};'use strict';var moment=require('moment');var _=require(_0xbd2b('0x0'));var qs=require('../../components/parsers/qs');var logger=require(_0xbd2b('0x1'))(_0xbd2b('0x2'));var shared=require(_0xbd2b('0x3'));var db=require(_0xbd2b('0x4'))['db'];function respondWithResult(_0x306817,_0x3c67c1){_0x3c67c1=_0x3c67c1||0xc8;return function(_0x5c41c7){if(_0x5c41c7){return _0x306817[_0xbd2b('0x5')](_0x3c67c1)[_0xbd2b('0x6')](_0x5c41c7);}};}function respondWithFilteredResult(_0xdcd8bd,_0x2f64a8){return function(_0x296d68){if(_0x296d68){var _0x3751df=typeof _0x2f64a8[_0xbd2b('0x7')]===_0xbd2b('0x8')&&typeof _0x2f64a8[_0xbd2b('0x9')]===_0xbd2b('0x8');var _0x4fd4f2=_0x296d68[_0xbd2b('0xa')];var _0x517862=_0x3751df?0x0:_0x2f64a8[_0xbd2b('0x7')];var _0x3bcbea=_0x3751df?_0x296d68['count']:_0x2f64a8[_0xbd2b('0x7')]+_0x2f64a8[_0xbd2b('0x9')];var _0x2a43a4;if(_0x3bcbea>=_0x4fd4f2){_0x3bcbea=_0x4fd4f2;_0x2a43a4=0xc8;}else{_0x2a43a4=0xce;}_0xdcd8bd[_0xbd2b('0x5')](_0x2a43a4);return _0xdcd8bd[_0xbd2b('0xb')](_0xbd2b('0xc'),_0x517862+'-'+_0x3bcbea+'/'+_0x4fd4f2)[_0xbd2b('0x6')](_0x296d68);}return null;};}function saveUpdates(_0x275b60,_0x5722a4){return function(_0x35c2c0){if(_0x35c2c0){return _0x35c2c0[_0xbd2b('0xd')](_0x275b60)[_0xbd2b('0xe')](function(_0x36916c){return _0x36916c;});}return null;};}function handleEntityNotFound(_0x29f3d1,_0x5f246b){return function(_0x1ccc21){if(!_0x1ccc21){_0x29f3d1[_0xbd2b('0xf')](0x194);}return _0x1ccc21;};}function handleError(_0x1bc648,_0x1018dc){_0x1018dc=_0x1018dc||0x1f4;return function(_0x1815b3){logger[_0xbd2b('0x10')](_0x1815b3[_0xbd2b('0x11')]);if(_0x1815b3[_0xbd2b('0x12')]){delete _0x1815b3[_0xbd2b('0x12')];}_0x1bc648['status'](_0x1018dc)[_0xbd2b('0x13')](_0x1815b3);};}exports[_0xbd2b('0x14')]=function(_0x21224b,_0x19ee5c){var _0x3ea01c={},_0x112b5e={},_0x13af97={'count':0x0,'rows':[]};var _0xe4eaa6=_[_0xbd2b('0x15')](db[_0xbd2b('0x16')]['rawAttributes'],function(_0x21a4e2){return{'name':_0x21a4e2[_0xbd2b('0x17')],'type':_0x21a4e2[_0xbd2b('0x18')][_0xbd2b('0x19')]};});_0x112b5e[_0xbd2b('0x1a')]=_[_0xbd2b('0x15')](_0xe4eaa6,_0xbd2b('0x12'));_0x112b5e['query']=_['keys'](_0x21224b['query']);_0x112b5e[_0xbd2b('0x1b')]=_['intersection'](_0x112b5e[_0xbd2b('0x1a')],_0x112b5e[_0xbd2b('0x1c')]);_0x112b5e['filters']=_['concat'](_0x112b5e[_0xbd2b('0x1b')],[_0xbd2b('0x1d'),'$or','$gt','$gte',_0xbd2b('0x1e'),_0xbd2b('0x1f'),_0xbd2b('0x20'),_0xbd2b('0x21'),_0xbd2b('0x22'),_0xbd2b('0x23'),'$notBetween','$in',_0xbd2b('0x24'),_0xbd2b('0x25'),'$notLike',_0xbd2b('0x26'),_0xbd2b('0x27'),_0xbd2b('0x25'),_0xbd2b('0x28'),'$contains',_0xbd2b('0x29'),'$any']);_0x3ea01c[_0xbd2b('0x2a')]=_[_0xbd2b('0x2b')](_0x112b5e[_0xbd2b('0x1a')],qs[_0xbd2b('0x2c')](_0x21224b[_0xbd2b('0x1c')][_0xbd2b('0x2c')]));_0x3ea01c[_0xbd2b('0x2a')]=_0x3ea01c['attributes'][_0xbd2b('0x2d')]?_0x3ea01c['attributes']:_0x112b5e[_0xbd2b('0x1a')];if(!_0x21224b[_0xbd2b('0x1c')]['hasOwnProperty']('nolimit')){_0x3ea01c[_0xbd2b('0x9')]=qs[_0xbd2b('0x9')](_0x21224b[_0xbd2b('0x1c')][_0xbd2b('0x9')]);_0x3ea01c[_0xbd2b('0x7')]=qs['offset'](_0x21224b[_0xbd2b('0x1c')][_0xbd2b('0x7')]);}_0x3ea01c[_0xbd2b('0x2e')]=qs[_0xbd2b('0x2f')](_0x21224b[_0xbd2b('0x1c')][_0xbd2b('0x2f')]);_0x3ea01c[_0xbd2b('0x30')]=qs['filters'](_[_0xbd2b('0x31')](_0x21224b['query'],_0x112b5e['filters']),_0xe4eaa6);if(_0x21224b[_0xbd2b('0x1c')][_0xbd2b('0x32')]){_0x3ea01c[_0xbd2b('0x30')]=_['merge'](_0x3ea01c['where'],{'$or':_[_0xbd2b('0x15')](_0xe4eaa6,function(_0x389d28){if(_0x389d28[_0xbd2b('0x18')]!==_0xbd2b('0x33')){var _0xdd1383={};_0xdd1383[_0x389d28['name']]={'$like':'%'+_0x21224b[_0xbd2b('0x1c')][_0xbd2b('0x32')]+'%'};return _0xdd1383;}})});}_0x3ea01c=_['merge']({},_0x3ea01c,_0x21224b[_0xbd2b('0x34')]);var _0x5e0d58={'where':_0x3ea01c[_0xbd2b('0x30')]};return db[_0xbd2b('0x16')][_0xbd2b('0xa')](_0x5e0d58)[_0xbd2b('0xe')](function(_0x5054b6){_0x13af97[_0xbd2b('0xa')]=_0x5054b6;if(_0x21224b[_0xbd2b('0x1c')][_0xbd2b('0x35')]){_0x3ea01c[_0xbd2b('0x36')]=[{'all':!![]}];}return db['CmHopper'][_0xbd2b('0x37')](_0x3ea01c);})['then'](function(_0x3ea722){_0x13af97[_0xbd2b('0x38')]=_0x3ea722;return _0x13af97;})[_0xbd2b('0xe')](respondWithFilteredResult(_0x19ee5c,_0x3ea01c))[_0xbd2b('0x39')](handleError(_0x19ee5c,null));};exports[_0xbd2b('0x3a')]=function(_0x534741,_0x252f0b){var _0x5050de={'raw':!![],'where':{'id':_0x534741['params']['id']}},_0xef8bb3={};_0xef8bb3[_0xbd2b('0x1a')]=_[_0xbd2b('0x3b')](db[_0xbd2b('0x16')][_0xbd2b('0x3c')]);_0xef8bb3[_0xbd2b('0x1c')]=_[_0xbd2b('0x3b')](_0x534741['query']);_0xef8bb3[_0xbd2b('0x1b')]=_[_0xbd2b('0x2b')](_0xef8bb3[_0xbd2b('0x1a')],_0xef8bb3['query']);_0x5050de['attributes']=_['intersection'](_0xef8bb3[_0xbd2b('0x1a')],qs[_0xbd2b('0x2c')](_0x534741[_0xbd2b('0x1c')][_0xbd2b('0x2c')]));_0x5050de[_0xbd2b('0x2a')]=_0x5050de['attributes'][_0xbd2b('0x2d')]?_0x5050de['attributes']:_0xef8bb3[_0xbd2b('0x1a')];if(_0x534741['query'][_0xbd2b('0x35')]){_0x5050de[_0xbd2b('0x36')]=[{'all':!![]}];}_0x5050de=_[_0xbd2b('0x3d')]({},_0x5050de,_0x534741['options']);return db['CmHopper'][_0xbd2b('0x3e')](_0x5050de)['then'](handleEntityNotFound(_0x252f0b,null))[_0xbd2b('0xe')](respondWithResult(_0x252f0b,null))[_0xbd2b('0x39')](handleError(_0x252f0b,null));};exports[_0xbd2b('0x3f')]=function(_0x37b408,_0x31d752){return db[_0xbd2b('0x16')][_0xbd2b('0x3f')](_0x37b408[_0xbd2b('0x40')],{})['then'](respondWithResult(_0x31d752,0xc9))[_0xbd2b('0x39')](handleError(_0x31d752,null));};exports['update']=function(_0x545fad,_0x59ea00){if(_0x545fad[_0xbd2b('0x40')]['id']){delete _0x545fad['body']['id'];}return db[_0xbd2b('0x16')][_0xbd2b('0x3e')]({'where':{'id':_0x545fad[_0xbd2b('0x41')]['id']}})['then'](handleEntityNotFound(_0x59ea00,null))[_0xbd2b('0xe')](saveUpdates(_0x545fad['body'],null))[_0xbd2b('0xe')](respondWithResult(_0x59ea00,null))[_0xbd2b('0x39')](handleError(_0x59ea00,null));};exports[_0xbd2b('0x42')]=function(_0x2dae90,_0x3194af){return db[_0xbd2b('0x16')]['describe']()[_0xbd2b('0xe')](respondWithResult(_0x3194af,null))[_0xbd2b('0x39')](handleError(_0x3194af,null));};exports[_0xbd2b('0x43')]=function(_0x18361d,_0x3cf8be){var _0x9a66d;var _0x64eb80=_0x18361d['params']['id'];return db[_0xbd2b('0x16')]['find']({'where':{'id':_0x18361d[_0xbd2b('0x41')]['id']}})[_0xbd2b('0xe')](handleEntityNotFound(_0x3cf8be,null))[_0xbd2b('0xe')](function(_0xc094ae){if(_0xc094ae){return _0xc094ae[_0xbd2b('0x43')]()[_0xbd2b('0xe')](function(_0x304d11){return _0x304d11;});}})[_0xbd2b('0xe')](function(_0x3a343b){_0x9a66d=_0x3a343b;if(_0x3a343b){if(_0x3a343b[_0xbd2b('0x44')]||_0x3a343b[_0xbd2b('0x45')]){return db[_0x3a343b['VoiceQueueId']?_0xbd2b('0x46'):'Campaign'][_0xbd2b('0x3e')]({'where':{'id':_0x3a343b['VoiceQueueId']?_0x3a343b[_0xbd2b('0x44')]:_0x3a343b[_0xbd2b('0x45')]},'attributes':['id',_0xbd2b('0x12')],'raw':!![]});}}})[_0xbd2b('0xe')](function(_0x50d373){var _0x3854c6={};if(_0x50d373){_[_0xbd2b('0x3d')](_0x3854c6,_[_0xbd2b('0x47')](_0x9a66d[_0xbd2b('0x48')],[_0xbd2b('0x49'),_0xbd2b('0x4a'),'id']));_0x3854c6['state']=0x15;_0x3854c6['statedesc']='deleted';_0x3854c6[_0xbd2b('0x4b')]=_0x50d373[_0xbd2b('0x12')];_0x3854c6['membername']=_0x18361d[_0xbd2b('0x4c')][_0xbd2b('0x12')];_0x3854c6[_0xbd2b('0x4d')]=_0x18361d[_0xbd2b('0x4c')]['id'];_0x3854c6['deleted']=!![];_0x3854c6['deletedat']=moment()[_0xbd2b('0x4e')](_0xbd2b('0x4f'));_0x3854c6[_0xbd2b('0x50')]=_0x9a66d[_0xbd2b('0x51')];_0x3854c6[_0xbd2b('0x52')]=_0x9a66d['VoiceQueueId']?_0xbd2b('0x53'):'ivr';return db[_0xbd2b('0x54')][_0xbd2b('0x3e')]({'where':{'id':_0x3854c6[_0xbd2b('0x55')]},'attributes':[_0xbd2b('0x56'),_0xbd2b('0x57')]})[_0xbd2b('0xe')](function(_0xc49804){if(!_[_0xbd2b('0x58')](_0x3cf8be)&&!_[_0xbd2b('0x58')](_0xc49804[_0xbd2b('0x56')])){_0x3854c6[_0xbd2b('0x59')]=_0xc49804[_0xbd2b('0x56')];if(!_[_0xbd2b('0x58')](_0xc49804[_0xbd2b('0x57')])){_0x3854c6[_0xbd2b('0x59')]+='\x20'+_0xc49804['lastName'];}}})[_0xbd2b('0x5a')](function(){return db[_0xbd2b('0x5b')]['create'](_0x3854c6);});}})['then'](function(_0x2d54bd){return db[_0xbd2b('0x5c')]['destroy']({'where':{'CmHopperId':_0x64eb80}});})[_0xbd2b('0xe')](function(){return _0x3cf8be[_0xbd2b('0x5')](0xcc)[_0xbd2b('0x5d')]();})['catch'](handleError(_0x3cf8be,null));};exports[_0xbd2b('0x5e')]=function(_0x45e8c5,_0x139e86){var _0x47c700=[];return db[_0xbd2b('0x54')][_0xbd2b('0x42')]()[_0xbd2b('0xe')](function(_0x26ac87){_0x47c700=_['keys'](_0x26ac87);return _0x45e8c5['user'][_0xbd2b('0x5f')]({'where':{'type':_0xbd2b('0x60'),'dialActive':!![],'dialMethod':_0xbd2b('0x61')},'attributes':['id',_0xbd2b('0x62'),_0xbd2b('0x63')],'raw':!![]});})[_0xbd2b('0xe')](function(_0x1b475f){if(_0x1b475f&&_0x1b475f[_0xbd2b('0x2d')]){return db['sequelize'][_0xbd2b('0x64')](function(_0xbaf13e){var _0x5aed9b={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xbd2b('0x4e')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0xbd2b('0x15')](_0x1b475f,'id')},'$or':[{'UserId':null},{'UserId':_0x45e8c5[_0xbd2b('0x4c')]['id']}]};var _0xed811f={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x1b475f)['filter'](['dialPreviewAutoRecallMe',0x0])[_0xbd2b('0x15')]('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x45e8c5[_0xbd2b('0x4c')]['id']}]};var _0x1e832f={'$or':[_0x5aed9b,_0xed811f]};var _0x3bc96a=[];if(_0x45e8c5['body'][_0xbd2b('0x65')]&&_0x45e8c5[_0xbd2b('0x40')][_0xbd2b('0x65')]===_0xbd2b('0x66')){if(!_['isEmpty'](_0x45e8c5[_0xbd2b('0x40')][_0xbd2b('0x67')])){_0x1e832f['id']={'$in':_0x45e8c5[_0xbd2b('0x40')][_0xbd2b('0x67')]};}_0x3bc96a=[[_0xbd2b('0x68'),_0xbd2b('0x69')],[_0xbd2b('0x6a'),_0x1b475f[0x0]['dialOrderByScheduledAt']===_0xbd2b('0x69')?_0xbd2b('0x6b'):_0xbd2b('0x69')],db[_0xbd2b('0x6c')][_0xbd2b('0x6d')](_0xbd2b('0x6e')),['id',_0xbd2b('0x6b')]];}else{if(!_[_0xbd2b('0x6f')](_0x45e8c5['body'][_0xbd2b('0x67')])){_0x1e832f['id']={'$notIn':_0x45e8c5[_0xbd2b('0x40')][_0xbd2b('0x67')]};}_0x3bc96a=[['priority',_0xbd2b('0x6b')],[_0xbd2b('0x6a'),_0x1b475f[0x0][_0xbd2b('0x62')]],db[_0xbd2b('0x6c')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0xbd2b('0x69')]];}return db['CmHopper'][_0xbd2b('0x70')]({'attributes':['id','scheduledat','phone',_0xbd2b('0x71')],'where':_0x1e832f,'order':_0x3bc96a,'transaction':_0xbaf13e,'lock':_0xbaf13e[_0xbd2b('0x72')][_0xbd2b('0x73')],'include':[{'model':db[_0xbd2b('0x54')],'as':_0xbd2b('0x74'),'attributes':_0x47c700,'include':[{'model':db[_0xbd2b('0x75')],'as':'Company','attributes':['id','name']}]},{'model':db[_0xbd2b('0x76')],'as':_0xbd2b('0x77'),'attributes':['id',_0xbd2b('0x12')]},{'model':db[_0xbd2b('0x46')],'as':'Queue','attributes':['id',_0xbd2b('0x12'),_0xbd2b('0x78')]}]})[_0xbd2b('0xe')](function(_0x1abd04){if(_0x1abd04){return _0x1abd04[_0xbd2b('0xd')]({'UserId':_0x45e8c5[_0xbd2b('0x4c')]['id']},{'transaction':_0xbaf13e});}});});}})[_0xbd2b('0xe')](handleEntityNotFound(_0x139e86,null))[_0xbd2b('0xe')](respondWithResult(_0x139e86,null))[_0xbd2b('0x39')](handleError(_0x139e86,null));};exports[_0xbd2b('0x79')]=function(_0xf893c9,_0x38a514,_0x3cd300){var _0x322a14=[];var _0x4f1b0c=_0xf893c9['params']['id'];var _0x51cf38=_0xf893c9[_0xbd2b('0x4c')]['id'];return db[_0xbd2b('0x54')]['describe']()[_0xbd2b('0xe')](function(_0x188291){_0x322a14=_[_0xbd2b('0x3b')](_0x188291);return db[_0xbd2b('0x6c')][_0xbd2b('0x64')](function(_0x49023e){const _0x280b1c={'id':_0x4f1b0c};return db[_0xbd2b('0x16')][_0xbd2b('0x70')]({'attributes':['id',_0xbd2b('0x7a'),_0xbd2b('0x71')],'where':_0x280b1c,'transaction':_0x49023e,'lock':_0x49023e[_0xbd2b('0x72')][_0xbd2b('0x73')],'include':[{'model':db[_0xbd2b('0x54')],'as':'Contact','attributes':_0x322a14,'include':[{'model':db['CmCompany'],'as':'Company','attributes':['id',_0xbd2b('0x12')]}]},{'model':db[_0xbd2b('0x76')],'as':_0xbd2b('0x77'),'attributes':['id','name']},{'model':db[_0xbd2b('0x46')],'as':_0xbd2b('0x7b'),'attributes':['id','name','dialActive']}]})[_0xbd2b('0xe')](function(_0x342c65){if(_0x342c65){return _0x342c65[_0xbd2b('0xd')]({'UserId':_0x51cf38},{'transaction':_0x49023e});}});});})[_0xbd2b('0xe')](handleEntityNotFound(_0x38a514,null))[_0xbd2b('0xe')](respondWithResult(_0x38a514,null))['catch'](handleError(_0x38a514,null));};exports['getOpenContacts']=function(_0x41527b,_0x40c5fb){return _0x41527b['user'][_0xbd2b('0x5f')]({'where':{'type':_0xbd2b('0x60'),'dialActive':!![],'dialMethod':_0xbd2b('0x61')},'attributes':['id'],'raw':!![]})[_0xbd2b('0xe')](function(_0x8b15fb){if(_0x8b15fb&&_0x8b15fb[_0xbd2b('0x2d')]){return db[_0xbd2b('0x16')][_0xbd2b('0xa')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xbd2b('0x4e')](_0xbd2b('0x4f'))},'VoiceQueueId':{'$in':_[_0xbd2b('0x15')](_0x8b15fb,'id')},'$or':[{'UserId':null},{'UserId':_0x41527b[_0xbd2b('0x4c')]['id']}]}});}return 0x0;})['then'](function(_0x198f9b){if(!_[_0xbd2b('0x58')](_0x198f9b)&&_['isNumber'](_0x198f9b)){return _0x40c5fb[_0xbd2b('0x5')](0xc8)[_0xbd2b('0x6')]({'contacts':_0x198f9b});}else{logger['error'](_0xbd2b('0x7c'),_0xbd2b('0x7d'),0x194,_0xbd2b('0x7e'));_0x40c5fb[_0xbd2b('0xf')](0x194);}})[_0xbd2b('0x39')](handleError(_0x40c5fb,null));};exports['getTimezones']=function(_0x2bd92b,_0x57a458){var _0x5ca66a=shared[_0xbd2b('0x7f')];var _0x45f0b3=[];_[_0xbd2b('0x15')](_0x5ca66a,function(_0x2172db){_0x45f0b3[_0xbd2b('0x80')]({'id':_0x2172db['name'],'name':_0x2172db[_0xbd2b('0x12')],'utcOffset':_0x2172db[_0xbd2b('0x81')]});});return _0x57a458[_0xbd2b('0x5')](0xc8)[_0xbd2b('0x6')]({'tz':_0x45f0b3});};exports['getTimezone']=function(_0x40f0d3,_0x107811){var _0x59567e=shared[_0xbd2b('0x7f')];var _0x288658={};if(!_[_0xbd2b('0x58')](_0x59567e[_0x40f0d3[_0xbd2b('0x40')]['id']]))_0x288658=_0x59567e[_0x40f0d3[_0xbd2b('0x40')]['id']];return _0x107811['status'](0xc8)[_0xbd2b('0x6')](_0x288658);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index cf2b9a0..7525700 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 _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 +var _0x524e=['define','CmHopper','scheduledat','phone','priority','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports'];(function(_0x52cb80,_0x4d97f0){var _0x5339fc=function(_0x247730){while(--_0x247730){_0x52cb80['push'](_0x52cb80['shift']());}};_0x5339fc(++_0x4d97f0);}(_0x524e,0x15e));var _0xe524=function(_0x5376d8,_0x15da6e){_0x5376d8=_0x5376d8-0x0;var _0x38cd44=_0x524e[_0x5376d8];return _0x38cd44;};'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':'cm_hopper','paranoid':![],'indexes':[{'name':_0xe524('0xc'),'fields':[_0xe524('0xc')]},{'name':_0xe524('0xd'),'fields':[_0xe524('0xd')]},{'name':_0xe524('0xe'),'fields':[_0xe524('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 fa2a832..74d81df 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 _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 +var _0x6a08=['CreateCmHopper','body','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','transaction','LOCK','Agent','UserId','push','update','all','length','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','sequelize','CmHopperFinal','create','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','order','UPDATE','GetContactRecallMe','Contact','keys','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','User','name','voicePause','CmList','List','NOW()','lodash','util','moment','../../mysqldb','../../config/logger','rpc','CmHopper','findAll','options','raw','limit','include','map','attributes','model','then','info','debug','GetCmHopper','stringify','catch','error','message','find','where','ShowCmHopper'];(function(_0x14490c,_0x50e8ab){var _0x2f6825=function(_0x477b03){while(--_0x477b03){_0x14490c['push'](_0x14490c['shift']());}};_0x2f6825(++_0x50e8ab);}(_0x6a08,0x88));var _0x86a0=function(_0x650e11,_0x284f86){_0x650e11=_0x650e11-0x0;var _0x1a9b47=_0x6a08[_0x650e11];return _0x1a9b47;};'use strict';var _=require(_0x86a0('0x0'));var util=require(_0x86a0('0x1'));var moment=require(_0x86a0('0x2'));var BPromise=require('bluebird');var db=require(_0x86a0('0x3'))['db'];var logger=require(_0x86a0('0x4'))(_0x86a0('0x5'));exports['GetCmHopper']=function(_0x3ee833){var _0x356c2c=this;return new Promise(function(_0x4f98d7,_0x303395){return db[_0x86a0('0x6')][_0x86a0('0x7')]({'raw':_0x3ee833[_0x86a0('0x8')]?_0x3ee833['options'][_0x86a0('0x9')]===undefined?!![]:![]:!![],'where':_0x3ee833[_0x86a0('0x8')]?_0x3ee833[_0x86a0('0x8')]['where']||null:null,'attributes':_0x3ee833[_0x86a0('0x8')]?_0x3ee833['options']['attributes']||null:null,'limit':_0x3ee833[_0x86a0('0x8')]?_0x3ee833[_0x86a0('0x8')][_0x86a0('0xa')]||null:null,'include':_0x3ee833['options']?_0x3ee833[_0x86a0('0x8')][_0x86a0('0xb')]?_[_0x86a0('0xc')](_0x3ee833[_0x86a0('0x8')][_0x86a0('0xb')],function(_0x333953){return{'model':db[_0x333953['model']],'as':_0x333953['as'],'attributes':_0x333953[_0x86a0('0xd')],'include':_0x333953['include']?_[_0x86a0('0xc')](_0x333953['include'],function(_0x34df28){return{'model':db[_0x34df28['model']],'as':_0x34df28['as'],'attributes':_0x34df28[_0x86a0('0xd')],'include':_0x34df28[_0x86a0('0xb')]?_['map'](_0x34df28['include'],function(_0x556ae7){return{'model':db[_0x556ae7[_0x86a0('0xe')]],'as':_0x556ae7['as'],'attributes':_0x556ae7[_0x86a0('0xd')]};}):[]};}):[]};}):[]:[]})[_0x86a0('0xf')](function(_0x302e30){logger[_0x86a0('0x10')]('GetCmHopper',_0x3ee833);logger[_0x86a0('0x11')](_0x86a0('0x12'),_0x3ee833,JSON[_0x86a0('0x13')](_0x302e30));_0x4f98d7(_0x302e30);})[_0x86a0('0x14')](function(_0xdeedee){logger[_0x86a0('0x15')](_0x86a0('0x12'),_0xdeedee[_0x86a0('0x16')],_0x3ee833);_0x303395(_0x356c2c[_0x86a0('0x15')](0x1f4,_0xdeedee[_0x86a0('0x16')]));});});};exports['ShowCmHopper']=function(_0x4c207e){var _0x19f170=this;return new Promise(function(_0x3651c4,_0x183a69){return db[_0x86a0('0x6')][_0x86a0('0x17')]({'raw':_0x4c207e[_0x86a0('0x8')]?_0x4c207e[_0x86a0('0x8')][_0x86a0('0x9')]===undefined?!![]:![]:!![],'where':_0x4c207e['options']?_0x4c207e[_0x86a0('0x8')][_0x86a0('0x18')]||null:null,'attributes':_0x4c207e['options']?_0x4c207e['options'][_0x86a0('0xd')]||null:null,'include':_0x4c207e[_0x86a0('0x8')]?_0x4c207e[_0x86a0('0x8')]['include']?_['map'](_0x4c207e['options'][_0x86a0('0xb')],function(_0x4b64aa){return{'model':db[_0x4b64aa[_0x86a0('0xe')]],'as':_0x4b64aa['as'],'attributes':_0x4b64aa['attributes'],'include':_0x4b64aa[_0x86a0('0xb')]?_[_0x86a0('0xc')](_0x4b64aa[_0x86a0('0xb')],function(_0x45b8b7){return{'model':db[_0x45b8b7['model']],'as':_0x45b8b7['as'],'attributes':_0x45b8b7[_0x86a0('0xd')],'include':_0x45b8b7[_0x86a0('0xb')]?_[_0x86a0('0xc')](_0x45b8b7[_0x86a0('0xb')],function(_0x4ff815){return{'model':db[_0x4ff815[_0x86a0('0xe')]],'as':_0x4ff815['as'],'attributes':_0x4ff815[_0x86a0('0xd')]};}):[]};}):[]};}):[]:[]})[_0x86a0('0xf')](function(_0x308587){logger[_0x86a0('0x10')](_0x86a0('0x19'),_0x4c207e);logger[_0x86a0('0x11')](_0x86a0('0x19'),_0x4c207e,JSON[_0x86a0('0x13')](_0x308587));_0x3651c4(_0x308587);})[_0x86a0('0x14')](function(_0x403b4e){logger['error'](_0x86a0('0x19'),_0x403b4e[_0x86a0('0x16')],_0x4c207e);_0x183a69(_0x19f170[_0x86a0('0x15')](0x1f4,_0x403b4e[_0x86a0('0x16')]));});});};exports[_0x86a0('0x1a')]=function(_0x20cb64){var _0x4330ee=this;return new Promise(function(_0x1760ab,_0x3a2671){return db[_0x86a0('0x6')]['create'](_0x20cb64[_0x86a0('0x1b')],{'raw':_0x20cb64[_0x86a0('0x8')]?_0x20cb64[_0x86a0('0x8')][_0x86a0('0x9')]===undefined?!![]:![]:!![]})['then'](function(_0x41a66d){logger['info'](_0x86a0('0x1a'),_0x20cb64);logger[_0x86a0('0x11')](_0x86a0('0x1a'),_0x20cb64,JSON[_0x86a0('0x13')](_0x41a66d));_0x1760ab(_0x41a66d);})['catch'](function(_0x211f5c){logger[_0x86a0('0x15')](_0x86a0('0x1a'),_0x211f5c[_0x86a0('0x16')],_0x20cb64);_0x3a2671(_0x4330ee[_0x86a0('0x15')](0x1f4,_0x211f5c['message']));});});};exports[_0x86a0('0x1c')]=function(_0x11a7bb){var _0x6ab724=this;return new Promise(function(_0x247df6,_0x51e153){return db[_0x86a0('0x6')]['update'](_0x11a7bb[_0x86a0('0x1b')],{'raw':_0x11a7bb[_0x86a0('0x8')]?_0x11a7bb[_0x86a0('0x8')][_0x86a0('0x9')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11a7bb[_0x86a0('0x8')]?_0x11a7bb[_0x86a0('0x8')][_0x86a0('0x18')]||null:null,'attributes':_0x11a7bb[_0x86a0('0x8')]?_0x11a7bb['options']['attributes']||null:null,'limit':_0x11a7bb[_0x86a0('0x8')]?_0x11a7bb[_0x86a0('0x8')][_0x86a0('0xa')]||null:null})['then'](function(_0x49d335){logger['info'](_0x86a0('0x1c'),_0x11a7bb);logger[_0x86a0('0x10')](_0x86a0('0x1d'),JSON[_0x86a0('0x13')](_0x11a7bb[_0x86a0('0x8')][_0x86a0('0x18')]),_0x11a7bb['body'][_0x86a0('0x1e')]);logger[_0x86a0('0x11')](_0x86a0('0x1c'),_0x11a7bb,JSON[_0x86a0('0x13')](_0x49d335));_0x247df6(_0x49d335);})[_0x86a0('0x14')](function(_0xe82184){logger['error'](_0x86a0('0x1c'),_0xe82184['message'],_0x11a7bb);_0x51e153(_0x6ab724['error'](0x1f4,_0xe82184[_0x86a0('0x16')]));});});};exports[_0x86a0('0x1f')]=function(_0x3a2a68){var _0x2749cd=this;return new Promise(function(_0x1d10c5,_0xad4d8b){return db[_0x86a0('0x6')][_0x86a0('0x20')]({'where':_0x3a2a68['options']?_0x3a2a68['options'][_0x86a0('0x18')]||null:null})['then'](function(_0x45e9b9){logger['info']('DestroyCmHopper',_0x3a2a68);logger['debug'](_0x86a0('0x1f'),_0x3a2a68,JSON['stringify'](_0x45e9b9));_0x1d10c5(_0x45e9b9);})['catch'](function(_0x104d4d){logger[_0x86a0('0x15')](_0x86a0('0x1f'),_0x104d4d[_0x86a0('0x16')],_0x3a2a68);_0xad4d8b(_0x2749cd[_0x86a0('0x15')](0x1f4,_0x104d4d[_0x86a0('0x16')]));});});};exports[_0x86a0('0x21')]=function(_0x2fd9db){var _0x560683=this;return new Promise(function(_0x3d88b1,_0x40c786){return db[_0x86a0('0x22')][_0x86a0('0x23')]()[_0x86a0('0xf')](function(_0x5fdd2e){return db['sequelize'][_0x86a0('0x24')](function(_0x47e810){return db[_0x86a0('0x6')]['findAll']({'where':_0x2fd9db[_0x86a0('0x8')]?_0x2fd9db[_0x86a0('0x8')][_0x86a0('0x18')]||null:null,'attributes':_0x2fd9db[_0x86a0('0x8')]?_0x2fd9db[_0x86a0('0x8')][_0x86a0('0xd')]||null:null,'limit':_0x2fd9db['options']?_0x2fd9db[_0x86a0('0x8')][_0x86a0('0xa')]||null:null,'order':_0x2fd9db[_0x86a0('0x8')]?_0x2fd9db[_0x86a0('0x8')]['order']||null:null,'transaction':_0x47e810,'lock':_0x47e810[_0x86a0('0x25')]['UPDATE'],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_['keys'](_0x5fdd2e)},{'model':db['User'],'as':_0x86a0('0x26'),'attributes':['id','name','voicePause']}]})[_0x86a0('0xf')](function(_0x2c6291){var _0x39068b=[];var _0x4b17cd=[];for(var _0x3e58d0=0x0;_0x3e58d0<_0x2c6291['length'];_0x3e58d0+=0x1){var _0x4eb144=_0x2c6291[_0x3e58d0][_0x86a0('0x27')];if(_0x4eb144===null){_0x39068b[_0x86a0('0x28')](_0x2c6291[_0x3e58d0][_0x86a0('0x29')](_0x2fd9db[_0x86a0('0x1b')],{'transaction':_0x47e810}));}else if(!_0x4b17cd['includes'](_0x4eb144)){_0x4b17cd[_0x86a0('0x28')](_0x4eb144);_0x39068b[_0x86a0('0x28')](_0x2c6291[_0x3e58d0][_0x86a0('0x29')](_0x2fd9db[_0x86a0('0x1b')],{'transaction':_0x47e810}));}}return BPromise[_0x86a0('0x2a')](_0x39068b);});})[_0x86a0('0xf')](function(_0x264716){logger[_0x86a0('0x10')](_0x86a0('0x21'),_0x2fd9db);if(_0x264716[_0x86a0('0x2b')]>0x0){logger[_0x86a0('0x10')](_0x86a0('0x2c'),_0x264716[0x0][_0x86a0('0x2d')]['id'],_0x264716[0x0][_0x86a0('0x2d')][_0x86a0('0x2e')],_0x264716[0x0][_0x86a0('0x2d')]['active']);}logger['debug'](_0x86a0('0x21'),_0x2fd9db,JSON[_0x86a0('0x13')](_0x264716));_0x3d88b1(_0x264716);})[_0x86a0('0x14')](function(_0x4bb26b){logger[_0x86a0('0x15')]('GetContactDialer',_0x4bb26b[_0x86a0('0x16')],_0x2fd9db);_0x40c786(_0x560683[_0x86a0('0x15')](0x1f4,_0x4bb26b['message']));});});});};exports[_0x86a0('0x2f')]=function(_0x86e977){var _0x3481dd=this;return new Promise(function(_0x52d321,_0x531d69){return db[_0x86a0('0x30')][_0x86a0('0x24')](function(_0x4b767f){return db[_0x86a0('0x31')][_0x86a0('0x32')](_0x86e977[_0x86a0('0x1b')],{'raw':_0x86e977[_0x86a0('0x8')]?_0x86e977['options'][_0x86a0('0x9')]===undefined?!![]:![]:!![],'transaction':_0x4b767f})[_0x86a0('0xf')](function(){logger[_0x86a0('0x10')](_0x86a0('0x33'),JSON[_0x86a0('0x13')](_0x86e977[_0x86a0('0x8')][_0x86a0('0x18')]),_0x86e977[_0x86a0('0x8')]['where'][_0x86a0('0x1e')]);return db[_0x86a0('0x6')][_0x86a0('0x20')]({'where':_0x86e977[_0x86a0('0x8')]?_0x86e977[_0x86a0('0x8')][_0x86a0('0x18')]||null:null,'transaction':_0x4b767f});});})['then'](function(_0x54efdb){logger[_0x86a0('0x10')](_0x86a0('0x2f'),_0x86e977);logger[_0x86a0('0x11')](_0x86a0('0x2f'),_0x86e977,JSON[_0x86a0('0x13')](_0x54efdb));_0x52d321(_0x54efdb);})[_0x86a0('0x14')](function(_0x54843e){logger[_0x86a0('0x15')](_0x86a0('0x2f'),_0x54843e[_0x86a0('0x16')],_0x86e977);_0x531d69(_0x3481dd['error'](0x1f4,_0x54843e[_0x86a0('0x16')]));});});};exports[_0x86a0('0x34')]=function(_0x32bbc6){var _0x262ec5=this;return new Promise(function(_0x2be17c,_0x5aab72){return db[_0x86a0('0x6')][_0x86a0('0x7')]({'raw':_0x32bbc6['options']?_0x32bbc6[_0x86a0('0x8')][_0x86a0('0x9')]===undefined?!![]:![]:!![],'where':_0x32bbc6[_0x86a0('0x8')]?_0x32bbc6['options'][_0x86a0('0x18')]||null:null,'attributes':[[db[_0x86a0('0x30')]['fn'](_0x86a0('0x35'),db[_0x86a0('0x30')]['fn']('IF',db[_0x86a0('0x30')][_0x86a0('0x36')](_0x86a0('0x37')+util[_0x86a0('0x38')](_0x86a0('0x39'),moment()[_0x86a0('0x38')](_0x86a0('0x3a')))+'\x20,\x201,\x20null'))),'contactsRescheduled']]})['then'](function(_0x404b00){logger[_0x86a0('0x10')](_0x86a0('0x34'),_0x32bbc6);logger[_0x86a0('0x11')]('CountReScheduled',_0x32bbc6,JSON[_0x86a0('0x13')](_0x404b00));_0x2be17c(_0x404b00);})[_0x86a0('0x14')](function(_0x442f4e){logger[_0x86a0('0x15')]('CountReScheduled',_0x442f4e[_0x86a0('0x16')],_0x32bbc6);_0x5aab72(_0x262ec5['error'](0x1f4,_0x442f4e[_0x86a0('0x16')]));});});};exports['GetContactRecallMe']=function(_0x1d882f){var _0x431c75=this;return new Promise(function(_0x203ddb,_0x39cb29){return db[_0x86a0('0x22')]['describe']()[_0x86a0('0xf')](function(){return db[_0x86a0('0x30')][_0x86a0('0x24')](function(_0x419331){return db[_0x86a0('0x6')][_0x86a0('0x7')]({'where':_0x1d882f[_0x86a0('0x8')]?_0x1d882f[_0x86a0('0x8')][_0x86a0('0x18')]||null:null,'attributes':_0x1d882f[_0x86a0('0x8')]?_0x1d882f[_0x86a0('0x8')][_0x86a0('0xd')]||null:null,'limit':0x1,'order':_0x1d882f['options']?_0x1d882f[_0x86a0('0x8')][_0x86a0('0x3b')]||null:null,'group':db['CmHopper'][_0x86a0('0x27')],'transaction':_0x419331,'lock':_0x419331[_0x86a0('0x25')][_0x86a0('0x3c')],'include':_0x1d882f['options']?_0x1d882f[_0x86a0('0x8')][_0x86a0('0xb')]?_[_0x86a0('0xc')](_0x1d882f[_0x86a0('0x8')][_0x86a0('0xb')],function(_0x391bdd){return{'model':db[_0x391bdd[_0x86a0('0xe')]],'as':_0x391bdd['as'],'attributes':_0x391bdd['attributes'],'include':_0x391bdd[_0x86a0('0xb')]?_['map'](_0x391bdd[_0x86a0('0xb')],function(_0x38ac96){return{'model':db[_0x38ac96[_0x86a0('0xe')]],'as':_0x38ac96['as'],'attributes':_0x38ac96[_0x86a0('0xd')],'include':_0x38ac96['include']?_['map'](_0x38ac96['include'],function(_0x179609){return{'model':db[_0x179609['model']],'as':_0x179609['as'],'attributes':_0x179609['attributes']};}):[]};}):[]};}):[]:[]})[_0x86a0('0xf')](function(_0x16ab54){var _0x581b42=[];for(var _0x4d7a54=0x0;_0x4d7a54<_0x16ab54[_0x86a0('0x2b')];_0x4d7a54+=0x1){_0x581b42[_0x86a0('0x28')](_0x16ab54[_0x4d7a54][_0x86a0('0x29')](_0x1d882f[_0x86a0('0x1b')],{'transaction':_0x419331}));}return BPromise[_0x86a0('0x2a')](_0x581b42);});})[_0x86a0('0xf')](function(_0x27b1d6){logger[_0x86a0('0x10')]('GetContactRecallMe',_0x1d882f);logger[_0x86a0('0x11')](_0x86a0('0x3d'),_0x1d882f,JSON[_0x86a0('0x13')](_0x27b1d6));_0x203ddb(_0x27b1d6);})[_0x86a0('0x14')](function(_0xf586f8){logger[_0x86a0('0x15')](_0x86a0('0x3d'),_0xf586f8[_0x86a0('0x16')],_0x1d882f);_0x39cb29(_0x431c75[_0x86a0('0x15')](0x1f4,_0xf586f8[_0x86a0('0x16')]));});});});};exports['GetCmHopperPreview']=function(_0x20669d){var _0x6957a0=this;return new Promise(function(_0x6d0917,_0x2f7992){db[_0x86a0('0x22')][_0x86a0('0x23')]()['then'](function(_0x35668d){return db['CmHopper'][_0x86a0('0x7')]({'raw':_0x20669d[_0x86a0('0x8')]?_0x20669d[_0x86a0('0x8')][_0x86a0('0x9')]===undefined?!![]:![]:!![],'where':_0x20669d['options']?_0x20669d[_0x86a0('0x8')][_0x86a0('0x18')]||null:null,'attributes':_0x20669d[_0x86a0('0x8')]?_0x20669d[_0x86a0('0x8')]['attributes']||null:null,'limit':_0x20669d['options']?_0x20669d[_0x86a0('0x8')]['limit']||null:null,'include':_0x20669d[_0x86a0('0x8')]?_0x20669d[_0x86a0('0x8')][_0x86a0('0xb')]?_[_0x86a0('0xc')](_0x20669d[_0x86a0('0x8')][_0x86a0('0xb')],function(_0x112ea2){return{'model':db[_0x112ea2[_0x86a0('0xe')]],'as':_0x112ea2['as'],'attributes':_0x112ea2['as']===_0x86a0('0x3e')?_[_0x86a0('0x3f')](_0x35668d):_0x112ea2[_0x86a0('0xd')],'include':_0x112ea2['include']?_[_0x86a0('0xc')](_0x112ea2[_0x86a0('0xb')],function(_0xdb980e){return{'model':db[_0xdb980e[_0x86a0('0xe')]],'as':_0xdb980e['as'],'attributes':_0xdb980e[_0x86a0('0xd')],'include':_0xdb980e[_0x86a0('0xb')]?_['map'](_0xdb980e[_0x86a0('0xb')],function(_0x2f5589){return{'model':db[_0x2f5589[_0x86a0('0xe')]],'as':_0x2f5589['as'],'attributes':_0x2f5589['attributes']};}):[]};}):[]};}):[]:[]})[_0x86a0('0xf')](function(_0x364b96){logger['info']('GetCmHopper',_0x20669d);logger[_0x86a0('0x11')]('GetCmHopper',_0x20669d,JSON[_0x86a0('0x13')](_0x364b96));_0x6d0917(_0x364b96);})['catch'](function(_0x2f2cfd){logger[_0x86a0('0x15')](_0x86a0('0x12'),_0x2f2cfd['message'],_0x20669d);_0x2f7992(_0x6957a0['error'](0x1f4,_0x2f2cfd[_0x86a0('0x16')]));});});});};exports[_0x86a0('0x40')]=function(_0x531669){var _0x3da964=this;return new Promise(function(_0x3969d4,_0x23c4c6){return db[_0x86a0('0x22')][_0x86a0('0x41')]({'raw':!![],'where':{'phone':_0x531669['options'][_0x86a0('0x18')][_0x86a0('0x42')]},'attributes':['id',_0x86a0('0x43')],'order':[['id',_0x86a0('0x44')]]})[_0x86a0('0xf')](function(_0x5f4aca){logger[_0x86a0('0x10')](_0x86a0('0x45'),_0x531669);logger['debug'](_0x86a0('0x45'),_0x531669,JSON[_0x86a0('0x13')](_0x5f4aca));_0x3969d4(_0x5f4aca);})[_0x86a0('0x14')](function(_0x4e7914){logger[_0x86a0('0x15')]('getContactByPhone',_0x4e7914[_0x86a0('0x16')],_0x531669);_0x23c4c6(_0x3da964[_0x86a0('0x15')](0x1f4,_0x4e7914[_0x86a0('0x16')]));});});};exports[_0x86a0('0x46')]=function(_0x28df09){var _0x34f4e1=this;return new Promise(function(_0x498fdb,_0x4042b7){return db[_0x86a0('0x30')][_0x86a0('0x24')](function(_0x268d31){var _0x11bc84=_0x28df09['options']&&_0x28df09['options']['where']?_0x28df09[_0x86a0('0x8')][_0x86a0('0x18')]:{};return db['CmHopper'][_0x86a0('0x29')](_0x28df09[_0x86a0('0x1b')],{'where':_0x11bc84,'transaction':_0x268d31})[_0x86a0('0xf')](function(_0x518881){logger[_0x86a0('0x10')]('ResetActiveCalls',_0x28df09);logger[_0x86a0('0x11')](_0x86a0('0x46'),_0x28df09,JSON[_0x86a0('0x13')](_0x518881));_0x498fdb(_0x518881);})[_0x86a0('0x14')](function(_0xbe2b55){logger[_0x86a0('0x15')]('ResetActiveCalls',_0xbe2b55[_0x86a0('0x16')],_0x28df09);_0x4042b7(_0x34f4e1['error'](0x1f4,_0xbe2b55[_0x86a0('0x16')]));});});});};exports[_0x86a0('0x47')]=function(_0x3db0d2){var _0xe83305=this;var _0x98bae3=_0x3db0d2['body']['where']['voiceQueueIds'];var _0x4a05e5=_0x3db0d2['body'][_0x86a0('0x18')][_0x86a0('0x48')];var _0x1f79c2=_0x3db0d2[_0x86a0('0x1b')]['where'][_0x86a0('0x49')];return new Promise(function(_0x5abf0d,_0x14d0a6){return db[_0x86a0('0x6')][_0x86a0('0x7')]({'where':{'voiceQueueId':{'$in':_0x98bae3},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x86a0('0x30')]['literal'](_0x86a0('0x4a')+_0x4a05e5+'\x20MINUTE'),'$gt':db['sequelize'][_0x86a0('0x36')]('NOW()')}},'UserId':{'$in':_0x1f79c2}},'include':[{'model':db['CmContact'],'as':'Contact'},{'model':db[_0x86a0('0x4b')],'as':'Agent','attributes':['id',_0x86a0('0x4c'),_0x86a0('0x4d')]},{'model':db[_0x86a0('0x4e')],'as':_0x86a0('0x4f')}]})[_0x86a0('0xf')](function(_0x1a936d){if(_0x1a936d[_0x86a0('0x2b')]>0x0){return db['sequelize']['transaction'](function(_0xb828c6){return db['CmHopper'][_0x86a0('0x29')]({'recallmeNotifiedDate':db[_0x86a0('0x30')][_0x86a0('0x36')](_0x86a0('0x50'))},{'where':{'id':{'$in':_[_0x86a0('0xc')](_0x1a936d,'id')}},'transaction':_0xb828c6})['then'](function(){_0x5abf0d(_0x1a936d);})[_0x86a0('0x14')](function(_0x275b62){logger['error'](_0x86a0('0x47'),_0x275b62[_0x86a0('0x16')],_0x3db0d2);_0x14d0a6(_0xe83305[_0x86a0('0x15')](0x1f4,_0x275b62[_0x86a0('0x16')]));});})[_0x86a0('0x14')](function(_0x250f5e){logger[_0x86a0('0x15')](_0x86a0('0x47'),_0x250f5e[_0x86a0('0x16')],_0x3db0d2);_0x14d0a6(_0xe83305[_0x86a0('0x15')](0x1f4,_0x250f5e[_0x86a0('0x16')]));});}else{_0x5abf0d(_0x1a936d);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index d687a59..3cb3c37 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 _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 +var _0xe10c=['isAuthenticated','index','/describe','describe','/opencontacts','getOpenContacts','/timezones','getTimezones','getPreviewRecall','create','post','/preview','getPreview','getTimezone','put','/:id','update','exports','express','Router','../../components/auth/service','./cmHopper.controller','get'];(function(_0x5d747e,_0x18ee9b){var _0x3f2eab=function(_0x2d275a){while(--_0x2d275a){_0x5d747e['push'](_0x5d747e['shift']());}};_0x3f2eab(++_0x18ee9b);}(_0xe10c,0x1b0));var _0xce10=function(_0xc40d7d,_0x4b8c35){_0xc40d7d=_0xc40d7d-0x0;var _0x4e82db=_0xe10c[_0xc40d7d];return _0x4e82db;};'use strict';var express=require(_0xce10('0x0'));var router=express[_0xce10('0x1')]();var auth=require(_0xce10('0x2'));var controller=require(_0xce10('0x3'));router[_0xce10('0x4')]('/',auth[_0xce10('0x5')](),controller[_0xce10('0x6')]);router[_0xce10('0x4')](_0xce10('0x7'),auth[_0xce10('0x5')](),controller[_0xce10('0x8')]);router['get'](_0xce10('0x9'),auth[_0xce10('0x5')](),controller[_0xce10('0xa')]);router[_0xce10('0x4')](_0xce10('0xb'),auth[_0xce10('0x5')](),controller[_0xce10('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0xce10('0x4')]('/:id/previewrecall',auth['isAuthenticated'](),controller[_0xce10('0xd')]);router['post']('/',auth[_0xce10('0x5')](),controller[_0xce10('0xe')]);router[_0xce10('0xf')](_0xce10('0x10'),auth[_0xce10('0x5')](),controller[_0xce10('0x11')]);router[_0xce10('0xf')]('/timezone',auth[_0xce10('0x5')](),controller[_0xce10('0x12')]);router[_0xce10('0x13')](_0xce10('0x14'),auth['isAuthenticated'](),controller[_0xce10('0x15')]);router['delete'](_0xce10('0x14'),auth[_0xce10('0x5')](),controller['destroy']);module[_0xce10('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 82803e5..8ad1c1a 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 _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 +var _0xf598=['INTEGER','DATE','YYYY-MM-DD\x20HH:mm:ss','sequelize','exports','STRING'];(function(_0x373f99,_0x394ba5){var _0x45058f=function(_0x4b3ccd){while(--_0x4b3ccd){_0x373f99['push'](_0x373f99['shift']());}};_0x45058f(++_0x394ba5);}(_0xf598,0xc3));var _0x8f59=function(_0xcf5cf5,_0x4d2a5c){_0xcf5cf5=_0xcf5cf5-0x0;var _0x42eb5e=_0xf598[_0xcf5cf5];return _0x42eb5e;};'use strict';var moment=require('moment');var Sequelize=require(_0x8f59('0x0'));module[_0x8f59('0x1')]={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize[_0x8f59('0x2')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x8f59('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x8f59('0x4')],'defaultValue':moment()['format'](_0x8f59('0x5'))},'countbusyretry':{'type':Sequelize[_0x8f59('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x8f59('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8f59('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8f59('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8f59('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8f59('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index 0f732cc..97fba8d 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 _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 +var _0x9f8c=['sendStatus','error','stack','name','send','index','CmHopperAdditionalPhone','fieldName','key','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','filters','where','merge','type','VIRTUAL','filter','options','include','catch','show','params','rawAttributes','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','moment','bluebird','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','get','CmHopperAdditionalPhones','UserProfileResource','end'];(function(_0x120343,_0x29bd4c){var _0x5361e2=function(_0x29ca40){while(--_0x29ca40){_0x120343['push'](_0x120343['shift']());}};_0x5361e2(++_0x29bd4c);}(_0x9f8c,0x121));var _0xc9f8=function(_0x4dbaf5,_0x40d23b){_0x4dbaf5=_0x4dbaf5-0x0;var _0x3cf35c=_0x9f8c[_0x4dbaf5];return _0x3cf35c;};'use strict';var emlformat=require(_0xc9f8('0x0'));var rimraf=require(_0xc9f8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc9f8('0x2'));var BPromise=require(_0xc9f8('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc9f8('0x4'));var sox=require(_0xc9f8('0x5'));var csv=require(_0xc9f8('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc9f8('0x7'));var _=require('lodash');var squel=require(_0xc9f8('0x8'));var crypto=require('crypto');var jsforce=require(_0xc9f8('0x9'));var deskjs=require(_0xc9f8('0xa'));var toCsv=require('to-csv');var querystring=require(_0xc9f8('0xb'));var Papa=require(_0xc9f8('0xc'));var Redis=require('ioredis');var authService=require(_0xc9f8('0xd'));var qs=require(_0xc9f8('0xe'));var as=require(_0xc9f8('0xf'));var hardwareService=require(_0xc9f8('0x10'));var logger=require(_0xc9f8('0x11'))(_0xc9f8('0x12'));var utils=require(_0xc9f8('0x13'));var config=require(_0xc9f8('0x14'));var licenseUtil=require(_0xc9f8('0x15'));var db=require(_0xc9f8('0x16'))['db'];function respondWithStatusCode(_0x4404df,_0xf291ba){_0xf291ba=_0xf291ba||0xcc;return function(_0x3f2005){if(_0x3f2005){return _0x4404df['sendStatus'](_0xf291ba);}return _0x4404df[_0xc9f8('0x17')](_0xf291ba)['end']();};}function respondWithResult(_0x727274,_0xec5dbe){_0xec5dbe=_0xec5dbe||0xc8;return function(_0xb7fcb5){if(_0xb7fcb5){return _0x727274[_0xc9f8('0x17')](_0xec5dbe)[_0xc9f8('0x18')](_0xb7fcb5);}};}function respondWithFilteredResult(_0x13e670,_0x3ad421){return function(_0x599a9c){if(_0x599a9c){var _0x2f979d=typeof _0x3ad421[_0xc9f8('0x19')]===_0xc9f8('0x1a')&&typeof _0x3ad421[_0xc9f8('0x1b')]===_0xc9f8('0x1a');var _0x5998af=_0x599a9c[_0xc9f8('0x1c')];var _0x6b114a=_0x2f979d?0x0:_0x3ad421[_0xc9f8('0x19')];var _0x4832ae=_0x2f979d?_0x599a9c[_0xc9f8('0x1c')]:_0x3ad421[_0xc9f8('0x19')]+_0x3ad421[_0xc9f8('0x1b')];var _0x47df87;if(_0x4832ae>=_0x5998af){_0x4832ae=_0x5998af;_0x47df87=0xc8;}else{_0x47df87=0xce;}_0x13e670[_0xc9f8('0x17')](_0x47df87);return _0x13e670[_0xc9f8('0x1d')](_0xc9f8('0x1e'),_0x6b114a+'-'+_0x4832ae+'/'+_0x5998af)[_0xc9f8('0x18')](_0x599a9c);}return null;};}function patchUpdates(_0x2a68a2){return function(_0x37218e){try{jsonpatch[_0xc9f8('0x1f')](_0x37218e,_0x2a68a2,!![]);}catch(_0x2b8701){return BPromise[_0xc9f8('0x20')](_0x2b8701);}return _0x37218e['save']();};}function saveUpdates(_0x18c0be,_0xa49ece){return function(_0x88a201){if(_0x88a201){return _0x88a201['update'](_0x18c0be)[_0xc9f8('0x21')](function(_0x47bf25){return _0x47bf25;});}return null;};}function removeEntity(_0x44d975,_0x3d884b){return function(_0x3852b4){if(_0x3852b4){return _0x3852b4[_0xc9f8('0x22')]()[_0xc9f8('0x21')](function(){var _0x286624=_0x3852b4[_0xc9f8('0x23')]({'plain':!![]});var _0x4fd3f5=_0xc9f8('0x24');return db[_0xc9f8('0x25')][_0xc9f8('0x22')]({'where':{'type':_0x4fd3f5,'resourceId':_0x286624['id']}})[_0xc9f8('0x21')](function(){return _0x3852b4;});})[_0xc9f8('0x21')](function(){_0x44d975['status'](0xcc)[_0xc9f8('0x26')]();});}};}function handleEntityNotFound(_0x3b7a60,_0x1ab717){return function(_0x42b90d){if(!_0x42b90d){_0x3b7a60[_0xc9f8('0x27')](0x194);}return _0x42b90d;};}function handleError(_0xb7129e,_0x56c75c){_0x56c75c=_0x56c75c||0x1f4;return function(_0x44fe85){logger[_0xc9f8('0x28')](_0x44fe85[_0xc9f8('0x29')]);if(_0x44fe85[_0xc9f8('0x2a')]){delete _0x44fe85['name'];}_0xb7129e[_0xc9f8('0x17')](_0x56c75c)[_0xc9f8('0x2b')](_0x44fe85);};}exports[_0xc9f8('0x2c')]=function(_0x3558fc,_0x177eca){var _0x1bc09f={},_0xf79bc4={},_0xccbdd1={'count':0x0,'rows':[]};var _0x3d379e=_['map'](db[_0xc9f8('0x2d')]['rawAttributes'],function(_0x4f54cb){return{'name':_0x4f54cb[_0xc9f8('0x2e')],'type':_0x4f54cb['type'][_0xc9f8('0x2f')]};});_0xf79bc4[_0xc9f8('0x30')]=_[_0xc9f8('0x31')](_0x3d379e,_0xc9f8('0x2a'));_0xf79bc4[_0xc9f8('0x32')]=_[_0xc9f8('0x33')](_0x3558fc[_0xc9f8('0x32')]);_0xf79bc4['filters']=_[_0xc9f8('0x34')](_0xf79bc4[_0xc9f8('0x30')],_0xf79bc4['query']);_0x1bc09f[_0xc9f8('0x35')]=_['intersection'](_0xf79bc4[_0xc9f8('0x30')],qs[_0xc9f8('0x36')](_0x3558fc[_0xc9f8('0x32')][_0xc9f8('0x36')]));_0x1bc09f[_0xc9f8('0x35')]=_0x1bc09f[_0xc9f8('0x35')]['length']?_0x1bc09f[_0xc9f8('0x35')]:_0xf79bc4[_0xc9f8('0x30')];if(!_0x3558fc[_0xc9f8('0x32')][_0xc9f8('0x37')](_0xc9f8('0x38'))){_0x1bc09f[_0xc9f8('0x1b')]=qs[_0xc9f8('0x1b')](_0x3558fc[_0xc9f8('0x32')][_0xc9f8('0x1b')]);_0x1bc09f['offset']=qs[_0xc9f8('0x19')](_0x3558fc[_0xc9f8('0x32')][_0xc9f8('0x19')]);}_0x1bc09f[_0xc9f8('0x39')]=qs['sort'](_0x3558fc[_0xc9f8('0x32')]['sort']);_0x1bc09f['where']=qs[_0xc9f8('0x3a')](_['pick'](_0x3558fc[_0xc9f8('0x32')],_0xf79bc4['filters']),_0x3d379e);if(_0x3558fc[_0xc9f8('0x32')]['filter']){_0x1bc09f[_0xc9f8('0x3b')]=_[_0xc9f8('0x3c')](_0x1bc09f[_0xc9f8('0x3b')],{'$or':_['map'](_0x3d379e,function(_0x372555){if(_0x372555[_0xc9f8('0x3d')]!==_0xc9f8('0x3e')){var _0x1aa67c={};_0x1aa67c[_0x372555[_0xc9f8('0x2a')]]={'$like':'%'+_0x3558fc[_0xc9f8('0x32')][_0xc9f8('0x3f')]+'%'};return _0x1aa67c;}})});}_0x1bc09f=_[_0xc9f8('0x3c')]({},_0x1bc09f,_0x3558fc[_0xc9f8('0x40')]);var _0x5c141c={'where':_0x1bc09f[_0xc9f8('0x3b')]};return db[_0xc9f8('0x2d')][_0xc9f8('0x1c')](_0x5c141c)['then'](function(_0x17deec){_0xccbdd1[_0xc9f8('0x1c')]=_0x17deec;if(_0x3558fc['query']['includeAll']){_0x1bc09f[_0xc9f8('0x41')]=[{'all':!![]}];}return db[_0xc9f8('0x2d')]['findAll'](_0x1bc09f);})['then'](function(_0x67fda2){_0xccbdd1['rows']=_0x67fda2;return _0xccbdd1;})[_0xc9f8('0x21')](respondWithFilteredResult(_0x177eca,_0x1bc09f))[_0xc9f8('0x42')](handleError(_0x177eca,null));};exports[_0xc9f8('0x43')]=function(_0x3174a4,_0x137ba){var _0x35d6cc={'raw':!![],'where':{'id':_0x3174a4[_0xc9f8('0x44')]['id']}},_0x2a5143={};_0x2a5143[_0xc9f8('0x30')]=_['keys'](db[_0xc9f8('0x2d')][_0xc9f8('0x45')]);_0x2a5143['query']=_[_0xc9f8('0x33')](_0x3174a4[_0xc9f8('0x32')]);_0x2a5143['filters']=_[_0xc9f8('0x34')](_0x2a5143[_0xc9f8('0x30')],_0x2a5143[_0xc9f8('0x32')]);_0x35d6cc[_0xc9f8('0x35')]=_['intersection'](_0x2a5143[_0xc9f8('0x30')],qs[_0xc9f8('0x36')](_0x3174a4[_0xc9f8('0x32')][_0xc9f8('0x36')]));_0x35d6cc[_0xc9f8('0x35')]=_0x35d6cc[_0xc9f8('0x35')][_0xc9f8('0x46')]?_0x35d6cc[_0xc9f8('0x35')]:_0x2a5143[_0xc9f8('0x30')];if(_0x3174a4[_0xc9f8('0x32')]['includeAll']){_0x35d6cc[_0xc9f8('0x41')]=[{'all':!![]}];}_0x35d6cc=_[_0xc9f8('0x3c')]({},_0x35d6cc,_0x3174a4[_0xc9f8('0x40')]);return db[_0xc9f8('0x2d')][_0xc9f8('0x47')](_0x35d6cc)[_0xc9f8('0x21')](handleEntityNotFound(_0x137ba,null))[_0xc9f8('0x21')](respondWithResult(_0x137ba,null))['catch'](handleError(_0x137ba,null));};exports[_0xc9f8('0x48')]=function(_0x394986,_0x45c235){return db['CmHopperAdditionalPhone'][_0xc9f8('0x48')](_0x394986[_0xc9f8('0x49')],{})[_0xc9f8('0x21')](function(_0x23ca18){var _0x4c2a18=_0x394986[_0xc9f8('0x4a')]['get']({'plain':!![]});if(!_0x4c2a18)throw new Error(_0xc9f8('0x4b'));if(_0x4c2a18[_0xc9f8('0x4c')]==='user'){var _0x57619c=_0x23ca18[_0xc9f8('0x23')]({'plain':!![]});var _0x322879='CmHopperAdditionalPhones';return db[_0xc9f8('0x4d')][_0xc9f8('0x47')]({'where':{'name':_0x322879,'userProfileId':_0x4c2a18[_0xc9f8('0x4e')]},'raw':!![]})[_0xc9f8('0x21')](function(_0x2616a6){if(_0x2616a6&&_0x2616a6[_0xc9f8('0x4f')]===0x0){return db[_0xc9f8('0x25')][_0xc9f8('0x48')]({'name':_0x57619c['name'],'resourceId':_0x57619c['id'],'type':_0x2616a6['name'],'sectionId':_0x2616a6['id']},{})['then'](function(){return _0x23ca18;});}else{return _0x23ca18;}})[_0xc9f8('0x42')](function(_0x569099){logger[_0xc9f8('0x28')](_0xc9f8('0x50'),_0x569099);throw _0x569099;});}return _0x23ca18;})[_0xc9f8('0x21')](respondWithResult(_0x45c235,0xc9))['catch'](handleError(_0x45c235,null));};exports[_0xc9f8('0x51')]=function(_0x24cfce,_0x513d0e){if(_0x24cfce['body']['id']){delete _0x24cfce[_0xc9f8('0x49')]['id'];}return db[_0xc9f8('0x2d')][_0xc9f8('0x47')]({'where':{'id':_0x24cfce[_0xc9f8('0x44')]['id']}})[_0xc9f8('0x21')](handleEntityNotFound(_0x513d0e,null))[_0xc9f8('0x21')](saveUpdates(_0x24cfce['body'],null))['then'](respondWithResult(_0x513d0e,null))[_0xc9f8('0x42')](handleError(_0x513d0e,null));};exports[_0xc9f8('0x22')]=function(_0x1a50c0,_0x155518){return db[_0xc9f8('0x2d')][_0xc9f8('0x47')]({'where':{'id':_0x1a50c0[_0xc9f8('0x44')]['id']}})['then'](handleEntityNotFound(_0x155518,null))[_0xc9f8('0x21')](removeEntity(_0x155518,null))['catch'](handleError(_0x155518,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index f2975bd..0d4bf36 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 _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 +var _0x063a=['lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','CmHopperAdditionalPhone','cm_hopper_additional_phones'];(function(_0x58f87d,_0x5d7ac8){var _0x549281=function(_0x35d453){while(--_0x35d453){_0x58f87d['push'](_0x58f87d['shift']());}};_0x549281(++_0x5d7ac8);}(_0x063a,0x1e0));var _0xa063=function(_0x5a5654,_0x51ae02){_0x5a5654=_0x5a5654-0x0;var _0x51680c=_0x063a[_0x5a5654];return _0x51680c;};'use strict';var _=require(_0xa063('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa063('0x1'));var moment=require('moment');var BPromise=require(_0xa063('0x2'));var rp=require(_0xa063('0x3'));var fs=require('fs');var path=require(_0xa063('0x4'));var rimraf=require(_0xa063('0x5'));var config=require(_0xa063('0x6'));var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0xa063('0x7')]=function(_0xf9c494,_0x3de8e6){return _0xf9c494['define'](_0xa063('0x8'),attributes,{'tableName':_0xa063('0x9'),'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 cc6d2b6..308c73c 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 _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 +var _0xebde=['body','ListId','VoiceQueueId','CampaignId','OrderBy','ASC','countbusyretry','countcongestionretry','countdropretry','countmachineretry','countagentrejectretry','CmHopperAdditionalPhone','countnoanswerretry','countnosuchnumberretry','entity','dialGlobalMaxRetry','duration','waitTime','isNil','scheduledat','add','minutes','phone','countabandonedretry','updatedAt','createdAt','sequelize','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','field','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','VerifyAdditionalPhones','CmHopper','findOne'];(function(_0x1cb89b,_0x5623c4){var _0x152462=function(_0x152c3e){while(--_0x152c3e){_0x1cb89b['push'](_0x1cb89b['shift']());}};_0x152462(++_0x5623c4);}(_0xebde,0x170));var _0xeebd=function(_0x265aa2,_0x220072){_0x265aa2=_0x265aa2-0x0;var _0x447a3a=_0xebde[_0x265aa2];return _0x447a3a;};'use strict';var _=require(_0xeebd('0x0'));var util=require(_0xeebd('0x1'));var moment=require(_0xeebd('0x2'));var BPromise=require(_0xeebd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeebd('0x4'));var db=require(_0xeebd('0x5'))['db'];var utils=require(_0xeebd('0x6'));var logger=require(_0xeebd('0x7'))(_0xeebd('0x8'));var config=require('../../config/environment');var jayson=require(_0xeebd('0x9'));var client=jayson['client'][_0xeebd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x12e149,_0x3e6cd8,_0x9e068a){return new BPromise(function(_0x190c2d,_0x43fd9e){return client[_0xeebd('0xb')](_0x12e149,_0x9e068a)[_0xeebd('0xc')](function(_0x243eba){logger[_0xeebd('0xd')](_0xeebd('0xe'),_0x3e6cd8,_0xeebd('0xf'));logger[_0xeebd('0x10')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x3e6cd8,_0xeebd('0xf'),JSON['stringify'](_0x243eba));if(_0x243eba[_0xeebd('0x11')]){if(_0x243eba[_0xeebd('0x11')][_0xeebd('0x12')]===0x1f4){logger[_0xeebd('0x11')](_0xeebd('0xe'),_0x3e6cd8,_0x243eba['error'][_0xeebd('0x13')]);return _0x43fd9e(_0x243eba[_0xeebd('0x11')][_0xeebd('0x13')]);}logger['error'](_0xeebd('0xe'),_0x3e6cd8,_0x243eba['error']['message']);return _0x190c2d(_0x243eba[_0xeebd('0x11')][_0xeebd('0x13')]);}else{logger[_0xeebd('0xd')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x3e6cd8,'request\x20sent');_0x190c2d(_0x243eba['result'][_0xeebd('0x13')]);}})[_0xeebd('0x14')](function(_0x162d2d){logger[_0xeebd('0x11')](_0xeebd('0xe'),_0x3e6cd8,_0x162d2d);_0x43fd9e(_0x162d2d);});});}exports[_0xeebd('0x15')]=function(_0x12eed6){var _0x3e403d=this;return new Promise(function(_0x1b338b,_0x5d89a1){return db[_0xeebd('0x16')][_0xeebd('0x17')]({'raw':!![],'where':{'ContactId':_0x12eed6[_0xeebd('0x18')]['ContactId'],'ListId':_0x12eed6['body'][_0xeebd('0x19')],'VoiceQueueId':_0x12eed6[_0xeebd('0x18')][_0xeebd('0x1a')]===undefined?null:_0x12eed6['body'][_0xeebd('0x1a')],'CampaignId':_0x12eed6[_0xeebd('0x18')][_0xeebd('0x1b')]===undefined?null:_0x12eed6[_0xeebd('0x18')]['CampaignId']}})[_0xeebd('0xc')](function(_0x116d51){if(_0x116d51!=null){return db['CmHopperAdditionalPhone'][_0xeebd('0x17')]({'raw':!![],'where':{'CmHopperId':_0x116d51['id'],'OrderBy':{'$gt':_0x116d51[_0xeebd('0x1c')]}},'order':[[_0xeebd('0x1c'),_0xeebd('0x1d')]]})[_0xeebd('0xc')](function(_0x54828b){var _0x4d4c54=0x0;if(_0x54828b){if(_0x54828b[_0xeebd('0x1e')]+_0x54828b[_0xeebd('0x1f')]+_0x54828b['countnoanswerretry']+_0x54828b['countnosuchnumberretry']+_0x54828b[_0xeebd('0x20')]+_0x54828b['countabandonedretry']+_0x54828b[_0xeebd('0x21')]+_0x54828b[_0xeebd('0x22')]<_0x12eed6['entity']['dialGlobalMaxRetry'])_0x4d4c54=0x1;_0x1b338b({'additional':_0x4d4c54});}else{return db[_0xeebd('0x23')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x116d51['id']},'order':[['OrderBy',_0xeebd('0x1d')]]})[_0xeebd('0xc')](function(_0x3890d1){var _0x3609c5=0x0;if(_0x3890d1){if(_0x3890d1['countbusyretry']+_0x3890d1[_0xeebd('0x1f')]+_0x3890d1[_0xeebd('0x24')]+_0x3890d1[_0xeebd('0x25')]+_0x3890d1[_0xeebd('0x20')]+_0x3890d1['countabandonedretry']+_0x3890d1[_0xeebd('0x21')]+_0x3890d1[_0xeebd('0x22')]<_0x12eed6[_0xeebd('0x26')][_0xeebd('0x27')])_0x3609c5=0x1;_0x1b338b({'additional':_0x3609c5});}else{_0x1b338b({'additional':0x0});}})[_0xeebd('0x14')](function(_0x590789){logger['error'](_0xeebd('0x15'),_0x590789[_0xeebd('0x13')]);_0x5d89a1(_0x3e403d[_0xeebd('0x11')](0x1f4,_0x590789[_0xeebd('0x13')]));});}})[_0xeebd('0x14')](function(_0x76c44){logger[_0xeebd('0x11')]('VerifyAdditionalPhones',_0x76c44[_0xeebd('0x13')]);_0x5d89a1(_0x3e403d[_0xeebd('0x11')](0x1f4,_0x76c44[_0xeebd('0x13')]));});}else _0x1b338b({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x358a61){var _0x38e5ec=this;return new Promise(function(_0x1ab5d8,_0x2310b1){return db['CmHopper'][_0xeebd('0x17')]({'raw':!![],'where':{'ContactId':_0x358a61['body']['ContactId'],'ListId':_0x358a61[_0xeebd('0x18')][_0xeebd('0x19')],'VoiceQueueId':_0x358a61['body'][_0xeebd('0x1a')]===undefined?null:_0x358a61[_0xeebd('0x18')]['VoiceQueueId'],'CampaignId':_0x358a61['body']['CampaignId']===undefined?null:_0x358a61['body'][_0xeebd('0x1b')]}})['then'](function(_0x2e4139){if(_0x2e4139!=null){return db['CmHopperAdditionalPhone'][_0xeebd('0x17')]({'raw':!![],'where':{'CmHopperId':_0x2e4139['id'],'OrderBy':{'$gte':_0x2e4139[_0xeebd('0x1c')]}},'order':[[_0xeebd('0x1c'),_0xeebd('0x1d')]]})[_0xeebd('0xc')](function(_0x254f39){if(_0x254f39)return activateAdditionalPhone(_0x2e4139,_0x358a61[_0xeebd('0x18')],_0x254f39,_0x358a61[_0xeebd('0x28')],_0x358a61[_0xeebd('0x29')])[_0xeebd('0xc')](function(_0x275d9e){_0x1ab5d8(_0x275d9e);});else{return db[_0xeebd('0x23')][_0xeebd('0x17')]({'raw':!![],'where':{'CmHopperId':_0x2e4139['id']},'order':[[_0xeebd('0x1c'),'ASC']]})[_0xeebd('0xc')](function(_0x4f0d8f){if(_0x4f0d8f)return activateAdditionalPhone(_0x2e4139,_0x358a61['body'],_0x4f0d8f,_0x358a61[_0xeebd('0x28')],_0x358a61['waitTime'])[_0xeebd('0xc')](function(_0x3d778f){_0x1ab5d8(_0x3d778f);});else{_0x1ab5d8({'id':_0x2e4139['id'],'phone':''});}})['catch'](function(_0x19e1b4){logger[_0xeebd('0x11')](_0xeebd('0x15'),_0x19e1b4[_0xeebd('0x13')]);_0x2310b1(_0x38e5ec['error'](0x1f4,_0x19e1b4[_0xeebd('0x13')]));});}})[_0xeebd('0x14')](function(_0x41701f){logger[_0xeebd('0x11')](_0xeebd('0x15'),_0x41701f[_0xeebd('0x13')]);_0x2310b1(_0x38e5ec[_0xeebd('0x11')](0x1f4,_0x41701f[_0xeebd('0x13')]));});}else _0x1ab5d8(0x1);});});};function activateAdditionalPhone(_0x13309c,_0x32d201,_0xcd7309,_0x11015b,_0x5da374){return new Promise(function(_0x40a207,_0x3bec2d){var _0x11a310;if(_[_0xeebd('0x2a')](_0xcd7309['scheduledat'])){_0xcd7309[_0xeebd('0x2b')]=moment();}if(moment()>moment(_0xcd7309[_0xeebd('0x2b')])){_0x11a310=moment()['add'](_0x5da374||0x3,'minutes');}else{if(_0xcd7309[_0xeebd('0x1c')]==0x0){_0x11a310=moment(_0xcd7309['scheduledat']);}else{_0x11a310=moment()[_0xeebd('0x2c')](_0x5da374||0x3,_0xeebd('0x2d'));}}if(_[_0xeebd('0x2a')](_0x11a310)){_0x11a310=moment()[_0xeebd('0x2c')](_0x5da374||0x3,'minutes');}var _0x5024f3={'phone':_0x13309c[_0xeebd('0x2e')],'active':0x0,'OrderBy':_[_0xeebd('0x2a')](_0x13309c['OrderBy'])?0x0:_0x13309c[_0xeebd('0x1c')],'scheduledat':moment()[_0xeebd('0x2c')](_0x11015b||0x1,_0xeebd('0x2d')),'countbusyretry':_0x32d201[_0xeebd('0x1e')],'countcongestionretry':_0x32d201[_0xeebd('0x1f')],'countnoanswerretry':_0x32d201['countnoanswerretry'],'countnosuchnumberretry':_0x32d201[_0xeebd('0x25')],'countdropretry':_0x32d201['countdropretry'],'countabandonedretry':_0x32d201[_0xeebd('0x2f')],'countmachineretry':_0x32d201[_0xeebd('0x21')],'countagentrejectretry':_0x32d201[_0xeebd('0x22')],'createdAt':_0x32d201['createdAt'],'updatedAt':_0x32d201[_0xeebd('0x30')]};var _0x3a4302={'CmHopperId':_0x13309c['id'],'phone':_0xcd7309[_0xeebd('0x2e')],'active':0x0,'OrderBy':_[_0xeebd('0x2a')](_0xcd7309[_0xeebd('0x1c')])?0x0:_0xcd7309[_0xeebd('0x1c')],'scheduledat':_0x11a310,'countbusyretry':_0xcd7309[_0xeebd('0x1e')],'countcongestionretry':_0xcd7309[_0xeebd('0x1f')],'countnoanswerretry':_0xcd7309['countnoanswerretry'],'countnosuchnumberretry':_0xcd7309['countnosuchnumberretry'],'countdropretry':_0xcd7309['countdropretry'],'countabandonedretry':_0xcd7309['countabandonedretry'],'countmachineretry':_0xcd7309[_0xeebd('0x21')],'countagentrejectretry':_0xcd7309[_0xeebd('0x22')],'createdAt':_0xcd7309[_0xeebd('0x31')],'updatedAt':_0xcd7309[_0xeebd('0x30')]};return db[_0xeebd('0x32')][_0xeebd('0x33')](function(_0x4e30df){return db['CmHopperAdditionalPhone'][_0xeebd('0x34')](_0x5024f3,{'where':{'id':_0xcd7309['id']}},{'transaction':_0x4e30df})[_0xeebd('0xc')](function(){return db['CmHopper'][_0xeebd('0x34')](_0x3a4302,{'where':{'id':_0x13309c['id']}},{'transaction':_0x4e30df});});})['then'](function(_0x4c381a){_0x40a207({'id':_0x13309c['id'],'phone':_0xcd7309[_0xeebd('0x2e')]});})[_0xeebd('0x14')](function(_0x44cd4a){logger['error'](_0xeebd('0x35'),_0x44cd4a[_0xeebd('0x13')]);_0x3bec2d({'error':_0x44cd4a[_0xeebd('0x13')]});});});}exports[_0xeebd('0x36')]=function(_0x3c767d){var _0x4c7c92=this;return new Promise(function(_0x3830f6,_0x139c91){return db[_0xeebd('0x16')][_0xeebd('0x34')](_0x3c767d[_0xeebd('0x18')][_0xeebd('0x37')],{'where':{'id':_0x3c767d[_0xeebd('0x18')]['id']}})[_0xeebd('0xc')](function(_0x277fa5){_0x3830f6(_0x277fa5);})[_0xeebd('0x14')](function(_0x2b1caa){logger[_0xeebd('0x11')](_0xeebd('0x36'),_0x2b1caa[_0xeebd('0x13')]);_0x139c91(_0x4c7c92[_0xeebd('0x11')](0x1f4,_0x2b1caa[_0xeebd('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index ad4d674..69be73a 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 _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 +var _0x2292=['destroy','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete'];(function(_0x254f73,_0x532104){var _0x472f28=function(_0xb7065){while(--_0xb7065){_0x254f73['push'](_0x254f73['shift']());}};_0x472f28(++_0x532104);}(_0x2292,0x11e));var _0x2229=function(_0xa05fd3,_0x4c6517){_0xa05fd3=_0xa05fd3-0x0;var _0x581738=_0x2292[_0xa05fd3];return _0x581738;};'use strict';var multer=require(_0x2229('0x0'));var util=require('util');var path=require(_0x2229('0x1'));var timeout=require(_0x2229('0x2'));var express=require(_0x2229('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2229('0x4'));var interaction=require(_0x2229('0x5'));var config=require(_0x2229('0x6'));var controller=require(_0x2229('0x7'));router[_0x2229('0x8')]('/',auth[_0x2229('0x9')](),controller[_0x2229('0xa')]);router[_0x2229('0x8')]('/:id',auth[_0x2229('0x9')](),controller[_0x2229('0xb')]);router[_0x2229('0xc')]('/',auth['isAuthenticated'](),controller[_0x2229('0xd')]);router[_0x2229('0xe')](_0x2229('0xf'),auth[_0x2229('0x9')](),controller[_0x2229('0x10')]);router[_0x2229('0x11')](_0x2229('0xf'),auth[_0x2229('0x9')](),controller[_0x2229('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 39f588a..821f45b 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 _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 +var _0x0913=['contactListQueue','moment','sequelize','INTEGER'];(function(_0x260fb9,_0x2bc9da){var _0x5326af=function(_0x3f00ae){while(--_0x3f00ae){_0x260fb9['push'](_0x260fb9['shift']());}};_0x5326af(++_0x2bc9da);}(_0x0913,0x1a5));var _0x3091=function(_0x34f640,_0x1d36f9){_0x34f640=_0x34f640-0x0;var _0x5c223d=_0x0913[_0x34f640];return _0x5c223d;};'use strict';var moment=require(_0x3091('0x0'));var Sequelize=require(_0x3091('0x1'));module['exports']={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x3091('0x2')],'unique':_0x3091('0x3')},'VoiceQueueId':{'type':Sequelize[_0x3091('0x2')],'unique':_0x3091('0x3')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 90999ce..a65a019 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 _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 +var _0xdc35=['mustache','util','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','save','update','then','end','error','stack','name','send','CmHopperBlack','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','pick','filter','merge','VIRTUAL','options','where','includeAll','include','rows','catch','show','params','keys','rawAttributes','find','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdc35,0xd3));var _0x5dc3=function(_0x46b1bd,_0x1be443){_0x46b1bd=_0x46b1bd-0x0;var _0x4d77d3=_0xdc35[_0x46b1bd];return _0x4d77d3;};'use strict';var emlformat=require(_0x5dc3('0x0'));var rimraf=require(_0x5dc3('0x1'));var zipdir=require(_0x5dc3('0x2'));var jsonpatch=require(_0x5dc3('0x3'));var rp=require('request-promise');var moment=require(_0x5dc3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5dc3('0x5'));var util=require(_0x5dc3('0x6'));var path=require('path');var sox=require(_0x5dc3('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5dc3('0x8'));var _=require(_0x5dc3('0x9'));var squel=require('squel');var crypto=require(_0x5dc3('0xa'));var jsforce=require(_0x5dc3('0xb'));var deskjs=require(_0x5dc3('0xc'));var toCsv=require(_0x5dc3('0xd'));var querystring=require(_0x5dc3('0xe'));var Papa=require('papaparse');var Redis=require(_0x5dc3('0xf'));var authService=require(_0x5dc3('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5dc3('0x11'));var hardwareService=require(_0x5dc3('0x12'));var logger=require(_0x5dc3('0x13'))(_0x5dc3('0x14'));var utils=require('../../config/utils');var config=require(_0x5dc3('0x15'));var licenseUtil=require(_0x5dc3('0x16'));var db=require(_0x5dc3('0x17'))['db'];function respondWithStatusCode(_0x80779e,_0x41f7d5){_0x41f7d5=_0x41f7d5||0xcc;return function(_0x36a6f5){if(_0x36a6f5){return _0x80779e[_0x5dc3('0x18')](_0x41f7d5);}return _0x80779e['status'](_0x41f7d5)['end']();};}function respondWithResult(_0x4404c2,_0x19536b){_0x19536b=_0x19536b||0xc8;return function(_0xad2bfc){if(_0xad2bfc){return _0x4404c2[_0x5dc3('0x19')](_0x19536b)['json'](_0xad2bfc);}};}function respondWithFilteredResult(_0x203e5a,_0x92bbd1){return function(_0x24532c){if(_0x24532c){var _0x427721=typeof _0x92bbd1[_0x5dc3('0x1a')]===_0x5dc3('0x1b')&&typeof _0x92bbd1[_0x5dc3('0x1c')]==='undefined';var _0x393eaf=_0x24532c[_0x5dc3('0x1d')];var _0x2d93a9=_0x427721?0x0:_0x92bbd1[_0x5dc3('0x1a')];var _0x134d58=_0x427721?_0x24532c[_0x5dc3('0x1d')]:_0x92bbd1[_0x5dc3('0x1a')]+_0x92bbd1[_0x5dc3('0x1c')];var _0x35c93c;if(_0x134d58>=_0x393eaf){_0x134d58=_0x393eaf;_0x35c93c=0xc8;}else{_0x35c93c=0xce;}_0x203e5a[_0x5dc3('0x19')](_0x35c93c);return _0x203e5a[_0x5dc3('0x1e')](_0x5dc3('0x1f'),_0x2d93a9+'-'+_0x134d58+'/'+_0x393eaf)[_0x5dc3('0x20')](_0x24532c);}return null;};}function patchUpdates(_0xef8f79){return function(_0x8ad8a6){try{jsonpatch['apply'](_0x8ad8a6,_0xef8f79,!![]);}catch(_0x45b84f){return BPromise['reject'](_0x45b84f);}return _0x8ad8a6[_0x5dc3('0x21')]();};}function saveUpdates(_0x279ae6,_0x75cfd1){return function(_0x20f2b3){if(_0x20f2b3){return _0x20f2b3[_0x5dc3('0x22')](_0x279ae6)[_0x5dc3('0x23')](function(_0x207caa){return _0x207caa;});}return null;};}function removeEntity(_0x4de521,_0x207d62){return function(_0x427f24){if(_0x427f24){return _0x427f24['destroy']()[_0x5dc3('0x23')](function(){_0x4de521['status'](0xcc)[_0x5dc3('0x24')]();});}};}function handleEntityNotFound(_0x8b543e,_0x48870d){return function(_0x4f7604){if(!_0x4f7604){_0x8b543e[_0x5dc3('0x18')](0x194);}return _0x4f7604;};}function handleError(_0x2429c9,_0x5c80e3){_0x5c80e3=_0x5c80e3||0x1f4;return function(_0x1be4a5){logger[_0x5dc3('0x25')](_0x1be4a5[_0x5dc3('0x26')]);if(_0x1be4a5[_0x5dc3('0x27')]){delete _0x1be4a5['name'];}_0x2429c9[_0x5dc3('0x19')](_0x5c80e3)[_0x5dc3('0x28')](_0x1be4a5);};}exports['index']=function(_0x40e4d1,_0x5bea7f){var _0x280391={},_0x1b1c0e={},_0x3329f3={'count':0x0,'rows':[]};var _0x3c8589=_['map'](db[_0x5dc3('0x29')]['rawAttributes'],function(_0x112c35){return{'name':_0x112c35[_0x5dc3('0x2a')],'type':_0x112c35[_0x5dc3('0x2b')][_0x5dc3('0x2c')]};});_0x1b1c0e[_0x5dc3('0x2d')]=_['map'](_0x3c8589,'name');_0x1b1c0e[_0x5dc3('0x2e')]=_['keys'](_0x40e4d1['query']);_0x1b1c0e[_0x5dc3('0x2f')]=_['intersection'](_0x1b1c0e['model'],_0x1b1c0e[_0x5dc3('0x2e')]);_0x280391[_0x5dc3('0x30')]=_[_0x5dc3('0x31')](_0x1b1c0e[_0x5dc3('0x2d')],qs[_0x5dc3('0x32')](_0x40e4d1['query'][_0x5dc3('0x32')]));_0x280391[_0x5dc3('0x30')]=_0x280391[_0x5dc3('0x30')][_0x5dc3('0x33')]?_0x280391['attributes']:_0x1b1c0e[_0x5dc3('0x2d')];if(!_0x40e4d1[_0x5dc3('0x2e')][_0x5dc3('0x34')](_0x5dc3('0x35'))){_0x280391['limit']=qs[_0x5dc3('0x1c')](_0x40e4d1[_0x5dc3('0x2e')][_0x5dc3('0x1c')]);_0x280391[_0x5dc3('0x1a')]=qs[_0x5dc3('0x1a')](_0x40e4d1['query'][_0x5dc3('0x1a')]);}_0x280391['order']=qs['sort'](_0x40e4d1[_0x5dc3('0x2e')]['sort']);_0x280391['where']=qs[_0x5dc3('0x2f')](_[_0x5dc3('0x36')](_0x40e4d1[_0x5dc3('0x2e')],_0x1b1c0e['filters']),_0x3c8589);if(_0x40e4d1['query'][_0x5dc3('0x37')]){_0x280391['where']=_[_0x5dc3('0x38')](_0x280391['where'],{'$or':_['map'](_0x3c8589,function(_0x9c475){if(_0x9c475['type']!==_0x5dc3('0x39')){var _0x374f1d={};_0x374f1d[_0x9c475['name']]={'$like':'%'+_0x40e4d1[_0x5dc3('0x2e')]['filter']+'%'};return _0x374f1d;}})});}_0x280391=_[_0x5dc3('0x38')]({},_0x280391,_0x40e4d1[_0x5dc3('0x3a')]);var _0x3cb2ed={'where':_0x280391[_0x5dc3('0x3b')]};return db[_0x5dc3('0x29')][_0x5dc3('0x1d')](_0x3cb2ed)[_0x5dc3('0x23')](function(_0x279384){_0x3329f3[_0x5dc3('0x1d')]=_0x279384;if(_0x40e4d1[_0x5dc3('0x2e')][_0x5dc3('0x3c')]){_0x280391[_0x5dc3('0x3d')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x280391);})['then'](function(_0x381946){_0x3329f3[_0x5dc3('0x3e')]=_0x381946;return _0x3329f3;})[_0x5dc3('0x23')](respondWithFilteredResult(_0x5bea7f,_0x280391))[_0x5dc3('0x3f')](handleError(_0x5bea7f,null));};exports[_0x5dc3('0x40')]=function(_0x223e59,_0x4b0b53){var _0x1c6ab9={'raw':!![],'where':{'id':_0x223e59[_0x5dc3('0x41')]['id']}},_0x1eec46={};_0x1eec46[_0x5dc3('0x2d')]=_[_0x5dc3('0x42')](db[_0x5dc3('0x29')][_0x5dc3('0x43')]);_0x1eec46[_0x5dc3('0x2e')]=_['keys'](_0x223e59[_0x5dc3('0x2e')]);_0x1eec46['filters']=_[_0x5dc3('0x31')](_0x1eec46[_0x5dc3('0x2d')],_0x1eec46[_0x5dc3('0x2e')]);_0x1c6ab9[_0x5dc3('0x30')]=_[_0x5dc3('0x31')](_0x1eec46[_0x5dc3('0x2d')],qs['fields'](_0x223e59[_0x5dc3('0x2e')]['fields']));_0x1c6ab9['attributes']=_0x1c6ab9['attributes'][_0x5dc3('0x33')]?_0x1c6ab9[_0x5dc3('0x30')]:_0x1eec46[_0x5dc3('0x2d')];if(_0x223e59['query'][_0x5dc3('0x3c')]){_0x1c6ab9[_0x5dc3('0x3d')]=[{'all':!![]}];}_0x1c6ab9=_[_0x5dc3('0x38')]({},_0x1c6ab9,_0x223e59[_0x5dc3('0x3a')]);return db[_0x5dc3('0x29')][_0x5dc3('0x44')](_0x1c6ab9)[_0x5dc3('0x23')](handleEntityNotFound(_0x4b0b53,null))[_0x5dc3('0x23')](respondWithResult(_0x4b0b53,null))[_0x5dc3('0x3f')](handleError(_0x4b0b53,null));};exports['update']=function(_0x33700b,_0x33319c){if(_0x33700b[_0x5dc3('0x45')]['id']){delete _0x33700b[_0x5dc3('0x45')]['id'];}return db[_0x5dc3('0x29')][_0x5dc3('0x44')]({'where':{'id':_0x33700b[_0x5dc3('0x41')]['id']}})[_0x5dc3('0x23')](handleEntityNotFound(_0x33319c,null))[_0x5dc3('0x23')](saveUpdates(_0x33700b[_0x5dc3('0x45')],null))[_0x5dc3('0x23')](respondWithResult(_0x33319c,null))[_0x5dc3('0x3f')](handleError(_0x33319c,null));};exports[_0x5dc3('0x46')]=function(_0xc49252,_0x2e867f){return db['CmHopperBlack'][_0x5dc3('0x44')]({'where':{'id':_0xc49252[_0x5dc3('0x41')]['id']}})['then'](handleEntityNotFound(_0x2e867f,null))[_0x5dc3('0x23')](removeEntity(_0x2e867f,null))[_0x5dc3('0x3f')](handleError(_0x2e867f,null));};exports[_0x5dc3('0x47')]=function(_0x409c9d,_0x383a15){return db[_0x5dc3('0x29')][_0x5dc3('0x47')]()[_0x5dc3('0x23')](respondWithResult(_0x383a15,null))[_0x5dc3('0x3f')](handleError(_0x383a15,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index d889ec6..847357b 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 _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 +var _0x09da=['exports','CmHopperBlack','cm_hopper_black','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopperBlack.attributes'];(function(_0x38a409,_0x4abdaa){var _0x24a01e=function(_0x43e98a){while(--_0x43e98a){_0x38a409['push'](_0x38a409['shift']());}};_0x24a01e(++_0x4abdaa);}(_0x09da,0x9f));var _0xa09d=function(_0x3c576b,_0x4a01f6){_0x3c576b=_0x3c576b-0x0;var _0x1889ca=_0x09da[_0x3c576b];return _0x1889ca;};'use strict';var _=require(_0xa09d('0x0'));var util=require(_0xa09d('0x1'));var logger=require('../../config/logger')(_0xa09d('0x2'));var moment=require(_0xa09d('0x3'));var BPromise=require(_0xa09d('0x4'));var rp=require(_0xa09d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa09d('0x6'));var config=require(_0xa09d('0x7'));var attributes=require(_0xa09d('0x8'));module[_0xa09d('0x9')]=function(_0x585785,_0x86cf7c){return _0x585785['define'](_0xa09d('0xa'),attributes,{'tableName':_0xa09d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index 30af030..f28a72c 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 _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 +var _0x758d=['findAll','options','raw','where','include','map','model','attributes','UpdateCmHopperBlack','update','body','stringify','destroy','DestroyCmHopperBlack','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetCmHopperBlack','CmHopperBlack'];(function(_0x2911da,_0x15b359){var _0x390d9c=function(_0x4888b8){while(--_0x4888b8){_0x2911da['push'](_0x2911da['shift']());}};_0x390d9c(++_0x15b359);}(_0x758d,0x118));var _0xd758=function(_0x407311,_0x59ae4f){_0x407311=_0x407311-0x0;var _0x4fc64e=_0x758d[_0x407311];return _0x4fc64e;};'use strict';var _=require('lodash');var util=require(_0xd758('0x0'));var moment=require('moment');var BPromise=require(_0xd758('0x1'));var rs=require(_0xd758('0x2'));var fs=require('fs');var Redis=require(_0xd758('0x3'));var db=require(_0xd758('0x4'))['db'];var utils=require(_0xd758('0x5'));var logger=require(_0xd758('0x6'))(_0xd758('0x7'));var config=require(_0xd758('0x8'));var jayson=require(_0xd758('0x9'));var client=jayson['client'][_0xd758('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x60628b,_0x3c4177,_0x1db908){return new BPromise(function(_0x393c10,_0x1ceccd){return client[_0xd758('0xb')](_0x60628b,_0x1db908)[_0xd758('0xc')](function(_0x36a9c9){logger[_0xd758('0xd')](_0xd758('0xe'),_0x3c4177,_0xd758('0xf'));logger[_0xd758('0x10')](_0xd758('0x11'),_0x3c4177,_0xd758('0xf'),JSON['stringify'](_0x36a9c9));if(_0x36a9c9[_0xd758('0x12')]){if(_0x36a9c9[_0xd758('0x12')][_0xd758('0x13')]===0x1f4){logger[_0xd758('0x12')](_0xd758('0xe'),_0x3c4177,_0x36a9c9[_0xd758('0x12')][_0xd758('0x14')]);return _0x1ceccd(_0x36a9c9['error'][_0xd758('0x14')]);}logger[_0xd758('0x12')]('CmHopperBlack,\x20%s,\x20%s',_0x3c4177,_0x36a9c9[_0xd758('0x12')][_0xd758('0x14')]);return _0x393c10(_0x36a9c9[_0xd758('0x12')][_0xd758('0x14')]);}else{logger[_0xd758('0xd')]('CmHopperBlack,\x20%s,\x20%s',_0x3c4177,_0xd758('0xf'));_0x393c10(_0x36a9c9['result']['message']);}})[_0xd758('0x15')](function(_0x5e33d8){logger[_0xd758('0x12')](_0xd758('0xe'),_0x3c4177,_0x5e33d8);_0x1ceccd(_0x5e33d8);});});}exports[_0xd758('0x16')]=function(_0x24a24d){var _0x2b6c5e=this;return new Promise(function(_0x346acf,_0x4d7543){return db[_0xd758('0x17')][_0xd758('0x18')]({'raw':_0x24a24d[_0xd758('0x19')]?_0x24a24d[_0xd758('0x19')][_0xd758('0x1a')]===undefined?!![]:![]:!![],'where':_0x24a24d['options']?_0x24a24d[_0xd758('0x19')][_0xd758('0x1b')]||null:null,'attributes':_0x24a24d['options']?_0x24a24d[_0xd758('0x19')]['attributes']||null:null,'limit':_0x24a24d[_0xd758('0x19')]?_0x24a24d[_0xd758('0x19')]['limit']||null:null,'include':_0x24a24d[_0xd758('0x19')]?_0x24a24d[_0xd758('0x19')][_0xd758('0x1c')]?_[_0xd758('0x1d')](_0x24a24d[_0xd758('0x19')][_0xd758('0x1c')],function(_0x226dbc){return{'model':db[_0x226dbc[_0xd758('0x1e')]],'as':_0x226dbc['as'],'attributes':_0x226dbc[_0xd758('0x1f')],'include':_0x226dbc[_0xd758('0x1c')]?_[_0xd758('0x1d')](_0x226dbc[_0xd758('0x1c')],function(_0x52d5ca){return{'model':db[_0x52d5ca['model']],'as':_0x52d5ca['as'],'attributes':_0x52d5ca[_0xd758('0x1f')],'include':_0x52d5ca[_0xd758('0x1c')]?_[_0xd758('0x1d')](_0x52d5ca[_0xd758('0x1c')],function(_0x2175cf){return{'model':db[_0x2175cf[_0xd758('0x1e')]],'as':_0x2175cf['as'],'attributes':_0x2175cf[_0xd758('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd758('0xc')](function(_0xc01aab){logger['info'](_0xd758('0x16'),_0x24a24d);logger[_0xd758('0x10')](_0xd758('0x16'),_0x24a24d,JSON['stringify'](_0xc01aab));_0x346acf(_0xc01aab);})[_0xd758('0x15')](function(_0x47240b){logger[_0xd758('0x12')](_0xd758('0x16'),_0x47240b[_0xd758('0x14')],_0x24a24d);_0x4d7543(_0x2b6c5e[_0xd758('0x12')](0x1f4,_0x47240b['message']));});});};exports[_0xd758('0x20')]=function(_0x62a9a0){var _0x29c21a=this;return new Promise(function(_0x438ce5,_0x4152d9){return db[_0xd758('0x17')][_0xd758('0x21')](_0x62a9a0[_0xd758('0x22')],{'raw':_0x62a9a0[_0xd758('0x19')]?_0x62a9a0[_0xd758('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x62a9a0['options']?_0x62a9a0[_0xd758('0x19')][_0xd758('0x1b')]||null:null,'attributes':_0x62a9a0[_0xd758('0x19')]?_0x62a9a0['options'][_0xd758('0x1f')]||null:null,'limit':_0x62a9a0[_0xd758('0x19')]?_0x62a9a0['options']['limit']||null:null})[_0xd758('0xc')](function(_0x5da689){logger[_0xd758('0xd')]('UpdateCmHopperBlack',_0x62a9a0);logger[_0xd758('0x10')]('UpdateCmHopperBlack',_0x62a9a0,JSON[_0xd758('0x23')](_0x5da689));_0x438ce5(_0x5da689);})[_0xd758('0x15')](function(_0x11bec9){logger['error'](_0xd758('0x20'),_0x11bec9['message'],_0x62a9a0);_0x4152d9(_0x29c21a[_0xd758('0x12')](0x1f4,_0x11bec9[_0xd758('0x14')]));});});};exports['DestroyCmHopperBlack']=function(_0x351d75){var _0x1dab05=this;return new Promise(function(_0x5ae7f6,_0x40d1e8){return db['CmHopperBlack'][_0xd758('0x24')]({'where':_0x351d75[_0xd758('0x19')]?_0x351d75['options'][_0xd758('0x1b')]||null:null})['then'](function(_0x334427){logger[_0xd758('0xd')]('DestroyCmHopperBlack',_0x351d75);logger[_0xd758('0x10')](_0xd758('0x25'),_0x351d75,JSON['stringify'](_0x334427));_0x5ae7f6(_0x334427);})[_0xd758('0x15')](function(_0x5e63e8){logger[_0xd758('0x12')](_0xd758('0x25'),_0x5e63e8[_0xd758('0x14')],_0x351d75);_0x40d1e8(_0x1dab05[_0xd758('0x12')](0x1f4,_0x5e63e8['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 7b1e19f..5469ff1 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 _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 +var _0x4c60=['connect-timeout','Router','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','/:id','show','update','exports','multer','util','path'];(function(_0x4af6d2,_0x1f789a){var _0x11782a=function(_0x1013d4){while(--_0x1013d4){_0x4af6d2['push'](_0x4af6d2['shift']());}};_0x11782a(++_0x1f789a);}(_0x4c60,0xc1));var _0x04c6=function(_0x49ca7d,_0x466616){_0x49ca7d=_0x49ca7d-0x0;var _0x148682=_0x4c60[_0x49ca7d];return _0x148682;};'use strict';var multer=require(_0x04c6('0x0'));var util=require(_0x04c6('0x1'));var path=require(_0x04c6('0x2'));var timeout=require(_0x04c6('0x3'));var express=require('express');var router=express[_0x04c6('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x04c6('0x5'));router[_0x04c6('0x6')]('/',auth[_0x04c6('0x7')](),controller[_0x04c6('0x8')]);router[_0x04c6('0x6')](_0x04c6('0x9'),auth[_0x04c6('0x7')](),controller['describe']);router[_0x04c6('0x6')](_0x04c6('0xa'),auth[_0x04c6('0x7')](),controller[_0x04c6('0xb')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x04c6('0xc')]);router['delete'](_0x04c6('0xa'),auth[_0x04c6('0x7')](),controller['destroy']);module[_0x04c6('0xd')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 35dbaf8..125e636 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 _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 +var _0xb4db=['getDataValue','setDataValue','followuptime','diff','BOOLEAN','sequelize','exports','INTEGER','STRING','DATE'];(function(_0x298527,_0x542f83){var _0x3264f3=function(_0x4d05c7){while(--_0x4d05c7){_0x298527['push'](_0x298527['shift']());}};_0x3264f3(++_0x542f83);}(_0xb4db,0xb9));var _0xbb4d=function(_0x287d95,_0x184c24){_0x287d95=_0x287d95-0x0;var _0x5a8b9c=_0xb4db[_0x287d95];return _0x5a8b9c;};'use strict';var Sequelize=require(_0xbb4d('0x0'));var moment=require('moment');module[_0xbb4d('0x1')]={'state':{'type':Sequelize[_0xbb4d('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xbb4d('0x3')]},'scheduledat':{'type':Sequelize[_0xbb4d('0x4')]},'countbusyretry':{'type':Sequelize[_0xbb4d('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xbb4d('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xbb4d('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xbb4d('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xbb4d('0x3')]},'originatecalleridname':{'type':Sequelize[_0xbb4d('0x3')]},'calleridnum':{'type':Sequelize[_0xbb4d('0x3')]},'calleridname':{'type':Sequelize[_0xbb4d('0x3')]},'starttime':{'type':Sequelize[_0xbb4d('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xbb4d('0x4')]},'droptime':{'type':Sequelize[_0xbb4d('0x4')]},'endtime':{'type':Sequelize[_0xbb4d('0x4')]},'ringtime':{'type':Sequelize[_0xbb4d('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xbb4d('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xbb4d('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xbb4d('0x3')]},'campaigntype':{'type':Sequelize[_0xbb4d('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xbb4d('0x3')]},'disposition':{'type':Sequelize[_0xbb4d('0x3')]},'secondDisposition':{'type':Sequelize[_0xbb4d('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0xbb4d('0x4')],'set':function(_0x461dcf){var _0x25cda3=this[_0xbb4d('0x5')]('endtime');if(_0x25cda3&&_0x461dcf){this[_0xbb4d('0x6')](_0xbb4d('0x7'),moment(_0x461dcf)[_0xbb4d('0x8')](moment(_0x25cda3),'seconds'));}}},'amd':{'type':Sequelize[_0xbb4d('0x9')],'defaultValue':![]},'fax':{'type':Sequelize[_0xbb4d('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xbb4d('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0xbb4d('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xbb4d('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xbb4d('0x4')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0xbb4d('0x4')]},'recallme':{'type':Sequelize[_0xbb4d('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xbb4d('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0xbb4d('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xbb4d('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xbb4d('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xbb4d('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xbb4d('0x2')],'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 2a6d89d..6c2fe98 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 _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 +var _0x71ab=['json','offset','undefined','limit','count','set','reject','update','then','destroy','error','stack','name','send','index','map','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','CmHopperFinal','findAll','rows','catch','show','params','rawAttributes','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','`state`\x20=\x203,\x201,\x20null','dropContacts','VoiceQueue','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','phone','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','VoiceQueueId','from','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','calleridnum\x20NOT\x20IN\x20(?)','cm_hopper_final','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','insert','CampaignId','state','CampaignId\x20=\x20?','calleridnum','checkContactHopper','CmHopper','findOne','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end'];(function(_0x6fe4f3,_0xff6ddd){var _0x4e6c4e=function(_0xc775f2){while(--_0xc775f2){_0x6fe4f3['push'](_0x6fe4f3['shift']());}};_0x4e6c4e(++_0xff6ddd);}(_0x71ab,0x64));var _0xb71a=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x71ab[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb71a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb71a('0x1'));var rp=require('request-promise');var moment=require(_0xb71a('0x2'));var BPromise=require(_0xb71a('0x3'));var Mustache=require(_0xb71a('0x4'));var util=require(_0xb71a('0x5'));var path=require(_0xb71a('0x6'));var sox=require(_0xb71a('0x7'));var csv=require(_0xb71a('0x8'));var ejs=require(_0xb71a('0x9'));var fs=require('fs');var fs_extra=require(_0xb71a('0xa'));var _=require(_0xb71a('0xb'));var squel=require(_0xb71a('0xc'));var crypto=require(_0xb71a('0xd'));var jsforce=require(_0xb71a('0xe'));var deskjs=require(_0xb71a('0xf'));var toCsv=require(_0xb71a('0x8'));var querystring=require(_0xb71a('0x10'));var Papa=require(_0xb71a('0x11'));var Redis=require(_0xb71a('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb71a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb71a('0x14'));var logger=require(_0xb71a('0x15'))(_0xb71a('0x16'));var utils=require('../../config/utils');var config=require(_0xb71a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xb71a('0x18'))['db'];function respondWithStatusCode(_0x50030d,_0x50b43b){_0x50b43b=_0x50b43b||0xcc;return function(_0x3346a5){if(_0x3346a5){return _0x50030d[_0xb71a('0x19')](_0x50b43b);}return _0x50030d[_0xb71a('0x1a')](_0x50b43b)[_0xb71a('0x1b')]();};}function respondWithResult(_0x483d77,_0x47ee48){_0x47ee48=_0x47ee48||0xc8;return function(_0x5364e3){if(_0x5364e3){return _0x483d77[_0xb71a('0x1a')](_0x47ee48)[_0xb71a('0x1c')](_0x5364e3);}};}function respondWithFilteredResult(_0x15252a,_0x42fc55){return function(_0x3cd0f0){if(_0x3cd0f0){var _0x1e9363=typeof _0x42fc55[_0xb71a('0x1d')]===_0xb71a('0x1e')&&typeof _0x42fc55[_0xb71a('0x1f')]==='undefined';var _0x1ca65e=_0x3cd0f0[_0xb71a('0x20')];var _0x374c8c=_0x1e9363?0x0:_0x42fc55[_0xb71a('0x1d')];var _0x2bdb61=_0x1e9363?_0x3cd0f0[_0xb71a('0x20')]:_0x42fc55[_0xb71a('0x1d')]+_0x42fc55[_0xb71a('0x1f')];var _0x20bdfe;if(_0x2bdb61>=_0x1ca65e){_0x2bdb61=_0x1ca65e;_0x20bdfe=0xc8;}else{_0x20bdfe=0xce;}_0x15252a[_0xb71a('0x1a')](_0x20bdfe);return _0x15252a[_0xb71a('0x21')]('Content-Range',_0x374c8c+'-'+_0x2bdb61+'/'+_0x1ca65e)['json'](_0x3cd0f0);}return null;};}function patchUpdates(_0x1358f2){return function(_0x578fe4){try{jsonpatch['apply'](_0x578fe4,_0x1358f2,!![]);}catch(_0x4d8871){return BPromise[_0xb71a('0x22')](_0x4d8871);}return _0x578fe4['save']();};}function saveUpdates(_0x76d6dc,_0x4227c7){return function(_0x3ac77b){if(_0x3ac77b){return _0x3ac77b[_0xb71a('0x23')](_0x76d6dc)[_0xb71a('0x24')](function(_0x14b2a1){return _0x14b2a1;});}return null;};}function removeEntity(_0x2f4fac,_0x14aac7){return function(_0x5f3f19){if(_0x5f3f19){return _0x5f3f19[_0xb71a('0x25')]()[_0xb71a('0x24')](function(){_0x2f4fac[_0xb71a('0x1a')](0xcc)[_0xb71a('0x1b')]();});}};}function handleEntityNotFound(_0x3401f7,_0x1a010d){return function(_0x20ed75){if(!_0x20ed75){_0x3401f7[_0xb71a('0x19')](0x194);}return _0x20ed75;};}function handleError(_0x31085b,_0x2a847a){_0x2a847a=_0x2a847a||0x1f4;return function(_0x45b849){logger[_0xb71a('0x26')](_0x45b849[_0xb71a('0x27')]);if(_0x45b849['name']){delete _0x45b849[_0xb71a('0x28')];}_0x31085b[_0xb71a('0x1a')](_0x2a847a)[_0xb71a('0x29')](_0x45b849);};}exports[_0xb71a('0x2a')]=function(_0x2fbd73,_0x38178c){var _0x44826e={},_0x25364c={},_0x42c086={'count':0x0,'rows':[]};var _0x421fcf=_[_0xb71a('0x2b')](db['CmHopperFinal']['rawAttributes'],function(_0x3112d3){return{'name':_0x3112d3['fieldName'],'type':_0x3112d3[_0xb71a('0x2c')][_0xb71a('0x2d')]};});_0x25364c['model']=_[_0xb71a('0x2b')](_0x421fcf,_0xb71a('0x28'));_0x25364c[_0xb71a('0x2e')]=_[_0xb71a('0x2f')](_0x2fbd73[_0xb71a('0x2e')]);_0x25364c[_0xb71a('0x30')]=_['intersection'](_0x25364c[_0xb71a('0x31')],_0x25364c[_0xb71a('0x2e')]);_0x44826e[_0xb71a('0x32')]=_[_0xb71a('0x33')](_0x25364c['model'],qs[_0xb71a('0x34')](_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x34')]));_0x44826e[_0xb71a('0x32')]=_0x44826e[_0xb71a('0x32')][_0xb71a('0x35')]?_0x44826e[_0xb71a('0x32')]:_0x25364c[_0xb71a('0x31')];if(!_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x36')]('nolimit')){_0x44826e['limit']=qs[_0xb71a('0x1f')](_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x1f')]);_0x44826e[_0xb71a('0x1d')]=qs[_0xb71a('0x1d')](_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x1d')]);}_0x44826e['order']=qs[_0xb71a('0x37')](_0x2fbd73['query'][_0xb71a('0x37')]);_0x44826e[_0xb71a('0x38')]=qs[_0xb71a('0x30')](_[_0xb71a('0x39')](_0x2fbd73['query'],_0x25364c[_0xb71a('0x30')]),_0x421fcf);if(_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x3a')]){_0x44826e[_0xb71a('0x38')]=_[_0xb71a('0x3b')](_0x44826e[_0xb71a('0x38')],{'$or':_[_0xb71a('0x2b')](_0x421fcf,function(_0x2756b9){if(_0x2756b9[_0xb71a('0x2c')]!=='VIRTUAL'){var _0x24a3af={};_0x24a3af[_0x2756b9['name']]={'$like':'%'+_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x3a')]+'%'};return _0x24a3af;}})});}_0x44826e=_[_0xb71a('0x3b')]({},_0x44826e,_0x2fbd73[_0xb71a('0x3c')]);var _0xce7b8a={'where':_0x44826e[_0xb71a('0x38')]};return db['CmHopperFinal']['count'](_0xce7b8a)['then'](function(_0x35fea9){_0x42c086['count']=_0x35fea9;if(_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x3d')]){_0x44826e[_0xb71a('0x3e')]=[{'all':!![]}];}return db[_0xb71a('0x3f')][_0xb71a('0x40')](_0x44826e);})[_0xb71a('0x24')](function(_0x59530a){_0x42c086[_0xb71a('0x41')]=_0x59530a;return _0x42c086;})[_0xb71a('0x24')](respondWithFilteredResult(_0x38178c,_0x44826e))[_0xb71a('0x42')](handleError(_0x38178c,null));};exports[_0xb71a('0x43')]=function(_0x7d305,_0x2f08d2){var _0x55cbca={'raw':!![],'where':{'id':_0x7d305[_0xb71a('0x44')]['id']}},_0x2afff3={};_0x2afff3[_0xb71a('0x31')]=_[_0xb71a('0x2f')](db[_0xb71a('0x3f')][_0xb71a('0x45')]);_0x2afff3[_0xb71a('0x2e')]=_['keys'](_0x7d305['query']);_0x2afff3[_0xb71a('0x30')]=_[_0xb71a('0x33')](_0x2afff3[_0xb71a('0x31')],_0x2afff3[_0xb71a('0x2e')]);_0x55cbca['attributes']=_[_0xb71a('0x33')](_0x2afff3['model'],qs[_0xb71a('0x34')](_0x7d305[_0xb71a('0x2e')]['fields']));_0x55cbca[_0xb71a('0x32')]=_0x55cbca[_0xb71a('0x32')][_0xb71a('0x35')]?_0x55cbca[_0xb71a('0x32')]:_0x2afff3['model'];if(_0x7d305[_0xb71a('0x2e')][_0xb71a('0x3d')]){_0x55cbca[_0xb71a('0x3e')]=[{'all':!![]}];}_0x55cbca=_['merge']({},_0x55cbca,_0x7d305[_0xb71a('0x3c')]);return db[_0xb71a('0x3f')][_0xb71a('0x46')](_0x55cbca)['then'](handleEntityNotFound(_0x2f08d2,null))[_0xb71a('0x24')](respondWithResult(_0x2f08d2,null))[_0xb71a('0x42')](handleError(_0x2f08d2,null));};exports[_0xb71a('0x47')]=function(_0x1f29b7,_0x365bed){return db['CmHopperFinal'][_0xb71a('0x47')]()[_0xb71a('0x24')](respondWithResult(_0x365bed,null))[_0xb71a('0x42')](handleError(_0x365bed,null));};exports[_0xb71a('0x23')]=function(_0x489c1f,_0x48fbde){if(_0x489c1f[_0xb71a('0x48')][_0xb71a('0x49')]){delete _0x489c1f[_0xb71a('0x48')][_0xb71a('0x49')];}return db[_0xb71a('0x3f')][_0xb71a('0x46')]({'where':{'uniqueid':_0x489c1f[_0xb71a('0x44')]['id']}})[_0xb71a('0x24')](handleEntityNotFound(_0x48fbde,null))[_0xb71a('0x24')](saveUpdates(_0x489c1f[_0xb71a('0x48')],null))['then'](respondWithResult(_0x48fbde,null))[_0xb71a('0x42')](handleError(_0x48fbde,null));};exports[_0xb71a('0x4a')]=function(_0x500196,_0x1c0536,_0x58116c){return db[_0xb71a('0x3f')][_0xb71a('0x40')]({'raw':![],'where':{'VoiceQueueId':_0x500196[_0xb71a('0x44')]['id']},'attributes':[[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db['sequelize']['fn']('IF',db[_0xb71a('0x4b')]['literal'](_0xb71a('0x4d')))),_0xb71a('0x4e')],[db['sequelize']['fn']('COUNT',db[_0xb71a('0x4b')]['fn']('IF',db[_0xb71a('0x4b')]['literal']('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db[_0xb71a('0x4b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xb71a('0x4b')][_0xb71a('0x4f')](_0xb71a('0x50')))),_0xb71a('0x51')],[db['sequelize']['fn'](_0xb71a('0x4c'),db[_0xb71a('0x4b')]['fn']('IF',db[_0xb71a('0x4b')]['literal'](_0xb71a('0x52')))),_0xb71a('0x53')],[db['sequelize']['fn'](_0xb71a('0x4c'),db[_0xb71a('0x4b')]['fn']('IF',db[_0xb71a('0x4b')]['literal'](_0xb71a('0x54')))),'dropContacts'],[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db['sequelize']['fn']('IF',db[_0xb71a('0x4b')][_0xb71a('0x4f')](_0xb71a('0x55')))),_0xb71a('0x56')],[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db[_0xb71a('0x4b')]['fn']('IF',db['sequelize']['literal'](_0xb71a('0x57')))),_0xb71a('0x58')],[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db[_0xb71a('0x4b')]['fn']('IF',db['sequelize']['literal'](_0xb71a('0x59')))),_0xb71a('0x5a')]]})['then'](handleEntityNotFound(_0x1c0536,null))[_0xb71a('0x24')](respondWithResult(_0x1c0536,null))[_0xb71a('0x42')](handleError(_0x1c0536,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x181a9f,_0xe55672,_0x38de3a){return db[_0xb71a('0x3f')]['findAll']({'raw':![],'where':{'CampaignId':_0x181a9f[_0xb71a('0x44')]['id']},'attributes':[[db[_0xb71a('0x4b')]['fn']('COUNT',db[_0xb71a('0x4b')]['fn']('IF',db[_0xb71a('0x4b')][_0xb71a('0x4f')](_0xb71a('0x4d')))),_0xb71a('0x4e')],[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db[_0xb71a('0x4b')]['fn']('IF',db['sequelize'][_0xb71a('0x4f')](_0xb71a('0x5b')))),'noAnswerContacts'],[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db['sequelize']['fn']('IF',db[_0xb71a('0x4b')][_0xb71a('0x4f')](_0xb71a('0x50')))),_0xb71a('0x51')],[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db['sequelize']['fn']('IF',db['sequelize'][_0xb71a('0x4f')](_0xb71a('0x52')))),_0xb71a('0x53')],[db['sequelize']['fn'](_0xb71a('0x4c'),db['sequelize']['fn']('IF',db[_0xb71a('0x4b')]['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xb71a('0x5c')],[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db[_0xb71a('0x4b')]['fn']('IF',db[_0xb71a('0x4b')]['literal'](_0xb71a('0x55')))),'abandonedContacts'],[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db[_0xb71a('0x4b')]['fn']('IF',db['sequelize']['literal'](_0xb71a('0x57')))),_0xb71a('0x58')],[db[_0xb71a('0x4b')]['fn'](_0xb71a('0x4c'),db[_0xb71a('0x4b')]['fn']('IF',db['sequelize'][_0xb71a('0x4f')](_0xb71a('0x59')))),_0xb71a('0x5a')]]})[_0xb71a('0x24')](handleEntityNotFound(_0xe55672,null))[_0xb71a('0x24')](respondWithResult(_0xe55672,null))['catch'](handleError(_0xe55672,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x15b8be,_0x2dd470,_0x38a8a1){return db[_0xb71a('0x5d')][_0xb71a('0x46')]({'where':{'id':_0x15b8be[_0xb71a('0x44')]['id']}})[_0xb71a('0x24')](handleEntityNotFound(_0x2dd470,null))['then'](function(_0x45f4b2){var _0x27c15e;if(_0x45f4b2){_0x27c15e=squel['insert']()[_0xb71a('0x5e')](_0xb71a('0x5f'))[_0xb71a('0x60')](['phone',_0xb71a('0x61'),_0xb71a('0x62'),_0xb71a('0x63'),'VoiceQueueId',_0xb71a('0x64'),_0xb71a('0x65')],squel[_0xb71a('0x66')]()[_0xb71a('0x67')](_0xb71a('0x68'),_0xb71a('0x69'))[_0xb71a('0x67')](_0xb71a('0x6a'),'scheduledAt')[_0xb71a('0x67')](_0xb71a('0x6b'),_0xb71a('0x62'))[_0xb71a('0x67')](_0xb71a('0x6c'),_0xb71a('0x63'))[_0xb71a('0x67')]('ANY_VALUE(VoiceQueueId)',_0xb71a('0x6d'))['field'](_0xb71a('0x6a'),_0xb71a('0x64'))['field'](_0xb71a('0x6a'),'updatedAt')[_0xb71a('0x6e')]('cm_hopper_final')[_0xb71a('0x38')](_0xb71a('0x6f'),_0x15b8be[_0xb71a('0x44')]['id'][_0xb71a('0x70')]())['where'](_0xb71a('0x71'),_0x15b8be[_0xb71a('0x48')]['state'][_0xb71a('0x70')]())['where']('calleridnum\x20IS\x20NOT\x20NULL')['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xb71a('0x66')]()[_0xb71a('0x67')](_0xb71a('0x69'))['from'](_0xb71a('0x5f'))[_0xb71a('0x38')]('VoiceQueueId\x20=\x20?',_0x15b8be[_0xb71a('0x44')]['id'][_0xb71a('0x70')]()))[_0xb71a('0x38')](_0xb71a('0x72'),squel[_0xb71a('0x66')]()[_0xb71a('0x67')]('calleridnum')[_0xb71a('0x6e')](_0xb71a('0x73'))[_0xb71a('0x38')](_0xb71a('0x6f'),_0x15b8be[_0xb71a('0x44')]['id'][_0xb71a('0x70')]())['where'](_0xb71a('0x74')))[_0xb71a('0x75')]('ContactId'))[_0xb71a('0x70')]();return db[_0xb71a('0x4b')][_0xb71a('0x2e')](_0x27c15e);}return[];})['then'](respondWithResult(_0x2dd470,null))[_0xb71a('0x42')](handleError(_0x2dd470,null));};exports[_0xb71a('0x76')]=function(_0x28bc74,_0x575a0a,_0x1a658e){return db[_0xb71a('0x77')]['find']({'where':{'id':_0x28bc74[_0xb71a('0x44')]['id']}})[_0xb71a('0x24')](handleEntityNotFound(_0x575a0a,null))[_0xb71a('0x24')](function(_0x21b9b5){var _0x4abfd6;if(_0x21b9b5){_0x4abfd6=squel[_0xb71a('0x78')]()[_0xb71a('0x5e')](_0xb71a('0x5f'))[_0xb71a('0x60')](['phone',_0xb71a('0x61'),_0xb71a('0x62'),'ListId',_0xb71a('0x79'),_0xb71a('0x64'),'updatedAt'],squel[_0xb71a('0x66')]()[_0xb71a('0x67')](_0xb71a('0x68'),'phone')[_0xb71a('0x67')](_0xb71a('0x6a'),_0xb71a('0x61'))[_0xb71a('0x67')](_0xb71a('0x6b'),_0xb71a('0x62'))[_0xb71a('0x67')](_0xb71a('0x6c'),_0xb71a('0x63'))['field']('ANY_VALUE(CampaignId)',_0xb71a('0x79'))[_0xb71a('0x67')](_0xb71a('0x6a'),_0xb71a('0x64'))[_0xb71a('0x67')](_0xb71a('0x6a'),'updatedAt')[_0xb71a('0x6e')]('cm_hopper_final')[_0xb71a('0x38')]('CampaignId\x20=\x20?',_0x28bc74[_0xb71a('0x44')]['id'][_0xb71a('0x70')]())['where'](_0xb71a('0x71'),_0x28bc74[_0xb71a('0x48')][_0xb71a('0x7a')][_0xb71a('0x70')]())[_0xb71a('0x38')]('calleridnum\x20IS\x20NOT\x20NULL')[_0xb71a('0x38')](_0xb71a('0x72'),squel['select']()[_0xb71a('0x67')](_0xb71a('0x69'))['from'](_0xb71a('0x5f'))[_0xb71a('0x38')](_0xb71a('0x7b'),_0x28bc74['params']['id'][_0xb71a('0x70')]()))[_0xb71a('0x38')](_0xb71a('0x72'),squel['select']()[_0xb71a('0x67')](_0xb71a('0x7c'))[_0xb71a('0x6e')](_0xb71a('0x73'))[_0xb71a('0x38')]('CampaignId\x20=\x20?',_0x28bc74[_0xb71a('0x44')]['id']['toString']())[_0xb71a('0x38')](_0xb71a('0x74')))[_0xb71a('0x75')]('ContactId'))['toString']();return db[_0xb71a('0x4b')][_0xb71a('0x2e')](_0x4abfd6);}return[];})[_0xb71a('0x24')](respondWithResult(_0x575a0a,null))[_0xb71a('0x42')](handleError(_0x575a0a,null));};exports[_0xb71a('0x7d')]=function(_0x18dfb3,_0x38ffc1,_0x442ec0){return db[_0xb71a('0x7e')][_0xb71a('0x7f')]({'where':{'VoiceQueueId':_0x18dfb3[_0xb71a('0x48')][_0xb71a('0x6d')],'CampaignId':_0x18dfb3[_0xb71a('0x48')][_0xb71a('0x79')],'ContactId':_0x18dfb3[_0xb71a('0x48')]['ContactId']}})[_0xb71a('0x24')](handleEntityNotFound(_0x38ffc1,null))[_0xb71a('0x24')](function(_0x243c90){if(_0x243c90){return _0x243c90;}return null;})['then'](respondWithResult(_0x38ffc1,null))['catch'](handleError(_0x38ffc1,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index a1e588b..2d121ac 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 _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 +var _0x3f68=['define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','api','bluebird','path','rimraf','./cmHopperFinal.attributes','exports'];(function(_0x16ae34,_0x1dc6d){var _0x184836=function(_0x1e48b7){while(--_0x1e48b7){_0x16ae34['push'](_0x16ae34['shift']());}};_0x184836(++_0x1dc6d);}(_0x3f68,0xad));var _0x83f6=function(_0x34d4e1,_0x473951){_0x34d4e1=_0x34d4e1-0x0;var _0x1d59a4=_0x3f68[_0x34d4e1];return _0x1d59a4;};'use strict';var _=require(_0x83f6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x83f6('0x1'));var moment=require('moment');var BPromise=require(_0x83f6('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x83f6('0x3'));var rimraf=require(_0x83f6('0x4'));var config=require('../../config/environment');var attributes=require(_0x83f6('0x5'));module[_0x83f6('0x6')]=function(_0x12ff63,_0x122c40){return _0x12ff63[_0x83f6('0x7')](_0x83f6('0x8'),attributes,{'tableName':_0x83f6('0x9'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0x83f6('0xa')]},{'name':'uniqueid','fields':[_0x83f6('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index d9bb543..a640f29 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_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 +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(_0x2a856a,_0x21f96b){var _0x1b5922=function(_0x5e55a3){while(--_0x5e55a3){_0x2a856a['push'](_0x2a856a['shift']());}};_0x1b5922(++_0x21f96b);}(_0xb10b,0x12a));var _0xbb10=function(_0x38ed15,_0x2b12e8){_0x38ed15=_0x38ed15-0x0;var _0x29db8b=_0xb10b[_0x38ed15];return _0x29db8b;};'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 e6c0c0d..3653f93 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 _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 +var _0xb6f3=['isAuthenticated','index','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','/checkContactHopper','checkContactHopper','put','update','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x3c22e0,_0x1dc6ea){var _0x215811=function(_0x1b453c){while(--_0x1b453c){_0x3c22e0['push'](_0x3c22e0['shift']());}};_0x215811(++_0x1dc6ea);}(_0xb6f3,0x12a));var _0x3b6f=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xb6f3[_0x413feb];return _0x40ee88;};'use strict';var multer=require(_0x3b6f('0x0'));var util=require('util');var path=require(_0x3b6f('0x1'));var timeout=require(_0x3b6f('0x2'));var express=require(_0x3b6f('0x3'));var router=express[_0x3b6f('0x4')]();var fs_extra=require(_0x3b6f('0x5'));var auth=require(_0x3b6f('0x6'));var interaction=require(_0x3b6f('0x7'));var config=require(_0x3b6f('0x8'));var controller=require('./cmHopperFinal.controller');router[_0x3b6f('0x9')]('/',auth[_0x3b6f('0xa')](),controller[_0x3b6f('0xb')]);router[_0x3b6f('0x9')](_0x3b6f('0xc'),auth[_0x3b6f('0xa')](),controller[_0x3b6f('0xd')]);router[_0x3b6f('0x9')](_0x3b6f('0xe'),auth['isAuthenticated'](),controller[_0x3b6f('0xf')]);router[_0x3b6f('0x9')](_0x3b6f('0x10'),auth[_0x3b6f('0xa')](),controller[_0x3b6f('0x11')]);router['get'](_0x3b6f('0x12'),auth[_0x3b6f('0xa')](),controller[_0x3b6f('0x13')]);router[_0x3b6f('0x14')](_0x3b6f('0x15'),auth[_0x3b6f('0xa')](),controller[_0x3b6f('0x16')]);router[_0x3b6f('0x14')](_0x3b6f('0x17'),auth[_0x3b6f('0xa')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x3b6f('0x14')](_0x3b6f('0x18'),auth['isAuthenticated'](),controller[_0x3b6f('0x19')]);router[_0x3b6f('0x1a')](_0x3b6f('0xe'),auth[_0x3b6f('0xa')](),controller[_0x3b6f('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 7f042fb..48fd9eb 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 _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 +var _0x7a07=['STRING','DATE','BOOLEAN','exports','INTEGER'];(function(_0x5872f2,_0x51185b){var _0x42d43e=function(_0x36f2a4){while(--_0x36f2a4){_0x5872f2['push'](_0x5872f2['shift']());}};_0x42d43e(++_0x51185b);}(_0x7a07,0x1b1));var _0x77a0=function(_0xe24a65,_0x1bfcb3){_0xe24a65=_0xe24a65-0x0;var _0x41bcf5=_0x7a07[_0xe24a65];return _0x41bcf5;};'use strict';var Sequelize=require('sequelize');module[_0x77a0('0x0')]={'state':{'type':Sequelize[_0x77a0('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x77a0('0x2')]},'scheduledat':{'type':Sequelize[_0x77a0('0x3')]},'countbusyretry':{'type':Sequelize[_0x77a0('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x77a0('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x77a0('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x77a0('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x77a0('0x2')]},'originatecalleridname':{'type':Sequelize[_0x77a0('0x2')]},'calleridnum':{'type':Sequelize[_0x77a0('0x2')]},'calleridname':{'type':Sequelize[_0x77a0('0x2')]},'starttime':{'type':Sequelize[_0x77a0('0x3')]},'responsetime':{'type':Sequelize[_0x77a0('0x3')]},'answertime':{'type':Sequelize[_0x77a0('0x3')]},'droptime':{'type':Sequelize[_0x77a0('0x3')]},'endtime':{'type':Sequelize[_0x77a0('0x3')]},'ringtime':{'type':Sequelize[_0x77a0('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x77a0('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x77a0('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x77a0('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x77a0('0x2')]},'campaign':{'type':Sequelize[_0x77a0('0x2')]},'campaigntype':{'type':Sequelize[_0x77a0('0x2')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x77a0('0x4')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x77a0('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x77a0('0x3')]},'recallme':{'type':Sequelize[_0x77a0('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x77a0('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x77a0('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x77a0('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x77a0('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x77a0('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x77a0('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 1789acc..fde1641 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 _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 +var _0x172e=['filter','merge','options','CmHopperHistory','then','includeAll','include','findAll','rows','catch','show','params','find','create','describe','update','body','uniqueid','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','Content-Range','apply','reject','save','destroy','stack','name','send','index','map','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x172e,0x13e));var _0xe172=function(_0x4a52b1,_0x48bed4){_0x4a52b1=_0x4a52b1-0x0;var _0xe88d3d=_0x172e[_0x4a52b1];return _0xe88d3d;};'use strict';var emlformat=require(_0xe172('0x0'));var rimraf=require(_0xe172('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe172('0x2'));var moment=require(_0xe172('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe172('0x4'));var util=require(_0xe172('0x5'));var path=require(_0xe172('0x6'));var sox=require(_0xe172('0x7'));var csv=require(_0xe172('0x8'));var ejs=require(_0xe172('0x9'));var fs=require('fs');var fs_extra=require(_0xe172('0xa'));var _=require(_0xe172('0xb'));var squel=require(_0xe172('0xc'));var crypto=require(_0xe172('0xd'));var jsforce=require(_0xe172('0xe'));var deskjs=require(_0xe172('0xf'));var toCsv=require(_0xe172('0x8'));var querystring=require(_0xe172('0x10'));var Papa=require('papaparse');var Redis=require(_0xe172('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe172('0x12'))(_0xe172('0x13'));var utils=require(_0xe172('0x14'));var config=require(_0xe172('0x15'));var licenseUtil=require(_0xe172('0x16'));var db=require(_0xe172('0x17'))['db'];function respondWithStatusCode(_0x362dbd,_0x2c63a8){_0x2c63a8=_0x2c63a8||0xcc;return function(_0x1e89a9){if(_0x1e89a9){return _0x362dbd[_0xe172('0x18')](_0x2c63a8);}return _0x362dbd[_0xe172('0x19')](_0x2c63a8)[_0xe172('0x1a')]();};}function respondWithResult(_0x57563b,_0x13d180){_0x13d180=_0x13d180||0xc8;return function(_0x489c16){if(_0x489c16){return _0x57563b[_0xe172('0x19')](_0x13d180)['json'](_0x489c16);}};}function respondWithFilteredResult(_0x371e12,_0x10ef6f){return function(_0x3ed561){if(_0x3ed561){var _0x2bffec=typeof _0x10ef6f[_0xe172('0x1b')]===_0xe172('0x1c')&&typeof _0x10ef6f['limit']===_0xe172('0x1c');var _0x57d5c8=_0x3ed561['count'];var _0x298294=_0x2bffec?0x0:_0x10ef6f[_0xe172('0x1b')];var _0x56343a=_0x2bffec?_0x3ed561[_0xe172('0x1d')]:_0x10ef6f[_0xe172('0x1b')]+_0x10ef6f[_0xe172('0x1e')];var _0x2d7734;if(_0x56343a>=_0x57d5c8){_0x56343a=_0x57d5c8;_0x2d7734=0xc8;}else{_0x2d7734=0xce;}_0x371e12[_0xe172('0x19')](_0x2d7734);return _0x371e12['set'](_0xe172('0x1f'),_0x298294+'-'+_0x56343a+'/'+_0x57d5c8)['json'](_0x3ed561);}return null;};}function patchUpdates(_0x377835){return function(_0x561d08){try{jsonpatch[_0xe172('0x20')](_0x561d08,_0x377835,!![]);}catch(_0x508d53){return BPromise[_0xe172('0x21')](_0x508d53);}return _0x561d08[_0xe172('0x22')]();};}function saveUpdates(_0x486a15,_0x552a04){return function(_0x40a9b7){if(_0x40a9b7){return _0x40a9b7['update'](_0x486a15)['then'](function(_0x4f7e03){return _0x4f7e03;});}return null;};}function removeEntity(_0x3ff7cc,_0x567e52){return function(_0x4c1da2){if(_0x4c1da2){return _0x4c1da2[_0xe172('0x23')]()['then'](function(){_0x3ff7cc[_0xe172('0x19')](0xcc)[_0xe172('0x1a')]();});}};}function handleEntityNotFound(_0x739067,_0x5e4516){return function(_0x4b4bde){if(!_0x4b4bde){_0x739067[_0xe172('0x18')](0x194);}return _0x4b4bde;};}function handleError(_0x3d19ee,_0x62df41){_0x62df41=_0x62df41||0x1f4;return function(_0x6bcabe){logger['error'](_0x6bcabe[_0xe172('0x24')]);if(_0x6bcabe[_0xe172('0x25')]){delete _0x6bcabe['name'];}_0x3d19ee['status'](_0x62df41)[_0xe172('0x26')](_0x6bcabe);};}exports[_0xe172('0x27')]=function(_0x8458fd,_0xc5477e){var _0xcf2b3a={},_0x3cf32d={},_0x2d9d1d={'count':0x0,'rows':[]};var _0x10b843=_[_0xe172('0x28')](db['CmHopperHistory']['rawAttributes'],function(_0x33000d){return{'name':_0x33000d[_0xe172('0x29')],'type':_0x33000d[_0xe172('0x2a')]['key']};});_0x3cf32d['model']=_[_0xe172('0x28')](_0x10b843,_0xe172('0x25'));_0x3cf32d[_0xe172('0x2b')]=_[_0xe172('0x2c')](_0x8458fd[_0xe172('0x2b')]);_0x3cf32d['filters']=_[_0xe172('0x2d')](_0x3cf32d[_0xe172('0x2e')],_0x3cf32d[_0xe172('0x2b')]);_0xcf2b3a[_0xe172('0x2f')]=_[_0xe172('0x2d')](_0x3cf32d[_0xe172('0x2e')],qs[_0xe172('0x30')](_0x8458fd[_0xe172('0x2b')][_0xe172('0x30')]));_0xcf2b3a[_0xe172('0x2f')]=_0xcf2b3a[_0xe172('0x2f')][_0xe172('0x31')]?_0xcf2b3a[_0xe172('0x2f')]:_0x3cf32d[_0xe172('0x2e')];if(!_0x8458fd[_0xe172('0x2b')][_0xe172('0x32')](_0xe172('0x33'))){_0xcf2b3a[_0xe172('0x1e')]=qs[_0xe172('0x1e')](_0x8458fd[_0xe172('0x2b')][_0xe172('0x1e')]);_0xcf2b3a['offset']=qs[_0xe172('0x1b')](_0x8458fd[_0xe172('0x2b')][_0xe172('0x1b')]);}_0xcf2b3a[_0xe172('0x34')]=qs[_0xe172('0x35')](_0x8458fd[_0xe172('0x2b')][_0xe172('0x35')]);_0xcf2b3a[_0xe172('0x36')]=qs[_0xe172('0x37')](_[_0xe172('0x38')](_0x8458fd[_0xe172('0x2b')],_0x3cf32d[_0xe172('0x37')]),_0x10b843);if(_0x8458fd['query'][_0xe172('0x39')]){_0xcf2b3a[_0xe172('0x36')]=_[_0xe172('0x3a')](_0xcf2b3a[_0xe172('0x36')],{'$or':_[_0xe172('0x28')](_0x10b843,function(_0x1d80f6){if(_0x1d80f6['type']!=='VIRTUAL'){var _0x1ed84a={};_0x1ed84a[_0x1d80f6[_0xe172('0x25')]]={'$like':'%'+_0x8458fd[_0xe172('0x2b')][_0xe172('0x39')]+'%'};return _0x1ed84a;}})});}_0xcf2b3a=_[_0xe172('0x3a')]({},_0xcf2b3a,_0x8458fd[_0xe172('0x3b')]);var _0x12a08b={'where':_0xcf2b3a['where']};return db[_0xe172('0x3c')][_0xe172('0x1d')](_0x12a08b)[_0xe172('0x3d')](function(_0x34abf0){_0x2d9d1d[_0xe172('0x1d')]=_0x34abf0;if(_0x8458fd[_0xe172('0x2b')][_0xe172('0x3e')]){_0xcf2b3a[_0xe172('0x3f')]=[{'all':!![]}];}return db[_0xe172('0x3c')][_0xe172('0x40')](_0xcf2b3a);})[_0xe172('0x3d')](function(_0x159d63){_0x2d9d1d[_0xe172('0x41')]=_0x159d63;return _0x2d9d1d;})[_0xe172('0x3d')](respondWithFilteredResult(_0xc5477e,_0xcf2b3a))[_0xe172('0x42')](handleError(_0xc5477e,null));};exports[_0xe172('0x43')]=function(_0x222e93,_0x17bcae){var _0xf6b70c={'raw':!![],'where':{'id':_0x222e93[_0xe172('0x44')]['id']}},_0x497f88={};_0x497f88['model']=_[_0xe172('0x2c')](db[_0xe172('0x3c')]['rawAttributes']);_0x497f88[_0xe172('0x2b')]=_[_0xe172('0x2c')](_0x222e93['query']);_0x497f88[_0xe172('0x37')]=_[_0xe172('0x2d')](_0x497f88[_0xe172('0x2e')],_0x497f88['query']);_0xf6b70c[_0xe172('0x2f')]=_[_0xe172('0x2d')](_0x497f88[_0xe172('0x2e')],qs[_0xe172('0x30')](_0x222e93['query'][_0xe172('0x30')]));_0xf6b70c['attributes']=_0xf6b70c[_0xe172('0x2f')][_0xe172('0x31')]?_0xf6b70c['attributes']:_0x497f88[_0xe172('0x2e')];if(_0x222e93['query'][_0xe172('0x3e')]){_0xf6b70c[_0xe172('0x3f')]=[{'all':!![]}];}_0xf6b70c=_['merge']({},_0xf6b70c,_0x222e93['options']);return db[_0xe172('0x3c')][_0xe172('0x45')](_0xf6b70c)[_0xe172('0x3d')](handleEntityNotFound(_0x17bcae,null))[_0xe172('0x3d')](respondWithResult(_0x17bcae,null))[_0xe172('0x42')](handleError(_0x17bcae,null));};exports[_0xe172('0x46')]=function(_0x4e8ec6,_0x2589f5){return db[_0xe172('0x3c')][_0xe172('0x46')](_0x4e8ec6['body'],{})[_0xe172('0x3d')](respondWithResult(_0x2589f5,0xc9))[_0xe172('0x42')](handleError(_0x2589f5,null));};exports[_0xe172('0x47')]=function(_0x49a7ea,_0x56ce56){return db[_0xe172('0x3c')]['describe']()[_0xe172('0x3d')](respondWithResult(_0x56ce56,null))[_0xe172('0x42')](handleError(_0x56ce56,null));};exports[_0xe172('0x48')]=function(_0x3a53fd,_0x2dcc72){if(_0x3a53fd[_0xe172('0x49')][_0xe172('0x4a')]){delete _0x3a53fd[_0xe172('0x49')][_0xe172('0x4a')];}return db[_0xe172('0x3c')][_0xe172('0x45')]({'where':{'uniqueid':_0x3a53fd['params']['id']}})[_0xe172('0x3d')](handleEntityNotFound(_0x2dcc72,null))['then'](saveUpdates(_0x3a53fd['body'],null))[_0xe172('0x3d')](respondWithResult(_0x2dcc72,null))[_0xe172('0x42')](handleError(_0x2dcc72,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index dcd3e3c..4af6bf0 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 _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 +var _0x287e=['path','rimraf','./cmHopperHistory.attributes','exports','define','endtime','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5e7278,_0x1e8110){var _0x56fd62=function(_0x2eae66){while(--_0x2eae66){_0x5e7278['push'](_0x5e7278['shift']());}};_0x56fd62(++_0x1e8110);}(_0x287e,0x1e3));var _0xe287=function(_0x169c52,_0x4fcd3c){_0x169c52=_0x169c52-0x0;var _0x448236=_0x287e[_0x169c52];return _0x448236;};'use strict';var _=require(_0xe287('0x0'));var util=require(_0xe287('0x1'));var logger=require(_0xe287('0x2'))(_0xe287('0x3'));var moment=require(_0xe287('0x4'));var BPromise=require(_0xe287('0x5'));var rp=require(_0xe287('0x6'));var fs=require('fs');var path=require(_0xe287('0x7'));var rimraf=require(_0xe287('0x8'));var config=require('../../config/environment');var attributes=require(_0xe287('0x9'));module[_0xe287('0xa')]=function(_0x5af7ce,_0x4b3807){return _0x5af7ce[_0xe287('0xb')]('CmHopperHistory',attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':'endtime','fields':[_0xe287('0xc')]},{'name':_0xe287('0xd'),'fields':[_0xe287('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 8a8173b..636219f 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 _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 +var _0x13f7=['GetCampaignHopperHistory','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','stringify','AvgHandleTime','findAll','raw','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','GetVoiceQueueHopperHistory','campaign','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','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','ivrTotalCallsDays','ivrAnswerCallsDay'];(function(_0x10e45e,_0x53efa5){var _0x444495=function(_0x24a734){while(--_0x24a734){_0x10e45e['push'](_0x10e45e['shift']());}};_0x444495(++_0x53efa5);}(_0x13f7,0x164));var _0x713f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x13f7[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x713f('0x0'));var util=require(_0x713f('0x1'));var moment=require(_0x713f('0x2'));var BPromise=require(_0x713f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x713f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x713f('0x5'));var logger=require(_0x713f('0x6'))(_0x713f('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x713f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2571f6,_0x57616c,_0x4f7a31){return new BPromise(function(_0x2a47f5,_0x59874f){return client[_0x713f('0x9')](_0x2571f6,_0x4f7a31)[_0x713f('0xa')](function(_0x3f594c){logger[_0x713f('0xb')](_0x713f('0xc'),_0x57616c,'request\x20sent');logger[_0x713f('0xd')](_0x713f('0xe'),_0x57616c,_0x713f('0xf'),JSON['stringify'](_0x3f594c));if(_0x3f594c[_0x713f('0x10')]){if(_0x3f594c[_0x713f('0x10')][_0x713f('0x11')]===0x1f4){logger[_0x713f('0x10')](_0x713f('0xc'),_0x57616c,_0x3f594c[_0x713f('0x10')][_0x713f('0x12')]);return _0x59874f(_0x3f594c[_0x713f('0x10')][_0x713f('0x12')]);}logger[_0x713f('0x10')](_0x713f('0xc'),_0x57616c,_0x3f594c[_0x713f('0x10')][_0x713f('0x12')]);return _0x2a47f5(_0x3f594c[_0x713f('0x10')]['message']);}else{logger[_0x713f('0xb')](_0x713f('0xc'),_0x57616c,'request\x20sent');_0x2a47f5(_0x3f594c[_0x713f('0x13')][_0x713f('0x12')]);}})[_0x713f('0x14')](function(_0x332b29){logger[_0x713f('0x10')](_0x713f('0xc'),_0x57616c,_0x332b29);_0x59874f(_0x332b29);});});}exports[_0x713f('0x15')]=function(_0x5a4501){var _0x55e850=this;return new Promise(function(_0x1f88ba,_0x49792d){return db[_0x713f('0x16')][_0x713f('0x17')](_0x5a4501[_0x713f('0x18')],{'raw':_0x5a4501[_0x713f('0x19')]?_0x5a4501['options']['raw']===undefined?!![]:![]:!![]})[_0x713f('0xa')](function(_0x184bfc){logger['info']('CreateCmHopperHistory',_0x5a4501);logger['debug'](_0x713f('0x15'),_0x5a4501,JSON[_0x713f('0x1a')](_0x184bfc));_0x1f88ba(_0x184bfc);})['catch'](function(_0x1f45be){logger[_0x713f('0x10')](_0x713f('0x15'),_0x1f45be[_0x713f('0x12')],_0x5a4501);_0x49792d(_0x55e850[_0x713f('0x10')](0x1f4,_0x1f45be[_0x713f('0x12')]));});});};exports[_0x713f('0x1b')]=function(_0x23a2e2){var _0x1b6fc1=this;return new Promise(function(_0x3dc44c,_0x193d69){return db[_0x713f('0x16')][_0x713f('0x1c')]({'raw':_0x23a2e2[_0x713f('0x19')]?_0x23a2e2[_0x713f('0x19')][_0x713f('0x1d')]===undefined?!![]:![]:!![],'where':_0x23a2e2[_0x713f('0x19')]?_0x23a2e2['options'][_0x713f('0x1e')]||null:null,'attributes':[[db[_0x713f('0x1f')]['fn'](_0x713f('0x20'),db[_0x713f('0x1f')][_0x713f('0x21')]('id')),_0x713f('0x22')],[db[_0x713f('0x1f')]['fn']('COUNT',db[_0x713f('0x1f')]['fn']('IF',db[_0x713f('0x1f')][_0x713f('0x23')](_0x713f('0x24')))),'predictiveIntervalAnsweredCalls'],[db['sequelize']['fn']('COUNT',db[_0x713f('0x1f')]['fn']('IF',db['sequelize'][_0x713f('0x23')](_0x713f('0x25')))),_0x713f('0x26')],[db[_0x713f('0x1f')]['fn'](_0x713f('0x20'),db[_0x713f('0x1f')]['fn']('IF',db[_0x713f('0x1f')][_0x713f('0x23')](_0x713f('0x27')))),_0x713f('0x28')],[db['sequelize']['fn']('AVG',db[_0x713f('0x1f')]['fn']('IF',db[_0x713f('0x1f')][_0x713f('0x23')](_0x713f('0x29')))),'predictiveIntervalAvgHoldtime'],[db[_0x713f('0x1f')]['fn'](_0x713f('0x2a'),db[_0x713f('0x1f')]['fn']('IF',db[_0x713f('0x1f')][_0x713f('0x23')](_0x713f('0x2b')))),'predictiveIntervalAvgTalktime']]})['then'](function(_0x11dfc2){logger[_0x713f('0xb')]('AvgHandleTime',_0x23a2e2);logger['debug'](_0x713f('0x1b'),_0x23a2e2,JSON[_0x713f('0x1a')](_0x11dfc2));_0x3dc44c(_0x11dfc2);})[_0x713f('0x14')](function(_0x402246){logger[_0x713f('0x10')]('AvgHandleTime',_0x402246[_0x713f('0x12')],_0x23a2e2);_0x193d69(_0x1b6fc1[_0x713f('0x10')](0x1f4,_0x402246[_0x713f('0x12')]));});});};exports[_0x713f('0x2c')]=function(_0xfdf0e){var _0x4fa1d9=this;return new Promise(function(_0x4a8999,_0xae87ea){return db[_0x713f('0x16')][_0x713f('0x1c')]({'raw':_0xfdf0e[_0x713f('0x19')]?_0xfdf0e[_0x713f('0x19')][_0x713f('0x1d')]===undefined?!![]:![]:!![],'where':_0xfdf0e['options']?_0xfdf0e['options']['where']||null:null,'attributes':[[_0x713f('0x2d'),_0x713f('0x2e')],[db[_0x713f('0x1f')]['fn'](_0x713f('0x20'),db[_0x713f('0x1f')]['fn']('IF',db[_0x713f('0x1f')][_0x713f('0x23')](_0x713f('0x2f')))),_0x713f('0x30')],[db[_0x713f('0x1f')]['fn']('COUNT',db[_0x713f('0x1f')]['fn']('IF',db[_0x713f('0x1f')][_0x713f('0x23')](_0x713f('0x31')))),_0x713f('0x32')],[db['sequelize']['fn']('COUNT',db[_0x713f('0x1f')]['fn']('IF',db[_0x713f('0x1f')][_0x713f('0x23')]('`state`\x20=\x204,\x201,\x20null'))),'outboundAnswerCallsDay'],[db[_0x713f('0x1f')]['fn']('COUNT',db[_0x713f('0x1f')]['fn']('IF',db[_0x713f('0x1f')]['literal'](_0x713f('0x33')))),'outboundBusyCallsDay'],[db[_0x713f('0x1f')]['fn'](_0x713f('0x20'),db[_0x713f('0x1f')]['fn']('IF',db[_0x713f('0x1f')][_0x713f('0x23')](_0x713f('0x34')))),_0x713f('0x35')],[db['sequelize']['fn'](_0x713f('0x20'),db[_0x713f('0x1f')]['fn']('IF',db[_0x713f('0x1f')][_0x713f('0x23')](_0x713f('0x36')))),_0x713f('0x37')],[db[_0x713f('0x1f')]['fn'](_0x713f('0x20'),db[_0x713f('0x1f')]['fn']('IF',db[_0x713f('0x1f')]['literal'](_0x713f('0x38')))),_0x713f('0x39')],[db[_0x713f('0x1f')]['fn']('COUNT',db[_0x713f('0x1f')]['fn']('IF',db[_0x713f('0x1f')][_0x713f('0x23')](_0x713f('0x3a')))),'outboundUnknownCallsDay'],[db[_0x713f('0x1f')]['fn']('COUNT',db[_0x713f('0x1f')]['fn']('IF',db[_0x713f('0x1f')][_0x713f('0x23')]('`state`\x20=\x2013,\x201,\x20null'))),_0x713f('0x3b')],[db[_0x713f('0x1f')]['fn'](_0x713f('0x20'),db[_0x713f('0x1f')]['fn']('IF',db['sequelize'][_0x713f('0x23')](_0x713f('0x3c')))),_0x713f('0x3d')],[db['sequelize']['fn'](_0x713f('0x20'),db[_0x713f('0x1f')]['fn']('IF',db[_0x713f('0x1f')][_0x713f('0x23')](_0x713f('0x3e')))),'outboundRejectCallsDay'],[db[_0x713f('0x1f')]['fn'](_0x713f('0x20'),db[_0x713f('0x1f')]['fn']('IF',db['sequelize'][_0x713f('0x23')]('`state`\x20=\x2016,\x201,\x20null'))),_0x713f('0x3f')],[db[_0x713f('0x1f')]['fn'](_0x713f('0x20'),db[_0x713f('0x1f')]['fn']('IF',db[_0x713f('0x1f')][_0x713f('0x23')](_0x713f('0x40')))),_0x713f('0x41')],[db[_0x713f('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x713f('0x1f')][_0x713f('0x23')](_0x713f('0x42')))),_0x713f('0x43')]],'group':[_0x713f('0x2d')]})[_0x713f('0xa')](function(_0x5aba02){logger[_0x713f('0xb')](_0x713f('0x2c'),_0xfdf0e);logger['debug'](_0x713f('0x2c'),_0xfdf0e,JSON[_0x713f('0x1a')](_0x5aba02));_0x4a8999(_0x5aba02);})[_0x713f('0x14')](function(_0x3d9391){logger[_0x713f('0x10')](_0x713f('0x2c'),_0x3d9391[_0x713f('0x12')],_0xfdf0e);_0xae87ea(_0x4fa1d9['error'](0x1f4,_0x3d9391[_0x713f('0x12')]));});});};exports['GetCampaignHopperHistory']=function(_0x1dfa64){var _0x24a35f=this;return new Promise(function(_0x64fe7d,_0x2de6ce){return db[_0x713f('0x16')][_0x713f('0x1c')]({'raw':_0x1dfa64[_0x713f('0x19')]?_0x1dfa64['options'][_0x713f('0x1d')]===undefined?!![]:![]:!![],'where':_0x1dfa64['options']?_0x1dfa64[_0x713f('0x19')][_0x713f('0x1e')]||null:null,'attributes':[[_0x713f('0x2d'),'name'],[db[_0x713f('0x1f')]['fn'](_0x713f('0x20'),db[_0x713f('0x1f')]['col']('id')),_0x713f('0x44')],[db[_0x713f('0x1f')]['fn'](_0x713f('0x20'),db[_0x713f('0x1f')]['fn']('IF',db[_0x713f('0x1f')][_0x713f('0x23')](_0x713f('0x24')))),_0x713f('0x45')]],'group':[_0x713f('0x2d')]})['then'](function(_0x5d164b){logger[_0x713f('0xb')](_0x713f('0x46'),_0x1dfa64);logger['debug'](_0x713f('0x46'),_0x1dfa64,JSON['stringify'](_0x5d164b));_0x64fe7d(_0x5d164b);})[_0x713f('0x14')](function(_0x40652a){logger[_0x713f('0x10')](_0x713f('0x46'),_0x40652a[_0x713f('0x12')],_0x1dfa64);_0x2de6ce(_0x24a35f[_0x713f('0x10')](0x1f4,_0x40652a[_0x713f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index dc77d70..7e1a69c 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 _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 +var _0xd3f2=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','create','put','exports','multer','connect-timeout'];(function(_0x253a64,_0x1dab6c){var _0x331880=function(_0x42f6f3){while(--_0x42f6f3){_0x253a64['push'](_0x253a64['shift']());}};_0x331880(++_0x1dab6c);}(_0xd3f2,0x1e8));var _0x2d3f=function(_0x48105b,_0x266487){_0x48105b=_0x48105b-0x0;var _0x1ca419=_0xd3f2[_0x48105b];return _0x1ca419;};'use strict';var multer=require(_0x2d3f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2d3f('0x1'));var express=require(_0x2d3f('0x2'));var router=express['Router']();var fs_extra=require(_0x2d3f('0x3'));var auth=require(_0x2d3f('0x4'));var interaction=require(_0x2d3f('0x5'));var config=require(_0x2d3f('0x6'));var controller=require('./cmHopperHistory.controller');router[_0x2d3f('0x7')]('/',auth[_0x2d3f('0x8')](),controller[_0x2d3f('0x9')]);router[_0x2d3f('0x7')]('/describe',auth[_0x2d3f('0x8')](),controller['describe']);router['get'](_0x2d3f('0xa'),auth[_0x2d3f('0x8')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x2d3f('0xb')]);router[_0x2d3f('0xc')]('/:id',auth[_0x2d3f('0x8')](),controller['update']);module[_0x2d3f('0xd')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index ec23edc..fb0d5b4 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 _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 +var _0x2fda=['sequelize','name','STRING'];(function(_0x34644f,_0x3f9b20){var _0x34e175=function(_0x4e7347){while(--_0x4e7347){_0x34644f['push'](_0x34644f['shift']());}};_0x34e175(++_0x3f9b20);}(_0x2fda,0x186));var _0xa2fd=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x2fda[_0xbb091];return _0x467a04;};'use strict';var Sequelize=require(_0xa2fd('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xa2fd('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa2fd('0x2')]},'dialPrefix':{'type':Sequelize[_0xa2fd('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index f741333..3d4420f 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 _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 +var _0x06a3=['Content-type','text/csv','download','addCustomField','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','queryInterface','addColumn','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','info','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','Lists','UserProfileResource','stack','name','send','index','CmList','rawAttributes','type','key','model','map','query','keys','filters','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','intersection','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','ListId','Disposition','getDispositions','findAll','removeDispositions','addContacts','CmContact','tags','isArray','join','push','each','omit','ids','dataValues','errors','message','getContacts','CmCustomField','CustomFields','cf_%d','raw','getContactsCsv','OrderBy','alias','select','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','field','c.cf_','customField_','item','cm_contact_has_items','additionalPhone_','description','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','description_additionalPhone_','toString','isEmpty','now','writeFileSync','format','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv'];(function(_0x5afeab,_0x536dcd){var _0x419cd3=function(_0x20edb8){while(--_0x20edb8){_0x5afeab['push'](_0x5afeab['shift']());}};_0x419cd3(++_0x536dcd);}(_0x06a3,0xc2));var _0x306a=function(_0x3144b3,_0x45f961){_0x3144b3=_0x3144b3-0x0;var _0x2517a9=_0x06a3[_0x3144b3];return _0x2517a9;};'use strict';var emlformat=require(_0x306a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x306a('0x1'));var jsonpatch=require(_0x306a('0x2'));var rp=require(_0x306a('0x3'));var moment=require(_0x306a('0x4'));var BPromise=require(_0x306a('0x5'));var Mustache=require(_0x306a('0x6'));var util=require('util');var path=require('path');var sox=require(_0x306a('0x7'));var csv=require(_0x306a('0x8'));var ejs=require(_0x306a('0x9'));var fs=require('fs');var fs_extra=require(_0x306a('0xa'));var _=require(_0x306a('0xb'));var squel=require('squel');var crypto=require(_0x306a('0xc'));var jsforce=require(_0x306a('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x306a('0xe'));var Papa=require(_0x306a('0xf'));var Redis=require(_0x306a('0x10'));var authService=require(_0x306a('0x11'));var qs=require(_0x306a('0x12'));var as=require(_0x306a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x306a('0x14'))(_0x306a('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x306a('0x16'));var db=require(_0x306a('0x17'))['db'];var csv_results;config[_0x306a('0x18')]=_[_0x306a('0x19')](config[_0x306a('0x18')],{'host':_0x306a('0x1a'),'port':0x18eb});var socket=require(_0x306a('0x1b'))(new Redis(config[_0x306a('0x18')]));require(_0x306a('0x1c'))[_0x306a('0x1d')](socket);function respondWithStatusCode(_0x4ead77,_0x16893b){_0x16893b=_0x16893b||0xcc;return function(_0x58a106){if(_0x58a106){return _0x4ead77[_0x306a('0x1e')](_0x16893b);}return _0x4ead77[_0x306a('0x1f')](_0x16893b)[_0x306a('0x20')]();};}function respondWithResult(_0x2d87fd,_0x423c14){_0x423c14=_0x423c14||0xc8;return function(_0x22f4df){if(_0x22f4df){return _0x2d87fd['status'](_0x423c14)[_0x306a('0x21')](_0x22f4df);}};}function respondWithFilteredResult(_0x59ea06,_0x336f9e){return function(_0x5cccf6){if(_0x5cccf6){var _0x4ccb84=typeof _0x336f9e[_0x306a('0x22')]===_0x306a('0x23')&&typeof _0x336f9e[_0x306a('0x24')]==='undefined';var _0x92f14a=_0x5cccf6[_0x306a('0x25')];var _0x724a5c=_0x4ccb84?0x0:_0x336f9e['offset'];var _0x366d6c=_0x4ccb84?_0x5cccf6['count']:_0x336f9e[_0x306a('0x22')]+_0x336f9e[_0x306a('0x24')];var _0x84e52d;if(_0x366d6c>=_0x92f14a){_0x366d6c=_0x92f14a;_0x84e52d=0xc8;}else{_0x84e52d=0xce;}_0x59ea06[_0x306a('0x1f')](_0x84e52d);return _0x59ea06[_0x306a('0x26')](_0x306a('0x27'),_0x724a5c+'-'+_0x366d6c+'/'+_0x92f14a)[_0x306a('0x21')](_0x5cccf6);}return null;};}function patchUpdates(_0x5f1416){return function(_0x5ce713){try{jsonpatch[_0x306a('0x28')](_0x5ce713,_0x5f1416,!![]);}catch(_0x2d8cea){return BPromise['reject'](_0x2d8cea);}return _0x5ce713[_0x306a('0x29')]();};}function saveUpdates(_0x3c1387,_0x242bf7){return function(_0x368a48){if(_0x368a48){return _0x368a48[_0x306a('0x2a')](_0x3c1387)[_0x306a('0x2b')](function(_0x7b1730){return _0x7b1730;});}return null;};}function removeEntity(_0x45e02d,_0x2dd7ae){return function(_0x25310f){if(_0x25310f){return _0x25310f[_0x306a('0x2c')]()['then'](function(){var _0x315752=_0x25310f[_0x306a('0x2d')]({'plain':!![]});var _0x379e5c=_0x306a('0x2e');return db[_0x306a('0x2f')][_0x306a('0x2c')]({'where':{'type':_0x379e5c,'resourceId':_0x315752['id']}})['then'](function(){return _0x25310f;});})[_0x306a('0x2b')](function(){_0x45e02d[_0x306a('0x1f')](0xcc)[_0x306a('0x20')]();});}};}function handleEntityNotFound(_0x341aa5,_0x45959f){return function(_0x31aaba){if(!_0x31aaba){_0x341aa5['sendStatus'](0x194);}return _0x31aaba;};}function handleError(_0x38b86f,_0x12fdb8){_0x12fdb8=_0x12fdb8||0x1f4;return function(_0x134331){logger['error'](_0x134331[_0x306a('0x30')]);if(_0x134331[_0x306a('0x31')]){delete _0x134331[_0x306a('0x31')];}_0x38b86f[_0x306a('0x1f')](_0x12fdb8)[_0x306a('0x32')](_0x134331);};}exports[_0x306a('0x33')]=function(_0x549b7d,_0x2215d0){var _0x4780b6={},_0x3520da={},_0x16880f={'count':0x0,'rows':[]};var _0x2496c0=_['map'](db[_0x306a('0x34')][_0x306a('0x35')],function(_0x810818){return{'name':_0x810818['fieldName'],'type':_0x810818[_0x306a('0x36')][_0x306a('0x37')]};});_0x3520da[_0x306a('0x38')]=_[_0x306a('0x39')](_0x2496c0,_0x306a('0x31'));_0x3520da[_0x306a('0x3a')]=_[_0x306a('0x3b')](_0x549b7d['query']);_0x3520da[_0x306a('0x3c')]=_['intersection'](_0x3520da[_0x306a('0x38')],_0x3520da[_0x306a('0x3a')]);_0x4780b6['attributes']=_['intersection'](_0x3520da[_0x306a('0x38')],qs[_0x306a('0x3d')](_0x549b7d['query'][_0x306a('0x3d')]));_0x4780b6[_0x306a('0x3e')]=_0x4780b6[_0x306a('0x3e')]['length']?_0x4780b6['attributes']:_0x3520da[_0x306a('0x38')];if(!_0x549b7d[_0x306a('0x3a')][_0x306a('0x3f')](_0x306a('0x40'))){_0x4780b6[_0x306a('0x24')]=qs[_0x306a('0x24')](_0x549b7d['query'][_0x306a('0x24')]);_0x4780b6[_0x306a('0x22')]=qs[_0x306a('0x22')](_0x549b7d[_0x306a('0x3a')][_0x306a('0x22')]);}_0x4780b6[_0x306a('0x41')]=qs['sort'](_0x549b7d[_0x306a('0x3a')][_0x306a('0x42')]);_0x4780b6[_0x306a('0x43')]=qs[_0x306a('0x3c')](_[_0x306a('0x44')](_0x549b7d['query'],_0x3520da[_0x306a('0x3c')]),_0x2496c0);if(_0x549b7d['query'][_0x306a('0x45')]){_0x4780b6[_0x306a('0x43')]=_[_0x306a('0x46')](_0x4780b6[_0x306a('0x43')],{'$or':_['map'](_0x2496c0,function(_0xb248e0){if(_0xb248e0[_0x306a('0x36')]!==_0x306a('0x47')){var _0x4694d7={};_0x4694d7[_0xb248e0[_0x306a('0x31')]]={'$like':'%'+_0x549b7d[_0x306a('0x3a')][_0x306a('0x45')]+'%'};return _0x4694d7;}})});}_0x4780b6=_['merge']({},_0x4780b6,_0x549b7d[_0x306a('0x48')]);var _0x314a7d={'where':_0x4780b6[_0x306a('0x43')]};return db['CmList']['count'](_0x314a7d)['then'](function(_0x5c980f){_0x16880f[_0x306a('0x25')]=_0x5c980f;if(_0x549b7d[_0x306a('0x3a')][_0x306a('0x49')]){_0x4780b6[_0x306a('0x4a')]=[{'all':!![]}];}return db[_0x306a('0x34')]['findAll'](_0x4780b6);})[_0x306a('0x2b')](function(_0x459836){_0x16880f[_0x306a('0x4b')]=_0x459836;return _0x16880f;})['then'](respondWithFilteredResult(_0x2215d0,_0x4780b6))[_0x306a('0x4c')](handleError(_0x2215d0,null));};exports['show']=function(_0x3b6cd7,_0x27f2ea){var _0x2f1bc0={'raw':![],'where':{'id':_0x3b6cd7[_0x306a('0x4d')]['id']}},_0x4d9b87={};_0x4d9b87[_0x306a('0x38')]=_['keys'](db[_0x306a('0x34')][_0x306a('0x35')]);_0x4d9b87[_0x306a('0x3a')]=_[_0x306a('0x3b')](_0x3b6cd7['query']);_0x4d9b87[_0x306a('0x3c')]=_[_0x306a('0x4e')](_0x4d9b87['model'],_0x4d9b87[_0x306a('0x3a')]);_0x2f1bc0[_0x306a('0x3e')]=_[_0x306a('0x4e')](_0x4d9b87['model'],qs[_0x306a('0x3d')](_0x3b6cd7[_0x306a('0x3a')][_0x306a('0x3d')]));_0x2f1bc0[_0x306a('0x3e')]=_0x2f1bc0[_0x306a('0x3e')][_0x306a('0x4f')]?_0x2f1bc0['attributes']:_0x4d9b87[_0x306a('0x38')];if(_0x3b6cd7[_0x306a('0x3a')][_0x306a('0x49')]){_0x2f1bc0[_0x306a('0x4a')]=[{'all':!![]}];}_0x2f1bc0=_['merge']({},_0x2f1bc0,_0x3b6cd7['options']);return db[_0x306a('0x34')][_0x306a('0x50')](_0x2f1bc0)['then'](handleEntityNotFound(_0x27f2ea,null))[_0x306a('0x2b')](respondWithResult(_0x27f2ea,null))['catch'](handleError(_0x27f2ea,null));};exports[_0x306a('0x51')]=function(_0x67f3fd,_0x5731db){return db['CmList']['create'](_0x67f3fd[_0x306a('0x52')],{})['then'](function(_0x41d9cb){var _0x513cb7=_0x67f3fd[_0x306a('0x53')][_0x306a('0x2d')]({'plain':!![]});if(!_0x513cb7)throw new Error(_0x306a('0x54'));if(_0x513cb7[_0x306a('0x55')]===_0x306a('0x53')){var _0x50f77a=_0x41d9cb[_0x306a('0x2d')]({'plain':!![]});var _0x8754ba='Lists';return db['UserProfileSection'][_0x306a('0x50')]({'where':{'name':_0x8754ba,'userProfileId':_0x513cb7['userProfileId']},'raw':!![]})[_0x306a('0x2b')](function(_0x4909e6){if(_0x4909e6&&_0x4909e6[_0x306a('0x56')]===0x0){return db[_0x306a('0x2f')][_0x306a('0x51')]({'name':_0x50f77a[_0x306a('0x31')],'resourceId':_0x50f77a['id'],'type':_0x4909e6['name'],'sectionId':_0x4909e6['id']},{})[_0x306a('0x2b')](function(){return _0x41d9cb;});}else{return _0x41d9cb;}})[_0x306a('0x4c')](function(_0x5f2cd8){logger[_0x306a('0x57')](_0x306a('0x58'),_0x5f2cd8);throw _0x5f2cd8;});}return _0x41d9cb;})[_0x306a('0x2b')](respondWithResult(_0x5731db,0xc9))[_0x306a('0x4c')](handleError(_0x5731db,null));};exports[_0x306a('0x2a')]=function(_0x41633e,_0x38d5b1){if(_0x41633e[_0x306a('0x52')]['id']){delete _0x41633e['body']['id'];}return db[_0x306a('0x34')][_0x306a('0x50')]({'where':{'id':_0x41633e[_0x306a('0x4d')]['id']}})[_0x306a('0x2b')](handleEntityNotFound(_0x38d5b1,null))['then'](saveUpdates(_0x41633e[_0x306a('0x52')],null))['then'](respondWithResult(_0x38d5b1,null))[_0x306a('0x4c')](handleError(_0x38d5b1,null));};exports[_0x306a('0x2c')]=function(_0x48725f,_0x449461){return db[_0x306a('0x34')][_0x306a('0x50')]({'where':{'id':_0x48725f[_0x306a('0x4d')]['id']}})[_0x306a('0x2b')](handleEntityNotFound(_0x449461,null))['then'](removeEntity(_0x449461,null))[_0x306a('0x4c')](handleError(_0x449461,null));};exports[_0x306a('0x59')]=function(_0x59e433,_0x5aebfa){return db[_0x306a('0x34')][_0x306a('0x59')]()[_0x306a('0x2b')](respondWithResult(_0x5aebfa,null))['catch'](handleError(_0x5aebfa,null));};exports['addDisposition']=function(_0x5967f7,_0x3635f3,_0x38d7b4){if(_0x5967f7[_0x306a('0x52')]['id']){delete _0x5967f7[_0x306a('0x52')]['id'];}return db[_0x306a('0x34')]['find']({'where':{'id':_0x5967f7[_0x306a('0x4d')]['id']}})[_0x306a('0x2b')](handleEntityNotFound(_0x3635f3,null))['then'](function(_0x2c9dad){if(_0x2c9dad){_0x5967f7[_0x306a('0x52')][_0x306a('0x5a')]=_0x2c9dad['id'];return db[_0x306a('0x5b')][_0x306a('0x51')](_0x5967f7[_0x306a('0x52')]);}})[_0x306a('0x2b')](respondWithResult(_0x3635f3,null))[_0x306a('0x4c')](handleError(_0x3635f3,null));};exports[_0x306a('0x5c')]=function(_0x36a522,_0x648657,_0x5108e5){var _0x226882={'raw':![],'where':{}};var _0x540373={};var _0x500065={'count':0x0,'rows':[]};return db[_0x306a('0x34')]['findOne']({'where':{'id':_0x36a522[_0x306a('0x4d')]['id']}})[_0x306a('0x2b')](handleEntityNotFound(_0x648657,null))[_0x306a('0x2b')](function(_0x4e4700){if(_0x4e4700){_0x540373['model']=_['keys'](db[_0x306a('0x5b')][_0x306a('0x35')]);_0x540373[_0x306a('0x3a')]=_[_0x306a('0x3b')](_0x36a522['query']);_0x540373[_0x306a('0x3c')]=_['intersection'](_0x540373['model'],_0x540373[_0x306a('0x3a')]);_0x226882[_0x306a('0x3e')]=_[_0x306a('0x4e')](_0x540373[_0x306a('0x38')],qs[_0x306a('0x3d')](_0x36a522[_0x306a('0x3a')][_0x306a('0x3d')]));_0x226882['attributes']=_0x226882[_0x306a('0x3e')][_0x306a('0x4f')]?_0x226882[_0x306a('0x3e')]:_0x540373[_0x306a('0x38')];if(!_0x36a522[_0x306a('0x3a')][_0x306a('0x3f')]('nolimit')){_0x226882[_0x306a('0x24')]=qs[_0x306a('0x24')](_0x36a522['query'][_0x306a('0x24')]);_0x226882[_0x306a('0x22')]=qs[_0x306a('0x22')](_0x36a522['query'][_0x306a('0x22')]);}_0x226882['order']=qs[_0x306a('0x42')](_0x36a522[_0x306a('0x3a')][_0x306a('0x42')]);_0x226882['where']=qs[_0x306a('0x3c')](_[_0x306a('0x44')](_0x36a522[_0x306a('0x3a')],_0x540373[_0x306a('0x3c')]));_0x226882[_0x306a('0x43')][_0x306a('0x5a')]=_0x4e4700['id'];if(_0x36a522[_0x306a('0x3a')][_0x306a('0x45')]){_0x226882[_0x306a('0x43')]=_[_0x306a('0x46')](_0x226882[_0x306a('0x43')],{'$or':_['map'](_0x226882[_0x306a('0x3e')],function(_0x3da61d){var _0x4fc953={};_0x4fc953[_0x3da61d]={'$like':'%'+_0x36a522[_0x306a('0x3a')][_0x306a('0x45')]+'%'};return _0x4fc953;})});}_0x226882=_['merge']({},_0x226882,_0x36a522[_0x306a('0x48')]);return db[_0x306a('0x5b')][_0x306a('0x25')]({'where':_0x226882[_0x306a('0x43')]})['then'](function(_0x2cf3d1){_0x500065[_0x306a('0x25')]=_0x2cf3d1;if(_0x36a522[_0x306a('0x3a')][_0x306a('0x49')]){_0x226882[_0x306a('0x4a')]=[{'all':!![]}];}return db[_0x306a('0x5b')][_0x306a('0x5d')](_0x226882);})[_0x306a('0x2b')](function(_0x381141){_0x500065[_0x306a('0x4b')]=_0x381141;return _0x500065;});}})[_0x306a('0x2b')](respondWithFilteredResult(_0x648657,_0x226882))[_0x306a('0x4c')](handleError(_0x648657,null));};exports[_0x306a('0x5e')]=function(_0x43953c,_0xd79cfd,_0x3cd15b){return db[_0x306a('0x34')][_0x306a('0x50')]({'where':{'id':_0x43953c[_0x306a('0x4d')]['id']}})['then'](handleEntityNotFound(_0xd79cfd,null))[_0x306a('0x2b')](function(_0x1bed91){if(_0x1bed91){return _0x1bed91[_0x306a('0x5e')](_0x43953c['query']['ids']);}})[_0x306a('0x2b')](respondWithStatusCode(_0xd79cfd,null))['catch'](handleError(_0xd79cfd,null));};exports[_0x306a('0x5f')]=function(_0x15e278,_0x16f479,_0x5dd97c){return db['CmList'][_0x306a('0x50')]({'where':{'id':_0x15e278['params']['id']}})['then'](handleEntityNotFound(_0x16f479,null))[_0x306a('0x2b')](function(_0x3858e2){if(_0x3858e2){var _0x1668a8=[];var _0x207e68={'success':[],'errors':[]};return db[_0x306a('0x60')]['describe']()['then'](function(_0x260ceb){if(_0x15e278[_0x306a('0x52')][_0x306a('0x61')]&&_[_0x306a('0x62')](_0x15e278[_0x306a('0x52')]['tags'])){if(_0x15e278['body'][_0x306a('0x61')][_0x306a('0x4f')]){_0x15e278[_0x306a('0x52')]['tags']=_0x15e278[_0x306a('0x52')][_0x306a('0x61')][_0x306a('0x63')](';')+';';}else{_0x15e278[_0x306a('0x52')][_0x306a('0x61')]=null;}}else{_0x15e278[_0x306a('0x52')]['tags']=null;}if(_0x15e278[_0x306a('0x52')]&&_[_0x306a('0x62')](_0x15e278[_0x306a('0x52')])){for(var _0x21409c=0x0;_0x21409c<_0x15e278[_0x306a('0x52')][_0x306a('0x4f')];_0x21409c+=0x1){_0x15e278[_0x306a('0x52')][_0x21409c]['ListId']=_0x15e278['params']['id'];_0x1668a8[_0x306a('0x64')](_0x15e278[_0x306a('0x52')][_0x21409c]);}return BPromise[_0x306a('0x65')](_0x1668a8,function(_0x151a91){return db['CmContact'][_0x306a('0x51')](_[_0x306a('0x66')](_0x151a91,[_0x306a('0x67'),'id'])||{},{'fields':_['keys'](_0x260ceb),'raw':!![]})['then'](function(_0x18d83f){_0x207e68['success'][_0x306a('0x64')](_0x18d83f[_0x306a('0x68')]);})[_0x306a('0x4c')](function(_0x46f3e5){_0x207e68[_0x306a('0x69')][_0x306a('0x64')]({'data':_0x151a91,'error':_0x46f3e5[_0x306a('0x6a')]});});})['then'](function(_0xb50d56){return _0x207e68;})[_0x306a('0x4c')](function(_0xd178b4){return _0xd178b4;});}else{_0x16f479['status'](0x190)[_0x306a('0x21')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0x306a('0x2b')](respondWithResult(_0x16f479,null))['catch'](handleError(_0x16f479,null));};exports[_0x306a('0x6b')]=function(_0x5b9b6f,_0x303cce,_0x21c71f){var _0xe2628e;return db['CmList'][_0x306a('0x50')]({'where':{'id':_0x5b9b6f[_0x306a('0x4d')]['id']},'include':[{'model':db[_0x306a('0x6c')],'as':_0x306a('0x6d')}]})['then'](handleEntityNotFound(_0x303cce,null))[_0x306a('0x2b')](function(_0x3850cf){if(_0x3850cf){_0xe2628e=_0x3850cf;return db[_0x306a('0x60')][_0x306a('0x35')];}})[_0x306a('0x2b')](function(_0x3e33dc){if(_0x3e33dc){var _0x4ff021={};var _0x335c16={};_0x335c16['model']=_['concat'](_[_0x306a('0x3b')](_0x3e33dc),_[_0x306a('0x39')](_0xe2628e[_0x306a('0x6d')],function(_0x4ff13a){return util['format'](_0x306a('0x6e'),_0x4ff13a['id']);}));_0x335c16[_0x306a('0x3a')]=_[_0x306a('0x3b')](_0x5b9b6f[_0x306a('0x3a')]);_0x335c16[_0x306a('0x3c')]=_['intersection'](_0x335c16[_0x306a('0x38')],_0x335c16[_0x306a('0x3a')]);_0x4ff021[_0x306a('0x3e')]=_[_0x306a('0x4e')](_0x335c16['model'],qs[_0x306a('0x3d')](_0x5b9b6f['query'][_0x306a('0x3d')]));_0x4ff021[_0x306a('0x3e')]=_0x4ff021[_0x306a('0x3e')][_0x306a('0x4f')]?_0x4ff021[_0x306a('0x3e')]:_0x335c16[_0x306a('0x38')];if(!_0x5b9b6f[_0x306a('0x3a')]['hasOwnProperty'](_0x306a('0x40'))){_0x4ff021[_0x306a('0x24')]=qs[_0x306a('0x24')](_0x5b9b6f['query'][_0x306a('0x24')]);_0x4ff021[_0x306a('0x22')]=qs[_0x306a('0x22')](_0x5b9b6f[_0x306a('0x3a')][_0x306a('0x22')]);}_0x4ff021['order']=qs[_0x306a('0x42')](_0x5b9b6f[_0x306a('0x3a')][_0x306a('0x42')]);_0x4ff021[_0x306a('0x43')]=qs[_0x306a('0x3c')](_['pick'](_0x5b9b6f[_0x306a('0x3a')],_0x335c16[_0x306a('0x3c')]));_0x4ff021[_0x306a('0x6f')]=!![];if(_0x5b9b6f['query'][_0x306a('0x45')]){_0x4ff021[_0x306a('0x43')]=_[_0x306a('0x46')](_0x4ff021[_0x306a('0x43')],{'$or':_[_0x306a('0x39')](_0x4ff021[_0x306a('0x3e')],function(_0x293780){var _0x31cf7a={};_0x31cf7a[_0x293780]={'$like':'%'+_0x5b9b6f[_0x306a('0x3a')][_0x306a('0x45')]+'%'};return _0x31cf7a;})});}_0x4ff021=_['merge']({},_0x4ff021,_0x5b9b6f[_0x306a('0x48')]);return _0xe2628e[_0x306a('0x6b')](_0x4ff021);}})[_0x306a('0x2b')](respondWithResult(_0x303cce,null))[_0x306a('0x4c')](handleError(_0x303cce,null));};exports[_0x306a('0x70')]=function(_0x3c94c7,_0x52f17f,_0x4b146d){var _0x2523d8;var _0x5f0b2e;var _0x17b61c;var _0x2258c5=_0x3c94c7[_0x306a('0x4d')]['id'];csv_results=[];return db['ContactItemType'][_0x306a('0x5d')]({'attributes':['id','name'],'raw':!![],'order':[_0x306a('0x71')]})[_0x306a('0x2b')](function(_0x234c06){_0x2523d8=_0x234c06;var _0x4f296b=_[_0x306a('0x3b')](db[_0x306a('0x60')][_0x306a('0x35')]);return db[_0x306a('0x6c')]['findAll']({'raw':!![],'attributes':['id',_0x306a('0x72')]})[_0x306a('0x2b')](function(_0x602f74){_0x5f0b2e=_0x602f74;var _0xbd1329=squel[_0x306a('0x73')]()[_0x306a('0x3d')](_0x4f296b)[_0x306a('0x74')](_0x306a('0x75'),'c')[_0x306a('0x43')](_0x306a('0x76'),_0x2258c5)['where'](_0x306a('0x77'))['distinct']();for(var _0x419cf1=0x0;_0x419cf1<_0x5f0b2e['length'];_0x419cf1++){_0xbd1329[_0x306a('0x78')](_0x306a('0x79')+_0x5f0b2e[_0x419cf1]['id'],_0x306a('0x7a')+_0x5f0b2e[_0x419cf1][_0x306a('0x72')]);}for(var _0x419cf1=0x0;_0x419cf1<_0x2523d8['length'];_0x419cf1++){_0xbd1329[_0x306a('0x78')](squel[_0x306a('0x73')]()['field'](_0x306a('0x7b'))['from'](_0x306a('0x7c'))[_0x306a('0x43')]('ItemTypeId\x20=\x20?',_0x2523d8[_0x419cf1]['id'])[_0x306a('0x43')]('CmContactId\x20=\x20c.id'),_0x306a('0x7d')+_0x2523d8[_0x419cf1][_0x306a('0x31')]);_0xbd1329['field'](squel[_0x306a('0x73')]()['field'](_0x306a('0x7e'))['from'](_0x306a('0x7c'))[_0x306a('0x43')](_0x306a('0x7f'),_0x2523d8[_0x419cf1]['id'])[_0x306a('0x43')](_0x306a('0x80')),_0x306a('0x81')+_0x2523d8[_0x419cf1]['name']);}var _0x16cdc2=[];_0x16cdc2['push'](_0xbd1329[_0x306a('0x82')]());BPromise[_0x306a('0x65')](_0x16cdc2,handleQuery)[_0x306a('0x2b')](function(_0x18442b){handleQuery(_0xbd1329[_0x306a('0x82')]());var _0x12ae4c=csv_results[0x0];if(!_[_0x306a('0x83')](_0x12ae4c)){var _0x4b0d30=toCsv(_0x12ae4c);var _0x46cb2e=Date[_0x306a('0x84')]();fs[_0x306a('0x85')](util[_0x306a('0x86')](_0x306a('0x87'),_0x2258c5,_0x46cb2e),_0x4b0d30);_0x52f17f[_0x306a('0x88')](_0x306a('0x89'),_0x306a('0x8a')+util[_0x306a('0x86')](_0x306a('0x8b'),_0x2258c5,_0x46cb2e));_0x52f17f['setHeader'](_0x306a('0x8c'),_0x306a('0x8d'));return _0x52f17f[_0x306a('0x8e')](util['format'](_0x306a('0x87'),_0x2258c5,_0x46cb2e));}else{return _0x52f17f[_0x306a('0x1e')](0xcc);}});});});};exports[_0x306a('0x8f')]=function(_0x56cf4b,_0x214747,_0x4668fe){var _0x42fbce;delete _0x56cf4b[_0x306a('0x52')]['id'];return db[_0x306a('0x34')]['findOne']({'where':{'id':_0x56cf4b[_0x306a('0x4d')]['id']}})[_0x306a('0x2b')](handleEntityNotFound(_0x214747,null))[_0x306a('0x2b')](function(_0x2d05bb){if(_0x2d05bb){return db[_0x306a('0x90')][_0x306a('0x91')](function(_0x1b30c8){return db[_0x306a('0x6c')][_0x306a('0x51')](_0x56cf4b['body'],{'transaction':_0x1b30c8})[_0x306a('0x2b')](function(_0x1b2f3c){_0x42fbce=_0x1b2f3c;return _0x2d05bb['addCustomFields'](_0x1b2f3c,{'transaction':_0x1b30c8});})[_0x306a('0x2b')](function(){var _0x53de15={'type':db[_0x306a('0x92')][_0x306a('0x93')],'transaction':_0x1b30c8};switch(_0x56cf4b[_0x306a('0x52')][_0x306a('0x36')]){case _0x306a('0x94'):_0x53de15[_0x306a('0x36')]=db[_0x306a('0x92')][_0x306a('0x93')];break;case _0x306a('0x95'):_0x53de15['type']=db[_0x306a('0x92')][_0x306a('0x96')];break;case _0x306a('0x97'):_0x53de15[_0x306a('0x36')]=db[_0x306a('0x92')][_0x306a('0x98')];_0x53de15['defaultValue']=![];break;default:}return db[_0x306a('0x90')][_0x306a('0x99')][_0x306a('0x9a')](_0x306a('0x75'),util[_0x306a('0x86')](_0x306a('0x9b'),_0x42fbce['id']),_0x53de15);})[_0x306a('0x2b')](function(){return _0x42fbce;});});}})[_0x306a('0x2b')](respondWithResult(_0x214747,null))[_0x306a('0x4c')](handleError(_0x214747,null));};exports[_0x306a('0x9c')]=function(_0x1c5ceb,_0x4806a6,_0x43cf2c){var _0x1820bf={};var _0x5040fd={};var _0x309e04;var _0x5c841d;return db[_0x306a('0x34')]['findOne']({'where':{'id':_0x1c5ceb[_0x306a('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4806a6,null))['then'](function(_0x4e5721){if(_0x4e5721){_0x309e04=_0x4e5721;_0x5040fd[_0x306a('0x38')]=_[_0x306a('0x3b')](db[_0x306a('0x6c')][_0x306a('0x35')]);_0x5040fd[_0x306a('0x3a')]=_[_0x306a('0x3b')](_0x1c5ceb[_0x306a('0x3a')]);_0x5040fd[_0x306a('0x3c')]=_[_0x306a('0x4e')](_0x5040fd[_0x306a('0x38')],_0x5040fd['query']);_0x1820bf[_0x306a('0x3e')]=_[_0x306a('0x4e')](_0x5040fd[_0x306a('0x38')],qs[_0x306a('0x3d')](_0x1c5ceb['query'][_0x306a('0x3d')]));_0x1820bf[_0x306a('0x3e')]=_0x1820bf['attributes']['length']?_0x1820bf[_0x306a('0x3e')]:_0x5040fd[_0x306a('0x38')];_0x1820bf[_0x306a('0x41')]=qs[_0x306a('0x42')](_0x1c5ceb['query'][_0x306a('0x42')]);_0x1820bf[_0x306a('0x43')]=qs[_0x306a('0x3c')](_[_0x306a('0x44')](_0x1c5ceb[_0x306a('0x3a')],_0x5040fd[_0x306a('0x3c')]));_0x1820bf[_0x306a('0x43')]=_[_0x306a('0x46')](_0x1820bf[_0x306a('0x43')],{'$or':[{'ListId':_0x4e5721['id']},{'ListId':null}]});if(_0x1c5ceb['query'][_0x306a('0x45')]){_0x1820bf[_0x306a('0x43')]=_['merge'](_0x1820bf['where'],{'$or':_[_0x306a('0x39')](_0x1820bf[_0x306a('0x3e')],function(_0x231f52){var _0x3407fd={};_0x3407fd[_0x231f52]={'$like':'%'+_0x1c5ceb[_0x306a('0x3a')][_0x306a('0x45')]+'%'};return _0x3407fd;})});}_0x1820bf=_[_0x306a('0x46')]({},_0x1820bf,_0x1c5ceb[_0x306a('0x48')]);return db[_0x306a('0x6c')][_0x306a('0x9d')](_0x1820bf);}})[_0x306a('0x2b')](respondWithResult(_0x4806a6,null))[_0x306a('0x4c')](handleError(_0x4806a6,null));};exports[_0x306a('0x9e')]=function(_0xdaa3db,_0xae1ce9){return db[_0x306a('0x6c')][_0x306a('0x9d')]({'where':{'ListId':null}})[_0x306a('0x2b')](handleEntityNotFound(_0xae1ce9,null))[_0x306a('0x2b')](function(_0x2df051){return _0x2df051;})[_0x306a('0x2b')](respondWithResult(_0xae1ce9,null))['catch'](handleError(_0xae1ce9,null));};exports[_0x306a('0x9f')]=function(_0xa7b317,_0x49bb74,_0xc05709){return db[_0x306a('0x34')][_0x306a('0x50')]({'where':{'id':_0xa7b317[_0x306a('0x4d')]['id']}})[_0x306a('0x2b')](handleEntityNotFound(_0x49bb74,null))['then'](function(_0x2c3e47){if(_0x2c3e47){return _0x2c3e47['addAgents'](_0xa7b317[_0x306a('0x52')]['ids'],_['omit'](_0xa7b317[_0x306a('0x52')],[_0x306a('0x67'),'id'])||{})[_0x306a('0xa0')](function(_0x56d402){for(var _0x44e08d=0x0;_0x44e08d<_0xa7b317[_0x306a('0x52')][_0x306a('0x67')][_0x306a('0x4f')];_0x44e08d+=0x1){socket[_0x306a('0xa1')](_0x306a('0xa2'),{'UserId':Number(_0xa7b317[_0x306a('0x52')][_0x306a('0x67')][_0x44e08d]),'CmListId':Number(_0xa7b317[_0x306a('0x4d')]['id'])});}return _0x56d402;});}})[_0x306a('0x2b')](respondWithResult(_0x49bb74,null))['catch'](handleError(_0x49bb74,null));};exports['removeAgents']=function(_0x3e43af,_0x31bbe2,_0x3e3c0b){return db[_0x306a('0x34')]['find']({'where':{'id':_0x3e43af[_0x306a('0x4d')]['id']}})[_0x306a('0x2b')](handleEntityNotFound(_0x31bbe2,null))['then'](function(_0x345bc9){if(_0x345bc9){return _0x345bc9[_0x306a('0xa3')](_0x3e43af[_0x306a('0x3a')]['ids'])[_0x306a('0x2b')](function(){if(_[_0x306a('0x62')](_0x3e43af[_0x306a('0x3a')][_0x306a('0x67')])){for(var _0x387ee0=0x0;_0x387ee0<_0x3e43af[_0x306a('0x3a')][_0x306a('0x67')][_0x306a('0x4f')];_0x387ee0+=0x1){socket['emit'](_0x306a('0xa4'),{'UserId':Number(_0x3e43af['query'][_0x306a('0x67')][_0x387ee0]),'CmListId':Number(_0x3e43af[_0x306a('0x4d')]['id'])});}}else{socket['emit'](_0x306a('0xa4'),{'UserId':Number(_0x3e43af[_0x306a('0x3a')][_0x306a('0x67')]),'CmListId':Number(_0x3e43af['params']['id'])});}});}})[_0x306a('0x2b')](respondWithStatusCode(_0x31bbe2,null))[_0x306a('0x4c')](handleError(_0x31bbe2,null));};exports[_0x306a('0xa5')]=function(_0xb25964,_0x4887e9,_0x5def43){var _0x2cd2ad={};var _0x5ad0c0={};var _0x4cec52;var _0x26f6db;return db[_0x306a('0x34')]['findOne']({'where':{'id':_0xb25964[_0x306a('0x4d')]['id']}})[_0x306a('0x2b')](handleEntityNotFound(_0x4887e9,null))[_0x306a('0x2b')](function(_0x3b19bf){if(_0x3b19bf){_0x4cec52=_0x3b19bf;_0x5ad0c0[_0x306a('0x38')]=_[_0x306a('0x3b')](db['User'][_0x306a('0x35')]);_0x5ad0c0[_0x306a('0x3a')]=_[_0x306a('0x3b')](_0xb25964[_0x306a('0x3a')]);_0x5ad0c0[_0x306a('0x3c')]=_[_0x306a('0x4e')](_0x5ad0c0['model'],_0x5ad0c0[_0x306a('0x3a')]);_0x2cd2ad[_0x306a('0x3e')]=_['intersection'](_0x5ad0c0[_0x306a('0x38')],qs[_0x306a('0x3d')](_0xb25964[_0x306a('0x3a')][_0x306a('0x3d')]));_0x2cd2ad[_0x306a('0x3e')]=_0x2cd2ad[_0x306a('0x3e')][_0x306a('0x4f')]?_0x2cd2ad[_0x306a('0x3e')]:_0x5ad0c0[_0x306a('0x38')];_0x2cd2ad[_0x306a('0x41')]=qs[_0x306a('0x42')](_0xb25964['query'][_0x306a('0x42')]);_0x2cd2ad[_0x306a('0x43')]=qs['filters'](_[_0x306a('0x44')](_0xb25964[_0x306a('0x3a')],_0x5ad0c0['filters']));if(_0xb25964[_0x306a('0x3a')]['filter']){_0x2cd2ad[_0x306a('0x43')]=_[_0x306a('0x46')](_0x2cd2ad[_0x306a('0x43')],{'$or':_[_0x306a('0x39')](_0x2cd2ad[_0x306a('0x3e')],function(_0x34728e){var _0x1fe82f={};_0x1fe82f[_0x34728e]={'$like':'%'+_0xb25964['query'][_0x306a('0x45')]+'%'};return _0x1fe82f;})});}_0x2cd2ad=_[_0x306a('0x46')]({},_0x2cd2ad,_0xb25964[_0x306a('0x48')]);return _0x4cec52[_0x306a('0xa5')](_0x2cd2ad);}})[_0x306a('0x2b')](function(_0x28fa1e){if(_0x28fa1e){_0x26f6db=_0x28fa1e[_0x306a('0x4f')];if(!_0xb25964[_0x306a('0x3a')][_0x306a('0x3f')](_0x306a('0x40'))){_0x2cd2ad['limit']=qs['limit'](_0xb25964[_0x306a('0x3a')][_0x306a('0x24')]);_0x2cd2ad['offset']=qs[_0x306a('0x22')](_0xb25964[_0x306a('0x3a')]['offset']);}return _0x4cec52[_0x306a('0xa5')](_0x2cd2ad);}})[_0x306a('0x2b')](function(_0x429f8c){if(_0x429f8c){return _0x429f8c?{'count':_0x26f6db,'rows':_0x429f8c}:null;}})[_0x306a('0x2b')](respondWithResult(_0x4887e9,null))[_0x306a('0x4c')](handleError(_0x4887e9,null));};function handleQuery(_0x5b0999){logger[_0x306a('0xa6')](_0x5b0999);return db['sequelize'][_0x306a('0x3a')](_0x5b0999)[_0x306a('0xa0')](function(_0x5d92cf){csv_results['push'](_0x5d92cf);})[_0x306a('0x4c')](function(_0xa812b6){logger[_0x306a('0x57')](_0xa812b6[_0x306a('0x6a')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index e42c4fb..67b71c0 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 _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 +var _0x326f=['exports','events','setMaxListeners','save','update','remove','emit','hook'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x326f,0xd1));var _0xf326=function(_0x16f832,_0x4d4718){_0x16f832=_0x16f832-0x0;var _0x342438=_0x326f[_0x16f832];return _0x342438;};'use strict';var EventEmitter=require(_0xf326('0x0'));var CmList=require('../../mysqldb')['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0xf326('0x1')](0x0);var events={'afterCreate':_0xf326('0x2'),'afterUpdate':_0xf326('0x3'),'afterDestroy':_0xf326('0x4')};function emitEvent(_0x27e8d7){return function(_0x120a26,_0x9445c6,_0xf1c243){CmListEvents[_0xf326('0x5')](_0x27e8d7+':'+_0x120a26['id'],_0x120a26);CmListEvents[_0xf326('0x5')](_0x27e8d7,_0x120a26);_0xf1c243(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xf326('0x6')](e,emitEvent(event));}}module[_0xf326('0x7')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index c37bf0d..ca5d371 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 _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 +var _0x153f=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./cmList.attributes','exports','define','cm_lists','lodash'];(function(_0x10bad8,_0x366904){var _0x19f4eb=function(_0x6c0395){while(--_0x6c0395){_0x10bad8['push'](_0x10bad8['shift']());}};_0x19f4eb(++_0x366904);}(_0x153f,0x15b));var _0xf153=function(_0x9fff39,_0x1728d6){_0x9fff39=_0x9fff39-0x0;var _0x2f2064=_0x153f[_0x9fff39];return _0x2f2064;};'use strict';var _=require(_0xf153('0x0'));var util=require(_0xf153('0x1'));var logger=require(_0xf153('0x2'))(_0xf153('0x3'));var moment=require(_0xf153('0x4'));var BPromise=require(_0xf153('0x5'));var rp=require(_0xf153('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf153('0x7'));var config=require('../../config/environment');var attributes=require(_0xf153('0x8'));module[_0xf153('0x9')]=function(_0x342a45,_0xafd987){return _0x342a45[_0xf153('0xa')]('CmList',attributes,{'tableName':_0xf153('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index b1ac170..fad79a4 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 _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 +var _0xad97=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','defaults','redis','localhost','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x19dd8a,_0x4af545){var _0x6245d3=function(_0x16e70b){while(--_0x16e70b){_0x19dd8a['push'](_0x19dd8a['shift']());}};_0x6245d3(++_0x4af545);}(_0xad97,0x100));var _0x7ad9=function(_0x3a0bc0,_0x54dbfe){_0x3a0bc0=_0x3a0bc0-0x0;var _0x84ad8e=_0xad97[_0x3a0bc0];return _0x84ad8e;};'use strict';var _=require(_0x7ad9('0x0'));var util=require(_0x7ad9('0x1'));var moment=require(_0x7ad9('0x2'));var BPromise=require(_0x7ad9('0x3'));var rs=require(_0x7ad9('0x4'));var fs=require('fs');var Redis=require(_0x7ad9('0x5'));var db=require(_0x7ad9('0x6'))['db'];var utils=require(_0x7ad9('0x7'));var logger=require(_0x7ad9('0x8'))(_0x7ad9('0x9'));var config=require(_0x7ad9('0xa'));var jayson=require(_0x7ad9('0xb'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x7ad9('0xc')](config[_0x7ad9('0xd')],{'host':_0x7ad9('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x7ad9('0xf'))[_0x7ad9('0x10')](socket);function respondWithRpcPromise(_0xbfa695,_0x28950d,_0x4eac4e){return new BPromise(function(_0x528b44,_0x30e872){return client[_0x7ad9('0x11')](_0xbfa695,_0x4eac4e)[_0x7ad9('0x12')](function(_0x459f0d){logger[_0x7ad9('0x13')](_0x7ad9('0x14'),_0x28950d,_0x7ad9('0x15'));logger[_0x7ad9('0x16')](_0x7ad9('0x17'),_0x28950d,'request\x20sent',JSON[_0x7ad9('0x18')](_0x459f0d));if(_0x459f0d[_0x7ad9('0x19')]){if(_0x459f0d[_0x7ad9('0x19')]['code']===0x1f4){logger[_0x7ad9('0x19')]('CmList,\x20%s,\x20%s',_0x28950d,_0x459f0d['error'][_0x7ad9('0x1a')]);return _0x30e872(_0x459f0d[_0x7ad9('0x19')]['message']);}logger['error']('CmList,\x20%s,\x20%s',_0x28950d,_0x459f0d['error'][_0x7ad9('0x1a')]);return _0x528b44(_0x459f0d['error'][_0x7ad9('0x1a')]);}else{logger['info'](_0x7ad9('0x14'),_0x28950d,_0x7ad9('0x15'));_0x528b44(_0x459f0d[_0x7ad9('0x1b')][_0x7ad9('0x1a')]);}})[_0x7ad9('0x1c')](function(_0x4a997f){logger[_0x7ad9('0x19')](_0x7ad9('0x14'),_0x28950d,_0x4a997f);_0x30e872(_0x4a997f);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 47a91a7..75f0808 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 _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 +var _0xe3e4=['save','remove','emit','removeListener','length','cmList:','./cmList.events'];(function(_0x1b880d,_0x3fec46){var _0x5e373f=function(_0x46a38d){while(--_0x46a38d){_0x1b880d['push'](_0x1b880d['shift']());}};_0x5e373f(++_0x3fec46);}(_0xe3e4,0xc3));var _0x4e3e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe3e4[_0x14add3];return _0x4a174f;};'use strict';var CmListEvents=require(_0x4e3e('0x0'));var events=[_0x4e3e('0x1'),_0x4e3e('0x2'),'update'];function createListener(_0xaf4ad0,_0x1c6aaf){return function(_0x28e820){_0x1c6aaf[_0x4e3e('0x3')](_0xaf4ad0,_0x28e820);};}function removeListener(_0x1a9d32,_0x556719){return function(){CmListEvents[_0x4e3e('0x4')](_0x1a9d32,_0x556719);};}exports['register']=function(_0x1ecf60){for(var _0x30dba7=0x0,_0x2f5942=events[_0x4e3e('0x5')];_0x30dba7<_0x2f5942;_0x30dba7++){var _0x33c6dd=events[_0x30dba7];var _0x2727c7=createListener(_0x4e3e('0x6')+_0x33c6dd,_0x1ecf60);CmListEvents['on'](_0x33c6dd,_0x2727c7);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 8a8c0fe..673f663 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 _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 +var _0xfeff=['/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','addDisposition','addContacts','addCustomField','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','/global_fields','getGlobalCustomFields','/:id','show','/:id/dispositions'];(function(_0x369ca2,_0x5cf8b3){var _0x291175=function(_0x54c24e){while(--_0x54c24e){_0x369ca2['push'](_0x369ca2['shift']());}};_0x291175(++_0x5cf8b3);}(_0xfeff,0xe5));var _0xffef=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0xfeff[_0x2fc012];return _0x2891f9;};'use strict';var multer=require(_0xffef('0x0'));var util=require(_0xffef('0x1'));var path=require(_0xffef('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xffef('0x3'));var interaction=require(_0xffef('0x4'));var config=require(_0xffef('0x5'));var controller=require(_0xffef('0x6'));router[_0xffef('0x7')]('/',auth[_0xffef('0x8')](),controller[_0xffef('0x9')]);router['get'](_0xffef('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xffef('0x7')](_0xffef('0xb'),auth['isAuthenticated'](),controller[_0xffef('0xc')]);router[_0xffef('0x7')](_0xffef('0xd'),auth['isAuthenticated'](),controller[_0xffef('0xe')]);router[_0xffef('0x7')](_0xffef('0xf'),auth[_0xffef('0x8')](),controller['getDispositions']);router['get'](_0xffef('0x10'),auth[_0xffef('0x8')](),controller[_0xffef('0x11')]);router['get'](_0xffef('0x12'),auth[_0xffef('0x8')](),controller[_0xffef('0x13')]);router['get'](_0xffef('0x14'),auth[_0xffef('0x8')](),controller[_0xffef('0x15')]);router[_0xffef('0x7')](_0xffef('0x16'),auth[_0xffef('0x8')](),controller[_0xffef('0x17')]);router[_0xffef('0x18')]('/',auth[_0xffef('0x8')](),controller['create']);router[_0xffef('0x18')](_0xffef('0xf'),auth[_0xffef('0x8')](),controller[_0xffef('0x19')]);router['post'](_0xffef('0x10'),auth[_0xffef('0x8')](),controller[_0xffef('0x1a')]);router['post']('/:id/fields',auth[_0xffef('0x8')](),controller[_0xffef('0x1b')]);router[_0xffef('0x18')](_0xffef('0x16'),auth[_0xffef('0x8')](),controller[_0xffef('0x1c')]);router[_0xffef('0x1d')](_0xffef('0xd'),auth[_0xffef('0x8')](),controller[_0xffef('0x1e')]);router[_0xffef('0x1f')](_0xffef('0xd'),auth[_0xffef('0x8')](),controller[_0xffef('0x20')]);router[_0xffef('0x1f')](_0xffef('0xf'),auth[_0xffef('0x8')](),controller[_0xffef('0x21')]);router[_0xffef('0x1f')](_0xffef('0x16'),auth['isAuthenticated'](),controller[_0xffef('0x22')]);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 398b432..c8f6e0a 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 _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 +var _0xb9d7=['exports','field','STRING'];(function(_0x55be9d,_0x2e6054){var _0x52c348=function(_0x1f0483){while(--_0x1f0483){_0x55be9d['push'](_0x55be9d['shift']());}};_0x52c348(++_0x2e6054);}(_0xb9d7,0x93));var _0x7b9d=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0xb9d7[_0x40220a];return _0x3903cc;};'use strict';var Sequelize=require('sequelize');module[_0x7b9d('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x1f4b8e){return this['getDataValue'](_0x7b9d('0x1'));}},'field':{'type':Sequelize[_0x7b9d('0x2')],'allowNull':![]},'operator':{'type':Sequelize[_0x7b9d('0x2')],'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 4d0927e..212ce6f 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_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 +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(_0x4485bd,_0x1a82b2){var _0x12dd5e=function(_0x2fb2c8){while(--_0x2fb2c8){_0x4485bd['push'](_0x4485bd['shift']());}};_0x12dd5e(++_0x1a82b2);}(_0x7a54,0x106));var _0x47a5=function(_0x88959a,_0x270c39){_0x88959a=_0x88959a-0x0;var _0x39d20a=_0x7a54[_0x88959a];return _0x39d20a;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 0ff8d01..8f25282 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 _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 +var _0x636a=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./condition.attributes','define','Condition','lodash'];(function(_0x25fda6,_0x13adf3){var _0x1e0e1d=function(_0x4d0906){while(--_0x4d0906){_0x25fda6['push'](_0x25fda6['shift']());}};_0x1e0e1d(++_0x13adf3);}(_0x636a,0x9f));var _0xa636=function(_0x12c98e,_0x2d0b4b){_0x12c98e=_0x12c98e-0x0;var _0x198b35=_0x636a[_0x12c98e];return _0x198b35;};'use strict';var _=require(_0xa636('0x0'));var util=require('util');var logger=require(_0xa636('0x1'))('api');var moment=require(_0xa636('0x2'));var BPromise=require(_0xa636('0x3'));var rp=require(_0xa636('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa636('0x5'));var config=require(_0xa636('0x6'));var attributes=require(_0xa636('0x7'));module['exports']=function(_0x243b10,_0x369990){return _0x243b10[_0xa636('0x8')](_0xa636('0x9'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index b9d4a64..0f9e342 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 _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 +var _0xb418=['stringify','error','code','Condition,\x20%s,\x20%s','message','info','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','request\x20sent','Condition,\x20%s,\x20%s,\x20%s'];(function(_0x5adace,_0x389162){var _0x2778c9=function(_0x1c33e4){while(--_0x1c33e4){_0x5adace['push'](_0x5adace['shift']());}};_0x2778c9(++_0x389162);}(_0xb418,0x126));var _0x8b41=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xb418[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0x8b41('0x0'));var util=require(_0x8b41('0x1'));var moment=require(_0x8b41('0x2'));var BPromise=require(_0x8b41('0x3'));var rs=require(_0x8b41('0x4'));var fs=require('fs');var Redis=require(_0x8b41('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8b41('0x6'))('rpc');var config=require(_0x8b41('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3d2e6b,_0x47fa4f,_0x1ceec7){return new BPromise(function(_0x587709,_0xe6df48){return client['request'](_0x3d2e6b,_0x1ceec7)['then'](function(_0x432f7d){logger['info']('Condition,\x20%s,\x20%s',_0x47fa4f,_0x8b41('0x8'));logger['debug'](_0x8b41('0x9'),_0x47fa4f,_0x8b41('0x8'),JSON[_0x8b41('0xa')](_0x432f7d));if(_0x432f7d[_0x8b41('0xb')]){if(_0x432f7d['error'][_0x8b41('0xc')]===0x1f4){logger[_0x8b41('0xb')](_0x8b41('0xd'),_0x47fa4f,_0x432f7d[_0x8b41('0xb')]['message']);return _0xe6df48(_0x432f7d['error'][_0x8b41('0xe')]);}logger[_0x8b41('0xb')](_0x8b41('0xd'),_0x47fa4f,_0x432f7d[_0x8b41('0xb')][_0x8b41('0xe')]);return _0x587709(_0x432f7d['error'][_0x8b41('0xe')]);}else{logger[_0x8b41('0xf')](_0x8b41('0xd'),_0x47fa4f,'request\x20sent');_0x587709(_0x432f7d['result'][_0x8b41('0xe')]);}})['catch'](function(_0x153f31){logger[_0x8b41('0xb')](_0x8b41('0xd'),_0x47fa4f,_0x153f31);_0xe6df48(_0x153f31);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 1a6fa69..1778391 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 _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 +var _0x3715=['isAuthenticated','update','destroy','exports','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put'];(function(_0x34613c,_0x40f76d){var _0x1aa6d3=function(_0x265b21){while(--_0x265b21){_0x34613c['push'](_0x34613c['shift']());}};_0x1aa6d3(++_0x40f76d);}(_0x3715,0x124));var _0x5371=function(_0x314ad8,_0x5b542c){_0x314ad8=_0x314ad8-0x0;var _0xf7a58e=_0x3715[_0x314ad8];return _0xf7a58e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5371('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5371('0x1')]();var fs_extra=require(_0x5371('0x2'));var auth=require(_0x5371('0x3'));var interaction=require(_0x5371('0x4'));var config=require(_0x5371('0x5'));var controller=require(_0x5371('0x6'));router[_0x5371('0x7')]('/:id',auth[_0x5371('0x8')](),controller[_0x5371('0x9')]);router['delete']('/:id',auth[_0x5371('0x8')](),controller[_0x5371('0xa')]);module[_0x5371('0xb')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 1c546ab..872edee 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 _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 +var _0x4360=['INTEGER','sequelize','exports','STRING','name'];(function(_0x44a1d0,_0x44146f){var _0x2a5ace=function(_0xe75579){while(--_0xe75579){_0x44a1d0['push'](_0x44a1d0['shift']());}};_0x2a5ace(++_0x44146f);}(_0x4360,0x97));var _0x0436=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x4360[_0x24061a];return _0x82054e;};'use strict';var Sequelize=require(_0x0436('0x0'));module[_0x0436('0x1')]={'name':{'type':Sequelize[_0x0436('0x2')],'allowNull':![],'unique':_0x0436('0x3')},'OrderBy':{'type':Sequelize[_0x0436('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x0436('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 d3577e1..4e34916 100644 --- a/server/api/contactItemType/contactItemType.controller.js +++ b/server/api/contactItemType/contactItemType.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6a95=['get','ContactItemTypes','error','name','send','map','ContactItemType','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','show','keys','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','CmContactHasItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy'];(function(_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 +var _0x1399=['model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','count','findAll','rows','show','rawAttributes','includeAll','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','undefined','limit','set','Content-Range','json','apply','reject','save','update','then','ContactItemTypes','UserProfileResource','sendStatus','error','stack','name','send','index','map','ContactItemType','fieldName'];(function(_0x4295de,_0xdb1ee7){var _0x28cafb=function(_0x330283){while(--_0x330283){_0x4295de['push'](_0x4295de['shift']());}};_0x28cafb(++_0xdb1ee7);}(_0x1399,0x16c));var _0x9139=function(_0x33e5c4,_0x1cc395){_0x33e5c4=_0x33e5c4-0x0;var _0x258bc0=_0x1399[_0x33e5c4];return _0x258bc0;};'use strict';var emlformat=require(_0x9139('0x0'));var rimraf=require(_0x9139('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9139('0x2'));var rp=require('request-promise');var moment=require(_0x9139('0x3'));var BPromise=require(_0x9139('0x4'));var Mustache=require(_0x9139('0x5'));var util=require(_0x9139('0x6'));var path=require(_0x9139('0x7'));var sox=require(_0x9139('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9139('0x9'));var _=require(_0x9139('0xa'));var squel=require(_0x9139('0xb'));var crypto=require('crypto');var jsforce=require(_0x9139('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9139('0xd'));var Papa=require(_0x9139('0xe'));var Redis=require('ioredis');var authService=require(_0x9139('0xf'));var qs=require(_0x9139('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9139('0x11'))(_0x9139('0x12'));var utils=require(_0x9139('0x13'));var config=require(_0x9139('0x14'));var licenseUtil=require(_0x9139('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52b32d,_0x511ec9){_0x511ec9=_0x511ec9||0xcc;return function(_0x417637){if(_0x417637){return _0x52b32d['sendStatus'](_0x511ec9);}return _0x52b32d[_0x9139('0x16')](_0x511ec9)[_0x9139('0x17')]();};}function respondWithResult(_0x375ada,_0x262009){_0x262009=_0x262009||0xc8;return function(_0x5936d2){if(_0x5936d2){return _0x375ada[_0x9139('0x16')](_0x262009)['json'](_0x5936d2);}};}function respondWithFilteredResult(_0x58307f,_0x52c57b){return function(_0x159e50){if(_0x159e50){var _0x3e2bad=typeof _0x52c57b[_0x9139('0x18')]===_0x9139('0x19')&&typeof _0x52c57b[_0x9139('0x1a')]===_0x9139('0x19');var _0x4bd957=_0x159e50['count'];var _0x13cab8=_0x3e2bad?0x0:_0x52c57b[_0x9139('0x18')];var _0x5e0a59=_0x3e2bad?_0x159e50['count']:_0x52c57b[_0x9139('0x18')]+_0x52c57b[_0x9139('0x1a')];var _0x56add4;if(_0x5e0a59>=_0x4bd957){_0x5e0a59=_0x4bd957;_0x56add4=0xc8;}else{_0x56add4=0xce;}_0x58307f[_0x9139('0x16')](_0x56add4);return _0x58307f[_0x9139('0x1b')](_0x9139('0x1c'),_0x13cab8+'-'+_0x5e0a59+'/'+_0x4bd957)[_0x9139('0x1d')](_0x159e50);}return null;};}function patchUpdates(_0xd2eb33){return function(_0x6f901b){try{jsonpatch[_0x9139('0x1e')](_0x6f901b,_0xd2eb33,!![]);}catch(_0x45fa16){return BPromise[_0x9139('0x1f')](_0x45fa16);}return _0x6f901b[_0x9139('0x20')]();};}function saveUpdates(_0x1bac18,_0x269f8a){return function(_0x5a3e2e){if(_0x5a3e2e){return _0x5a3e2e[_0x9139('0x21')](_0x1bac18)[_0x9139('0x22')](function(_0x31635a){return _0x31635a;});}return null;};}function removeEntity(_0x1aee3b,_0x934732){return function(_0x1a7350){if(_0x1a7350){return _0x1a7350['destroy']()[_0x9139('0x22')](function(){var _0x31c22d=_0x1a7350['get']({'plain':!![]});var _0x3ed4da=_0x9139('0x23');return db[_0x9139('0x24')]['destroy']({'where':{'type':_0x3ed4da,'resourceId':_0x31c22d['id']}})[_0x9139('0x22')](function(){return _0x1a7350;});})[_0x9139('0x22')](function(){_0x1aee3b['status'](0xcc)[_0x9139('0x17')]();});}};}function handleEntityNotFound(_0x39e8cf,_0x452d9a){return function(_0x55e95f){if(!_0x55e95f){_0x39e8cf[_0x9139('0x25')](0x194);}return _0x55e95f;};}function handleError(_0x22e11e,_0x2a35fd){_0x2a35fd=_0x2a35fd||0x1f4;return function(_0x22994c){logger[_0x9139('0x26')](_0x22994c[_0x9139('0x27')]);if(_0x22994c[_0x9139('0x28')]){delete _0x22994c['name'];}_0x22e11e['status'](_0x2a35fd)[_0x9139('0x29')](_0x22994c);};}exports[_0x9139('0x2a')]=function(_0xd27355,_0x4c1693){var _0x50d545={},_0x24e8d5={},_0x2118a2={'count':0x0,'rows':[]};var _0x2dff49=_[_0x9139('0x2b')](db[_0x9139('0x2c')]['rawAttributes'],function(_0x5a1673){return{'name':_0x5a1673[_0x9139('0x2d')],'type':_0x5a1673['type']['key']};});_0x24e8d5[_0x9139('0x2e')]=_[_0x9139('0x2b')](_0x2dff49,'name');_0x24e8d5[_0x9139('0x2f')]=_[_0x9139('0x30')](_0xd27355['query']);_0x24e8d5[_0x9139('0x31')]=_[_0x9139('0x32')](_0x24e8d5[_0x9139('0x2e')],_0x24e8d5[_0x9139('0x2f')]);_0x50d545[_0x9139('0x33')]=_[_0x9139('0x32')](_0x24e8d5[_0x9139('0x2e')],qs[_0x9139('0x34')](_0xd27355[_0x9139('0x2f')][_0x9139('0x34')]));_0x50d545[_0x9139('0x33')]=_0x50d545['attributes'][_0x9139('0x35')]?_0x50d545[_0x9139('0x33')]:_0x24e8d5['model'];if(!_0xd27355[_0x9139('0x2f')][_0x9139('0x36')](_0x9139('0x37'))){_0x50d545['limit']=qs[_0x9139('0x1a')](_0xd27355[_0x9139('0x2f')][_0x9139('0x1a')]);_0x50d545[_0x9139('0x18')]=qs[_0x9139('0x18')](_0xd27355[_0x9139('0x2f')][_0x9139('0x18')]);}_0x50d545[_0x9139('0x38')]=qs[_0x9139('0x39')](_0xd27355[_0x9139('0x2f')]['sort']);_0x50d545[_0x9139('0x3a')]=qs[_0x9139('0x31')](_[_0x9139('0x3b')](_0xd27355[_0x9139('0x2f')],_0x24e8d5[_0x9139('0x31')]),_0x2dff49);if(_0xd27355[_0x9139('0x2f')][_0x9139('0x3c')]){_0x50d545['where']=_[_0x9139('0x3d')](_0x50d545['where'],{'$or':_[_0x9139('0x2b')](_0x2dff49,function(_0x11789e){if(_0x11789e[_0x9139('0x3e')]!=='VIRTUAL'){var _0x1228b6={};_0x1228b6[_0x11789e[_0x9139('0x28')]]={'$like':'%'+_0xd27355[_0x9139('0x2f')][_0x9139('0x3c')]+'%'};return _0x1228b6;}})});}_0x50d545=_[_0x9139('0x3d')]({},_0x50d545,_0xd27355[_0x9139('0x3f')]);var _0x3c98a4={'where':_0x50d545[_0x9139('0x3a')]};return db[_0x9139('0x2c')][_0x9139('0x40')](_0x3c98a4)['then'](function(_0xf14393){_0x2118a2[_0x9139('0x40')]=_0xf14393;if(_0xd27355[_0x9139('0x2f')]['includeAll']){_0x50d545['include']=[{'all':!![]}];}return db['ContactItemType'][_0x9139('0x41')](_0x50d545);})[_0x9139('0x22')](function(_0x3611b4){_0x2118a2[_0x9139('0x42')]=_0x3611b4;return _0x2118a2;})[_0x9139('0x22')](respondWithFilteredResult(_0x4c1693,_0x50d545))['catch'](handleError(_0x4c1693,null));};exports[_0x9139('0x43')]=function(_0x2f3ed4,_0x40fd52){var _0xf81f77={'raw':!![],'where':{'id':_0x2f3ed4['params']['id']}},_0x2197ff={};_0x2197ff[_0x9139('0x2e')]=_[_0x9139('0x30')](db[_0x9139('0x2c')][_0x9139('0x44')]);_0x2197ff['query']=_['keys'](_0x2f3ed4[_0x9139('0x2f')]);_0x2197ff[_0x9139('0x31')]=_['intersection'](_0x2197ff['model'],_0x2197ff[_0x9139('0x2f')]);_0xf81f77[_0x9139('0x33')]=_['intersection'](_0x2197ff[_0x9139('0x2e')],qs[_0x9139('0x34')](_0x2f3ed4['query'][_0x9139('0x34')]));_0xf81f77['attributes']=_0xf81f77['attributes'][_0x9139('0x35')]?_0xf81f77[_0x9139('0x33')]:_0x2197ff[_0x9139('0x2e')];if(_0x2f3ed4[_0x9139('0x2f')][_0x9139('0x45')]){_0xf81f77['include']=[{'all':!![]}];}_0xf81f77=_[_0x9139('0x3d')]({},_0xf81f77,_0x2f3ed4[_0x9139('0x3f')]);return db[_0x9139('0x2c')]['find'](_0xf81f77)[_0x9139('0x22')](handleEntityNotFound(_0x40fd52,null))[_0x9139('0x22')](respondWithResult(_0x40fd52,null))[_0x9139('0x46')](handleError(_0x40fd52,null));};exports[_0x9139('0x47')]=function(_0x215793,_0x31395f){return db[_0x9139('0x2c')][_0x9139('0x47')](_0x215793[_0x9139('0x48')],{})[_0x9139('0x22')](function(_0x2da28c){var _0x54c926=_0x215793[_0x9139('0x49')][_0x9139('0x4a')]({'plain':!![]});if(!_0x54c926)throw new Error(_0x9139('0x4b'));if(_0x54c926['role']===_0x9139('0x49')){var _0x46f77a=_0x2da28c['get']({'plain':!![]});var _0x2f4a6f=_0x9139('0x23');return db[_0x9139('0x4c')]['find']({'where':{'name':_0x2f4a6f,'userProfileId':_0x54c926[_0x9139('0x4d')]},'raw':!![]})[_0x9139('0x22')](function(_0x1404ce){if(_0x1404ce&&_0x1404ce[_0x9139('0x4e')]===0x0){return db['UserProfileResource'][_0x9139('0x47')]({'name':_0x46f77a[_0x9139('0x28')],'resourceId':_0x46f77a['id'],'type':_0x1404ce[_0x9139('0x28')],'sectionId':_0x1404ce['id']},{})['then'](function(){return _0x2da28c;});}else{return _0x2da28c;}})[_0x9139('0x46')](function(_0x146201){logger[_0x9139('0x26')](_0x9139('0x4f'),_0x146201);throw _0x146201;});}return _0x2da28c;})[_0x9139('0x22')](respondWithResult(_0x31395f,0xc9))[_0x9139('0x46')](handleError(_0x31395f,null));};exports[_0x9139('0x21')]=function(_0x5857bf,_0x35002d){if(_0x5857bf[_0x9139('0x48')]['id']){delete _0x5857bf['body']['id'];}return db[_0x9139('0x2c')][_0x9139('0x50')]({'where':{'id':_0x5857bf[_0x9139('0x51')]['id']}})[_0x9139('0x22')](handleEntityNotFound(_0x35002d,null))[_0x9139('0x22')](saveUpdates(_0x5857bf['body'],null))[_0x9139('0x22')](respondWithResult(_0x35002d,null))[_0x9139('0x46')](handleError(_0x35002d,null));};exports['destroy']=function(_0x500863,_0x212d56){return db[_0x9139('0x2c')][_0x9139('0x50')]({'where':{'id':_0x500863['params']['id']}})[_0x9139('0x22')](handleEntityNotFound(_0x212d56,null))['then'](db['CmContactHasItem'][_0x9139('0x21')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x500863[_0x9139('0x51')]['id']}}))[_0x9139('0x22')](removeEntity(_0x212d56,null))[_0x9139('0x46')](handleError(_0x212d56,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 897ed98..7d97ead 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 _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 +var _0x6ec3=['./contactItemType.attributes','exports','define','ContactItemType','tools_contact_item_types','lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment'];(function(_0x89e603,_0x3ba533){var _0x3f864f=function(_0x51407b){while(--_0x51407b){_0x89e603['push'](_0x89e603['shift']());}};_0x3f864f(++_0x3ba533);}(_0x6ec3,0xa1));var _0x36ec=function(_0x16b662,_0x54351d){_0x16b662=_0x16b662-0x0;var _0x359406=_0x6ec3[_0x16b662];return _0x359406;};'use strict';var _=require(_0x36ec('0x0'));var util=require(_0x36ec('0x1'));var logger=require(_0x36ec('0x2'))('api');var moment=require(_0x36ec('0x3'));var BPromise=require('bluebird');var rp=require(_0x36ec('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x36ec('0x5'));var config=require(_0x36ec('0x6'));var attributes=require(_0x36ec('0x7'));module[_0x36ec('0x8')]=function(_0x4c3c8f,_0x13ac0c){return _0x4c3c8f[_0x36ec('0x9')](_0x36ec('0xa'),attributes,{'tableName':_0x36ec('0xb'),'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 ae3ad95..a2c0ee9 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 _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 +var _0xa89d=['info','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','ContactItemType,\x20%s,\x20%s','message','result','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x22a12e,_0x145edd){var _0x590bb4=function(_0x30c490){while(--_0x30c490){_0x22a12e['push'](_0x22a12e['shift']());}};_0x590bb4(++_0x145edd);}(_0xa89d,0xdc));var _0xda89=function(_0x57da3f,_0x2c5af7){_0x57da3f=_0x57da3f-0x0;var _0x23cb82=_0xa89d[_0x57da3f];return _0x23cb82;};'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')]('ContactItemType,\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/contactItemType/index.js b/server/api/contactItemType/index.js index 2f1c12e..e1cdba7 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 _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 +var _0x3cf4=['get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x293b7d,_0xe44902){var _0x31c609=function(_0x317b53){while(--_0x317b53){_0x293b7d['push'](_0x293b7d['shift']());}};_0x31c609(++_0xe44902);}(_0x3cf4,0x1bb));var _0x43cf=function(_0x117e50,_0x144d10){_0x117e50=_0x117e50-0x0;var _0x3c90fb=_0x3cf4[_0x117e50];return _0x3c90fb;};'use strict';var multer=require('multer');var util=require(_0x43cf('0x0'));var path=require(_0x43cf('0x1'));var timeout=require(_0x43cf('0x2'));var express=require('express');var router=express[_0x43cf('0x3')]();var fs_extra=require(_0x43cf('0x4'));var auth=require(_0x43cf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x43cf('0x6'));var controller=require('./contactItemType.controller');router[_0x43cf('0x7')]('/',auth[_0x43cf('0x8')](),controller[_0x43cf('0x9')]);router['get'](_0x43cf('0xa'),auth[_0x43cf('0x8')](),controller[_0x43cf('0xb')]);router[_0x43cf('0xc')]('/',auth[_0x43cf('0x8')](),controller[_0x43cf('0xd')]);router['put']('/:id',auth[_0x43cf('0x8')](),controller[_0x43cf('0xe')]);router[_0x43cf('0xf')]('/:id',auth[_0x43cf('0x8')](),controller[_0x43cf('0x10')]);module[_0x43cf('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 a9772b5..a3dfda5 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['exports','STRING'];(function(_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 +var _0xb10b=['name','sequelize','STRING'];(function(_0x57b522,_0xc07120){var _0x1d9911=function(_0x56fcd6){while(--_0x56fcd6){_0x57b522['push'](_0x57b522['shift']());}};_0x1d9911(++_0xc07120);}(_0xb10b,0x12a));var _0xbb10=function(_0x2e38e0,_0x5841ba){_0x2e38e0=_0x2e38e0-0x0;var _0x173804=_0xb10b[_0x2e38e0];return _0x173804;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 704a5d1..45a2695 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 _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 +var _0x8caf=['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','UserProfileResource','iframe','attrUrl','attrs','value','custom','attrPath','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','DashboardId','DashboardItem','findOne','order','getItems','nolimit','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','jsforce','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','get','CustomDashboards','end','error','stack','name','index','map','Dashboard','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','VIRTUAL','filter','merge','includeAll','include','rows','catch','show','params','options','find'];(function(_0x15fc7a,_0xd21741){var _0x3aa9f4=function(_0x313108){while(--_0x313108){_0x15fc7a['push'](_0x15fc7a['shift']());}};_0x3aa9f4(++_0xd21741);}(_0x8caf,0x12f));var _0xf8ca=function(_0x316ad3,_0x24e897){_0x316ad3=_0x316ad3-0x0;var _0x1d81e0=_0x8caf[_0x316ad3];return _0x1d81e0;};'use strict';var emlformat=require(_0xf8ca('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf8ca('0x1'));var jsonpatch=require(_0xf8ca('0x2'));var rp=require(_0xf8ca('0x3'));var moment=require(_0xf8ca('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf8ca('0x5'));var util=require(_0xf8ca('0x6'));var path=require(_0xf8ca('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf8ca('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf8ca('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xf8ca('0xa'));var querystring=require(_0xf8ca('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf8ca('0xc'));var as=require(_0xf8ca('0xd'));var hardwareService=require(_0xf8ca('0xe'));var logger=require(_0xf8ca('0xf'))('api');var utils=require(_0xf8ca('0x10'));var config=require(_0xf8ca('0x11'));var licenseUtil=require(_0xf8ca('0x12'));var db=require(_0xf8ca('0x13'))['db'];config[_0xf8ca('0x14')]=_[_0xf8ca('0x15')](config[_0xf8ca('0x14')],{'host':_0xf8ca('0x16'),'port':0x18eb});var socket=require(_0xf8ca('0x17'))(new Redis(config[_0xf8ca('0x14')]));require('./dashboard.socket')[_0xf8ca('0x18')](socket);function respondWithStatusCode(_0x337114,_0x4e6c03){_0x4e6c03=_0x4e6c03||0xcc;return function(_0x4c7074){if(_0x4c7074){return _0x337114[_0xf8ca('0x19')](_0x4e6c03);}return _0x337114[_0xf8ca('0x1a')](_0x4e6c03)['end']();};}function respondWithResult(_0x5305a6,_0x1fe569){_0x1fe569=_0x1fe569||0xc8;return function(_0x1cb8ad){if(_0x1cb8ad){return _0x5305a6[_0xf8ca('0x1a')](_0x1fe569)[_0xf8ca('0x1b')](_0x1cb8ad);}};}function respondWithFilteredResult(_0x238077,_0xf6e44f){return function(_0x2196a8){if(_0x2196a8){var _0x23f19b=typeof _0xf6e44f[_0xf8ca('0x1c')]===_0xf8ca('0x1d')&&typeof _0xf6e44f[_0xf8ca('0x1e')]===_0xf8ca('0x1d');var _0x415b91=_0x2196a8[_0xf8ca('0x1f')];var _0x4f15e0=_0x23f19b?0x0:_0xf6e44f['offset'];var _0x1ad917=_0x23f19b?_0x2196a8[_0xf8ca('0x1f')]:_0xf6e44f['offset']+_0xf6e44f[_0xf8ca('0x1e')];var _0x338089;if(_0x1ad917>=_0x415b91){_0x1ad917=_0x415b91;_0x338089=0xc8;}else{_0x338089=0xce;}_0x238077[_0xf8ca('0x1a')](_0x338089);return _0x238077[_0xf8ca('0x20')](_0xf8ca('0x21'),_0x4f15e0+'-'+_0x1ad917+'/'+_0x415b91)['json'](_0x2196a8);}return null;};}function patchUpdates(_0x3d4738){return function(_0x2806d6){try{jsonpatch[_0xf8ca('0x22')](_0x2806d6,_0x3d4738,!![]);}catch(_0x10c6ca){return BPromise[_0xf8ca('0x23')](_0x10c6ca);}return _0x2806d6[_0xf8ca('0x24')]();};}function saveUpdates(_0xd20e73,_0x22dfb0){return function(_0x59bfef){if(_0x59bfef){return _0x59bfef[_0xf8ca('0x25')](_0xd20e73)['then'](function(_0x27e068){return _0x27e068;});}return null;};}function removeEntity(_0x16f259,_0x408a00){return function(_0x22d97d){if(_0x22d97d){return _0x22d97d[_0xf8ca('0x26')]()[_0xf8ca('0x27')](function(){var _0x279555=_0x22d97d[_0xf8ca('0x28')]({'plain':!![]});var _0x4e759e=_0xf8ca('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0x4e759e,'resourceId':_0x279555['id']}})['then'](function(){return _0x22d97d;});})[_0xf8ca('0x27')](function(){_0x16f259[_0xf8ca('0x1a')](0xcc)[_0xf8ca('0x2a')]();});}};}function handleEntityNotFound(_0xa33c22,_0x2ab869){return function(_0x3a93dc){if(!_0x3a93dc){_0xa33c22[_0xf8ca('0x19')](0x194);}return _0x3a93dc;};}function handleError(_0xe5e59b,_0x1ea4e5){_0x1ea4e5=_0x1ea4e5||0x1f4;return function(_0x52e733){logger[_0xf8ca('0x2b')](_0x52e733[_0xf8ca('0x2c')]);if(_0x52e733[_0xf8ca('0x2d')]){delete _0x52e733[_0xf8ca('0x2d')];}_0xe5e59b['status'](_0x1ea4e5)['send'](_0x52e733);};}exports[_0xf8ca('0x2e')]=function(_0x4ed548,_0x3c0295){var _0x51913e={},_0x5d1be7={},_0x8899af={'count':0x0,'rows':[]};var _0x5157af=_[_0xf8ca('0x2f')](db[_0xf8ca('0x30')][_0xf8ca('0x31')],function(_0xae72ff){return{'name':_0xae72ff[_0xf8ca('0x32')],'type':_0xae72ff[_0xf8ca('0x33')]['key']};});_0x5d1be7[_0xf8ca('0x34')]=_[_0xf8ca('0x2f')](_0x5157af,'name');_0x5d1be7[_0xf8ca('0x35')]=_[_0xf8ca('0x36')](_0x4ed548[_0xf8ca('0x35')]);_0x5d1be7[_0xf8ca('0x37')]=_[_0xf8ca('0x38')](_0x5d1be7[_0xf8ca('0x34')],_0x5d1be7[_0xf8ca('0x35')]);_0x51913e[_0xf8ca('0x39')]=_[_0xf8ca('0x38')](_0x5d1be7[_0xf8ca('0x34')],qs[_0xf8ca('0x3a')](_0x4ed548['query'][_0xf8ca('0x3a')]));_0x51913e['attributes']=_0x51913e[_0xf8ca('0x39')][_0xf8ca('0x3b')]?_0x51913e['attributes']:_0x5d1be7['model'];if(!_0x4ed548[_0xf8ca('0x35')][_0xf8ca('0x3c')]('nolimit')){_0x51913e['limit']=qs[_0xf8ca('0x1e')](_0x4ed548[_0xf8ca('0x35')][_0xf8ca('0x1e')]);_0x51913e[_0xf8ca('0x1c')]=qs['offset'](_0x4ed548[_0xf8ca('0x35')][_0xf8ca('0x1c')]);}_0x51913e['order']=qs[_0xf8ca('0x3d')](_0x4ed548['query'][_0xf8ca('0x3d')]);_0x51913e[_0xf8ca('0x3e')]=qs['filters'](_[_0xf8ca('0x3f')](_0x4ed548[_0xf8ca('0x35')],_0x5d1be7[_0xf8ca('0x37')]),_0x5157af);if(_0x4ed548[_0xf8ca('0x35')]['filter']){_0x51913e[_0xf8ca('0x3e')]=_['merge'](_0x51913e['where'],{'$or':_[_0xf8ca('0x2f')](_0x5157af,function(_0x1036cc){if(_0x1036cc['type']!==_0xf8ca('0x40')){var _0x5ab11f={};_0x5ab11f[_0x1036cc[_0xf8ca('0x2d')]]={'$like':'%'+_0x4ed548['query'][_0xf8ca('0x41')]+'%'};return _0x5ab11f;}})});}_0x51913e=_[_0xf8ca('0x42')]({},_0x51913e,_0x4ed548['options']);var _0x3c6ab5={'where':_0x51913e[_0xf8ca('0x3e')]};return db['Dashboard']['count'](_0x3c6ab5)[_0xf8ca('0x27')](function(_0x51b3d9){_0x8899af[_0xf8ca('0x1f')]=_0x51b3d9;if(_0x4ed548[_0xf8ca('0x35')][_0xf8ca('0x43')]){_0x51913e[_0xf8ca('0x44')]=[{'all':!![]}];}return db[_0xf8ca('0x30')]['findAll'](_0x51913e);})[_0xf8ca('0x27')](function(_0x524a33){_0x8899af[_0xf8ca('0x45')]=_0x524a33;return _0x8899af;})[_0xf8ca('0x27')](respondWithFilteredResult(_0x3c0295,_0x51913e))[_0xf8ca('0x46')](handleError(_0x3c0295,null));};exports[_0xf8ca('0x47')]=function(_0x5808c8,_0x567be8){var _0x2198d4={'raw':![],'where':{'id':_0x5808c8[_0xf8ca('0x48')]['id']}},_0x37b5fd={};_0x37b5fd[_0xf8ca('0x34')]=_['keys'](db[_0xf8ca('0x30')][_0xf8ca('0x31')]);_0x37b5fd['query']=_['keys'](_0x5808c8['query']);_0x37b5fd['filters']=_[_0xf8ca('0x38')](_0x37b5fd[_0xf8ca('0x34')],_0x37b5fd['query']);_0x2198d4[_0xf8ca('0x39')]=_[_0xf8ca('0x38')](_0x37b5fd['model'],qs[_0xf8ca('0x3a')](_0x5808c8[_0xf8ca('0x35')][_0xf8ca('0x3a')]));_0x2198d4[_0xf8ca('0x39')]=_0x2198d4[_0xf8ca('0x39')][_0xf8ca('0x3b')]?_0x2198d4[_0xf8ca('0x39')]:_0x37b5fd[_0xf8ca('0x34')];if(_0x5808c8[_0xf8ca('0x35')]['includeAll']){_0x2198d4[_0xf8ca('0x44')]=[{'all':!![]}];}_0x2198d4=_[_0xf8ca('0x42')]({},_0x2198d4,_0x5808c8[_0xf8ca('0x49')]);return db['Dashboard'][_0xf8ca('0x4a')](_0x2198d4)[_0xf8ca('0x27')](handleEntityNotFound(_0x567be8,null))[_0xf8ca('0x27')](respondWithResult(_0x567be8,null))['catch'](handleError(_0x567be8,null));};exports[_0xf8ca('0x4b')]=function(_0x425841,_0x592fed){return db['Dashboard']['create'](_0x425841[_0xf8ca('0x4c')],{})[_0xf8ca('0x27')](function(_0x1c49dd){var _0xb7c0b2=_0x425841[_0xf8ca('0x4d')][_0xf8ca('0x28')]({'plain':!![]});if(!_0xb7c0b2)throw new Error(_0xf8ca('0x4e'));if(_0xb7c0b2[_0xf8ca('0x4f')]===_0xf8ca('0x4d')){var _0x130a34=_0x1c49dd[_0xf8ca('0x28')]({'plain':!![]});var _0x488c35=_0xf8ca('0x29');return db[_0xf8ca('0x50')][_0xf8ca('0x4a')]({'where':{'name':_0x488c35,'userProfileId':_0xb7c0b2[_0xf8ca('0x51')]},'raw':!![]})['then'](function(_0x471414){if(_0x471414&&_0x471414[_0xf8ca('0x52')]===0x0){return db['UserProfileResource'][_0xf8ca('0x4b')]({'name':_0x130a34[_0xf8ca('0x2d')],'resourceId':_0x130a34['id'],'type':_0x471414[_0xf8ca('0x2d')],'sectionId':_0x471414['id']},{})['then'](function(){return _0x1c49dd;});}else{return _0x1c49dd;}})['catch'](function(_0x4efd3b){logger[_0xf8ca('0x2b')](_0xf8ca('0x53'),_0x4efd3b);throw _0x4efd3b;});}return _0x1c49dd;})[_0xf8ca('0x27')](respondWithResult(_0x592fed,0xc9))['catch'](handleError(_0x592fed,null));};exports[_0xf8ca('0x54')]=function(_0x4cb6d5,_0x5a3ff6){var _0x5e7196={'where':{'id':_0x4cb6d5['params']['id']}},_0x35597f={};_0x35597f[_0xf8ca('0x34')]=_['keys'](db[_0xf8ca('0x30')][_0xf8ca('0x31')]);_0x5e7196[_0xf8ca('0x39')]=_[_0xf8ca('0x38')](_0x35597f[_0xf8ca('0x34')],qs[_0xf8ca('0x3a')](_0x4cb6d5[_0xf8ca('0x35')]['fields']));_0x5e7196[_0xf8ca('0x39')]=_0x5e7196[_0xf8ca('0x39')][_0xf8ca('0x3b')]?_0x5e7196[_0xf8ca('0x39')]:_0x35597f[_0xf8ca('0x34')];if(_0x4cb6d5['query'][_0xf8ca('0x43')]){_0x5e7196[_0xf8ca('0x44')]=[{'all':!![]}];}_0x5e7196=_[_0xf8ca('0x42')]({},_0x5e7196,_0x4cb6d5['options']);return db[_0xf8ca('0x30')][_0xf8ca('0x4a')](_0x5e7196)[_0xf8ca('0x27')](handleEntityNotFound(_0x5a3ff6,null))[_0xf8ca('0x27')](function(_0x4a1fac){if(_0x4a1fac){var _0x915011=_0x4a1fac['get']({'plain':!![]});_0x915011=qs[_0xf8ca('0x55')](_0x915011,['id',_0xf8ca('0x56'),_0xf8ca('0x57')]);_0x4cb6d5['body']=_['omit'](_0x4cb6d5[_0xf8ca('0x4c')],['id','createdAt',_0xf8ca('0x57')]);return db['Dashboard']['create'](_[_0xf8ca('0x42')](_0x915011,_0x4cb6d5[_0xf8ca('0x4c')]),{'include':_0x4cb6d5[_0xf8ca('0x35')][_0xf8ca('0x43')]?[{'all':!![]}]:undefined})[_0xf8ca('0x27')](function(_0x1ee265){var _0x2c7611=_0x4cb6d5[_0xf8ca('0x4d')][_0xf8ca('0x28')]({'plain':!![]});if(!_0x2c7611)throw new Error(_0xf8ca('0x4e'));if(_0x2c7611[_0xf8ca('0x4f')]==='user'){var _0x2418ab=_0x1ee265[_0xf8ca('0x28')]({'plain':!![]});var _0x594b74=_0xf8ca('0x29');return db[_0xf8ca('0x50')]['find']({'where':{'name':_0x594b74,'userProfileId':_0x2c7611[_0xf8ca('0x51')]},'raw':!![]})[_0xf8ca('0x27')](function(_0x54caac){if(_0x54caac&&_0x54caac[_0xf8ca('0x52')]===0x0){return db[_0xf8ca('0x58')][_0xf8ca('0x4b')]({'name':_0x2418ab[_0xf8ca('0x2d')],'resourceId':_0x2418ab['id'],'type':_0x54caac[_0xf8ca('0x2d')],'sectionId':_0x54caac['id']},{})[_0xf8ca('0x27')](function(){return _0x1ee265;});}else{return _0x1ee265;}})[_0xf8ca('0x46')](function(_0x347a8c){logger[_0xf8ca('0x2b')](_0xf8ca('0x53'),_0x347a8c);throw _0x347a8c;});}return _0x1ee265;});}})[_0xf8ca('0x27')](respondWithResult(_0x5a3ff6,0xc9))[_0xf8ca('0x46')](handleError(_0x5a3ff6,null));};exports[_0xf8ca('0x25')]=function(_0x3ebdfe,_0x3a254d){if(_0x3ebdfe[_0xf8ca('0x4c')]['id']){delete _0x3ebdfe[_0xf8ca('0x4c')]['id'];}return db[_0xf8ca('0x30')][_0xf8ca('0x4a')]({'where':{'id':_0x3ebdfe[_0xf8ca('0x48')]['id']}})[_0xf8ca('0x27')](handleEntityNotFound(_0x3a254d,null))[_0xf8ca('0x27')](saveUpdates(_0x3ebdfe['body'],null))[_0xf8ca('0x27')](respondWithResult(_0x3a254d,null))['catch'](handleError(_0x3a254d,null));};exports[_0xf8ca('0x26')]=function(_0x187cb5,_0x3769e6){return db[_0xf8ca('0x30')]['find']({'where':{'id':_0x187cb5[_0xf8ca('0x48')]['id']}})['then'](handleEntityNotFound(_0x3769e6,null))[_0xf8ca('0x27')](removeEntity(_0x3769e6,null))['catch'](handleError(_0x3769e6,null));};function widgetAttributes(_0x496489){try{switch(_0x496489['type']){case _0xf8ca('0x59'):return[{'name':_0xf8ca('0x5a'),'value':_0x496489['attrUrl']||(_0x496489[_0xf8ca('0x5b')]&&_0x496489['attrs'][0x0]?_0x496489[_0xf8ca('0x5b')][0x0][_0xf8ca('0x5c')]:undefined)||'https://'}];case _0xf8ca('0x5d'):return[{'name':_0xf8ca('0x5e'),'value':_0x496489[_0xf8ca('0x5e')]||(_0x496489[_0xf8ca('0x5b')]&&_0x496489['attrs'][0x0]?_0x496489[_0xf8ca('0x5b')][0x0][_0xf8ca('0x5c')]:undefined)||''}];case'clock':return[{'name':_0xf8ca('0x5f'),'value':_0x496489[_0xf8ca('0x5f')]||(_0x496489['attrs']&&_0x496489['attrs'][0x0]?_0x496489['attrs'][0x0][_0xf8ca('0x5c')]:undefined)||'HH:mm:ss'},{'name':_0xf8ca('0x60'),'value':_0x496489[_0xf8ca('0x60')]||(_0x496489[_0xf8ca('0x5b')]&&_0x496489['attrs'][0x1]?_0x496489[_0xf8ca('0x5b')][0x1][_0xf8ca('0x5c')]:undefined)||_0xf8ca('0x61')},{'name':_0xf8ca('0x62'),'value':_0x496489[_0xf8ca('0x62')]||(_0x496489['attrs']&&_0x496489['attrs'][0x2]?_0x496489[_0xf8ca('0x5b')][0x2][_0xf8ca('0x5c')]:undefined)||0xc}];case _0xf8ca('0x63'):return[{'name':_0xf8ca('0x64'),'value':_0x496489[_0xf8ca('0x64')]||(_0x496489[_0xf8ca('0x5b')]&&_0x496489[_0xf8ca('0x5b')][0x0]?_0x496489[_0xf8ca('0x5b')][0x0][_0xf8ca('0x5c')]:undefined)||_0xf8ca('0x65')},{'name':_0xf8ca('0x66'),'value':_0x496489[_0xf8ca('0x66')]||(_0x496489['attrs']&&_0x496489[_0xf8ca('0x5b')][0x1]?_0x496489['attrs'][0x1][_0xf8ca('0x5c')]:undefined)||[]},{'name':_0xf8ca('0x62'),'value':_0x496489[_0xf8ca('0x62')]||(_0x496489[_0xf8ca('0x5b')]&&_0x496489[_0xf8ca('0x5b')][0x2]?_0x496489['attrs'][0x2][_0xf8ca('0x5c')]:undefined)||0x14},{'name':_0xf8ca('0x67'),'value':_0x496489[_0xf8ca('0x67')]||(_0x496489[_0xf8ca('0x5b')]&&_0x496489[_0xf8ca('0x5b')][0x3]?_0x496489[_0xf8ca('0x5b')][0x3][_0xf8ca('0x5c')]:undefined)||_0xf8ca('0x68')},{'name':_0xf8ca('0x69'),'value':_0x496489['attrEmailAccounts']||(_0x496489['attrs']&&_0x496489[_0xf8ca('0x5b')][0x4]?_0x496489[_0xf8ca('0x5b')][0x4][_0xf8ca('0x5c')]:undefined)||''},{'name':_0xf8ca('0x6a'),'value':_0x496489[_0xf8ca('0x6a')]||(_0x496489[_0xf8ca('0x5b')]&&_0x496489[_0xf8ca('0x5b')][0x5]?_0x496489[_0xf8ca('0x5b')][0x5][_0xf8ca('0x5c')]:undefined)||''},{'name':_0xf8ca('0x6b'),'value':_0x496489[_0xf8ca('0x6b')]||(_0x496489[_0xf8ca('0x5b')]&&_0x496489['attrs'][0x6]?_0x496489['attrs'][0x6]['value']:undefined)||''},{'name':_0xf8ca('0x6c'),'value':_0x496489[_0xf8ca('0x6c')]||(_0x496489[_0xf8ca('0x5b')]&&_0x496489[_0xf8ca('0x5b')][0x7]?_0x496489['attrs'][0x7][_0xf8ca('0x5c')]:undefined)||''},{'name':_0xf8ca('0x6d'),'value':_0x496489[_0xf8ca('0x6d')]||(_0x496489[_0xf8ca('0x5b')]&&_0x496489[_0xf8ca('0x5b')][0x8]?_0x496489[_0xf8ca('0x5b')][0x8]['value']:undefined)||''},{'name':_0xf8ca('0x6e'),'value':_0x496489[_0xf8ca('0x6e')]||(_0x496489['attrs']&&_0x496489[_0xf8ca('0x5b')][0x9]?_0x496489['attrs'][0x9][_0xf8ca('0x5c')]:undefined)||''}];case _0xf8ca('0x6f'):case _0xf8ca('0x70'):return[{'name':_0xf8ca('0x71'),'value':_0x496489[_0xf8ca('0x71')]||(_0x496489[_0xf8ca('0x5b')]&&_0x496489[_0xf8ca('0x5b')][0x0]?_0x496489[_0xf8ca('0x5b')][0x0]['value']:undefined)||'total'},{'name':_0xf8ca('0x72'),'value':_0x496489[_0xf8ca('0x72')]||(_0x496489[_0xf8ca('0x5b')]&&_0x496489[_0xf8ca('0x5b')][0x1]?_0x496489['attrs'][0x1][_0xf8ca('0x5c')]:undefined)||null},{'name':'attrSerie3','value':_0x496489[_0xf8ca('0x73')]||(_0x496489[_0xf8ca('0x5b')]&&_0x496489[_0xf8ca('0x5b')][0x2]?_0x496489[_0xf8ca('0x5b')][0x2][_0xf8ca('0x5c')]:undefined)||null},{'name':_0xf8ca('0x66'),'value':_0x496489[_0xf8ca('0x66')]||(_0x496489['attrs']&&_0x496489['attrs'][0x3]?_0x496489[_0xf8ca('0x5b')][0x3][_0xf8ca('0x5c')]:undefined)||[]},{'name':_0xf8ca('0x67'),'value':_0x496489[_0xf8ca('0x67')]||(_0x496489[_0xf8ca('0x5b')]&&_0x496489[_0xf8ca('0x5b')][0x4]?_0x496489['attrs'][0x4][_0xf8ca('0x5c')]:undefined)||'voice'},{'name':_0xf8ca('0x69'),'value':_0x496489[_0xf8ca('0x69')]||(_0x496489['attrs']&&_0x496489[_0xf8ca('0x5b')][0x5]?_0x496489[_0xf8ca('0x5b')][0x5][_0xf8ca('0x5c')]:undefined)||''},{'name':_0xf8ca('0x6a'),'value':_0x496489[_0xf8ca('0x6a')]||(_0x496489[_0xf8ca('0x5b')]&&_0x496489[_0xf8ca('0x5b')][0x6]?_0x496489['attrs'][0x6][_0xf8ca('0x5c')]:undefined)||''},{'name':_0xf8ca('0x6b'),'value':_0x496489[_0xf8ca('0x6b')]||(_0x496489[_0xf8ca('0x5b')]&&_0x496489[_0xf8ca('0x5b')][0x7]?_0x496489[_0xf8ca('0x5b')][0x7][_0xf8ca('0x5c')]:undefined)||''},{'name':_0xf8ca('0x6c'),'value':_0x496489['attrOpenchannelAccounts']||(_0x496489[_0xf8ca('0x5b')]&&_0x496489[_0xf8ca('0x5b')][0x8]?_0x496489['attrs'][0x8][_0xf8ca('0x5c')]:undefined)||''},{'name':_0xf8ca('0x6d'),'value':_0x496489['attrWhatsappAccounts']||(_0x496489[_0xf8ca('0x5b')]&&_0x496489['attrs'][0x9]?_0x496489['attrs'][0x9]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0x496489[_0xf8ca('0x6e')]||(_0x496489['attrs']&&_0x496489[_0xf8ca('0x5b')][0xa]?_0x496489[_0xf8ca('0x5b')][0xa]['value']:undefined)||''}];case'web-report':return[{'name':_0xf8ca('0x74'),'type':_0x496489[_0xf8ca('0x75')]||(_0x496489[_0xf8ca('0x5b')]&&_0x496489[_0xf8ca('0x5b')][0x0]?_0x496489['attrs'][0x0]['type']:undefined)||null,'value':_0x496489[_0xf8ca('0x74')]||(_0x496489[_0xf8ca('0x5b')]&&_0x496489[_0xf8ca('0x5b')][0x0]?_0x496489[_0xf8ca('0x5b')][0x0][_0xf8ca('0x5c')]:undefined)||null},{'name':_0xf8ca('0x76'),'value':_0x496489[_0xf8ca('0x76')]||(_0x496489[_0xf8ca('0x5b')]&&_0x496489[_0xf8ca('0x5b')][0x1]?_0x496489['attrs'][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x426c31){logger[_0xf8ca('0x2b')](_0xf8ca('0x77'),JSON['stringify'](_0x426c31));return[];}}exports['addItem']=function(_0x5d9627,_0x30101a,_0x14ee6a){if(_0x5d9627[_0xf8ca('0x4c')]['id']){delete _0x5d9627[_0xf8ca('0x4c')]['id'];}return db[_0xf8ca('0x30')][_0xf8ca('0x4a')]({'where':{'id':_0x5d9627['params']['id']}})['then'](handleEntityNotFound(_0x30101a,null))['then'](function(_0x14a5e8){if(_0x14a5e8){_0x5d9627['body'][_0xf8ca('0x78')]=_0x14a5e8['id'];_0x5d9627[_0xf8ca('0x4c')][_0xf8ca('0x5b')]=widgetAttributes(_0x5d9627[_0xf8ca('0x4c')]);return db[_0xf8ca('0x79')][_0xf8ca('0x4b')](_0x5d9627[_0xf8ca('0x4c')]);}})['then'](respondWithResult(_0x30101a,null))[_0xf8ca('0x46')](handleError(_0x30101a,null));};exports['getItems']=function(_0x2a9a4c,_0x5b2415,_0x9e80f3){var _0x15bbb2={};var _0x338ea8={};var _0x3c349b;var _0x3ced07;return db[_0xf8ca('0x30')][_0xf8ca('0x7a')]({'where':{'id':_0x2a9a4c[_0xf8ca('0x48')]['id']}})[_0xf8ca('0x27')](handleEntityNotFound(_0x5b2415,null))[_0xf8ca('0x27')](function(_0x567cdd){if(_0x567cdd){_0x3c349b=_0x567cdd;_0x338ea8[_0xf8ca('0x34')]=_[_0xf8ca('0x36')](db['DashboardItem'][_0xf8ca('0x31')]);_0x338ea8[_0xf8ca('0x35')]=_['keys'](_0x2a9a4c['query']);_0x338ea8[_0xf8ca('0x37')]=_[_0xf8ca('0x38')](_0x338ea8[_0xf8ca('0x34')],_0x338ea8[_0xf8ca('0x35')]);_0x15bbb2['attributes']=_[_0xf8ca('0x38')](_0x338ea8[_0xf8ca('0x34')],qs['fields'](_0x2a9a4c[_0xf8ca('0x35')]['fields']));_0x15bbb2['attributes']=_0x15bbb2[_0xf8ca('0x39')][_0xf8ca('0x3b')]?_0x15bbb2[_0xf8ca('0x39')]:_0x338ea8[_0xf8ca('0x34')];_0x15bbb2[_0xf8ca('0x7b')]=qs[_0xf8ca('0x3d')](_0x2a9a4c[_0xf8ca('0x35')][_0xf8ca('0x3d')]);_0x15bbb2[_0xf8ca('0x3e')]=qs[_0xf8ca('0x37')](_[_0xf8ca('0x3f')](_0x2a9a4c[_0xf8ca('0x35')],_0x338ea8[_0xf8ca('0x37')]));if(_0x2a9a4c[_0xf8ca('0x35')][_0xf8ca('0x41')]){_0x15bbb2[_0xf8ca('0x3e')]=_[_0xf8ca('0x42')](_0x15bbb2[_0xf8ca('0x3e')],{'$or':_[_0xf8ca('0x2f')](_0x15bbb2[_0xf8ca('0x39')],function(_0x350532){var _0x272922={};_0x272922[_0x350532]={'$like':'%'+_0x2a9a4c[_0xf8ca('0x35')][_0xf8ca('0x41')]+'%'};return _0x272922;})});}_0x15bbb2=_[_0xf8ca('0x42')]({},_0x15bbb2,_0x2a9a4c[_0xf8ca('0x49')]);return _0x3c349b[_0xf8ca('0x7c')](_0x15bbb2);}})[_0xf8ca('0x27')](function(_0x4718d5){if(_0x4718d5){_0x3ced07=_0x4718d5[_0xf8ca('0x3b')];if(!_0x2a9a4c[_0xf8ca('0x35')][_0xf8ca('0x3c')](_0xf8ca('0x7d'))){_0x15bbb2[_0xf8ca('0x1e')]=qs['limit'](_0x2a9a4c['query'][_0xf8ca('0x1e')]);_0x15bbb2[_0xf8ca('0x1c')]=qs[_0xf8ca('0x1c')](_0x2a9a4c[_0xf8ca('0x35')]['offset']);}return _0x3c349b[_0xf8ca('0x7c')](_0x15bbb2);}})[_0xf8ca('0x27')](function(_0x3a3bd7){if(_0x3a3bd7){return _0x3a3bd7?{'count':_0x3ced07,'rows':_0x3a3bd7}:null;}})[_0xf8ca('0x27')](respondWithResult(_0x5b2415,null))['catch'](handleError(_0x5b2415,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 49c2b14..0dd6549 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 _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 +var _0xaf79=['hook','events','Dashboard','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0xaf79,0x1f0));var _0x9af7=function(_0x3486e4,_0x360e3d){_0x3486e4=_0x3486e4-0x0;var _0x491fe6=_0xaf79[_0x3486e4];return _0x491fe6;};'use strict';var EventEmitter=require(_0x9af7('0x0'));var Dashboard=require('../../mysqldb')['db'][_0x9af7('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x9af7('0x2')](0x0);var events={'afterCreate':_0x9af7('0x3'),'afterUpdate':_0x9af7('0x4'),'afterDestroy':_0x9af7('0x5')};function emitEvent(_0x4c8e0b){return function(_0x4818e2,_0x526874,_0x5b50be){DashboardEvents[_0x9af7('0x6')](_0x4c8e0b+':'+_0x4818e2['id'],_0x4818e2);DashboardEvents[_0x9af7('0x6')](_0x4c8e0b,_0x4818e2);_0x5b50be(null);};}for(var e in events){if(events[_0x9af7('0x7')](e)){var event=events[e];Dashboard[_0x9af7('0x8')](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 1838102..909d117 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 _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 +var _0x7f68=['moment','bluebird','path','../../config/environment','./dashboard.attributes','exports','define','lodash','../../config/logger','api'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x7f68,0xcf));var _0x87f6=function(_0x57532c,_0x2c75cf){_0x57532c=_0x57532c-0x0;var _0x5cb9a6=_0x7f68[_0x57532c];return _0x5cb9a6;};'use strict';var _=require(_0x87f6('0x0'));var util=require('util');var logger=require(_0x87f6('0x1'))(_0x87f6('0x2'));var moment=require(_0x87f6('0x3'));var BPromise=require(_0x87f6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x87f6('0x5'));var rimraf=require('rimraf');var config=require(_0x87f6('0x6'));var attributes=require(_0x87f6('0x7'));module[_0x87f6('0x8')]=function(_0x3a4f4c,_0x2b33e5){return _0x3a4f4c[_0x87f6('0x9')]('Dashboard',attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 8b91858..f577ac2 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 _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 +var _0x21a5=['result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x533e4e,_0x4eba54){var _0x1f14bb=function(_0x33a485){while(--_0x33a485){_0x533e4e['push'](_0x533e4e['shift']());}};_0x1f14bb(++_0x4eba54);}(_0x21a5,0x12b));var _0x521a=function(_0x1fafa5,_0x1aa281){_0x1fafa5=_0x1fafa5-0x0;var _0xcf08c9=_0x21a5[_0x1fafa5];return _0xcf08c9;};'use strict';var _=require('lodash');var util=require(_0x521a('0x0'));var moment=require(_0x521a('0x1'));var BPromise=require('bluebird');var rs=require(_0x521a('0x2'));var fs=require('fs');var Redis=require(_0x521a('0x3'));var db=require(_0x521a('0x4'))['db'];var utils=require(_0x521a('0x5'));var logger=require(_0x521a('0x6'))(_0x521a('0x7'));var config=require('../../config/environment');var jayson=require(_0x521a('0x8'));var client=jayson['client'][_0x521a('0x9')]({'port':0x232a});config[_0x521a('0xa')]=_[_0x521a('0xb')](config[_0x521a('0xa')],{'host':_0x521a('0xc'),'port':0x18eb});var socket=require(_0x521a('0xd'))(new Redis(config['redis']));require('./dashboard.socket')[_0x521a('0xe')](socket);function respondWithRpcPromise(_0x5b75d4,_0x3e7ec6,_0x575ddd){return new BPromise(function(_0x4d5665,_0x3a19bb){return client[_0x521a('0xf')](_0x5b75d4,_0x575ddd)[_0x521a('0x10')](function(_0x52d0bc){logger['info'](_0x521a('0x11'),_0x3e7ec6,_0x521a('0x12'));logger[_0x521a('0x13')](_0x521a('0x14'),_0x3e7ec6,'request\x20sent',JSON[_0x521a('0x15')](_0x52d0bc));if(_0x52d0bc[_0x521a('0x16')]){if(_0x52d0bc['error']['code']===0x1f4){logger[_0x521a('0x16')](_0x521a('0x11'),_0x3e7ec6,_0x52d0bc[_0x521a('0x16')][_0x521a('0x17')]);return _0x3a19bb(_0x52d0bc[_0x521a('0x16')][_0x521a('0x17')]);}logger[_0x521a('0x16')]('Dashboard,\x20%s,\x20%s',_0x3e7ec6,_0x52d0bc[_0x521a('0x16')]['message']);return _0x4d5665(_0x52d0bc['error'][_0x521a('0x17')]);}else{logger[_0x521a('0x18')]('Dashboard,\x20%s,\x20%s',_0x3e7ec6,_0x521a('0x12'));_0x4d5665(_0x52d0bc[_0x521a('0x19')]['message']);}})[_0x521a('0x1a')](function(_0x309884){logger[_0x521a('0x16')](_0x521a('0x11'),_0x3e7ec6,_0x309884);_0x3a19bb(_0x309884);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 42c50be..525bce1 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 _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 +var _0x3ebb=['emit','removeListener','register','length','dashboard:','update'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3ebb,0xa1));var _0xb3eb=function(_0x163e16,_0x3094fd){_0x163e16=_0x163e16-0x0;var _0x4df5b4=_0x3ebb[_0x163e16];return _0x4df5b4;};'use strict';var DashboardEvents=require('./dashboard.events');var events=['save','remove',_0xb3eb('0x0')];function createListener(_0x46c74b,_0x72846d){return function(_0xcbaf38){_0x72846d[_0xb3eb('0x1')](_0x46c74b,_0xcbaf38);};}function removeListener(_0xe26f03,_0x29b4cd){return function(){DashboardEvents[_0xb3eb('0x2')](_0xe26f03,_0x29b4cd);};}exports[_0xb3eb('0x3')]=function(_0x36f6df){for(var _0x182f35=0x0,_0x1dc035=events[_0xb3eb('0x4')];_0x182f35<_0x1dc035;_0x182f35++){var _0x2c1c5f=events[_0x182f35];var _0x3e01c3=createListener(_0xb3eb('0x5')+_0x2c1c5f,_0x36f6df);DashboardEvents['on'](_0x2c1c5f,_0x3e01c3);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 8a02ea0..b848629 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 _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 +var _0xb720=['delete','/:id','destroy','exports','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','show','/:id/items','getItems','post','create','/:id/clone','addItem','put'];(function(_0x18a728,_0x1c65eb){var _0x269cd5=function(_0x2066a2){while(--_0x2066a2){_0x18a728['push'](_0x18a728['shift']());}};_0x269cd5(++_0x1c65eb);}(_0xb720,0x180));var _0x0b72=function(_0x1c0a25,_0x227201){_0x1c0a25=_0x1c0a25-0x0;var _0x4ddd7e=_0xb720[_0x1c0a25];return _0x4ddd7e;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x0b72('0x0'));var express=require(_0x0b72('0x1'));var router=express[_0x0b72('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0b72('0x3'));var config=require(_0x0b72('0x4'));var controller=require(_0x0b72('0x5'));router[_0x0b72('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0b72('0x6')]('/:id',auth[_0x0b72('0x7')](),controller[_0x0b72('0x8')]);router[_0x0b72('0x6')](_0x0b72('0x9'),auth['isAuthenticated'](),controller[_0x0b72('0xa')]);router[_0x0b72('0xb')]('/',auth[_0x0b72('0x7')](),controller[_0x0b72('0xc')]);router[_0x0b72('0xb')](_0x0b72('0xd'),auth['isAuthenticated'](),controller['clone']);router['post'](_0x0b72('0x9'),auth[_0x0b72('0x7')](),controller[_0x0b72('0xe')]);router[_0x0b72('0xf')]('/:id',auth[_0x0b72('0x7')](),controller['update']);router[_0x0b72('0x10')](_0x0b72('0x11'),auth[_0x0b72('0x7')](),controller[_0x0b72('0x12')]);module[_0x0b72('0x13')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 7f7ee7b..5832e9d 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 _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 +var _0xc4aa=['getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','sequelize','squel','lodash','exports','STRING'];(function(_0x2cae5e,_0x2fbbf2){var _0x380465=function(_0x1b948a){while(--_0x1b948a){_0x2cae5e['push'](_0x2cae5e['shift']());}};_0x380465(++_0x2fbbf2);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0xc4aa[_0x5a776b];return _0xbbef59;};'use strict';var Sequelize=require(_0xac4a('0x0'));var squel=require(_0xac4a('0x1'));var _=require(_0xac4a('0x2'));module[_0xac4a('0x3')]={'title':{'type':Sequelize[_0xac4a('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0xac4a('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT']('long'),'get':function(){try{return JSON['parse'](this[_0xac4a('0x5')](_0xac4a('0x6')));}catch(_0x730a38){return[];}},'set':function(_0x215f39){try{this[_0xac4a('0x7')](_0xac4a('0x6'),JSON[_0xac4a('0x8')](_0x215f39));}catch(_0x10525b){this['setDataValue']('attrs',JSON[_0xac4a('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0xac4a('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xac4a('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0xac4a('0x9')]},'background':{'type':Sequelize[_0xac4a('0x4')],'allowNull':![],'defaultValue':_0xac4a('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xac4a('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0xac4a('0x9')],'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 52f892a..8be004f 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 _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 +var _0xf13b=['status','end','offset','undefined','count','limit','set','apply','reject','save','then','destroy','error','name','send','params','model','keys','query','intersection','attributes','fields','options','find','catch','DashboardItem','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','body','eml-format','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','sendStatus'];(function(_0x42c7e7,_0x357294){var _0x4f17aa=function(_0x1d158d){while(--_0x1d158d){_0x42c7e7['push'](_0x42c7e7['shift']());}};_0x4f17aa(++_0x357294);}(_0xf13b,0x1f0));var _0xbf13=function(_0x37a042,_0x2c307a){_0x37a042=_0x37a042-0x0;var _0x19a727=_0xf13b[_0x37a042];return _0x19a727;};'use strict';var emlformat=require(_0xbf13('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbf13('0x1'));var moment=require(_0xbf13('0x2'));var BPromise=require(_0xbf13('0x3'));var Mustache=require(_0xbf13('0x4'));var util=require('util');var path=require('path');var sox=require(_0xbf13('0x5'));var csv=require(_0xbf13('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbf13('0x7'));var _=require(_0xbf13('0x8'));var squel=require('squel');var crypto=require(_0xbf13('0x9'));var jsforce=require(_0xbf13('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xbf13('0x6'));var querystring=require(_0xbf13('0xb'));var Papa=require(_0xbf13('0xc'));var Redis=require(_0xbf13('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xbf13('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbf13('0xf'));var logger=require('../../config/logger')(_0xbf13('0x10'));var utils=require(_0xbf13('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xbf13('0x12'));var db=require(_0xbf13('0x13'))['db'];config[_0xbf13('0x14')]=_[_0xbf13('0x15')](config['redis'],{'host':_0xbf13('0x16'),'port':0x18eb});var socket=require(_0xbf13('0x17'))(new Redis(config[_0xbf13('0x14')]));require(_0xbf13('0x18'))['register'](socket);function respondWithStatusCode(_0x5df674,_0x56331f){_0x56331f=_0x56331f||0xcc;return function(_0x12c77d){if(_0x12c77d){return _0x5df674[_0xbf13('0x19')](_0x56331f);}return _0x5df674[_0xbf13('0x1a')](_0x56331f)[_0xbf13('0x1b')]();};}function respondWithResult(_0x3ce614,_0x2f1a98){_0x2f1a98=_0x2f1a98||0xc8;return function(_0xef3d83){if(_0xef3d83){return _0x3ce614[_0xbf13('0x1a')](_0x2f1a98)['json'](_0xef3d83);}};}function respondWithFilteredResult(_0xa296f0,_0x528d3c){return function(_0xdd4206){if(_0xdd4206){var _0x1adb54=typeof _0x528d3c[_0xbf13('0x1c')]===_0xbf13('0x1d')&&typeof _0x528d3c['limit']==='undefined';var _0x3a2ff8=_0xdd4206[_0xbf13('0x1e')];var _0x3cbc13=_0x1adb54?0x0:_0x528d3c[_0xbf13('0x1c')];var _0x5d1be7=_0x1adb54?_0xdd4206['count']:_0x528d3c[_0xbf13('0x1c')]+_0x528d3c[_0xbf13('0x1f')];var _0x12f3f9;if(_0x5d1be7>=_0x3a2ff8){_0x5d1be7=_0x3a2ff8;_0x12f3f9=0xc8;}else{_0x12f3f9=0xce;}_0xa296f0['status'](_0x12f3f9);return _0xa296f0[_0xbf13('0x20')]('Content-Range',_0x3cbc13+'-'+_0x5d1be7+'/'+_0x3a2ff8)['json'](_0xdd4206);}return null;};}function patchUpdates(_0x31b0b9){return function(_0x29dce1){try{jsonpatch[_0xbf13('0x21')](_0x29dce1,_0x31b0b9,!![]);}catch(_0x44dfb3){return BPromise[_0xbf13('0x22')](_0x44dfb3);}return _0x29dce1[_0xbf13('0x23')]();};}function saveUpdates(_0x3eb399,_0x326397){return function(_0x11e635){if(_0x11e635){return _0x11e635['update'](_0x3eb399)[_0xbf13('0x24')](function(_0x74217e){return _0x74217e;});}return null;};}function removeEntity(_0x3ad31f,_0x115e5a){return function(_0x4152c3){if(_0x4152c3){return _0x4152c3[_0xbf13('0x25')]()[_0xbf13('0x24')](function(){_0x3ad31f['status'](0xcc)[_0xbf13('0x1b')]();});}};}function handleEntityNotFound(_0x2a87c1,_0x2ec35c){return function(_0x38a039){if(!_0x38a039){_0x2a87c1[_0xbf13('0x19')](0x194);}return _0x38a039;};}function handleError(_0x242f21,_0x5b4779){_0x5b4779=_0x5b4779||0x1f4;return function(_0x1d81db){logger[_0xbf13('0x26')](_0x1d81db['stack']);if(_0x1d81db['name']){delete _0x1d81db[_0xbf13('0x27')];}_0x242f21[_0xbf13('0x1a')](_0x5b4779)[_0xbf13('0x28')](_0x1d81db);};}exports['show']=function(_0x229093,_0x46fa93){var _0x43c8b0={'raw':![],'where':{'id':_0x229093[_0xbf13('0x29')]['id']}},_0x22dbed={};_0x22dbed[_0xbf13('0x2a')]=_[_0xbf13('0x2b')](db['DashboardItem']['rawAttributes']);_0x22dbed[_0xbf13('0x2c')]=_[_0xbf13('0x2b')](_0x229093['query']);_0x22dbed['filters']=_[_0xbf13('0x2d')](_0x22dbed[_0xbf13('0x2a')],_0x22dbed[_0xbf13('0x2c')]);_0x43c8b0[_0xbf13('0x2e')]=_[_0xbf13('0x2d')](_0x22dbed[_0xbf13('0x2a')],qs[_0xbf13('0x2f')](_0x229093[_0xbf13('0x2c')]['fields']));_0x43c8b0[_0xbf13('0x2e')]=_0x43c8b0[_0xbf13('0x2e')]['length']?_0x43c8b0[_0xbf13('0x2e')]:_0x22dbed[_0xbf13('0x2a')];if(_0x229093[_0xbf13('0x2c')]['includeAll']){_0x43c8b0['include']=[{'all':!![]}];}_0x43c8b0=_['merge']({},_0x43c8b0,_0x229093[_0xbf13('0x30')]);return db['DashboardItem'][_0xbf13('0x31')](_0x43c8b0)[_0xbf13('0x24')](handleEntityNotFound(_0x46fa93,null))['then'](respondWithResult(_0x46fa93,null))[_0xbf13('0x32')](handleError(_0x46fa93,null));};exports[_0xbf13('0x25')]=function(_0x31d005,_0xd1dd0c){return db[_0xbf13('0x33')][_0xbf13('0x31')]({'where':{'id':_0x31d005[_0xbf13('0x29')]['id']}})[_0xbf13('0x24')](handleEntityNotFound(_0xd1dd0c,null))[_0xbf13('0x24')](removeEntity(_0xd1dd0c,null))[_0xbf13('0x32')](handleError(_0xd1dd0c,null));};function widgetAttributes(_0x58c0c4){try{switch(_0x58c0c4[_0xbf13('0x34')]){case _0xbf13('0x35'):return[{'name':_0xbf13('0x36'),'value':_0x58c0c4[_0xbf13('0x36')]||(_0x58c0c4[_0xbf13('0x37')]&&_0x58c0c4[_0xbf13('0x37')][0x0]?_0x58c0c4[_0xbf13('0x37')][0x0][_0xbf13('0x38')]:undefined)||_0xbf13('0x39')}];case _0xbf13('0x3a'):return[{'name':_0xbf13('0x3b'),'value':_0x58c0c4['attrPath']||(_0x58c0c4[_0xbf13('0x37')]&&_0x58c0c4[_0xbf13('0x37')][0x0]?_0x58c0c4[_0xbf13('0x37')][0x0]['value']:undefined)||''}];case _0xbf13('0x3c'):return[{'name':_0xbf13('0x3d'),'value':_0x58c0c4[_0xbf13('0x3d')]||(_0x58c0c4[_0xbf13('0x37')]&&_0x58c0c4[_0xbf13('0x37')][0x0]?_0x58c0c4[_0xbf13('0x37')][0x0]['value']:undefined)||'HH:mm:ss'},{'name':_0xbf13('0x3e'),'value':_0x58c0c4[_0xbf13('0x3e')]||(_0x58c0c4['attrs']&&_0x58c0c4[_0xbf13('0x37')][0x1]?_0x58c0c4[_0xbf13('0x37')][0x1][_0xbf13('0x38')]:undefined)||_0xbf13('0x3f')},{'name':'attrFontSize','value':_0x58c0c4[_0xbf13('0x40')]||(_0x58c0c4[_0xbf13('0x37')]&&_0x58c0c4['attrs'][0x2]?_0x58c0c4[_0xbf13('0x37')][0x2][_0xbf13('0x38')]:undefined)||0xc}];case _0xbf13('0x41'):return[{'name':'attrMetric','value':_0x58c0c4['attrMetric']||(_0x58c0c4['attrs']&&_0x58c0c4[_0xbf13('0x37')][0x0]?_0x58c0c4[_0xbf13('0x37')][0x0][_0xbf13('0x38')]:undefined)||_0xbf13('0x42')},{'name':'attrVoiceQueues','value':_0x58c0c4[_0xbf13('0x43')]||(_0x58c0c4[_0xbf13('0x37')]&&_0x58c0c4['attrs'][0x1]?_0x58c0c4[_0xbf13('0x37')][0x1][_0xbf13('0x38')]:undefined)||[]},{'name':_0xbf13('0x40'),'value':_0x58c0c4[_0xbf13('0x40')]||(_0x58c0c4[_0xbf13('0x37')]&&_0x58c0c4['attrs'][0x2]?_0x58c0c4[_0xbf13('0x37')][0x2]['value']:undefined)||0x14},{'name':_0xbf13('0x44'),'value':_0x58c0c4[_0xbf13('0x44')]||(_0x58c0c4['attrs']&&_0x58c0c4['attrs'][0x3]?_0x58c0c4['attrs'][0x3][_0xbf13('0x38')]:undefined)||_0xbf13('0x45')},{'name':_0xbf13('0x46'),'value':_0x58c0c4[_0xbf13('0x46')]||(_0x58c0c4[_0xbf13('0x37')]&&_0x58c0c4[_0xbf13('0x37')][0x4]?_0x58c0c4[_0xbf13('0x37')][0x4]['value']:undefined)||''},{'name':_0xbf13('0x47'),'value':_0x58c0c4[_0xbf13('0x47')]||(_0x58c0c4[_0xbf13('0x37')]&&_0x58c0c4[_0xbf13('0x37')][0x5]?_0x58c0c4[_0xbf13('0x37')][0x5][_0xbf13('0x38')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x58c0c4[_0xbf13('0x48')]||(_0x58c0c4[_0xbf13('0x37')]&&_0x58c0c4[_0xbf13('0x37')][0x6]?_0x58c0c4[_0xbf13('0x37')][0x6][_0xbf13('0x38')]:undefined)||''},{'name':_0xbf13('0x49'),'value':_0x58c0c4[_0xbf13('0x49')]||(_0x58c0c4[_0xbf13('0x37')]&&_0x58c0c4['attrs'][0x7]?_0x58c0c4[_0xbf13('0x37')][0x7][_0xbf13('0x38')]:undefined)||''},{'name':_0xbf13('0x4a'),'value':_0x58c0c4[_0xbf13('0x4a')]||(_0x58c0c4[_0xbf13('0x37')]&&_0x58c0c4[_0xbf13('0x37')][0x8]?_0x58c0c4[_0xbf13('0x37')][0x8]['value']:undefined)||''},{'name':_0xbf13('0x4b'),'value':_0x58c0c4[_0xbf13('0x4b')]||(_0x58c0c4[_0xbf13('0x37')]&&_0x58c0c4[_0xbf13('0x37')][0x9]?_0x58c0c4[_0xbf13('0x37')][0x9][_0xbf13('0x38')]:undefined)||''}];case _0xbf13('0x4c'):case _0xbf13('0x4d'):return[{'name':_0xbf13('0x4e'),'value':_0x58c0c4[_0xbf13('0x4e')]||(_0x58c0c4[_0xbf13('0x37')]&&_0x58c0c4['attrs'][0x0]?_0x58c0c4[_0xbf13('0x37')][0x0]['value']:undefined)||_0xbf13('0x42')},{'name':_0xbf13('0x4f'),'value':_0x58c0c4[_0xbf13('0x4f')]||(_0x58c0c4['attrs']&&_0x58c0c4[_0xbf13('0x37')][0x1]?_0x58c0c4['attrs'][0x1]['value']:undefined)||null},{'name':'attrSerie3','value':_0x58c0c4[_0xbf13('0x50')]||(_0x58c0c4[_0xbf13('0x37')]&&_0x58c0c4['attrs'][0x2]?_0x58c0c4[_0xbf13('0x37')][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x58c0c4[_0xbf13('0x43')]||(_0x58c0c4[_0xbf13('0x37')]&&_0x58c0c4[_0xbf13('0x37')][0x3]?_0x58c0c4[_0xbf13('0x37')][0x3]['value']:undefined)||[]},{'name':_0xbf13('0x44'),'value':_0x58c0c4[_0xbf13('0x44')]||(_0x58c0c4[_0xbf13('0x37')]&&_0x58c0c4[_0xbf13('0x37')][0x4]?_0x58c0c4['attrs'][0x4][_0xbf13('0x38')]:undefined)||_0xbf13('0x45')},{'name':'attrEmailAccounts','value':_0x58c0c4['attrEmailAccounts']||(_0x58c0c4[_0xbf13('0x37')]&&_0x58c0c4[_0xbf13('0x37')][0x5]?_0x58c0c4[_0xbf13('0x37')][0x5][_0xbf13('0x38')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x58c0c4[_0xbf13('0x47')]||(_0x58c0c4[_0xbf13('0x37')]&&_0x58c0c4['attrs'][0x6]?_0x58c0c4[_0xbf13('0x37')][0x6][_0xbf13('0x38')]:undefined)||''},{'name':_0xbf13('0x48'),'value':_0x58c0c4[_0xbf13('0x48')]||(_0x58c0c4[_0xbf13('0x37')]&&_0x58c0c4[_0xbf13('0x37')][0x7]?_0x58c0c4[_0xbf13('0x37')][0x7][_0xbf13('0x38')]:undefined)||''},{'name':_0xbf13('0x49'),'value':_0x58c0c4[_0xbf13('0x49')]||(_0x58c0c4[_0xbf13('0x37')]&&_0x58c0c4[_0xbf13('0x37')][0x8]?_0x58c0c4['attrs'][0x8][_0xbf13('0x38')]:undefined)||''},{'name':_0xbf13('0x4a'),'value':_0x58c0c4['attrWhatsappAccounts']||(_0x58c0c4['attrs']&&_0x58c0c4['attrs'][0x9]?_0x58c0c4[_0xbf13('0x37')][0x9][_0xbf13('0x38')]:undefined)||''},{'name':_0xbf13('0x4b'),'value':_0x58c0c4[_0xbf13('0x4b')]||(_0x58c0c4['attrs']&&_0x58c0c4['attrs'][0xa]?_0x58c0c4['attrs'][0xa]['value']:undefined)||''}];case _0xbf13('0x51'):return[{'name':_0xbf13('0x52'),'type':_0x58c0c4[_0xbf13('0x53')]||(_0x58c0c4['attrs']&&_0x58c0c4[_0xbf13('0x37')][0x0]?_0x58c0c4[_0xbf13('0x37')][0x0]['type']:undefined)||null,'value':_0x58c0c4[_0xbf13('0x52')]||(_0x58c0c4[_0xbf13('0x37')]&&_0x58c0c4[_0xbf13('0x37')][0x0]?_0x58c0c4[_0xbf13('0x37')][0x0][_0xbf13('0x38')]:undefined)||null},{'name':'attrRefresh','value':_0x58c0c4[_0xbf13('0x54')]||(_0x58c0c4[_0xbf13('0x37')]&&_0x58c0c4[_0xbf13('0x37')][0x1]?_0x58c0c4['attrs'][0x1][_0xbf13('0x38')]:undefined)||0x0}];default:return[];}}catch(_0x19c8ac){logger[_0xbf13('0x26')](_0xbf13('0x55'),JSON['stringify'](_0x19c8ac));return[];}}exports['create']=function(_0x50390a,_0x199d4e){if(_0x50390a[_0xbf13('0x56')]){_0x50390a['body'][_0xbf13('0x37')]=widgetAttributes(_0x50390a[_0xbf13('0x56')]);}return db[_0xbf13('0x33')]['create'](_0x50390a['body'],{})[_0xbf13('0x24')](respondWithResult(_0x199d4e,0xc9))[_0xbf13('0x32')](handleError(_0x199d4e,null));};exports['update']=function(_0x11a2a4,_0x1458c5){if(_0x11a2a4[_0xbf13('0x56')]['id']){delete _0x11a2a4[_0xbf13('0x56')]['id'];}_0x11a2a4[_0xbf13('0x56')][_0xbf13('0x37')]=widgetAttributes(_0x11a2a4[_0xbf13('0x56')]);return db[_0xbf13('0x33')][_0xbf13('0x31')]({'where':{'id':_0x11a2a4[_0xbf13('0x29')]['id']}})[_0xbf13('0x24')](handleEntityNotFound(_0x1458c5,null))[_0xbf13('0x24')](saveUpdates(_0x11a2a4['body'],null))[_0xbf13('0x24')](respondWithResult(_0x1458c5,null))['catch'](handleError(_0x1458c5,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 6cab198..3214302 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 _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 +var _0xd7c1=['events','../../mysqldb','DashboardItem','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x2c1afd,_0x5b3b4b){var _0x4daae3=function(_0x67fab4){while(--_0x67fab4){_0x2c1afd['push'](_0x2c1afd['shift']());}};_0x4daae3(++_0x5b3b4b);}(_0xd7c1,0xa5));var _0x1d7c=function(_0x551783,_0xc1e908){_0x551783=_0x551783-0x0;var _0x39083a=_0xd7c1[_0x551783];return _0x39083a;};'use strict';var EventEmitter=require(_0x1d7c('0x0'));var DashboardItem=require(_0x1d7c('0x1'))['db'][_0x1d7c('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x1d7c('0x3')](0x0);var events={'afterCreate':_0x1d7c('0x4'),'afterUpdate':_0x1d7c('0x5'),'afterDestroy':_0x1d7c('0x6')};function emitEvent(_0x16ce8b){return function(_0x11f906,_0x1a16b8,_0x216fbd){DashboardItemEvents[_0x1d7c('0x7')](_0x16ce8b+':'+_0x11f906['id'],_0x11f906);DashboardItemEvents[_0x1d7c('0x7')](_0x16ce8b,_0x11f906);_0x216fbd(null);};}for(var e in events){if(events[_0x1d7c('0x8')](e)){var event=events[e];DashboardItem[_0x1d7c('0x9')](e,emitEvent(event));}}module[_0x1d7c('0xa')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index d010173..e0523e3 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 _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 +var _0x2629=['rimraf','../../config/environment','exports','define','dashboard_items','lodash','util','bluebird','request-promise','path'];(function(_0x3d27ba,_0x2671a3){var _0xf01885=function(_0x311f5c){while(--_0x311f5c){_0x3d27ba['push'](_0x3d27ba['shift']());}};_0xf01885(++_0x2671a3);}(_0x2629,0x1c7));var _0x9262=function(_0x5385f5,_0x554c1b){_0x5385f5=_0x5385f5-0x0;var _0x1eac01=_0x2629[_0x5385f5];return _0x1eac01;};'use strict';var _=require(_0x9262('0x0'));var util=require(_0x9262('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x9262('0x2'));var rp=require(_0x9262('0x3'));var fs=require('fs');var path=require(_0x9262('0x4'));var rimraf=require(_0x9262('0x5'));var config=require(_0x9262('0x6'));var attributes=require('./dashboardItem.attributes');module[_0x9262('0x7')]=function(_0x462edb,_0x500bde){return _0x462edb[_0x9262('0x8')]('DashboardItem',attributes,{'tableName':_0x9262('0x9'),'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 a823ade..86c60c8 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 _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 +var _0x0760=['request\x20sent','result','catch','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','./dashboardItem.socket','register','request','DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','error','code','message','info'];(function(_0x83cfa6,_0x3b2952){var _0x185c74=function(_0x33d36f){while(--_0x33d36f){_0x83cfa6['push'](_0x83cfa6['shift']());}};_0x185c74(++_0x3b2952);}(_0x0760,0x1e3));var _0x0076=function(_0x1a2547,_0x4fce74){_0x1a2547=_0x1a2547-0x0;var _0x570f68=_0x0760[_0x1a2547];return _0x570f68;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0076('0x0'));var fs=require('fs');var Redis=require(_0x0076('0x1'));var db=require(_0x0076('0x2'))['db'];var utils=require(_0x0076('0x3'));var logger=require(_0x0076('0x4'))(_0x0076('0x5'));var config=require('../../config/environment');var jayson=require(_0x0076('0x6'));var client=jayson['client'][_0x0076('0x7')]({'port':0x232a});config[_0x0076('0x8')]=_[_0x0076('0x9')](config[_0x0076('0x8')],{'host':_0x0076('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0076('0xb'))[_0x0076('0xc')](socket);function respondWithRpcPromise(_0x30eccb,_0x3ca2b3,_0xdb7b69){return new BPromise(function(_0x1aaea1,_0x19b64c){return client[_0x0076('0xd')](_0x30eccb,_0xdb7b69)['then'](function(_0x23439f){logger['info'](_0x0076('0xe'),_0x3ca2b3,'request\x20sent');logger[_0x0076('0xf')](_0x0076('0x10'),_0x3ca2b3,'request\x20sent',JSON['stringify'](_0x23439f));if(_0x23439f[_0x0076('0x11')]){if(_0x23439f[_0x0076('0x11')][_0x0076('0x12')]===0x1f4){logger[_0x0076('0x11')]('DashboardItem,\x20%s,\x20%s',_0x3ca2b3,_0x23439f[_0x0076('0x11')][_0x0076('0x13')]);return _0x19b64c(_0x23439f[_0x0076('0x11')][_0x0076('0x13')]);}logger[_0x0076('0x11')](_0x0076('0xe'),_0x3ca2b3,_0x23439f[_0x0076('0x11')]['message']);return _0x1aaea1(_0x23439f[_0x0076('0x11')][_0x0076('0x13')]);}else{logger[_0x0076('0x14')](_0x0076('0xe'),_0x3ca2b3,_0x0076('0x15'));_0x1aaea1(_0x23439f[_0x0076('0x16')][_0x0076('0x13')]);}})[_0x0076('0x17')](function(_0x38bfdb){logger[_0x0076('0x11')](_0x0076('0xe'),_0x3ca2b3,_0x38bfdb);_0x19b64c(_0x38bfdb);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 17019d0..060faa4 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 _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 +var _0x9d68=['update','register','length','dashboardItem:','./dashboardItem.events','save','remove'];(function(_0x52df21,_0x2b9b5a){var _0x31587f=function(_0x1c2538){while(--_0x1c2538){_0x52df21['push'](_0x52df21['shift']());}};_0x31587f(++_0x2b9b5a);}(_0x9d68,0xc1));var _0x89d6=function(_0x408de5,_0x24fa7b){_0x408de5=_0x408de5-0x0;var _0x2015a1=_0x9d68[_0x408de5];return _0x2015a1;};'use strict';var DashboardItemEvents=require(_0x89d6('0x0'));var events=[_0x89d6('0x1'),_0x89d6('0x2'),_0x89d6('0x3')];function createListener(_0x4b1383,_0x2135ae){return function(_0x5e697f){_0x2135ae['emit'](_0x4b1383,_0x5e697f);};}function removeListener(_0x3ac789,_0x6d2697){return function(){DashboardItemEvents['removeListener'](_0x3ac789,_0x6d2697);};}exports[_0x89d6('0x4')]=function(_0x24d577){for(var _0x4d9286=0x0,_0x256035=events[_0x89d6('0x5')];_0x4d9286<_0x256035;_0x4d9286++){var _0x13b95d=events[_0x4d9286];var _0x376c58=createListener(_0x89d6('0x6')+_0x13b95d,_0x24d577);DashboardItemEvents['on'](_0x13b95d,_0x376c58);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index e99cef9..198851d 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 _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 +var _0xaf24=['../../components/auth/service','./dashboardItem.controller','get','/:id','isAuthenticated','show','post','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x4393ea,_0x102c8b){var _0x3b10ba=function(_0x190d67){while(--_0x190d67){_0x4393ea['push'](_0x4393ea['shift']());}};_0x3b10ba(++_0x102c8b);}(_0xaf24,0x1aa));var _0x4af2=function(_0x32f35f,_0x446be5){_0x32f35f=_0x32f35f-0x0;var _0x42cc92=_0xaf24[_0x32f35f];return _0x42cc92;};'use strict';var multer=require(_0x4af2('0x0'));var util=require(_0x4af2('0x1'));var path=require('path');var timeout=require(_0x4af2('0x2'));var express=require(_0x4af2('0x3'));var router=express[_0x4af2('0x4')]();var fs_extra=require(_0x4af2('0x5'));var auth=require(_0x4af2('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4af2('0x7'));router[_0x4af2('0x8')](_0x4af2('0x9'),auth[_0x4af2('0xa')](),controller[_0x4af2('0xb')]);router[_0x4af2('0xc')]('/',auth[_0x4af2('0xa')](),controller['create']);router[_0x4af2('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x4af2('0xe')]);router[_0x4af2('0xf')]('/:id',auth[_0x4af2('0xa')](),controller[_0x4af2('0x10')]);module[_0x4af2('0x11')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index c69b651..78f1fb2 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 _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 +var _0x2e57=['third','STRING','ENUM','first','second'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2e57,0x13c));var _0x72e5=function(_0x27ab60,_0x232b42){_0x27ab60=_0x27ab60-0x0;var _0x546cbd=_0x2e57[_0x27ab60];return _0x546cbd;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x72e5('0x0')],'allowNull':![]},'level':{'type':Sequelize[_0x72e5('0x1')](_0x72e5('0x2'),_0x72e5('0x3'),_0x72e5('0x4')),'allowNull':![],'defaultValue':_0x72e5('0x2')},'description':{'type':Sequelize[_0x72e5('0x0')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index f4762c4..43eff7a 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 _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 +var _0x7e5b=['map','Disposition','rawAttributes','type','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','where','filters','pick','merge','VIRTUAL','filter','include','findAll','show','keys','length','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','Dispositions','UserProfileResource','end','error','stack','name','send','index'];(function(_0x284998,_0x4c8733){var _0x1db6d6=function(_0x8718ac){while(--_0x8718ac){_0x284998['push'](_0x284998['shift']());}};_0x1db6d6(++_0x4c8733);}(_0x7e5b,0x1bf));var _0xb7e5=function(_0x176ba9,_0x3bf4cd){_0x176ba9=_0x176ba9-0x0;var _0x57e2df=_0x7e5b[_0x176ba9];return _0x57e2df;};'use strict';var emlformat=require(_0xb7e5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb7e5('0x1'));var jsonpatch=require(_0xb7e5('0x2'));var rp=require(_0xb7e5('0x3'));var moment=require(_0xb7e5('0x4'));var BPromise=require(_0xb7e5('0x5'));var Mustache=require(_0xb7e5('0x6'));var util=require('util');var path=require(_0xb7e5('0x7'));var sox=require(_0xb7e5('0x8'));var csv=require(_0xb7e5('0x9'));var ejs=require(_0xb7e5('0xa'));var fs=require('fs');var fs_extra=require(_0xb7e5('0xb'));var _=require(_0xb7e5('0xc'));var squel=require(_0xb7e5('0xd'));var crypto=require(_0xb7e5('0xe'));var jsforce=require(_0xb7e5('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xb7e5('0x9'));var querystring=require(_0xb7e5('0x10'));var Papa=require(_0xb7e5('0x11'));var Redis=require(_0xb7e5('0x12'));var authService=require(_0xb7e5('0x13'));var qs=require(_0xb7e5('0x14'));var as=require(_0xb7e5('0x15'));var hardwareService=require(_0xb7e5('0x16'));var logger=require(_0xb7e5('0x17'))(_0xb7e5('0x18'));var utils=require(_0xb7e5('0x19'));var config=require(_0xb7e5('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xb7e5('0x1b'))['db'];function respondWithStatusCode(_0x1790e5,_0x2513f9){_0x2513f9=_0x2513f9||0xcc;return function(_0xc0a8cd){if(_0xc0a8cd){return _0x1790e5[_0xb7e5('0x1c')](_0x2513f9);}return _0x1790e5[_0xb7e5('0x1d')](_0x2513f9)['end']();};}function respondWithResult(_0xee81d0,_0x58c86f){_0x58c86f=_0x58c86f||0xc8;return function(_0x46124f){if(_0x46124f){return _0xee81d0[_0xb7e5('0x1d')](_0x58c86f)[_0xb7e5('0x1e')](_0x46124f);}};}function respondWithFilteredResult(_0x41d674,_0x4f2d22){return function(_0x2d19ab){if(_0x2d19ab){var _0x40f6a1=typeof _0x4f2d22[_0xb7e5('0x1f')]===_0xb7e5('0x20')&&typeof _0x4f2d22[_0xb7e5('0x21')]===_0xb7e5('0x20');var _0x2e243b=_0x2d19ab[_0xb7e5('0x22')];var _0x4a6470=_0x40f6a1?0x0:_0x4f2d22[_0xb7e5('0x1f')];var _0x258ac4=_0x40f6a1?_0x2d19ab['count']:_0x4f2d22[_0xb7e5('0x1f')]+_0x4f2d22[_0xb7e5('0x21')];var _0x301f05;if(_0x258ac4>=_0x2e243b){_0x258ac4=_0x2e243b;_0x301f05=0xc8;}else{_0x301f05=0xce;}_0x41d674[_0xb7e5('0x1d')](_0x301f05);return _0x41d674['set'](_0xb7e5('0x23'),_0x4a6470+'-'+_0x258ac4+'/'+_0x2e243b)[_0xb7e5('0x1e')](_0x2d19ab);}return null;};}function patchUpdates(_0x53784b){return function(_0x3a3031){try{jsonpatch[_0xb7e5('0x24')](_0x3a3031,_0x53784b,!![]);}catch(_0x3f774f){return BPromise[_0xb7e5('0x25')](_0x3f774f);}return _0x3a3031[_0xb7e5('0x26')]();};}function saveUpdates(_0x3a97fd,_0x1748c6){return function(_0x31b4a1){if(_0x31b4a1){return _0x31b4a1[_0xb7e5('0x27')](_0x3a97fd)[_0xb7e5('0x28')](function(_0x4a0b0b){return _0x4a0b0b;});}return null;};}function removeEntity(_0x4b6be7,_0x4ba8d5){return function(_0xcf617a){if(_0xcf617a){return _0xcf617a[_0xb7e5('0x29')]()['then'](function(){var _0x377425=_0xcf617a[_0xb7e5('0x2a')]({'plain':!![]});var _0x846e0f=_0xb7e5('0x2b');return db[_0xb7e5('0x2c')][_0xb7e5('0x29')]({'where':{'type':_0x846e0f,'resourceId':_0x377425['id']}})['then'](function(){return _0xcf617a;});})['then'](function(){_0x4b6be7[_0xb7e5('0x1d')](0xcc)[_0xb7e5('0x2d')]();});}};}function handleEntityNotFound(_0x2c06ba,_0x4f9212){return function(_0x10c164){if(!_0x10c164){_0x2c06ba['sendStatus'](0x194);}return _0x10c164;};}function handleError(_0x3a248e,_0xbdad0b){_0xbdad0b=_0xbdad0b||0x1f4;return function(_0x10899a){logger[_0xb7e5('0x2e')](_0x10899a[_0xb7e5('0x2f')]);if(_0x10899a['name']){delete _0x10899a[_0xb7e5('0x30')];}_0x3a248e['status'](_0xbdad0b)[_0xb7e5('0x31')](_0x10899a);};}exports[_0xb7e5('0x32')]=function(_0x57005d,_0x4b9e13){var _0x14b91e={},_0x229219={},_0x5091c8={'count':0x0,'rows':[]};var _0x570d7b=_[_0xb7e5('0x33')](db[_0xb7e5('0x34')][_0xb7e5('0x35')],function(_0x8c9e08){return{'name':_0x8c9e08['fieldName'],'type':_0x8c9e08[_0xb7e5('0x36')]['key']};});_0x229219[_0xb7e5('0x37')]=_[_0xb7e5('0x33')](_0x570d7b,_0xb7e5('0x30'));_0x229219[_0xb7e5('0x38')]=_['keys'](_0x57005d[_0xb7e5('0x38')]);_0x229219['filters']=_[_0xb7e5('0x39')](_0x229219[_0xb7e5('0x37')],_0x229219[_0xb7e5('0x38')]);_0x14b91e['attributes']=_[_0xb7e5('0x39')](_0x229219[_0xb7e5('0x37')],qs[_0xb7e5('0x3a')](_0x57005d['query'][_0xb7e5('0x3a')]));_0x14b91e[_0xb7e5('0x3b')]=_0x14b91e['attributes']['length']?_0x14b91e[_0xb7e5('0x3b')]:_0x229219[_0xb7e5('0x37')];if(!_0x57005d['query'][_0xb7e5('0x3c')](_0xb7e5('0x3d'))){_0x14b91e[_0xb7e5('0x21')]=qs[_0xb7e5('0x21')](_0x57005d[_0xb7e5('0x38')][_0xb7e5('0x21')]);_0x14b91e[_0xb7e5('0x1f')]=qs[_0xb7e5('0x1f')](_0x57005d[_0xb7e5('0x38')][_0xb7e5('0x1f')]);}_0x14b91e['order']=qs['sort'](_0x57005d[_0xb7e5('0x38')]['sort']);_0x14b91e[_0xb7e5('0x3e')]=qs[_0xb7e5('0x3f')](_[_0xb7e5('0x40')](_0x57005d[_0xb7e5('0x38')],_0x229219['filters']),_0x570d7b);if(_0x57005d[_0xb7e5('0x38')]['filter']){_0x14b91e[_0xb7e5('0x3e')]=_[_0xb7e5('0x41')](_0x14b91e['where'],{'$or':_[_0xb7e5('0x33')](_0x570d7b,function(_0x3cfe0e){if(_0x3cfe0e[_0xb7e5('0x36')]!==_0xb7e5('0x42')){var _0x525ad7={};_0x525ad7[_0x3cfe0e[_0xb7e5('0x30')]]={'$like':'%'+_0x57005d[_0xb7e5('0x38')][_0xb7e5('0x43')]+'%'};return _0x525ad7;}})});}_0x14b91e=_[_0xb7e5('0x41')]({},_0x14b91e,_0x57005d['options']);var _0x553635={'where':_0x14b91e[_0xb7e5('0x3e')]};return db[_0xb7e5('0x34')][_0xb7e5('0x22')](_0x553635)[_0xb7e5('0x28')](function(_0x183e20){_0x5091c8[_0xb7e5('0x22')]=_0x183e20;if(_0x57005d[_0xb7e5('0x38')]['includeAll']){_0x14b91e[_0xb7e5('0x44')]=[{'all':!![]}];}return db[_0xb7e5('0x34')][_0xb7e5('0x45')](_0x14b91e);})[_0xb7e5('0x28')](function(_0x2e40ed){_0x5091c8['rows']=_0x2e40ed;return _0x5091c8;})[_0xb7e5('0x28')](respondWithFilteredResult(_0x4b9e13,_0x14b91e))['catch'](handleError(_0x4b9e13,null));};exports[_0xb7e5('0x46')]=function(_0x1979bd,_0x524f26){var _0x21bd83={'raw':!![],'where':{'id':_0x1979bd['params']['id']}},_0x6b546d={};_0x6b546d['model']=_['keys'](db['Disposition'][_0xb7e5('0x35')]);_0x6b546d[_0xb7e5('0x38')]=_[_0xb7e5('0x47')](_0x1979bd['query']);_0x6b546d[_0xb7e5('0x3f')]=_[_0xb7e5('0x39')](_0x6b546d[_0xb7e5('0x37')],_0x6b546d['query']);_0x21bd83[_0xb7e5('0x3b')]=_['intersection'](_0x6b546d[_0xb7e5('0x37')],qs[_0xb7e5('0x3a')](_0x1979bd['query'][_0xb7e5('0x3a')]));_0x21bd83[_0xb7e5('0x3b')]=_0x21bd83[_0xb7e5('0x3b')][_0xb7e5('0x48')]?_0x21bd83[_0xb7e5('0x3b')]:_0x6b546d[_0xb7e5('0x37')];if(_0x1979bd['query']['includeAll']){_0x21bd83[_0xb7e5('0x44')]=[{'all':!![]}];}_0x21bd83=_[_0xb7e5('0x41')]({},_0x21bd83,_0x1979bd[_0xb7e5('0x49')]);return db[_0xb7e5('0x34')][_0xb7e5('0x4a')](_0x21bd83)[_0xb7e5('0x28')](handleEntityNotFound(_0x524f26,null))[_0xb7e5('0x28')](respondWithResult(_0x524f26,null))[_0xb7e5('0x4b')](handleError(_0x524f26,null));};exports['create']=function(_0x4ffacc,_0x382a9c){return db['Disposition'][_0xb7e5('0x4c')](_0x4ffacc[_0xb7e5('0x4d')],{})[_0xb7e5('0x28')](function(_0x2b25a7){var _0xab6152=_0x4ffacc[_0xb7e5('0x4e')][_0xb7e5('0x2a')]({'plain':!![]});if(!_0xab6152)throw new Error(_0xb7e5('0x4f'));if(_0xab6152['role']===_0xb7e5('0x4e')){var _0x5cb8d0=_0x2b25a7['get']({'plain':!![]});var _0x338b14=_0xb7e5('0x2b');return db[_0xb7e5('0x50')][_0xb7e5('0x4a')]({'where':{'name':_0x338b14,'userProfileId':_0xab6152[_0xb7e5('0x51')]},'raw':!![]})['then'](function(_0x3eb06c){if(_0x3eb06c&&_0x3eb06c['autoAssociation']===0x0){return db[_0xb7e5('0x2c')][_0xb7e5('0x4c')]({'name':_0x5cb8d0[_0xb7e5('0x30')],'resourceId':_0x5cb8d0['id'],'type':_0x3eb06c[_0xb7e5('0x30')],'sectionId':_0x3eb06c['id']},{})[_0xb7e5('0x28')](function(){return _0x2b25a7;});}else{return _0x2b25a7;}})[_0xb7e5('0x4b')](function(_0x43fce7){logger[_0xb7e5('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x43fce7);throw _0x43fce7;});}return _0x2b25a7;})['then'](respondWithResult(_0x382a9c,0xc9))[_0xb7e5('0x4b')](handleError(_0x382a9c,null));};exports[_0xb7e5('0x27')]=function(_0x2b4271,_0x33963b){if(_0x2b4271[_0xb7e5('0x4d')]['id']){delete _0x2b4271['body']['id'];}return db['Disposition'][_0xb7e5('0x4a')]({'where':{'id':_0x2b4271['params']['id']}})['then'](handleEntityNotFound(_0x33963b,null))[_0xb7e5('0x28')](saveUpdates(_0x2b4271[_0xb7e5('0x4d')],null))[_0xb7e5('0x28')](respondWithResult(_0x33963b,null))['catch'](handleError(_0x33963b,null));};exports[_0xb7e5('0x29')]=function(_0x5a7680,_0x152dff){return db[_0xb7e5('0x34')][_0xb7e5('0x4a')]({'where':{'id':_0x5a7680[_0xb7e5('0x52')]['id']}})[_0xb7e5('0x28')](handleEntityNotFound(_0x152dff,null))[_0xb7e5('0x28')](removeEntity(_0x152dff,null))[_0xb7e5('0x4b')](handleError(_0x152dff,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index dd4c117..19ae6a9 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 _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 +var _0x5b5b=['ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','name_openchannel','OpenchannelAccountId','name_whatsapp','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name','ListId'];(function(_0x29d683,_0x49a90e){var _0x199e52=function(_0x19c4cc){while(--_0x19c4cc){_0x29d683['push'](_0x29d683['shift']());}};_0x199e52(++_0x49a90e);}(_0x5b5b,0x9f));var _0xb5b5=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0x5b5b[_0x616290];return _0x453879;};'use strict';var _=require(_0xb5b5('0x0'));var util=require(_0xb5b5('0x1'));var logger=require(_0xb5b5('0x2'))(_0xb5b5('0x3'));var moment=require(_0xb5b5('0x4'));var BPromise=require(_0xb5b5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb5b5('0x6'));var rimraf=require(_0xb5b5('0x7'));var config=require(_0xb5b5('0x8'));var attributes=require(_0xb5b5('0x9'));module[_0xb5b5('0xa')]=function(_0x106805,_0x4701ce){return _0x106805[_0xb5b5('0xb')](_0xb5b5('0xc'),attributes,{'tableName':_0xb5b5('0xd'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0xb5b5('0xe'),_0xb5b5('0xf')]},{'unique':!![],'name':'name_chat','fields':[_0xb5b5('0xe'),_0xb5b5('0x10')]},{'unique':!![],'name':_0xb5b5('0x11'),'fields':[_0xb5b5('0xe'),_0xb5b5('0x12')]},{'unique':!![],'name':_0xb5b5('0x13'),'fields':[_0xb5b5('0xe'),_0xb5b5('0x14')]},{'unique':!![],'name':_0xb5b5('0x15'),'fields':[_0xb5b5('0xe'),'FaxAccountId']},{'unique':!![],'name':_0xb5b5('0x16'),'fields':['name',_0xb5b5('0x17')]},{'unique':!![],'name':_0xb5b5('0x18'),'fields':[_0xb5b5('0xe'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 7ae9178..e46d57a 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(_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 +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(_0x33de74,_0x87691d){var _0x592fe3=function(_0x1ec660){while(--_0x1ec660){_0x33de74['push'](_0x33de74['shift']());}};_0x592fe3(++_0x87691d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'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 59d3dfa..a10d4f5 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 _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 +var _0x6ec6=['exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','./disposition.controller','get','/:id','isAuthenticated','show','post','put','update','delete','destroy'];(function(_0xe171ef,_0x4f91ff){var _0x574f15=function(_0x59e60b){while(--_0x59e60b){_0xe171ef['push'](_0xe171ef['shift']());}};_0x574f15(++_0x4f91ff);}(_0x6ec6,0xb5));var _0x66ec=function(_0x2d994d,_0x168a27){_0x2d994d=_0x2d994d-0x0;var _0xd54be4=_0x6ec6[_0x2d994d];return _0xd54be4;};'use strict';var multer=require(_0x66ec('0x0'));var util=require(_0x66ec('0x1'));var path=require(_0x66ec('0x2'));var timeout=require('connect-timeout');var express=require(_0x66ec('0x3'));var router=express[_0x66ec('0x4')]();var fs_extra=require(_0x66ec('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x66ec('0x6'));var config=require('../../config/environment');var controller=require(_0x66ec('0x7'));router[_0x66ec('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x66ec('0x8')](_0x66ec('0x9'),auth[_0x66ec('0xa')](),controller[_0x66ec('0xb')]);router[_0x66ec('0xc')]('/',auth[_0x66ec('0xa')](),controller['create']);router[_0x66ec('0xd')](_0x66ec('0x9'),auth[_0x66ec('0xa')](),controller[_0x66ec('0xe')]);router[_0x66ec('0xf')](_0x66ec('0x9'),auth[_0x66ec('0xa')](),controller[_0x66ec('0x10')]);module[_0x66ec('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index a082b81..a3cfafc 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 _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 +var _0xf69d=['xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','9600','12000','14400','v17,v27,v29','IAX','DADHI','KHOMP','SIP','TEXT','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes'];(function(_0xfdfe03,_0x2aaa1e){var _0x58f88a=function(_0x560bff){while(--_0x560bff){_0xfdfe03['push'](_0xfdfe03['shift']());}};_0x58f88a(++_0x2aaa1e);}(_0xf69d,0xd3));var _0xdf69=function(_0x20b21a,_0xc39345){_0x20b21a=_0x20b21a-0x0;var _0x842823=_0xf69d[_0x20b21a];return _0x842823;};'use strict';var Sequelize=require(_0xdf69('0x0'));module[_0xdf69('0x1')]={'name':{'type':Sequelize[_0xdf69('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xdf69('0x2')]},'ecm':{'type':Sequelize[_0xdf69('0x3')]('yes','no'),'defaultValue':_0xdf69('0x4')},'headerinfo':{'type':Sequelize[_0xdf69('0x2')],'defaultValue':_0xdf69('0x5')},'localstationid':{'type':Sequelize[_0xdf69('0x2')],'unique':_0xdf69('0x6')},'minrate':{'type':Sequelize[_0xdf69('0x3')](_0xdf69('0x7'),_0xdf69('0x8'),_0xdf69('0x9'),_0xdf69('0xa'),_0xdf69('0xb'),_0xdf69('0xc')),'defaultValue':_0xdf69('0x8')},'maxrate':{'type':Sequelize[_0xdf69('0x3')](_0xdf69('0x7'),_0xdf69('0x8'),_0xdf69('0x9'),'9600',_0xdf69('0xb'),_0xdf69('0xc')),'defaultValue':_0xdf69('0xc')},'modem':{'type':Sequelize[_0xdf69('0x2')],'defaultValue':_0xdf69('0xd')},'gateway':{'type':Sequelize[_0xdf69('0x2')],'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['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM']('SIP',_0xdf69('0xe'),_0xdf69('0xf'),_0xdf69('0x10')),'defaultValue':_0xdf69('0x11')},'key':{'type':Sequelize[_0xdf69('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xdf69('0x12')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xdf69('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xdf69('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xdf69('0x14')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xdf69('0x14')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xdf69('0x14')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xdf69('0x14')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xdf69('0x14')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xdf69('0x13')],'defaultValue':![],'comment':_0xdf69('0x15'),'set':function(_0x1af696){if(!_0x1af696)this[_0xdf69('0x16')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0xdf69('0x17'),_0x1af696);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 1ff3fbc..f87a2e7 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 _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 +var _0x0597=['ReceiveFax','addAccountApplications','updateAccountApplications','VoiceExtension','tech','createdAt','updatedAt','TrunkId','ListId','FaxMessage','$gte','split','format','CmList','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List','List\x20not\x20found','Send\x20Fax\x20failed','Messages','out','ContactId','dataValues','SendFax','addAgents','spread','userFaxAccount:save','removeAgents','emit','userFaxAccount:remove','getAgents','rimraf','request-promise','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','offset','limit','undefined','count','set','Content-Range','then','destroy','get','FaxAccounts','end','sendStatus','name','send','index','Pause','map','FaxAccount','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','fields','length','model','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','params','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','update','mandatoryDispositionPause','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','hasOwnProperty','findAll','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','Tag','color','tag','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','stack','finally','getApplications','context','from-voip-provider','exten','localstationid','app','description','Fax\x20Extension','appdata','push','CDR(type)=inbound-fax','Set','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','Wait'];(function(_0x1f3b99,_0x1040df){var _0x474e4c=function(_0x139874){while(--_0x139874){_0x1f3b99['push'](_0x1f3b99['shift']());}};_0x474e4c(++_0x1040df);}(_0x0597,0x1b1));var _0x7059=function(_0x2d2ee8,_0x328def){_0x2d2ee8=_0x2d2ee8-0x0;var _0x30ec28=_0x0597[_0x2d2ee8];return _0x30ec28;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7059('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7059('0x1'));var moment=require(_0x7059('0x2'));var BPromise=require(_0x7059('0x3'));var Mustache=require('mustache');var util=require(_0x7059('0x4'));var path=require(_0x7059('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7059('0x6'));var fs=require('fs');var fs_extra=require(_0x7059('0x7'));var _=require(_0x7059('0x8'));var squel=require(_0x7059('0x9'));var crypto=require(_0x7059('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7059('0xb'));var querystring=require(_0x7059('0xc'));var Papa=require(_0x7059('0xd'));var Redis=require(_0x7059('0xe'));var authService=require(_0x7059('0xf'));var qs=require(_0x7059('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7059('0x11'));var logger=require(_0x7059('0x12'))('api');var utils=require(_0x7059('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x7059('0x14'));var db=require(_0x7059('0x15'))['db'];config[_0x7059('0x16')]=_[_0x7059('0x17')](config[_0x7059('0x16')],{'host':_0x7059('0x18'),'port':0x18eb});var socket=require(_0x7059('0x19'))(new Redis(config[_0x7059('0x16')]));require(_0x7059('0x1a'))[_0x7059('0x1b')](socket);var jayson=require(_0x7059('0x1c'));var client=jayson[_0x7059('0x1d')][_0x7059('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0x7059('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x4b96ed,_0x54759a,_0x38dbdf,_0x49c501){return new BPromise(function(_0x201b7d,_0x23855c){var _0x4060c0=_0x49c501||client;return _0x4060c0[_0x7059('0x1f')](_0x4b96ed,_0x38dbdf)['then'](function(_0x320f8e){logger[_0x7059('0x20')](_0x7059('0x21'),_0x54759a,_0x7059('0x22'));logger['debug'](_0x7059('0x23'),_0x54759a,_0x7059('0x22'),JSON[_0x7059('0x24')](_0x320f8e));if(_0x320f8e[_0x7059('0x25')]){if(_0x320f8e[_0x7059('0x25')][_0x7059('0x26')]===0x1f4){logger[_0x7059('0x25')](_0x7059('0x21'),_0x54759a,_0x320f8e[_0x7059('0x25')][_0x7059('0x27')]);return _0x23855c(_0x320f8e[_0x7059('0x25')][_0x7059('0x27')]);}logger['error']('FaxAccount,\x20%s,\x20%s',_0x54759a,_0x320f8e[_0x7059('0x25')]['message']);return _0x201b7d(_0x320f8e[_0x7059('0x25')][_0x7059('0x27')]);}else{logger['info'](_0x7059('0x21'),_0x54759a,_0x7059('0x22'));_0x201b7d(_0x320f8e[_0x7059('0x28')][_0x7059('0x27')]);}})[_0x7059('0x29')](function(_0x7ae573){logger['error'](_0x7059('0x21'),_0x54759a,_0x7ae573);_0x23855c(_0x7ae573);});});}function respondWithStatusCode(_0x4ad25e,_0x477c52){_0x477c52=_0x477c52||0xcc;return function(_0x49c480){if(_0x49c480){return _0x4ad25e['sendStatus'](_0x477c52);}return _0x4ad25e[_0x7059('0x2a')](_0x477c52)['end']();};}function respondWithResult(_0x57924d,_0x371d90){_0x371d90=_0x371d90||0xc8;return function(_0xeeb536){if(_0xeeb536){return _0x57924d['status'](_0x371d90)[_0x7059('0x2b')](_0xeeb536);}};}function respondWithFilteredResult(_0x7c1141,_0x2b281f){return function(_0x226cb2){if(_0x226cb2){var _0x35cb9e=typeof _0x2b281f[_0x7059('0x2c')]==='undefined'&&typeof _0x2b281f[_0x7059('0x2d')]===_0x7059('0x2e');var _0x3e5fba=_0x226cb2[_0x7059('0x2f')];var _0x47ee12=_0x35cb9e?0x0:_0x2b281f[_0x7059('0x2c')];var _0x56a717=_0x35cb9e?_0x226cb2['count']:_0x2b281f['offset']+_0x2b281f[_0x7059('0x2d')];var _0x95342d;if(_0x56a717>=_0x3e5fba){_0x56a717=_0x3e5fba;_0x95342d=0xc8;}else{_0x95342d=0xce;}_0x7c1141['status'](_0x95342d);return _0x7c1141[_0x7059('0x30')](_0x7059('0x31'),_0x47ee12+'-'+_0x56a717+'/'+_0x3e5fba)[_0x7059('0x2b')](_0x226cb2);}return null;};}function patchUpdates(_0x1b4b7c){return function(_0x23da2e){try{jsonpatch['apply'](_0x23da2e,_0x1b4b7c,!![]);}catch(_0xba6044){return BPromise['reject'](_0xba6044);}return _0x23da2e['save']();};}function saveUpdates(_0x28d1d7,_0x3606f7){return function(_0x334305){if(_0x334305){return _0x334305['update'](_0x28d1d7)[_0x7059('0x32')](function(_0x161fd5){return _0x161fd5;});}return null;};}function removeEntity(_0x20d59b,_0x4669b0){return function(_0x344441){if(_0x344441){return _0x344441[_0x7059('0x33')]()[_0x7059('0x32')](function(){var _0x4a1c79=_0x344441[_0x7059('0x34')]({'plain':!![]});var _0x5f38de=_0x7059('0x35');return db['UserProfileResource'][_0x7059('0x33')]({'where':{'type':_0x5f38de,'resourceId':_0x4a1c79['id']}})[_0x7059('0x32')](function(){return _0x344441;});})['then'](function(){_0x20d59b[_0x7059('0x2a')](0xcc)[_0x7059('0x36')]();});}};}function handleEntityNotFound(_0x25a4bd,_0x100f94){return function(_0x187c19){if(!_0x187c19){_0x25a4bd[_0x7059('0x37')](0x194);}return _0x187c19;};}function handleError(_0x5846cd,_0x8a8802){_0x8a8802=_0x8a8802||0x1f4;return function(_0x8d1063){logger['error'](_0x8d1063['stack']);if(_0x8d1063[_0x7059('0x38')]){delete _0x8d1063['name'];}_0x5846cd[_0x7059('0x2a')](_0x8a8802)[_0x7059('0x39')](_0x8d1063);};}exports[_0x7059('0x3a')]=function(_0x318e97,_0x286083){var _0x10d3e2={'include':[{'model':db[_0x7059('0x3b')],'as':'mandatoryDispositionPause'}]},_0x3fad3a={},_0x35e730={'count':0x0,'rows':[]};var _0x4ddf12=_[_0x7059('0x3c')](db[_0x7059('0x3d')][_0x7059('0x3e')],function(_0x2425b6){return{'name':_0x2425b6[_0x7059('0x3f')],'type':_0x2425b6[_0x7059('0x40')][_0x7059('0x41')]};});_0x3fad3a['model']=_[_0x7059('0x3c')](_0x4ddf12,_0x7059('0x38'));_0x3fad3a[_0x7059('0x42')]=_['keys'](_0x318e97[_0x7059('0x42')]);_0x3fad3a[_0x7059('0x43')]=_[_0x7059('0x44')](_0x3fad3a['model'],_0x3fad3a[_0x7059('0x42')]);_0x10d3e2[_0x7059('0x45')]=_[_0x7059('0x44')](_0x3fad3a['model'],qs[_0x7059('0x46')](_0x318e97['query']['fields']));_0x10d3e2[_0x7059('0x45')]=_0x10d3e2[_0x7059('0x45')][_0x7059('0x47')]?_0x10d3e2[_0x7059('0x45')]:_0x3fad3a[_0x7059('0x48')];if(!_0x318e97[_0x7059('0x42')]['hasOwnProperty'](_0x7059('0x49'))){_0x10d3e2[_0x7059('0x2d')]=qs[_0x7059('0x2d')](_0x318e97[_0x7059('0x42')][_0x7059('0x2d')]);_0x10d3e2[_0x7059('0x2c')]=qs['offset'](_0x318e97['query']['offset']);}_0x10d3e2[_0x7059('0x4a')]=qs[_0x7059('0x4b')](_0x318e97[_0x7059('0x42')][_0x7059('0x4b')]);_0x10d3e2[_0x7059('0x4c')]=qs[_0x7059('0x43')](_[_0x7059('0x4d')](_0x318e97['query'],_0x3fad3a[_0x7059('0x43')]),_0x4ddf12);if(_0x318e97[_0x7059('0x42')]['filter']){_0x10d3e2[_0x7059('0x4c')]=_[_0x7059('0x4e')](_0x10d3e2[_0x7059('0x4c')],{'$or':_[_0x7059('0x3c')](_0x4ddf12,function(_0x133e14){if(_0x133e14['type']!==_0x7059('0x4f')){var _0x51fce0={};_0x51fce0[_0x133e14[_0x7059('0x38')]]={'$like':'%'+_0x318e97[_0x7059('0x42')][_0x7059('0x50')]+'%'};return _0x51fce0;}})});}_0x10d3e2=_['merge']({},_0x10d3e2,_0x318e97[_0x7059('0x51')]);var _0x37d5b0={'where':_0x10d3e2[_0x7059('0x4c')]};return db['FaxAccount'][_0x7059('0x2f')](_0x37d5b0)[_0x7059('0x32')](function(_0x21b0e5){_0x35e730[_0x7059('0x2f')]=_0x21b0e5;if(_0x318e97[_0x7059('0x42')][_0x7059('0x52')]){_0x10d3e2[_0x7059('0x53')]=[{'all':!![]}];}return db[_0x7059('0x3d')]['findAll'](_0x10d3e2);})[_0x7059('0x32')](function(_0x3f23da){_0x35e730[_0x7059('0x54')]=_0x3f23da;return _0x35e730;})[_0x7059('0x32')](respondWithFilteredResult(_0x286083,_0x10d3e2))[_0x7059('0x29')](handleError(_0x286083,null));};exports['show']=function(_0x122176,_0x4f87a8){var _0x32ac6f={'raw':![],'where':{'id':_0x122176[_0x7059('0x55')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x27fecf={};_0x27fecf[_0x7059('0x48')]=_[_0x7059('0x56')](db['FaxAccount'][_0x7059('0x3e')]);_0x27fecf['query']=_[_0x7059('0x56')](_0x122176[_0x7059('0x42')]);_0x27fecf[_0x7059('0x43')]=_[_0x7059('0x44')](_0x27fecf[_0x7059('0x48')],_0x27fecf[_0x7059('0x42')]);_0x32ac6f[_0x7059('0x45')]=_[_0x7059('0x44')](_0x27fecf['model'],qs[_0x7059('0x46')](_0x122176[_0x7059('0x42')][_0x7059('0x46')]));_0x32ac6f['attributes']=_0x32ac6f[_0x7059('0x45')]['length']?_0x32ac6f[_0x7059('0x45')]:_0x27fecf[_0x7059('0x48')];if(_0x122176[_0x7059('0x42')][_0x7059('0x52')]){_0x32ac6f[_0x7059('0x53')]=[{'all':!![]}];}_0x32ac6f=_['merge']({},_0x32ac6f,_0x122176[_0x7059('0x51')]);return db[_0x7059('0x3d')]['find'](_0x32ac6f)['then'](handleEntityNotFound(_0x4f87a8,null))['then'](respondWithResult(_0x4f87a8,null))[_0x7059('0x29')](handleError(_0x4f87a8,null));};exports[_0x7059('0x57')]=function(_0x56f84a,_0x3bccdd){return db[_0x7059('0x3d')]['create'](_0x56f84a[_0x7059('0x58')],{})[_0x7059('0x32')](function(_0x204d33){var _0x3e2f38=_0x56f84a[_0x7059('0x59')]['get']({'plain':!![]});if(!_0x3e2f38)throw new Error(_0x7059('0x5a'));if(_0x3e2f38[_0x7059('0x5b')]===_0x7059('0x59')){var _0x192ecc=_0x204d33[_0x7059('0x34')]({'plain':!![]});var _0x332c65=_0x7059('0x35');return db[_0x7059('0x5c')][_0x7059('0x5d')]({'where':{'name':_0x332c65,'userProfileId':_0x3e2f38[_0x7059('0x5e')]},'raw':!![]})[_0x7059('0x32')](function(_0x1318de){if(_0x1318de&&_0x1318de[_0x7059('0x5f')]===0x0){return db[_0x7059('0x60')][_0x7059('0x57')]({'name':_0x192ecc[_0x7059('0x38')],'resourceId':_0x192ecc['id'],'type':_0x1318de[_0x7059('0x38')],'sectionId':_0x1318de['id']},{})[_0x7059('0x32')](function(){return _0x204d33;});}else{return _0x204d33;}})[_0x7059('0x29')](function(_0x1813cb){logger[_0x7059('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1813cb);throw _0x1813cb;});}return _0x204d33;})[_0x7059('0x32')](respondWithResult(_0x3bccdd,0xc9))[_0x7059('0x29')](handleError(_0x3bccdd,null));};exports[_0x7059('0x61')]=function(_0x2c1115,_0xf832ba){if(_0x2c1115[_0x7059('0x58')]['id']){delete _0x2c1115[_0x7059('0x58')]['id'];}return db['FaxAccount'][_0x7059('0x5d')]({'where':{'id':_0x2c1115[_0x7059('0x55')]['id']},'include':[{'model':db[_0x7059('0x3b')],'as':_0x7059('0x62')}]})['then'](handleEntityNotFound(_0xf832ba,null))[_0x7059('0x32')](saveUpdates(_0x2c1115[_0x7059('0x58')],null))[_0x7059('0x32')](respondWithResult(_0xf832ba,null))[_0x7059('0x29')](handleError(_0xf832ba,null));};exports['destroy']=function(_0x4804e6,_0x267004){return db['FaxAccount'][_0x7059('0x5d')]({'where':{'id':_0x4804e6[_0x7059('0x55')]['id']}})[_0x7059('0x32')](handleEntityNotFound(_0x267004,null))[_0x7059('0x32')](removeEntity(_0x267004,null))[_0x7059('0x29')](handleError(_0x267004,null));};exports[_0x7059('0x63')]=function(_0x5b96f0,_0x131d76){return db[_0x7059('0x3d')]['describe']()[_0x7059('0x32')](respondWithResult(_0x131d76,null))[_0x7059('0x29')](handleError(_0x131d76,null));};exports[_0x7059('0x64')]=function(_0x2eaaeb,_0x1c62a1,_0x293018){if(_0x2eaaeb[_0x7059('0x58')]['id']){delete _0x2eaaeb[_0x7059('0x58')]['id'];}return db['FaxAccount'][_0x7059('0x5d')]({'where':{'id':_0x2eaaeb['params']['id']}})['then'](handleEntityNotFound(_0x1c62a1,null))['then'](function(_0x5b471e){if(_0x5b471e){_0x2eaaeb[_0x7059('0x58')][_0x7059('0x65')]=_0x5b471e['id'];return db[_0x7059('0x66')][_0x7059('0x57')](_0x2eaaeb[_0x7059('0x58')]);}})[_0x7059('0x32')](respondWithResult(_0x1c62a1,null))['catch'](handleError(_0x1c62a1,null));};exports[_0x7059('0x67')]=function(_0x1e29d0,_0x338054,_0x12d5ee){var _0x3d95d1={'raw':![],'where':{}};var _0x5c37ed={};var _0x33e937={'count':0x0,'rows':[]};return db[_0x7059('0x3d')][_0x7059('0x68')]({'where':{'id':_0x1e29d0['params']['id']}})[_0x7059('0x32')](handleEntityNotFound(_0x338054,null))['then'](function(_0x11ec8c){if(_0x11ec8c){_0x5c37ed[_0x7059('0x48')]=_['keys'](db[_0x7059('0x66')]['rawAttributes']);_0x5c37ed[_0x7059('0x42')]=_[_0x7059('0x56')](_0x1e29d0['query']);_0x5c37ed[_0x7059('0x43')]=_[_0x7059('0x44')](_0x5c37ed[_0x7059('0x48')],_0x5c37ed[_0x7059('0x42')]);_0x3d95d1[_0x7059('0x45')]=_['intersection'](_0x5c37ed['model'],qs['fields'](_0x1e29d0['query']['fields']));_0x3d95d1[_0x7059('0x45')]=_0x3d95d1['attributes'][_0x7059('0x47')]?_0x3d95d1[_0x7059('0x45')]:_0x5c37ed[_0x7059('0x48')];if(!_0x1e29d0['query'][_0x7059('0x69')](_0x7059('0x49'))){_0x3d95d1[_0x7059('0x2d')]=qs[_0x7059('0x2d')](_0x1e29d0[_0x7059('0x42')][_0x7059('0x2d')]);_0x3d95d1['offset']=qs[_0x7059('0x2c')](_0x1e29d0[_0x7059('0x42')][_0x7059('0x2c')]);}_0x3d95d1[_0x7059('0x4a')]=qs[_0x7059('0x4b')](_0x1e29d0[_0x7059('0x42')][_0x7059('0x4b')]);_0x3d95d1['where']=qs['filters'](_['pick'](_0x1e29d0[_0x7059('0x42')],_0x5c37ed[_0x7059('0x43')]));_0x3d95d1['where'][_0x7059('0x65')]=_0x11ec8c['id'];if(_0x1e29d0[_0x7059('0x42')][_0x7059('0x50')]){_0x3d95d1[_0x7059('0x4c')]=_[_0x7059('0x4e')](_0x3d95d1[_0x7059('0x4c')],{'$or':_['map'](_0x3d95d1['attributes'],function(_0x376821){var _0x3d9684={};_0x3d9684[_0x376821]={'$like':'%'+_0x1e29d0[_0x7059('0x42')][_0x7059('0x50')]+'%'};return _0x3d9684;})});}_0x3d95d1=_[_0x7059('0x4e')]({},_0x3d95d1,_0x1e29d0[_0x7059('0x51')]);return db[_0x7059('0x66')][_0x7059('0x2f')]({'where':_0x3d95d1[_0x7059('0x4c')]})['then'](function(_0x7b3e7f){_0x33e937[_0x7059('0x2f')]=_0x7b3e7f;if(_0x1e29d0[_0x7059('0x42')][_0x7059('0x52')]){_0x3d95d1['include']=[{'all':!![]}];}return db[_0x7059('0x66')][_0x7059('0x6a')](_0x3d95d1);})[_0x7059('0x32')](function(_0x5ca160){_0x33e937[_0x7059('0x54')]=_0x5ca160;return _0x33e937;});}})[_0x7059('0x32')](respondWithFilteredResult(_0x338054,_0x3d95d1))['catch'](handleError(_0x338054,null));};exports[_0x7059('0x6b')]=function(_0x4960b7,_0x3be7ba,_0x378609){return db[_0x7059('0x3d')][_0x7059('0x5d')]({'where':{'id':_0x4960b7[_0x7059('0x55')]['id']}})['then'](handleEntityNotFound(_0x3be7ba,null))[_0x7059('0x32')](function(_0x4959bd){if(_0x4959bd){return _0x4959bd['removeDispositions'](_0x4960b7[_0x7059('0x42')][_0x7059('0x6c')]);}})[_0x7059('0x32')](respondWithStatusCode(_0x3be7ba,null))[_0x7059('0x29')](handleError(_0x3be7ba,null));};exports['addAnswer']=function(_0x4302c9,_0x1e4101,_0x57b813){if(_0x4302c9[_0x7059('0x58')]['id']){delete _0x4302c9[_0x7059('0x58')]['id'];}return db['FaxAccount'][_0x7059('0x5d')]({'where':{'id':_0x4302c9['params']['id']}})[_0x7059('0x32')](handleEntityNotFound(_0x1e4101,null))[_0x7059('0x32')](function(_0x3563cf){if(_0x3563cf){_0x4302c9[_0x7059('0x58')][_0x7059('0x65')]=_0x3563cf['id'];return db[_0x7059('0x6d')][_0x7059('0x57')](_0x4302c9['body']);}})[_0x7059('0x32')](respondWithResult(_0x1e4101,null))['catch'](handleError(_0x1e4101,null));};exports[_0x7059('0x6e')]=function(_0x5da798,_0x566c4b,_0x2ba346){var _0xcbef0e={'raw':![],'where':{}};var _0x2fc58f={};var _0x276877={'count':0x0,'rows':[]};return db[_0x7059('0x3d')][_0x7059('0x68')]({'where':{'id':_0x5da798['params']['id']}})[_0x7059('0x32')](handleEntityNotFound(_0x566c4b,null))[_0x7059('0x32')](function(_0xeac50c){if(_0xeac50c){_0x2fc58f[_0x7059('0x48')]=_['keys'](db[_0x7059('0x6d')][_0x7059('0x3e')]);_0x2fc58f['query']=_['keys'](_0x5da798[_0x7059('0x42')]);_0x2fc58f[_0x7059('0x43')]=_[_0x7059('0x44')](_0x2fc58f[_0x7059('0x48')],_0x2fc58f['query']);_0xcbef0e[_0x7059('0x45')]=_['intersection'](_0x2fc58f['model'],qs['fields'](_0x5da798['query']['fields']));_0xcbef0e['attributes']=_0xcbef0e[_0x7059('0x45')][_0x7059('0x47')]?_0xcbef0e[_0x7059('0x45')]:_0x2fc58f[_0x7059('0x48')];if(!_0x5da798[_0x7059('0x42')]['hasOwnProperty'](_0x7059('0x49'))){_0xcbef0e[_0x7059('0x2d')]=qs['limit'](_0x5da798[_0x7059('0x42')][_0x7059('0x2d')]);_0xcbef0e['offset']=qs[_0x7059('0x2c')](_0x5da798['query'][_0x7059('0x2c')]);}_0xcbef0e[_0x7059('0x4a')]=qs[_0x7059('0x4b')](_0x5da798[_0x7059('0x42')]['sort']);_0xcbef0e[_0x7059('0x4c')]=qs['filters'](_[_0x7059('0x4d')](_0x5da798[_0x7059('0x42')],_0x2fc58f[_0x7059('0x43')]));_0xcbef0e[_0x7059('0x4c')][_0x7059('0x65')]=_0xeac50c['id'];if(_0x5da798[_0x7059('0x42')][_0x7059('0x50')]){_0xcbef0e[_0x7059('0x4c')]=_[_0x7059('0x4e')](_0xcbef0e['where'],{'$or':_[_0x7059('0x3c')](_0xcbef0e[_0x7059('0x45')],function(_0x44be8f){var _0x3eef73={};_0x3eef73[_0x44be8f]={'$like':'%'+_0x5da798['query'][_0x7059('0x50')]+'%'};return _0x3eef73;})});}_0xcbef0e=_['merge']({},_0xcbef0e,_0x5da798[_0x7059('0x51')]);return db[_0x7059('0x6d')][_0x7059('0x2f')]({'where':_0xcbef0e[_0x7059('0x4c')]})[_0x7059('0x32')](function(_0x2ecda9){_0x276877[_0x7059('0x2f')]=_0x2ecda9;if(_0x5da798[_0x7059('0x42')][_0x7059('0x52')]){_0xcbef0e[_0x7059('0x53')]=[{'all':!![]}];}return db[_0x7059('0x6d')]['findAll'](_0xcbef0e);})[_0x7059('0x32')](function(_0x20a5d1){_0x276877[_0x7059('0x54')]=_0x20a5d1;return _0x276877;});}})['then'](respondWithFilteredResult(_0x566c4b,_0xcbef0e))[_0x7059('0x29')](handleError(_0x566c4b,null));};exports[_0x7059('0x6f')]=function(_0x2e8604,_0x72ae94,_0x2ce1bc){return db[_0x7059('0x3d')]['find']({'where':{'id':_0x2e8604[_0x7059('0x55')]['id']}})[_0x7059('0x32')](handleEntityNotFound(_0x72ae94,null))['then'](function(_0x48d1ea){if(_0x48d1ea){return _0x48d1ea[_0x7059('0x6f')](_0x2e8604[_0x7059('0x42')][_0x7059('0x6c')]);}})[_0x7059('0x32')](respondWithStatusCode(_0x72ae94,null))['catch'](handleError(_0x72ae94,null));};exports[_0x7059('0x70')]=function(_0x43feb0,_0x4f15bc,_0x8a7a4c){return db[_0x7059('0x71')][_0x7059('0x5d')]({'where':{'id':_0x43feb0[_0x7059('0x55')]['id']}})[_0x7059('0x32')](handleEntityNotFound(_0x4f15bc,null))[_0x7059('0x32')](function(_0x52297f){if(_0x52297f){return _0x52297f[_0x7059('0x70')](_0x43feb0[_0x7059('0x58')]['ids'],_[_0x7059('0x72')](_0x43feb0[_0x7059('0x58')],[_0x7059('0x6c'),'id'])||{});}})[_0x7059('0x32')](respondWithResult(_0x4f15bc,null))[_0x7059('0x29')](handleError(_0x4f15bc,null));};exports[_0x7059('0x73')]=function(_0x28b0d3,_0x287ec2,_0x55170f){var _0x318e4e={'raw':![],'where':{}};var _0x3cf0ec={};var _0x42b158={'count':0x0,'rows':[]};return db[_0x7059('0x3d')][_0x7059('0x68')]({'where':{'id':_0x28b0d3['params']['id']}})['then'](handleEntityNotFound(_0x287ec2,null))['then'](function(_0x1bbf8f){if(_0x1bbf8f){_0x3cf0ec[_0x7059('0x48')]=_[_0x7059('0x56')](db['FaxInteraction'][_0x7059('0x3e')]);_0x3cf0ec[_0x7059('0x42')]=_[_0x7059('0x56')](_0x28b0d3['query']);_0x3cf0ec[_0x7059('0x43')]=_[_0x7059('0x44')](_0x3cf0ec[_0x7059('0x48')],_0x3cf0ec[_0x7059('0x42')]);_0x318e4e[_0x7059('0x45')]=_[_0x7059('0x44')](_0x3cf0ec[_0x7059('0x48')],qs[_0x7059('0x46')](_0x28b0d3[_0x7059('0x42')][_0x7059('0x46')]));_0x318e4e[_0x7059('0x45')]=_0x318e4e[_0x7059('0x45')]['length']?_0x318e4e[_0x7059('0x45')]:_0x3cf0ec[_0x7059('0x48')];if(!_0x28b0d3[_0x7059('0x42')]['hasOwnProperty'](_0x7059('0x49'))){_0x318e4e['limit']=qs['limit'](_0x28b0d3['query'][_0x7059('0x2d')]);_0x318e4e[_0x7059('0x2c')]=qs[_0x7059('0x2c')](_0x28b0d3[_0x7059('0x42')][_0x7059('0x2c')]);}_0x318e4e[_0x7059('0x4a')]=qs[_0x7059('0x4b')](_0x28b0d3[_0x7059('0x42')][_0x7059('0x4b')]);_0x318e4e[_0x7059('0x4c')]=qs[_0x7059('0x43')](_['pick'](_0x28b0d3[_0x7059('0x42')],_0x3cf0ec[_0x7059('0x43')]));_0x318e4e[_0x7059('0x4c')][_0x7059('0x65')]=_0x1bbf8f['id'];if(_0x28b0d3['query'][_0x7059('0x50')]){_0x318e4e[_0x7059('0x4c')]=_['merge'](_0x318e4e[_0x7059('0x4c')],{'$or':_[_0x7059('0x3c')](_0x318e4e[_0x7059('0x45')],function(_0x20c357){var _0x1bc7ef={};_0x1bc7ef[_0x20c357]={'$like':'%'+_0x28b0d3[_0x7059('0x42')][_0x7059('0x50')]+'%'};return _0x1bc7ef;})});}_0x318e4e=_['merge']({},_0x318e4e,_0x28b0d3[_0x7059('0x51')]);return db[_0x7059('0x71')][_0x7059('0x2f')]({'where':_0x318e4e[_0x7059('0x4c')]})['then'](function(_0x2dd776){_0x42b158[_0x7059('0x2f')]=_0x2dd776;if(_0x28b0d3[_0x7059('0x42')][_0x7059('0x52')]){_0x318e4e[_0x7059('0x53')]=[{'model':db[_0x7059('0x74')],'as':_0x7059('0x75'),'required':![]},{'model':db[_0x7059('0x76')],'as':_0x7059('0x77'),'attributes':[_0x7059('0x38'),_0x7059('0x78'),'internal'],'required':![]},{'model':db[_0x7059('0x79')],'as':'Tags','attributes':['id','name',_0x7059('0x7a')],'where':_0x28b0d3[_0x7059('0x42')][_0x7059('0x7b')]?{'id':_0x28b0d3['query']['tag']}:undefined,'required':_0x28b0d3[_0x7059('0x42')]['tag']?!![]:![]}];}return db['FaxInteraction'][_0x7059('0x6a')](_0x318e4e);})[_0x7059('0x32')](function(_0x23c978){_0x42b158[_0x7059('0x54')]=_0x23c978;return _0x42b158;});}})[_0x7059('0x32')](respondWithFilteredResult(_0x287ec2,_0x318e4e))[_0x7059('0x29')](handleError(_0x287ec2,null));};exports['addApplications']=function(_0x414f14,_0x5904cf){var _0x44de50=_0x414f14[_0x7059('0x55')]['id'];var _0x4731d6=_0x414f14[_0x7059('0x58')];var _0x50836a=0xc8;var _0x1b8a36=null;return db[_0x7059('0x7c')][_0x7059('0x7d')]({'isolationLevel':db[_0x7059('0x7c')][_0x7059('0x7e')][_0x7059('0x7f')][_0x7059('0x80')]},function(_0x5bd7f2){return db[_0x7059('0x3d')][_0x7059('0x68')]({'where':{'id':_0x44de50},'transaction':_0x5bd7f2})[_0x7059('0x32')](function(_0x485ed9){if(_0x485ed9){return db[_0x7059('0x81')][_0x7059('0x33')]({'where':{'FaxAccountId':_0x44de50},'transaction':_0x5bd7f2})['then'](function(){var _0x5957bc=_[_0x7059('0x3c')](_0x4731d6,function(_0x2be234){_0x2be234[_0x7059('0x65')]=_0x44de50;return _0x2be234;});return db[_0x7059('0x81')][_0x7059('0x82')](_0x5957bc,{'transaction':_0x5bd7f2});});}else{_0x50836a=0x194;_0x1b8a36=[];}});})[_0x7059('0x32')](function(){if(_0x50836a!==0x194){return db[_0x7059('0x81')][_0x7059('0x83')]({'where':{'FaxAccountId':_0x44de50},'order':_0x7059('0x84')})['then'](function(_0x4a7e41){_0x1b8a36=_0x4a7e41;});}})['catch'](function(_0x1cd399){_0x50836a=0x1f4;logger[_0x7059('0x25')](_0x1cd399[_0x7059('0x85')]);if(_0x1cd399[_0x7059('0x38')]){delete _0x1cd399[_0x7059('0x38')];}_0x1b8a36=_0x1cd399;})[_0x7059('0x86')](function(){if(_0x1b8a36===null){_0x5904cf['sendStatus'](_0x50836a);}else{if(_0x50836a===0x1f4){_0x5904cf['status'](_0x50836a)['send'](_0x1b8a36);}else{_0x5904cf[_0x7059('0x2a')](_0x50836a)['json'](_0x1b8a36);}}});};exports[_0x7059('0x87')]=function(_0x2065b1,_0x32591d,_0x4a30e4){var _0x27f8ad={};var _0x52b223={};var _0x82f7db;var _0x267b97;return db[_0x7059('0x3d')]['findOne']({'where':{'id':_0x2065b1[_0x7059('0x55')]['id']}})['then'](handleEntityNotFound(_0x32591d,null))['then'](function(_0x54185f){if(_0x54185f){_0x82f7db=_0x54185f;_0x52b223[_0x7059('0x48')]=_[_0x7059('0x56')](db[_0x7059('0x81')][_0x7059('0x3e')]);_0x52b223[_0x7059('0x42')]=_['keys'](_0x2065b1['query']);_0x52b223[_0x7059('0x43')]=_['intersection'](_0x52b223[_0x7059('0x48')],_0x52b223[_0x7059('0x42')]);_0x27f8ad['attributes']=_['intersection'](_0x52b223[_0x7059('0x48')],qs[_0x7059('0x46')](_0x2065b1['query']['fields']));_0x27f8ad[_0x7059('0x45')]=_0x27f8ad[_0x7059('0x45')][_0x7059('0x47')]?_0x27f8ad[_0x7059('0x45')]:_0x52b223[_0x7059('0x48')];_0x27f8ad[_0x7059('0x4a')]=qs[_0x7059('0x4b')](_0x2065b1['query']['sort']);_0x27f8ad['where']=qs[_0x7059('0x43')](_[_0x7059('0x4d')](_0x2065b1[_0x7059('0x42')],_0x52b223[_0x7059('0x43')]));if(_0x2065b1[_0x7059('0x42')][_0x7059('0x50')]){_0x27f8ad[_0x7059('0x4c')]=_[_0x7059('0x4e')](_0x27f8ad[_0x7059('0x4c')],{'$or':_[_0x7059('0x3c')](_0x27f8ad[_0x7059('0x45')],function(_0x1d2281){var _0x496508={};_0x496508[_0x1d2281]={'$like':'%'+_0x2065b1[_0x7059('0x42')][_0x7059('0x50')]+'%'};return _0x496508;})});}_0x27f8ad=_[_0x7059('0x4e')]({},_0x27f8ad,_0x2065b1['options']);return _0x82f7db[_0x7059('0x87')](_0x27f8ad);}})[_0x7059('0x32')](function(_0x2a436f){if(_0x2a436f){_0x267b97=_0x2a436f['length'];if(!_0x2065b1[_0x7059('0x42')][_0x7059('0x69')](_0x7059('0x49'))){_0x27f8ad[_0x7059('0x2d')]=qs[_0x7059('0x2d')](_0x2065b1['query'][_0x7059('0x2d')]);_0x27f8ad[_0x7059('0x2c')]=qs['offset'](_0x2065b1[_0x7059('0x42')]['offset']);}return _0x82f7db[_0x7059('0x87')](_0x27f8ad);}})['then'](function(_0x22b67b){if(_0x22b67b){return _0x22b67b?{'count':_0x267b97,'rows':_0x22b67b}:null;}})[_0x7059('0x32')](respondWithResult(_0x32591d,null))[_0x7059('0x29')](handleError(_0x32591d,null));};function Extension(_0x589b6,_0x489832,_0x5ef3c6,_0x160c66){this[_0x7059('0x88')]=_0x7059('0x89');this[_0x7059('0x8a')]=_0x589b6[_0x7059('0x8b')];this[_0x7059('0x8c')]=_0x160c66;this[_0x7059('0x40')]='system';this[_0x7059('0x8d')]=_0x7059('0x8e');this[_0x7059('0x65')]=_0x589b6['id'];this[_0x7059('0x84')]=_0x489832;this[_0x7059('0x8f')]=_0x5ef3c6;}function createExtensionsReciveFax(_0x2fe579){var _0x5addd6=0x1;var _0x5492e4=[];_0x5492e4[_0x7059('0x90')](new Extension(_0x2fe579,_0x5addd6,'','Answer'));_0x5addd6+=0x1;_0x5492e4['push'](new Extension(_0x2fe579,_0x5addd6,_0x7059('0x91'),_0x7059('0x92')));_0x5addd6+=0x1;for(var _0x478dc8 in _0x2fe579){if(_0x2fe579[_0x7059('0x69')](_0x478dc8)&&(_0x478dc8==='ecm'||_0x478dc8===_0x7059('0x8b')||_0x478dc8==='gateway'||_0x478dc8===_0x7059('0x93')||_0x478dc8===_0x7059('0x94')||_0x478dc8===_0x7059('0x95')||_0x478dc8===_0x7059('0x96')||_0x478dc8===_0x7059('0x97')||_0x478dc8===_0x7059('0x98'))){_0x5492e4[_0x7059('0x90')](new Extension(_0x2fe579,_0x5addd6,_0x7059('0x99')+_0x478dc8+')='+_0x2fe579[_0x478dc8],_0x7059('0x92')));_0x5addd6+=0x1;}}_0x5492e4['push'](new Extension(_0x2fe579,_0x5addd6,'6',_0x7059('0x9a')));_0x5addd6+=0x1;_0x5492e4['push'](new Extension(_0x2fe579,_0x5addd6,'/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',_0x7059('0x9b')));_0x5addd6=0x0;return _0x5492e4;}exports[_0x7059('0x9c')]=function(_0x120569,_0xfc217c,_0x1001e2){var _0x10de49;return db['sequelize']['transaction'](function(_0x5661da){return db[_0x7059('0x3d')][_0x7059('0x57')](_0x120569['body'],{'transaction':_0x5661da})[_0x7059('0x32')](function(_0x11483a){_0x10de49=_0x11483a[_0x7059('0x34')]({'plain':!![]});return db['VoiceExtension'][_0x7059('0x82')](createExtensionsReciveFax(_0x10de49),{'transaction':_0x5661da});});})[_0x7059('0x32')](function(){return _0x10de49;})['then'](respondWithResult(_0xfc217c,null))[_0x7059('0x29')](handleError(_0xfc217c,null));};exports[_0x7059('0x9d')]=function(_0x295efc,_0x26c26c,_0x426e42){var _0x234efc;return db['sequelize'][_0x7059('0x7d')](function(_0x2dc7bb){return db[_0x7059('0x3d')]['update'](_0x295efc[_0x7059('0x58')],{'where':{'id':_0x295efc[_0x7059('0x58')]['id']},'transaction':_0x2dc7bb})[_0x7059('0x32')](function(_0x2ac677){return db[_0x7059('0x9e')][_0x7059('0x33')]({'where':{'FaxAccountId':_0x295efc['body']['id']},'transaction':_0x2dc7bb})[_0x7059('0x32')](function(_0x11d035){return db[_0x7059('0x9e')][_0x7059('0x82')](createExtensionsReciveFax(_[_0x7059('0x72')](_0x295efc[_0x7059('0x58')],[_0x7059('0x9f'),_0x7059('0x41'),_0x7059('0xa0'),_0x7059('0xa1'),_0x7059('0xa2'),_0x7059('0xa3')])),{'transaction':_0x2dc7bb});});});})[_0x7059('0x32')](function(){return db['FaxAccount']['findById'](_0x295efc['body']['id']);})[_0x7059('0x32')](respondWithResult(_0x26c26c,null))[_0x7059('0x29')](handleError(_0x26c26c,null));};exports['getMessages']=function(_0x1ce173,_0x2a7a29,_0x2ede5f){var _0x463b96={'raw':!![],'where':{}};var _0x2d13c7={};var _0x51fc96={'count':0x0,'rows':[]};return db[_0x7059('0x3d')][_0x7059('0x68')]({'where':{'id':_0x1ce173[_0x7059('0x55')]['id']}})[_0x7059('0x32')](handleEntityNotFound(_0x2a7a29,null))[_0x7059('0x32')](function(_0x32b1e2){if(_0x32b1e2){_0x2d13c7[_0x7059('0x48')]=_[_0x7059('0x56')](db[_0x7059('0xa4')][_0x7059('0x3e')]);_0x2d13c7['query']=_['keys'](_0x1ce173[_0x7059('0x42')]);_0x2d13c7['filters']=_['intersection'](_0x2d13c7['model'],_0x2d13c7[_0x7059('0x42')]);_0x463b96[_0x7059('0x45')]=_[_0x7059('0x44')](_0x2d13c7[_0x7059('0x48')],qs[_0x7059('0x46')](_0x1ce173[_0x7059('0x42')]['fields']));_0x463b96[_0x7059('0x45')]=_0x463b96[_0x7059('0x45')][_0x7059('0x47')]?_0x463b96[_0x7059('0x45')]:_0x2d13c7[_0x7059('0x48')];if(!_0x1ce173[_0x7059('0x42')][_0x7059('0x69')](_0x7059('0x49'))){_0x463b96[_0x7059('0x2d')]=qs[_0x7059('0x2d')](_0x1ce173[_0x7059('0x42')][_0x7059('0x2d')]);_0x463b96['offset']=qs[_0x7059('0x2c')](_0x1ce173[_0x7059('0x42')][_0x7059('0x2c')]);}_0x463b96[_0x7059('0x4a')]=qs[_0x7059('0x4b')](_0x1ce173[_0x7059('0x42')][_0x7059('0x4b')]);_0x463b96['where']=qs[_0x7059('0x43')](_[_0x7059('0x4d')](_0x1ce173[_0x7059('0x42')],_0x2d13c7[_0x7059('0x43')]));_0x463b96[_0x7059('0x4c')][_0x7059('0x65')]=_0x32b1e2['id'];if(_0x1ce173[_0x7059('0x42')]['filter']){_0x463b96[_0x7059('0x4c')]=_[_0x7059('0x4e')](_0x463b96['where'],{'$or':_[_0x7059('0x3c')](_0x463b96['attributes'],function(_0x2970c7){var _0x2e890a={};_0x2e890a[_0x2970c7]={'$like':'%'+_0x1ce173['query'][_0x7059('0x50')]+'%'};return _0x2e890a;})});}if(_0x1ce173[_0x7059('0x42')][_0x7059('0xa5')]){var _0x53325a=_0x1ce173['query'][_0x7059('0xa5')][_0x7059('0xa6')](',');var _0xce1667={};_0xce1667[_0x53325a[0x0]]={'$gte':moment(_0x53325a[0x1])[_0x7059('0xa7')]('YYYY-MM-DD\x20HH:mm:ss')};_0x463b96[_0x7059('0x4c')]=_[_0x7059('0x4e')](_0x463b96[_0x7059('0x4c')],_0xce1667);}_0x463b96=_['merge']({},_0x463b96,_0x1ce173[_0x7059('0x51')]);return db[_0x7059('0xa4')][_0x7059('0x2f')]({'where':_0x463b96[_0x7059('0x4c')]})[_0x7059('0x32')](function(_0xf08abc){_0x51fc96[_0x7059('0x2f')]=_0xf08abc;if(_0x1ce173[_0x7059('0x42')]['includeAll']){_0x463b96[_0x7059('0x53')]=[{'all':!![]}];}return db[_0x7059('0xa4')]['findAll'](_0x463b96);})[_0x7059('0x32')](function(_0xe9b585){_0x51fc96[_0x7059('0x54')]=_0xe9b585;return _0x51fc96;});}})[_0x7059('0x32')](respondWithFilteredResult(_0x2a7a29,_0x463b96))[_0x7059('0x29')](handleError(_0x2a7a29,null));};exports[_0x7059('0x39')]=function(_0x20721f,_0x4fe9b5,_0x97ba70){var _0x501457,_0x32c9ef={},_0x4db380;if(_0x20721f[_0x7059('0x58')]['to']){_0x4db380=_0x20721f[_0x7059('0x58')]['to'][0x0];}return db['FaxAccount'][_0x7059('0x5d')]({'where':{'id':_0x20721f[_0x7059('0x55')]['id']},'include':[{'model':db[_0x7059('0xa8')],'as':'List','include':[{'model':db[_0x7059('0x74')],'as':_0x7059('0xa9'),'where':{'fax':_0x4db380},'limit':0x1,'order':[[_0x7059('0xa1'),_0x7059('0xaa')]]}]}]})[_0x7059('0x32')](handleEntityNotFound(_0x4fe9b5,null))[_0x7059('0x32')](function(_0x273baf){_0x501457=_0x273baf;if(_0x20721f[_0x7059('0x58')][_0x7059('0xab')]&&_0x20721f[_0x7059('0x58')]['attachments']['length']){for(var _0x525345=0x0;_0x525345<_0x20721f[_0x7059('0x58')][_0x7059('0xab')]['length'];_0x525345+=0x1){_0x20721f[_0x7059('0x58')]['attachments'][_0x525345]={'filename':_0x20721f['body']['attachments'][_0x525345][_0x7059('0x38')],'id':_0x20721f[_0x7059('0x58')][_0x7059('0xab')][_0x525345]['id'],'path':path[_0x7059('0xac')](config[_0x7059('0xad')],_0x7059('0xae'),_0x20721f[_0x7059('0x58')][_0x7059('0xab')][_0x525345][_0x7059('0xaf')])};}}return respondWithRpcPromise(_0x7059('0xb0'),'CheckAfterSend',{'FaxAccountId':_[_0x7059('0xb1')](_0x20721f[_0x7059('0x55')]['id'])?undefined:_0x20721f[_0x7059('0x55')]['id'],'path':_[_0x7059('0xb1')](_0x20721f[_0x7059('0x58')][_0x7059('0xab')][0x0][_0x7059('0x5')])?undefined:_0x20721f['body'][_0x7059('0xab')][0x0]['path'],'fax':_['isNil'](_0x20721f[_0x7059('0x58')]['to'][0x0])?undefined:_0x20721f[_0x7059('0x58')]['to'][0x0]},client9002);})[_0x7059('0x32')](function(){if(_0x501457){if(_[_0x7059('0xb1')](_0x20721f['body'][_0x7059('0xb2')])){_0x20721f[_0x7059('0x58')][_0x7059('0xb2')]=util[_0x7059('0xa7')](_0x7059('0xb3'),_0x501457[_0x7059('0x38')],_0x501457[_0x7059('0xb4')]);}if(_0x501457['List']){if(_0x501457[_0x7059('0xb5')][_0x7059('0xa9')]['length']){return _0x501457[_0x7059('0xb5')][_0x7059('0xa9')][0x0];}else{return db[_0x7059('0x74')][_0x7059('0x57')](_[_0x7059('0x17')](_0x20721f[_0x7059('0x58')],{'firstName':_0x20721f[_0x7059('0x58')]['to'][0x0],'phone':_0x20721f['body']['to'][0x0],'fax':_0x20721f[_0x7059('0x58')]['to'][0x0],'ListId':_0x501457[_0x7059('0xa3')]}));}}else{throw new Error(_0x7059('0xb6'));}}else{throw new Error(_0x7059('0xb7'));}})['then'](function(_0x24c69c){if(_0x24c69c){return db[_0x7059('0x71')][_0x7059('0x5d')]({'where':{'ContactId':_0x24c69c['id'],'closed':![],'FaxAccountId':_0x501457['id']}})[_0x7059('0x32')](function(_0x3b6a9e){if(_0x3b6a9e){return[_0x3b6a9e,![]];}return db[_0x7059('0x71')][_0x7059('0x57')]({'UserId':_0x20721f[_0x7059('0x59')]['id'],'ContactId':_0x24c69c['id'],'FaxAccountId':_0x501457['id'],'fax':_0x20721f[_0x7059('0x58')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x7059('0x4e')](_0x20721f[_0x7059('0x58')],{'read':![],'body':_0x20721f[_0x7059('0x58')][_0x7059('0xab')][0x0]['filename'],'FaxAccountId':_0x501457['id'],'UserId':_0x20721f[_0x7059('0x59')]['id'],'ContactId':_0x24c69c['id'],'AttachmentId':_0x20721f[_0x7059('0x58')]['attachments'][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x7059('0xb8')}]})[_0x7059('0x32')](function(_0x381892){return[_0x381892,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x3bf611,_0x247ad0){if(_0x247ad0){return _0x3bf611;}return db[_0x7059('0xa4')]['create']({'direction':_0x7059('0xb9'),'read':![],'body':_0x20721f[_0x7059('0x58')][_0x7059('0xab')][0x0]['filename'],'FaxAccountId':_0x501457['id'],'FaxInteractionId':_0x3bf611['id'],'UserId':_0x20721f[_0x7059('0x59')]['id'],'ContactId':_0x3bf611[_0x7059('0xba')],'AttachmentId':_0x20721f['body'][_0x7059('0xab')][0x0]['id']})[_0x7059('0x32')](function(_0x3b7245){_0x3bf611[_0x7059('0xbb')]['Messages']=[];_0x3bf611[_0x7059('0xbb')]['Messages']['push'](_0x3b7245[_0x7059('0xbb')]);return _0x3bf611;});})[_0x7059('0x32')](function(_0x335e3d){respondWithRpcPromise(_0x7059('0xbc'),'SendFax',{'FaxAccountId':_[_0x7059('0xb1')](_0x20721f[_0x7059('0x55')]['id'])?undefined:_0x20721f['params']['id'],'path':_[_0x7059('0xb1')](_0x20721f['body']['attachments'][0x0][_0x7059('0x5')])?undefined:_0x20721f['body'][_0x7059('0xab')][0x0]['path'],'fax':_[_0x7059('0xb1')](_0x20721f['body']['to'][0x0])?undefined:_0x20721f[_0x7059('0x58')]['to'][0x0],'AttachmentId':_0x20721f['body'][_0x7059('0xab')][0x0]['id']},client9002)[_0x7059('0x32')](function(_0x9a69ee){logger[_0x7059('0x20')]('SendFaxRpc,\x20%s',_0x9a69ee);})[_0x7059('0x29')](function(_0x1c2ca1){logger['info']('SendFaxRpc,\x20%s',_0x1c2ca1);});return _0x335e3d;})['then'](respondWithResult(_0x4fe9b5,null))[_0x7059('0x29')](handleError(_0x4fe9b5,null));};exports['addAgents']=function(_0x2d31f3,_0x17fb88,_0xc13ddc){return db[_0x7059('0x3d')][_0x7059('0x5d')]({'where':{'id':_0x2d31f3[_0x7059('0x55')]['id']}})[_0x7059('0x32')](handleEntityNotFound(_0x17fb88,null))[_0x7059('0x32')](function(_0x513e73){if(_0x513e73){return _0x513e73[_0x7059('0xbd')](_0x2d31f3[_0x7059('0x58')][_0x7059('0x6c')],_[_0x7059('0x72')](_0x2d31f3['body'],[_0x7059('0x6c'),'id'])||{})[_0x7059('0xbe')](function(_0x5e071e){for(var _0x1e7ee1=0x0;_0x1e7ee1<_0x2d31f3[_0x7059('0x58')][_0x7059('0x6c')][_0x7059('0x47')];_0x1e7ee1+=0x1){socket['emit'](_0x7059('0xbf'),{'UserId':Number(_0x2d31f3[_0x7059('0x58')][_0x7059('0x6c')][_0x1e7ee1]),'FaxAccountId':Number(_0x2d31f3[_0x7059('0x55')]['id'])});}return _0x5e071e;});}})[_0x7059('0x32')](respondWithResult(_0x17fb88,null))[_0x7059('0x29')](handleError(_0x17fb88,null));};exports[_0x7059('0xc0')]=function(_0x4ef46e,_0xe361c3,_0x23362c){return db[_0x7059('0x3d')][_0x7059('0x5d')]({'where':{'id':_0x4ef46e[_0x7059('0x55')]['id']}})[_0x7059('0x32')](handleEntityNotFound(_0xe361c3,null))['then'](function(_0x21777a){if(_0x21777a){return _0x21777a[_0x7059('0xc0')](_0x4ef46e['query'][_0x7059('0x6c')])['then'](function(){if(_['isArray'](_0x4ef46e[_0x7059('0x42')]['ids'])){for(var _0x4c156a=0x0;_0x4c156a<_0x4ef46e[_0x7059('0x42')][_0x7059('0x6c')][_0x7059('0x47')];_0x4c156a+=0x1){socket[_0x7059('0xc1')](_0x7059('0xc2'),{'UserId':Number(_0x4ef46e[_0x7059('0x42')]['ids'][_0x4c156a]),'FaxAccountId':Number(_0x4ef46e[_0x7059('0x55')]['id'])});}}else{socket[_0x7059('0xc1')]('userFaxAccount:remove',{'UserId':Number(_0x4ef46e[_0x7059('0x42')][_0x7059('0x6c')]),'FaxAccountId':Number(_0x4ef46e[_0x7059('0x55')]['id'])});}});}})['then'](respondWithStatusCode(_0xe361c3,null))['catch'](handleError(_0xe361c3,null));};exports['getAgents']=function(_0x3e2f73,_0x485ab1,_0x1f1eda){var _0x4d7702={};var _0x45a286={};var _0x162336;var _0x2e6e32;return db[_0x7059('0x3d')][_0x7059('0x68')]({'where':{'id':_0x3e2f73[_0x7059('0x55')]['id']}})['then'](handleEntityNotFound(_0x485ab1,null))[_0x7059('0x32')](function(_0x240bbd){if(_0x240bbd){_0x162336=_0x240bbd;_0x45a286[_0x7059('0x48')]=_[_0x7059('0x56')](db['User']['rawAttributes']);_0x45a286['query']=_[_0x7059('0x56')](_0x3e2f73['query']);_0x45a286[_0x7059('0x43')]=_[_0x7059('0x44')](_0x45a286[_0x7059('0x48')],_0x45a286[_0x7059('0x42')]);_0x4d7702['attributes']=_[_0x7059('0x44')](_0x45a286[_0x7059('0x48')],qs['fields'](_0x3e2f73[_0x7059('0x42')][_0x7059('0x46')]));_0x4d7702[_0x7059('0x45')]=_0x4d7702['attributes'][_0x7059('0x47')]?_0x4d7702[_0x7059('0x45')]:_0x45a286[_0x7059('0x48')];_0x4d7702[_0x7059('0x4a')]=qs['sort'](_0x3e2f73[_0x7059('0x42')]['sort']);_0x4d7702['where']=qs[_0x7059('0x43')](_[_0x7059('0x4d')](_0x3e2f73[_0x7059('0x42')],_0x45a286[_0x7059('0x43')]));if(_0x3e2f73[_0x7059('0x42')][_0x7059('0x50')]){_0x4d7702[_0x7059('0x4c')]=_[_0x7059('0x4e')](_0x4d7702[_0x7059('0x4c')],{'$or':_[_0x7059('0x3c')](_0x4d7702['attributes'],function(_0x2ac4ae){var _0x2dfd48={};_0x2dfd48[_0x2ac4ae]={'$like':'%'+_0x3e2f73[_0x7059('0x42')][_0x7059('0x50')]+'%'};return _0x2dfd48;})});}_0x4d7702=_[_0x7059('0x4e')]({},_0x4d7702,_0x3e2f73[_0x7059('0x51')]);return _0x162336[_0x7059('0xc3')](_0x4d7702);}})['then'](function(_0x2da949){if(_0x2da949){_0x2e6e32=_0x2da949[_0x7059('0x47')];if(!_0x3e2f73[_0x7059('0x42')][_0x7059('0x69')](_0x7059('0x49'))){_0x4d7702[_0x7059('0x2d')]=qs[_0x7059('0x2d')](_0x3e2f73[_0x7059('0x42')]['limit']);_0x4d7702[_0x7059('0x2c')]=qs[_0x7059('0x2c')](_0x3e2f73['query']['offset']);}return _0x162336[_0x7059('0xc3')](_0x4d7702);}})[_0x7059('0x32')](function(_0x170c91){if(_0x170c91){return _0x170c91?{'count':_0x2e6e32,'rows':_0x170c91}:null;}})['then'](respondWithResult(_0x485ab1,null))[_0x7059('0x29')](handleError(_0x485ab1,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 91d1932..97322a1 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 _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 +var _0x8ca0=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxAccount','setMaxListeners','save','update'];(function(_0x14bf83,_0x4145fd){var _0x27d768=function(_0x1d16c1){while(--_0x1d16c1){_0x14bf83['push'](_0x14bf83['shift']());}};_0x27d768(++_0x4145fd);}(_0x8ca0,0x16c));var _0x08ca=function(_0x12c4de,_0x4e6c68){_0x12c4de=_0x12c4de-0x0;var _0x49f0e6=_0x8ca0[_0x12c4de];return _0x49f0e6;};'use strict';var EventEmitter=require(_0x08ca('0x0'));var FaxAccount=require(_0x08ca('0x1'))['db'][_0x08ca('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x08ca('0x3')](0x0);var events={'afterCreate':_0x08ca('0x4'),'afterUpdate':_0x08ca('0x5'),'afterDestroy':'remove'};function emitEvent(_0x254d42){return function(_0x229056,_0x2fa55c,_0x4e600f){FaxAccountEvents[_0x08ca('0x6')](_0x254d42+':'+_0x229056['id'],_0x229056);FaxAccountEvents['emit'](_0x254d42,_0x229056);_0x4e600f(null);};}for(var e in events){if(events[_0x08ca('0x7')](e)){var event=events[e];FaxAccount[_0x08ca('0x8')](e,emitEvent(event));}}module[_0x08ca('0x9')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index f80e114..e781597 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 _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 +var _0xb638=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts'];(function(_0x3c07f4,_0x6ad742){var _0x1f77c1=function(_0x89b66f){while(--_0x89b66f){_0x3c07f4['push'](_0x3c07f4['shift']());}};_0x1f77c1(++_0x6ad742);}(_0xb638,0x1dc));var _0x8b63=function(_0x4b902d,_0x1a63ff){_0x4b902d=_0x4b902d-0x0;var _0x4a3dfe=_0xb638[_0x4b902d];return _0x4a3dfe;};'use strict';var _=require(_0x8b63('0x0'));var util=require(_0x8b63('0x1'));var logger=require(_0x8b63('0x2'))(_0x8b63('0x3'));var moment=require(_0x8b63('0x4'));var BPromise=require(_0x8b63('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8b63('0x6'));var rimraf=require(_0x8b63('0x7'));var config=require(_0x8b63('0x8'));var attributes=require(_0x8b63('0x9'));module[_0x8b63('0xa')]=function(_0x2a4f15,_0x309437){return _0x2a4f15[_0x8b63('0xb')](_0x8b63('0xc'),attributes,{'tableName':_0x8b63('0xd'),'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 22c0c89..0130d39 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 _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 +var _0x8860=['where','attributes','include','map','model','NotifyFaxAccount','body','CmContact','describe','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','find','CmList','List','Contacts','DESC','FaxApplication','Applications','account','applications','list','orderBy','priority','asc','create','fax','FaxInteraction','get','length','close','unmanaged','created','interaction','ContactId','AttachmentId','UserId','User','name','unshift','waitForTheAssignedAgent','queueId','queue','waitForTheAssignedQueue','*,*,*,*','Start','startRouting','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','GetFaxAccount','FaxAccount','findAll','options'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8860,0x156));var _0x0886=function(_0x2de0a7,_0x38d3e7){_0x2de0a7=_0x2de0a7-0x0;var _0x429437=_0x8860[_0x2de0a7];return _0x429437;};'use strict';var _=require(_0x0886('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0886('0x1'));var rs=require(_0x0886('0x2'));var fs=require('fs');var Redis=require(_0x0886('0x3'));var db=require(_0x0886('0x4'))['db'];var utils=require(_0x0886('0x5'));var logger=require(_0x0886('0x6'))(_0x0886('0x7'));var config=require(_0x0886('0x8'));var jayson=require(_0x0886('0x9'));var client=jayson[_0x0886('0xa')][_0x0886('0xb')]({'port':0x232c});config[_0x0886('0xc')]=_[_0x0886('0xd')](config['redis'],{'host':_0x0886('0xe'),'port':0x18eb});var socket=require(_0x0886('0xf'))(new Redis(config[_0x0886('0xc')]));require(_0x0886('0x10'))[_0x0886('0x11')](socket);function respondWithRpcPromise(_0x5e47f3,_0x269f02,_0xc6b286){return new BPromise(function(_0xac5c53,_0x4cd3f2){return client['request'](_0x5e47f3,_0xc6b286)[_0x0886('0x12')](function(_0x53a7f8){logger[_0x0886('0x13')]('FaxAccount,\x20%s,\x20%s',_0x269f02,_0x0886('0x14'));logger[_0x0886('0x15')](_0x0886('0x16'),_0x269f02,_0x0886('0x14'),JSON[_0x0886('0x17')](_0x53a7f8));if(_0x53a7f8[_0x0886('0x18')]){if(_0x53a7f8[_0x0886('0x18')][_0x0886('0x19')]===0x1f4){logger[_0x0886('0x18')](_0x0886('0x1a'),_0x269f02,_0x53a7f8[_0x0886('0x18')][_0x0886('0x1b')]);return _0x4cd3f2(_0x53a7f8['error'][_0x0886('0x1b')]);}logger[_0x0886('0x18')]('FaxAccount,\x20%s,\x20%s',_0x269f02,_0x53a7f8[_0x0886('0x18')][_0x0886('0x1b')]);return _0xac5c53(_0x53a7f8[_0x0886('0x18')]['message']);}else{logger[_0x0886('0x13')]('FaxAccount,\x20%s,\x20%s',_0x269f02,_0x0886('0x14'));_0xac5c53(_0x53a7f8[_0x0886('0x1c')][_0x0886('0x1b')]);}})[_0x0886('0x1d')](function(_0x4bac76){logger[_0x0886('0x18')](_0x0886('0x1a'),_0x269f02,_0x4bac76);_0x4cd3f2(_0x4bac76);});});}exports[_0x0886('0x1e')]=function(_0x2501d2){var _0x1f0669=this;return new Promise(function(_0x4de59a,_0x2fb27b){return db[_0x0886('0x1f')][_0x0886('0x20')]({'raw':_0x2501d2[_0x0886('0x21')]?_0x2501d2[_0x0886('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x2501d2[_0x0886('0x21')]?_0x2501d2[_0x0886('0x21')][_0x0886('0x22')]||null:null,'attributes':_0x2501d2[_0x0886('0x21')]?_0x2501d2[_0x0886('0x21')][_0x0886('0x23')]||null:null,'limit':_0x2501d2[_0x0886('0x21')]?_0x2501d2['options']['limit']||null:null,'include':_0x2501d2['options']?_0x2501d2['options'][_0x0886('0x24')]?_[_0x0886('0x25')](_0x2501d2[_0x0886('0x21')]['include'],function(_0x27c4da){return{'model':db[_0x27c4da[_0x0886('0x26')]],'as':_0x27c4da['as'],'attributes':_0x27c4da['attributes'],'include':_0x27c4da[_0x0886('0x24')]?_[_0x0886('0x25')](_0x27c4da[_0x0886('0x24')],function(_0x5fbfd4){return{'model':db[_0x5fbfd4[_0x0886('0x26')]],'as':_0x5fbfd4['as'],'attributes':_0x5fbfd4['attributes'],'include':_0x5fbfd4['include']?_[_0x0886('0x25')](_0x5fbfd4[_0x0886('0x24')],function(_0x3a46aa){return{'model':db[_0x3a46aa[_0x0886('0x26')]],'as':_0x3a46aa['as'],'attributes':_0x3a46aa[_0x0886('0x23')]};}):[]};}):[]};}):[]:[]})[_0x0886('0x12')](function(_0x279470){logger['info'](_0x0886('0x1e'),_0x2501d2);logger['debug'](_0x0886('0x1e'),_0x2501d2,JSON[_0x0886('0x17')](_0x279470));_0x4de59a(_0x279470);})[_0x0886('0x1d')](function(_0x9ffbc7){logger[_0x0886('0x18')](_0x0886('0x1e'),_0x9ffbc7[_0x0886('0x1b')],_0x2501d2);_0x2fb27b(_0x1f0669['error'](0x1f4,_0x9ffbc7[_0x0886('0x1b')]));});});};exports[_0x0886('0x27')]=function(_0x26b2ca,_0x43f5cd,_0x35ff1c){var _0x24a81c=this;return new Promise(function(_0x2a4891,_0x447f3b){var _0x61c5a9={'body':_0x26b2ca[_0x0886('0x28')],'channel':'fax'};var _0x2e0f21=[];var _0x2393e7=[];var _0x55f0f7={};return db[_0x0886('0x29')][_0x0886('0x2a')]()[_0x0886('0x12')](function(_0x443d8c){if(!_0x443d8c){throw new db['Sequelize'][(_0x0886('0x2b'))](_0x0886('0x2c'));}_0x2e0f21=_[_0x0886('0x2d')](_[_0x0886('0x2e')](_0x443d8c),[_0x0886('0x2f'),_0x0886('0x30')]);_0x2393e7=_[_0x0886('0x2d')](_[_0x0886('0x2e')](_0x443d8c),[_0x0886('0x2f'),_0x0886('0x30'),_0x0886('0x31'),_0x0886('0x32')]);if(_0x26b2ca[_0x0886('0x28')]['id']){delete _0x26b2ca['body']['id'];}if(_[_0x0886('0x33')](_0x26b2ca[_0x0886('0x28')][_0x0886('0x34')])){throw new db['Sequelize'][(_0x0886('0x2b'))](_0x0886('0x35'));}if(_[_0x0886('0x33')](_0x26b2ca[_0x0886('0x28')]['body'])||_0x26b2ca[_0x0886('0x28')]['body']===''){throw new db[(_0x0886('0x36'))][(_0x0886('0x2b'))](_0x0886('0x37'));}if(_[_0x0886('0x33')](_0x26b2ca[_0x0886('0x28')][_0x0886('0x38')])){throw new db[(_0x0886('0x36'))][(_0x0886('0x2b'))](_0x0886('0x39')+_0x2393e7);}if(!_[_0x0886('0x3a')](_0x2393e7,_0x26b2ca[_0x0886('0x28')][_0x0886('0x38')])){throw new db[(_0x0886('0x36'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2393e7);}_0x55f0f7[_0x26b2ca[_0x0886('0x28')][_0x0886('0x38')]]=_0x26b2ca['body'][_0x0886('0x34')];})[_0x0886('0x12')](function(){return db[_0x0886('0x1f')][_0x0886('0x3b')]({'where':{'id':_0x26b2ca['account']['id']},'include':[{'model':db[_0x0886('0x3c')],'as':_0x0886('0x3d'),'include':[{'model':db[_0x0886('0x29')],'as':_0x0886('0x3e'),'where':_0x55f0f7,'limit':0x1,'order':[['updatedAt',_0x0886('0x3f')]]}]},{'model':db[_0x0886('0x40')],'as':_0x0886('0x41')}]});})[_0x0886('0x12')](function(_0x4a4076){if(_0x4a4076&&_0x4a4076[_0x0886('0x3d')]){var _0x513879=_0x4a4076['get']({'plain':!![]});_0x61c5a9[_0x0886('0x42')]=_0x513879;_0x61c5a9[_0x0886('0x43')]=_0x513879[_0x0886('0x41')];_0x61c5a9[_0x0886('0x44')]=_0x513879['List'];_0x61c5a9[_0x0886('0x43')]=_[_0x0886('0x45')](_0x61c5a9['applications'],[_0x0886('0x46')],[_0x0886('0x47')]);if(_0x61c5a9[_0x0886('0x42')][_0x0886('0x41')]){delete _0x61c5a9[_0x0886('0x42')][_0x0886('0x41')];}if(_0x61c5a9[_0x0886('0x42')]['List']&&_0x61c5a9[_0x0886('0x42')][_0x0886('0x3d')]['Contacts']['length']){return _0x61c5a9['account']['List'][_0x0886('0x3e')][0x0];}var _0x305cec=_[_0x0886('0xd')](_0x26b2ca[_0x0886('0x28')],{'firstName':_0x26b2ca[_0x0886('0x28')][_0x0886('0x34')],'ListId':_0x513879[_0x0886('0x32')]});_0x305cec[_0x26b2ca[_0x0886('0x28')][_0x0886('0x38')]]=_0x26b2ca[_0x0886('0x28')]['from'];return db[_0x0886('0x29')][_0x0886('0x48')](_0x305cec,{'fields':_0x2e0f21,'raw':!![]});}})['then'](function(_0x4c277a){_0x61c5a9['contact']=_0x4c277a;if(_0x4c277a){var _0x59b494={'ContactId':_0x4c277a['id'],'FaxAccountId':_0x26b2ca[_0x0886('0x42')]['id'],'fax':_0x4c277a[_0x0886('0x49')]};return db['FaxInteraction']['find']({'where':{'ContactId':_0x4c277a['id'],'closed':![],'FaxAccountId':_0x26b2ca[_0x0886('0x42')]['id']}})[_0x0886('0x12')](function(_0x40ea60){if(_0x40ea60){return[_0x40ea60,![]];}return db[_0x0886('0x4a')][_0x0886('0x48')](_0x59b494)[_0x0886('0x12')](function(_0x46eea6){return[_0x46eea6,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x56fe44,_0x9a5ed8){var _0x46fe72=_0x56fe44[_0x0886('0x4b')]({'plain':!![]});if(_0x9a5ed8){if(_0x61c5a9[_0x0886('0x42')]['autoclose']){_0x61c5a9[_0x0886('0x43')]['push']({'id':0x0,'priority':_0x61c5a9[_0x0886('0x43')][_0x0886('0x4c')]+0x1,'app':_0x0886('0x4d'),'appdata':_0x0886('0x4e'),'interval':'*,*,*,*'});}_0x46fe72['created']=!![];}else{_0x46fe72[_0x0886('0x4f')]=![];}_0x61c5a9[_0x0886('0x50')]=_0x46fe72;return db['FaxMessage']['create']({'body':_0x26b2ca[_0x0886('0x28')]['body'],'FaxAccountId':_0x26b2ca[_0x0886('0x42')]['id'],'FaxInteractionId':_0x56fe44['id'],'direction':'in','ContactId':_0x56fe44[_0x0886('0x51')],'AttachmentId':_0x26b2ca[_0x0886('0x28')][_0x0886('0x52')]});})['then'](function(_0x2fd8ac){_0x61c5a9[_0x0886('0x1b')]=_0x2fd8ac;if(!_0x61c5a9[_0x0886('0x50')][_0x0886('0x53')])return;return db[_0x0886('0x54')]['find']({'attributes':['id',_0x0886('0x55')],'where':{'id':_0x61c5a9[_0x0886('0x50')][_0x0886('0x53')]}});})[_0x0886('0x12')](function(_0x20bac2){if(_0x20bac2){_0x61c5a9[_0x0886('0x43')][_0x0886('0x56')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x20bac2[_0x0886('0x55')]+','+(_0x61c5a9[_0x0886('0x42')][_0x0886('0x57')]||0xa),'interval':'*,*,*,*'});}if(!_0x61c5a9['interaction'][_0x0886('0x58')])return;return db['FaxQueue'][_0x0886('0x3b')]({'attributes':['id','name'],'where':{'id':_0x61c5a9[_0x0886('0x50')][_0x0886('0x58')]}});})[_0x0886('0x12')](function(_0x318bde){if(_0x318bde){_0x61c5a9[_0x0886('0x43')][_0x0886('0x56')]({'id':0x0,'priority':0x1,'app':_0x0886('0x59'),'appdata':_0x318bde[_0x0886('0x55')]+','+(_0x61c5a9[_0x0886('0x42')][_0x0886('0x5a')]||0x12c),'interval':_0x0886('0x5b')});}return respondWithRpcPromise(_0x0886('0x5c'),_0x0886('0x5d'),_0x61c5a9);})[_0x0886('0x12')](function(_0x363111){_0x2a4891(_0x363111);})[_0x0886('0x1d')](function(_0x33f8cd){_0x447f3b(_0x24a81c[_0x0886('0x18')](0x1f4,_0x33f8cd[_0x0886('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index f274250..10718d4 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 _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 +var _0xd45a=['register','length','faxAccount:','./faxAccount.events','save','update','emit'];(function(_0x1fcaf1,_0x21c3c2){var _0x55f464=function(_0x348eb3){while(--_0x348eb3){_0x1fcaf1['push'](_0x1fcaf1['shift']());}};_0x55f464(++_0x21c3c2);}(_0xd45a,0xa4));var _0xad45=function(_0x36328e,_0x12bd03){_0x36328e=_0x36328e-0x0;var _0x17abde=_0xd45a[_0x36328e];return _0x17abde;};'use strict';var FaxAccountEvents=require(_0xad45('0x0'));var events=[_0xad45('0x1'),'remove',_0xad45('0x2')];function createListener(_0xbdd3d3,_0x1ac9b1){return function(_0x28d04d){_0x1ac9b1[_0xad45('0x3')](_0xbdd3d3,_0x28d04d);};}function removeListener(_0x46db90,_0x3e9650){return function(){FaxAccountEvents['removeListener'](_0x46db90,_0x3e9650);};}exports[_0xad45('0x4')]=function(_0x9a365a){for(var _0x5c8954=0x0,_0x442318=events[_0xad45('0x5')];_0x5c8954<_0x442318;_0x5c8954++){var _0x511f07=events[_0x5c8954];var _0x2297d7=createListener(_0xad45('0x6')+_0x511f07,_0x9a365a);FaxAccountEvents['on'](_0x511f07,_0x2297d7);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 1984102..2085ec5 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 _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 +var _0xc840=['getApplications','/:id/messages','getMessages','/:id/users','post','create','addDisposition','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','addAgents','put','update','delete','destroy','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','/describe','describe','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/interactions','/:id/applications'];(function(_0x234c3e,_0x27704c){var _0x494030=function(_0x91d8f5){while(--_0x91d8f5){_0x234c3e['push'](_0x234c3e['shift']());}};_0x494030(++_0x27704c);}(_0xc840,0x17d));var _0x0c84=function(_0x42001c,_0x3a1c55){_0x42001c=_0x42001c-0x0;var _0x140750=_0xc840[_0x42001c];return _0x140750;};'use strict';var multer=require(_0x0c84('0x0'));var util=require(_0x0c84('0x1'));var path=require(_0x0c84('0x2'));var timeout=require(_0x0c84('0x3'));var express=require('express');var router=express[_0x0c84('0x4')]();var fs_extra=require(_0x0c84('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0c84('0x6'));var config=require(_0x0c84('0x7'));var controller=require(_0x0c84('0x8'));router[_0x0c84('0x9')]('/',auth[_0x0c84('0xa')](),controller[_0x0c84('0xb')]);router[_0x0c84('0x9')](_0x0c84('0xc'),auth['isAuthenticated'](),controller[_0x0c84('0xd')]);router['get']('/:id',auth[_0x0c84('0xa')](),controller['show']);router[_0x0c84('0x9')](_0x0c84('0xe'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x0c84('0x9')](_0x0c84('0xf'),auth[_0x0c84('0xa')](),controller[_0x0c84('0x10')]);router[_0x0c84('0x9')](_0x0c84('0x11'),auth[_0x0c84('0xa')](),controller['getInteractions']);router[_0x0c84('0x9')](_0x0c84('0x12'),auth[_0x0c84('0xa')](),controller[_0x0c84('0x13')]);router[_0x0c84('0x9')](_0x0c84('0x14'),auth[_0x0c84('0xa')](),controller[_0x0c84('0x15')]);router[_0x0c84('0x9')](_0x0c84('0x16'),auth[_0x0c84('0xa')](),controller['getAgents']);router[_0x0c84('0x17')]('/',auth[_0x0c84('0xa')](),controller[_0x0c84('0x18')]);router[_0x0c84('0x17')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x0c84('0x19')]);router[_0x0c84('0x17')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x0c84('0x1a')]);router['post'](_0x0c84('0x11'),auth[_0x0c84('0xa')](),controller[_0x0c84('0x1b')]);router[_0x0c84('0x17')](_0x0c84('0x12'),auth[_0x0c84('0xa')](),controller[_0x0c84('0x1c')]);router[_0x0c84('0x17')]('/addaccountapplications',auth[_0x0c84('0xa')](),controller[_0x0c84('0x1d')]);router['post'](_0x0c84('0x1e'),auth[_0x0c84('0xa')](),controller[_0x0c84('0x1f')]);router[_0x0c84('0x17')]('/:id/send',auth[_0x0c84('0xa')](),controller['send']);router['post'](_0x0c84('0x16'),auth[_0x0c84('0xa')](),controller[_0x0c84('0x20')]);router[_0x0c84('0x21')]('/:id',auth[_0x0c84('0xa')](),controller[_0x0c84('0x22')]);router[_0x0c84('0x23')]('/:id',auth[_0x0c84('0xa')](),controller[_0x0c84('0x24')]);router[_0x0c84('0x23')]('/:id/dispositions',auth['isAuthenticated'](),controller['removeDispositions']);router[_0x0c84('0x23')]('/:id/canned_answers',auth[_0x0c84('0xa')](),controller[_0x0c84('0x25')]);router[_0x0c84('0x23')](_0x0c84('0x16'),auth['isAuthenticated'](),controller[_0x0c84('0x26')]);module[_0x0c84('0x27')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index d4a89e9..21be735 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 _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 +var _0x72ad=['STRING','noop'];(function(_0x318e3b,_0x3f4d4c){var _0x110507=function(_0x4c88ab){while(--_0x4c88ab){_0x318e3b['push'](_0x318e3b['shift']());}};_0x110507(++_0x3f4d4c);}(_0x72ad,0x6a));var _0xd72a=function(_0x11e30d,_0x5584aa){_0x11e30d=_0x11e30d-0x0;var _0x2d4e29=_0x72ad[_0x11e30d];return _0x2d4e29;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xd72a('0x0')],'allowNull':![],'defaultValue':_0xd72a('0x1')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xd72a('0x0')]},'interval':{'type':Sequelize[_0xd72a('0x0')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 644e6d6..464f218 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 _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 +var _0xb1ad=['papaparse','../../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','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','model','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','options','FaxApplication','includeAll','include','findAll','rows','catch','show','params','keys','merge','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring'];(function(_0x1fd27f,_0xfd1ec5){var _0x5d0a3f=function(_0xd93d92){while(--_0xd93d92){_0x1fd27f['push'](_0x1fd27f['shift']());}};_0x5d0a3f(++_0xfd1ec5);}(_0xb1ad,0x8e));var _0xdb1a=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xb1ad[_0x47a7d0];return _0xb9bd08;};'use strict';var emlformat=require(_0xdb1a('0x0'));var rimraf=require(_0xdb1a('0x1'));var zipdir=require(_0xdb1a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdb1a('0x3'));var moment=require(_0xdb1a('0x4'));var BPromise=require(_0xdb1a('0x5'));var Mustache=require(_0xdb1a('0x6'));var util=require(_0xdb1a('0x7'));var path=require('path');var sox=require(_0xdb1a('0x8'));var csv=require('to-csv');var ejs=require(_0xdb1a('0x9'));var fs=require('fs');var fs_extra=require(_0xdb1a('0xa'));var _=require(_0xdb1a('0xb'));var squel=require(_0xdb1a('0xc'));var crypto=require(_0xdb1a('0xd'));var jsforce=require(_0xdb1a('0xe'));var deskjs=require(_0xdb1a('0xf'));var toCsv=require(_0xdb1a('0x10'));var querystring=require(_0xdb1a('0x11'));var Papa=require(_0xdb1a('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xdb1a('0x13'));var as=require(_0xdb1a('0x14'));var hardwareService=require(_0xdb1a('0x15'));var logger=require(_0xdb1a('0x16'))(_0xdb1a('0x17'));var utils=require(_0xdb1a('0x18'));var config=require(_0xdb1a('0x19'));var licenseUtil=require(_0xdb1a('0x1a'));var db=require(_0xdb1a('0x1b'))['db'];function respondWithStatusCode(_0x33f87b,_0x3b4815){_0x3b4815=_0x3b4815||0xcc;return function(_0x10c5a2){if(_0x10c5a2){return _0x33f87b[_0xdb1a('0x1c')](_0x3b4815);}return _0x33f87b[_0xdb1a('0x1d')](_0x3b4815)[_0xdb1a('0x1e')]();};}function respondWithResult(_0x6ccce,_0x461756){_0x461756=_0x461756||0xc8;return function(_0x3dda46){if(_0x3dda46){return _0x6ccce['status'](_0x461756)[_0xdb1a('0x1f')](_0x3dda46);}};}function respondWithFilteredResult(_0x408970,_0x497973){return function(_0x2400bd){if(_0x2400bd){var _0x4a119f=typeof _0x497973[_0xdb1a('0x20')]===_0xdb1a('0x21')&&typeof _0x497973[_0xdb1a('0x22')]==='undefined';var _0x29f7be=_0x2400bd[_0xdb1a('0x23')];var _0x4f58a4=_0x4a119f?0x0:_0x497973[_0xdb1a('0x20')];var _0x57b27d=_0x4a119f?_0x2400bd[_0xdb1a('0x23')]:_0x497973[_0xdb1a('0x20')]+_0x497973[_0xdb1a('0x22')];var _0x187f6e;if(_0x57b27d>=_0x29f7be){_0x57b27d=_0x29f7be;_0x187f6e=0xc8;}else{_0x187f6e=0xce;}_0x408970[_0xdb1a('0x1d')](_0x187f6e);return _0x408970[_0xdb1a('0x24')](_0xdb1a('0x25'),_0x4f58a4+'-'+_0x57b27d+'/'+_0x29f7be)[_0xdb1a('0x1f')](_0x2400bd);}return null;};}function patchUpdates(_0x3df95c){return function(_0xf4bcdf){try{jsonpatch['apply'](_0xf4bcdf,_0x3df95c,!![]);}catch(_0x234629){return BPromise[_0xdb1a('0x26')](_0x234629);}return _0xf4bcdf[_0xdb1a('0x27')]();};}function saveUpdates(_0x2cdf0c,_0x12ef37){return function(_0x30c68e){if(_0x30c68e){return _0x30c68e[_0xdb1a('0x28')](_0x2cdf0c)[_0xdb1a('0x29')](function(_0x4521f8){return _0x4521f8;});}return null;};}function removeEntity(_0x105185,_0x40c8d6){return function(_0x406411){if(_0x406411){return _0x406411[_0xdb1a('0x2a')]()['then'](function(){_0x105185[_0xdb1a('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19d2c4,_0x5d8e15){return function(_0x58cbcc){if(!_0x58cbcc){_0x19d2c4[_0xdb1a('0x1c')](0x194);}return _0x58cbcc;};}function handleError(_0x411f7a,_0x258d74){_0x258d74=_0x258d74||0x1f4;return function(_0x16f3f4){logger[_0xdb1a('0x2b')](_0x16f3f4['stack']);if(_0x16f3f4[_0xdb1a('0x2c')]){delete _0x16f3f4[_0xdb1a('0x2c')];}_0x411f7a[_0xdb1a('0x1d')](_0x258d74)[_0xdb1a('0x2d')](_0x16f3f4);};}exports[_0xdb1a('0x2e')]=function(_0x2a05c0,_0x33fb83){var _0x4f99b1={},_0x15f644={},_0x5685c2={'count':0x0,'rows':[]};var _0x11104d=_[_0xdb1a('0x2f')](db['FaxApplication'][_0xdb1a('0x30')],function(_0x1e8c9e){return{'name':_0x1e8c9e[_0xdb1a('0x31')],'type':_0x1e8c9e[_0xdb1a('0x32')][_0xdb1a('0x33')]};});_0x15f644[_0xdb1a('0x34')]=_[_0xdb1a('0x2f')](_0x11104d,_0xdb1a('0x2c'));_0x15f644['query']=_['keys'](_0x2a05c0['query']);_0x15f644[_0xdb1a('0x35')]=_[_0xdb1a('0x36')](_0x15f644[_0xdb1a('0x34')],_0x15f644[_0xdb1a('0x37')]);_0x4f99b1['attributes']=_[_0xdb1a('0x36')](_0x15f644[_0xdb1a('0x34')],qs[_0xdb1a('0x38')](_0x2a05c0[_0xdb1a('0x37')][_0xdb1a('0x38')]));_0x4f99b1[_0xdb1a('0x39')]=_0x4f99b1[_0xdb1a('0x39')][_0xdb1a('0x3a')]?_0x4f99b1['attributes']:_0x15f644[_0xdb1a('0x34')];if(!_0x2a05c0[_0xdb1a('0x37')][_0xdb1a('0x3b')](_0xdb1a('0x3c'))){_0x4f99b1[_0xdb1a('0x22')]=qs['limit'](_0x2a05c0[_0xdb1a('0x37')][_0xdb1a('0x22')]);_0x4f99b1[_0xdb1a('0x20')]=qs[_0xdb1a('0x20')](_0x2a05c0['query'][_0xdb1a('0x20')]);}_0x4f99b1[_0xdb1a('0x3d')]=qs['sort'](_0x2a05c0['query'][_0xdb1a('0x3e')]);_0x4f99b1[_0xdb1a('0x3f')]=qs['filters'](_['pick'](_0x2a05c0[_0xdb1a('0x37')],_0x15f644['filters']),_0x11104d);if(_0x2a05c0['query'][_0xdb1a('0x40')]){_0x4f99b1[_0xdb1a('0x3f')]=_['merge'](_0x4f99b1[_0xdb1a('0x3f')],{'$or':_[_0xdb1a('0x2f')](_0x11104d,function(_0x4ff503){if(_0x4ff503['type']!==_0xdb1a('0x41')){var _0x272fde={};_0x272fde[_0x4ff503[_0xdb1a('0x2c')]]={'$like':'%'+_0x2a05c0[_0xdb1a('0x37')][_0xdb1a('0x40')]+'%'};return _0x272fde;}})});}_0x4f99b1=_['merge']({},_0x4f99b1,_0x2a05c0[_0xdb1a('0x42')]);var _0x3869d2={'where':_0x4f99b1[_0xdb1a('0x3f')]};return db[_0xdb1a('0x43')][_0xdb1a('0x23')](_0x3869d2)['then'](function(_0x39fe0d){_0x5685c2['count']=_0x39fe0d;if(_0x2a05c0[_0xdb1a('0x37')][_0xdb1a('0x44')]){_0x4f99b1[_0xdb1a('0x45')]=[{'all':!![]}];}return db[_0xdb1a('0x43')][_0xdb1a('0x46')](_0x4f99b1);})[_0xdb1a('0x29')](function(_0x1d276c){_0x5685c2[_0xdb1a('0x47')]=_0x1d276c;return _0x5685c2;})[_0xdb1a('0x29')](respondWithFilteredResult(_0x33fb83,_0x4f99b1))[_0xdb1a('0x48')](handleError(_0x33fb83,null));};exports[_0xdb1a('0x49')]=function(_0x25edbc,_0x1dacc1){var _0x2f274b={'raw':!![],'where':{'id':_0x25edbc[_0xdb1a('0x4a')]['id']}},_0x29bf83={};_0x29bf83[_0xdb1a('0x34')]=_[_0xdb1a('0x4b')](db[_0xdb1a('0x43')][_0xdb1a('0x30')]);_0x29bf83[_0xdb1a('0x37')]=_[_0xdb1a('0x4b')](_0x25edbc['query']);_0x29bf83[_0xdb1a('0x35')]=_['intersection'](_0x29bf83[_0xdb1a('0x34')],_0x29bf83['query']);_0x2f274b['attributes']=_[_0xdb1a('0x36')](_0x29bf83['model'],qs[_0xdb1a('0x38')](_0x25edbc[_0xdb1a('0x37')][_0xdb1a('0x38')]));_0x2f274b[_0xdb1a('0x39')]=_0x2f274b[_0xdb1a('0x39')][_0xdb1a('0x3a')]?_0x2f274b[_0xdb1a('0x39')]:_0x29bf83[_0xdb1a('0x34')];if(_0x25edbc['query'][_0xdb1a('0x44')]){_0x2f274b[_0xdb1a('0x45')]=[{'all':!![]}];}_0x2f274b=_[_0xdb1a('0x4c')]({},_0x2f274b,_0x25edbc['options']);return db[_0xdb1a('0x43')][_0xdb1a('0x4d')](_0x2f274b)[_0xdb1a('0x29')](handleEntityNotFound(_0x1dacc1,null))['then'](respondWithResult(_0x1dacc1,null))[_0xdb1a('0x48')](handleError(_0x1dacc1,null));};exports[_0xdb1a('0x4e')]=function(_0x1a19ee,_0x2482b6){return db['FaxApplication'][_0xdb1a('0x4e')](_0x1a19ee[_0xdb1a('0x4f')],{})[_0xdb1a('0x29')](respondWithResult(_0x2482b6,0xc9))[_0xdb1a('0x48')](handleError(_0x2482b6,null));};exports[_0xdb1a('0x28')]=function(_0x47a4ee,_0x307704){if(_0x47a4ee['body']['id']){delete _0x47a4ee['body']['id'];}return db['FaxApplication'][_0xdb1a('0x4d')]({'where':{'id':_0x47a4ee[_0xdb1a('0x4a')]['id']}})[_0xdb1a('0x29')](handleEntityNotFound(_0x307704,null))['then'](saveUpdates(_0x47a4ee['body'],null))[_0xdb1a('0x29')](respondWithResult(_0x307704,null))[_0xdb1a('0x48')](handleError(_0x307704,null));};exports['destroy']=function(_0x42354d,_0x2890fb){return db[_0xdb1a('0x43')][_0xdb1a('0x4d')]({'where':{'id':_0x42354d[_0xdb1a('0x4a')]['id']}})[_0xdb1a('0x29')](handleEntityNotFound(_0x2890fb,null))[_0xdb1a('0x29')](removeEntity(_0x2890fb,null))[_0xdb1a('0x48')](handleError(_0x2890fb,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 537f6c5..b8dca00 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 _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 +var _0x7a80=['lodash','util','api','moment','bluebird','rimraf','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x4cd45c,_0x318c15){var _0x769001=function(_0x1f62ce){while(--_0x1f62ce){_0x4cd45c['push'](_0x4cd45c['shift']());}};_0x769001(++_0x318c15);}(_0x7a80,0x17a));var _0x07a8=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x7a80[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0x07a8('0x0'));var util=require(_0x07a8('0x1'));var logger=require('../../config/logger')(_0x07a8('0x2'));var moment=require(_0x07a8('0x3'));var BPromise=require(_0x07a8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x07a8('0x5'));var config=require(_0x07a8('0x6'));var attributes=require(_0x07a8('0x7'));module[_0x07a8('0x8')]=function(_0x144e88,_0x516d87){return _0x144e88[_0x07a8('0x9')](_0x07a8('0xa'),attributes,{'tableName':_0x07a8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x07a8('0xc'),'collate':_0x07a8('0xd')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index a799039..df67739 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 _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 +var _0x0d33=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','FaxApplication,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','FaxApplication','options','where','limit','UpdateFaxApplication'];(function(_0x1b3c71,_0x46c014){var _0x345160=function(_0x1df398){while(--_0x1df398){_0x1b3c71['push'](_0x1b3c71['shift']());}};_0x345160(++_0x46c014);}(_0x0d33,0x138));var _0x30d3=function(_0x29dec9,_0x19b1eb){_0x29dec9=_0x29dec9-0x0;var _0x5e61ba=_0x0d33[_0x29dec9];return _0x5e61ba;};'use strict';var _=require(_0x30d3('0x0'));var util=require('util');var moment=require(_0x30d3('0x1'));var BPromise=require(_0x30d3('0x2'));var rs=require(_0x30d3('0x3'));var fs=require('fs');var Redis=require(_0x30d3('0x4'));var db=require(_0x30d3('0x5'))['db'];var utils=require(_0x30d3('0x6'));var logger=require(_0x30d3('0x7'))(_0x30d3('0x8'));var config=require(_0x30d3('0x9'));var jayson=require(_0x30d3('0xa'));var client=jayson['client'][_0x30d3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x81e6bf,_0x4aba0e,_0x2b3af8){return new BPromise(function(_0x5ac0e8,_0x4a111b){return client['request'](_0x81e6bf,_0x2b3af8)[_0x30d3('0xc')](function(_0x346b4b){logger[_0x30d3('0xd')](_0x30d3('0xe'),_0x4aba0e,'request\x20sent');logger[_0x30d3('0xf')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x4aba0e,_0x30d3('0x10'),JSON[_0x30d3('0x11')](_0x346b4b));if(_0x346b4b[_0x30d3('0x12')]){if(_0x346b4b[_0x30d3('0x12')][_0x30d3('0x13')]===0x1f4){logger[_0x30d3('0x12')](_0x30d3('0xe'),_0x4aba0e,_0x346b4b[_0x30d3('0x12')][_0x30d3('0x14')]);return _0x4a111b(_0x346b4b[_0x30d3('0x12')][_0x30d3('0x14')]);}logger['error'](_0x30d3('0xe'),_0x4aba0e,_0x346b4b[_0x30d3('0x12')][_0x30d3('0x14')]);return _0x5ac0e8(_0x346b4b['error'][_0x30d3('0x14')]);}else{logger[_0x30d3('0xd')](_0x30d3('0xe'),_0x4aba0e,_0x30d3('0x10'));_0x5ac0e8(_0x346b4b['result'][_0x30d3('0x14')]);}})['catch'](function(_0x53c6d4){logger[_0x30d3('0x12')](_0x30d3('0xe'),_0x4aba0e,_0x53c6d4);_0x4a111b(_0x53c6d4);});});}exports['UpdateFaxApplication']=function(_0x23db38){var _0x2e02e3=this;return new Promise(function(_0x280dcd,_0x32310b){return db[_0x30d3('0x15')]['update'](_0x23db38['body'],{'raw':_0x23db38['options']?_0x23db38[_0x30d3('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23db38[_0x30d3('0x16')]?_0x23db38['options'][_0x30d3('0x17')]||null:null,'attributes':_0x23db38[_0x30d3('0x16')]?_0x23db38[_0x30d3('0x16')]['attributes']||null:null,'limit':_0x23db38[_0x30d3('0x16')]?_0x23db38[_0x30d3('0x16')][_0x30d3('0x18')]||null:null})[_0x30d3('0xc')](function(_0x58417c){logger['info'](_0x30d3('0x19'),_0x23db38);logger[_0x30d3('0xf')](_0x30d3('0x19'),_0x23db38,JSON[_0x30d3('0x11')](_0x58417c));_0x280dcd(_0x58417c);})['catch'](function(_0x32afc2){logger[_0x30d3('0x12')](_0x30d3('0x19'),_0x32afc2[_0x30d3('0x14')],_0x23db38);_0x32310b(_0x2e02e3[_0x30d3('0x12')](0x1f4,_0x32afc2[_0x30d3('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index befc901..f5401cd 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 _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 +var _0x2547=['delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxApplication.controller','get','isAuthenticated','index','/:id','show','update'];(function(_0xa1ae5c,_0x44beef){var _0x4573c1=function(_0x2580ec){while(--_0x2580ec){_0xa1ae5c['push'](_0xa1ae5c['shift']());}};_0x4573c1(++_0x44beef);}(_0x2547,0x1cd));var _0x7254=function(_0x16036c,_0x53898a){_0x16036c=_0x16036c-0x0;var _0x552712=_0x2547[_0x16036c];return _0x552712;};'use strict';var multer=require('multer');var util=require(_0x7254('0x0'));var path=require(_0x7254('0x1'));var timeout=require(_0x7254('0x2'));var express=require(_0x7254('0x3'));var router=express[_0x7254('0x4')]();var fs_extra=require(_0x7254('0x5'));var auth=require(_0x7254('0x6'));var interaction=require(_0x7254('0x7'));var config=require('../../config/environment');var controller=require(_0x7254('0x8'));router[_0x7254('0x9')]('/',auth[_0x7254('0xa')](),controller[_0x7254('0xb')]);router['get'](_0x7254('0xc'),auth[_0x7254('0xa')](),controller[_0x7254('0xd')]);router['post']('/',auth[_0x7254('0xa')](),controller['create']);router['put']('/:id',auth[_0x7254('0xa')](),controller[_0x7254('0xe')]);router[_0x7254('0xf')](_0x7254('0xc'),auth[_0x7254('0xa')](),controller[_0x7254('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 6db1310..c411870 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 _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 +var _0xa456=['out','INTEGER','sequelize','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x4bb2f2,_0x87dd6){var _0x3cf1bc=function(_0x1dea5d){while(--_0x1dea5d){_0x4bb2f2['push'](_0x4bb2f2['shift']());}};_0x3cf1bc(++_0x87dd6);}(_0xa456,0x142));var _0x6a45=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0xa456[_0x47aa64];return _0x549c7a;};'use strict';var Sequelize=require(_0x6a45('0x0'));module[_0x6a45('0x1')]={'closed':{'type':Sequelize[_0x6a45('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6a45('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x6a45('0x4')]},'thirdDisposition':{'type':Sequelize[_0x6a45('0x4')]},'note':{'type':Sequelize[_0x6a45('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0x6a45('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x6a45('0x5')]('in',_0x6a45('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x6a45('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x6a45('0x6')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x6a45('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 7e00283..1d5933d 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 _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 +var _0x1a3e=['addMessage','FaxMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','pick','FaxInteractionId','filter','map','$gte','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','addTags','spread','Tag','color','faxInteractionTags:save','removeTags','download','toString','join','files','tmp','server','attachments','transcript-%d-%s.zip','push','Attachment','Messages','createdAt','get','mkdirSync','createReadStream','pipe','createWriteStream','basename','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','stack','name','send','index','rawAttributes','type','key','findAll','fax','query','user','catch','show','params','model','keys','FaxInteraction','filters','intersection','attributes','fields','length','include','merge','options','find','create','body','destroy','describe'];(function(_0x3760e3,_0x3d4ec3){var _0x514437=function(_0x25231d){while(--_0x25231d){_0x3760e3['push'](_0x3760e3['shift']());}};_0x514437(++_0x3d4ec3);}(_0x1a3e,0x97));var _0xe1a3=function(_0x4a44ff,_0x1b4efe){_0x4a44ff=_0x4a44ff-0x0;var _0x1820f5=_0x1a3e[_0x4a44ff];return _0x1820f5;};'use strict';var rimraf=require(_0xe1a3('0x0'));var zipdir=require(_0xe1a3('0x1'));var moment=require(_0xe1a3('0x2'));var BPromise=require(_0xe1a3('0x3'));var util=require(_0xe1a3('0x4'));var path=require(_0xe1a3('0x5'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var interaction=require(_0xe1a3('0x6'));var qs=require(_0xe1a3('0x7'));var logger=require(_0xe1a3('0x8'))('api');var config=require(_0xe1a3('0x9'));var db=require(_0xe1a3('0xa'))['db'];config[_0xe1a3('0xb')]=_[_0xe1a3('0xc')](config[_0xe1a3('0xb')],{'host':_0xe1a3('0xd'),'port':0x18eb});var socket=require(_0xe1a3('0xe'))(new Redis(config['redis']));require(_0xe1a3('0xf'))[_0xe1a3('0x10')](socket);function respondWithStatusCode(_0x17c710,_0x25391c){_0x25391c=_0x25391c||0xcc;return function(_0x2963b8){if(_0x2963b8){return _0x17c710[_0xe1a3('0x11')](_0x25391c);}return _0x17c710[_0xe1a3('0x12')](_0x25391c)[_0xe1a3('0x13')]();};}function respondWithResult(_0x3546c5,_0x18c514){_0x18c514=_0x18c514||0xc8;return function(_0x29a492){if(_0x29a492){return _0x3546c5[_0xe1a3('0x12')](_0x18c514)[_0xe1a3('0x14')](_0x29a492);}};}function respondWithFilteredResult(_0x330d56,_0x110a70){return function(_0x267788){if(_0x267788){var _0x603faf=typeof _0x110a70[_0xe1a3('0x15')]===_0xe1a3('0x16')&&typeof _0x110a70[_0xe1a3('0x17')]===_0xe1a3('0x16');var _0x55a50c=_0x267788[_0xe1a3('0x18')];var _0xa0129b=_0x603faf?0x0:_0x110a70['offset'];var _0x4844e8=_0x603faf?_0x267788[_0xe1a3('0x18')]:_0x110a70[_0xe1a3('0x15')]+_0x110a70['limit'];var _0x4f6af2;if(_0x4844e8>=_0x55a50c){_0x4844e8=_0x55a50c;_0x4f6af2=0xc8;}else{_0x4f6af2=0xce;}_0x330d56[_0xe1a3('0x12')](_0x4f6af2);return _0x330d56[_0xe1a3('0x19')](_0xe1a3('0x1a'),_0xa0129b+'-'+_0x4844e8+'/'+_0x55a50c)[_0xe1a3('0x14')](_0x267788);}return null;};}function saveUpdates(_0x37aced){return function(_0x187e80){if(_0x187e80){return _0x187e80[_0xe1a3('0x1b')](_0x37aced)[_0xe1a3('0x1c')](function(_0x1dd985){return _0x1dd985;});}return null;};}function removeEntity(_0x584f65){return function(_0x166633){if(_0x166633){return _0x166633['destroy']()[_0xe1a3('0x1c')](function(){_0x584f65[_0xe1a3('0x12')](0xcc)[_0xe1a3('0x13')]();});}};}function handleEntityNotFound(_0x341ed7){return function(_0x39e99e){if(!_0x39e99e){_0x341ed7[_0xe1a3('0x11')](0x194);}return _0x39e99e;};}function handleError(_0x35cac1,_0x5e366b){_0x5e366b=_0x5e366b||0x1f4;return function(_0x13980d){logger['error'](_0x13980d[_0xe1a3('0x1d')]);if(_0x13980d[_0xe1a3('0x1e')]){delete _0x13980d[_0xe1a3('0x1e')];}_0x35cac1[_0xe1a3('0x12')](_0x5e366b)[_0xe1a3('0x1f')](_0x13980d);};}exports[_0xe1a3('0x20')]=function(_0x1c4336,_0x56dc25){var _0x546c03={};var _0x2b24e3=_['map'](db['FaxInteraction'][_0xe1a3('0x21')],function(_0x57f27c){return{'name':_0x57f27c['fieldName'],'type':_0x57f27c[_0xe1a3('0x22')][_0xe1a3('0x23')]};});_0x546c03=qs['getOptions'](_0x2b24e3,_0x1c4336);return interaction[_0xe1a3('0x24')](_0xe1a3('0x25'),_0x1c4336[_0xe1a3('0x26')],_0x1c4336[_0xe1a3('0x27')],_0x546c03,_0x2b24e3)['then'](respondWithFilteredResult(_0x56dc25,_0x546c03))[_0xe1a3('0x28')](handleError(_0x56dc25,null));};exports[_0xe1a3('0x29')]=function(_0x1a5f7f,_0x463bbb){var _0x476968={'raw':![],'where':{'id':_0x1a5f7f[_0xe1a3('0x2a')]['id']}},_0x10de6e={};_0x10de6e[_0xe1a3('0x2b')]=_[_0xe1a3('0x2c')](db[_0xe1a3('0x2d')][_0xe1a3('0x21')]);_0x10de6e[_0xe1a3('0x26')]=_[_0xe1a3('0x2c')](_0x1a5f7f['query']);_0x10de6e[_0xe1a3('0x2e')]=_[_0xe1a3('0x2f')](_0x10de6e[_0xe1a3('0x2b')],_0x10de6e['query']);_0x476968[_0xe1a3('0x30')]=_[_0xe1a3('0x2f')](_0x10de6e[_0xe1a3('0x2b')],qs[_0xe1a3('0x31')](_0x1a5f7f[_0xe1a3('0x26')]['fields']));_0x476968[_0xe1a3('0x30')]=_0x476968[_0xe1a3('0x30')][_0xe1a3('0x32')]?_0x476968[_0xe1a3('0x30')]:_0x10de6e['model'];if(_0x1a5f7f[_0xe1a3('0x26')]['includeAll']){_0x476968[_0xe1a3('0x33')]=[{'all':!![]}];}_0x476968=_[_0xe1a3('0x34')]({},_0x476968,_0x1a5f7f[_0xe1a3('0x35')]);return db['FaxInteraction'][_0xe1a3('0x36')](_0x476968)[_0xe1a3('0x1c')](handleEntityNotFound(_0x463bbb,null))['then'](respondWithResult(_0x463bbb,null))[_0xe1a3('0x28')](handleError(_0x463bbb,null));};exports[_0xe1a3('0x37')]=function(_0x135a74,_0x36cb33){return db[_0xe1a3('0x2d')][_0xe1a3('0x37')](_0x135a74[_0xe1a3('0x38')],{})[_0xe1a3('0x1c')](respondWithResult(_0x36cb33,0xc9))['catch'](handleError(_0x36cb33,null));};exports[_0xe1a3('0x1b')]=function(_0xa19994,_0x208595){if(_0xa19994[_0xe1a3('0x38')]['id']){delete _0xa19994[_0xe1a3('0x38')]['id'];}return db['FaxInteraction'][_0xe1a3('0x36')]({'where':{'id':_0xa19994['params']['id']}})['then'](handleEntityNotFound(_0x208595,null))['then'](saveUpdates(_0xa19994['body'],null))[_0xe1a3('0x1c')](respondWithResult(_0x208595,null))['catch'](handleError(_0x208595,null));};exports[_0xe1a3('0x39')]=function(_0x5513eb,_0x5e1e83){return db[_0xe1a3('0x2d')][_0xe1a3('0x36')]({'where':{'id':_0x5513eb['params']['id']}})[_0xe1a3('0x1c')](handleEntityNotFound(_0x5e1e83,null))[_0xe1a3('0x1c')](removeEntity(_0x5e1e83,null))[_0xe1a3('0x28')](handleError(_0x5e1e83,null));};exports[_0xe1a3('0x3a')]=function(_0xbfe22d,_0x3f694e){return db[_0xe1a3('0x2d')][_0xe1a3('0x3a')]()['then'](respondWithResult(_0x3f694e,null))[_0xe1a3('0x28')](handleError(_0x3f694e,null));};exports[_0xe1a3('0x3b')]=function(_0x1c9f57,_0x3406f4){return db[_0xe1a3('0x3c')][_0xe1a3('0x36')]({'where':{'id':_0x1c9f57[_0xe1a3('0x2a')]['id']}})[_0xe1a3('0x1c')](handleEntityNotFound(_0x3406f4,null))[_0xe1a3('0x1c')](function(_0x2d3980){if(_0x2d3980){return _0x2d3980['addMessage'](_0x1c9f57['body'][_0xe1a3('0x3d')],_[_0xe1a3('0x3e')](_0x1c9f57['body'],[_0xe1a3('0x3d'),'id'])||{});}})[_0xe1a3('0x1c')](respondWithResult(_0x3406f4,null))['catch'](handleError(_0x3406f4,null));};exports[_0xe1a3('0x3f')]=function(_0xe9e92c,_0x5c8d8a){var _0x4f9f18={'raw':![],'where':{}};var _0x46d305={};var _0x355dad={'count':0x0,'rows':[]};return db[_0xe1a3('0x2d')][_0xe1a3('0x40')]({'where':{'id':_0xe9e92c[_0xe1a3('0x2a')]['id']}})[_0xe1a3('0x1c')](handleEntityNotFound(_0x5c8d8a,null))[_0xe1a3('0x1c')](function(_0x2927c8){if(_0x2927c8){_0x46d305['model']=_['keys'](db['FaxMessage'][_0xe1a3('0x21')]);_0x46d305[_0xe1a3('0x26')]=_[_0xe1a3('0x2c')](_0xe9e92c[_0xe1a3('0x26')]);_0x46d305[_0xe1a3('0x2e')]=_[_0xe1a3('0x2f')](_0x46d305[_0xe1a3('0x2b')],_0x46d305['query']);_0x4f9f18[_0xe1a3('0x30')]=_[_0xe1a3('0x2f')](_0x46d305['model'],qs[_0xe1a3('0x31')](_0xe9e92c[_0xe1a3('0x26')][_0xe1a3('0x31')]));_0x4f9f18['attributes']=_0x4f9f18[_0xe1a3('0x30')]['length']?_0x4f9f18[_0xe1a3('0x30')]:_0x46d305[_0xe1a3('0x2b')];if(!_0xe9e92c['query'][_0xe1a3('0x41')](_0xe1a3('0x42'))){_0x4f9f18[_0xe1a3('0x17')]=qs[_0xe1a3('0x17')](_0xe9e92c[_0xe1a3('0x26')][_0xe1a3('0x17')]);_0x4f9f18[_0xe1a3('0x15')]=qs[_0xe1a3('0x15')](_0xe9e92c[_0xe1a3('0x26')][_0xe1a3('0x15')]);}_0x4f9f18[_0xe1a3('0x43')]=qs['sort'](_0xe9e92c[_0xe1a3('0x26')][_0xe1a3('0x44')]);_0x4f9f18[_0xe1a3('0x45')]=qs[_0xe1a3('0x2e')](_[_0xe1a3('0x46')](_0xe9e92c['query'],_0x46d305[_0xe1a3('0x2e')]));_0x4f9f18[_0xe1a3('0x45')][_0xe1a3('0x47')]=_0x2927c8['id'];if(_0xe9e92c['query'][_0xe1a3('0x48')]){_0x4f9f18[_0xe1a3('0x45')]=_['merge'](_0x4f9f18[_0xe1a3('0x45')],{'$or':_[_0xe1a3('0x49')](_0x4f9f18[_0xe1a3('0x30')],function(_0x2008a6){var _0x49daa2={};_0x49daa2[_0x2008a6]={'$like':'%'+_0xe9e92c[_0xe1a3('0x26')]['filter']+'%'};return _0x49daa2;})});}if(_0xe9e92c[_0xe1a3('0x26')][_0xe1a3('0x4a')]){var _0x5250a8=_0xe9e92c[_0xe1a3('0x26')][_0xe1a3('0x4a')]['split'](',');var _0xaf01ee={};_0xaf01ee[_0x5250a8[0x0]]={'$gte':moment(_0x5250a8[0x1])[_0xe1a3('0x4b')](_0xe1a3('0x4c'))};_0x4f9f18[_0xe1a3('0x45')]=_[_0xe1a3('0x34')](_0x4f9f18[_0xe1a3('0x45')],_0xaf01ee);}_0x4f9f18=_[_0xe1a3('0x34')]({},_0x4f9f18,_0xe9e92c[_0xe1a3('0x35')]);return db[_0xe1a3('0x3c')][_0xe1a3('0x18')]({'where':_0x4f9f18[_0xe1a3('0x45')]})[_0xe1a3('0x1c')](function(_0x24ea19){_0x355dad[_0xe1a3('0x18')]=_0x24ea19;if(_0xe9e92c[_0xe1a3('0x26')][_0xe1a3('0x4d')]){_0x4f9f18['include']=[{'all':!![]}];}return db[_0xe1a3('0x3c')][_0xe1a3('0x24')](_0x4f9f18);})['then'](function(_0x5119dc){_0x355dad['rows']=_0x5119dc;return _0x355dad;});}})[_0xe1a3('0x1c')](respondWithFilteredResult(_0x5c8d8a,_0x4f9f18))['catch'](handleError(_0x5c8d8a,null));};exports[_0xe1a3('0x4e')]=function(_0x16dc9a,_0x16a109){return db[_0xe1a3('0x2d')][_0xe1a3('0x36')]({'where':{'id':_0x16dc9a[_0xe1a3('0x2a')]['id']}})[_0xe1a3('0x1c')](handleEntityNotFound(_0x16a109,null))['then'](function(_0xd0ffec){if(_0xd0ffec){return _0xd0ffec['setTags'](_0x16dc9a[_0xe1a3('0x38')][_0xe1a3('0x3d')],_[_0xe1a3('0x3e')](_0x16dc9a[_0xe1a3('0x38')],[_0xe1a3('0x3d'),'id'])||{})[_0xe1a3('0x4f')](function(){return db[_0xe1a3('0x50')][_0xe1a3('0x24')]({'attributes':['id','name',_0xe1a3('0x51')],'where':{'id':_0x16dc9a[_0xe1a3('0x38')][_0xe1a3('0x3d')]}});})[_0xe1a3('0x1c')](function(_0x4ed258){socket['emit'](_0xe1a3('0x52'),{'id':Number(_0x16dc9a[_0xe1a3('0x2a')]['id']),'tags':_0x4ed258||[]});return{'id':Number(_0x16dc9a['params']['id']),'tags':_0x4ed258||[]};});}})['then'](respondWithResult(_0x16a109,null))[_0xe1a3('0x28')](handleError(_0x16a109,null));};exports[_0xe1a3('0x53')]=function(_0x548708,_0xc4a371){return db[_0xe1a3('0x2d')][_0xe1a3('0x36')]({'where':{'id':_0x548708[_0xe1a3('0x2a')]['id']}})[_0xe1a3('0x1c')](handleEntityNotFound(_0xc4a371,null))['then'](function(_0x283201){if(_0x283201){return _0x283201['removeTags'](_0x548708[_0xe1a3('0x26')][_0xe1a3('0x3d')]);}})[_0xe1a3('0x1c')](respondWithStatusCode(_0xc4a371,null))['catch'](handleError(_0xc4a371,null));};exports[_0xe1a3('0x54')]=function(_0x5ee086,_0x56f454){var _0x1f9d9c=moment()['unix']()[_0xe1a3('0x55')]();var _0x1c1298=path[_0xe1a3('0x56')](config['root'],'server',_0xe1a3('0x57'),_0xe1a3('0x58'));var _0x424f7a=path[_0xe1a3('0x56')](config['root'],_0xe1a3('0x59'),_0xe1a3('0x57'),_0xe1a3('0x5a'));var _0x3b0054=path[_0xe1a3('0x56')](_0x1c1298,_0x1f9d9c);var _0x2b3c54=util['format'](_0xe1a3('0x5b'),_0x5ee086[_0xe1a3('0x2a')]['id'],_0x1f9d9c);var _0x535da3=path[_0xe1a3('0x56')](_0x1c1298,_0x2b3c54);var _0x2fe04c=[];_0x2fe04c[_0xe1a3('0x5c')]({'model':db[_0xe1a3('0x5d')],'as':'Attachment','raw':!![]});var _0x74bfdd=[{'model':db['FaxMessage'],'as':_0xe1a3('0x5e'),'attributes':['id',_0xe1a3('0x38'),_0xe1a3('0x5f')],'include':_0x2fe04c}];return db['FaxInteraction'][_0xe1a3('0x36')]({'where':{'id':_0x5ee086[_0xe1a3('0x2a')]['id']},'include':_0x74bfdd})[_0xe1a3('0x1c')](handleEntityNotFound(_0x56f454,null))['then'](function(_0x5eb882){if(_0x5eb882&&_0x5eb882[_0xe1a3('0x5e')]){var _0x4cbbdc=_0x5eb882[_0xe1a3('0x60')]({'plain':!![]});fs[_0xe1a3('0x61')](_0x3b0054);for(var _0x23acb5=0x0;_0x23acb5<_0x4cbbdc[_0xe1a3('0x5e')][_0xe1a3('0x32')];_0x23acb5++){var _0x27e57f=_0x4cbbdc[_0xe1a3('0x5e')][_0x23acb5][_0xe1a3('0x5d')];if(_0x27e57f){var _0x40df55=path[_0xe1a3('0x56')](_0x424f7a,_0x27e57f['basename']);if(fs['existsSync'](_0x40df55)){fs[_0xe1a3('0x62')](_0x40df55)[_0xe1a3('0x63')](fs[_0xe1a3('0x64')](path[_0xe1a3('0x56')](_0x3b0054,_0x27e57f[_0xe1a3('0x65')])));}}}return BPromise['resolve']()[_0xe1a3('0x1c')](function(){return new BPromise(function(_0x2f2f56,_0x5c340d){zipdir(_0x3b0054,{'saveTo':_0x535da3},function(_0x50d427,_0x5d2573){if(_0x50d427)return _0x5c340d(_0x50d427);return _0x2f2f56(_0x5d2573);});})[_0xe1a3('0x1c')](function(){return new BPromise(function(_0x14cc3c,_0x26da51){rimraf(_0x3b0054,function(_0x4b6b5d){if(_0x4b6b5d)_0x26da51(_0x4b6b5d);return _0x14cc3c();});});})['then'](function(){return _0x56f454['download'](_0x535da3,_0x2b3c54,function(_0x14531e){if(_0x14531e){console[_0xe1a3('0x66')](_0xe1a3('0x67'),_0x14531e);}else{fs[_0xe1a3('0x68')](_0x535da3);}});});});}else{return _0x56f454['sendStatus'](0xc8);}})[_0xe1a3('0x28')](handleError(_0x56f454,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 44d9ee5..e54b054 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 _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 +var _0x197c=['FaxMessage','setMaxListeners','save','update','remove','setDataValue','Users','map','then','length','emit','catch','hook','events','../../mysqldb'];(function(_0x1dc708,_0x293d95){var _0x415967=function(_0x529795){while(--_0x529795){_0x1dc708['push'](_0x1dc708['shift']());}};_0x415967(++_0x293d95);}(_0x197c,0x67));var _0xc197=function(_0x6dfbaa,_0x31eede){_0x6dfbaa=_0x6dfbaa-0x0;var _0xfbe02=_0x197c[_0x6dfbaa];return _0xfbe02;};'use strict';var EventEmitter=require(_0xc197('0x0'));var FaxInteraction=require(_0xc197('0x1'))['db']['FaxInteraction'];var FaxMessage=require(_0xc197('0x1'))['db'][_0xc197('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xc197('0x3')](0x0);var events={'afterCreate':_0xc197('0x4'),'afterUpdate':_0xc197('0x5'),'afterDestroy':_0xc197('0x6')};function emitEvent(_0x5555f5){return function(_0xa0f29d,_0x476d03,_0x4b265b){_0xa0f29d['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x4e4221){_0xa0f29d[_0xc197('0x7')](_0xc197('0x8'),_0x4e4221[_0xc197('0x9')](function(_0x1bb64e){return{'id':_0x1bb64e['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0xa0f29d['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc197('0xa')](function(_0x5b5c6f){_0xa0f29d[_0xc197('0x7')]('unreadMessages',_0x5b5c6f[_0xc197('0xb')]);FaxInteractionEvents['emit'](_0x5555f5+':'+_0xa0f29d['id'],_0xa0f29d);FaxInteractionEvents[_0xc197('0xc')](_0x5555f5,_0xa0f29d);_0x4b265b(null);})[_0xc197('0xd')](_0x4b265b(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0xc197('0xe')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index f9845c7..8cfb0d4 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 _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 +var _0xe6c0=['request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','fax_interactions','changed','closedAt','util','../../config/logger','api','bluebird'];(function(_0x4c794a,_0x20b8aa){var _0x3006f6=function(_0x4a0b91){while(--_0x4a0b91){_0x4c794a['push'](_0x4c794a['shift']());}};_0x3006f6(++_0x20b8aa);}(_0xe6c0,0x88));var _0x0e6c=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xe6c0[_0x49ca18];return _0x145d54;};'use strict';var _=require('lodash');var util=require(_0x0e6c('0x0'));var logger=require(_0x0e6c('0x1'))(_0x0e6c('0x2'));var moment=require('moment');var BPromise=require(_0x0e6c('0x3'));var rp=require(_0x0e6c('0x4'));var fs=require('fs');var path=require(_0x0e6c('0x5'));var rimraf=require(_0x0e6c('0x6'));var config=require(_0x0e6c('0x7'));var attributes=require(_0x0e6c('0x8'));module[_0x0e6c('0x9')]=function(_0x11cfa0,_0x33988c){return _0x11cfa0[_0x0e6c('0xa')]('FaxInteraction',attributes,{'tableName':_0x0e6c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4f1f0b,_0x6d6428,_0x50e647){if(_0x4f1f0b[_0x0e6c('0xc')]('closed')){_0x4f1f0b[_0x0e6c('0xd')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x50e647(null,_0x4f1f0b);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 8bdc64a..57622ef 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 _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 +var _0xb0fb=['../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','register','then','info','FaxInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','FaxInteraction','update','options','where','attributes','limit','UpdateFaxInteraction','AddTagsToFaxInteraction','body','ids','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x271ace,_0x2b1999){var _0x48e6af=function(_0x166e5c){while(--_0x166e5c){_0x271ace['push'](_0x271ace['shift']());}};_0x48e6af(++_0x2b1999);}(_0xb0fb,0x127));var _0xbb0f=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0xb0fb[_0xd0b415];return _0x2bdf2c;};'use strict';var _=require(_0xbb0f('0x0'));var util=require(_0xbb0f('0x1'));var moment=require(_0xbb0f('0x2'));var BPromise=require(_0xbb0f('0x3'));var rs=require(_0xbb0f('0x4'));var fs=require('fs');var Redis=require(_0xbb0f('0x5'));var db=require(_0xbb0f('0x6'))['db'];var utils=require(_0xbb0f('0x7'));var logger=require(_0xbb0f('0x8'))('rpc');var config=require(_0xbb0f('0x9'));var jayson=require(_0xbb0f('0xa'));var client=jayson['client'][_0xbb0f('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xbb0f('0xc')],{'host':_0xbb0f('0xd'),'port':0x18eb});var socket=require(_0xbb0f('0xe'))(new Redis(config[_0xbb0f('0xc')]));require('./faxInteraction.socket')[_0xbb0f('0xf')](socket);function respondWithRpcPromise(_0x3575af,_0x19a244,_0x4fb270){return new BPromise(function(_0x451cdb,_0x22c2a8){return client['request'](_0x3575af,_0x4fb270)[_0xbb0f('0x10')](function(_0x39dcd1){logger[_0xbb0f('0x11')](_0xbb0f('0x12'),_0x19a244,'request\x20sent');logger[_0xbb0f('0x13')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x19a244,_0xbb0f('0x14'),JSON[_0xbb0f('0x15')](_0x39dcd1));if(_0x39dcd1[_0xbb0f('0x16')]){if(_0x39dcd1[_0xbb0f('0x16')][_0xbb0f('0x17')]===0x1f4){logger['error']('FaxInteraction,\x20%s,\x20%s',_0x19a244,_0x39dcd1[_0xbb0f('0x16')][_0xbb0f('0x18')]);return _0x22c2a8(_0x39dcd1[_0xbb0f('0x16')][_0xbb0f('0x18')]);}logger[_0xbb0f('0x16')]('FaxInteraction,\x20%s,\x20%s',_0x19a244,_0x39dcd1[_0xbb0f('0x16')]['message']);return _0x451cdb(_0x39dcd1[_0xbb0f('0x16')][_0xbb0f('0x18')]);}else{logger[_0xbb0f('0x11')](_0xbb0f('0x12'),_0x19a244,_0xbb0f('0x14'));_0x451cdb(_0x39dcd1[_0xbb0f('0x19')]['message']);}})[_0xbb0f('0x1a')](function(_0x5daa9b){logger[_0xbb0f('0x16')]('FaxInteraction,\x20%s,\x20%s',_0x19a244,_0x5daa9b);_0x22c2a8(_0x5daa9b);});});}exports['UpdateFaxInteraction']=function(_0x4c82ef){var _0x5b06c7=this;return new Promise(function(_0x1f7d5a,_0x2d63f5){return db[_0xbb0f('0x1b')][_0xbb0f('0x1c')](_0x4c82ef['body'],{'raw':_0x4c82ef[_0xbb0f('0x1d')]?_0x4c82ef['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c82ef[_0xbb0f('0x1d')]?_0x4c82ef[_0xbb0f('0x1d')][_0xbb0f('0x1e')]||null:null,'attributes':_0x4c82ef[_0xbb0f('0x1d')]?_0x4c82ef[_0xbb0f('0x1d')][_0xbb0f('0x1f')]||null:null,'limit':_0x4c82ef[_0xbb0f('0x1d')]?_0x4c82ef['options'][_0xbb0f('0x20')]||null:null})[_0xbb0f('0x10')](function(_0x5bd769){logger[_0xbb0f('0x11')](_0xbb0f('0x21'),_0x4c82ef);logger['debug'](_0xbb0f('0x21'),_0x4c82ef,JSON[_0xbb0f('0x15')](_0x5bd769));_0x1f7d5a(_0x5bd769);})[_0xbb0f('0x1a')](function(_0xb46090){logger[_0xbb0f('0x16')](_0xbb0f('0x21'),_0xb46090[_0xbb0f('0x18')],_0x4c82ef);_0x2d63f5(_0x5b06c7['error'](0x1f4,_0xb46090[_0xbb0f('0x18')]));});});};exports[_0xbb0f('0x22')]=function(_0x4ac16b){return new Promise(function(_0x4a5c0d,_0x2e62d5){return db[_0xbb0f('0x1b')]['find']({'where':_0x4ac16b[_0xbb0f('0x1d')]?_0x4ac16b[_0xbb0f('0x1d')]['where']||null:null})['then'](function(_0x42f128){if(_0x42f128){return _0x42f128['addTags'](_0x4ac16b[_0xbb0f('0x23')][_0xbb0f('0x24')],_['omit'](_0x4ac16b[_0xbb0f('0x23')],[_0xbb0f('0x24'),'id'])||{});}})['spread'](function(_0x554ba5){logger['info'](_0xbb0f('0x25'),_0x4ac16b);logger[_0xbb0f('0x13')](_0xbb0f('0x25'),_0x4ac16b,JSON[_0xbb0f('0x15')](_0x554ba5));_0x4a5c0d(_0x554ba5);})['catch'](function(_0x1866ac){logger['error']('AddTags',_0x1866ac[_0xbb0f('0x18')],_0x4ac16b);_0x2e62d5(_this[_0xbb0f('0x16')](0x1f4,_0x1866ac[_0xbb0f('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 8cffef5..7108730 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 _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 +var _0x234f=['update','register','length','faxInteraction:','./faxInteraction.events','remove'];(function(_0x1a5644,_0x5b573b){var _0x510d62=function(_0x158604){while(--_0x158604){_0x1a5644['push'](_0x1a5644['shift']());}};_0x510d62(++_0x5b573b);}(_0x234f,0xd6));var _0xf234=function(_0x526b60,_0x1c8e4a){_0x526b60=_0x526b60-0x0;var _0x27b60e=_0x234f[_0x526b60];return _0x27b60e;};'use strict';var FaxInteractionEvents=require(_0xf234('0x0'));var events=['save',_0xf234('0x1'),_0xf234('0x2')];function createListener(_0x525bf0,_0xdda5bf){return function(_0x4956a1){_0xdda5bf['emit'](_0x525bf0,_0x4956a1);};}function removeListener(_0x44cc01,_0x39cc2b){return function(){FaxInteractionEvents['removeListener'](_0x44cc01,_0x39cc2b);};}exports[_0xf234('0x3')]=function(_0x37341e){for(var _0x11131f=0x0,_0x23c403=events[_0xf234('0x4')];_0x11131f<_0x23c403;_0x11131f++){var _0x12f6eb=events[_0x11131f];var _0x4c7089=createListener(_0xf234('0x5')+_0x12f6eb,_0x37341e);FaxInteractionEvents['on'](_0x12f6eb,_0x4c7089);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index de6fffe..8e4f1b8 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 _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 +var _0x4119=['addMessage','/:id/tags','fax','addTags','put','tracked','update','delete','faxinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post'];(function(_0x2b9c45,_0x387d8e){var _0x2f96ce=function(_0xa6303){while(--_0xa6303){_0x2b9c45['push'](_0x2b9c45['shift']());}};_0x2f96ce(++_0x387d8e);}(_0x4119,0xfa));var _0x9411=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x4119[_0x4154a6];return _0x3b2786;};'use strict';var multer=require(_0x9411('0x0'));var util=require(_0x9411('0x1'));var path=require(_0x9411('0x2'));var timeout=require(_0x9411('0x3'));var express=require(_0x9411('0x4'));var router=express[_0x9411('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9411('0x6'));var interaction=require(_0x9411('0x7'));var config=require('../../config/environment');var controller=require(_0x9411('0x8'));router[_0x9411('0x9')]('/',auth[_0x9411('0xa')](),controller[_0x9411('0xb')]);router[_0x9411('0x9')](_0x9411('0xc'),auth['isAuthenticated'](),controller[_0x9411('0xd')]);router[_0x9411('0x9')](_0x9411('0xe'),auth['isAuthenticated'](),controller[_0x9411('0xf')]);router[_0x9411('0x9')](_0x9411('0x10'),auth[_0x9411('0xa')](),controller[_0x9411('0x11')]);router[_0x9411('0x9')](_0x9411('0x12'),auth['isAuthenticated'](),controller[_0x9411('0x13')]);router['post']('/',auth[_0x9411('0xa')](),controller[_0x9411('0x14')]);router[_0x9411('0x15')]('/:id/messages',auth[_0x9411('0xa')](),controller[_0x9411('0x16')]);router[_0x9411('0x15')](_0x9411('0x17'),auth[_0x9411('0xa')](),interaction['tracked'](_0x9411('0x18'),'faxinteraction:addtags'),controller[_0x9411('0x19')]);router[_0x9411('0x1a')](_0x9411('0xe'),auth[_0x9411('0xa')](),interaction[_0x9411('0x1b')](_0x9411('0x18'),'faxinteraction:update'),controller[_0x9411('0x1c')]);router[_0x9411('0x1d')](_0x9411('0xe'),auth[_0x9411('0xa')](),interaction[_0x9411('0x1b')]('fax',_0x9411('0x1e')),controller[_0x9411('0x1f')]);router[_0x9411('0x1d')](_0x9411('0x17'),auth[_0x9411('0xa')](),controller[_0x9411('0x20')]);module[_0x9411('0x21')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 6e22ea8..eb3ba2d 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 _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 +var _0xa631=['medium','ENUM','DATE','exports','TEXT'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0xa631,0xe4));var _0x1a63=function(_0x2d8f44,_0x2250b0){_0x2d8f44=_0x2d8f44-0x0;var _0x46d56c=_0xa631[_0x2d8f44];return _0x46d56c;};'use strict';var Sequelize=require('sequelize');module[_0x1a63('0x0')]={'body':{'type':Sequelize[_0x1a63('0x1')](_0x1a63('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x1a63('0x3')]('in','out'),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x1a63('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0x1a63('0x4')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index e8be35b..856ba31 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 _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 +var _0xf0a1=['Content-Range','reject','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','FaxMessage','includeAll','findAll','rows','show','params','keys','update','body','find','destroy','describe','fax-interactions','fax','read','readAt','format','UserId','agent','FaxInteraction','FaxInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','get','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','stringify','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','SELECT','User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','role','RejectMessage','ContactId','Sequelize','contact','rejectmessage','create','CmContact','findOne','AttachmentId','SendFax','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','server','files','attachments','Attachment','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','http','request','then','FaxMessage,\x20%s,\x20%s','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set'];(function(_0x468a77,_0x1382be){var _0x2d1c33=function(_0x2f2e83){while(--_0x2f2e83){_0x468a77['push'](_0x468a77['shift']());}};_0x2d1c33(++_0x1382be);}(_0xf0a1,0xe9));var _0x1f0a=function(_0x55450a,_0x23e7e5){_0x55450a=_0x55450a-0x0;var _0x4b8f9e=_0xf0a1[_0x55450a];return _0x4b8f9e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1f0a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1f0a('0x1'));var rp=require(_0x1f0a('0x2'));var moment=require('moment');var BPromise=require(_0x1f0a('0x3'));var Mustache=require(_0x1f0a('0x4'));var util=require(_0x1f0a('0x5'));var path=require('path');var sox=require(_0x1f0a('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1f0a('0x7'));var _=require(_0x1f0a('0x8'));var squel=require(_0x1f0a('0x9'));var crypto=require(_0x1f0a('0xa'));var jsforce=require(_0x1f0a('0xb'));var deskjs=require(_0x1f0a('0xc'));var toCsv=require(_0x1f0a('0xd'));var querystring=require(_0x1f0a('0xe'));var Papa=require('papaparse');var Redis=require(_0x1f0a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x1f0a('0x10'));var as=require(_0x1f0a('0x11'));var hardwareService=require(_0x1f0a('0x12'));var logger=require(_0x1f0a('0x13'))(_0x1f0a('0x14'));var utils=require(_0x1f0a('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x1f0a('0x16')]=_[_0x1f0a('0x17')](config[_0x1f0a('0x16')],{'host':_0x1f0a('0x18'),'port':0x18eb});var socket=require(_0x1f0a('0x19'))(new Redis(config[_0x1f0a('0x16')]));require('./faxMessage.socket')[_0x1f0a('0x1a')](socket);var jayson=require(_0x1f0a('0x1b'));var client=jayson['client'][_0x1f0a('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0x1f0a('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x13c21b,_0x4586ab,_0x153396,_0xe5a6ca){return new BPromise(function(_0x267dc7,_0x1e372f){var _0x54554a=_0xe5a6ca||client;return _0x54554a[_0x1f0a('0x1d')](_0x13c21b,_0x153396)[_0x1f0a('0x1e')](function(_0x3e4afa){logger['info'](_0x1f0a('0x1f'),_0x4586ab,'request\x20sent');logger['debug'](_0x1f0a('0x20'),_0x4586ab,_0x1f0a('0x21'),JSON['stringify'](_0x3e4afa));if(_0x3e4afa['error']){if(_0x3e4afa[_0x1f0a('0x22')][_0x1f0a('0x23')]===0x1f4){logger[_0x1f0a('0x22')](_0x1f0a('0x1f'),_0x4586ab,_0x3e4afa[_0x1f0a('0x22')][_0x1f0a('0x24')]);return _0x1e372f(_0x3e4afa['error']['message']);}logger[_0x1f0a('0x22')](_0x1f0a('0x1f'),_0x4586ab,_0x3e4afa[_0x1f0a('0x22')]['message']);return _0x267dc7(_0x3e4afa[_0x1f0a('0x22')][_0x1f0a('0x24')]);}else{logger[_0x1f0a('0x25')]('FaxMessage,\x20%s,\x20%s',_0x4586ab,_0x1f0a('0x21'));_0x267dc7(_0x3e4afa[_0x1f0a('0x26')]['message']);}})[_0x1f0a('0x27')](function(_0x183cbb){logger[_0x1f0a('0x22')](_0x1f0a('0x1f'),_0x4586ab,_0x183cbb);_0x1e372f(_0x183cbb);});});}function respondWithStatusCode(_0x490ce4,_0x45d824){_0x45d824=_0x45d824||0xcc;return function(_0x587976){if(_0x587976){return _0x490ce4[_0x1f0a('0x28')](_0x45d824);}return _0x490ce4[_0x1f0a('0x29')](_0x45d824)[_0x1f0a('0x2a')]();};}function respondWithResult(_0x14a9e3,_0x3c75ba){_0x3c75ba=_0x3c75ba||0xc8;return function(_0x567395){if(_0x567395){return _0x14a9e3[_0x1f0a('0x29')](_0x3c75ba)[_0x1f0a('0x2b')](_0x567395);}};}function respondWithFilteredResult(_0x46f9d5,_0x2c6b0d){return function(_0xac2939){if(_0xac2939){var _0x3bef79=typeof _0x2c6b0d[_0x1f0a('0x2c')]===_0x1f0a('0x2d')&&typeof _0x2c6b0d[_0x1f0a('0x2e')]===_0x1f0a('0x2d');var _0x59b640=_0xac2939[_0x1f0a('0x2f')];var _0x518969=_0x3bef79?0x0:_0x2c6b0d[_0x1f0a('0x2c')];var _0x9a193a=_0x3bef79?_0xac2939[_0x1f0a('0x2f')]:_0x2c6b0d['offset']+_0x2c6b0d[_0x1f0a('0x2e')];var _0x1ed261;if(_0x9a193a>=_0x59b640){_0x9a193a=_0x59b640;_0x1ed261=0xc8;}else{_0x1ed261=0xce;}_0x46f9d5[_0x1f0a('0x29')](_0x1ed261);return _0x46f9d5[_0x1f0a('0x30')](_0x1f0a('0x31'),_0x518969+'-'+_0x9a193a+'/'+_0x59b640)[_0x1f0a('0x2b')](_0xac2939);}return null;};}function patchUpdates(_0x24d824){return function(_0x1b6762){try{jsonpatch['apply'](_0x1b6762,_0x24d824,!![]);}catch(_0x2a8467){return BPromise[_0x1f0a('0x32')](_0x2a8467);}return _0x1b6762['save']();};}function saveUpdates(_0x3ae0db,_0x207c0a){return function(_0x1baefd){if(_0x1baefd){return _0x1baefd['update'](_0x3ae0db)[_0x1f0a('0x1e')](function(_0x5c158a){return _0x5c158a;});}return null;};}function removeEntity(_0x4e8ca5,_0x3f65fe){return function(_0x106580){if(_0x106580){return _0x106580['destroy']()[_0x1f0a('0x1e')](function(){_0x4e8ca5[_0x1f0a('0x29')](0xcc)[_0x1f0a('0x2a')]();});}};}function handleEntityNotFound(_0x8dddef,_0x56636a){return function(_0xf87755){if(!_0xf87755){_0x8dddef['sendStatus'](0x194);}return _0xf87755;};}function handleError(_0x26fbc4,_0x9f1c90){_0x9f1c90=_0x9f1c90||0x1f4;return function(_0x1852aa){logger[_0x1f0a('0x22')](_0x1852aa[_0x1f0a('0x33')]);if(_0x1852aa[_0x1f0a('0x34')]){delete _0x1852aa[_0x1f0a('0x34')];}_0x26fbc4[_0x1f0a('0x29')](_0x9f1c90)[_0x1f0a('0x35')](_0x1852aa);};}exports[_0x1f0a('0x36')]=function(_0x4a8e76,_0x40f8ac){var _0xf1945e={},_0x581b84={},_0x42bcc3={'count':0x0,'rows':[]};var _0x32f5c0=_[_0x1f0a('0x37')](db['FaxMessage'][_0x1f0a('0x38')],function(_0x2f8e41){return{'name':_0x2f8e41[_0x1f0a('0x39')],'type':_0x2f8e41[_0x1f0a('0x3a')][_0x1f0a('0x3b')]};});_0x581b84[_0x1f0a('0x3c')]=_['map'](_0x32f5c0,_0x1f0a('0x34'));_0x581b84[_0x1f0a('0x3d')]=_['keys'](_0x4a8e76['query']);_0x581b84[_0x1f0a('0x3e')]=_['intersection'](_0x581b84[_0x1f0a('0x3c')],_0x581b84[_0x1f0a('0x3d')]);_0xf1945e[_0x1f0a('0x3f')]=_[_0x1f0a('0x40')](_0x581b84[_0x1f0a('0x3c')],qs[_0x1f0a('0x41')](_0x4a8e76[_0x1f0a('0x3d')][_0x1f0a('0x41')]));_0xf1945e[_0x1f0a('0x3f')]=_0xf1945e[_0x1f0a('0x3f')][_0x1f0a('0x42')]?_0xf1945e[_0x1f0a('0x3f')]:_0x581b84[_0x1f0a('0x3c')];if(!_0x4a8e76[_0x1f0a('0x3d')]['hasOwnProperty']('nolimit')){_0xf1945e['limit']=qs[_0x1f0a('0x2e')](_0x4a8e76[_0x1f0a('0x3d')][_0x1f0a('0x2e')]);_0xf1945e['offset']=qs['offset'](_0x4a8e76['query']['offset']);}_0xf1945e[_0x1f0a('0x43')]=qs[_0x1f0a('0x44')](_0x4a8e76[_0x1f0a('0x3d')][_0x1f0a('0x44')]);_0xf1945e[_0x1f0a('0x45')]=qs['filters'](_[_0x1f0a('0x46')](_0x4a8e76[_0x1f0a('0x3d')],_0x581b84[_0x1f0a('0x3e')]),_0x32f5c0);if(_0x4a8e76[_0x1f0a('0x3d')][_0x1f0a('0x47')]){_0xf1945e[_0x1f0a('0x45')]=_[_0x1f0a('0x48')](_0xf1945e['where'],{'$or':_[_0x1f0a('0x37')](_0x32f5c0,function(_0x38c638){if(_0x38c638[_0x1f0a('0x3a')]!==_0x1f0a('0x49')){var _0x8f099a={};_0x8f099a[_0x38c638[_0x1f0a('0x34')]]={'$like':'%'+_0x4a8e76[_0x1f0a('0x3d')][_0x1f0a('0x47')]+'%'};return _0x8f099a;}})});}_0xf1945e=_[_0x1f0a('0x48')]({},_0xf1945e,_0x4a8e76[_0x1f0a('0x4a')]);var _0x570285={'where':_0xf1945e[_0x1f0a('0x45')]};return db[_0x1f0a('0x4b')][_0x1f0a('0x2f')](_0x570285)[_0x1f0a('0x1e')](function(_0x1bec6e){_0x42bcc3[_0x1f0a('0x2f')]=_0x1bec6e;if(_0x4a8e76['query'][_0x1f0a('0x4c')]){_0xf1945e['include']=[{'all':!![]}];}return db[_0x1f0a('0x4b')][_0x1f0a('0x4d')](_0xf1945e);})[_0x1f0a('0x1e')](function(_0x198533){_0x42bcc3[_0x1f0a('0x4e')]=_0x198533;return _0x42bcc3;})['then'](respondWithFilteredResult(_0x40f8ac,_0xf1945e))[_0x1f0a('0x27')](handleError(_0x40f8ac,null));};exports[_0x1f0a('0x4f')]=function(_0x3e1ce9,_0x13393a){var _0x4b9181={'raw':!![],'where':{'id':_0x3e1ce9[_0x1f0a('0x50')]['id']}},_0x273290={};_0x273290[_0x1f0a('0x3c')]=_[_0x1f0a('0x51')](db['FaxMessage'][_0x1f0a('0x38')]);_0x273290['query']=_[_0x1f0a('0x51')](_0x3e1ce9['query']);_0x273290[_0x1f0a('0x3e')]=_[_0x1f0a('0x40')](_0x273290[_0x1f0a('0x3c')],_0x273290['query']);_0x4b9181[_0x1f0a('0x3f')]=_['intersection'](_0x273290['model'],qs[_0x1f0a('0x41')](_0x3e1ce9['query'][_0x1f0a('0x41')]));_0x4b9181[_0x1f0a('0x3f')]=_0x4b9181[_0x1f0a('0x3f')][_0x1f0a('0x42')]?_0x4b9181['attributes']:_0x273290[_0x1f0a('0x3c')];if(_0x3e1ce9[_0x1f0a('0x3d')][_0x1f0a('0x4c')]){_0x4b9181['include']=[{'all':!![]}];}_0x4b9181=_[_0x1f0a('0x48')]({},_0x4b9181,_0x3e1ce9['options']);return db['FaxMessage']['find'](_0x4b9181)[_0x1f0a('0x1e')](handleEntityNotFound(_0x13393a,null))[_0x1f0a('0x1e')](respondWithResult(_0x13393a,null))[_0x1f0a('0x27')](handleError(_0x13393a,null));};exports[_0x1f0a('0x52')]=function(_0x41ff82,_0x590f25){if(_0x41ff82[_0x1f0a('0x53')]['id']){delete _0x41ff82[_0x1f0a('0x53')]['id'];}return db[_0x1f0a('0x4b')][_0x1f0a('0x54')]({'where':{'id':_0x41ff82[_0x1f0a('0x50')]['id']}})[_0x1f0a('0x1e')](handleEntityNotFound(_0x590f25,null))[_0x1f0a('0x1e')](saveUpdates(_0x41ff82[_0x1f0a('0x53')],null))[_0x1f0a('0x1e')](respondWithResult(_0x590f25,null))[_0x1f0a('0x27')](handleError(_0x590f25,null));};exports[_0x1f0a('0x55')]=function(_0xa52f47,_0x2c4a08){return db[_0x1f0a('0x4b')][_0x1f0a('0x54')]({'where':{'id':_0xa52f47[_0x1f0a('0x50')]['id']}})[_0x1f0a('0x1e')](handleEntityNotFound(_0x2c4a08,null))[_0x1f0a('0x1e')](removeEntity(_0x2c4a08,null))[_0x1f0a('0x27')](handleError(_0x2c4a08,null));};exports[_0x1f0a('0x56')]=function(_0xf759b1,_0x4a98f0){return db['FaxMessage'][_0x1f0a('0x56')]()['then'](respondWithResult(_0x4a98f0,null))[_0x1f0a('0x27')](handleError(_0x4a98f0,null));};var interaction_log=require(_0x1f0a('0x13'))(_0x1f0a('0x57'));exports['accept']=function(_0x313729,_0x5be443,_0x3451fd){var _0x16e724={'agent':{},'channel':_0x1f0a('0x58')};if(_0x313729['body']['id']){delete _0x313729[_0x1f0a('0x53')]['id'];}_0x313729[_0x1f0a('0x53')][_0x1f0a('0x59')]=!![];_0x313729[_0x1f0a('0x53')][_0x1f0a('0x5a')]=moment()[_0x1f0a('0x5b')]('YYYY-MM-DD\x20HH:mm:ss');_0x313729[_0x1f0a('0x53')][_0x1f0a('0x5c')]=_0x313729[_0x1f0a('0x53')][_0x1f0a('0x5c')]||_0x313729['user']['id'];_0x16e724[_0x1f0a('0x5d')]['id']=_0x313729[_0x1f0a('0x53')][_0x1f0a('0x5c')];return db[_0x1f0a('0x4b')]['find']({'where':{'id':_0x313729[_0x1f0a('0x50')]['id'],'UserId':null}})[_0x1f0a('0x1e')](handleEntityNotFound(_0x5be443,null))[_0x1f0a('0x1e')](saveUpdates(_0x313729[_0x1f0a('0x53')],null))[_0x1f0a('0x1e')](function(_0x2b81b3){if(_0x2b81b3){_0x16e724['message']=_0x2b81b3['get']({'plain':!![]});return db[_0x1f0a('0x5e')][_0x1f0a('0x54')]({'where':{'id':_0x2b81b3[_0x1f0a('0x5f')]}});}return null;})['then'](handleEntityNotFound(_0x5be443,null))[_0x1f0a('0x1e')](function(_0x2c45e0){if(_0x2c45e0){return _0x2c45e0[_0x1f0a('0x52')]({'UserId':_0x313729[_0x1f0a('0x53')][_0x1f0a('0x5c')],'read1stAt':_[_0x1f0a('0x60')](_0x2c45e0[_0x1f0a('0x61')])?moment()[_0x1f0a('0x5b')](_0x1f0a('0x62')):undefined});}return null;})['then'](function(_0x472216){if(_0x472216){_0x16e724[_0x1f0a('0x63')]=_0x472216[_0x1f0a('0x64')]({'plain':!![]});interaction_log[_0x1f0a('0x25')](_0x1f0a('0x65'),_0x313729['user']['id'],_0x313729['user'][_0x1f0a('0x34')],_0x313729[_0x1f0a('0x66')]['role'],_0x16e724[_0x1f0a('0x63')]['id'],_0x313729[_0x1f0a('0x53')]?JSON[_0x1f0a('0x67')](_0x313729[_0x1f0a('0x53')]):_0x1f0a('0x68'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x16e724);}return null;})[_0x1f0a('0x1e')](function(_0x55f9a9){var _0x5646bd=_0x1f0a('0x69')+_0x55f9a9[_0x1f0a('0x24')]['ContactId'];return db[_0x1f0a('0x6a')][_0x1f0a('0x3d')](_0x5646bd,{'type':db['Sequelize'][_0x1f0a('0x6b')][_0x1f0a('0x6c')],'raw':!![]})[_0x1f0a('0x1e')](function(_0x17a6a1){return _0x17a6a1;});})[_0x1f0a('0x1e')](function(_0x3b7850){if(_0x3b7850){_0x16e724[_0x1f0a('0x24')]['contact']=_0x3b7850[0x0];if(!_0x313729[_0x1f0a('0x53')]['UserId'])return;return db[_0x1f0a('0x6d')][_0x1f0a('0x54')]({'where':{'id':_0x313729['body'][_0x1f0a('0x5c')],'role':_0x1f0a('0x5d')},'attributes':['id','name',_0x1f0a('0x6e'),_0x1f0a('0x6f'),_0x1f0a('0x70')],'raw':!![]});}return null;})[_0x1f0a('0x1e')](function(_0x3f97d9){if(!_0x3f97d9)return null;_0x16e724[_0x1f0a('0x24')]['agent']=_0x3f97d9;return _0x16e724;})[_0x1f0a('0x1e')](function(_0x250ce6){if(_0x250ce6){if(_0x313729[_0x1f0a('0x53')]['manual']){_0x16e724[_0x1f0a('0x24')][_0x1f0a('0x71')]=util[_0x1f0a('0x5b')](_0x1f0a('0x72'),_0x313729[_0x1f0a('0x66')][_0x1f0a('0x34')]);_0x16e724['message']['channel']=_0x16e724[_0x1f0a('0x73')];_0x16e724[_0x1f0a('0x24')][_0x1f0a('0x74')]=_0x16e724[_0x1f0a('0x73')];_0x16e724['message'][_0x1f0a('0x75')]=_0x1f0a('0x76');return respondWithRpcPromise(_0x1f0a('0x77'),'EventManager',{'event':_0x1f0a('0x78'),'message':_0x16e724[_0x1f0a('0x24')]},client9002)['then'](function(){return _0x16e724;});}return _0x16e724;}return null;})[_0x1f0a('0x1e')](respondWithResult(_0x5be443,null))['catch'](handleError(_0x5be443,null));};var interaction_log=require(_0x1f0a('0x13'))(_0x1f0a('0x57'));exports[_0x1f0a('0x32')]=function(_0x1b081e,_0xb5001d,_0x5a189f){var _0x243706={'agent':{},'channel':_0x1f0a('0x58')};if(_0x1b081e[_0x1f0a('0x53')]['id']){delete _0x1b081e[_0x1f0a('0x53')]['id'];}_0x1b081e['body'][_0x1f0a('0x5c')]=_0x1b081e['body'][_0x1f0a('0x5c')]||_0x1b081e[_0x1f0a('0x66')]['id'];_0x243706['agent']['id']=_0x1b081e[_0x1f0a('0x53')][_0x1f0a('0x5c')];return db[_0x1f0a('0x4b')][_0x1f0a('0x54')]({'where':{'id':_0x1b081e['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0xb5001d,null))[_0x1f0a('0x1e')](function(_0x4f6365){if(_0x4f6365){_0x243706[_0x1f0a('0x24')]=_0x4f6365[_0x1f0a('0x64')]({'plain':!![]});return db[_0x1f0a('0x5e')][_0x1f0a('0x54')]({'where':{'id':_0x4f6365['FaxInteractionId']}});}return null;})[_0x1f0a('0x1e')](handleEntityNotFound(_0xb5001d,null))[_0x1f0a('0x1e')](function(_0x1999c1){if(_0x1999c1){_0x243706[_0x1f0a('0x63')]=_0x1999c1[_0x1f0a('0x64')]({'plain':!![]});interaction_log[_0x1f0a('0x25')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1b081e[_0x1f0a('0x66')]['id'],_0x1b081e[_0x1f0a('0x66')][_0x1f0a('0x34')],_0x1b081e[_0x1f0a('0x66')][_0x1f0a('0x79')],_0x243706[_0x1f0a('0x63')]['id'],_0x1b081e['body']?JSON[_0x1f0a('0x67')](_0x1b081e['body']):_0x1f0a('0x68'));return respondWithRpcPromise(_0x1f0a('0x7a'),'rejectMessage',_0x243706);}return null;})['then'](function(_0x544c03){var _0x119d78=_0x1f0a('0x69')+_0x544c03[_0x1f0a('0x24')][_0x1f0a('0x7b')];return db[_0x1f0a('0x6a')]['query'](_0x119d78,{'type':db[_0x1f0a('0x7c')][_0x1f0a('0x6b')]['SELECT'],'raw':!![]})[_0x1f0a('0x1e')](function(_0x3c9e75){return _0x3c9e75;});})[_0x1f0a('0x1e')](function(_0x23ad6c){if(_0x23ad6c){_0x243706[_0x1f0a('0x24')][_0x1f0a('0x7d')]=_0x23ad6c[0x0];if(!_0x1b081e[_0x1f0a('0x53')][_0x1f0a('0x5c')])return;return db[_0x1f0a('0x6d')][_0x1f0a('0x54')]({'where':{'id':_0x1b081e[_0x1f0a('0x53')][_0x1f0a('0x5c')],'role':_0x1f0a('0x5d')},'attributes':['id',_0x1f0a('0x34'),_0x1f0a('0x6e'),_0x1f0a('0x6f'),_0x1f0a('0x70')],'raw':!![]});}return null;})['then'](function(_0x50b2a3){if(!_0x50b2a3)return null;_0x243706[_0x1f0a('0x24')][_0x1f0a('0x5d')]=_0x50b2a3;return _0x243706;})[_0x1f0a('0x1e')](function(_0x4947d8){if(_0x4947d8){_0x4947d8[_0x1f0a('0x24')][_0x1f0a('0x71')]=util[_0x1f0a('0x5b')]('SIP/%s',_0x1b081e[_0x1f0a('0x66')]['name']);_0x4947d8[_0x1f0a('0x24')][_0x1f0a('0x73')]=_0x243706[_0x1f0a('0x73')];_0x4947d8[_0x1f0a('0x24')]['motionChannel']=_0x243706[_0x1f0a('0x73')];_0x4947d8[_0x1f0a('0x24')][_0x1f0a('0x75')]=_0x1f0a('0x32');respondWithRpcPromise('EventManager',_0x1f0a('0x77'),{'event':_0x1f0a('0x7e'),'message':_0x4947d8[_0x1f0a('0x24')]},client9002);return _0x243706;}return null;})['then'](respondWithResult(_0xb5001d,null))['catch'](handleError(_0xb5001d,null));};exports[_0x1f0a('0x7f')]=function(_0x56e9ed,_0x3bd4ed){var _0x12bd07;return db['FaxMessage']['create'](_0x56e9ed[_0x1f0a('0x53')],{})['then'](function(_0x2308d1){_0x12bd07=_0x2308d1;return db[_0x1f0a('0x80')]['findOne']({'where':{'id':_0x12bd07[_0x1f0a('0x7b')]}});})['then'](function(_0x1eeb6b){if(_[_0x1f0a('0x60')](_0x1eeb6b)){return;}else{_0x12bd07[_0x1f0a('0x58')]=_0x1eeb6b['fax'];return db['Attachment'][_0x1f0a('0x81')]({'where':{'id':_0x12bd07[_0x1f0a('0x82')]}});}})[_0x1f0a('0x1e')](function(_0x431466){return respondWithRpcPromise(_0x1f0a('0x83'),_0x1f0a('0x83'),{'FaxAccountId':_['isNil'](_0x56e9ed[_0x1f0a('0x53')])?undefined:_0x56e9ed['body']['FaxAccountId'],'path':_[_0x1f0a('0x60')](_0x431466)?undefined:util['format'](_0x1f0a('0x84'),_0x431466[_0x1f0a('0x85')]),'fax':_[_0x1f0a('0x60')](_0x12bd07[_0x1f0a('0x58')])?undefined:_0x12bd07[_0x1f0a('0x58')],'AttachmentId':_0x12bd07['AttachmentId']},client9002);})[_0x1f0a('0x1e')](respondWithResult(_0x3bd4ed,0xc9))[_0x1f0a('0x27')](handleError(_0x3bd4ed,null));};exports[_0x1f0a('0x86')]=function(_0x4badc3,_0x3b9c52){var _0xd79d8b=path[_0x1f0a('0x87')](config[_0x1f0a('0x88')],_0x1f0a('0x89'),_0x1f0a('0x8a'),_0x1f0a('0x8b'));return db[_0x1f0a('0x4b')][_0x1f0a('0x54')]({'where':{'id':_0x4badc3['params']['id']},'include':[{'model':db['Attachment'],'as':'Attachment'}]})['then'](handleEntityNotFound(_0x3b9c52,null))[_0x1f0a('0x1e')](function(_0x2b749a){if(_0x2b749a){return _0x3b9c52['download'](path[_0x1f0a('0x87')](_0xd79d8b,_0x2b749a[_0x1f0a('0x8c')][_0x1f0a('0x85')]));}})['catch'](handleError(_0x3b9c52,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 58da651..f6601fc 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 _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 +var _0x9bdb=['update','remove','emit','hook','events','../../mysqldb','FaxMessage','setMaxListeners'];(function(_0x23a79e,_0x235f89){var _0x3dab57=function(_0x346cf4){while(--_0x346cf4){_0x23a79e['push'](_0x23a79e['shift']());}};_0x3dab57(++_0x235f89);}(_0x9bdb,0x13c));var _0xb9bd=function(_0x3057ca,_0x41adf8){_0x3057ca=_0x3057ca-0x0;var _0x34814d=_0x9bdb[_0x3057ca];return _0x34814d;};'use strict';var EventEmitter=require(_0xb9bd('0x0'));var FaxMessage=require(_0xb9bd('0x1'))['db'][_0xb9bd('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xb9bd('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb9bd('0x4'),'afterDestroy':_0xb9bd('0x5')};function emitEvent(_0x3f1592){return function(_0x461287,_0x8ab0b8,_0x176328){FaxMessageEvents[_0xb9bd('0x6')](_0x3f1592+':'+_0x461287['id'],_0x461287);FaxMessageEvents[_0xb9bd('0x6')](_0x3f1592,_0x461287);_0x176328(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0xb9bd('0x7')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index df31c24..f5b25d0 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 _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 +var _0x432d=['then','createdAt','error','utf8mb4','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','./faxMessage.attributes','exports','define','fax_messages','fti_fax_messages','FULLTEXT','models','toLowerCase','direction','out','FaxInteraction','FaxInteractionId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x432d,0x1d0));var _0xd432=function(_0x13e8ac,_0x25c0c0){_0x13e8ac=_0x13e8ac-0x0;var _0xc77ea6=_0x432d[_0x13e8ac];return _0xc77ea6;};'use strict';var _=require(_0xd432('0x0'));var util=require(_0xd432('0x1'));var logger=require(_0xd432('0x2'))('api');var moment=require(_0xd432('0x3'));var BPromise=require(_0xd432('0x4'));var rp=require(_0xd432('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd432('0x6'));var config=require('../../config/environment');var attributes=require(_0xd432('0x7'));module[_0xd432('0x8')]=function(_0x3c0316,_0x80fea6){return _0x3c0316[_0xd432('0x9')]('FaxMessage',attributes,{'tableName':_0xd432('0xa'),'paranoid':![],'indexes':[{'name':_0xd432('0xb'),'fields':['body'],'type':_0xd432('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x169163,_0x2a13a5,_0x3102e0){var _0x403be9=_0x3c0316[_0xd432('0xd')];var _0x38ffa4=_0x169163['get']({'plain':!![]});if(_0x38ffa4['direction'][_0xd432('0xe')]()==='in'||_0x38ffa4[_0xd432('0xf')]['toLowerCase']()===_0xd432('0x10')&&!_0x38ffa4['secret']&&!_['isNil'](_0x38ffa4['UserId'])){_0x403be9[_0xd432('0x11')]['findOne']({'where':{'id':_0x38ffa4[_0xd432('0x12')]}})[_0xd432('0x13')](function(_0x9f7cfd){if(_0x9f7cfd){_0x9f7cfd['update']({'lastMsgAt':_0x38ffa4[_0xd432('0x14')],'lastMsgDirection':_0x38ffa4['direction'][_0xd432('0xe')]()});}})['catch'](function(_0x36f5c9){console[_0xd432('0x15')](_0x36f5c9);});}_0x3102e0();}},'charset':_0xd432('0x16'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index fd55a99..4072519 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 _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 +var _0x2d17=['create','catch','UpdateFaxMessage','FaxMessage','body','options','where','attributes','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateFaxMessage'];(function(_0x2e66f1,_0xff22e4){var _0x5d76bc=function(_0x24de2b){while(--_0x24de2b){_0x2e66f1['push'](_0x2e66f1['shift']());}};_0x5d76bc(++_0xff22e4);}(_0x2d17,0x17e));var _0x72d1=function(_0x544002,_0x17b025){_0x544002=_0x544002-0x0;var _0x3a9e4a=_0x2d17[_0x544002];return _0x3a9e4a;};'use strict';var _=require(_0x72d1('0x0'));var util=require(_0x72d1('0x1'));var moment=require('moment');var BPromise=require(_0x72d1('0x2'));var rs=require(_0x72d1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x72d1('0x4'))['db'];var utils=require(_0x72d1('0x5'));var logger=require('../../config/logger')(_0x72d1('0x6'));var config=require('../../config/environment');var jayson=require(_0x72d1('0x7'));var client=jayson['client'][_0x72d1('0x8')]({'port':0x232a});config[_0x72d1('0x9')]=_['defaults'](config[_0x72d1('0x9')],{'host':_0x72d1('0xa'),'port':0x18eb});var socket=require(_0x72d1('0xb'))(new Redis(config['redis']));require(_0x72d1('0xc'))[_0x72d1('0xd')](socket);function respondWithRpcPromise(_0x283775,_0x593c91,_0x1d7520){return new BPromise(function(_0x3a35c6,_0x45eb4a){return client[_0x72d1('0xe')](_0x283775,_0x1d7520)[_0x72d1('0xf')](function(_0x3916f2){logger[_0x72d1('0x10')](_0x72d1('0x11'),_0x593c91,_0x72d1('0x12'));logger[_0x72d1('0x13')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x593c91,_0x72d1('0x12'),JSON[_0x72d1('0x14')](_0x3916f2));if(_0x3916f2[_0x72d1('0x15')]){if(_0x3916f2[_0x72d1('0x15')][_0x72d1('0x16')]===0x1f4){logger[_0x72d1('0x15')](_0x72d1('0x11'),_0x593c91,_0x3916f2[_0x72d1('0x15')][_0x72d1('0x17')]);return _0x45eb4a(_0x3916f2[_0x72d1('0x15')][_0x72d1('0x17')]);}logger[_0x72d1('0x15')](_0x72d1('0x11'),_0x593c91,_0x3916f2['error'][_0x72d1('0x17')]);return _0x3a35c6(_0x3916f2['error'][_0x72d1('0x17')]);}else{logger[_0x72d1('0x10')]('FaxMessage,\x20%s,\x20%s',_0x593c91,_0x72d1('0x12'));_0x3a35c6(_0x3916f2[_0x72d1('0x18')][_0x72d1('0x17')]);}})['catch'](function(_0x4925f6){logger[_0x72d1('0x15')](_0x72d1('0x11'),_0x593c91,_0x4925f6);_0x45eb4a(_0x4925f6);});});}exports[_0x72d1('0x19')]=function(_0x1865c1){var _0x8d6890=this;return new Promise(function(_0x2253fd,_0x1e2411){return db['FaxMessage'][_0x72d1('0x1a')](_0x1865c1['body'],{'raw':_0x1865c1['options']?_0x1865c1['options']['raw']===undefined?!![]:![]:!![]})[_0x72d1('0xf')](function(_0x374602){logger['info'](_0x72d1('0x19'),_0x1865c1);logger[_0x72d1('0x13')](_0x72d1('0x19'),_0x1865c1,JSON[_0x72d1('0x14')](_0x374602));_0x2253fd(_0x374602);})[_0x72d1('0x1b')](function(_0x4e6acd){logger['error'](_0x72d1('0x19'),_0x4e6acd[_0x72d1('0x17')],_0x1865c1);_0x1e2411(_0x8d6890[_0x72d1('0x15')](0x1f4,_0x4e6acd[_0x72d1('0x17')]));});});};exports[_0x72d1('0x1c')]=function(_0x33d530){var _0x163bec=this;return new Promise(function(_0x589f7c,_0x57ec9e){return db[_0x72d1('0x1d')]['update'](_0x33d530[_0x72d1('0x1e')],{'raw':_0x33d530[_0x72d1('0x1f')]?_0x33d530[_0x72d1('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33d530[_0x72d1('0x1f')]?_0x33d530['options'][_0x72d1('0x20')]||null:null,'attributes':_0x33d530[_0x72d1('0x1f')]?_0x33d530[_0x72d1('0x1f')][_0x72d1('0x21')]||null:null,'limit':_0x33d530['options']?_0x33d530[_0x72d1('0x1f')]['limit']||null:null})[_0x72d1('0xf')](function(_0x32dc5e){logger['info'](_0x72d1('0x1c'),_0x33d530);logger[_0x72d1('0x13')](_0x72d1('0x1c'),_0x33d530,JSON[_0x72d1('0x14')](_0x32dc5e));_0x589f7c(_0x32dc5e);})[_0x72d1('0x1b')](function(_0x52511f){logger[_0x72d1('0x15')](_0x72d1('0x1c'),_0x52511f[_0x72d1('0x17')],_0x33d530);_0x57ec9e(_0x163bec['error'](0x1f4,_0x52511f[_0x72d1('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 2257022..227dd90 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 _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 +var _0x2c16=['./faxMessage.events','remove','update','removeListener','register','length','faxMessage:'];(function(_0x31f8a3,_0x4331f8){var _0x5199ae=function(_0x225f03){while(--_0x225f03){_0x31f8a3['push'](_0x31f8a3['shift']());}};_0x5199ae(++_0x4331f8);}(_0x2c16,0x19d));var _0x62c1=function(_0x1f6bcc,_0x5cf121){_0x1f6bcc=_0x1f6bcc-0x0;var _0x3d5a58=_0x2c16[_0x1f6bcc];return _0x3d5a58;};'use strict';var FaxMessageEvents=require(_0x62c1('0x0'));var events=['save',_0x62c1('0x1'),_0x62c1('0x2')];function createListener(_0x3b243c,_0x4a0c07){return function(_0x54a397){_0x4a0c07['emit'](_0x3b243c,_0x54a397);};}function removeListener(_0x5b3ada,_0x55dbd1){return function(){FaxMessageEvents[_0x62c1('0x3')](_0x5b3ada,_0x55dbd1);};}exports[_0x62c1('0x4')]=function(_0x1397e7){for(var _0x1a7e0d=0x0,_0x58495e=events[_0x62c1('0x5')];_0x1a7e0d<_0x58495e;_0x1a7e0d++){var _0x192635=events[_0x1a7e0d];var _0x5e29fe=createListener(_0x62c1('0x6')+_0x192635,_0x1397e7);FaxMessageEvents['on'](_0x192635,_0x5e29fe);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 02b6fb2..7b7a95d 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 _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 +var _0xbfcc=['isAuthenticated','describe','/:id','show','/:id/download','download','post','tracked','fax','faxmessage:create','create','put','update','accept','/:id/reject','delete','destroy','multer','connect-timeout','express','Router','fs-extra','get'];(function(_0x565822,_0x30731c){var _0x3f6f45=function(_0x4aa43c){while(--_0x4aa43c){_0x565822['push'](_0x565822['shift']());}};_0x3f6f45(++_0x30731c);}(_0xbfcc,0x1dd));var _0xcbfc=function(_0x125ff8,_0x41925f){_0x125ff8=_0x125ff8-0x0;var _0x2d9ef=_0xbfcc[_0x125ff8];return _0x2d9ef;};'use strict';var multer=require(_0xcbfc('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xcbfc('0x1'));var express=require(_0xcbfc('0x2'));var router=express[_0xcbfc('0x3')]();var fs_extra=require(_0xcbfc('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./faxMessage.controller');router[_0xcbfc('0x5')]('/',auth[_0xcbfc('0x6')](),controller['index']);router[_0xcbfc('0x5')]('/describe',auth[_0xcbfc('0x6')](),controller[_0xcbfc('0x7')]);router[_0xcbfc('0x5')](_0xcbfc('0x8'),auth['isAuthenticated'](),controller[_0xcbfc('0x9')]);router[_0xcbfc('0x5')](_0xcbfc('0xa'),auth[_0xcbfc('0x6')](),controller[_0xcbfc('0xb')]);router[_0xcbfc('0xc')]('/',auth['isAuthenticated'](),interaction[_0xcbfc('0xd')](_0xcbfc('0xe'),_0xcbfc('0xf')),controller[_0xcbfc('0x10')]);router[_0xcbfc('0x11')]('/:id',auth[_0xcbfc('0x6')](),controller[_0xcbfc('0x12')]);router[_0xcbfc('0x11')]('/:id/accept',auth[_0xcbfc('0x6')](),controller[_0xcbfc('0x13')]);router[_0xcbfc('0x11')](_0xcbfc('0x14'),auth[_0xcbfc('0x6')](),controller['reject']);router[_0xcbfc('0x15')](_0xcbfc('0x8'),auth[_0xcbfc('0x6')](),controller[_0xcbfc('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index dbdd1b4..9627c4a 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 _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 +var _0x859e=['beepall','roundrobin','sequelize','STRING','name','INTEGER','ENUM'];(function(_0x4fd013,_0x2f9f4b){var _0x16181d=function(_0x33effb){while(--_0x33effb){_0x4fd013['push'](_0x4fd013['shift']());}};_0x16181d(++_0x2f9f4b);}(_0x859e,0x1ad));var _0xe859=function(_0xdc348e,_0xe1354f){_0xdc348e=_0xdc348e-0x0;var _0x3f5150=_0x859e[_0xdc348e];return _0x3f5150;};'use strict';var Sequelize=require(_0xe859('0x0'));module['exports']={'name':{'type':Sequelize[_0xe859('0x1')],'unique':_0xe859('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe859('0x1')]},'timeout':{'type':Sequelize[_0xe859('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe859('0x4')]('rrmemory',_0xe859('0x5'),_0xe859('0x6')),'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 a970985..07efadf 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 _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 +var _0x15b2=['name','send','map','FaxQueue','rawAttributes','fieldName','type','getOptions','where','count','include','findAll','params','query','filters','intersection','attributes','fields','length','model','includeAll','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxQueues','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','keys','UserFaxQueue','nolimit','order','sort','pick','FaxQueueId','filter','merge','User','agent','faxPause','updatedAt','rows','format','%s/%s','SIP','createdAt','getTeams','hasOwnProperty','addTeams','ids','Team','Agents','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','select','field','tq.TeamId','team_has_fax_queues','user_has_teams','FaxQueueId\x20=\x20?','clone','SELECT','every','TeamId','all','union','compact','value','removeTeams','isEmpty','removeAgents','userFaxQueue:remove','addAgents','isArray','getAgents','util','squel','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./faxQueue.socket','register','sendStatus','end','status','limit','offset','set','Content-Range','json','then','destroy','get','UserProfileResource','error'];(function(_0x4695ba,_0x5a7f2a){var _0x524b7d=function(_0xfc9707){while(--_0xfc9707){_0x4695ba['push'](_0x4695ba['shift']());}};_0x524b7d(++_0x5a7f2a);}(_0x15b2,0x145));var _0x215b=function(_0x1f1feb,_0x5782e1){_0x1f1feb=_0x1f1feb-0x0;var _0x43ca65=_0x15b2[_0x1f1feb];return _0x43ca65;};'use strict';var BPromise=require('bluebird');var util=require(_0x215b('0x0'));var _=require('lodash');var squel=require(_0x215b('0x1'));var Redis=require(_0x215b('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0x215b('0x3'))(_0x215b('0x4'));var config=require(_0x215b('0x5'));var db=require(_0x215b('0x6'))['db'];config['redis']=_[_0x215b('0x7')](config['redis'],{'host':_0x215b('0x8'),'port':0x18eb});var socket=require(_0x215b('0x9'))(new Redis(config[_0x215b('0xa')]));require(_0x215b('0xb'))[_0x215b('0xc')](socket);function respondWithStatusCode(_0xdc16f8,_0x4f0663){_0x4f0663=_0x4f0663||0xcc;return function(_0x13a0f4){if(_0x13a0f4){return _0xdc16f8[_0x215b('0xd')](_0x4f0663);}return _0xdc16f8['status'](_0x4f0663)[_0x215b('0xe')]();};}function respondWithResult(_0x44bbd9,_0x5578e4){_0x5578e4=_0x5578e4||0xc8;return function(_0x4de4ad){if(_0x4de4ad){return _0x44bbd9[_0x215b('0xf')](_0x5578e4)['json'](_0x4de4ad);}};}function respondWithFilteredResult(_0x401260,_0x1f217a){return function(_0x48f7fe){if(_0x48f7fe){var _0x2609ac=typeof _0x1f217a['offset']==='undefined'&&typeof _0x1f217a[_0x215b('0x10')]==='undefined';var _0x1465ee=_0x48f7fe['count'];var _0x2aa945=_0x2609ac?0x0:_0x1f217a[_0x215b('0x11')];var _0x38d765=_0x2609ac?_0x48f7fe['count']:_0x1f217a['offset']+_0x1f217a['limit'];var _0x1006fe;if(_0x38d765>=_0x1465ee){_0x38d765=_0x1465ee;_0x1006fe=0xc8;}else{_0x1006fe=0xce;}_0x401260[_0x215b('0xf')](_0x1006fe);return _0x401260[_0x215b('0x12')](_0x215b('0x13'),_0x2aa945+'-'+_0x38d765+'/'+_0x1465ee)[_0x215b('0x14')](_0x48f7fe);}return null;};}function saveUpdates(_0x31a491){return function(_0x3a72a6){if(_0x3a72a6){return _0x3a72a6['update'](_0x31a491)[_0x215b('0x15')](function(_0x2ca496){return _0x2ca496;});}return null;};}function removeEntity(_0x2fd65){return function(_0x37248f){if(_0x37248f){return _0x37248f[_0x215b('0x16')]()[_0x215b('0x15')](function(){var _0x3ef620=_0x37248f[_0x215b('0x17')]({'plain':!![]});var _0x4e1525='FaxQueues';return db[_0x215b('0x18')]['destroy']({'where':{'type':_0x4e1525,'resourceId':_0x3ef620['id']}})[_0x215b('0x15')](function(){return _0x37248f;});})[_0x215b('0x15')](function(){_0x2fd65[_0x215b('0xf')](0xcc)[_0x215b('0xe')]();});}};}function handleEntityNotFound(_0x5ce89a){return function(_0x1a40a5){if(!_0x1a40a5){_0x5ce89a[_0x215b('0xd')](0x194);}return _0x1a40a5;};}function handleError(_0x1a41c0,_0x5cce5d){_0x5cce5d=_0x5cce5d||0x1f4;return function(_0x4b31c3){logger[_0x215b('0x19')](_0x4b31c3['stack']);if(_0x4b31c3[_0x215b('0x1a')]){delete _0x4b31c3[_0x215b('0x1a')];}_0x1a41c0['status'](_0x5cce5d)[_0x215b('0x1b')](_0x4b31c3);};}exports['index']=function(_0x43e2dd,_0x286834){var _0x1b7c12={};var _0x245a36={'count':0x0,'rows':[]};var _0x1f30b1=_[_0x215b('0x1c')](db[_0x215b('0x1d')][_0x215b('0x1e')],function(_0x49dc3d){return{'name':_0x49dc3d[_0x215b('0x1f')],'type':_0x49dc3d[_0x215b('0x20')]['key']};});_0x1b7c12=qs[_0x215b('0x21')](_0x1f30b1,_0x43e2dd);var _0x191c50={'where':_0x1b7c12[_0x215b('0x22')]};return db['FaxQueue'][_0x215b('0x23')](_0x191c50)[_0x215b('0x15')](function(_0x1471a9){_0x245a36[_0x215b('0x23')]=_0x1471a9;_0x1b7c12[_0x215b('0x24')]=qs[_0x215b('0x24')](_0x43e2dd['query']);return db[_0x215b('0x1d')][_0x215b('0x25')](_0x1b7c12);})[_0x215b('0x15')](function(_0x1d449b){_0x245a36['rows']=_0x1d449b;return _0x245a36;})['then'](respondWithFilteredResult(_0x286834,_0x1b7c12))['catch'](handleError(_0x286834,null));};exports['show']=function(_0x48f0d6,_0xa14a89){var _0x1c7313={'raw':!![],'where':{'id':_0x48f0d6[_0x215b('0x26')]['id']}},_0xf230ee={};_0xf230ee['model']=_['keys'](db['FaxQueue'][_0x215b('0x1e')]);_0xf230ee['query']=_['keys'](_0x48f0d6[_0x215b('0x27')]);_0xf230ee[_0x215b('0x28')]=_[_0x215b('0x29')](_0xf230ee['model'],_0xf230ee[_0x215b('0x27')]);_0x1c7313[_0x215b('0x2a')]=_['intersection'](_0xf230ee['model'],qs[_0x215b('0x2b')](_0x48f0d6['query'][_0x215b('0x2b')]));_0x1c7313['attributes']=_0x1c7313['attributes'][_0x215b('0x2c')]?_0x1c7313[_0x215b('0x2a')]:_0xf230ee[_0x215b('0x2d')];if(_0x48f0d6['query'][_0x215b('0x2e')]){_0x1c7313['include']=[{'all':!![]}];}_0x1c7313=_['merge']({},_0x1c7313,_0x48f0d6[_0x215b('0x2f')]);return db[_0x215b('0x1d')][_0x215b('0x30')](_0x1c7313)[_0x215b('0x15')](handleEntityNotFound(_0xa14a89,null))[_0x215b('0x15')](respondWithResult(_0xa14a89,null))[_0x215b('0x31')](handleError(_0xa14a89,null));};exports['create']=function(_0x464fe8,_0x22fbb3){return db['FaxQueue'][_0x215b('0x32')](_0x464fe8[_0x215b('0x33')],{})[_0x215b('0x15')](function(_0xd72a58){var _0x48ecbc=_0x464fe8[_0x215b('0x34')][_0x215b('0x17')]({'plain':!![]});if(!_0x48ecbc)throw new Error(_0x215b('0x35'));if(_0x48ecbc[_0x215b('0x36')]===_0x215b('0x34')){var _0x22bd45=_0xd72a58['get']({'plain':!![]});var _0x4a8086=_0x215b('0x37');return db[_0x215b('0x38')]['find']({'where':{'name':_0x4a8086,'userProfileId':_0x48ecbc[_0x215b('0x39')]},'raw':!![]})[_0x215b('0x15')](function(_0x1cf253){if(_0x1cf253&&_0x1cf253['autoAssociation']===0x0){return db[_0x215b('0x18')][_0x215b('0x32')]({'name':_0x22bd45[_0x215b('0x1a')],'resourceId':_0x22bd45['id'],'type':_0x1cf253['name'],'sectionId':_0x1cf253['id']},{})[_0x215b('0x15')](function(){return _0xd72a58;});}else{return _0xd72a58;}})['catch'](function(_0x5b366d){logger[_0x215b('0x19')](_0x215b('0x3a'),_0x5b366d);throw _0x5b366d;});}return _0xd72a58;})[_0x215b('0x15')](respondWithResult(_0x22fbb3,0xc9))['catch'](handleError(_0x22fbb3,null));};exports[_0x215b('0x3b')]=function(_0x20908e,_0x782816){if(_0x20908e[_0x215b('0x33')]['id']){delete _0x20908e['body']['id'];}return db[_0x215b('0x1d')][_0x215b('0x30')]({'where':{'id':_0x20908e[_0x215b('0x26')]['id']}})[_0x215b('0x15')](handleEntityNotFound(_0x782816,null))[_0x215b('0x15')](saveUpdates(_0x20908e['body'],null))[_0x215b('0x15')](respondWithResult(_0x782816,null))['catch'](handleError(_0x782816,null));};exports[_0x215b('0x16')]=function(_0x4d24ee,_0x3c5be7){return db[_0x215b('0x1d')][_0x215b('0x30')]({'where':{'id':_0x4d24ee[_0x215b('0x26')]['id']}})[_0x215b('0x15')](handleEntityNotFound(_0x3c5be7,null))['then'](removeEntity(_0x3c5be7,null))['catch'](handleError(_0x3c5be7,null));};exports[_0x215b('0x3c')]=function(_0x47a14d,_0x3e43e7){return db[_0x215b('0x1d')][_0x215b('0x3c')]()[_0x215b('0x15')](respondWithResult(_0x3e43e7,null))['catch'](handleError(_0x3e43e7,null));};exports[_0x215b('0x3d')]=function(_0x3e5f24,_0x34e8e3){var _0x538b65={'raw':!![],'where':{}},_0x193269={},_0x6eea55;return db[_0x215b('0x1d')][_0x215b('0x3e')]({'where':{'id':_0x3e5f24['params']['id']}})[_0x215b('0x15')](handleEntityNotFound(_0x34e8e3,null))['then'](function(_0x122ad4){if(_0x122ad4){_0x6eea55=_0x122ad4[_0x215b('0x17')]({'plain':!![]});_0x193269['model']=_[_0x215b('0x3f')](db[_0x215b('0x40')]['rawAttributes']);_0x193269['query']=_[_0x215b('0x3f')](_0x3e5f24[_0x215b('0x27')]);_0x193269[_0x215b('0x28')]=_['intersection'](_0x193269[_0x215b('0x2d')],_0x193269[_0x215b('0x27')]);_0x538b65[_0x215b('0x2a')]=_[_0x215b('0x29')](_0x193269['model'],qs[_0x215b('0x2b')](_0x3e5f24['query'][_0x215b('0x2b')]));_0x538b65[_0x215b('0x2a')]=_0x538b65[_0x215b('0x2a')]['length']?_0x538b65[_0x215b('0x2a')]:_0x193269[_0x215b('0x2d')];if(!_0x3e5f24['query']['hasOwnProperty'](_0x215b('0x41'))){_0x538b65[_0x215b('0x10')]=qs['limit'](_0x3e5f24[_0x215b('0x27')][_0x215b('0x10')]);_0x538b65[_0x215b('0x11')]=qs[_0x215b('0x11')](_0x3e5f24[_0x215b('0x27')][_0x215b('0x11')]);}_0x538b65[_0x215b('0x42')]=qs['sort'](_0x3e5f24['query'][_0x215b('0x43')]);_0x538b65[_0x215b('0x22')]=qs['filters'](_[_0x215b('0x44')](_0x3e5f24[_0x215b('0x27')],_0x193269[_0x215b('0x28')]));_0x538b65[_0x215b('0x22')][_0x215b('0x45')]=_0x122ad4['id'];if(_0x3e5f24['query'][_0x215b('0x46')]){_0x538b65[_0x215b('0x22')]=_[_0x215b('0x47')](_0x538b65['where'],{'$or':_[_0x215b('0x1c')](_0x538b65[_0x215b('0x2a')],function(_0x35c729){var _0x56688f={};_0x56688f[_0x35c729]={'$like':'%'+_0x3e5f24['query'][_0x215b('0x46')]+'%'};return _0x56688f;})});}_0x538b65=_['merge']({},_0x538b65,_0x3e5f24[_0x215b('0x2f')]);return db['UserFaxQueue'][_0x215b('0x25')](_0x538b65);}})['then'](function(_0x41b139){if(_0x41b139){return db[_0x215b('0x48')]['findAndCountAll']({'where':{'id':_[_0x215b('0x1c')](_0x41b139,'UserId'),'role':_0x215b('0x49')},'attributes':['id',_0x215b('0x1a'),_0x215b('0x4a'),_0x215b('0x4b'),'createdAt']});}})[_0x215b('0x15')](function(_0x4c145d){if(_0x4c145d){return{'count':_0x4c145d[_0x215b('0x23')],'rows':_[_0x215b('0x1c')](_0x4c145d[_0x215b('0x4c')],function(_0x2182d2){return{'membername':_0x2182d2['name'],'UserId':_0x2182d2['id'],'queue_name':_0x6eea55['name'],'FaxQueueId':_0x6eea55['id'],'interface':util[_0x215b('0x4d')](_0x215b('0x4e'),_0x215b('0x4f'),_0x2182d2[_0x215b('0x1a')]),'penalty':0x0,'paused':_0x2182d2[_0x215b('0x4a')],'createdAt':_0x2182d2[_0x215b('0x50')],'updatedAt':_0x2182d2[_0x215b('0x4b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x215b('0x15')](respondWithFilteredResult(_0x34e8e3,_0x538b65))[_0x215b('0x31')](handleError(_0x34e8e3,null));};exports['getTeams']=function(_0x332cd9,_0x9b6fa4){var _0x213b84={};var _0x1caf4a={};var _0x279b42;var _0x2c5a23;return db[_0x215b('0x1d')][_0x215b('0x3e')]({'where':{'id':_0x332cd9[_0x215b('0x26')]['id']}})[_0x215b('0x15')](handleEntityNotFound(_0x9b6fa4,null))[_0x215b('0x15')](function(_0x2b9e2a){if(_0x2b9e2a){_0x279b42=_0x2b9e2a;_0x1caf4a[_0x215b('0x2d')]=_[_0x215b('0x3f')](db['Team'][_0x215b('0x1e')]);_0x1caf4a[_0x215b('0x27')]=_[_0x215b('0x3f')](_0x332cd9[_0x215b('0x27')]);_0x1caf4a['filters']=_['intersection'](_0x1caf4a[_0x215b('0x2d')],_0x1caf4a[_0x215b('0x27')]);_0x213b84[_0x215b('0x2a')]=_[_0x215b('0x29')](_0x1caf4a['model'],qs[_0x215b('0x2b')](_0x332cd9['query'][_0x215b('0x2b')]));_0x213b84[_0x215b('0x2a')]=_0x213b84[_0x215b('0x2a')][_0x215b('0x2c')]?_0x213b84[_0x215b('0x2a')]:_0x1caf4a[_0x215b('0x2d')];_0x213b84['order']=qs[_0x215b('0x43')](_0x332cd9[_0x215b('0x27')][_0x215b('0x43')]);_0x213b84[_0x215b('0x22')]=qs[_0x215b('0x28')](_[_0x215b('0x44')](_0x332cd9['query'],_0x1caf4a[_0x215b('0x28')]));if(_0x332cd9[_0x215b('0x27')][_0x215b('0x46')]){_0x213b84['where']=_[_0x215b('0x47')](_0x213b84[_0x215b('0x22')],{'$or':_['map'](_0x213b84[_0x215b('0x2a')],function(_0x2275b7){var _0x5cc8cc={};_0x5cc8cc[_0x2275b7]={'$like':'%'+_0x332cd9[_0x215b('0x27')][_0x215b('0x46')]+'%'};return _0x5cc8cc;})});}_0x213b84=_['merge']({},_0x213b84,_0x332cd9['options']);return _0x279b42[_0x215b('0x51')](_0x213b84);}})[_0x215b('0x15')](function(_0x4e5e21){if(_0x4e5e21){_0x2c5a23=_0x4e5e21[_0x215b('0x2c')];if(!_0x332cd9['query'][_0x215b('0x52')]('nolimit')){_0x213b84[_0x215b('0x10')]=qs[_0x215b('0x10')](_0x332cd9['query'][_0x215b('0x10')]);_0x213b84['offset']=qs[_0x215b('0x11')](_0x332cd9[_0x215b('0x27')][_0x215b('0x11')]);}return _0x279b42[_0x215b('0x51')](_0x213b84);}})[_0x215b('0x15')](function(_0x1444b0){if(_0x1444b0){return _0x1444b0?{'count':_0x2c5a23,'rows':_0x1444b0}:null;}})[_0x215b('0x15')](respondWithResult(_0x9b6fa4,null))[_0x215b('0x31')](handleError(_0x9b6fa4,null));};exports[_0x215b('0x53')]=function(_0x5aeb6b,_0x1a0989){var _0x588b17=_0x5aeb6b[_0x215b('0x33')][_0x215b('0x54')];return db[_0x215b('0x55')][_0x215b('0x25')]({'where':{'id':_0x588b17},'attributes':['id'],'include':[{'model':db[_0x215b('0x48')],'as':_0x215b('0x56'),'attributes':['id',_0x215b('0x1a'),'online','voicePause',_0x215b('0x57')],'raw':!![]}]})['then'](function(_0x3d5f00){if(_0x3d5f00){var _0x1836a1=_[_0x215b('0x58')](_0x3d5f00,function(_0x109711){var _0x499699=_0x109711[_0x215b('0x17')]({'plain':!![]});return _0x499699[_0x215b('0x56')];});return db['FaxQueue']['find']({'where':{'id':_0x5aeb6b[_0x215b('0x26')]['id']}})[_0x215b('0x15')](function(_0x5a132b){return db[_0x215b('0x59')][_0x215b('0x5a')](function(_0x337c28){return _0x5a132b['addTeams'](_0x588b17,{'transaction':_0x337c28})[_0x215b('0x15')](function(){return BPromise[_0x215b('0x5b')](_0x1836a1,function(_0x4b40a8){return db[_0x215b('0x40')][_0x215b('0x5c')]({'where':{'UserId':_0x4b40a8['id'],'FaxQueueId':_0x5aeb6b[_0x215b('0x26')]['id']},'transaction':_0x337c28});});})[_0x215b('0x15')](function(){_0x1836a1[_0x215b('0x5d')](function(_0x473b8d){socket[_0x215b('0x5e')](_0x215b('0x5f'),{'UserId':_0x473b8d['id'],'FaxQueueId':_0x5a132b['id']});});});});});}})[_0x215b('0x15')](respondWithStatusCode(_0x1a0989,null))[_0x215b('0x31')](handleError(_0x1a0989,null));};exports['removeTeams']=function(_0x4500a5,_0x38e4fd){return db[_0x215b('0x55')][_0x215b('0x25')]({'where':{'id':_0x4500a5[_0x215b('0x27')][_0x215b('0x54')]},'attributes':['id'],'include':[{'model':db[_0x215b('0x48')],'as':_0x215b('0x56'),'attributes':['id'],'raw':!![]}]})[_0x215b('0x15')](handleEntityNotFound(_0x38e4fd,null))[_0x215b('0x15')](function(_0x5dec9f){var _0xee330d=_[_0x215b('0x1c')](_0x5dec9f,'id');var _0xe28822=[];var _0x164006=[];var _0x35b64b=squel[_0x215b('0x60')]();_0x35b64b[_0x215b('0x61')](_0x215b('0x62'))['from'](_0x215b('0x63'),'tq')['join'](_0x215b('0x64'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x215b('0x22')](_0x215b('0x65'),_0x4500a5[_0x215b('0x26')]['id']);for(var _0x42ca65=0x0;_0x42ca65<_0x5dec9f['length'];_0x42ca65+=0x1){let _0x3d4594=_0x5dec9f[_0x42ca65];for(var _0x590a29=0x0;_0x590a29<_0x3d4594[_0x215b('0x56')]['length'];_0x590a29+=0x1){let _0x3075df=_0x3d4594[_0x215b('0x56')][_0x590a29];var _0x496e93=_0x35b64b[_0x215b('0x66')]();_0x496e93[_0x215b('0x22')]('ut.UserId\x20=\x20?',_0x3075df['id']);_0x164006['push'](db[_0x215b('0x59')][_0x215b('0x27')](_0x496e93['toString'](),{'type':db[_0x215b('0x59')]['QueryTypes'][_0x215b('0x67')]})[_0x215b('0x15')](function(_0x2f88bc){if(_0x2f88bc[_0x215b('0x2c')]===0x1){return _0x3075df['id'];}else{var _0x18b853=_[_0x215b('0x68')](_[_0x215b('0x1c')](_0x2f88bc,_0x215b('0x69')),function(_0x21146f){return _['includes'](_0xee330d,_0x21146f);});if(_0x18b853){return _0x3075df['id'];}}}));}}return BPromise[_0x215b('0x6a')](_0x164006)[_0x215b('0x15')](function(_0x2ceb4e){_0xe28822=_(_0xe28822)[_0x215b('0x6b')](_0x2ceb4e)[_0x215b('0x6c')]()[_0x215b('0x6d')]();return db[_0x215b('0x1d')][_0x215b('0x30')]({'where':{'id':_0x4500a5[_0x215b('0x26')]['id']}})['then'](function(_0x2b7c48){return db['sequelize']['transaction'](function(_0x274518){return _0x2b7c48[_0x215b('0x6e')](_0x4500a5[_0x215b('0x27')][_0x215b('0x54')],{'transaction':_0x274518})[_0x215b('0x15')](function(){if(!_[_0x215b('0x6f')](_0xe28822)){return _0x2b7c48[_0x215b('0x70')](_0xe28822,{'transaction':_0x274518});}})[_0x215b('0x15')](function(){_0xe28822['forEach'](function(_0x5ba4f3){socket[_0x215b('0x5e')](_0x215b('0x71'),{'UserId':_0x5ba4f3,'FaxQueueId':_0x2b7c48['id']});});});});});});})[_0x215b('0x15')](respondWithStatusCode(_0x38e4fd,null))['catch'](handleError(_0x38e4fd,null));};exports[_0x215b('0x72')]=function(_0x1a67a9,_0x333619){return db['FaxQueue'][_0x215b('0x30')]({'where':{'id':_0x1a67a9['params']['id']}})[_0x215b('0x15')](handleEntityNotFound(_0x333619,null))['then'](function(_0x4c8077){if(_0x4c8077){return _0x4c8077[_0x215b('0x72')](_0x1a67a9['body'][_0x215b('0x54')],_['omit'](_0x1a67a9[_0x215b('0x33')],[_0x215b('0x54'),'id'])||{})['spread'](function(_0x6d5029){for(var _0x43ce4d=0x0;_0x43ce4d<_0x1a67a9[_0x215b('0x33')][_0x215b('0x54')]['length'];_0x43ce4d+=0x1){socket[_0x215b('0x5e')](_0x215b('0x5f'),{'UserId':Number(_0x1a67a9['body'][_0x215b('0x54')][_0x43ce4d]),'FaxQueueId':Number(_0x1a67a9[_0x215b('0x26')]['id'])});}return _0x6d5029;});}})[_0x215b('0x15')](respondWithResult(_0x333619,null))[_0x215b('0x31')](handleError(_0x333619,null));};exports[_0x215b('0x70')]=function(_0x3f1f77,_0x1bc1b0){return db[_0x215b('0x1d')][_0x215b('0x30')]({'where':{'id':_0x3f1f77[_0x215b('0x26')]['id']}})[_0x215b('0x15')](handleEntityNotFound(_0x1bc1b0,null))[_0x215b('0x15')](function(_0x42f99a){if(_0x42f99a){return _0x42f99a[_0x215b('0x70')](_0x3f1f77[_0x215b('0x27')][_0x215b('0x54')])[_0x215b('0x15')](function(){if(_[_0x215b('0x73')](_0x3f1f77[_0x215b('0x27')][_0x215b('0x54')])){for(var _0x4f6891=0x0;_0x4f6891<_0x3f1f77[_0x215b('0x27')][_0x215b('0x54')]['length'];_0x4f6891+=0x1){socket['emit'](_0x215b('0x71'),{'UserId':Number(_0x3f1f77[_0x215b('0x27')][_0x215b('0x54')][_0x4f6891]),'FaxQueueId':Number(_0x3f1f77[_0x215b('0x26')]['id'])});}}else{socket[_0x215b('0x5e')](_0x215b('0x71'),{'UserId':Number(_0x3f1f77[_0x215b('0x27')][_0x215b('0x54')]),'FaxQueueId':Number(_0x3f1f77[_0x215b('0x26')]['id'])});}});}})[_0x215b('0x15')](respondWithStatusCode(_0x1bc1b0,null))[_0x215b('0x31')](handleError(_0x1bc1b0,null));};exports[_0x215b('0x74')]=function(_0x52cf07,_0x4bc178){var _0x24581d={};var _0x356392={};var _0x278df7;var _0x2609a9;return db[_0x215b('0x1d')]['findOne']({'where':{'id':_0x52cf07['params']['id']}})['then'](handleEntityNotFound(_0x4bc178,null))[_0x215b('0x15')](function(_0x16178a){if(_0x16178a){_0x278df7=_0x16178a;_0x356392[_0x215b('0x2d')]=_[_0x215b('0x3f')](db[_0x215b('0x48')][_0x215b('0x1e')]);_0x356392[_0x215b('0x27')]=_[_0x215b('0x3f')](_0x52cf07[_0x215b('0x27')]);_0x356392[_0x215b('0x28')]=_[_0x215b('0x29')](_0x356392[_0x215b('0x2d')],_0x356392[_0x215b('0x27')]);_0x24581d['attributes']=_[_0x215b('0x29')](_0x356392[_0x215b('0x2d')],qs[_0x215b('0x2b')](_0x52cf07[_0x215b('0x27')][_0x215b('0x2b')]));_0x24581d['attributes']=_0x24581d[_0x215b('0x2a')][_0x215b('0x2c')]?_0x24581d[_0x215b('0x2a')]:_0x356392[_0x215b('0x2d')];_0x24581d[_0x215b('0x42')]=qs[_0x215b('0x43')](_0x52cf07[_0x215b('0x27')][_0x215b('0x43')]);_0x24581d['where']=qs[_0x215b('0x28')](_['pick'](_0x52cf07[_0x215b('0x27')],_0x356392[_0x215b('0x28')]));if(_0x52cf07[_0x215b('0x27')][_0x215b('0x46')]){_0x24581d[_0x215b('0x22')]=_[_0x215b('0x47')](_0x24581d[_0x215b('0x22')],{'$or':_[_0x215b('0x1c')](_0x24581d['attributes'],function(_0x22e37e){var _0x3ad598={};_0x3ad598[_0x22e37e]={'$like':'%'+_0x52cf07['query'][_0x215b('0x46')]+'%'};return _0x3ad598;})});}_0x24581d=_[_0x215b('0x47')]({},_0x24581d,_0x52cf07[_0x215b('0x2f')]);return _0x278df7['getAgents'](_0x24581d);}})['then'](function(_0x2065d4){if(_0x2065d4){_0x2609a9=_0x2065d4['length'];if(!_0x52cf07['query'][_0x215b('0x52')]('nolimit')){_0x24581d[_0x215b('0x10')]=qs[_0x215b('0x10')](_0x52cf07[_0x215b('0x27')]['limit']);_0x24581d['offset']=qs['offset'](_0x52cf07[_0x215b('0x27')][_0x215b('0x11')]);}return _0x278df7[_0x215b('0x74')](_0x24581d);}})[_0x215b('0x15')](function(_0x20f66a){if(_0x20f66a){return _0x20f66a?{'count':_0x2609a9,'rows':_0x20f66a}:null;}})[_0x215b('0x15')](respondWithResult(_0x4bc178,null))['catch'](handleError(_0x4bc178,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 6f38c5f..cf6cea5 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 _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 +var _0x32f4=['../../mysqldb','FaxQueue','save','remove','hasOwnProperty','hook','exports','events'];(function(_0x2900f6,_0x2d50ce){var _0x377376=function(_0x384216){while(--_0x384216){_0x2900f6['push'](_0x2900f6['shift']());}};_0x377376(++_0x2d50ce);}(_0x32f4,0x137));var _0x432f=function(_0x817f3f,_0x380692){_0x817f3f=_0x817f3f-0x0;var _0x4524d7=_0x32f4[_0x817f3f];return _0x4524d7;};'use strict';var EventEmitter=require(_0x432f('0x0'));var FaxQueue=require(_0x432f('0x1'))['db'][_0x432f('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x432f('0x3'),'afterUpdate':'update','afterDestroy':_0x432f('0x4')};function emitEvent(_0x47f421){return function(_0x5e39e1,_0x584f19,_0x322840){FaxQueueEvents['emit'](_0x47f421+':'+_0x5e39e1['id'],_0x5e39e1);FaxQueueEvents['emit'](_0x47f421,_0x5e39e1);_0x322840(null);};}for(var e in events){if(events[_0x432f('0x5')](e)){var event=events[e];FaxQueue[_0x432f('0x6')](e,emitEvent(event));}}module[_0x432f('0x7')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 189e572..e0f4dac 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 _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 +var _0x10e1=['../../config/logger','moment','bluebird','path','../../config/environment','./faxQueue.attributes','exports','define','FaxQueue','fax_queues','lodash','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x10e1,0x14e));var _0x110e=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0x10e1[_0x2b9b7f];return _0x4ed19a;};'use strict';var _=require(_0x110e('0x0'));var util=require(_0x110e('0x1'));var logger=require(_0x110e('0x2'))('api');var moment=require(_0x110e('0x3'));var BPromise=require(_0x110e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x110e('0x5'));var rimraf=require('rimraf');var config=require(_0x110e('0x6'));var attributes=require(_0x110e('0x7'));module[_0x110e('0x8')]=function(_0x58c57f,_0x3d2ff4){return _0x58c57f[_0x110e('0x9')](_0x110e('0xa'),attributes,{'tableName':_0x110e('0xb'),'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 ee4dd81..fae3c5a 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 _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 +var _0x166a=['result','GetFaxQueue','options','attributes','include','map','model','stringify','FaxQueue','find','raw','where','ShowFaxQueue','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./faxQueue.socket','register','then','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','info'];(function(_0x13f0d5,_0x3bccc4){var _0x3666bb=function(_0x466123){while(--_0x466123){_0x13f0d5['push'](_0x13f0d5['shift']());}};_0x3666bb(++_0x3bccc4);}(_0x166a,0x164));var _0xa166=function(_0x2fcba9,_0x4d419f){_0x2fcba9=_0x2fcba9-0x0;var _0x371a05=_0x166a[_0x2fcba9];return _0x371a05;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa166('0x0'));var BPromise=require(_0xa166('0x1'));var rs=require(_0xa166('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa166('0x3'))['db'];var utils=require(_0xa166('0x4'));var logger=require(_0xa166('0x5'))(_0xa166('0x6'));var config=require(_0xa166('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa166('0x8')][_0xa166('0x9')]({'port':0x232a});config[_0xa166('0xa')]=_['defaults'](config[_0xa166('0xa')],{'host':_0xa166('0xb'),'port':0x18eb});var socket=require(_0xa166('0xc'))(new Redis(config[_0xa166('0xa')]));require(_0xa166('0xd'))[_0xa166('0xe')](socket);function respondWithRpcPromise(_0x2b22d8,_0x501d5d,_0x48c69a){return new BPromise(function(_0x39d603,_0x2619b1){return client['request'](_0x2b22d8,_0x48c69a)[_0xa166('0xf')](function(_0x28cc65){logger['info'](_0xa166('0x10'),_0x501d5d,_0xa166('0x11'));logger[_0xa166('0x12')](_0xa166('0x13'),_0x501d5d,'request\x20sent',JSON['stringify'](_0x28cc65));if(_0x28cc65[_0xa166('0x14')]){if(_0x28cc65[_0xa166('0x14')][_0xa166('0x15')]===0x1f4){logger[_0xa166('0x14')](_0xa166('0x10'),_0x501d5d,_0x28cc65[_0xa166('0x14')][_0xa166('0x16')]);return _0x2619b1(_0x28cc65[_0xa166('0x14')][_0xa166('0x16')]);}logger[_0xa166('0x14')](_0xa166('0x10'),_0x501d5d,_0x28cc65[_0xa166('0x14')][_0xa166('0x16')]);return _0x39d603(_0x28cc65[_0xa166('0x14')][_0xa166('0x16')]);}else{logger[_0xa166('0x17')]('FaxQueue,\x20%s,\x20%s',_0x501d5d,_0xa166('0x11'));_0x39d603(_0x28cc65[_0xa166('0x18')][_0xa166('0x16')]);}})['catch'](function(_0x3292d9){logger[_0xa166('0x14')](_0xa166('0x10'),_0x501d5d,_0x3292d9);_0x2619b1(_0x3292d9);});});}exports[_0xa166('0x19')]=function(_0x20857a){var _0x3332b0=this;return new Promise(function(_0x3fc43d,_0x3f6e7b){return db['FaxQueue']['findAll']({'raw':_0x20857a[_0xa166('0x1a')]?_0x20857a[_0xa166('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x20857a[_0xa166('0x1a')]?_0x20857a[_0xa166('0x1a')]['where']||null:null,'attributes':_0x20857a[_0xa166('0x1a')]?_0x20857a['options'][_0xa166('0x1b')]||null:null,'limit':_0x20857a[_0xa166('0x1a')]?_0x20857a[_0xa166('0x1a')]['limit']||null:null,'include':_0x20857a[_0xa166('0x1a')]?_0x20857a[_0xa166('0x1a')][_0xa166('0x1c')]?_[_0xa166('0x1d')](_0x20857a[_0xa166('0x1a')]['include'],function(_0xb274d0){return{'model':db[_0xb274d0[_0xa166('0x1e')]],'as':_0xb274d0['as'],'attributes':_0xb274d0[_0xa166('0x1b')],'include':_0xb274d0['include']?_[_0xa166('0x1d')](_0xb274d0[_0xa166('0x1c')],function(_0x456d25){return{'model':db[_0x456d25[_0xa166('0x1e')]],'as':_0x456d25['as'],'attributes':_0x456d25[_0xa166('0x1b')],'include':_0x456d25['include']?_[_0xa166('0x1d')](_0x456d25['include'],function(_0x415924){return{'model':db[_0x415924['model']],'as':_0x415924['as'],'attributes':_0x415924[_0xa166('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2c403d){logger[_0xa166('0x17')]('GetFaxQueue',_0x20857a);logger[_0xa166('0x12')]('GetFaxQueue',_0x20857a,JSON[_0xa166('0x1f')](_0x2c403d));_0x3fc43d(_0x2c403d);})['catch'](function(_0x3e6f9e){logger[_0xa166('0x14')](_0xa166('0x19'),_0x3e6f9e['message'],_0x20857a);_0x3f6e7b(_0x3332b0['error'](0x1f4,_0x3e6f9e['message']));});});};exports['ShowFaxQueue']=function(_0x1dd9a5){var _0x328faf=this;return new Promise(function(_0x1f1206,_0x20e143){return db[_0xa166('0x20')][_0xa166('0x21')]({'raw':_0x1dd9a5[_0xa166('0x1a')]?_0x1dd9a5[_0xa166('0x1a')][_0xa166('0x22')]===undefined?!![]:![]:!![],'where':_0x1dd9a5[_0xa166('0x1a')]?_0x1dd9a5[_0xa166('0x1a')][_0xa166('0x23')]||null:null,'attributes':_0x1dd9a5[_0xa166('0x1a')]?_0x1dd9a5[_0xa166('0x1a')][_0xa166('0x1b')]||null:null,'include':_0x1dd9a5['options']?_0x1dd9a5[_0xa166('0x1a')][_0xa166('0x1c')]?_[_0xa166('0x1d')](_0x1dd9a5[_0xa166('0x1a')][_0xa166('0x1c')],function(_0x1b0543){return{'model':db[_0x1b0543[_0xa166('0x1e')]],'as':_0x1b0543['as'],'attributes':_0x1b0543[_0xa166('0x1b')],'include':_0x1b0543[_0xa166('0x1c')]?_['map'](_0x1b0543[_0xa166('0x1c')],function(_0x1ce797){return{'model':db[_0x1ce797[_0xa166('0x1e')]],'as':_0x1ce797['as'],'attributes':_0x1ce797[_0xa166('0x1b')],'include':_0x1ce797[_0xa166('0x1c')]?_[_0xa166('0x1d')](_0x1ce797['include'],function(_0x4ac899){return{'model':db[_0x4ac899['model']],'as':_0x4ac899['as'],'attributes':_0x4ac899[_0xa166('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa166('0xf')](function(_0x3d77fb){logger[_0xa166('0x17')]('ShowFaxQueue',_0x1dd9a5);logger[_0xa166('0x12')](_0xa166('0x24'),_0x1dd9a5,JSON['stringify'](_0x3d77fb));_0x1f1206(_0x3d77fb);})[_0xa166('0x25')](function(_0x593133){logger['error'](_0xa166('0x24'),_0x593133[_0xa166('0x16')],_0x1dd9a5);_0x20e143(_0x328faf['error'](0x1f4,_0x593133[_0xa166('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 1ca150f..7eac9a4 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 _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 +var _0x6863=['./faxQueue.events','save','remove','removeListener','register','length','faxQueue:'];(function(_0x38773,_0x44d470){var _0x2a5319=function(_0x4ba955){while(--_0x4ba955){_0x38773['push'](_0x38773['shift']());}};_0x2a5319(++_0x44d470);}(_0x6863,0xd9));var _0x3686=function(_0x397e46,_0xff151b){_0x397e46=_0x397e46-0x0;var _0x234ba9=_0x6863[_0x397e46];return _0x234ba9;};'use strict';var FaxQueueEvents=require(_0x3686('0x0'));var events=[_0x3686('0x1'),_0x3686('0x2'),'update'];function createListener(_0x52b6be,_0x14bacc){return function(_0x117020){_0x14bacc['emit'](_0x52b6be,_0x117020);};}function removeListener(_0x1eb8e2,_0x4d0177){return function(){FaxQueueEvents[_0x3686('0x3')](_0x1eb8e2,_0x4d0177);};}exports[_0x3686('0x4')]=function(_0x2c82b4){for(var _0x4c5c07=0x0,_0x7dd73c=events[_0x3686('0x5')];_0x4c5c07<_0x7dd73c;_0x4c5c07++){var _0x5cfb2c=events[_0x4c5c07];var _0x2ad6d4=createListener(_0x3686('0x6')+_0x5cfb2c,_0x2c82b4);FaxQueueEvents['on'](_0x5cfb2c,_0x2ad6d4);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index a11ded7..ea2d2c4 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 _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 +var _0xfb11=['Router','../../components/auth/service','../../config/environment','./faxQueue.controller','isAuthenticated','index','/describe','describe','get','/:id','show','/:id/members','/:id/users','getAgents','post','/:id/teams','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','multer','path','connect-timeout'];(function(_0x322063,_0x1d7f3d){var _0x58ab5f=function(_0x319c13){while(--_0x319c13){_0x322063['push'](_0x322063['shift']());}};_0x58ab5f(++_0x1d7f3d);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0xfb11[_0x20c9b2];return _0x2c6030;};'use strict';var multer=require(_0x1fb1('0x0'));var util=require('util');var path=require(_0x1fb1('0x1'));var timeout=require(_0x1fb1('0x2'));var express=require('express');var router=express[_0x1fb1('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1fb1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1fb1('0x5'));var controller=require(_0x1fb1('0x6'));router['get']('/',auth[_0x1fb1('0x7')](),controller[_0x1fb1('0x8')]);router['get'](_0x1fb1('0x9'),auth[_0x1fb1('0x7')](),controller[_0x1fb1('0xa')]);router[_0x1fb1('0xb')](_0x1fb1('0xc'),auth[_0x1fb1('0x7')](),controller[_0x1fb1('0xd')]);router[_0x1fb1('0xb')](_0x1fb1('0xe'),auth[_0x1fb1('0x7')](),controller['getMembers']);router[_0x1fb1('0xb')]('/:id/teams',auth[_0x1fb1('0x7')](),controller['getTeams']);router[_0x1fb1('0xb')](_0x1fb1('0xf'),auth[_0x1fb1('0x7')](),controller[_0x1fb1('0x10')]);router[_0x1fb1('0x11')]('/',auth[_0x1fb1('0x7')](),controller['create']);router[_0x1fb1('0x11')](_0x1fb1('0x12'),auth[_0x1fb1('0x7')](),controller[_0x1fb1('0x13')]);router[_0x1fb1('0x11')](_0x1fb1('0xf'),auth[_0x1fb1('0x7')](),controller[_0x1fb1('0x14')]);router[_0x1fb1('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x1fb1('0x16')]);router[_0x1fb1('0x17')](_0x1fb1('0xc'),auth['isAuthenticated'](),controller[_0x1fb1('0x18')]);router[_0x1fb1('0x17')](_0x1fb1('0x12'),auth[_0x1fb1('0x7')](),controller[_0x1fb1('0x19')]);router[_0x1fb1('0x17')](_0x1fb1('0xf'),auth[_0x1fb1('0x7')](),controller[_0x1fb1('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index ad84572..ae717d7 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 _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 +var _0x004c=['STRING','DATE','sequelize','exports'];(function(_0x272638,_0x42b993){var _0x19d027=function(_0x27ac44){while(--_0x27ac44){_0x272638['push'](_0x272638['shift']());}};_0x19d027(++_0x42b993);}(_0x004c,0x76));var _0xc004=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x004c[_0x5c2e3e];return _0x53f64a;};'use strict';var moment=require('moment');var Sequelize=require(_0xc004('0x0'));module[_0xc004('0x1')]={'uniqueid':{'type':Sequelize[_0xc004('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xc004('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xc004('0x3')]},'acceptAt':{'type':Sequelize[_0xc004('0x3')]},'exitAt':{'type':Sequelize[_0xc004('0x3')]},'reason':{'type':Sequelize[_0xc004('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 8744ec0..4430300 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 _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 +var _0x4d46=['sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','save','update','then','destroy','error','stack','name','map','fieldName','key','model','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','type','VIRTUAL','filter','merge','options','FaxQueueReport','include','rows','catch','show','params','keys','includeAll','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x519a26,_0x2076af){var _0x555cbd=function(_0x5ae1a7){while(--_0x5ae1a7){_0x519a26['push'](_0x519a26['shift']());}};_0x555cbd(++_0x2076af);}(_0x4d46,0x197));var _0x64d4=function(_0x4672e9,_0x5caff9){_0x4672e9=_0x4672e9-0x0;var _0x2407fd=_0x4d46[_0x4672e9];return _0x2407fd;};'use strict';var emlformat=require(_0x64d4('0x0'));var rimraf=require(_0x64d4('0x1'));var zipdir=require(_0x64d4('0x2'));var jsonpatch=require(_0x64d4('0x3'));var rp=require(_0x64d4('0x4'));var moment=require(_0x64d4('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x64d4('0x6'));var util=require(_0x64d4('0x7'));var path=require(_0x64d4('0x8'));var sox=require(_0x64d4('0x9'));var csv=require(_0x64d4('0xa'));var ejs=require(_0x64d4('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x64d4('0xc'));var squel=require(_0x64d4('0xd'));var crypto=require('crypto');var jsforce=require(_0x64d4('0xe'));var deskjs=require(_0x64d4('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x64d4('0x10'));var as=require(_0x64d4('0x11'));var hardwareService=require(_0x64d4('0x12'));var logger=require(_0x64d4('0x13'))(_0x64d4('0x14'));var utils=require(_0x64d4('0x15'));var config=require(_0x64d4('0x16'));var licenseUtil=require(_0x64d4('0x17'));var db=require(_0x64d4('0x18'))['db'];function respondWithStatusCode(_0x4a4cbe,_0x3d3b97){_0x3d3b97=_0x3d3b97||0xcc;return function(_0x553f90){if(_0x553f90){return _0x4a4cbe[_0x64d4('0x19')](_0x3d3b97);}return _0x4a4cbe[_0x64d4('0x1a')](_0x3d3b97)[_0x64d4('0x1b')]();};}function respondWithResult(_0x4762a9,_0x13b111){_0x13b111=_0x13b111||0xc8;return function(_0x2b0c39){if(_0x2b0c39){return _0x4762a9['status'](_0x13b111)[_0x64d4('0x1c')](_0x2b0c39);}};}function respondWithFilteredResult(_0x433af8,_0x4574c2){return function(_0x3a25a3){if(_0x3a25a3){var _0x1b005a=typeof _0x4574c2[_0x64d4('0x1d')]===_0x64d4('0x1e')&&typeof _0x4574c2['limit']===_0x64d4('0x1e');var _0x260561=_0x3a25a3['count'];var _0x1bbaf0=_0x1b005a?0x0:_0x4574c2[_0x64d4('0x1d')];var _0x13900e=_0x1b005a?_0x3a25a3[_0x64d4('0x1f')]:_0x4574c2[_0x64d4('0x1d')]+_0x4574c2[_0x64d4('0x20')];var _0x1b2516;if(_0x13900e>=_0x260561){_0x13900e=_0x260561;_0x1b2516=0xc8;}else{_0x1b2516=0xce;}_0x433af8[_0x64d4('0x1a')](_0x1b2516);return _0x433af8['set'](_0x64d4('0x21'),_0x1bbaf0+'-'+_0x13900e+'/'+_0x260561)[_0x64d4('0x1c')](_0x3a25a3);}return null;};}function patchUpdates(_0x35ee04){return function(_0xf6e129){try{jsonpatch['apply'](_0xf6e129,_0x35ee04,!![]);}catch(_0x4d9f29){return BPromise[_0x64d4('0x22')](_0x4d9f29);}return _0xf6e129[_0x64d4('0x23')]();};}function saveUpdates(_0x374119,_0x4c0b0b){return function(_0x3c7a8c){if(_0x3c7a8c){return _0x3c7a8c[_0x64d4('0x24')](_0x374119)[_0x64d4('0x25')](function(_0x3259a0){return _0x3259a0;});}return null;};}function removeEntity(_0x157639,_0x2fec7d){return function(_0x4b8b72){if(_0x4b8b72){return _0x4b8b72[_0x64d4('0x26')]()[_0x64d4('0x25')](function(){_0x157639[_0x64d4('0x1a')](0xcc)[_0x64d4('0x1b')]();});}};}function handleEntityNotFound(_0x4ee0b9,_0x494640){return function(_0x598457){if(!_0x598457){_0x4ee0b9[_0x64d4('0x19')](0x194);}return _0x598457;};}function handleError(_0x58d1e8,_0x24c45e){_0x24c45e=_0x24c45e||0x1f4;return function(_0x512d67){logger[_0x64d4('0x27')](_0x512d67[_0x64d4('0x28')]);if(_0x512d67[_0x64d4('0x29')]){delete _0x512d67[_0x64d4('0x29')];}_0x58d1e8[_0x64d4('0x1a')](_0x24c45e)['send'](_0x512d67);};}exports['index']=function(_0x3865ef,_0x2a38b4){var _0x236691={},_0x18e1b1={},_0x77912e={'count':0x0,'rows':[]};var _0x1c3347=_[_0x64d4('0x2a')](db['FaxQueueReport']['rawAttributes'],function(_0x184813){return{'name':_0x184813[_0x64d4('0x2b')],'type':_0x184813['type'][_0x64d4('0x2c')]};});_0x18e1b1[_0x64d4('0x2d')]=_[_0x64d4('0x2a')](_0x1c3347,_0x64d4('0x29'));_0x18e1b1[_0x64d4('0x2e')]=_['keys'](_0x3865ef[_0x64d4('0x2e')]);_0x18e1b1['filters']=_['intersection'](_0x18e1b1[_0x64d4('0x2d')],_0x18e1b1[_0x64d4('0x2e')]);_0x236691['attributes']=_[_0x64d4('0x2f')](_0x18e1b1['model'],qs[_0x64d4('0x30')](_0x3865ef[_0x64d4('0x2e')]['fields']));_0x236691['attributes']=_0x236691[_0x64d4('0x31')][_0x64d4('0x32')]?_0x236691[_0x64d4('0x31')]:_0x18e1b1[_0x64d4('0x2d')];if(!_0x3865ef[_0x64d4('0x2e')]['hasOwnProperty'](_0x64d4('0x33'))){_0x236691[_0x64d4('0x20')]=qs[_0x64d4('0x20')](_0x3865ef['query']['limit']);_0x236691[_0x64d4('0x1d')]=qs[_0x64d4('0x1d')](_0x3865ef[_0x64d4('0x2e')][_0x64d4('0x1d')]);}_0x236691[_0x64d4('0x34')]=qs[_0x64d4('0x35')](_0x3865ef['query']['sort']);_0x236691[_0x64d4('0x36')]=qs[_0x64d4('0x37')](_['pick'](_0x3865ef['query'],_0x18e1b1[_0x64d4('0x37')]),_0x1c3347);if(_0x3865ef['query']['filter']){_0x236691['where']=_['merge'](_0x236691[_0x64d4('0x36')],{'$or':_[_0x64d4('0x2a')](_0x1c3347,function(_0xa9f459){if(_0xa9f459[_0x64d4('0x38')]!==_0x64d4('0x39')){var _0x130dba={};_0x130dba[_0xa9f459['name']]={'$like':'%'+_0x3865ef[_0x64d4('0x2e')][_0x64d4('0x3a')]+'%'};return _0x130dba;}})});}_0x236691=_[_0x64d4('0x3b')]({},_0x236691,_0x3865ef[_0x64d4('0x3c')]);var _0x2fd846={'where':_0x236691[_0x64d4('0x36')]};return db[_0x64d4('0x3d')][_0x64d4('0x1f')](_0x2fd846)['then'](function(_0x107871){_0x77912e['count']=_0x107871;if(_0x3865ef[_0x64d4('0x2e')]['includeAll']){_0x236691[_0x64d4('0x3e')]=[{'all':!![]}];}return db['FaxQueueReport']['findAll'](_0x236691);})[_0x64d4('0x25')](function(_0x463bf0){_0x77912e[_0x64d4('0x3f')]=_0x463bf0;return _0x77912e;})[_0x64d4('0x25')](respondWithFilteredResult(_0x2a38b4,_0x236691))[_0x64d4('0x40')](handleError(_0x2a38b4,null));};exports[_0x64d4('0x41')]=function(_0x11577b,_0xd99afd){var _0x2ccb14={'raw':!![],'where':{'id':_0x11577b[_0x64d4('0x42')]['id']}},_0x5f0213={};_0x5f0213[_0x64d4('0x2d')]=_[_0x64d4('0x43')](db[_0x64d4('0x3d')]['rawAttributes']);_0x5f0213[_0x64d4('0x2e')]=_[_0x64d4('0x43')](_0x11577b['query']);_0x5f0213['filters']=_[_0x64d4('0x2f')](_0x5f0213['model'],_0x5f0213[_0x64d4('0x2e')]);_0x2ccb14['attributes']=_[_0x64d4('0x2f')](_0x5f0213[_0x64d4('0x2d')],qs[_0x64d4('0x30')](_0x11577b['query'][_0x64d4('0x30')]));_0x2ccb14[_0x64d4('0x31')]=_0x2ccb14[_0x64d4('0x31')][_0x64d4('0x32')]?_0x2ccb14[_0x64d4('0x31')]:_0x5f0213[_0x64d4('0x2d')];if(_0x11577b['query'][_0x64d4('0x44')]){_0x2ccb14[_0x64d4('0x3e')]=[{'all':!![]}];}_0x2ccb14=_[_0x64d4('0x3b')]({},_0x2ccb14,_0x11577b[_0x64d4('0x3c')]);return db['FaxQueueReport'][_0x64d4('0x45')](_0x2ccb14)[_0x64d4('0x25')](handleEntityNotFound(_0xd99afd,null))[_0x64d4('0x25')](respondWithResult(_0xd99afd,null))[_0x64d4('0x40')](handleError(_0xd99afd,null));};exports['create']=function(_0x49930e,_0x38d59f){return db[_0x64d4('0x3d')]['create'](_0x49930e[_0x64d4('0x46')],{})[_0x64d4('0x25')](respondWithResult(_0x38d59f,0xc9))[_0x64d4('0x40')](handleError(_0x38d59f,null));};exports[_0x64d4('0x24')]=function(_0x4b3c17,_0x46bd77){if(_0x4b3c17[_0x64d4('0x46')]['id']){delete _0x4b3c17[_0x64d4('0x46')]['id'];}return db[_0x64d4('0x3d')][_0x64d4('0x45')]({'where':{'id':_0x4b3c17['params']['id']}})[_0x64d4('0x25')](handleEntityNotFound(_0x46bd77,null))[_0x64d4('0x25')](saveUpdates(_0x4b3c17['body'],null))[_0x64d4('0x25')](respondWithResult(_0x46bd77,null))[_0x64d4('0x40')](handleError(_0x46bd77,null));};exports[_0x64d4('0x26')]=function(_0x5829e6,_0x11ed80){return db['FaxQueueReport'][_0x64d4('0x45')]({'where':{'id':_0x5829e6[_0x64d4('0x42')]['id']}})[_0x64d4('0x25')](handleEntityNotFound(_0x11ed80,null))[_0x64d4('0x25')](removeEntity(_0x11ed80,null))[_0x64d4('0x40')](handleError(_0x11ed80,null));};exports[_0x64d4('0x47')]=function(_0x3f228a,_0x5a7677){return db['FaxQueueReport']['describe']()[_0x64d4('0x25')](respondWithResult(_0x5a7677,null))[_0x64d4('0x40')](handleError(_0x5a7677,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index f19fde5..8ec0431 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 _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 +var _0x7217=['api','moment','bluebird','request-promise','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','uniqueid','lodash','../../config/logger'];(function(_0x50798b,_0x22ccf8){var _0x4b1d26=function(_0x26107f){while(--_0x26107f){_0x50798b['push'](_0x50798b['shift']());}};_0x4b1d26(++_0x22ccf8);}(_0x7217,0x19e));var _0x7721=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x7217[_0x4fc9e6];return _0x551d28;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[{'name':_0x7721('0xc'),'fields':[_0x7721('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index ee695d5..805293e 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 _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 +var _0xa866=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FaxQueueReport,\x20%s,\x20%s','message','info','catch','FaxQueueReport','create','body','options','raw','CreateFaxQueueReport','UpdateFaxQueueReport','where','attributes','lodash','bluebird'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0xa866,0x1b0));var _0x6a86=function(_0x4ce2d0,_0x24dd7a){_0x4ce2d0=_0x4ce2d0-0x0;var _0x342656=_0xa866[_0x4ce2d0];return _0x342656;};'use strict';var _=require(_0x6a86('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6a86('0x1'));var rs=require(_0x6a86('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6a86('0x3'))['db'];var utils=require(_0x6a86('0x4'));var logger=require(_0x6a86('0x5'))(_0x6a86('0x6'));var config=require('../../config/environment');var jayson=require(_0x6a86('0x7'));var client=jayson[_0x6a86('0x8')][_0x6a86('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d0d6e,_0x8c9fc0,_0x10b61a){return new BPromise(function(_0x235659,_0x2dd460){return client[_0x6a86('0xa')](_0x4d0d6e,_0x10b61a)[_0x6a86('0xb')](function(_0x34a719){logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x8c9fc0,'request\x20sent');logger[_0x6a86('0xc')](_0x6a86('0xd'),_0x8c9fc0,_0x6a86('0xe'),JSON[_0x6a86('0xf')](_0x34a719));if(_0x34a719[_0x6a86('0x10')]){if(_0x34a719[_0x6a86('0x10')][_0x6a86('0x11')]===0x1f4){logger[_0x6a86('0x10')](_0x6a86('0x12'),_0x8c9fc0,_0x34a719[_0x6a86('0x10')]['message']);return _0x2dd460(_0x34a719['error'][_0x6a86('0x13')]);}logger[_0x6a86('0x10')]('FaxQueueReport,\x20%s,\x20%s',_0x8c9fc0,_0x34a719[_0x6a86('0x10')][_0x6a86('0x13')]);return _0x235659(_0x34a719[_0x6a86('0x10')][_0x6a86('0x13')]);}else{logger[_0x6a86('0x14')]('FaxQueueReport,\x20%s,\x20%s',_0x8c9fc0,_0x6a86('0xe'));_0x235659(_0x34a719['result'][_0x6a86('0x13')]);}})[_0x6a86('0x15')](function(_0x5172a3){logger['error'](_0x6a86('0x12'),_0x8c9fc0,_0x5172a3);_0x2dd460(_0x5172a3);});});}exports['CreateFaxQueueReport']=function(_0x131a5f){var _0x4a9356=this;return new Promise(function(_0x44ab2f,_0x525eb1){return db[_0x6a86('0x16')][_0x6a86('0x17')](_0x131a5f[_0x6a86('0x18')],{'raw':_0x131a5f[_0x6a86('0x19')]?_0x131a5f[_0x6a86('0x19')][_0x6a86('0x1a')]===undefined?!![]:![]:!![]})[_0x6a86('0xb')](function(_0x49f3d0){logger['info'](_0x6a86('0x1b'),_0x131a5f);logger[_0x6a86('0xc')](_0x6a86('0x1b'),_0x131a5f,JSON['stringify'](_0x49f3d0));_0x44ab2f(_0x49f3d0);})[_0x6a86('0x15')](function(_0x8f480f){logger['error']('CreateFaxQueueReport',_0x8f480f[_0x6a86('0x13')],_0x131a5f);_0x525eb1(_0x4a9356[_0x6a86('0x10')](0x1f4,_0x8f480f[_0x6a86('0x13')]));});});};exports[_0x6a86('0x1c')]=function(_0x133753){var _0x3c48b8=this;return new Promise(function(_0x18ef5f,_0x41199e){return db['FaxQueueReport']['update'](_0x133753['body'],{'raw':_0x133753[_0x6a86('0x19')]?_0x133753[_0x6a86('0x19')][_0x6a86('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x133753[_0x6a86('0x19')]?_0x133753[_0x6a86('0x19')][_0x6a86('0x1d')]||null:null,'attributes':_0x133753[_0x6a86('0x19')]?_0x133753['options'][_0x6a86('0x1e')]||null:null,'limit':_0x133753[_0x6a86('0x19')]?_0x133753[_0x6a86('0x19')]['limit']||null:null})[_0x6a86('0xb')](function(_0x1ff062){logger['info']('UpdateFaxQueueReport',_0x133753);logger[_0x6a86('0xc')](_0x6a86('0x1c'),_0x133753,JSON['stringify'](_0x1ff062));_0x18ef5f(_0x1ff062);})[_0x6a86('0x15')](function(_0x1bc358){logger[_0x6a86('0x10')](_0x6a86('0x1c'),_0x1bc358[_0x6a86('0x13')],_0x133753);_0x41199e(_0x3c48b8[_0x6a86('0x10')](0x1f4,_0x1bc358[_0x6a86('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 4b07c18..32ca972 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 _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 +var _0xc60b=['put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./faxQueueReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','create'];(function(_0x437a5a,_0x1c3dd1){var _0xe92813=function(_0x537e4b){while(--_0x537e4b){_0x437a5a['push'](_0x437a5a['shift']());}};_0xe92813(++_0x1c3dd1);}(_0xc60b,0x115));var _0xbc60=function(_0x18c0e9,_0xd1e861){_0x18c0e9=_0x18c0e9-0x0;var _0x5733c2=_0xc60b[_0x18c0e9];return _0x5733c2;};'use strict';var multer=require(_0xbc60('0x0'));var util=require(_0xbc60('0x1'));var path=require(_0xbc60('0x2'));var timeout=require(_0xbc60('0x3'));var express=require(_0xbc60('0x4'));var router=express[_0xbc60('0x5')]();var fs_extra=require(_0xbc60('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xbc60('0x7'));var config=require('../../config/environment');var controller=require(_0xbc60('0x8'));router[_0xbc60('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xbc60('0x9')](_0xbc60('0xa'),auth[_0xbc60('0xb')](),controller[_0xbc60('0xc')]);router[_0xbc60('0x9')](_0xbc60('0xd'),auth[_0xbc60('0xb')](),controller[_0xbc60('0xe')]);router[_0xbc60('0xf')]('/',auth[_0xbc60('0xb')](),controller[_0xbc60('0x10')]);router[_0xbc60('0x11')]('/:id',auth[_0xbc60('0xb')](),controller[_0xbc60('0x12')]);router['delete']('/:id',auth[_0xbc60('0xb')](),controller[_0xbc60('0x13')]);module[_0xbc60('0x14')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 0bd70d5..85bd9e8 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 _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 +var _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x4a7ca6,_0x2d746c){var _0x2365ef=function(_0x3dfec7){while(--_0x3dfec7){_0x4a7ca6['push'](_0x4a7ca6['shift']());}};_0x2365ef(++_0x2d746c);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x2f1a6e,_0x3082cb){_0x2f1a6e=_0x2f1a6e-0x0;var _0x5865e5=_0xf3cd[_0x2f1a6e];return _0x5865e5;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index f0a03db..9660ef7 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 _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 +var _0x3f36=['rows','catch','show','options','find','create','update','body','params','describe','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','model','map','keys','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','pick','filters','filter','where','merge','VIRTUAL','includeAll','include','FaxTransferReport','findAll'];(function(_0x308fd3,_0x1a6b69){var _0x2859d5=function(_0x5e77af){while(--_0x5e77af){_0x308fd3['push'](_0x308fd3['shift']());}};_0x2859d5(++_0x1a6b69);}(_0x3f36,0x136));var _0x63f3=function(_0x5d7227,_0x12aebe){_0x5d7227=_0x5d7227-0x0;var _0x15ac55=_0x3f36[_0x5d7227];return _0x15ac55;};'use strict';var emlformat=require(_0x63f3('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x63f3('0x1'));var moment=require(_0x63f3('0x2'));var BPromise=require(_0x63f3('0x3'));var Mustache=require(_0x63f3('0x4'));var util=require(_0x63f3('0x5'));var path=require(_0x63f3('0x6'));var sox=require(_0x63f3('0x7'));var csv=require(_0x63f3('0x8'));var ejs=require(_0x63f3('0x9'));var fs=require('fs');var fs_extra=require(_0x63f3('0xa'));var _=require(_0x63f3('0xb'));var squel=require(_0x63f3('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x63f3('0xd'));var toCsv=require(_0x63f3('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x63f3('0xe'));var qs=require(_0x63f3('0xf'));var as=require(_0x63f3('0x10'));var hardwareService=require(_0x63f3('0x11'));var logger=require(_0x63f3('0x12'))(_0x63f3('0x13'));var utils=require('../../config/utils');var config=require(_0x63f3('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x526429,_0x86ed54){_0x86ed54=_0x86ed54||0xcc;return function(_0x4430cf){if(_0x4430cf){return _0x526429[_0x63f3('0x15')](_0x86ed54);}return _0x526429[_0x63f3('0x16')](_0x86ed54)[_0x63f3('0x17')]();};}function respondWithResult(_0x27a5ab,_0x521d0a){_0x521d0a=_0x521d0a||0xc8;return function(_0x395430){if(_0x395430){return _0x27a5ab['status'](_0x521d0a)[_0x63f3('0x18')](_0x395430);}};}function respondWithFilteredResult(_0x46c33e,_0x15d20f){return function(_0x25d609){if(_0x25d609){var _0x143139=typeof _0x15d20f[_0x63f3('0x19')]==='undefined'&&typeof _0x15d20f[_0x63f3('0x1a')]===_0x63f3('0x1b');var _0x2356a0=_0x25d609[_0x63f3('0x1c')];var _0x2b6e24=_0x143139?0x0:_0x15d20f[_0x63f3('0x19')];var _0x5d7dab=_0x143139?_0x25d609[_0x63f3('0x1c')]:_0x15d20f[_0x63f3('0x19')]+_0x15d20f[_0x63f3('0x1a')];var _0x10243c;if(_0x5d7dab>=_0x2356a0){_0x5d7dab=_0x2356a0;_0x10243c=0xc8;}else{_0x10243c=0xce;}_0x46c33e[_0x63f3('0x16')](_0x10243c);return _0x46c33e[_0x63f3('0x1d')](_0x63f3('0x1e'),_0x2b6e24+'-'+_0x5d7dab+'/'+_0x2356a0)[_0x63f3('0x18')](_0x25d609);}return null;};}function patchUpdates(_0x2a84ef){return function(_0x104e4e){try{jsonpatch[_0x63f3('0x1f')](_0x104e4e,_0x2a84ef,!![]);}catch(_0x13da53){return BPromise[_0x63f3('0x20')](_0x13da53);}return _0x104e4e[_0x63f3('0x21')]();};}function saveUpdates(_0x3c11ae,_0x72bb1b){return function(_0x557d09){if(_0x557d09){return _0x557d09['update'](_0x3c11ae)[_0x63f3('0x22')](function(_0x1af50d){return _0x1af50d;});}return null;};}function removeEntity(_0x2f4b40,_0x4f5831){return function(_0x3e70b5){if(_0x3e70b5){return _0x3e70b5[_0x63f3('0x23')]()['then'](function(){_0x2f4b40[_0x63f3('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39d833,_0x30a021){return function(_0x5b92ac){if(!_0x5b92ac){_0x39d833[_0x63f3('0x15')](0x194);}return _0x5b92ac;};}function handleError(_0x465378,_0x559ba8){_0x559ba8=_0x559ba8||0x1f4;return function(_0x414ab0){logger[_0x63f3('0x24')](_0x414ab0[_0x63f3('0x25')]);if(_0x414ab0[_0x63f3('0x26')]){delete _0x414ab0[_0x63f3('0x26')];}_0x465378[_0x63f3('0x16')](_0x559ba8)[_0x63f3('0x27')](_0x414ab0);};}exports[_0x63f3('0x28')]=function(_0x47acd8,_0x342f9e){var _0x44fe41={},_0x1aada9={},_0x4686f3={'count':0x0,'rows':[]};var _0x4cf505=_['map'](db['FaxTransferReport'][_0x63f3('0x29')],function(_0x2f03c8){return{'name':_0x2f03c8[_0x63f3('0x2a')],'type':_0x2f03c8[_0x63f3('0x2b')]['key']};});_0x1aada9[_0x63f3('0x2c')]=_[_0x63f3('0x2d')](_0x4cf505,_0x63f3('0x26'));_0x1aada9['query']=_[_0x63f3('0x2e')](_0x47acd8['query']);_0x1aada9['filters']=_[_0x63f3('0x2f')](_0x1aada9[_0x63f3('0x2c')],_0x1aada9[_0x63f3('0x30')]);_0x44fe41[_0x63f3('0x31')]=_[_0x63f3('0x2f')](_0x1aada9[_0x63f3('0x2c')],qs[_0x63f3('0x32')](_0x47acd8['query'][_0x63f3('0x32')]));_0x44fe41[_0x63f3('0x31')]=_0x44fe41[_0x63f3('0x31')][_0x63f3('0x33')]?_0x44fe41[_0x63f3('0x31')]:_0x1aada9[_0x63f3('0x2c')];if(!_0x47acd8[_0x63f3('0x30')][_0x63f3('0x34')]('nolimit')){_0x44fe41[_0x63f3('0x1a')]=qs[_0x63f3('0x1a')](_0x47acd8[_0x63f3('0x30')][_0x63f3('0x1a')]);_0x44fe41['offset']=qs[_0x63f3('0x19')](_0x47acd8[_0x63f3('0x30')]['offset']);}_0x44fe41[_0x63f3('0x35')]=qs[_0x63f3('0x36')](_0x47acd8[_0x63f3('0x30')]['sort']);_0x44fe41['where']=qs['filters'](_[_0x63f3('0x37')](_0x47acd8[_0x63f3('0x30')],_0x1aada9[_0x63f3('0x38')]),_0x4cf505);if(_0x47acd8['query'][_0x63f3('0x39')]){_0x44fe41[_0x63f3('0x3a')]=_[_0x63f3('0x3b')](_0x44fe41[_0x63f3('0x3a')],{'$or':_[_0x63f3('0x2d')](_0x4cf505,function(_0x5b2196){if(_0x5b2196[_0x63f3('0x2b')]!==_0x63f3('0x3c')){var _0x4a2241={};_0x4a2241[_0x5b2196['name']]={'$like':'%'+_0x47acd8['query']['filter']+'%'};return _0x4a2241;}})});}_0x44fe41=_[_0x63f3('0x3b')]({},_0x44fe41,_0x47acd8['options']);var _0x4c04e5={'where':_0x44fe41['where']};return db['FaxTransferReport'][_0x63f3('0x1c')](_0x4c04e5)[_0x63f3('0x22')](function(_0x185272){_0x4686f3['count']=_0x185272;if(_0x47acd8[_0x63f3('0x30')][_0x63f3('0x3d')]){_0x44fe41[_0x63f3('0x3e')]=[{'all':!![]}];}return db[_0x63f3('0x3f')][_0x63f3('0x40')](_0x44fe41);})[_0x63f3('0x22')](function(_0x9e669){_0x4686f3[_0x63f3('0x41')]=_0x9e669;return _0x4686f3;})[_0x63f3('0x22')](respondWithFilteredResult(_0x342f9e,_0x44fe41))[_0x63f3('0x42')](handleError(_0x342f9e,null));};exports[_0x63f3('0x43')]=function(_0x418cde,_0x4b061f){var _0x172e2c={'raw':!![],'where':{'id':_0x418cde['params']['id']}},_0xa37e22={};_0xa37e22[_0x63f3('0x2c')]=_['keys'](db[_0x63f3('0x3f')][_0x63f3('0x29')]);_0xa37e22[_0x63f3('0x30')]=_[_0x63f3('0x2e')](_0x418cde[_0x63f3('0x30')]);_0xa37e22[_0x63f3('0x38')]=_[_0x63f3('0x2f')](_0xa37e22[_0x63f3('0x2c')],_0xa37e22['query']);_0x172e2c[_0x63f3('0x31')]=_[_0x63f3('0x2f')](_0xa37e22[_0x63f3('0x2c')],qs[_0x63f3('0x32')](_0x418cde[_0x63f3('0x30')][_0x63f3('0x32')]));_0x172e2c[_0x63f3('0x31')]=_0x172e2c[_0x63f3('0x31')]['length']?_0x172e2c[_0x63f3('0x31')]:_0xa37e22[_0x63f3('0x2c')];if(_0x418cde[_0x63f3('0x30')][_0x63f3('0x3d')]){_0x172e2c[_0x63f3('0x3e')]=[{'all':!![]}];}_0x172e2c=_['merge']({},_0x172e2c,_0x418cde[_0x63f3('0x44')]);return db[_0x63f3('0x3f')][_0x63f3('0x45')](_0x172e2c)[_0x63f3('0x22')](handleEntityNotFound(_0x4b061f,null))[_0x63f3('0x22')](respondWithResult(_0x4b061f,null))[_0x63f3('0x42')](handleError(_0x4b061f,null));};exports[_0x63f3('0x46')]=function(_0xb3323a,_0x5c0444){return db[_0x63f3('0x3f')][_0x63f3('0x46')](_0xb3323a['body'],{})[_0x63f3('0x22')](respondWithResult(_0x5c0444,0xc9))[_0x63f3('0x42')](handleError(_0x5c0444,null));};exports[_0x63f3('0x47')]=function(_0x3627f5,_0x4ac2c3){if(_0x3627f5[_0x63f3('0x48')]['id']){delete _0x3627f5[_0x63f3('0x48')]['id'];}return db[_0x63f3('0x3f')][_0x63f3('0x45')]({'where':{'id':_0x3627f5[_0x63f3('0x49')]['id']}})[_0x63f3('0x22')](handleEntityNotFound(_0x4ac2c3,null))[_0x63f3('0x22')](saveUpdates(_0x3627f5[_0x63f3('0x48')],null))[_0x63f3('0x22')](respondWithResult(_0x4ac2c3,null))[_0x63f3('0x42')](handleError(_0x4ac2c3,null));};exports[_0x63f3('0x23')]=function(_0xaa37e9,_0x4e1da8){return db[_0x63f3('0x3f')][_0x63f3('0x45')]({'where':{'id':_0xaa37e9[_0x63f3('0x49')]['id']}})[_0x63f3('0x22')](handleEntityNotFound(_0x4e1da8,null))['then'](removeEntity(_0x4e1da8,null))[_0x63f3('0x42')](handleError(_0x4e1da8,null));};exports[_0x63f3('0x4a')]=function(_0x51a24e,_0x4ce979){return db[_0x63f3('0x3f')][_0x63f3('0x4a')]()['then'](respondWithResult(_0x4ce979,null))[_0x63f3('0x42')](handleError(_0x4ce979,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index d72cd12..f3feaaa 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 _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 +var _0x37e9=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxTransferReport.attributes','exports','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0xabc9cd,_0x5ebbf5){var _0x20e840=function(_0x317cad){while(--_0x317cad){_0xabc9cd['push'](_0xabc9cd['shift']());}};_0x20e840(++_0x5ebbf5);}(_0x37e9,0x1e7));var _0x937e=function(_0x5c4a19,_0x2e8a2d){_0x5c4a19=_0x5c4a19-0x0;var _0xdb489b=_0x37e9[_0x5c4a19];return _0xdb489b;};'use strict';var _=require(_0x937e('0x0'));var util=require(_0x937e('0x1'));var logger=require(_0x937e('0x2'))(_0x937e('0x3'));var moment=require(_0x937e('0x4'));var BPromise=require(_0x937e('0x5'));var rp=require(_0x937e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x937e('0x7'));var config=require(_0x937e('0x8'));var attributes=require(_0x937e('0x9'));module[_0x937e('0xa')]=function(_0x15051b,_0x19ab09){return _0x15051b['define'](_0x937e('0xb'),attributes,{'tableName':_0x937e('0xc'),'paranoid':![],'indexes':[{'name':_0x937e('0xd'),'fields':[_0x937e('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index b03e98c..d8aba2a 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 _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 +var _0xda3f=['FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x1b7368,_0x3286ed){var _0x25d54c=function(_0x2366da){while(--_0x2366da){_0x1b7368['push'](_0x1b7368['shift']());}};_0x25d54c(++_0x3286ed);}(_0xda3f,0x1ed));var _0xfda3=function(_0x2b1e6e,_0x3853e1){_0x2b1e6e=_0x2b1e6e-0x0;var _0x51b535=_0xda3f[_0x2b1e6e];return _0x51b535;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require(_0xfda3('0x2'));var rs=require(_0xfda3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x4'))['db'];var utils=require(_0xfda3('0x5'));var logger=require(_0xfda3('0x6'))(_0xfda3('0x7'));var config=require(_0xfda3('0x8'));var jayson=require(_0xfda3('0x9'));var client=jayson['client'][_0xfda3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x51a851,_0x3dd93d,_0x28b33f){return new BPromise(function(_0x4c27dc,_0x375d73){return client[_0xfda3('0xb')](_0x51a851,_0x28b33f)[_0xfda3('0xc')](function(_0x1b92bc){logger['info'](_0xfda3('0xd'),_0x3dd93d,_0xfda3('0xe'));logger[_0xfda3('0xf')](_0xfda3('0x10'),_0x3dd93d,_0xfda3('0xe'),JSON[_0xfda3('0x11')](_0x1b92bc));if(_0x1b92bc[_0xfda3('0x12')]){if(_0x1b92bc['error']['code']===0x1f4){logger[_0xfda3('0x12')]('FaxTransferReport,\x20%s,\x20%s',_0x3dd93d,_0x1b92bc['error']['message']);return _0x375d73(_0x1b92bc[_0xfda3('0x12')][_0xfda3('0x13')]);}logger[_0xfda3('0x12')](_0xfda3('0xd'),_0x3dd93d,_0x1b92bc[_0xfda3('0x12')][_0xfda3('0x13')]);return _0x4c27dc(_0x1b92bc[_0xfda3('0x12')][_0xfda3('0x13')]);}else{logger[_0xfda3('0x14')]('FaxTransferReport,\x20%s,\x20%s',_0x3dd93d,_0xfda3('0xe'));_0x4c27dc(_0x1b92bc[_0xfda3('0x15')][_0xfda3('0x13')]);}})['catch'](function(_0x9469ed){logger['error'](_0xfda3('0xd'),_0x3dd93d,_0x9469ed);_0x375d73(_0x9469ed);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 4014680..60a17cc 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 _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 +var _0xe950=['isAuthenticated','/:id','show','create','put','delete','destroy','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','/describe'];(function(_0x1cb18a,_0x33167a){var _0x22442e=function(_0x46c611){while(--_0x46c611){_0x1cb18a['push'](_0x1cb18a['shift']());}};_0x22442e(++_0x33167a);}(_0xe950,0xce));var _0x0e95=function(_0x5b5569,_0x4c1c26){_0x5b5569=_0x5b5569-0x0;var _0x49edc1=_0xe950[_0x5b5569];return _0x49edc1;};'use strict';var multer=require('multer');var util=require(_0x0e95('0x0'));var path=require(_0x0e95('0x1'));var timeout=require(_0x0e95('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0e95('0x3'));var auth=require(_0x0e95('0x4'));var interaction=require(_0x0e95('0x5'));var config=require(_0x0e95('0x6'));var controller=require(_0x0e95('0x7'));router[_0x0e95('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0e95('0x8')](_0x0e95('0x9'),auth[_0x0e95('0xa')](),controller['describe']);router[_0x0e95('0x8')](_0x0e95('0xb'),auth[_0x0e95('0xa')](),controller[_0x0e95('0xc')]);router['post']('/',auth[_0x0e95('0xa')](),controller[_0x0e95('0xd')]);router[_0x0e95('0xe')](_0x0e95('0xb'),auth[_0x0e95('0xa')](),controller['update']);router[_0x0e95('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x0e95('0x10')]);module[_0x0e95('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 53bec19..fd2976a 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 _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 +var _0xfb46=['put','update','delete','destroy','multer','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','index','/:id','isAuthenticated','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration'];(function(_0x5b8919,_0x3d2103){var _0x5baa5b=function(_0x406c5e){while(--_0x406c5e){_0x5b8919['push'](_0x5b8919['shift']());}};_0x5baa5b(++_0x3d2103);}(_0xfb46,0xca));var _0x6fb4=function(_0x238830,_0x545f75){_0x238830=_0x238830-0x0;var _0x5917f0=_0xfb46[_0x238830];return _0x5917f0;};'use strict';var multer=require(_0x6fb4('0x0'));var util=require('util');var path=require(_0x6fb4('0x1'));var timeout=require(_0x6fb4('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x6fb4('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x6fb4('0x4'));var config=require(_0x6fb4('0x5'));var controller=require(_0x6fb4('0x6'));router[_0x6fb4('0x7')]('/',auth['isAuthenticated'](),controller[_0x6fb4('0x8')]);router[_0x6fb4('0x7')](_0x6fb4('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x6fb4('0x7')]('/:id/configurations',auth[_0x6fb4('0xa')](),controller[_0x6fb4('0xb')]);router[_0x6fb4('0x7')](_0x6fb4('0xc'),auth['isAuthenticated'](),controller[_0x6fb4('0xd')]);router[_0x6fb4('0xe')]('/',auth[_0x6fb4('0xa')](),controller[_0x6fb4('0xf')]);router[_0x6fb4('0xe')](_0x6fb4('0x10'),auth[_0x6fb4('0xa')](),controller[_0x6fb4('0x11')]);router[_0x6fb4('0x12')]('/:id',auth[_0x6fb4('0xa')](),controller[_0x6fb4('0x13')]);router[_0x6fb4('0x14')](_0x6fb4('0x9'),auth[_0x6fb4('0xa')](),controller[_0x6fb4('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index c17c33a..dbeb130 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 _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 +var _0x2f99=['ENUM','basic','integrationTab','sequelize','exports','STRING'];(function(_0x11a4e6,_0x189389){var _0x5607ef=function(_0x31786b){while(--_0x31786b){_0x11a4e6['push'](_0x11a4e6['shift']());}};_0x5607ef(++_0x189389);}(_0x2f99,0x165));var _0x92f9=function(_0x35fc19,_0x4d538f){_0x35fc19=_0x35fc19-0x0;var _0x52233f=_0x2f99[_0x35fc19];return _0x52233f;};'use strict';var Sequelize=require(_0x92f9('0x0'));module[_0x92f9('0x1')]={'name':{'type':Sequelize[_0x92f9('0x2')]},'description':{'type':Sequelize[_0x92f9('0x2')]},'username':{'type':Sequelize[_0x92f9('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0x92f9('0x3')](_0x92f9('0x4')),'defaultValue':_0x92f9('0x4')},'password':{'type':Sequelize[_0x92f9('0x2')]},'consumerKey':{'type':Sequelize[_0x92f9('0x2')]},'consumerSecret':{'type':Sequelize[_0x92f9('0x2')]},'token':{'type':Sequelize[_0x92f9('0x2')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x92f9('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x92f9('0x5'),'newTab'),'defaultValue':_0x92f9('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 37e8dbc..6d2aee3 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 _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 +var _0xf40e=['active','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','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','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','update','then','error','send','index','rawAttributes','fieldName','key','model','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','map','type','options','DeskAccount','includeAll','include','findAll','catch','show','params','length','find','create','body','destroy','getConfigurations','DeskConfiguration','order','nolimit','addConfiguration','findOne','AccountId','Subjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','substring','GET','format','%s/custom_fields','application/json','basic','Authorization','Basic\x20%s','%s:%s','username','toString','base64','concat','_embedded'];(function(_0x2f0bed,_0x4911f1){var _0x31fa87=function(_0x1de2fc){while(--_0x1de2fc){_0x2f0bed['push'](_0x2f0bed['shift']());}};_0x31fa87(++_0x4911f1);}(_0xf40e,0x1d2));var _0xef40=function(_0x3d749d,_0x196a29){_0x3d749d=_0x3d749d-0x0;var _0x39e159=_0xf40e[_0x3d749d];return _0x39e159;};'use strict';var emlformat=require(_0xef40('0x0'));var rimraf=require(_0xef40('0x1'));var zipdir=require(_0xef40('0x2'));var jsonpatch=require(_0xef40('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xef40('0x4'));var Mustache=require(_0xef40('0x5'));var util=require(_0xef40('0x6'));var path=require(_0xef40('0x7'));var sox=require(_0xef40('0x8'));var csv=require(_0xef40('0x9'));var ejs=require(_0xef40('0xa'));var fs=require('fs');var fs_extra=require(_0xef40('0xb'));var _=require('lodash');var squel=require(_0xef40('0xc'));var crypto=require(_0xef40('0xd'));var jsforce=require(_0xef40('0xe'));var deskjs=require(_0xef40('0xf'));var toCsv=require('to-csv');var querystring=require(_0xef40('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xef40('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xef40('0x12'));var hardwareService=require(_0xef40('0x13'));var logger=require(_0xef40('0x14'))(_0xef40('0x15'));var utils=require(_0xef40('0x16'));var config=require(_0xef40('0x17'));var licenseUtil=require(_0xef40('0x18'));var db=require(_0xef40('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1b37da,_0x2dea6d){_0x2dea6d=_0x2dea6d||0xcc;return function(_0x1a6ff4){if(_0x1a6ff4){return _0x1b37da[_0xef40('0x1a')](_0x2dea6d);}return _0x1b37da[_0xef40('0x1b')](_0x2dea6d)[_0xef40('0x1c')]();};}function respondWithResult(_0x41959c,_0x6e6b73){_0x6e6b73=_0x6e6b73||0xc8;return function(_0x3fcafc){if(_0x3fcafc){return _0x41959c[_0xef40('0x1b')](_0x6e6b73)[_0xef40('0x1d')](_0x3fcafc);}};}function respondWithFilteredResult(_0x595280,_0x550294){return function(_0x47ad7b){if(_0x47ad7b){var _0x296938=typeof _0x550294[_0xef40('0x1e')]===_0xef40('0x1f')&&typeof _0x550294['limit']===_0xef40('0x1f');var _0x568ba3=_0x47ad7b[_0xef40('0x20')];var _0x32c89f=_0x296938?0x0:_0x550294['offset'];var _0x27440a=_0x296938?_0x47ad7b[_0xef40('0x20')]:_0x550294[_0xef40('0x1e')]+_0x550294[_0xef40('0x21')];var _0x561196;if(_0x27440a>=_0x568ba3){_0x27440a=_0x568ba3;_0x561196=0xc8;}else{_0x561196=0xce;}_0x595280[_0xef40('0x1b')](_0x561196);return _0x595280[_0xef40('0x22')](_0xef40('0x23'),_0x32c89f+'-'+_0x27440a+'/'+_0x568ba3)[_0xef40('0x1d')](_0x47ad7b);}return null;};}function patchUpdates(_0x2c9f39){return function(_0x156a40){try{jsonpatch['apply'](_0x156a40,_0x2c9f39,!![]);}catch(_0x53b2e3){return BPromise[_0xef40('0x24')](_0x53b2e3);}return _0x156a40['save']();};}function saveUpdates(_0x5eaac0,_0x1b14d4){return function(_0x547205){if(_0x547205){return _0x547205[_0xef40('0x25')](_0x5eaac0)[_0xef40('0x26')](function(_0x215067){return _0x215067;});}return null;};}function removeEntity(_0x14c3a6,_0x1d9ffc){return function(_0x1572d3){if(_0x1572d3){return _0x1572d3['destroy']()[_0xef40('0x26')](function(){_0x14c3a6[_0xef40('0x1b')](0xcc)[_0xef40('0x1c')]();});}};}function handleEntityNotFound(_0x2bce07,_0x25483d){return function(_0x5f5904){if(!_0x5f5904){_0x2bce07[_0xef40('0x1a')](0x194);}return _0x5f5904;};}function handleError(_0x4c4dbe,_0x26a3a0){_0x26a3a0=_0x26a3a0||0x1f4;return function(_0x53469b){logger[_0xef40('0x27')](_0x53469b['stack']);if(_0x53469b['name']){delete _0x53469b['name'];}_0x4c4dbe['status'](_0x26a3a0)[_0xef40('0x28')](_0x53469b);};}exports[_0xef40('0x29')]=function(_0x20a539,_0x55d9ed){var _0x5641c2={},_0x206869={},_0x3f488e={'count':0x0,'rows':[]};var _0x24ccf1=_['map'](db['DeskAccount'][_0xef40('0x2a')],function(_0x46aad6){return{'name':_0x46aad6[_0xef40('0x2b')],'type':_0x46aad6['type'][_0xef40('0x2c')]};});_0x206869[_0xef40('0x2d')]=_['map'](_0x24ccf1,_0xef40('0x2e'));_0x206869[_0xef40('0x2f')]=_[_0xef40('0x30')](_0x20a539['query']);_0x206869[_0xef40('0x31')]=_[_0xef40('0x32')](_0x206869[_0xef40('0x2d')],_0x206869['query']);_0x5641c2[_0xef40('0x33')]=_[_0xef40('0x32')](_0x206869[_0xef40('0x2d')],qs[_0xef40('0x34')](_0x20a539['query'][_0xef40('0x34')]));_0x5641c2[_0xef40('0x33')]=_0x5641c2[_0xef40('0x33')]['length']?_0x5641c2[_0xef40('0x33')]:_0x206869[_0xef40('0x2d')];if(!_0x20a539[_0xef40('0x2f')][_0xef40('0x35')]('nolimit')){_0x5641c2['limit']=qs[_0xef40('0x21')](_0x20a539[_0xef40('0x2f')][_0xef40('0x21')]);_0x5641c2[_0xef40('0x1e')]=qs[_0xef40('0x1e')](_0x20a539[_0xef40('0x2f')][_0xef40('0x1e')]);}_0x5641c2['order']=qs['sort'](_0x20a539[_0xef40('0x2f')][_0xef40('0x36')]);_0x5641c2[_0xef40('0x37')]=qs[_0xef40('0x31')](_[_0xef40('0x38')](_0x20a539['query'],_0x206869[_0xef40('0x31')]),_0x24ccf1);if(_0x20a539[_0xef40('0x2f')][_0xef40('0x39')]){_0x5641c2[_0xef40('0x37')]=_[_0xef40('0x3a')](_0x5641c2[_0xef40('0x37')],{'$or':_[_0xef40('0x3b')](_0x24ccf1,function(_0x40c087){if(_0x40c087[_0xef40('0x3c')]!=='VIRTUAL'){var _0x465205={};_0x465205[_0x40c087[_0xef40('0x2e')]]={'$like':'%'+_0x20a539[_0xef40('0x2f')]['filter']+'%'};return _0x465205;}})});}_0x5641c2=_['merge']({},_0x5641c2,_0x20a539[_0xef40('0x3d')]);var _0x43be72={'where':_0x5641c2['where']};return db[_0xef40('0x3e')][_0xef40('0x20')](_0x43be72)[_0xef40('0x26')](function(_0xd2264d){_0x3f488e[_0xef40('0x20')]=_0xd2264d;if(_0x20a539[_0xef40('0x2f')][_0xef40('0x3f')]){_0x5641c2[_0xef40('0x40')]=[{'all':!![]}];}return db[_0xef40('0x3e')][_0xef40('0x41')](_0x5641c2);})[_0xef40('0x26')](function(_0x5860fe){_0x3f488e['rows']=_0x5860fe;return _0x3f488e;})['then'](respondWithFilteredResult(_0x55d9ed,_0x5641c2))[_0xef40('0x42')](handleError(_0x55d9ed,null));};exports[_0xef40('0x43')]=function(_0x9334ed,_0x1c1d84){var _0x3179b4={'raw':![],'where':{'id':_0x9334ed[_0xef40('0x44')]['id']}},_0x470375={};_0x470375[_0xef40('0x2d')]=_['keys'](db[_0xef40('0x3e')][_0xef40('0x2a')]);_0x470375[_0xef40('0x2f')]=_['keys'](_0x9334ed[_0xef40('0x2f')]);_0x470375[_0xef40('0x31')]=_[_0xef40('0x32')](_0x470375[_0xef40('0x2d')],_0x470375[_0xef40('0x2f')]);_0x3179b4[_0xef40('0x33')]=_[_0xef40('0x32')](_0x470375[_0xef40('0x2d')],qs[_0xef40('0x34')](_0x9334ed[_0xef40('0x2f')][_0xef40('0x34')]));_0x3179b4['attributes']=_0x3179b4[_0xef40('0x33')][_0xef40('0x45')]?_0x3179b4[_0xef40('0x33')]:_0x470375[_0xef40('0x2d')];if(_0x9334ed['query'][_0xef40('0x3f')]){_0x3179b4[_0xef40('0x40')]=[{'all':!![]}];}_0x3179b4=_[_0xef40('0x3a')]({},_0x3179b4,_0x9334ed['options']);return db[_0xef40('0x3e')][_0xef40('0x46')](_0x3179b4)[_0xef40('0x26')](handleEntityNotFound(_0x1c1d84,null))['then'](respondWithResult(_0x1c1d84,null))[_0xef40('0x42')](handleError(_0x1c1d84,null));};exports[_0xef40('0x47')]=function(_0x1353b4,_0x4667c7){return db[_0xef40('0x3e')]['create'](_0x1353b4[_0xef40('0x48')],{})[_0xef40('0x26')](respondWithResult(_0x4667c7,0xc9))['catch'](handleError(_0x4667c7,null));};exports[_0xef40('0x25')]=function(_0x365d5f,_0x25bf79){if(_0x365d5f[_0xef40('0x48')]['id']){delete _0x365d5f[_0xef40('0x48')]['id'];}return db[_0xef40('0x3e')][_0xef40('0x46')]({'where':{'id':_0x365d5f[_0xef40('0x44')]['id']}})[_0xef40('0x26')](handleEntityNotFound(_0x25bf79,null))[_0xef40('0x26')](saveUpdates(_0x365d5f['body'],null))[_0xef40('0x26')](respondWithResult(_0x25bf79,null))[_0xef40('0x42')](handleError(_0x25bf79,null));};exports[_0xef40('0x49')]=function(_0x402b7b,_0x419990){return db[_0xef40('0x3e')]['find']({'where':{'id':_0x402b7b[_0xef40('0x44')]['id']}})['then'](handleEntityNotFound(_0x419990,null))[_0xef40('0x26')](removeEntity(_0x419990,null))[_0xef40('0x42')](handleError(_0x419990,null));};exports[_0xef40('0x4a')]=function(_0x11053f,_0x346133,_0x1985f8){var _0x3fba61={};var _0x5f0d98={};var _0x3c8d50;var _0x3d100a;return db['DeskAccount']['findOne']({'where':{'id':_0x11053f['params']['id']}})[_0xef40('0x26')](handleEntityNotFound(_0x346133,null))[_0xef40('0x26')](function(_0x4b7c3d){if(_0x4b7c3d){_0x3c8d50=_0x4b7c3d;_0x5f0d98[_0xef40('0x2d')]=_[_0xef40('0x30')](db[_0xef40('0x4b')][_0xef40('0x2a')]);_0x5f0d98['query']=_[_0xef40('0x30')](_0x11053f[_0xef40('0x2f')]);_0x5f0d98['filters']=_['intersection'](_0x5f0d98[_0xef40('0x2d')],_0x5f0d98[_0xef40('0x2f')]);_0x3fba61[_0xef40('0x33')]=_[_0xef40('0x32')](_0x5f0d98[_0xef40('0x2d')],qs[_0xef40('0x34')](_0x11053f[_0xef40('0x2f')]['fields']));_0x3fba61[_0xef40('0x33')]=_0x3fba61[_0xef40('0x33')][_0xef40('0x45')]?_0x3fba61['attributes']:_0x5f0d98[_0xef40('0x2d')];_0x3fba61[_0xef40('0x4c')]=qs[_0xef40('0x36')](_0x11053f[_0xef40('0x2f')]['sort']);_0x3fba61[_0xef40('0x37')]=qs[_0xef40('0x31')](_[_0xef40('0x38')](_0x11053f['query'],_0x5f0d98[_0xef40('0x31')]));if(_0x11053f[_0xef40('0x2f')][_0xef40('0x39')]){_0x3fba61[_0xef40('0x37')]=_[_0xef40('0x3a')](_0x3fba61[_0xef40('0x37')],{'$or':_[_0xef40('0x3b')](_0x3fba61[_0xef40('0x33')],function(_0x354ed3){var _0x21a0ce={};_0x21a0ce[_0x354ed3]={'$like':'%'+_0x11053f[_0xef40('0x2f')][_0xef40('0x39')]+'%'};return _0x21a0ce;})});}_0x3fba61=_[_0xef40('0x3a')]({},_0x3fba61,_0x11053f[_0xef40('0x3d')]);return _0x3c8d50[_0xef40('0x4a')](_0x3fba61);}})['then'](function(_0x271768){if(_0x271768){_0x3d100a=_0x271768['length'];if(!_0x11053f['query'][_0xef40('0x35')](_0xef40('0x4d'))){_0x3fba61[_0xef40('0x21')]=qs[_0xef40('0x21')](_0x11053f[_0xef40('0x2f')]['limit']);_0x3fba61[_0xef40('0x1e')]=qs[_0xef40('0x1e')](_0x11053f[_0xef40('0x2f')][_0xef40('0x1e')]);}return _0x3c8d50[_0xef40('0x4a')](_0x3fba61);}})['then'](function(_0x378d49){if(_0x378d49){return _0x378d49?{'count':_0x3d100a,'rows':_0x378d49}:null;}})[_0xef40('0x26')](respondWithResult(_0x346133,null))['catch'](handleError(_0x346133,null));};exports[_0xef40('0x4e')]=function(_0x51de39,_0x4a2f41,_0x6420b9){if(_0x51de39['body']['id']){delete _0x51de39['body']['id'];}return db['DeskAccount'][_0xef40('0x4f')]({'where':{'id':_0x51de39['params']['id']}})[_0xef40('0x26')](handleEntityNotFound(_0x4a2f41,null))[_0xef40('0x26')](function(_0x580016){if(_0x580016){_0x51de39[_0xef40('0x48')][_0xef40('0x50')]=_0x580016['id'];_0x51de39[_0xef40('0x48')][_0xef40('0x51')]=integrations['getSubjects'](_0x51de39['body'][_0xef40('0x52')],_0x51de39['body'][_0xef40('0x3c')]);_0x51de39['body'][_0xef40('0x53')]=integrations[_0xef40('0x54')](_0x51de39['body'][_0xef40('0x52')],_0x51de39[_0xef40('0x48')][_0xef40('0x3c')]);return db[_0xef40('0x4b')]['create'](_0x51de39[_0xef40('0x48')],{'include':[{'model':db[_0xef40('0x55')],'as':_0xef40('0x51')},{'model':db[_0xef40('0x55')],'as':_0xef40('0x53')}]});}return null;})[_0xef40('0x26')](respondWithResult(_0x4a2f41,null))['catch'](handleError(_0x4a2f41,null));};exports[_0xef40('0x56')]=function(_0x3352e6,_0x6c78d7,_0x10c856){var _0x351488=[{'name':_0xef40('0x57'),'label':_0xef40('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 _0x5897b7='';return db[_0xef40('0x3e')][_0xef40('0x4f')]({'where':{'id':_0x3352e6[_0xef40('0x44')]['id']},'attributes':['id',_0xef40('0x58'),_0xef40('0x59'),'username',_0xef40('0x5a'),_0xef40('0x5b'),_0xef40('0x5c'),_0xef40('0x5d'),_0xef40('0x5e')]})[_0xef40('0x26')](handleEntityNotFound(_0x6c78d7,null))[_0xef40('0x26')](function(_0x470074){if(_0x470074){_0x5897b7=_0x470074['remoteUri'];var _0x564f02=_0x5897b7['slice'](-0x1);if(_0x564f02==='/'){_0x5897b7=_0x5897b7[_0xef40('0x5f')](0x0,_0x5897b7['lastIndexOf'](_0x564f02));}var _0x417445={'method':_0xef40('0x60'),'uri':util[_0xef40('0x61')](_0xef40('0x62'),_0x5897b7),'headers':{'Content-Type':_0xef40('0x63'),'Accept':_0xef40('0x63')},'json':!![]};if(_0x470074[_0xef40('0x59')]===_0xef40('0x64')){_0x417445['headers'][_0xef40('0x65')]=util['format'](_0xef40('0x66'),new Buffer(util[_0xef40('0x61')](_0xef40('0x67'),_0x470074[_0xef40('0x68')],_0x470074[_0xef40('0x5a')]))[_0xef40('0x69')](_0xef40('0x6a')));}return rp(_0x417445)['then'](function(_0x47e072){return _0x351488[_0xef40('0x6b')](_[_0xef40('0x3b')](_0x47e072[_0xef40('0x6c')]['entries'],function(_0x29ee55){return{'id':_0x29ee55['name'],'name':_0x29ee55['name'],'type':_0x29ee55[_0xef40('0x3c')],'active':_0x29ee55[_0xef40('0x6d')],'label':_0x29ee55[_0xef40('0x6e')],'custom':!![]};}));});}})['then'](function(_0x366cb7){return{'count':_0x366cb7[_0xef40('0x45')],'rows':_0x366cb7};})['then'](respondWithResult(_0x6c78d7,null))['catch'](function(_0x479b4b){var _0x40e084=_0x3352e6[_0xef40('0x2f')]['test']?0x1f4:_0x479b4b[_0xef40('0x6f')]||0x1f4;logger[_0xef40('0x27')](_0xef40('0x70'),_0xef40('0x56'),_0x40e084,JSON['stringify'](_0x479b4b));delete _0x479b4b[_0xef40('0x2e')];if(_0x40e084===0x191){_0x40e084=0x190;}_0x6c78d7[_0xef40('0x1b')](_0x40e084)[_0xef40('0x28')](_0x3352e6['query'][_0xef40('0x71')]?{'message':_0xef40('0x72'),'statusCode':_0x479b4b['statusCode']}:_0x479b4b);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index dae9b7b..241b7e6 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 _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 +var _0x9718=['../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','DeskAccount','int_desk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x560448,_0x2c1082){var _0x550276=function(_0x37e949){while(--_0x37e949){_0x560448['push'](_0x560448['shift']());}};_0x550276(++_0x2c1082);}(_0x9718,0xad));var _0x8971=function(_0x379cb9,_0x438041){_0x379cb9=_0x379cb9-0x0;var _0x247fe7=_0x9718[_0x379cb9];return _0x247fe7;};'use strict';var _=require(_0x8971('0x0'));var util=require(_0x8971('0x1'));var logger=require(_0x8971('0x2'))(_0x8971('0x3'));var moment=require(_0x8971('0x4'));var BPromise=require(_0x8971('0x5'));var rp=require(_0x8971('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8971('0x7'));var attributes=require(_0x8971('0x8'));var integrations=require(_0x8971('0x9'));module['exports']=function(_0x106ddc,_0x35f4dd){return _0x106ddc['define'](_0x8971('0xa'),attributes,{'tableName':_0x8971('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 b369bf9..52bf2c5 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 _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 +var _0x1cd5=['limit','include','map','model','info','catch','ShowDeskAccount','find','raw','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetDeskAccount','DeskAccount','findAll','options','where','attributes'];(function(_0x3a1b35,_0x43f746){var _0x27fd53=function(_0x398150){while(--_0x398150){_0x3a1b35['push'](_0x3a1b35['shift']());}};_0x27fd53(++_0x43f746);}(_0x1cd5,0xdb));var _0x51cd=function(_0x4bf496,_0x8d690a){_0x4bf496=_0x4bf496-0x0;var _0x53c72a=_0x1cd5[_0x4bf496];return _0x53c72a;};'use strict';var _=require(_0x51cd('0x0'));var util=require(_0x51cd('0x1'));var moment=require(_0x51cd('0x2'));var BPromise=require(_0x51cd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x51cd('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x51cd('0x5'));var logger=require(_0x51cd('0x6'))('rpc');var config=require(_0x51cd('0x7'));var jayson=require(_0x51cd('0x8'));var client=jayson[_0x51cd('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5f0ea0,_0x11f299,_0xa36468){return new BPromise(function(_0x172e13,_0x5eeed8){return client[_0x51cd('0xa')](_0x5f0ea0,_0xa36468)[_0x51cd('0xb')](function(_0x74fbd5){logger['info'](_0x51cd('0xc'),_0x11f299,_0x51cd('0xd'));logger[_0x51cd('0xe')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x11f299,'request\x20sent',JSON[_0x51cd('0xf')](_0x74fbd5));if(_0x74fbd5[_0x51cd('0x10')]){if(_0x74fbd5[_0x51cd('0x10')][_0x51cd('0x11')]===0x1f4){logger[_0x51cd('0x10')](_0x51cd('0xc'),_0x11f299,_0x74fbd5['error'][_0x51cd('0x12')]);return _0x5eeed8(_0x74fbd5[_0x51cd('0x10')][_0x51cd('0x12')]);}logger[_0x51cd('0x10')](_0x51cd('0xc'),_0x11f299,_0x74fbd5[_0x51cd('0x10')]['message']);return _0x172e13(_0x74fbd5[_0x51cd('0x10')][_0x51cd('0x12')]);}else{logger['info'](_0x51cd('0xc'),_0x11f299,'request\x20sent');_0x172e13(_0x74fbd5[_0x51cd('0x13')]['message']);}})['catch'](function(_0xcad30f){logger['error']('DeskAccount,\x20%s,\x20%s',_0x11f299,_0xcad30f);_0x5eeed8(_0xcad30f);});});}exports[_0x51cd('0x14')]=function(_0x37fb04){var _0x21bef8=this;return new Promise(function(_0x463e09,_0x294cb6){return db[_0x51cd('0x15')][_0x51cd('0x16')]({'raw':_0x37fb04[_0x51cd('0x17')]?_0x37fb04[_0x51cd('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x37fb04[_0x51cd('0x17')]?_0x37fb04[_0x51cd('0x17')][_0x51cd('0x18')]||null:null,'attributes':_0x37fb04[_0x51cd('0x17')]?_0x37fb04[_0x51cd('0x17')][_0x51cd('0x19')]||null:null,'limit':_0x37fb04['options']?_0x37fb04[_0x51cd('0x17')][_0x51cd('0x1a')]||null:null,'include':_0x37fb04[_0x51cd('0x17')]?_0x37fb04[_0x51cd('0x17')][_0x51cd('0x1b')]?_[_0x51cd('0x1c')](_0x37fb04[_0x51cd('0x17')][_0x51cd('0x1b')],function(_0x250795){return{'model':db[_0x250795['model']],'as':_0x250795['as'],'attributes':_0x250795[_0x51cd('0x19')],'include':_0x250795['include']?_[_0x51cd('0x1c')](_0x250795[_0x51cd('0x1b')],function(_0x285be9){return{'model':db[_0x285be9[_0x51cd('0x1d')]],'as':_0x285be9['as'],'attributes':_0x285be9[_0x51cd('0x19')],'include':_0x285be9[_0x51cd('0x1b')]?_['map'](_0x285be9[_0x51cd('0x1b')],function(_0x1047c2){return{'model':db[_0x1047c2[_0x51cd('0x1d')]],'as':_0x1047c2['as'],'attributes':_0x1047c2['attributes']};}):[]};}):[]};}):[]:[]})[_0x51cd('0xb')](function(_0x1f3cd5){logger[_0x51cd('0x1e')](_0x51cd('0x14'),_0x37fb04);logger[_0x51cd('0xe')]('GetDeskAccount',_0x37fb04,JSON[_0x51cd('0xf')](_0x1f3cd5));_0x463e09(_0x1f3cd5);})[_0x51cd('0x1f')](function(_0xa74582){logger[_0x51cd('0x10')]('GetDeskAccount',_0xa74582[_0x51cd('0x12')],_0x37fb04);_0x294cb6(_0x21bef8[_0x51cd('0x10')](0x1f4,_0xa74582[_0x51cd('0x12')]));});});};exports[_0x51cd('0x20')]=function(_0x1c8fc5){var _0x23c120=this;return new Promise(function(_0x30c8fc,_0x5039ac){return db[_0x51cd('0x15')][_0x51cd('0x21')]({'raw':_0x1c8fc5['options']?_0x1c8fc5[_0x51cd('0x17')][_0x51cd('0x22')]===undefined?!![]:![]:!![],'where':_0x1c8fc5[_0x51cd('0x17')]?_0x1c8fc5['options'][_0x51cd('0x18')]||null:null,'attributes':_0x1c8fc5[_0x51cd('0x17')]?_0x1c8fc5[_0x51cd('0x17')][_0x51cd('0x19')]||null:null,'include':_0x1c8fc5['options']?_0x1c8fc5['options'][_0x51cd('0x1b')]?_['map'](_0x1c8fc5[_0x51cd('0x17')][_0x51cd('0x1b')],function(_0x431394){return{'model':db[_0x431394['model']],'as':_0x431394['as'],'attributes':_0x431394[_0x51cd('0x19')],'include':_0x431394['include']?_[_0x51cd('0x1c')](_0x431394['include'],function(_0x49d661){return{'model':db[_0x49d661['model']],'as':_0x49d661['as'],'attributes':_0x49d661[_0x51cd('0x19')],'include':_0x49d661[_0x51cd('0x1b')]?_['map'](_0x49d661[_0x51cd('0x1b')],function(_0x294883){return{'model':db[_0x294883[_0x51cd('0x1d')]],'as':_0x294883['as'],'attributes':_0x294883[_0x51cd('0x19')]};}):[]};}):[]};}):[]:[]})[_0x51cd('0xb')](function(_0x398f49){logger[_0x51cd('0x1e')](_0x51cd('0x20'),_0x1c8fc5);logger[_0x51cd('0xe')](_0x51cd('0x20'),_0x1c8fc5,JSON['stringify'](_0x398f49));_0x30c8fc(_0x398f49);})['catch'](function(_0x4f438a){logger[_0x51cd('0x10')](_0x51cd('0x20'),_0x4f438a['message'],_0x1c8fc5);_0x5039ac(_0x23c120[_0x51cd('0x10')](0x1f4,_0x4f438a[_0x51cd('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index c9059d0..999e9cd 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields'];(function(_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 +var _0x55ca=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','setTags','put','/:id','update','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service'];(function(_0x899a7b,_0x47f3fe){var _0x501574=function(_0x721be2){while(--_0x721be2){_0x899a7b['push'](_0x899a7b['shift']());}};_0x501574(++_0x47f3fe);}(_0x55ca,0x126));var _0xa55c=function(_0x4de877,_0x340170){_0x4de877=_0x4de877-0x0;var _0xb2cfeb=_0x55ca[_0x4de877];return _0xb2cfeb;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['getFields']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getTags']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/tags',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router['delete'](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x15')]);module[_0xa55c('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index c89f86d..bcb3933 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 _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 +var _0xfc0e=['exports','STRING','sequelize'];(function(_0x358628,_0x36c8e9){var _0x3223af=function(_0x34a044){while(--_0x34a044){_0x358628['push'](_0x358628['shift']());}};_0x3223af(++_0x36c8e9);}(_0xfc0e,0xce));var _0xefc0=function(_0x565fed,_0xb85768){_0x565fed=_0x565fed-0x0;var _0x3e018f=_0xfc0e[_0x565fed];return _0x3e018f;};'use strict';var Sequelize=require(_0xefc0('0x0'));module[_0xefc0('0x1')]={'name':{'type':Sequelize[_0xefc0('0x2')]},'description':{'type':Sequelize[_0xefc0('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index aa338f4..96e0e8a 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 _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 +var _0xb303=['catch','show','params','keys','find','create','body','destroy','getFields','DeskField','pick','nolimit','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','apply','save','update','then','sendStatus','error','stack','map','DeskConfiguration','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','name','filter','options','includeAll','include','rows'];(function(_0x2e5a65,_0x3338f1){var _0x2a2a1a=function(_0x397c3e){while(--_0x397c3e){_0x2e5a65['push'](_0x2e5a65['shift']());}};_0x2a2a1a(++_0x3338f1);}(_0xb303,0x1f3));var _0x3b30=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb303[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x3b30('0x0'));var rimraf=require(_0x3b30('0x1'));var zipdir=require(_0x3b30('0x2'));var jsonpatch=require(_0x3b30('0x3'));var rp=require('request-promise');var moment=require(_0x3b30('0x4'));var BPromise=require(_0x3b30('0x5'));var Mustache=require(_0x3b30('0x6'));var util=require(_0x3b30('0x7'));var path=require('path');var sox=require(_0x3b30('0x8'));var csv=require(_0x3b30('0x9'));var ejs=require(_0x3b30('0xa'));var fs=require('fs');var fs_extra=require(_0x3b30('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x3b30('0xc'));var jsforce=require(_0x3b30('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3b30('0x9'));var querystring=require(_0x3b30('0xe'));var Papa=require(_0x3b30('0xf'));var Redis=require(_0x3b30('0x10'));var authService=require(_0x3b30('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3b30('0x12'));var hardwareService=require(_0x3b30('0x13'));var logger=require('../../config/logger')(_0x3b30('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3b30('0x15'));var db=require(_0x3b30('0x16'))['db'];function respondWithStatusCode(_0x394981,_0x583a7a){_0x583a7a=_0x583a7a||0xcc;return function(_0x3dc2b3){if(_0x3dc2b3){return _0x394981['sendStatus'](_0x583a7a);}return _0x394981['status'](_0x583a7a)[_0x3b30('0x17')]();};}function respondWithResult(_0x43eb30,_0x5849f4){_0x5849f4=_0x5849f4||0xc8;return function(_0x53f249){if(_0x53f249){return _0x43eb30[_0x3b30('0x18')](_0x5849f4)[_0x3b30('0x19')](_0x53f249);}};}function respondWithFilteredResult(_0x4285f1,_0x480f81){return function(_0x4ad901){if(_0x4ad901){var _0x3bf072=typeof _0x480f81[_0x3b30('0x1a')]===_0x3b30('0x1b')&&typeof _0x480f81['limit']===_0x3b30('0x1b');var _0x538320=_0x4ad901[_0x3b30('0x1c')];var _0x19935f=_0x3bf072?0x0:_0x480f81[_0x3b30('0x1a')];var _0x1c770f=_0x3bf072?_0x4ad901[_0x3b30('0x1c')]:_0x480f81[_0x3b30('0x1a')]+_0x480f81[_0x3b30('0x1d')];var _0x3bf93a;if(_0x1c770f>=_0x538320){_0x1c770f=_0x538320;_0x3bf93a=0xc8;}else{_0x3bf93a=0xce;}_0x4285f1[_0x3b30('0x18')](_0x3bf93a);return _0x4285f1['set']('Content-Range',_0x19935f+'-'+_0x1c770f+'/'+_0x538320)['json'](_0x4ad901);}return null;};}function patchUpdates(_0x6e38c0){return function(_0x25c9cb){try{jsonpatch[_0x3b30('0x1e')](_0x25c9cb,_0x6e38c0,!![]);}catch(_0x2e5378){return BPromise['reject'](_0x2e5378);}return _0x25c9cb[_0x3b30('0x1f')]();};}function saveUpdates(_0x39afea,_0x1e0974){return function(_0x1725fb){if(_0x1725fb){return _0x1725fb[_0x3b30('0x20')](_0x39afea)['then'](function(_0xad0b39){return _0xad0b39;});}return null;};}function removeEntity(_0x1c1145,_0x234d57){return function(_0xaa67d9){if(_0xaa67d9){return _0xaa67d9['destroy']()[_0x3b30('0x21')](function(){_0x1c1145[_0x3b30('0x18')](0xcc)[_0x3b30('0x17')]();});}};}function handleEntityNotFound(_0x27d8ca,_0x5437c1){return function(_0x4ff0f3){if(!_0x4ff0f3){_0x27d8ca[_0x3b30('0x22')](0x194);}return _0x4ff0f3;};}function handleError(_0x527ca1,_0x3cf45f){_0x3cf45f=_0x3cf45f||0x1f4;return function(_0x2eb940){logger[_0x3b30('0x23')](_0x2eb940[_0x3b30('0x24')]);if(_0x2eb940['name']){delete _0x2eb940['name'];}_0x527ca1[_0x3b30('0x18')](_0x3cf45f)['send'](_0x2eb940);};}exports['index']=function(_0x1bde60,_0x2fb658){var _0x358d92={},_0x3a9f70={},_0x30c3b6={'count':0x0,'rows':[]};var _0x31ba73=_[_0x3b30('0x25')](db[_0x3b30('0x26')][_0x3b30('0x27')],function(_0x1166e0){return{'name':_0x1166e0[_0x3b30('0x28')],'type':_0x1166e0[_0x3b30('0x29')]['key']};});_0x3a9f70[_0x3b30('0x2a')]=_['map'](_0x31ba73,'name');_0x3a9f70[_0x3b30('0x2b')]=_['keys'](_0x1bde60['query']);_0x3a9f70[_0x3b30('0x2c')]=_['intersection'](_0x3a9f70[_0x3b30('0x2a')],_0x3a9f70[_0x3b30('0x2b')]);_0x358d92['attributes']=_[_0x3b30('0x2d')](_0x3a9f70[_0x3b30('0x2a')],qs[_0x3b30('0x2e')](_0x1bde60[_0x3b30('0x2b')][_0x3b30('0x2e')]));_0x358d92[_0x3b30('0x2f')]=_0x358d92[_0x3b30('0x2f')][_0x3b30('0x30')]?_0x358d92[_0x3b30('0x2f')]:_0x3a9f70[_0x3b30('0x2a')];if(!_0x1bde60[_0x3b30('0x2b')][_0x3b30('0x31')]('nolimit')){_0x358d92[_0x3b30('0x1d')]=qs['limit'](_0x1bde60[_0x3b30('0x2b')][_0x3b30('0x1d')]);_0x358d92[_0x3b30('0x1a')]=qs[_0x3b30('0x1a')](_0x1bde60['query']['offset']);}_0x358d92[_0x3b30('0x32')]=qs[_0x3b30('0x33')](_0x1bde60['query']['sort']);_0x358d92[_0x3b30('0x34')]=qs[_0x3b30('0x2c')](_['pick'](_0x1bde60[_0x3b30('0x2b')],_0x3a9f70[_0x3b30('0x2c')]),_0x31ba73);if(_0x1bde60['query']['filter']){_0x358d92[_0x3b30('0x34')]=_[_0x3b30('0x35')](_0x358d92[_0x3b30('0x34')],{'$or':_[_0x3b30('0x25')](_0x31ba73,function(_0x24e7e9){if(_0x24e7e9['type']!==_0x3b30('0x36')){var _0xe2bfd7={};_0xe2bfd7[_0x24e7e9[_0x3b30('0x37')]]={'$like':'%'+_0x1bde60[_0x3b30('0x2b')][_0x3b30('0x38')]+'%'};return _0xe2bfd7;}})});}_0x358d92=_[_0x3b30('0x35')]({},_0x358d92,_0x1bde60[_0x3b30('0x39')]);var _0x193e60={'where':_0x358d92[_0x3b30('0x34')]};return db[_0x3b30('0x26')][_0x3b30('0x1c')](_0x193e60)[_0x3b30('0x21')](function(_0x21e9cb){_0x30c3b6[_0x3b30('0x1c')]=_0x21e9cb;if(_0x1bde60[_0x3b30('0x2b')][_0x3b30('0x3a')]){_0x358d92[_0x3b30('0x3b')]=[{'all':!![]}];}return db[_0x3b30('0x26')]['findAll'](_0x358d92);})[_0x3b30('0x21')](function(_0x593c86){_0x30c3b6[_0x3b30('0x3c')]=_0x593c86;return _0x30c3b6;})[_0x3b30('0x21')](respondWithFilteredResult(_0x2fb658,_0x358d92))[_0x3b30('0x3d')](handleError(_0x2fb658,null));};exports[_0x3b30('0x3e')]=function(_0x4d14a1,_0x88015d){var _0x4d5069={'raw':![],'where':{'id':_0x4d14a1[_0x3b30('0x3f')]['id']}},_0x4f10fe={};_0x4f10fe[_0x3b30('0x2a')]=_['keys'](db[_0x3b30('0x26')]['rawAttributes']);_0x4f10fe[_0x3b30('0x2b')]=_[_0x3b30('0x40')](_0x4d14a1['query']);_0x4f10fe['filters']=_[_0x3b30('0x2d')](_0x4f10fe[_0x3b30('0x2a')],_0x4f10fe[_0x3b30('0x2b')]);_0x4d5069[_0x3b30('0x2f')]=_[_0x3b30('0x2d')](_0x4f10fe[_0x3b30('0x2a')],qs[_0x3b30('0x2e')](_0x4d14a1[_0x3b30('0x2b')]['fields']));_0x4d5069['attributes']=_0x4d5069[_0x3b30('0x2f')]['length']?_0x4d5069['attributes']:_0x4f10fe[_0x3b30('0x2a')];if(_0x4d14a1['query'][_0x3b30('0x3a')]){_0x4d5069[_0x3b30('0x3b')]=[{'all':!![]}];}_0x4d5069=_[_0x3b30('0x35')]({},_0x4d5069,_0x4d14a1['options']);return db[_0x3b30('0x26')][_0x3b30('0x41')](_0x4d5069)[_0x3b30('0x21')](handleEntityNotFound(_0x88015d,null))[_0x3b30('0x21')](respondWithResult(_0x88015d,null))[_0x3b30('0x3d')](handleError(_0x88015d,null));};exports[_0x3b30('0x42')]=function(_0x3c3f56,_0x2dd739){return db[_0x3b30('0x26')]['create'](_0x3c3f56[_0x3b30('0x43')],{})['then'](respondWithResult(_0x2dd739,0xc9))[_0x3b30('0x3d')](handleError(_0x2dd739,null));};exports[_0x3b30('0x20')]=function(_0x7a7ce8,_0x302ddf){if(_0x7a7ce8[_0x3b30('0x43')]['id']){delete _0x7a7ce8[_0x3b30('0x43')]['id'];}return db[_0x3b30('0x26')][_0x3b30('0x41')]({'where':{'id':_0x7a7ce8[_0x3b30('0x3f')]['id']}})[_0x3b30('0x21')](handleEntityNotFound(_0x302ddf,null))[_0x3b30('0x21')](saveUpdates(_0x7a7ce8[_0x3b30('0x43')],null))[_0x3b30('0x21')](respondWithResult(_0x302ddf,null))[_0x3b30('0x3d')](handleError(_0x302ddf,null));};exports[_0x3b30('0x44')]=function(_0x3ae2ec,_0x4d3860){return db['DeskConfiguration'][_0x3b30('0x41')]({'where':{'id':_0x3ae2ec[_0x3b30('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4d3860,null))[_0x3b30('0x21')](removeEntity(_0x4d3860,null))[_0x3b30('0x3d')](handleError(_0x4d3860,null));};exports[_0x3b30('0x45')]=function(_0x3edeb0,_0x46f544,_0x336eec){var _0x41509b={};var _0x34e96f={};var _0x7e1ad7;var _0x7b63c1;return db[_0x3b30('0x26')]['findOne']({'where':{'id':_0x3edeb0[_0x3b30('0x3f')]['id']}})[_0x3b30('0x21')](handleEntityNotFound(_0x46f544,null))[_0x3b30('0x21')](function(_0x6e1f63){if(_0x6e1f63){_0x7e1ad7=_0x6e1f63;_0x34e96f[_0x3b30('0x2a')]=_['keys'](db[_0x3b30('0x46')][_0x3b30('0x27')]);_0x34e96f[_0x3b30('0x2b')]=_['keys'](_0x3edeb0[_0x3b30('0x2b')]);_0x34e96f[_0x3b30('0x2c')]=_['intersection'](_0x34e96f[_0x3b30('0x2a')],_0x34e96f[_0x3b30('0x2b')]);_0x41509b[_0x3b30('0x2f')]=_['intersection'](_0x34e96f[_0x3b30('0x2a')],qs[_0x3b30('0x2e')](_0x3edeb0[_0x3b30('0x2b')][_0x3b30('0x2e')]));_0x41509b[_0x3b30('0x2f')]=_0x41509b['attributes']['length']?_0x41509b[_0x3b30('0x2f')]:_0x34e96f[_0x3b30('0x2a')];_0x41509b['order']=qs[_0x3b30('0x33')](_0x3edeb0[_0x3b30('0x2b')]['sort']);_0x41509b['where']=qs[_0x3b30('0x2c')](_[_0x3b30('0x47')](_0x3edeb0[_0x3b30('0x2b')],_0x34e96f[_0x3b30('0x2c')]));if(_0x3edeb0[_0x3b30('0x2b')][_0x3b30('0x38')]){_0x41509b['where']=_['merge'](_0x41509b[_0x3b30('0x34')],{'$or':_[_0x3b30('0x25')](_0x41509b[_0x3b30('0x2f')],function(_0x4d6988){var _0x5bce1a={};_0x5bce1a[_0x4d6988]={'$like':'%'+_0x3edeb0['query'][_0x3b30('0x38')]+'%'};return _0x5bce1a;})});}_0x41509b=_[_0x3b30('0x35')]({},_0x41509b,_0x3edeb0[_0x3b30('0x39')]);return _0x7e1ad7[_0x3b30('0x45')](_0x41509b);}})[_0x3b30('0x21')](function(_0x385e9e){if(_0x385e9e){_0x7b63c1=_0x385e9e['length'];if(!_0x3edeb0[_0x3b30('0x2b')]['hasOwnProperty'](_0x3b30('0x48'))){_0x41509b[_0x3b30('0x1d')]=qs[_0x3b30('0x1d')](_0x3edeb0[_0x3b30('0x2b')][_0x3b30('0x1d')]);_0x41509b[_0x3b30('0x1a')]=qs['offset'](_0x3edeb0[_0x3b30('0x2b')]['offset']);}return _0x7e1ad7[_0x3b30('0x45')](_0x41509b);}})[_0x3b30('0x21')](function(_0x24b805){if(_0x24b805){return _0x24b805?{'count':_0x7b63c1,'rows':_0x24b805}:null;}})[_0x3b30('0x21')](respondWithResult(_0x46f544,null))[_0x3b30('0x3d')](handleError(_0x46f544,null));};exports[_0x3b30('0x49')]=function(_0x442d81,_0x1635e7,_0x3e075c){var _0x26be09={};var _0x26a7ba={};var _0x343fd5;var _0x258dec;return db[_0x3b30('0x26')][_0x3b30('0x4a')]({'where':{'id':_0x442d81['params']['id']}})[_0x3b30('0x21')](handleEntityNotFound(_0x1635e7,null))[_0x3b30('0x21')](function(_0x29e261){if(_0x29e261){_0x343fd5=_0x29e261;_0x26a7ba[_0x3b30('0x2a')]=_[_0x3b30('0x40')](db[_0x3b30('0x46')][_0x3b30('0x27')]);_0x26a7ba[_0x3b30('0x2b')]=_['keys'](_0x442d81[_0x3b30('0x2b')]);_0x26a7ba[_0x3b30('0x2c')]=_[_0x3b30('0x2d')](_0x26a7ba['model'],_0x26a7ba[_0x3b30('0x2b')]);_0x26be09['attributes']=_['intersection'](_0x26a7ba['model'],qs['fields'](_0x442d81[_0x3b30('0x2b')][_0x3b30('0x2e')]));_0x26be09['attributes']=_0x26be09[_0x3b30('0x2f')][_0x3b30('0x30')]?_0x26be09[_0x3b30('0x2f')]:_0x26a7ba[_0x3b30('0x2a')];_0x26be09['order']=qs['sort'](_0x442d81[_0x3b30('0x2b')]['sort']);_0x26be09['where']=qs[_0x3b30('0x2c')](_[_0x3b30('0x47')](_0x442d81[_0x3b30('0x2b')],_0x26a7ba[_0x3b30('0x2c')]));if(_0x442d81[_0x3b30('0x2b')][_0x3b30('0x38')]){_0x26be09[_0x3b30('0x34')]=_['merge'](_0x26be09[_0x3b30('0x34')],{'$or':_[_0x3b30('0x25')](_0x26be09[_0x3b30('0x2f')],function(_0x3d032a){var _0x42c721={};_0x42c721[_0x3d032a]={'$like':'%'+_0x442d81['query']['filter']+'%'};return _0x42c721;})});}_0x26be09=_[_0x3b30('0x35')]({},_0x26be09,_0x442d81['options']);return _0x343fd5[_0x3b30('0x49')](_0x26be09);}})[_0x3b30('0x21')](function(_0x2d8761){if(_0x2d8761){_0x258dec=_0x2d8761[_0x3b30('0x30')];if(!_0x442d81['query'][_0x3b30('0x31')](_0x3b30('0x48'))){_0x26be09[_0x3b30('0x1d')]=qs['limit'](_0x442d81['query'][_0x3b30('0x1d')]);_0x26be09[_0x3b30('0x1a')]=qs['offset'](_0x442d81['query'][_0x3b30('0x1a')]);}return _0x343fd5[_0x3b30('0x49')](_0x26be09);}})['then'](function(_0x24db3a){if(_0x24db3a){return _0x24db3a?{'count':_0x258dec,'rows':_0x24db3a}:null;}})['then'](respondWithResult(_0x1635e7,null))[_0x3b30('0x3d')](handleError(_0x1635e7,null));};exports['getDescriptions']=function(_0x5f3579,_0x26160a,_0x3a5650){var _0x2fd22e={};var _0x587c10={};var _0x404621;var _0xdfa856;return db['DeskConfiguration']['findOne']({'where':{'id':_0x5f3579[_0x3b30('0x3f')]['id']}})[_0x3b30('0x21')](handleEntityNotFound(_0x26160a,null))[_0x3b30('0x21')](function(_0x28b52f){if(_0x28b52f){_0x404621=_0x28b52f;_0x587c10[_0x3b30('0x2a')]=_['keys'](db[_0x3b30('0x46')]['rawAttributes']);_0x587c10[_0x3b30('0x2b')]=_[_0x3b30('0x40')](_0x5f3579['query']);_0x587c10['filters']=_[_0x3b30('0x2d')](_0x587c10[_0x3b30('0x2a')],_0x587c10['query']);_0x2fd22e[_0x3b30('0x2f')]=_[_0x3b30('0x2d')](_0x587c10['model'],qs[_0x3b30('0x2e')](_0x5f3579[_0x3b30('0x2b')][_0x3b30('0x2e')]));_0x2fd22e[_0x3b30('0x2f')]=_0x2fd22e[_0x3b30('0x2f')][_0x3b30('0x30')]?_0x2fd22e[_0x3b30('0x2f')]:_0x587c10[_0x3b30('0x2a')];_0x2fd22e['order']=qs[_0x3b30('0x33')](_0x5f3579['query']['sort']);_0x2fd22e['where']=qs[_0x3b30('0x2c')](_['pick'](_0x5f3579[_0x3b30('0x2b')],_0x587c10[_0x3b30('0x2c')]));if(_0x5f3579['query']['filter']){_0x2fd22e[_0x3b30('0x34')]=_[_0x3b30('0x35')](_0x2fd22e[_0x3b30('0x34')],{'$or':_[_0x3b30('0x25')](_0x2fd22e['attributes'],function(_0x144142){var _0x3c5b5d={};_0x3c5b5d[_0x144142]={'$like':'%'+_0x5f3579['query']['filter']+'%'};return _0x3c5b5d;})});}_0x2fd22e=_[_0x3b30('0x35')]({},_0x2fd22e,_0x5f3579[_0x3b30('0x39')]);return _0x404621[_0x3b30('0x4b')](_0x2fd22e);}})[_0x3b30('0x21')](function(_0x87d2ec){if(_0x87d2ec){_0xdfa856=_0x87d2ec['length'];if(!_0x5f3579[_0x3b30('0x2b')][_0x3b30('0x31')]('nolimit')){_0x2fd22e[_0x3b30('0x1d')]=qs[_0x3b30('0x1d')](_0x5f3579['query'][_0x3b30('0x1d')]);_0x2fd22e['offset']=qs[_0x3b30('0x1a')](_0x5f3579[_0x3b30('0x2b')][_0x3b30('0x1a')]);}return _0x404621[_0x3b30('0x4b')](_0x2fd22e);}})['then'](function(_0x44daf0){if(_0x44daf0){return _0x44daf0?{'count':_0xdfa856,'rows':_0x44daf0}:null;}})['then'](respondWithResult(_0x26160a,null))[_0x3b30('0x3d')](handleError(_0x26160a,null));};exports[_0x3b30('0x4c')]=function(_0x2fb7b3,_0x5d8ebf,_0x1b19e1){var _0x5b5a6d={};var _0x155ce4={};var _0x29d0c6;var _0x5ea691;return db['DeskConfiguration'][_0x3b30('0x4a')]({'where':{'id':_0x2fb7b3[_0x3b30('0x3f')]['id']}})['then'](handleEntityNotFound(_0x5d8ebf,null))[_0x3b30('0x21')](function(_0x359069){if(_0x359069){_0x29d0c6=_0x359069;_0x155ce4[_0x3b30('0x2a')]=_[_0x3b30('0x40')](db[_0x3b30('0x4d')]['rawAttributes']);_0x155ce4[_0x3b30('0x2b')]=_[_0x3b30('0x40')](_0x2fb7b3[_0x3b30('0x2b')]);_0x155ce4[_0x3b30('0x2c')]=_[_0x3b30('0x2d')](_0x155ce4['model'],_0x155ce4[_0x3b30('0x2b')]);_0x5b5a6d[_0x3b30('0x2f')]=_[_0x3b30('0x2d')](_0x155ce4[_0x3b30('0x2a')],qs[_0x3b30('0x2e')](_0x2fb7b3['query'][_0x3b30('0x2e')]));_0x5b5a6d[_0x3b30('0x2f')]=_0x5b5a6d['attributes'][_0x3b30('0x30')]?_0x5b5a6d[_0x3b30('0x2f')]:_0x155ce4[_0x3b30('0x2a')];_0x5b5a6d['order']=qs[_0x3b30('0x33')](_0x2fb7b3['query'][_0x3b30('0x33')]);_0x5b5a6d[_0x3b30('0x34')]=qs[_0x3b30('0x2c')](_['pick'](_0x2fb7b3[_0x3b30('0x2b')],_0x155ce4['filters']));if(_0x2fb7b3[_0x3b30('0x2b')][_0x3b30('0x38')]){_0x5b5a6d[_0x3b30('0x34')]=_[_0x3b30('0x35')](_0x5b5a6d[_0x3b30('0x34')],{'$or':_[_0x3b30('0x25')](_0x5b5a6d[_0x3b30('0x2f')],function(_0x5048f0){var _0x2270bf={};_0x2270bf[_0x5048f0]={'$like':'%'+_0x2fb7b3[_0x3b30('0x2b')][_0x3b30('0x38')]+'%'};return _0x2270bf;})});}_0x5b5a6d=_[_0x3b30('0x35')]({},_0x5b5a6d,_0x2fb7b3[_0x3b30('0x39')]);return _0x29d0c6[_0x3b30('0x4c')](_0x5b5a6d);}})['then'](function(_0x465979){if(_0x465979){_0x5ea691=_0x465979[_0x3b30('0x30')];if(!_0x2fb7b3[_0x3b30('0x2b')][_0x3b30('0x31')]('nolimit')){_0x5b5a6d['limit']=qs[_0x3b30('0x1d')](_0x2fb7b3['query'][_0x3b30('0x1d')]);_0x5b5a6d[_0x3b30('0x1a')]=qs[_0x3b30('0x1a')](_0x2fb7b3['query'][_0x3b30('0x1a')]);}return _0x29d0c6[_0x3b30('0x4c')](_0x5b5a6d);}})[_0x3b30('0x21')](function(_0x5b98f8){if(_0x5b98f8){return _0x5b98f8?{'count':_0x5ea691,'rows':_0x5b98f8}:null;}})['then'](respondWithResult(_0x5d8ebf,null))['catch'](handleError(_0x5d8ebf,null));};exports['setTags']=function(_0x39f6d6,_0x2fa093,_0x335a4b){if(_0x39f6d6[_0x3b30('0x43')]['id']){delete _0x39f6d6[_0x3b30('0x43')]['id'];}return db[_0x3b30('0x26')][_0x3b30('0x4a')]({'where':{'id':_0x39f6d6[_0x3b30('0x3f')]['id']}})[_0x3b30('0x21')](handleEntityNotFound(_0x2fa093,null))[_0x3b30('0x21')](function(_0x1b0d6b){if(_0x1b0d6b){return _0x1b0d6b[_0x3b30('0x4e')](_0x39f6d6['body'][_0x3b30('0x4f')]||[]);}return null;})['then'](respondWithResult(_0x2fa093,null))['catch'](handleError(_0x2fa093,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index ebc4796..f3c8e1b 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 _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 +var _0x38db=['int_desk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration'];(function(_0x92958f,_0x44430b){var _0x1e406d=function(_0x42699d){while(--_0x42699d){_0x92958f['push'](_0x92958f['shift']());}};_0x1e406d(++_0x44430b);}(_0x38db,0x6a));var _0xb38d=function(_0x3f6bb6,_0x2f6929){_0x3f6bb6=_0x3f6bb6-0x0;var _0xa905be=_0x38db[_0x3f6bb6];return _0xa905be;};'use strict';var _=require(_0xb38d('0x0'));var util=require(_0xb38d('0x1'));var logger=require(_0xb38d('0x2'))(_0xb38d('0x3'));var moment=require(_0xb38d('0x4'));var BPromise=require(_0xb38d('0x5'));var rp=require(_0xb38d('0x6'));var fs=require('fs');var path=require(_0xb38d('0x7'));var rimraf=require(_0xb38d('0x8'));var config=require(_0xb38d('0x9'));var attributes=require(_0xb38d('0xa'));module[_0xb38d('0xb')]=function(_0x36db37,_0x3bd4fa){return _0x36db37[_0xb38d('0xc')](_0xb38d('0xd'),attributes,{'tableName':_0xb38d('0xe'),'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 2ca887f..3186094 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 _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 +var _0xeeeb=['client','http','request\x20sent','debug','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','info','result','util','moment','bluebird','randomstring','ioredis','../../config/utils','jayson/promise'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xeeeb,0x1bb));var _0xbeee=function(_0x44a406,_0x28b6bf){_0x44a406=_0x44a406-0x0;var _0x3d3240=_0xeeeb[_0x44a406];return _0x3d3240;};'use strict';var _=require('lodash');var util=require(_0xbeee('0x0'));var moment=require(_0xbeee('0x1'));var BPromise=require(_0xbeee('0x2'));var rs=require(_0xbeee('0x3'));var fs=require('fs');var Redis=require(_0xbeee('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbeee('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xbeee('0x6'));var client=jayson[_0xbeee('0x7')][_0xbeee('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x377323,_0x2bf12e,_0x14ba0c){return new BPromise(function(_0x4dc25f,_0x236be1){return client['request'](_0x377323,_0x14ba0c)['then'](function(_0xfa37bd){logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x2bf12e,_0xbeee('0x9'));logger[_0xbeee('0xa')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x2bf12e,_0xbeee('0x9'),JSON[_0xbeee('0xb')](_0xfa37bd));if(_0xfa37bd[_0xbeee('0xc')]){if(_0xfa37bd[_0xbeee('0xc')][_0xbeee('0xd')]===0x1f4){logger[_0xbeee('0xc')](_0xbeee('0xe'),_0x2bf12e,_0xfa37bd[_0xbeee('0xc')][_0xbeee('0xf')]);return _0x236be1(_0xfa37bd['error'][_0xbeee('0xf')]);}logger[_0xbeee('0xc')]('DeskConfiguration,\x20%s,\x20%s',_0x2bf12e,_0xfa37bd[_0xbeee('0xc')]['message']);return _0x4dc25f(_0xfa37bd[_0xbeee('0xc')]['message']);}else{logger[_0xbeee('0x10')](_0xbeee('0xe'),_0x2bf12e,_0xbeee('0x9'));_0x4dc25f(_0xfa37bd[_0xbeee('0x11')]['message']);}})['catch'](function(_0x3ac978){logger[_0xbeee('0xc')]('DeskConfiguration,\x20%s,\x20%s',_0x2bf12e,_0x3ac978);_0x236be1(_0x3ac978);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index c6f13c7..e903875 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 _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 +var _0x6738=['get','/:id','show','put','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','isAuthenticated'];(function(_0x316aa2,_0x2eb7a0){var _0x45343e=function(_0x4a4241){while(--_0x4a4241){_0x316aa2['push'](_0x316aa2['shift']());}};_0x45343e(++_0x2eb7a0);}(_0x6738,0x16f));var _0x8673=function(_0x312e7e,_0x1c49a8){_0x312e7e=_0x312e7e-0x0;var _0x1ccdec=_0x6738[_0x312e7e];return _0x1ccdec;};'use strict';var multer=require(_0x8673('0x0'));var util=require('util');var path=require(_0x8673('0x1'));var timeout=require(_0x8673('0x2'));var express=require(_0x8673('0x3'));var router=express[_0x8673('0x4')]();var fs_extra=require(_0x8673('0x5'));var auth=require(_0x8673('0x6'));var interaction=require(_0x8673('0x7'));var config=require(_0x8673('0x8'));var controller=require(_0x8673('0x9'));router['get']('/',auth[_0x8673('0xa')](),controller['index']);router[_0x8673('0xb')](_0x8673('0xc'),auth[_0x8673('0xa')](),controller[_0x8673('0xd')]);router['post']('/',auth[_0x8673('0xa')](),controller['create']);router[_0x8673('0xe')](_0x8673('0xc'),auth[_0x8673('0xa')](),controller[_0x8673('0xf')]);router['delete']('/:id',auth[_0x8673('0xa')](),controller[_0x8673('0x10')]);module[_0x8673('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 0597c34..27d5626 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 _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 +var _0x5996=['ENUM','string','variable','keyValue','picklist','STRING','customVariable','sequelize'];(function(_0x5cd056,_0x54b935){var _0x3885f1=function(_0x237673){while(--_0x237673){_0x5cd056['push'](_0x5cd056['shift']());}};_0x3885f1(++_0x54b935);}(_0x5996,0x1c7));var _0x6599=function(_0x41e1d7,_0x3aa85d){_0x41e1d7=_0x41e1d7-0x0;var _0x256d60=_0x5996[_0x41e1d7];return _0x256d60;};'use strict';var Sequelize=require(_0x6599('0x0'));module['exports']={'type':{'type':Sequelize[_0x6599('0x1')](_0x6599('0x2'),_0x6599('0x3'),'customVariable',_0x6599('0x4'),_0x6599('0x5')),'defaultValue':_0x6599('0x2')},'content':{'type':Sequelize[_0x6599('0x6')]},'key':{'type':Sequelize[_0x6599('0x6')]},'keyType':{'type':Sequelize['ENUM']('string','variable',_0x6599('0x7'))},'keyContent':{'type':Sequelize[_0x6599('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x6599('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6599('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 2bc315e..449345c 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 _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 +var _0x4af9=['include','find','create','body','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','map','DeskField','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params'];(function(_0x51f895,_0x4ca3d0){var _0x4dfd53=function(_0x44cdda){while(--_0x44cdda){_0x51f895['push'](_0x51f895['shift']());}};_0x4dfd53(++_0x4ca3d0);}(_0x4af9,0x12c));var _0x94af=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4af9[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x94af('0x0'));var rimraf=require(_0x94af('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x94af('0x2'));var moment=require(_0x94af('0x3'));var BPromise=require(_0x94af('0x4'));var Mustache=require(_0x94af('0x5'));var util=require(_0x94af('0x6'));var path=require(_0x94af('0x7'));var sox=require(_0x94af('0x8'));var csv=require('to-csv');var ejs=require(_0x94af('0x9'));var fs=require('fs');var fs_extra=require(_0x94af('0xa'));var _=require(_0x94af('0xb'));var squel=require(_0x94af('0xc'));var crypto=require('crypto');var jsforce=require(_0x94af('0xd'));var deskjs=require(_0x94af('0xe'));var toCsv=require(_0x94af('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x94af('0x10'));var authService=require(_0x94af('0x11'));var qs=require(_0x94af('0x12'));var as=require(_0x94af('0x13'));var hardwareService=require(_0x94af('0x14'));var logger=require(_0x94af('0x15'))('api');var utils=require(_0x94af('0x16'));var config=require(_0x94af('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x94af('0x18'))['db'];function respondWithStatusCode(_0x36fb24,_0x1621a9){_0x1621a9=_0x1621a9||0xcc;return function(_0x38108a){if(_0x38108a){return _0x36fb24[_0x94af('0x19')](_0x1621a9);}return _0x36fb24['status'](_0x1621a9)[_0x94af('0x1a')]();};}function respondWithResult(_0x4dd013,_0x598dff){_0x598dff=_0x598dff||0xc8;return function(_0x4d080c){if(_0x4d080c){return _0x4dd013[_0x94af('0x1b')](_0x598dff)[_0x94af('0x1c')](_0x4d080c);}};}function respondWithFilteredResult(_0x2313a1,_0x356a17){return function(_0x49eb9f){if(_0x49eb9f){var _0x275c63=typeof _0x356a17[_0x94af('0x1d')]==='undefined'&&typeof _0x356a17[_0x94af('0x1e')]===_0x94af('0x1f');var _0x11ee85=_0x49eb9f[_0x94af('0x20')];var _0x414bc9=_0x275c63?0x0:_0x356a17[_0x94af('0x1d')];var _0x19369b=_0x275c63?_0x49eb9f[_0x94af('0x20')]:_0x356a17[_0x94af('0x1d')]+_0x356a17[_0x94af('0x1e')];var _0x4a9d75;if(_0x19369b>=_0x11ee85){_0x19369b=_0x11ee85;_0x4a9d75=0xc8;}else{_0x4a9d75=0xce;}_0x2313a1['status'](_0x4a9d75);return _0x2313a1[_0x94af('0x21')](_0x94af('0x22'),_0x414bc9+'-'+_0x19369b+'/'+_0x11ee85)[_0x94af('0x1c')](_0x49eb9f);}return null;};}function patchUpdates(_0x17bfcc){return function(_0x472960){try{jsonpatch[_0x94af('0x23')](_0x472960,_0x17bfcc,!![]);}catch(_0x4adbea){return BPromise[_0x94af('0x24')](_0x4adbea);}return _0x472960['save']();};}function saveUpdates(_0x3b7cb9,_0x587ddb){return function(_0xa0cf1a){if(_0xa0cf1a){return _0xa0cf1a[_0x94af('0x25')](_0x3b7cb9)[_0x94af('0x26')](function(_0x521828){return _0x521828;});}return null;};}function removeEntity(_0x3f22f3,_0x2434fe){return function(_0x906599){if(_0x906599){return _0x906599[_0x94af('0x27')]()['then'](function(){_0x3f22f3[_0x94af('0x1b')](0xcc)[_0x94af('0x1a')]();});}};}function handleEntityNotFound(_0x24e8a0,_0x3b6152){return function(_0x202e5c){if(!_0x202e5c){_0x24e8a0[_0x94af('0x19')](0x194);}return _0x202e5c;};}function handleError(_0x1b3b4a,_0xc85250){_0xc85250=_0xc85250||0x1f4;return function(_0x131a93){logger['error'](_0x131a93[_0x94af('0x28')]);if(_0x131a93['name']){delete _0x131a93[_0x94af('0x29')];}_0x1b3b4a[_0x94af('0x1b')](_0xc85250)[_0x94af('0x2a')](_0x131a93);};}exports['index']=function(_0x16d7cf,_0x10eeb0){var _0x51d827={},_0x3332a5={},_0x1b40b0={'count':0x0,'rows':[]};var _0x331fc9=_[_0x94af('0x2b')](db[_0x94af('0x2c')][_0x94af('0x2d')],function(_0x54a14a){return{'name':_0x54a14a[_0x94af('0x2e')],'type':_0x54a14a['type']['key']};});_0x3332a5[_0x94af('0x2f')]=_[_0x94af('0x2b')](_0x331fc9,_0x94af('0x29'));_0x3332a5[_0x94af('0x30')]=_[_0x94af('0x31')](_0x16d7cf['query']);_0x3332a5[_0x94af('0x32')]=_[_0x94af('0x33')](_0x3332a5['model'],_0x3332a5[_0x94af('0x30')]);_0x51d827[_0x94af('0x34')]=_[_0x94af('0x33')](_0x3332a5[_0x94af('0x2f')],qs[_0x94af('0x35')](_0x16d7cf[_0x94af('0x30')][_0x94af('0x35')]));_0x51d827['attributes']=_0x51d827[_0x94af('0x34')][_0x94af('0x36')]?_0x51d827[_0x94af('0x34')]:_0x3332a5[_0x94af('0x2f')];if(!_0x16d7cf[_0x94af('0x30')][_0x94af('0x37')](_0x94af('0x38'))){_0x51d827[_0x94af('0x1e')]=qs[_0x94af('0x1e')](_0x16d7cf['query'][_0x94af('0x1e')]);_0x51d827[_0x94af('0x1d')]=qs[_0x94af('0x1d')](_0x16d7cf[_0x94af('0x30')][_0x94af('0x1d')]);}_0x51d827['order']=qs[_0x94af('0x39')](_0x16d7cf[_0x94af('0x30')][_0x94af('0x39')]);_0x51d827[_0x94af('0x3a')]=qs['filters'](_[_0x94af('0x3b')](_0x16d7cf['query'],_0x3332a5['filters']),_0x331fc9);if(_0x16d7cf['query'][_0x94af('0x3c')]){_0x51d827[_0x94af('0x3a')]=_['merge'](_0x51d827[_0x94af('0x3a')],{'$or':_['map'](_0x331fc9,function(_0x2ec124){if(_0x2ec124['type']!==_0x94af('0x3d')){var _0x2017fa={};_0x2017fa[_0x2ec124[_0x94af('0x29')]]={'$like':'%'+_0x16d7cf[_0x94af('0x30')][_0x94af('0x3c')]+'%'};return _0x2017fa;}})});}_0x51d827=_[_0x94af('0x3e')]({},_0x51d827,_0x16d7cf[_0x94af('0x3f')]);var _0x385b74={'where':_0x51d827[_0x94af('0x3a')]};return db[_0x94af('0x2c')][_0x94af('0x20')](_0x385b74)['then'](function(_0x416913){_0x1b40b0[_0x94af('0x20')]=_0x416913;if(_0x16d7cf['query'][_0x94af('0x40')]){_0x51d827['include']=[{'all':!![]}];}return db[_0x94af('0x2c')][_0x94af('0x41')](_0x51d827);})[_0x94af('0x26')](function(_0x4cf8b9){_0x1b40b0[_0x94af('0x42')]=_0x4cf8b9;return _0x1b40b0;})['then'](respondWithFilteredResult(_0x10eeb0,_0x51d827))[_0x94af('0x43')](handleError(_0x10eeb0,null));};exports[_0x94af('0x44')]=function(_0x501945,_0xa9fb04){var _0x144adc={'raw':!![],'where':{'id':_0x501945[_0x94af('0x45')]['id']}},_0x10d45b={};_0x10d45b[_0x94af('0x2f')]=_[_0x94af('0x31')](db[_0x94af('0x2c')][_0x94af('0x2d')]);_0x10d45b['query']=_[_0x94af('0x31')](_0x501945['query']);_0x10d45b[_0x94af('0x32')]=_[_0x94af('0x33')](_0x10d45b[_0x94af('0x2f')],_0x10d45b[_0x94af('0x30')]);_0x144adc[_0x94af('0x34')]=_[_0x94af('0x33')](_0x10d45b['model'],qs[_0x94af('0x35')](_0x501945[_0x94af('0x30')][_0x94af('0x35')]));_0x144adc[_0x94af('0x34')]=_0x144adc['attributes'][_0x94af('0x36')]?_0x144adc[_0x94af('0x34')]:_0x10d45b[_0x94af('0x2f')];if(_0x501945[_0x94af('0x30')][_0x94af('0x40')]){_0x144adc[_0x94af('0x46')]=[{'all':!![]}];}_0x144adc=_['merge']({},_0x144adc,_0x501945['options']);return db[_0x94af('0x2c')][_0x94af('0x47')](_0x144adc)[_0x94af('0x26')](handleEntityNotFound(_0xa9fb04,null))[_0x94af('0x26')](respondWithResult(_0xa9fb04,null))[_0x94af('0x43')](handleError(_0xa9fb04,null));};exports[_0x94af('0x48')]=function(_0x4fd8b3,_0x111dc8){return db[_0x94af('0x2c')][_0x94af('0x48')](_0x4fd8b3[_0x94af('0x49')],{})[_0x94af('0x26')](respondWithResult(_0x111dc8,0xc9))[_0x94af('0x43')](handleError(_0x111dc8,null));};exports[_0x94af('0x25')]=function(_0x5ed5b6,_0x321cf6){if(_0x5ed5b6['body']['id']){delete _0x5ed5b6[_0x94af('0x49')]['id'];}return db[_0x94af('0x2c')][_0x94af('0x47')]({'where':{'id':_0x5ed5b6[_0x94af('0x45')]['id']}})[_0x94af('0x26')](handleEntityNotFound(_0x321cf6,null))[_0x94af('0x26')](saveUpdates(_0x5ed5b6[_0x94af('0x49')],null))[_0x94af('0x26')](respondWithResult(_0x321cf6,null))[_0x94af('0x43')](handleError(_0x321cf6,null));};exports[_0x94af('0x27')]=function(_0x3c0945,_0x5ccfe){return db[_0x94af('0x2c')]['find']({'where':{'id':_0x3c0945[_0x94af('0x45')]['id']}})[_0x94af('0x26')](handleEntityNotFound(_0x5ccfe,null))[_0x94af('0x26')](removeEntity(_0x5ccfe,null))[_0x94af('0x43')](handleError(_0x5ccfe,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index f9218dc..7527094 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 _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 +var _0x71b0=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports','define','idField','FieldId'];(function(_0x2e21b0,_0x1d50dc){var _0x4e054d=function(_0x1bca61){while(--_0x1bca61){_0x2e21b0['push'](_0x2e21b0['shift']());}};_0x4e054d(++_0x1d50dc);}(_0x71b0,0x195));var _0x071b=function(_0x5f3fa5,_0x1ba1c5){_0x5f3fa5=_0x5f3fa5-0x0;var _0x486861=_0x71b0[_0x5f3fa5];return _0x486861;};'use strict';var _=require(_0x071b('0x0'));var util=require(_0x071b('0x1'));var logger=require(_0x071b('0x2'))(_0x071b('0x3'));var moment=require(_0x071b('0x4'));var BPromise=require(_0x071b('0x5'));var rp=require(_0x071b('0x6'));var fs=require('fs');var path=require(_0x071b('0x7'));var rimraf=require(_0x071b('0x8'));var config=require(_0x071b('0x9'));var attributes=require(_0x071b('0xa'));module[_0x071b('0xb')]=function(_0x133f30,_0x3724b8){return _0x133f30[_0x071b('0xc')]('DeskField',attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0x071b('0xd'),_0x071b('0xe')],'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 2e3014a..b44d5b6 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 _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 +var _0x7bf5=['info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7bf5,0xf1));var _0x57bf=function(_0x2b202c,_0x41a18c){_0x2b202c=_0x2b202c-0x0;var _0x2cdd44=_0x7bf5[_0x2b202c];return _0x2cdd44;};'use strict';var _=require(_0x57bf('0x0'));var util=require(_0x57bf('0x1'));var moment=require(_0x57bf('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x57bf('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x57bf('0x4'));var logger=require(_0x57bf('0x5'))(_0x57bf('0x6'));var config=require(_0x57bf('0x7'));var jayson=require(_0x57bf('0x8'));var client=jayson[_0x57bf('0x9')][_0x57bf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x24aa25,_0x541eda,_0x50af09){return new BPromise(function(_0x2f932c,_0xd9e94f){return client['request'](_0x24aa25,_0x50af09)[_0x57bf('0xb')](function(_0x378074){logger[_0x57bf('0xc')](_0x57bf('0xd'),_0x541eda,_0x57bf('0xe'));logger[_0x57bf('0xf')](_0x57bf('0x10'),_0x541eda,'request\x20sent',JSON[_0x57bf('0x11')](_0x378074));if(_0x378074[_0x57bf('0x12')]){if(_0x378074[_0x57bf('0x12')][_0x57bf('0x13')]===0x1f4){logger[_0x57bf('0x12')](_0x57bf('0xd'),_0x541eda,_0x378074[_0x57bf('0x12')][_0x57bf('0x14')]);return _0xd9e94f(_0x378074[_0x57bf('0x12')][_0x57bf('0x14')]);}logger[_0x57bf('0x12')](_0x57bf('0xd'),_0x541eda,_0x378074[_0x57bf('0x12')][_0x57bf('0x14')]);return _0x2f932c(_0x378074[_0x57bf('0x12')][_0x57bf('0x14')]);}else{logger[_0x57bf('0xc')](_0x57bf('0xd'),_0x541eda,_0x57bf('0xe'));_0x2f932c(_0x378074[_0x57bf('0x15')]['message']);}})[_0x57bf('0x16')](function(_0x31bd7a){logger[_0x57bf('0x12')](_0x57bf('0xd'),_0x541eda,_0x31bd7a);_0xd9e94f(_0x31bd7a);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index bc1dc78..b5330bf 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 _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 +var _0x32fd=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','index','/:id','isAuthenticated','getConfigurations','post','create','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','multer','util','express','Router'];(function(_0x343973,_0x13a241){var _0x3125b3=function(_0xd5dd61){while(--_0xd5dd61){_0x343973['push'](_0x343973['shift']());}};_0x3125b3(++_0x13a241);}(_0x32fd,0x9d));var _0xd32f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x32fd[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd32f('0x0'));var util=require(_0xd32f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd32f('0x2'));var router=express[_0xd32f('0x3')]();var fs_extra=require(_0xd32f('0x4'));var auth=require(_0xd32f('0x5'));var interaction=require(_0xd32f('0x6'));var config=require(_0xd32f('0x7'));var controller=require(_0xd32f('0x8'));router[_0xd32f('0x9')]('/',auth['isAuthenticated'](),controller[_0xd32f('0xa')]);router['get'](_0xd32f('0xb'),auth[_0xd32f('0xc')](),controller['show']);router[_0xd32f('0x9')]('/:id/configurations',auth[_0xd32f('0xc')](),controller[_0xd32f('0xd')]);router[_0xd32f('0x9')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0xd32f('0xe')]('/',auth['isAuthenticated'](),controller[_0xd32f('0xf')]);router[_0xd32f('0xe')](_0xd32f('0x10'),auth[_0xd32f('0xc')](),controller[_0xd32f('0x11')]);router[_0xd32f('0x12')](_0xd32f('0xb'),auth[_0xd32f('0xc')](),controller[_0xd32f('0x13')]);router[_0xd32f('0x14')]('/:id',auth[_0xd32f('0xc')](),controller[_0xd32f('0x15')]);module[_0xd32f('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index f003f04..33ab059 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 _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 +var _0x0ec6=['STRING','BOOLEAN','sequelize'];(function(_0x4be1e5,_0xacc104){var _0x41457d=function(_0x2ecb5b){while(--_0x2ecb5b){_0x4be1e5['push'](_0x4be1e5['shift']());}};_0x41457d(++_0xacc104);}(_0x0ec6,0x1f1));var _0x60ec=function(_0xf8bc13,_0x22eff0){_0xf8bc13=_0xf8bc13-0x0;var _0x5aa95e=_0x0ec6[_0xf8bc13];return _0x5aa95e;};'use strict';var Sequelize=require(_0x60ec('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x60ec('0x1')]},'password':{'type':Sequelize[_0x60ec('0x1')]},'remoteUri':{'type':Sequelize[_0x60ec('0x1')]},'tenantId':{'type':Sequelize[_0x60ec('0x1')]},'clientId':{'type':Sequelize[_0x60ec('0x1')]},'clientSecret':{'type':Sequelize[_0x60ec('0x1')]},'serverUrl':{'type':Sequelize[_0x60ec('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x60ec('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 57f794e..2e8db22 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 _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 +var _0xefd7=['length','hasOwnProperty','order','sort','where','pick','filter','merge','type','options','include','rows','catch','show','params','Dynamics365Account','keys','includeAll','find','create','body','getConfigurations','Dynamics365Configuration','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','Dynamics365Field','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','incident','Incident','PhoneCall','description','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridyominame','entitlementidname','entityimage_url','escalatedon','firstresponsebykpiidname','followupby','lastonholdtime','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','primarycontactidname','primarycontactidyominame','prioritycodename','productserialnumber','resolveby','responseby','sentimentvalue','socialprofileidname','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','findOne','username','password','tenantId','clientSecret','modernAuthentication','CloudProvider','data7','access_token','data5','remoteUri','https://login.microsoftonline.com/','/oauth2/token','clientId','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','value','MetadataId',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','Attributes','remove','includes','LogicalName','@odata.type','push','all','forEach','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StateAttributeMetadata','test','error','send','Wrong\x20credentials','statusCode','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','lodash','../../components/parsers/qs','../../config/logger','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields'];(function(_0x4300b3,_0x38ee7f){var _0x8620ab=function(_0xe53d8d){while(--_0xe53d8d){_0x4300b3['push'](_0x4300b3['shift']());}};_0x8620ab(++_0x38ee7f);}(_0xefd7,0x99));var _0x7efd=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xefd7[_0x501510];return _0x1e6ee5;};'use strict';var rp=require(_0x7efd('0x0'));var util=require('util');var _=require(_0x7efd('0x1'));var qs=require(_0x7efd('0x2'));var logger=require(_0x7efd('0x3'))('api');var db=require(_0x7efd('0x4'))['db'];var integrations=require(_0x7efd('0x5'));function respondWithResult(_0x453838,_0x2f98c8){_0x2f98c8=_0x2f98c8||0xc8;return function(_0x51664e){if(_0x51664e){return _0x453838[_0x7efd('0x6')](_0x2f98c8)[_0x7efd('0x7')](_0x51664e);}};}function respondWithFilteredResult(_0x3be366,_0x3bb89f){return function(_0x2bb11b){if(_0x2bb11b){var _0x1d0cc9=typeof _0x3bb89f[_0x7efd('0x8')]===_0x7efd('0x9')&&typeof _0x3bb89f[_0x7efd('0xa')]==='undefined';var _0x43b9f0=_0x2bb11b[_0x7efd('0xb')];var _0x511ccc=_0x1d0cc9?0x0:_0x3bb89f[_0x7efd('0x8')];var _0x24d2b0=_0x1d0cc9?_0x2bb11b['count']:_0x3bb89f[_0x7efd('0x8')]+_0x3bb89f[_0x7efd('0xa')];var _0x5ba66b;if(_0x24d2b0>=_0x43b9f0){_0x24d2b0=_0x43b9f0;_0x5ba66b=0xc8;}else{_0x5ba66b=0xce;}_0x3be366[_0x7efd('0x6')](_0x5ba66b);return _0x3be366[_0x7efd('0xc')](_0x7efd('0xd'),_0x511ccc+'-'+_0x24d2b0+'/'+_0x43b9f0)['json'](_0x2bb11b);}return null;};}function saveUpdates(_0x5e017c){return function(_0x424da9){if(_0x424da9){return _0x424da9[_0x7efd('0xe')](_0x5e017c)[_0x7efd('0xf')](function(_0x5f07c9){return _0x5f07c9;});}return null;};}function removeEntity(_0x17c1f4){return function(_0x37e9f2){if(_0x37e9f2){return _0x37e9f2[_0x7efd('0x10')]()['then'](function(){_0x17c1f4[_0x7efd('0x6')](0xcc)[_0x7efd('0x11')]();});}};}function handleEntityNotFound(_0x5280a2){return function(_0x196674){if(!_0x196674){_0x5280a2['sendStatus'](0x194);}return _0x196674;};}function handleError(_0x34d13f,_0x112555){_0x112555=_0x112555||0x1f4;return function(_0x1e6344){logger['error'](_0x1e6344[_0x7efd('0x12')]);if(_0x1e6344[_0x7efd('0x13')]){delete _0x1e6344[_0x7efd('0x13')];}_0x34d13f[_0x7efd('0x6')](_0x112555)['send'](_0x1e6344);};}exports['index']=function(_0x2f4b5a,_0x59ecda){var _0x58c994={},_0x2c4c16={},_0x176600={'count':0x0,'rows':[]};var _0x297134=_[_0x7efd('0x14')](db['Dynamics365Account'][_0x7efd('0x15')],function(_0x298374){return{'name':_0x298374[_0x7efd('0x16')],'type':_0x298374['type'][_0x7efd('0x17')]};});_0x2c4c16[_0x7efd('0x18')]=_[_0x7efd('0x14')](_0x297134,_0x7efd('0x13'));_0x2c4c16[_0x7efd('0x19')]=_['keys'](_0x2f4b5a[_0x7efd('0x19')]);_0x2c4c16[_0x7efd('0x1a')]=_[_0x7efd('0x1b')](_0x2c4c16[_0x7efd('0x18')],_0x2c4c16[_0x7efd('0x19')]);_0x58c994[_0x7efd('0x1c')]=_[_0x7efd('0x1b')](_0x2c4c16[_0x7efd('0x18')],qs['fields'](_0x2f4b5a[_0x7efd('0x19')][_0x7efd('0x1d')]));_0x58c994[_0x7efd('0x1c')]=_0x58c994['attributes'][_0x7efd('0x1e')]?_0x58c994[_0x7efd('0x1c')]:_0x2c4c16[_0x7efd('0x18')];if(!_0x2f4b5a['query'][_0x7efd('0x1f')]('nolimit')){_0x58c994[_0x7efd('0xa')]=qs[_0x7efd('0xa')](_0x2f4b5a[_0x7efd('0x19')]['limit']);_0x58c994[_0x7efd('0x8')]=qs['offset'](_0x2f4b5a['query'][_0x7efd('0x8')]);}_0x58c994[_0x7efd('0x20')]=qs[_0x7efd('0x21')](_0x2f4b5a[_0x7efd('0x19')][_0x7efd('0x21')]);_0x58c994[_0x7efd('0x22')]=qs[_0x7efd('0x1a')](_[_0x7efd('0x23')](_0x2f4b5a[_0x7efd('0x19')],_0x2c4c16[_0x7efd('0x1a')]),_0x297134);if(_0x2f4b5a['query'][_0x7efd('0x24')]){_0x58c994[_0x7efd('0x22')]=_[_0x7efd('0x25')](_0x58c994['where'],{'$or':_['map'](_0x297134,function(_0x4abb05){if(_0x4abb05[_0x7efd('0x26')]!=='VIRTUAL'){var _0x225ec8={};_0x225ec8[_0x4abb05[_0x7efd('0x13')]]={'$like':'%'+_0x2f4b5a[_0x7efd('0x19')][_0x7efd('0x24')]+'%'};return _0x225ec8;}})});}_0x58c994=_[_0x7efd('0x25')]({},_0x58c994,_0x2f4b5a[_0x7efd('0x27')]);var _0x52a350={'where':_0x58c994[_0x7efd('0x22')]};return db['Dynamics365Account'][_0x7efd('0xb')](_0x52a350)[_0x7efd('0xf')](function(_0x5f52c3){_0x176600['count']=_0x5f52c3;if(_0x2f4b5a['query']['includeAll']){_0x58c994[_0x7efd('0x28')]=[{'all':!![]}];}return db['Dynamics365Account']['findAll'](_0x58c994);})[_0x7efd('0xf')](function(_0x1a8ad1){_0x176600[_0x7efd('0x29')]=_0x1a8ad1;return _0x176600;})['then'](respondWithFilteredResult(_0x59ecda,_0x58c994))[_0x7efd('0x2a')](handleError(_0x59ecda,null));};exports[_0x7efd('0x2b')]=function(_0x1c8a4c,_0x37f661){var _0x29b757={'raw':![],'where':{'id':_0x1c8a4c[_0x7efd('0x2c')]['id']}},_0x19aa4d={};_0x19aa4d[_0x7efd('0x18')]=_['keys'](db[_0x7efd('0x2d')][_0x7efd('0x15')]);_0x19aa4d['query']=_[_0x7efd('0x2e')](_0x1c8a4c['query']);_0x19aa4d[_0x7efd('0x1a')]=_[_0x7efd('0x1b')](_0x19aa4d['model'],_0x19aa4d['query']);_0x29b757[_0x7efd('0x1c')]=_[_0x7efd('0x1b')](_0x19aa4d['model'],qs[_0x7efd('0x1d')](_0x1c8a4c[_0x7efd('0x19')][_0x7efd('0x1d')]));_0x29b757['attributes']=_0x29b757['attributes']['length']?_0x29b757[_0x7efd('0x1c')]:_0x19aa4d[_0x7efd('0x18')];if(_0x1c8a4c[_0x7efd('0x19')][_0x7efd('0x2f')]){_0x29b757['include']=[{'all':!![]}];}_0x29b757=_[_0x7efd('0x25')]({},_0x29b757,_0x1c8a4c['options']);return db[_0x7efd('0x2d')][_0x7efd('0x30')](_0x29b757)['then'](handleEntityNotFound(_0x37f661,null))[_0x7efd('0xf')](respondWithResult(_0x37f661,null))['catch'](handleError(_0x37f661,null));};exports[_0x7efd('0x31')]=function(_0x264d08,_0x2764a4){return db[_0x7efd('0x2d')][_0x7efd('0x31')](_0x264d08[_0x7efd('0x32')],{})[_0x7efd('0xf')](respondWithResult(_0x2764a4,0xc9))[_0x7efd('0x2a')](handleError(_0x2764a4,null));};exports[_0x7efd('0xe')]=function(_0x4d28b5,_0x47a63e){if(_0x4d28b5[_0x7efd('0x32')]['id']){delete _0x4d28b5[_0x7efd('0x32')]['id'];}return db['Dynamics365Account']['find']({'where':{'id':_0x4d28b5['params']['id']}})['then'](handleEntityNotFound(_0x47a63e,null))[_0x7efd('0xf')](saveUpdates(_0x4d28b5['body'],null))['then'](respondWithResult(_0x47a63e,null))['catch'](handleError(_0x47a63e,null));};exports[_0x7efd('0x10')]=function(_0x47e3f1,_0x51f96f){return db[_0x7efd('0x2d')][_0x7efd('0x30')]({'where':{'id':_0x47e3f1['params']['id']}})[_0x7efd('0xf')](handleEntityNotFound(_0x51f96f,null))[_0x7efd('0xf')](removeEntity(_0x51f96f,null))[_0x7efd('0x2a')](handleError(_0x51f96f,null));};exports[_0x7efd('0x33')]=function(_0x174bb8,_0x2737bb){var _0x4f0e23={};var _0x5e1b2c={};var _0x36f487;var _0x2951b4;return db[_0x7efd('0x2d')]['findOne']({'where':{'id':_0x174bb8[_0x7efd('0x2c')]['id']}})[_0x7efd('0xf')](handleEntityNotFound(_0x2737bb,null))[_0x7efd('0xf')](function(_0x586066){if(_0x586066){_0x36f487=_0x586066;_0x5e1b2c[_0x7efd('0x18')]=_[_0x7efd('0x2e')](db[_0x7efd('0x34')][_0x7efd('0x15')]);_0x5e1b2c[_0x7efd('0x19')]=_[_0x7efd('0x2e')](_0x174bb8['query']);_0x5e1b2c[_0x7efd('0x1a')]=_[_0x7efd('0x1b')](_0x5e1b2c[_0x7efd('0x18')],_0x5e1b2c[_0x7efd('0x19')]);_0x4f0e23[_0x7efd('0x1c')]=_[_0x7efd('0x1b')](_0x5e1b2c[_0x7efd('0x18')],qs[_0x7efd('0x1d')](_0x174bb8['query'][_0x7efd('0x1d')]));_0x4f0e23[_0x7efd('0x1c')]=_0x4f0e23['attributes'][_0x7efd('0x1e')]?_0x4f0e23[_0x7efd('0x1c')]:_0x5e1b2c[_0x7efd('0x18')];_0x4f0e23[_0x7efd('0x20')]=qs[_0x7efd('0x21')](_0x174bb8[_0x7efd('0x19')]['sort']);_0x4f0e23[_0x7efd('0x22')]=qs[_0x7efd('0x1a')](_[_0x7efd('0x23')](_0x174bb8[_0x7efd('0x19')],_0x5e1b2c[_0x7efd('0x1a')]));if(_0x174bb8[_0x7efd('0x19')][_0x7efd('0x24')]){_0x4f0e23[_0x7efd('0x22')]=_[_0x7efd('0x25')](_0x4f0e23[_0x7efd('0x22')],{'$or':_[_0x7efd('0x14')](_0x4f0e23['attributes'],function(_0x40f3e2){var _0x5d1359={};_0x5d1359[_0x40f3e2]={'$like':'%'+_0x174bb8[_0x7efd('0x19')]['filter']+'%'};return _0x5d1359;})});}_0x4f0e23=_['merge']({},_0x4f0e23,_0x174bb8['options']);return _0x36f487['getConfigurations'](_0x4f0e23);}})['then'](function(_0x4af68d){if(_0x4af68d){_0x2951b4=_0x4af68d['length'];if(!_0x174bb8['query'][_0x7efd('0x1f')](_0x7efd('0x35'))){_0x4f0e23[_0x7efd('0xa')]=qs[_0x7efd('0xa')](_0x174bb8[_0x7efd('0x19')][_0x7efd('0xa')]);_0x4f0e23[_0x7efd('0x8')]=qs[_0x7efd('0x8')](_0x174bb8[_0x7efd('0x19')][_0x7efd('0x8')]);}return _0x36f487['getConfigurations'](_0x4f0e23);}})[_0x7efd('0xf')](function(_0x1af11a){if(_0x1af11a){return _0x1af11a?{'count':_0x2951b4,'rows':_0x1af11a}:null;}})['then'](respondWithResult(_0x2737bb,null))['catch'](handleError(_0x2737bb,null));};exports[_0x7efd('0x36')]=function(_0x2d755e,_0x58065d){if(_0x2d755e['body']['id']){delete _0x2d755e['body']['id'];}return db[_0x7efd('0x2d')]['findOne']({'where':{'id':_0x2d755e['params']['id']}})['then'](handleEntityNotFound(_0x58065d,null))[_0x7efd('0xf')](function(_0x1f4d2b){if(_0x1f4d2b){_0x2d755e[_0x7efd('0x32')][_0x7efd('0x37')]=_0x1f4d2b['id'];_0x2d755e[_0x7efd('0x32')][_0x7efd('0x38')]=integrations[_0x7efd('0x39')](_0x2d755e[_0x7efd('0x32')][_0x7efd('0x3a')],_0x2d755e['body']['type']);_0x2d755e['body']['Descriptions']=integrations[_0x7efd('0x3b')](_0x2d755e[_0x7efd('0x32')][_0x7efd('0x3a')],_0x2d755e['body'][_0x7efd('0x26')]);return db['Dynamics365Configuration']['create'](_0x2d755e[_0x7efd('0x32')],{'include':[{'model':db['Dynamics365Field'],'as':_0x7efd('0x38')},{'model':db[_0x7efd('0x3c')],'as':'Descriptions'}]});}return null;})[_0x7efd('0xf')](respondWithResult(_0x58065d,null))['catch'](handleError(_0x58065d,null));};function sanitizeRemoteUri(_0x3ec6da){var _0x5d0dda=_0x3ec6da[_0x7efd('0x3d')](-0x1);if(_0x5d0dda==='/')return _0x3ec6da[_0x7efd('0x3e')](0x0,_0x3ec6da[_0x7efd('0x3f')](_0x5d0dda));return _0x3ec6da;}function getWebApiUrl(_0x32e1cf){return util[_0x7efd('0x40')](_0x7efd('0x41'),_0x32e1cf);}exports['getFields']=function(_0x3da8fd,_0x590142){var _0x32e001=_0x3da8fd['query']['ticketType'];var _0x19dff6=_0x32e001===_0x7efd('0x42')?_0x7efd('0x43'):_0x7efd('0x44');var _0xc0fb5c='';var _0x4bb083='';var _0x176b3e='';var _0x574d86='';var _0x5a177f='';var _0x378422='';var _0x73922a='';var _0x37942d='';var _0x2c0b9e=['title',_0x7efd('0x45'),_0x7efd('0x46'),_0x7efd('0x47'),_0x7efd('0x48'),_0x7efd('0x49'),_0x7efd('0x4a'),_0x7efd('0x4b'),_0x7efd('0x4c'),_0x7efd('0x4d')];var _0x27652a=[_0x7efd('0x4e'),_0x7efd('0x4f'),_0x7efd('0x50'),_0x7efd('0x51'),'contactidname','contactidyominame',_0x7efd('0x52'),_0x7efd('0x53'),_0x7efd('0x54'),_0x7efd('0x55'),_0x7efd('0x56'),_0x7efd('0x57'),'createdon',_0x7efd('0x58'),_0x7efd('0x59'),_0x7efd('0x5a'),'customeridtype',_0x7efd('0x5b'),'emailaddress',_0x7efd('0x5c'),'entityimage_timestamp',_0x7efd('0x5d'),_0x7efd('0x5e'),'exchangerate',_0x7efd('0x5f'),_0x7efd('0x60'),'importsequencenumber','influencescore','kbarticleidname',_0x7efd('0x61'),'masteridname',_0x7efd('0x62'),_0x7efd('0x63'),'modifiedbyname',_0x7efd('0x64'),_0x7efd('0x65'),_0x7efd('0x66'),_0x7efd('0x67'),_0x7efd('0x68'),'msdyn_iotalertname',_0x7efd('0x69'),_0x7efd('0x6a'),_0x7efd('0x6b'),_0x7efd('0x6c'),'owneridtype','owneridyominame','parentcaseidname',_0x7efd('0x6d'),_0x7efd('0x6e'),_0x7efd('0x6f'),'productidname',_0x7efd('0x70'),_0x7efd('0x71'),'resolvebykpiidname',_0x7efd('0x72'),'responsiblecontactidname','responsiblecontactidyominame',_0x7efd('0x73'),'slainvokedidname','slaname',_0x7efd('0x74'),'statecode',_0x7efd('0x75'),_0x7efd('0x76'),_0x7efd('0x77'),_0x7efd('0x78'),_0x7efd('0x79'),_0x7efd('0x7a'),_0x7efd('0x7b'),_0x7efd('0x7c')];var _0x300780=_0x2c0b9e[_0x7efd('0x7d')](_0x27652a);return db[_0x7efd('0x2d')][_0x7efd('0x7e')]({'where':{'id':_0x3da8fd[_0x7efd('0x2c')]['id']},'attributes':['id',_0x7efd('0x7f'),_0x7efd('0x80'),'remoteUri',_0x7efd('0x81'),'clientId',_0x7efd('0x82'),_0x7efd('0x83')],'include':[{'model':db[_0x7efd('0x84')],'as':_0x7efd('0x84'),'attributes':['id','data5',_0x7efd('0x85')]}]})[_0x7efd('0xf')](handleEntityNotFound(_0x590142,null))[_0x7efd('0xf')](function(_0xd864b){if(_0xd864b){if(_0xd864b[_0x7efd('0x83')]){_0xd864b[_0x7efd('0x86')]=_0xd864b['CloudProvider'][_0x7efd('0x87')];_0x37942d=sanitizeRemoteUri(_0xd864b[_0x7efd('0x84')][_0x7efd('0x85')]);_0x73922a=getWebApiUrl(_0x37942d);return _0xd864b;}_0x37942d=sanitizeRemoteUri(_0xd864b[_0x7efd('0x88')]);_0x73922a=getWebApiUrl(_0x37942d);var _0x4c97b9={'method':'POST','uri':_0x7efd('0x89')+_0xd864b[_0x7efd('0x81')]+_0x7efd('0x8a'),'form':{'client_id':_0xd864b[_0x7efd('0x8b')],'resource':_0x37942d,'username':_0xd864b[_0x7efd('0x7f')],'password':_0xd864b[_0x7efd('0x80')],'grant_type':_0x7efd('0x80'),'client_secret':_0xd864b[_0x7efd('0x82')]},'json':!![]};return rp(_0x4c97b9);}})[_0x7efd('0xf')](function(_0x521fe0){_0x378422=_0x521fe0[_0x7efd('0x86')];var _0x4852fa={'method':_0x7efd('0x8c'),'uri':encodeURI(_0x73922a+_0x7efd('0x8d')+_0x19dff6+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x378422,'If-None-Match':null,'OData-Version':_0x7efd('0x8e')},'json':!![]};return rp(_0x4852fa);})['then'](function(_0x2a7c8a){var _0x4ca5d8=_0x2a7c8a[_0x7efd('0x8f')][0x0];var _0x44b60d=_0x4ca5d8[_0x7efd('0x90')];var _0x136424={'method':_0x7efd('0x8c'),'uri':_0x73922a+'EntityDefinitions('+_0x44b60d+_0x7efd('0x91'),'headers':{'Authorization':_0x7efd('0x92')+_0x378422,'If-None-Match':null,'OData-Version':_0x7efd('0x8e')},'json':!![]};return rp(_0x136424);})[_0x7efd('0xf')](function(_0x382b37){_0xc0fb5c=_0x382b37;_0x4bb083=_0xc0fb5c[_0x7efd('0x93')];_0x4bb083=_[_0x7efd('0x94')](_0x4bb083,function(_0xa4c4c2){return!_0x300780[_0x7efd('0x95')](_0xa4c4c2[_0x7efd('0x96')]);});var _0xd9bfe6=[];var _0x35e6e1=[];_0x4bb083['forEach'](function(_0x3ccdab){if(_0x3ccdab[_0x7efd('0x97')]){var _0x51a083=_0x3ccdab['@odata.type'][_0x7efd('0x3e')](_0x3ccdab[_0x7efd('0x97')][_0x7efd('0x3f')]('.')+0x1);if(_0x51a083==='PicklistAttributeMetadata'){_0xd9bfe6[_0x7efd('0x98')](getSelectList(_0x73922a,_0x32e001,_0x35e6e1,_0xc0fb5c[_0x7efd('0x90')],_0x3ccdab[_0x7efd('0x90')],_0x378422));}}});return Promise[_0x7efd('0x99')](_0xd9bfe6);})[_0x7efd('0xf')](function(_0x2c75da){_0x176b3e=_0x2c75da[0x0];var _0x424d8d=[];var _0x5d5028=[];_0x4bb083[_0x7efd('0x9a')](function(_0x14b431){if(!_[_0x7efd('0x9b')](_0x14b431[_0x7efd('0x97')])){var _0x5ab854=_0x14b431[_0x7efd('0x97')]['substring'](_0x14b431[_0x7efd('0x97')][_0x7efd('0x3f')]('.')+0x1);if(_0x5ab854===_0x7efd('0x9c')){_0x424d8d['push'](getBooleanList(_0x73922a,_0x32e001,_0x5d5028,_0xc0fb5c[_0x7efd('0x90')],_0x14b431[_0x7efd('0x90')],_0x378422));}}});return Promise[_0x7efd('0x99')](_0x424d8d);})[_0x7efd('0xf')](function(_0xc4f4ac){_0x574d86=_0xc4f4ac[0x0];var _0x4c31aa=[];var _0x5b0b31=[];_0x4bb083[_0x7efd('0x9a')](function(_0x1d9192){if(_0x1d9192['@odata.type']){var _0x13e891=_0x1d9192['@odata.type'][_0x7efd('0x3e')](_0x1d9192[_0x7efd('0x97')][_0x7efd('0x3f')]('.')+0x1);if(_0x13e891===_0x7efd('0x9d')||_0x13e891===_0x7efd('0x9e')||_0x13e891===_0x7efd('0x9f')||_0x13e891==='IntegerAttributeMetadata'||_0x13e891===_0x7efd('0xa0')||_0x13e891===_0x7efd('0xa1')||_0x13e891==='StatusAttributeMetadata'||_0x13e891==='EntityNameAttributeMetadata'||_0x13e891===_0x7efd('0xa2')||_0x13e891==='DecimalAttributeMetadata'){_0x4c31aa[_0x7efd('0x98')](getInputList(_0x73922a,_0x32e001,_0x13e891,_0x5b0b31,_0xc0fb5c[_0x7efd('0x90')],_0x1d9192[_0x7efd('0x90')],_0x378422));}}});return Promise[_0x7efd('0x99')](_0x4c31aa);})[_0x7efd('0xf')](function(_0x3361cd){_0x5a177f=_0x3361cd[0x0];var _0x4c0809=_0x176b3e['concat'](_0x574d86)[_0x7efd('0x7d')](_0x5a177f);var _0x27fc3b={'count':_0x4c0809[_0x7efd('0x1e')],'rows':_0x4c0809};return _0x27fc3b;})[_0x7efd('0xf')](respondWithResult(_0x590142,null))['catch'](function(_0x905c26){var _0x11369a=_0x3da8fd[_0x7efd('0x19')][_0x7efd('0xa3')]?0x1f4:_0x905c26['statusCode']||0x1f4;logger[_0x7efd('0xa4')](_0x905c26[_0x7efd('0x12')]);delete _0x905c26[_0x7efd('0x13')];if(_0x11369a===0x191){_0x11369a=0x190;}_0x590142[_0x7efd('0x6')](_0x11369a)[_0x7efd('0xa5')](_0x3da8fd['query']['test']?{'message':_0x7efd('0xa6'),'statusCode':_0x905c26[_0x7efd('0xa7')]}:_0x905c26);});};function getSelectList(_0x1b747f,_0x24d465,_0x3f0601,_0x9cd2a,_0x361016,_0x1c12b8){var _0x5c384e={'method':_0x7efd('0x8c'),'uri':_0x1b747f+_0x7efd('0xa8')+_0x9cd2a+_0x7efd('0xa9')+_0x361016+_0x7efd('0xaa')+_0x7efd('0xab'),'headers':{'Authorization':_0x7efd('0x92')+_0x1c12b8,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x5c384e)['then'](function(_0x21d200){var _0x2b09b0=[];var _0x263eb5=_0x21d200[_0x7efd('0xac')][_0x7efd('0xad')];_0x263eb5[_0x7efd('0x9a')](function(_0x576fcc){_0x2b09b0[_0x7efd('0x98')]({'name':_0x576fcc[_0x7efd('0xae')][_0x7efd('0xaf')]['Label'],'value':String(_0x576fcc[_0x7efd('0xb0')])});});var _0x1f4869={'id':_0x24d465+'_'+_0x21d200[_0x7efd('0x96')],'name':_0x21d200[_0x7efd('0xb1')]['UserLocalizedLabel']['Label'],'custom':![],'options':_0x2b09b0};_0x3f0601[_0x7efd('0x98')](_0x1f4869);return _0x3f0601;});}function getBooleanList(_0x327d44,_0x1da5bf,_0x3beb7a,_0x2a83fd,_0x5ab0a5,_0x1c1120){var _0x4be134={'method':'GET','uri':_0x327d44+_0x7efd('0xa8')+_0x2a83fd+_0x7efd('0xa9')+_0x5ab0a5+_0x7efd('0xb2'),'headers':{'Authorization':_0x7efd('0x92')+_0x1c1120,'If-None-Match':null,'OData-Version':_0x7efd('0x8e')},'json':!![]};return rp(_0x4be134)[_0x7efd('0xf')](function(_0x2177e3){var _0x4b08f3=[];_0x4b08f3[_0x7efd('0x98')]({'name':_0x2177e3[_0x7efd('0xac')]['TrueOption']['Label'][_0x7efd('0xaf')]['Label'],'value':'true'},{'name':_0x2177e3[_0x7efd('0xac')][_0x7efd('0xb3')][_0x7efd('0xae')][_0x7efd('0xaf')][_0x7efd('0xae')],'value':_0x7efd('0xb4')});var _0x571faa={'id':_0x1da5bf+'_'+_0x2177e3[_0x7efd('0x96')],'name':_0x2177e3['DisplayName'][_0x7efd('0xaf')][_0x7efd('0xae')],'custom':![],'options':_0x4b08f3};_0x3beb7a['push'](_0x571faa);return _0x3beb7a;});}function getInputList(_0x591ad6,_0x4d7559,_0x51b6ea,_0x39d455,_0x7b82c4,_0x5bcd6b,_0x258002){var _0x338a41={'method':_0x7efd('0x8c'),'uri':_0x591ad6+'EntityDefinitions('+_0x7b82c4+_0x7efd('0xa9')+_0x5bcd6b+_0x7efd('0xb5')+_0x51b6ea+_0x7efd('0xb6'),'headers':{'Authorization':'Bearer\x20'+_0x258002,'If-None-Match':null,'OData-Version':_0x7efd('0x8e')},'json':!![]};return rp(_0x338a41)[_0x7efd('0xf')](function(_0x1d58bf){var _0xc6ddf2={'id':_0x4d7559+'_'+_0x1d58bf[_0x7efd('0x96')],'name':_0x1d58bf['DisplayName'][_0x7efd('0xaf')]?_0x1d58bf[_0x7efd('0xb1')]['UserLocalizedLabel'][_0x7efd('0xae')]:_0x1d58bf[_0x7efd('0x96')],'custom':![],'options':[]};_0x39d455[_0x7efd('0x98')](_0xc6ddf2);return _0x39d455;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index d228ec0..917b363 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['rimraf','./intDynamics365Account.attributes','../../components/integrations/configuration','Dynamics365Account','int_dynamics365_accounts','../../config/logger','api','moment','bluebird','path'];(function(_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 +var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts'];(function(_0x58c851,_0x1f3d96){var _0x534d8a=function(_0x10c1a0){while(--_0x10c1a0){_0x58c851['push'](_0x58c851['shift']());}};_0x534d8a(++_0x1f3d96);}(_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'));var integrations=require(_0x3071('0x8'));module[_0x3071('0x9')]=function(_0x41cf76,_0x1d3dd6){return _0x41cf76[_0x3071('0xa')](_0x3071('0xb'),attributes,{'tableName':_0x3071('0xc'),'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 b6032a8..2f03061 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 _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 +var _0x3e01=['bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','Dynamics365Account','findAll','options','raw','attributes','include','map','model','then','GetDynamics365Account','ShowDynamics365Account','find','where','stringify','lodash','util'];(function(_0x2fc960,_0x1ee68f){var _0x12353c=function(_0x5ee731){while(--_0x5ee731){_0x2fc960['push'](_0x2fc960['shift']());}};_0x12353c(++_0x1ee68f);}(_0x3e01,0x7e));var _0x13e0=function(_0x7818c1,_0x27ca7e){_0x7818c1=_0x7818c1-0x0;var _0x3ba860=_0x3e01[_0x7818c1];return _0x3ba860;};'use strict';var _=require(_0x13e0('0x0'));var util=require(_0x13e0('0x1'));var moment=require('moment');var BPromise=require(_0x13e0('0x2'));var rs=require(_0x13e0('0x3'));var fs=require('fs');var Redis=require(_0x13e0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x13e0('0x5'));var logger=require('../../config/logger')(_0x13e0('0x6'));var config=require(_0x13e0('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x13e0('0x8')][_0x13e0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x565155,_0x8b5a27,_0x34b7a1){return new BPromise(function(_0x73d146,_0x11c6ba){return client['request'](_0x565155,_0x34b7a1)['then'](function(_0xc98de1){logger['info'](_0x13e0('0xa'),_0x8b5a27,_0x13e0('0xb'));logger[_0x13e0('0xc')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x8b5a27,_0x13e0('0xb'),JSON['stringify'](_0xc98de1));if(_0xc98de1['error']){if(_0xc98de1[_0x13e0('0xd')][_0x13e0('0xe')]===0x1f4){logger[_0x13e0('0xd')](_0x13e0('0xa'),_0x8b5a27,_0xc98de1['error']['message']);return _0x11c6ba(_0xc98de1[_0x13e0('0xd')]['message']);}logger[_0x13e0('0xd')](_0x13e0('0xa'),_0x8b5a27,_0xc98de1['error'][_0x13e0('0xf')]);return _0x73d146(_0xc98de1[_0x13e0('0xd')][_0x13e0('0xf')]);}else{logger[_0x13e0('0x10')](_0x13e0('0xa'),_0x8b5a27,_0x13e0('0xb'));_0x73d146(_0xc98de1['result'][_0x13e0('0xf')]);}})[_0x13e0('0x11')](function(_0x2f7366){logger[_0x13e0('0xd')](_0x13e0('0xa'),_0x8b5a27,_0x2f7366);_0x11c6ba(_0x2f7366);});});}exports['GetDynamics365Account']=function(_0x2ad10e){var _0x8347be=this;return new Promise(function(_0x4f347d,_0x4d3877){return db[_0x13e0('0x12')][_0x13e0('0x13')]({'raw':_0x2ad10e['options']?_0x2ad10e[_0x13e0('0x14')][_0x13e0('0x15')]===undefined?!![]:![]:!![],'where':_0x2ad10e['options']?_0x2ad10e['options']['where']||null:null,'attributes':_0x2ad10e[_0x13e0('0x14')]?_0x2ad10e[_0x13e0('0x14')][_0x13e0('0x16')]||null:null,'limit':_0x2ad10e[_0x13e0('0x14')]?_0x2ad10e[_0x13e0('0x14')]['limit']||null:null,'include':_0x2ad10e[_0x13e0('0x14')]?_0x2ad10e[_0x13e0('0x14')][_0x13e0('0x17')]?_[_0x13e0('0x18')](_0x2ad10e[_0x13e0('0x14')][_0x13e0('0x17')],function(_0x197ef4){return{'model':db[_0x197ef4[_0x13e0('0x19')]],'as':_0x197ef4['as'],'attributes':_0x197ef4[_0x13e0('0x16')],'include':_0x197ef4['include']?_['map'](_0x197ef4[_0x13e0('0x17')],function(_0x15251e){return{'model':db[_0x15251e[_0x13e0('0x19')]],'as':_0x15251e['as'],'attributes':_0x15251e[_0x13e0('0x16')],'include':_0x15251e[_0x13e0('0x17')]?_['map'](_0x15251e[_0x13e0('0x17')],function(_0x23fa4b){return{'model':db[_0x23fa4b[_0x13e0('0x19')]],'as':_0x23fa4b['as'],'attributes':_0x23fa4b[_0x13e0('0x16')]};}):[]};}):[]};}):[]:[]})[_0x13e0('0x1a')](function(_0x3ca04a){logger[_0x13e0('0x10')](_0x13e0('0x1b'),_0x2ad10e);logger[_0x13e0('0xc')](_0x13e0('0x1b'),_0x2ad10e,JSON['stringify'](_0x3ca04a));_0x4f347d(_0x3ca04a);})[_0x13e0('0x11')](function(_0x5cf83f){logger[_0x13e0('0xd')](_0x13e0('0x1b'),_0x5cf83f[_0x13e0('0xf')],_0x2ad10e);_0x4d3877(_0x8347be['error'](0x1f4,_0x5cf83f[_0x13e0('0xf')]));});});};exports[_0x13e0('0x1c')]=function(_0x277b1b){var _0x3ecfa4=this;return new Promise(function(_0x34573c,_0x214ec0){return db[_0x13e0('0x12')][_0x13e0('0x1d')]({'raw':_0x277b1b['options']?_0x277b1b['options'][_0x13e0('0x15')]===undefined?!![]:![]:!![],'where':_0x277b1b['options']?_0x277b1b['options'][_0x13e0('0x1e')]||null:null,'attributes':_0x277b1b[_0x13e0('0x14')]?_0x277b1b[_0x13e0('0x14')][_0x13e0('0x16')]||null:null,'include':_0x277b1b[_0x13e0('0x14')]?_0x277b1b[_0x13e0('0x14')]['include']?_['map'](_0x277b1b[_0x13e0('0x14')][_0x13e0('0x17')],function(_0x55fb47){return{'model':db[_0x55fb47['model']],'as':_0x55fb47['as'],'attributes':_0x55fb47[_0x13e0('0x16')],'include':_0x55fb47['include']?_[_0x13e0('0x18')](_0x55fb47['include'],function(_0x26c596){return{'model':db[_0x26c596[_0x13e0('0x19')]],'as':_0x26c596['as'],'attributes':_0x26c596[_0x13e0('0x16')],'include':_0x26c596['include']?_[_0x13e0('0x18')](_0x26c596[_0x13e0('0x17')],function(_0x4bdce8){return{'model':db[_0x4bdce8['model']],'as':_0x4bdce8['as'],'attributes':_0x4bdce8[_0x13e0('0x16')]};}):[]};}):[]};}):[]:[]})[_0x13e0('0x1a')](function(_0x43cbfa){logger[_0x13e0('0x10')](_0x13e0('0x1c'),_0x277b1b);logger[_0x13e0('0xc')](_0x13e0('0x1c'),_0x277b1b,JSON[_0x13e0('0x1f')](_0x43cbfa));_0x34573c(_0x43cbfa);})[_0x13e0('0x11')](function(_0x498952){logger[_0x13e0('0xd')](_0x13e0('0x1c'),_0x498952[_0x13e0('0xf')],_0x277b1b);_0x214ec0(_0x3ecfa4[_0x13e0('0xd')](0x1f4,_0x498952[_0x13e0('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index e46c505..62f55d0 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 _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 +var _0x9140=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions','post','create','put','destroy','exports','multer','util'];(function(_0x395581,_0x22fd09){var _0x26c1fe=function(_0x2a81c8){while(--_0x2a81c8){_0x395581['push'](_0x395581['shift']());}};_0x26c1fe(++_0x22fd09);}(_0x9140,0x185));var _0x0914=function(_0x25ea92,_0x5a822e){_0x25ea92=_0x25ea92-0x0;var _0x273229=_0x9140[_0x25ea92];return _0x273229;};'use strict';var multer=require(_0x0914('0x0'));var util=require(_0x0914('0x1'));var path=require(_0x0914('0x2'));var timeout=require(_0x0914('0x3'));var express=require(_0x0914('0x4'));var router=express['Router']();var fs_extra=require(_0x0914('0x5'));var auth=require(_0x0914('0x6'));var interaction=require(_0x0914('0x7'));var config=require('../../config/environment');var controller=require(_0x0914('0x8'));router[_0x0914('0x9')]('/',auth[_0x0914('0xa')](),controller[_0x0914('0xb')]);router['get'](_0x0914('0xc'),auth[_0x0914('0xa')](),controller[_0x0914('0xd')]);router[_0x0914('0x9')](_0x0914('0xe'),auth[_0x0914('0xa')](),controller['getFields']);router[_0x0914('0x9')](_0x0914('0xf'),auth[_0x0914('0xa')](),controller[_0x0914('0x10')]);router[_0x0914('0x9')]('/:id/descriptions',auth[_0x0914('0xa')](),controller[_0x0914('0x11')]);router[_0x0914('0x12')]('/',auth[_0x0914('0xa')](),controller[_0x0914('0x13')]);router[_0x0914('0x14')](_0x0914('0xc'),auth[_0x0914('0xa')](),controller['update']);router['delete'](_0x0914('0xc'),auth[_0x0914('0xa')](),controller[_0x0914('0x15')]);module[_0x0914('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 934595f..158bddf 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 _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 +var _0x82df=['STRING','ENUM','incident','phonecall','contact','nothing','sequelize'];(function(_0x3db122,_0x5e6bee){var _0x325b67=function(_0x5095af){while(--_0x5095af){_0x3db122['push'](_0x3db122['shift']());}};_0x325b67(++_0x5e6bee);}(_0x82df,0xd1));var _0xf82d=function(_0x4588bd,_0x57222b){_0x4588bd=_0x4588bd-0x0;var _0x1becaa=_0x82df[_0x4588bd];return _0x1becaa;};'use strict';var Sequelize=require(_0xf82d('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf82d('0x1')]},'ticketType':{'type':Sequelize[_0xf82d('0x2')](_0xf82d('0x3'),_0xf82d('0x4')),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize[_0xf82d('0x2')](_0xf82d('0x5'),_0xf82d('0x6')),'defaultValue':'contact','allowNull':![]},'additionalSearchContact':{'type':Sequelize['STRING'],'allowNull':!![]},'openNewTab':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 168c869..4918229 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 _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 +var _0x2ef9=['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','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','error','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','destroy','findOne','Dynamics365Field','merge','getFields','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','crypto','jsforce'];(function(_0x517d36,_0x3fddc4){var _0x3dbd35=function(_0x5b7d38){while(--_0x5b7d38){_0x517d36['push'](_0x517d36['shift']());}};_0x3dbd35(++_0x3fddc4);}(_0x2ef9,0x137));var _0x92ef=function(_0x204652,_0x3e6238){_0x204652=_0x204652-0x0;var _0x3e8790=_0x2ef9[_0x204652];return _0x3e8790;};'use strict';var emlformat=require(_0x92ef('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x92ef('0x1'));var jsonpatch=require(_0x92ef('0x2'));var rp=require(_0x92ef('0x3'));var moment=require(_0x92ef('0x4'));var BPromise=require(_0x92ef('0x5'));var Mustache=require(_0x92ef('0x6'));var util=require(_0x92ef('0x7'));var path=require(_0x92ef('0x8'));var sox=require(_0x92ef('0x9'));var csv=require(_0x92ef('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x92ef('0xb'));var jsforce=require(_0x92ef('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x92ef('0xa'));var querystring=require('querystring');var Papa=require(_0x92ef('0xd'));var Redis=require(_0x92ef('0xe'));var authService=require(_0x92ef('0xf'));var qs=require(_0x92ef('0x10'));var as=require(_0x92ef('0x11'));var hardwareService=require(_0x92ef('0x12'));var logger=require('../../config/logger')(_0x92ef('0x13'));var utils=require(_0x92ef('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x92ef('0x15'));var db=require(_0x92ef('0x16'))['db'];function respondWithStatusCode(_0xb9a8f8,_0x5ac43c){_0x5ac43c=_0x5ac43c||0xcc;return function(_0x4a174d){if(_0x4a174d){return _0xb9a8f8[_0x92ef('0x17')](_0x5ac43c);}return _0xb9a8f8[_0x92ef('0x18')](_0x5ac43c)[_0x92ef('0x19')]();};}function respondWithResult(_0x351d7d,_0xc16358){_0xc16358=_0xc16358||0xc8;return function(_0x31469b){if(_0x31469b){return _0x351d7d[_0x92ef('0x18')](_0xc16358)[_0x92ef('0x1a')](_0x31469b);}};}function respondWithFilteredResult(_0x1f5de4,_0x7c3b83){return function(_0x3e7a39){if(_0x3e7a39){var _0x31ed07=typeof _0x7c3b83['offset']==='undefined'&&typeof _0x7c3b83[_0x92ef('0x1b')]===_0x92ef('0x1c');var _0xd666df=_0x3e7a39[_0x92ef('0x1d')];var _0x5162e5=_0x31ed07?0x0:_0x7c3b83['offset'];var _0x2e5c64=_0x31ed07?_0x3e7a39[_0x92ef('0x1d')]:_0x7c3b83[_0x92ef('0x1e')]+_0x7c3b83[_0x92ef('0x1b')];var _0x1b995a;if(_0x2e5c64>=_0xd666df){_0x2e5c64=_0xd666df;_0x1b995a=0xc8;}else{_0x1b995a=0xce;}_0x1f5de4['status'](_0x1b995a);return _0x1f5de4[_0x92ef('0x1f')](_0x92ef('0x20'),_0x5162e5+'-'+_0x2e5c64+'/'+_0xd666df)[_0x92ef('0x1a')](_0x3e7a39);}return null;};}function patchUpdates(_0x2678d9){return function(_0x19b058){try{jsonpatch[_0x92ef('0x21')](_0x19b058,_0x2678d9,!![]);}catch(_0x951c5b){return BPromise[_0x92ef('0x22')](_0x951c5b);}return _0x19b058[_0x92ef('0x23')]();};}function saveUpdates(_0x4658f4,_0x6ed5e2){return function(_0x2420c6){if(_0x2420c6){return _0x2420c6[_0x92ef('0x24')](_0x4658f4)[_0x92ef('0x25')](function(_0x56dc38){return _0x56dc38;});}return null;};}function removeEntity(_0xbdb4c9,_0x45870b){return function(_0x480368){if(_0x480368){return _0x480368['destroy']()[_0x92ef('0x25')](function(){_0xbdb4c9[_0x92ef('0x18')](0xcc)[_0x92ef('0x19')]();});}};}function handleEntityNotFound(_0x3b789d,_0x5a5b7b){return function(_0x214d07){if(!_0x214d07){_0x3b789d[_0x92ef('0x17')](0x194);}return _0x214d07;};}function handleError(_0x4d87d9,_0x39b0df){_0x39b0df=_0x39b0df||0x1f4;return function(_0x950569){logger[_0x92ef('0x26')](_0x950569['stack']);if(_0x950569['name']){delete _0x950569[_0x92ef('0x27')];}_0x4d87d9[_0x92ef('0x18')](_0x39b0df)[_0x92ef('0x28')](_0x950569);};}exports[_0x92ef('0x29')]=function(_0x49b8c2,_0x1f44f5){var _0x3fd112={},_0xbdcf={},_0x106473={'count':0x0,'rows':[]};var _0x60dbd7=_[_0x92ef('0x2a')](db[_0x92ef('0x2b')][_0x92ef('0x2c')],function(_0x279d0d){return{'name':_0x279d0d[_0x92ef('0x2d')],'type':_0x279d0d[_0x92ef('0x2e')][_0x92ef('0x2f')]};});_0xbdcf[_0x92ef('0x30')]=_[_0x92ef('0x2a')](_0x60dbd7,_0x92ef('0x27'));_0xbdcf[_0x92ef('0x31')]=_['keys'](_0x49b8c2[_0x92ef('0x31')]);_0xbdcf[_0x92ef('0x32')]=_[_0x92ef('0x33')](_0xbdcf[_0x92ef('0x30')],_0xbdcf[_0x92ef('0x31')]);_0x3fd112['attributes']=_['intersection'](_0xbdcf[_0x92ef('0x30')],qs[_0x92ef('0x34')](_0x49b8c2[_0x92ef('0x31')][_0x92ef('0x34')]));_0x3fd112[_0x92ef('0x35')]=_0x3fd112[_0x92ef('0x35')][_0x92ef('0x36')]?_0x3fd112['attributes']:_0xbdcf['model'];if(!_0x49b8c2[_0x92ef('0x31')][_0x92ef('0x37')](_0x92ef('0x38'))){_0x3fd112[_0x92ef('0x1b')]=qs[_0x92ef('0x1b')](_0x49b8c2[_0x92ef('0x31')][_0x92ef('0x1b')]);_0x3fd112[_0x92ef('0x1e')]=qs[_0x92ef('0x1e')](_0x49b8c2['query']['offset']);}_0x3fd112[_0x92ef('0x39')]=qs['sort'](_0x49b8c2[_0x92ef('0x31')][_0x92ef('0x3a')]);_0x3fd112['where']=qs[_0x92ef('0x32')](_[_0x92ef('0x3b')](_0x49b8c2[_0x92ef('0x31')],_0xbdcf['filters']),_0x60dbd7);if(_0x49b8c2[_0x92ef('0x31')][_0x92ef('0x3c')]){_0x3fd112['where']=_['merge'](_0x3fd112[_0x92ef('0x3d')],{'$or':_[_0x92ef('0x2a')](_0x60dbd7,function(_0x2c91da){if(_0x2c91da[_0x92ef('0x2e')]!==_0x92ef('0x3e')){var _0x20d809={};_0x20d809[_0x2c91da[_0x92ef('0x27')]]={'$like':'%'+_0x49b8c2['query'][_0x92ef('0x3c')]+'%'};return _0x20d809;}})});}_0x3fd112=_['merge']({},_0x3fd112,_0x49b8c2[_0x92ef('0x3f')]);var _0x2c5f70={'where':_0x3fd112[_0x92ef('0x3d')]};return db[_0x92ef('0x2b')][_0x92ef('0x1d')](_0x2c5f70)[_0x92ef('0x25')](function(_0x358b77){_0x106473[_0x92ef('0x1d')]=_0x358b77;if(_0x49b8c2['query'][_0x92ef('0x40')]){_0x3fd112[_0x92ef('0x41')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x92ef('0x42')](_0x3fd112);})[_0x92ef('0x25')](function(_0x4a7718){_0x106473[_0x92ef('0x43')]=_0x4a7718;return _0x106473;})[_0x92ef('0x25')](respondWithFilteredResult(_0x1f44f5,_0x3fd112))[_0x92ef('0x44')](handleError(_0x1f44f5,null));};exports['show']=function(_0x25cf40,_0x5f3eef){var _0x579c47={'raw':![],'where':{'id':_0x25cf40[_0x92ef('0x45')]['id']}},_0x5e1ce8={};_0x5e1ce8['model']=_[_0x92ef('0x46')](db[_0x92ef('0x2b')][_0x92ef('0x2c')]);_0x5e1ce8[_0x92ef('0x31')]=_['keys'](_0x25cf40[_0x92ef('0x31')]);_0x5e1ce8[_0x92ef('0x32')]=_[_0x92ef('0x33')](_0x5e1ce8['model'],_0x5e1ce8['query']);_0x579c47[_0x92ef('0x35')]=_[_0x92ef('0x33')](_0x5e1ce8[_0x92ef('0x30')],qs[_0x92ef('0x34')](_0x25cf40[_0x92ef('0x31')][_0x92ef('0x34')]));_0x579c47[_0x92ef('0x35')]=_0x579c47['attributes'][_0x92ef('0x36')]?_0x579c47[_0x92ef('0x35')]:_0x5e1ce8[_0x92ef('0x30')];if(_0x25cf40[_0x92ef('0x31')]['includeAll']){_0x579c47[_0x92ef('0x41')]=[{'all':!![]}];}_0x579c47=_['merge']({},_0x579c47,_0x25cf40[_0x92ef('0x3f')]);return db[_0x92ef('0x2b')][_0x92ef('0x47')](_0x579c47)['then'](handleEntityNotFound(_0x5f3eef,null))[_0x92ef('0x25')](respondWithResult(_0x5f3eef,null))['catch'](handleError(_0x5f3eef,null));};exports[_0x92ef('0x48')]=function(_0xdb0cae,_0x56879e){return db[_0x92ef('0x2b')][_0x92ef('0x48')](_0xdb0cae[_0x92ef('0x49')],{})['then'](respondWithResult(_0x56879e,0xc9))[_0x92ef('0x44')](handleError(_0x56879e,null));};exports['update']=function(_0x3bfd13,_0x2cb601){if(_0x3bfd13['body']['id']){delete _0x3bfd13['body']['id'];}return db['Dynamics365Configuration'][_0x92ef('0x47')]({'where':{'id':_0x3bfd13[_0x92ef('0x45')]['id']}})['then'](handleEntityNotFound(_0x2cb601,null))[_0x92ef('0x25')](saveUpdates(_0x3bfd13['body'],null))['then'](respondWithResult(_0x2cb601,null))[_0x92ef('0x44')](handleError(_0x2cb601,null));};exports[_0x92ef('0x4a')]=function(_0x34bff4,_0x2b4347){return db[_0x92ef('0x2b')][_0x92ef('0x47')]({'where':{'id':_0x34bff4[_0x92ef('0x45')]['id']}})[_0x92ef('0x25')](handleEntityNotFound(_0x2b4347,null))[_0x92ef('0x25')](removeEntity(_0x2b4347,null))['catch'](handleError(_0x2b4347,null));};exports['getFields']=function(_0x2e5aab,_0x3e8b4e,_0x5559f8){var _0x198c8f={};var _0x5734a7={};var _0x14cc37;var _0x3aad8b;return db[_0x92ef('0x2b')][_0x92ef('0x4b')]({'where':{'id':_0x2e5aab[_0x92ef('0x45')]['id']}})['then'](handleEntityNotFound(_0x3e8b4e,null))[_0x92ef('0x25')](function(_0x2595b0){if(_0x2595b0){_0x14cc37=_0x2595b0;_0x5734a7[_0x92ef('0x30')]=_[_0x92ef('0x46')](db[_0x92ef('0x4c')]['rawAttributes']);_0x5734a7[_0x92ef('0x31')]=_[_0x92ef('0x46')](_0x2e5aab[_0x92ef('0x31')]);_0x5734a7[_0x92ef('0x32')]=_[_0x92ef('0x33')](_0x5734a7['model'],_0x5734a7[_0x92ef('0x31')]);_0x198c8f['attributes']=_[_0x92ef('0x33')](_0x5734a7['model'],qs['fields'](_0x2e5aab[_0x92ef('0x31')][_0x92ef('0x34')]));_0x198c8f['attributes']=_0x198c8f[_0x92ef('0x35')]['length']?_0x198c8f[_0x92ef('0x35')]:_0x5734a7[_0x92ef('0x30')];_0x198c8f['order']=qs[_0x92ef('0x3a')](_0x2e5aab[_0x92ef('0x31')][_0x92ef('0x3a')]);_0x198c8f[_0x92ef('0x3d')]=qs[_0x92ef('0x32')](_[_0x92ef('0x3b')](_0x2e5aab[_0x92ef('0x31')],_0x5734a7[_0x92ef('0x32')]));if(_0x2e5aab[_0x92ef('0x31')][_0x92ef('0x3c')]){_0x198c8f[_0x92ef('0x3d')]=_[_0x92ef('0x4d')](_0x198c8f['where'],{'$or':_[_0x92ef('0x2a')](_0x198c8f['attributes'],function(_0x1c6446){var _0x184c88={};_0x184c88[_0x1c6446]={'$like':'%'+_0x2e5aab[_0x92ef('0x31')][_0x92ef('0x3c')]+'%'};return _0x184c88;})});}_0x198c8f=_[_0x92ef('0x4d')]({},_0x198c8f,_0x2e5aab[_0x92ef('0x3f')]);return _0x14cc37['getFields'](_0x198c8f);}})[_0x92ef('0x25')](function(_0x4de7ca){if(_0x4de7ca){_0x3aad8b=_0x4de7ca[_0x92ef('0x36')];if(!_0x2e5aab[_0x92ef('0x31')][_0x92ef('0x37')](_0x92ef('0x38'))){_0x198c8f[_0x92ef('0x1b')]=qs[_0x92ef('0x1b')](_0x2e5aab[_0x92ef('0x31')][_0x92ef('0x1b')]);_0x198c8f[_0x92ef('0x1e')]=qs[_0x92ef('0x1e')](_0x2e5aab[_0x92ef('0x31')][_0x92ef('0x1e')]);}return _0x14cc37[_0x92ef('0x4e')](_0x198c8f);}})[_0x92ef('0x25')](function(_0x20ecab){if(_0x20ecab){return _0x20ecab?{'count':_0x3aad8b,'rows':_0x20ecab}:null;}})[_0x92ef('0x25')](respondWithResult(_0x3e8b4e,null))[_0x92ef('0x44')](handleError(_0x3e8b4e,null));};exports[_0x92ef('0x4f')]=function(_0x125c7d,_0x32e501,_0x34d79f){var _0x46f5ee={};var _0x38c3a8={};var _0x347220;var _0x17ce5f;return db[_0x92ef('0x2b')]['findOne']({'where':{'id':_0x125c7d['params']['id']}})[_0x92ef('0x25')](handleEntityNotFound(_0x32e501,null))['then'](function(_0xdc893a){if(_0xdc893a){_0x347220=_0xdc893a;_0x38c3a8[_0x92ef('0x30')]=_[_0x92ef('0x46')](db[_0x92ef('0x4c')]['rawAttributes']);_0x38c3a8[_0x92ef('0x31')]=_[_0x92ef('0x46')](_0x125c7d[_0x92ef('0x31')]);_0x38c3a8['filters']=_[_0x92ef('0x33')](_0x38c3a8[_0x92ef('0x30')],_0x38c3a8[_0x92ef('0x31')]);_0x46f5ee['attributes']=_['intersection'](_0x38c3a8['model'],qs[_0x92ef('0x34')](_0x125c7d[_0x92ef('0x31')][_0x92ef('0x34')]));_0x46f5ee[_0x92ef('0x35')]=_0x46f5ee['attributes']['length']?_0x46f5ee['attributes']:_0x38c3a8[_0x92ef('0x30')];_0x46f5ee[_0x92ef('0x39')]=qs[_0x92ef('0x3a')](_0x125c7d[_0x92ef('0x31')]['sort']);_0x46f5ee[_0x92ef('0x3d')]=qs[_0x92ef('0x32')](_['pick'](_0x125c7d[_0x92ef('0x31')],_0x38c3a8[_0x92ef('0x32')]));if(_0x125c7d['query'][_0x92ef('0x3c')]){_0x46f5ee[_0x92ef('0x3d')]=_['merge'](_0x46f5ee['where'],{'$or':_[_0x92ef('0x2a')](_0x46f5ee['attributes'],function(_0x1b9451){var _0x548fa8={};_0x548fa8[_0x1b9451]={'$like':'%'+_0x125c7d[_0x92ef('0x31')][_0x92ef('0x3c')]+'%'};return _0x548fa8;})});}_0x46f5ee=_['merge']({},_0x46f5ee,_0x125c7d['options']);return _0x347220[_0x92ef('0x4f')](_0x46f5ee);}})['then'](function(_0x51d344){if(_0x51d344){_0x17ce5f=_0x51d344[_0x92ef('0x36')];if(!_0x125c7d['query'][_0x92ef('0x37')](_0x92ef('0x38'))){_0x46f5ee[_0x92ef('0x1b')]=qs['limit'](_0x125c7d['query'][_0x92ef('0x1b')]);_0x46f5ee[_0x92ef('0x1e')]=qs[_0x92ef('0x1e')](_0x125c7d[_0x92ef('0x31')]['offset']);}return _0x347220[_0x92ef('0x4f')](_0x46f5ee);}})[_0x92ef('0x25')](function(_0x3f87e9){if(_0x3f87e9){return _0x3f87e9?{'count':_0x17ce5f,'rows':_0x3f87e9}:null;}})[_0x92ef('0x25')](respondWithResult(_0x32e501,null))['catch'](handleError(_0x32e501,null));};exports[_0x92ef('0x50')]=function(_0x999198,_0x4cc7f1,_0x48d03b){var _0x1d139e={};var _0x29b846={};var _0x59e4d4;var _0x166356;return db['Dynamics365Configuration'][_0x92ef('0x4b')]({'where':{'id':_0x999198[_0x92ef('0x45')]['id']}})[_0x92ef('0x25')](handleEntityNotFound(_0x4cc7f1,null))[_0x92ef('0x25')](function(_0x216ab8){if(_0x216ab8){_0x59e4d4=_0x216ab8;_0x29b846[_0x92ef('0x30')]=_[_0x92ef('0x46')](db[_0x92ef('0x4c')][_0x92ef('0x2c')]);_0x29b846[_0x92ef('0x31')]=_[_0x92ef('0x46')](_0x999198[_0x92ef('0x31')]);_0x29b846[_0x92ef('0x32')]=_['intersection'](_0x29b846[_0x92ef('0x30')],_0x29b846['query']);_0x1d139e[_0x92ef('0x35')]=_[_0x92ef('0x33')](_0x29b846[_0x92ef('0x30')],qs[_0x92ef('0x34')](_0x999198[_0x92ef('0x31')][_0x92ef('0x34')]));_0x1d139e[_0x92ef('0x35')]=_0x1d139e[_0x92ef('0x35')][_0x92ef('0x36')]?_0x1d139e[_0x92ef('0x35')]:_0x29b846[_0x92ef('0x30')];_0x1d139e[_0x92ef('0x39')]=qs[_0x92ef('0x3a')](_0x999198['query']['sort']);_0x1d139e[_0x92ef('0x3d')]=qs[_0x92ef('0x32')](_[_0x92ef('0x3b')](_0x999198['query'],_0x29b846[_0x92ef('0x32')]));if(_0x999198[_0x92ef('0x31')][_0x92ef('0x3c')]){_0x1d139e[_0x92ef('0x3d')]=_['merge'](_0x1d139e['where'],{'$or':_[_0x92ef('0x2a')](_0x1d139e[_0x92ef('0x35')],function(_0x921108){var _0xef69cc={};_0xef69cc[_0x921108]={'$like':'%'+_0x999198[_0x92ef('0x31')]['filter']+'%'};return _0xef69cc;})});}_0x1d139e=_[_0x92ef('0x4d')]({},_0x1d139e,_0x999198[_0x92ef('0x3f')]);return _0x59e4d4[_0x92ef('0x50')](_0x1d139e);}})['then'](function(_0x305455){if(_0x305455){_0x166356=_0x305455[_0x92ef('0x36')];if(!_0x999198['query']['hasOwnProperty']('nolimit')){_0x1d139e[_0x92ef('0x1b')]=qs[_0x92ef('0x1b')](_0x999198['query'][_0x92ef('0x1b')]);_0x1d139e['offset']=qs[_0x92ef('0x1e')](_0x999198['query'][_0x92ef('0x1e')]);}return _0x59e4d4[_0x92ef('0x50')](_0x1d139e);}})['then'](function(_0x47cd1e){if(_0x47cd1e){return _0x47cd1e?{'count':_0x166356,'rows':_0x47cd1e}:null;}})[_0x92ef('0x25')](respondWithResult(_0x4cc7f1,null))[_0x92ef('0x44')](handleError(_0x4cc7f1,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index fc0f8e1..41c020c 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 _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 +var _0x3e74=['exports','Dynamics365Configuration','int_dynamics365_configurations','lodash','../../config/logger','api','moment','path','../../config/environment','./intDynamics365Configuration.attributes'];(function(_0x2ae8d6,_0x4d7876){var _0x3d5145=function(_0x3c3638){while(--_0x3c3638){_0x2ae8d6['push'](_0x2ae8d6['shift']());}};_0x3d5145(++_0x4d7876);}(_0x3e74,0x175));var _0x43e7=function(_0x4ffc37,_0x4fbaab){_0x4ffc37=_0x4ffc37-0x0;var _0x231109=_0x3e74[_0x4ffc37];return _0x231109;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 1520144..ba48775 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 _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 +var _0xc8e0=['request','then','info','Dynamics365Configuration,\x20%s,\x20%s','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0xc8e0,0x128));var _0x0c8e=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xc8e0[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x0c8e('0x0'));var util=require(_0x0c8e('0x1'));var moment=require(_0x0c8e('0x2'));var BPromise=require('bluebird');var rs=require(_0x0c8e('0x3'));var fs=require('fs');var Redis=require(_0x0c8e('0x4'));var db=require(_0x0c8e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0c8e('0x6'))(_0x0c8e('0x7'));var config=require(_0x0c8e('0x8'));var jayson=require(_0x0c8e('0x9'));var client=jayson[_0x0c8e('0xa')][_0x0c8e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x474eb8,_0x2b3892,_0x114719){return new BPromise(function(_0x315a92,_0x49b246){return client[_0x0c8e('0xc')](_0x474eb8,_0x114719)[_0x0c8e('0xd')](function(_0x296a91){logger[_0x0c8e('0xe')](_0x0c8e('0xf'),_0x2b3892,'request\x20sent');logger['debug'](_0x0c8e('0x10'),_0x2b3892,'request\x20sent',JSON['stringify'](_0x296a91));if(_0x296a91[_0x0c8e('0x11')]){if(_0x296a91['error'][_0x0c8e('0x12')]===0x1f4){logger['error'](_0x0c8e('0xf'),_0x2b3892,_0x296a91[_0x0c8e('0x11')][_0x0c8e('0x13')]);return _0x49b246(_0x296a91['error']['message']);}logger[_0x0c8e('0x11')](_0x0c8e('0xf'),_0x2b3892,_0x296a91['error'][_0x0c8e('0x13')]);return _0x315a92(_0x296a91[_0x0c8e('0x11')][_0x0c8e('0x13')]);}else{logger[_0x0c8e('0xe')]('Dynamics365Configuration,\x20%s,\x20%s',_0x2b3892,_0x0c8e('0x14'));_0x315a92(_0x296a91['result']['message']);}})[_0x0c8e('0x15')](function(_0x2e2b0a){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x2b3892,_0x2e2b0a);_0x49b246(_0x2e2b0a);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 9060f0c..8be10f0 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 _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 +var _0x8978=['post','put','update','delete','/:id','destroy','exports','multer','fs-extra','../../components/auth/service','./intDynamics365Field.controller','get','isAuthenticated','index','show'];(function(_0x420196,_0x469558){var _0x2851ab=function(_0x5d355b){while(--_0x5d355b){_0x420196['push'](_0x420196['shift']());}};_0x2851ab(++_0x469558);}(_0x8978,0x17e));var _0x8897=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x8978[_0x18ab2a];return _0x16dcee;};'use strict';var multer=require(_0x8897('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x8897('0x1'));var auth=require(_0x8897('0x2'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8897('0x3'));router[_0x8897('0x4')]('/',auth[_0x8897('0x5')](),controller[_0x8897('0x6')]);router[_0x8897('0x4')]('/:id',auth['isAuthenticated'](),controller[_0x8897('0x7')]);router[_0x8897('0x8')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8897('0x9')]('/:id',auth[_0x8897('0x5')](),controller[_0x8897('0xa')]);router[_0x8897('0xb')](_0x8897('0xc'),auth[_0x8897('0x5')](),controller[_0x8897('0xd')]);module[_0x8897('0xe')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index c718673..fa3c32e 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 _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 +var _0xc71f=['string','customVariable','keyValue','picklist','STRING','BOOLEAN','exports','ENUM'];(function(_0x3daee4,_0x1c7693){var _0x3a4fa7=function(_0x424297){while(--_0x424297){_0x3daee4['push'](_0x3daee4['shift']());}};_0x3a4fa7(++_0x1c7693);}(_0xc71f,0x1b6));var _0xfc71=function(_0x2c602e,_0x1d26f5){_0x2c602e=_0x2c602e-0x0;var _0x1a2650=_0xc71f[_0x2c602e];return _0x1a2650;};'use strict';var Sequelize=require('sequelize');module[_0xfc71('0x0')]={'type':{'type':Sequelize[_0xfc71('0x1')](_0xfc71('0x2'),'variable',_0xfc71('0x3'),_0xfc71('0x4'),_0xfc71('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xfc71('0x6')]},'key':{'type':Sequelize[_0xfc71('0x6')]},'keyType':{'type':Sequelize[_0xfc71('0x1')]('string','variable',_0xfc71('0x3'))},'keyContent':{'type':Sequelize[_0xfc71('0x6')]},'idField':{'type':Sequelize[_0xfc71('0x6')]},'nameField':{'type':Sequelize[_0xfc71('0x6')]},'customField':{'type':Sequelize[_0xfc71('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfc71('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index ef53d02..edb74a5 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 _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 +var _0x368b=['fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','show','params','catch','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','Dynamics365Field','rawAttributes'];(function(_0x245f64,_0x4ae342){var _0x3447e0=function(_0x17d0c5){while(--_0x17d0c5){_0x245f64['push'](_0x245f64['shift']());}};_0x3447e0(++_0x4ae342);}(_0x368b,0x131));var _0xb368=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x368b[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xb368('0x0'));var rimraf=require(_0xb368('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb368('0x2'));var rp=require(_0xb368('0x3'));var moment=require(_0xb368('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb368('0x5'));var util=require(_0xb368('0x6'));var path=require('path');var sox=require(_0xb368('0x7'));var csv=require(_0xb368('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb368('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xb368('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xb368('0xb'));var toCsv=require(_0xb368('0x8'));var querystring=require('querystring');var Papa=require(_0xb368('0xc'));var Redis=require('ioredis');var authService=require(_0xb368('0xd'));var qs=require(_0xb368('0xe'));var as=require(_0xb368('0xf'));var hardwareService=require(_0xb368('0x10'));var logger=require(_0xb368('0x11'))(_0xb368('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb368('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x329f9d,_0xbfd515){_0xbfd515=_0xbfd515||0xcc;return function(_0x33f078){if(_0x33f078){return _0x329f9d[_0xb368('0x14')](_0xbfd515);}return _0x329f9d[_0xb368('0x15')](_0xbfd515)['end']();};}function respondWithResult(_0x30353c,_0x4d8593){_0x4d8593=_0x4d8593||0xc8;return function(_0x5d45fa){if(_0x5d45fa){return _0x30353c['status'](_0x4d8593)[_0xb368('0x16')](_0x5d45fa);}};}function respondWithFilteredResult(_0x2b5a1b,_0x56ae45){return function(_0x548922){if(_0x548922){var _0x2b1d1a=typeof _0x56ae45[_0xb368('0x17')]==='undefined'&&typeof _0x56ae45[_0xb368('0x18')]===_0xb368('0x19');var _0xa3e8d0=_0x548922[_0xb368('0x1a')];var _0x543b6f=_0x2b1d1a?0x0:_0x56ae45[_0xb368('0x17')];var _0x1d6780=_0x2b1d1a?_0x548922[_0xb368('0x1a')]:_0x56ae45['offset']+_0x56ae45['limit'];var _0x4d9516;if(_0x1d6780>=_0xa3e8d0){_0x1d6780=_0xa3e8d0;_0x4d9516=0xc8;}else{_0x4d9516=0xce;}_0x2b5a1b[_0xb368('0x15')](_0x4d9516);return _0x2b5a1b[_0xb368('0x1b')](_0xb368('0x1c'),_0x543b6f+'-'+_0x1d6780+'/'+_0xa3e8d0)[_0xb368('0x16')](_0x548922);}return null;};}function patchUpdates(_0x5dc221){return function(_0x332d35){try{jsonpatch['apply'](_0x332d35,_0x5dc221,!![]);}catch(_0x488803){return BPromise['reject'](_0x488803);}return _0x332d35['save']();};}function saveUpdates(_0x57f81f,_0x1e493a){return function(_0x517b9c){if(_0x517b9c){return _0x517b9c[_0xb368('0x1d')](_0x57f81f)[_0xb368('0x1e')](function(_0x420488){return _0x420488;});}return null;};}function removeEntity(_0x4cf6cc,_0x4e42a4){return function(_0x1d66f9){if(_0x1d66f9){return _0x1d66f9[_0xb368('0x1f')]()[_0xb368('0x1e')](function(){_0x4cf6cc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x289a57,_0x369cd8){return function(_0x5be89e){if(!_0x5be89e){_0x289a57[_0xb368('0x14')](0x194);}return _0x5be89e;};}function handleError(_0x11faf9,_0x1f33cb){_0x1f33cb=_0x1f33cb||0x1f4;return function(_0x51cf0c){logger[_0xb368('0x20')](_0x51cf0c[_0xb368('0x21')]);if(_0x51cf0c[_0xb368('0x22')]){delete _0x51cf0c['name'];}_0x11faf9[_0xb368('0x15')](_0x1f33cb)[_0xb368('0x23')](_0x51cf0c);};}exports[_0xb368('0x24')]=function(_0x247474,_0x4a1aed){var _0x131851={},_0x1b8998={},_0x544b95={'count':0x0,'rows':[]};var _0x51d373=_[_0xb368('0x25')](db[_0xb368('0x26')][_0xb368('0x27')],function(_0x39ba45){return{'name':_0x39ba45[_0xb368('0x28')],'type':_0x39ba45[_0xb368('0x29')][_0xb368('0x2a')]};});_0x1b8998['model']=_[_0xb368('0x25')](_0x51d373,_0xb368('0x22'));_0x1b8998[_0xb368('0x2b')]=_[_0xb368('0x2c')](_0x247474[_0xb368('0x2b')]);_0x1b8998[_0xb368('0x2d')]=_[_0xb368('0x2e')](_0x1b8998[_0xb368('0x2f')],_0x1b8998[_0xb368('0x2b')]);_0x131851[_0xb368('0x30')]=_[_0xb368('0x2e')](_0x1b8998['model'],qs[_0xb368('0x31')](_0x247474[_0xb368('0x2b')][_0xb368('0x31')]));_0x131851['attributes']=_0x131851['attributes'][_0xb368('0x32')]?_0x131851[_0xb368('0x30')]:_0x1b8998[_0xb368('0x2f')];if(!_0x247474[_0xb368('0x2b')][_0xb368('0x33')]('nolimit')){_0x131851[_0xb368('0x18')]=qs[_0xb368('0x18')](_0x247474[_0xb368('0x2b')]['limit']);_0x131851[_0xb368('0x17')]=qs[_0xb368('0x17')](_0x247474['query'][_0xb368('0x17')]);}_0x131851[_0xb368('0x34')]=qs[_0xb368('0x35')](_0x247474[_0xb368('0x2b')][_0xb368('0x35')]);_0x131851[_0xb368('0x36')]=qs[_0xb368('0x2d')](_[_0xb368('0x37')](_0x247474[_0xb368('0x2b')],_0x1b8998[_0xb368('0x2d')]),_0x51d373);if(_0x247474[_0xb368('0x2b')]['filter']){_0x131851[_0xb368('0x36')]=_[_0xb368('0x38')](_0x131851[_0xb368('0x36')],{'$or':_[_0xb368('0x25')](_0x51d373,function(_0x53d0e3){if(_0x53d0e3[_0xb368('0x29')]!==_0xb368('0x39')){var _0x47742b={};_0x47742b[_0x53d0e3[_0xb368('0x22')]]={'$like':'%'+_0x247474[_0xb368('0x2b')][_0xb368('0x3a')]+'%'};return _0x47742b;}})});}_0x131851=_[_0xb368('0x38')]({},_0x131851,_0x247474[_0xb368('0x3b')]);var _0x2e7ba4={'where':_0x131851[_0xb368('0x36')]};return db['Dynamics365Field']['count'](_0x2e7ba4)[_0xb368('0x1e')](function(_0xa3998){_0x544b95['count']=_0xa3998;if(_0x247474[_0xb368('0x2b')][_0xb368('0x3c')]){_0x131851[_0xb368('0x3d')]=[{'all':!![]}];}return db['Dynamics365Field']['findAll'](_0x131851);})[_0xb368('0x1e')](function(_0x3ae7c7){_0x544b95[_0xb368('0x3e')]=_0x3ae7c7;return _0x544b95;})[_0xb368('0x1e')](respondWithFilteredResult(_0x4a1aed,_0x131851))['catch'](handleError(_0x4a1aed,null));};exports[_0xb368('0x3f')]=function(_0x590bc4,_0x5c0117){var _0x2c9b19={'raw':!![],'where':{'id':_0x590bc4[_0xb368('0x40')]['id']}},_0x3bf76c={};_0x3bf76c[_0xb368('0x2f')]=_[_0xb368('0x2c')](db['Dynamics365Field']['rawAttributes']);_0x3bf76c['query']=_[_0xb368('0x2c')](_0x590bc4[_0xb368('0x2b')]);_0x3bf76c[_0xb368('0x2d')]=_[_0xb368('0x2e')](_0x3bf76c[_0xb368('0x2f')],_0x3bf76c[_0xb368('0x2b')]);_0x2c9b19[_0xb368('0x30')]=_[_0xb368('0x2e')](_0x3bf76c['model'],qs[_0xb368('0x31')](_0x590bc4['query'][_0xb368('0x31')]));_0x2c9b19['attributes']=_0x2c9b19[_0xb368('0x30')][_0xb368('0x32')]?_0x2c9b19[_0xb368('0x30')]:_0x3bf76c[_0xb368('0x2f')];if(_0x590bc4[_0xb368('0x2b')]['includeAll']){_0x2c9b19[_0xb368('0x3d')]=[{'all':!![]}];}_0x2c9b19=_[_0xb368('0x38')]({},_0x2c9b19,_0x590bc4[_0xb368('0x3b')]);return db[_0xb368('0x26')]['find'](_0x2c9b19)[_0xb368('0x1e')](handleEntityNotFound(_0x5c0117,null))[_0xb368('0x1e')](respondWithResult(_0x5c0117,null))[_0xb368('0x41')](handleError(_0x5c0117,null));};exports['create']=function(_0x326595,_0x2ab83c){return db[_0xb368('0x26')][_0xb368('0x42')](_0x326595[_0xb368('0x43')],{})[_0xb368('0x1e')](respondWithResult(_0x2ab83c,0xc9))[_0xb368('0x41')](handleError(_0x2ab83c,null));};exports[_0xb368('0x1d')]=function(_0x1483b3,_0x3b1667){if(_0x1483b3['body']['id']){delete _0x1483b3[_0xb368('0x43')]['id'];}return db['Dynamics365Field'][_0xb368('0x44')]({'where':{'id':_0x1483b3[_0xb368('0x40')]['id']}})['then'](handleEntityNotFound(_0x3b1667,null))[_0xb368('0x1e')](saveUpdates(_0x1483b3['body'],null))[_0xb368('0x1e')](respondWithResult(_0x3b1667,null))[_0xb368('0x41')](handleError(_0x3b1667,null));};exports[_0xb368('0x1f')]=function(_0x4ee717,_0x44c89b){return db['Dynamics365Field'][_0xb368('0x44')]({'where':{'id':_0x4ee717[_0xb368('0x40')]['id']}})[_0xb368('0x1e')](handleEntityNotFound(_0x44c89b,null))[_0xb368('0x1e')](removeEntity(_0x44c89b,null))[_0xb368('0x41')](handleError(_0x44c89b,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 84451af..da54d7b 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 _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 +var _0x9c7c=['dynamics365_unique_index','idField','FieldId','lodash','../../config/logger','api','request-promise','path','rimraf','exports','Dynamics365Field','int_dynamics365_fields'];(function(_0x520292,_0x114345){var _0x55c429=function(_0x398bdf){while(--_0x398bdf){_0x520292['push'](_0x520292['shift']());}};_0x55c429(++_0x114345);}(_0x9c7c,0x1a7));var _0xc9c7=function(_0x1a8eb5,_0x35fdea){_0x1a8eb5=_0x1a8eb5-0x0;var _0x35b534=_0x9c7c[_0x1a8eb5];return _0x35b534;};'use strict';var _=require(_0xc9c7('0x0'));var util=require('util');var logger=require(_0xc9c7('0x1'))(_0xc9c7('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc9c7('0x3'));var fs=require('fs');var path=require(_0xc9c7('0x4'));var rimraf=require(_0xc9c7('0x5'));var config=require('../../config/environment');var attributes=require('./intDynamics365Field.attributes');module[_0xc9c7('0x6')]=function(_0x37bd13,_0x4ca716){return _0x37bd13['define'](_0xc9c7('0x7'),attributes,{'tableName':_0xc9c7('0x8'),'paranoid':![],'indexes':[{'name':_0xc9c7('0x9'),'fields':[_0xc9c7('0xa'),_0xc9c7('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index 47253be..94817c4 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 _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 +var _0xa5e7=['catch','lodash','util','bluebird','ioredis','../../config/logger','client','then','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Field,\x20%s,\x20%s','message','info','result'];(function(_0x401e1e,_0x2f95e1){var _0x436007=function(_0x3bd77f){while(--_0x3bd77f){_0x401e1e['push'](_0x401e1e['shift']());}};_0x436007(++_0x2f95e1);}(_0xa5e7,0x1b1));var _0x7a5e=function(_0x501e45,_0x34e02a){_0x501e45=_0x501e45-0x0;var _0x557d28=_0xa5e7[_0x501e45];return _0x557d28;};'use strict';var _=require(_0x7a5e('0x0'));var util=require(_0x7a5e('0x1'));var moment=require('moment');var BPromise=require(_0x7a5e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7a5e('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7a5e('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7a5e('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b98b2,_0x1a7dba,_0x4dd895){return new BPromise(function(_0x185714,_0x502ccb){return client['request'](_0x1b98b2,_0x4dd895)[_0x7a5e('0x6')](function(_0x1266ad){logger['info']('Dynamics365Field,\x20%s,\x20%s',_0x1a7dba,_0x7a5e('0x7'));logger[_0x7a5e('0x8')](_0x7a5e('0x9'),_0x1a7dba,'request\x20sent',JSON[_0x7a5e('0xa')](_0x1266ad));if(_0x1266ad['error']){if(_0x1266ad[_0x7a5e('0xb')][_0x7a5e('0xc')]===0x1f4){logger[_0x7a5e('0xb')](_0x7a5e('0xd'),_0x1a7dba,_0x1266ad[_0x7a5e('0xb')][_0x7a5e('0xe')]);return _0x502ccb(_0x1266ad['error']['message']);}logger[_0x7a5e('0xb')](_0x7a5e('0xd'),_0x1a7dba,_0x1266ad['error'][_0x7a5e('0xe')]);return _0x185714(_0x1266ad[_0x7a5e('0xb')]['message']);}else{logger[_0x7a5e('0xf')](_0x7a5e('0xd'),_0x1a7dba,_0x7a5e('0x7'));_0x185714(_0x1266ad[_0x7a5e('0x10')]['message']);}})[_0x7a5e('0x11')](function(_0x2aa493){logger[_0x7a5e('0xb')](_0x7a5e('0xd'),_0x1a7dba,_0x2aa493);_0x502ccb(_0x2aa493);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 112f771..a6d2e1f 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 _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 +var _0xb776=['index','/:id','show','/:id/configurations','getFields','create','post','addConfiguration','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','get','isAuthenticated'];(function(_0x454164,_0x581271){var _0x824380=function(_0x37f5f7){while(--_0x37f5f7){_0x454164['push'](_0x454164['shift']());}};_0x824380(++_0x581271);}(_0xb776,0x1ec));var _0x6b77=function(_0x37cf58,_0x2a370e){_0x37cf58=_0x37cf58-0x0;var _0x5a5162=_0xb776[_0x37cf58];return _0x5a5162;};'use strict';var multer=require(_0x6b77('0x0'));var util=require('util');var path=require(_0x6b77('0x1'));var timeout=require(_0x6b77('0x2'));var express=require(_0x6b77('0x3'));var router=express[_0x6b77('0x4')]();var fs_extra=require(_0x6b77('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intFreshdeskAccount.controller');router[_0x6b77('0x6')]('/',auth[_0x6b77('0x7')](),controller[_0x6b77('0x8')]);router[_0x6b77('0x6')](_0x6b77('0x9'),auth[_0x6b77('0x7')](),controller[_0x6b77('0xa')]);router[_0x6b77('0x6')](_0x6b77('0xb'),auth[_0x6b77('0x7')](),controller['getConfigurations']);router[_0x6b77('0x6')]('/:id/fields',auth[_0x6b77('0x7')](),controller[_0x6b77('0xc')]);router['post']('/',auth[_0x6b77('0x7')](),controller[_0x6b77('0xd')]);router[_0x6b77('0xe')]('/:id/configurations',auth[_0x6b77('0x7')](),controller[_0x6b77('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x6b77('0x10')]);router[_0x6b77('0x11')](_0x6b77('0x9'),auth['isAuthenticated'](),controller[_0x6b77('0x12')]);module[_0x6b77('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 066a1a8..a53fd9d 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 _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 +var _0x4bd3=['sequelize','STRING','remoteUri'];(function(_0x327199,_0x1283db){var _0x5a7cf0=function(_0x350f66){while(--_0x350f66){_0x327199['push'](_0x327199['shift']());}};_0x5a7cf0(++_0x1283db);}(_0x4bd3,0x174));var _0x34bd=function(_0x9a3e8d,_0x1e85d7){_0x9a3e8d=_0x9a3e8d-0x0;var _0x15728f=_0x4bd3[_0x9a3e8d];return _0x15728f;};'use strict';var Sequelize=require(_0x34bd('0x0'));module['exports']={'name':{'type':Sequelize[_0x34bd('0x1')]},'description':{'type':Sequelize[_0x34bd('0x1')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x34bd('0x1')],'unique':_0x34bd('0x2')},'serverUrl':{'type':Sequelize[_0x34bd('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 2fde706..c29ca68 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 _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 +var _0xf089=['reject','save','update','then','destroy','stack','name','send','index','map','FreshdeskAccount','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','options','find','body','getConfigurations','findOne','FreshdeskConfiguration','nolimit','Subjects','getSubjects','channel','Descriptions','create','FreshdeskField','getFields','remoteUri','apiKey','substring','lastIndexOf','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','requester','agent','description','group','ticket_type','company','remove','includes','custom_text','custom_dropdown','choices','capitalize','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','rimraf','zip-dir','request-promise','moment','bluebird','mustache','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/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply'];(function(_0x469688,_0xefb6a4){var _0x4d96d5=function(_0xbeb628){while(--_0xbeb628){_0x469688['push'](_0x469688['shift']());}};_0x4d96d5(++_0xefb6a4);}(_0xf089,0xba));var _0x9f08=function(_0x5d2001,_0x2d5aa1){_0x5d2001=_0x5d2001-0x0;var _0x24ebf4=_0xf089[_0x5d2001];return _0x24ebf4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9f08('0x0'));var zipdir=require(_0x9f08('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9f08('0x2'));var moment=require(_0x9f08('0x3'));var BPromise=require(_0x9f08('0x4'));var Mustache=require(_0x9f08('0x5'));var util=require('util');var path=require(_0x9f08('0x6'));var sox=require(_0x9f08('0x7'));var csv=require(_0x9f08('0x8'));var ejs=require(_0x9f08('0x9'));var fs=require('fs');var fs_extra=require(_0x9f08('0xa'));var _=require(_0x9f08('0xb'));var squel=require('squel');var crypto=require(_0x9f08('0xc'));var jsforce=require(_0x9f08('0xd'));var deskjs=require(_0x9f08('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9f08('0xf'));var Papa=require(_0x9f08('0x10'));var Redis=require(_0x9f08('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9f08('0x12'));var as=require(_0x9f08('0x13'));var hardwareService=require(_0x9f08('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x9f08('0x15'));var config=require(_0x9f08('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x9f08('0x17'))['db'];var integrations=require(_0x9f08('0x18'));function respondWithStatusCode(_0x251b84,_0x597ae8){_0x597ae8=_0x597ae8||0xcc;return function(_0x582be0){if(_0x582be0){return _0x251b84[_0x9f08('0x19')](_0x597ae8);}return _0x251b84[_0x9f08('0x1a')](_0x597ae8)[_0x9f08('0x1b')]();};}function respondWithResult(_0x2ef45d,_0x4ee49c){_0x4ee49c=_0x4ee49c||0xc8;return function(_0x2b892d){if(_0x2b892d){return _0x2ef45d[_0x9f08('0x1a')](_0x4ee49c)[_0x9f08('0x1c')](_0x2b892d);}};}function respondWithFilteredResult(_0x4135cf,_0x323146){return function(_0x4cec58){if(_0x4cec58){var _0xef2bc8=typeof _0x323146['offset']==='undefined'&&typeof _0x323146[_0x9f08('0x1d')]===_0x9f08('0x1e');var _0x2acec0=_0x4cec58[_0x9f08('0x1f')];var _0x249190=_0xef2bc8?0x0:_0x323146[_0x9f08('0x20')];var _0x40c97a=_0xef2bc8?_0x4cec58[_0x9f08('0x1f')]:_0x323146[_0x9f08('0x20')]+_0x323146[_0x9f08('0x1d')];var _0x2558fc;if(_0x40c97a>=_0x2acec0){_0x40c97a=_0x2acec0;_0x2558fc=0xc8;}else{_0x2558fc=0xce;}_0x4135cf[_0x9f08('0x1a')](_0x2558fc);return _0x4135cf[_0x9f08('0x21')](_0x9f08('0x22'),_0x249190+'-'+_0x40c97a+'/'+_0x2acec0)[_0x9f08('0x1c')](_0x4cec58);}return null;};}function patchUpdates(_0x4174b6){return function(_0x4ce350){try{jsonpatch[_0x9f08('0x23')](_0x4ce350,_0x4174b6,!![]);}catch(_0x986247){return BPromise[_0x9f08('0x24')](_0x986247);}return _0x4ce350[_0x9f08('0x25')]();};}function saveUpdates(_0x282dcb,_0x8cea64){return function(_0x4f9f8e){if(_0x4f9f8e){return _0x4f9f8e[_0x9f08('0x26')](_0x282dcb)[_0x9f08('0x27')](function(_0x10f329){return _0x10f329;});}return null;};}function removeEntity(_0x2600ff,_0x336b33){return function(_0x8d3ab1){if(_0x8d3ab1){return _0x8d3ab1[_0x9f08('0x28')]()['then'](function(){_0x2600ff['status'](0xcc)[_0x9f08('0x1b')]();});}};}function handleEntityNotFound(_0x182016,_0x36988a){return function(_0xc1c409){if(!_0xc1c409){_0x182016[_0x9f08('0x19')](0x194);}return _0xc1c409;};}function handleError(_0x266965,_0x1405ac){_0x1405ac=_0x1405ac||0x1f4;return function(_0x3474d9){logger['error'](_0x3474d9[_0x9f08('0x29')]);if(_0x3474d9[_0x9f08('0x2a')]){delete _0x3474d9[_0x9f08('0x2a')];}_0x266965[_0x9f08('0x1a')](_0x1405ac)[_0x9f08('0x2b')](_0x3474d9);};}exports[_0x9f08('0x2c')]=function(_0x444beb,_0xc0564b){var _0x568450={},_0x4d4cc1={},_0x5d1c80={'count':0x0,'rows':[]};var _0x7763f7=_[_0x9f08('0x2d')](db[_0x9f08('0x2e')][_0x9f08('0x2f')],function(_0x3d204e){return{'name':_0x3d204e['fieldName'],'type':_0x3d204e[_0x9f08('0x30')][_0x9f08('0x31')]};});_0x4d4cc1[_0x9f08('0x32')]=_[_0x9f08('0x2d')](_0x7763f7,_0x9f08('0x2a'));_0x4d4cc1[_0x9f08('0x33')]=_[_0x9f08('0x34')](_0x444beb[_0x9f08('0x33')]);_0x4d4cc1[_0x9f08('0x35')]=_['intersection'](_0x4d4cc1[_0x9f08('0x32')],_0x4d4cc1['query']);_0x568450[_0x9f08('0x36')]=_[_0x9f08('0x37')](_0x4d4cc1[_0x9f08('0x32')],qs[_0x9f08('0x38')](_0x444beb[_0x9f08('0x33')][_0x9f08('0x38')]));_0x568450['attributes']=_0x568450[_0x9f08('0x36')][_0x9f08('0x39')]?_0x568450[_0x9f08('0x36')]:_0x4d4cc1[_0x9f08('0x32')];if(!_0x444beb[_0x9f08('0x33')][_0x9f08('0x3a')]('nolimit')){_0x568450[_0x9f08('0x1d')]=qs['limit'](_0x444beb[_0x9f08('0x33')][_0x9f08('0x1d')]);_0x568450[_0x9f08('0x20')]=qs[_0x9f08('0x20')](_0x444beb[_0x9f08('0x33')]['offset']);}_0x568450[_0x9f08('0x3b')]=qs[_0x9f08('0x3c')](_0x444beb[_0x9f08('0x33')]['sort']);_0x568450[_0x9f08('0x3d')]=qs[_0x9f08('0x35')](_[_0x9f08('0x3e')](_0x444beb[_0x9f08('0x33')],_0x4d4cc1[_0x9f08('0x35')]),_0x7763f7);if(_0x444beb['query'][_0x9f08('0x3f')]){_0x568450[_0x9f08('0x3d')]=_[_0x9f08('0x40')](_0x568450[_0x9f08('0x3d')],{'$or':_[_0x9f08('0x2d')](_0x7763f7,function(_0x4ccc69){if(_0x4ccc69[_0x9f08('0x30')]!==_0x9f08('0x41')){var _0x2c3180={};_0x2c3180[_0x4ccc69[_0x9f08('0x2a')]]={'$like':'%'+_0x444beb[_0x9f08('0x33')][_0x9f08('0x3f')]+'%'};return _0x2c3180;}})});}_0x568450=_[_0x9f08('0x40')]({},_0x568450,_0x444beb['options']);var _0x52f14a={'where':_0x568450[_0x9f08('0x3d')]};return db['FreshdeskAccount'][_0x9f08('0x1f')](_0x52f14a)[_0x9f08('0x27')](function(_0x1ba9cf){_0x5d1c80[_0x9f08('0x1f')]=_0x1ba9cf;if(_0x444beb['query'][_0x9f08('0x42')]){_0x568450[_0x9f08('0x43')]=[{'all':!![]}];}return db[_0x9f08('0x2e')][_0x9f08('0x44')](_0x568450);})[_0x9f08('0x27')](function(_0x249199){_0x5d1c80['rows']=_0x249199;return _0x5d1c80;})[_0x9f08('0x27')](respondWithFilteredResult(_0xc0564b,_0x568450))[_0x9f08('0x45')](handleError(_0xc0564b,null));};exports[_0x9f08('0x46')]=function(_0x55c6c6,_0x3b396a){var _0x587397={'raw':![],'where':{'id':_0x55c6c6[_0x9f08('0x47')]['id']}},_0x2475ba={};_0x2475ba[_0x9f08('0x32')]=_['keys'](db[_0x9f08('0x2e')][_0x9f08('0x2f')]);_0x2475ba[_0x9f08('0x33')]=_[_0x9f08('0x34')](_0x55c6c6[_0x9f08('0x33')]);_0x2475ba[_0x9f08('0x35')]=_['intersection'](_0x2475ba[_0x9f08('0x32')],_0x2475ba['query']);_0x587397[_0x9f08('0x36')]=_[_0x9f08('0x37')](_0x2475ba[_0x9f08('0x32')],qs[_0x9f08('0x38')](_0x55c6c6[_0x9f08('0x33')][_0x9f08('0x38')]));_0x587397[_0x9f08('0x36')]=_0x587397['attributes']['length']?_0x587397['attributes']:_0x2475ba['model'];if(_0x55c6c6['query'][_0x9f08('0x42')]){_0x587397[_0x9f08('0x43')]=[{'all':!![]}];}_0x587397=_['merge']({},_0x587397,_0x55c6c6[_0x9f08('0x48')]);return db['FreshdeskAccount'][_0x9f08('0x49')](_0x587397)[_0x9f08('0x27')](handleEntityNotFound(_0x3b396a,null))[_0x9f08('0x27')](respondWithResult(_0x3b396a,null))[_0x9f08('0x45')](handleError(_0x3b396a,null));};exports['create']=function(_0x25c21f,_0x131d09){return db[_0x9f08('0x2e')]['create'](_0x25c21f[_0x9f08('0x4a')],{})['then'](respondWithResult(_0x131d09,0xc9))['catch'](handleError(_0x131d09,null));};exports['update']=function(_0x2639c1,_0x3579b9){if(_0x2639c1[_0x9f08('0x4a')]['id']){delete _0x2639c1[_0x9f08('0x4a')]['id'];}return db[_0x9f08('0x2e')]['find']({'where':{'id':_0x2639c1['params']['id']}})[_0x9f08('0x27')](handleEntityNotFound(_0x3579b9,null))['then'](saveUpdates(_0x2639c1[_0x9f08('0x4a')],null))[_0x9f08('0x27')](respondWithResult(_0x3579b9,null))['catch'](handleError(_0x3579b9,null));};exports[_0x9f08('0x28')]=function(_0x3d858f,_0x2dc7d6){return db[_0x9f08('0x2e')]['find']({'where':{'id':_0x3d858f[_0x9f08('0x47')]['id']}})[_0x9f08('0x27')](handleEntityNotFound(_0x2dc7d6,null))['then'](removeEntity(_0x2dc7d6,null))['catch'](handleError(_0x2dc7d6,null));};exports[_0x9f08('0x4b')]=function(_0x4c4624,_0x3d7c0f,_0x187629){var _0x46821d={};var _0x592099={};var _0x3132b2;var _0x22e513;return db[_0x9f08('0x2e')][_0x9f08('0x4c')]({'where':{'id':_0x4c4624[_0x9f08('0x47')]['id']}})[_0x9f08('0x27')](handleEntityNotFound(_0x3d7c0f,null))[_0x9f08('0x27')](function(_0x370833){if(_0x370833){_0x3132b2=_0x370833;_0x592099[_0x9f08('0x32')]=_[_0x9f08('0x34')](db[_0x9f08('0x4d')][_0x9f08('0x2f')]);_0x592099[_0x9f08('0x33')]=_[_0x9f08('0x34')](_0x4c4624[_0x9f08('0x33')]);_0x592099[_0x9f08('0x35')]=_['intersection'](_0x592099[_0x9f08('0x32')],_0x592099[_0x9f08('0x33')]);_0x46821d['attributes']=_[_0x9f08('0x37')](_0x592099[_0x9f08('0x32')],qs[_0x9f08('0x38')](_0x4c4624[_0x9f08('0x33')][_0x9f08('0x38')]));_0x46821d['attributes']=_0x46821d[_0x9f08('0x36')][_0x9f08('0x39')]?_0x46821d[_0x9f08('0x36')]:_0x592099[_0x9f08('0x32')];_0x46821d[_0x9f08('0x3b')]=qs[_0x9f08('0x3c')](_0x4c4624[_0x9f08('0x33')][_0x9f08('0x3c')]);_0x46821d[_0x9f08('0x3d')]=qs[_0x9f08('0x35')](_[_0x9f08('0x3e')](_0x4c4624[_0x9f08('0x33')],_0x592099[_0x9f08('0x35')]));if(_0x4c4624[_0x9f08('0x33')][_0x9f08('0x3f')]){_0x46821d[_0x9f08('0x3d')]=_['merge'](_0x46821d['where'],{'$or':_['map'](_0x46821d[_0x9f08('0x36')],function(_0x535364){var _0x2a52de={};_0x2a52de[_0x535364]={'$like':'%'+_0x4c4624[_0x9f08('0x33')][_0x9f08('0x3f')]+'%'};return _0x2a52de;})});}_0x46821d=_['merge']({},_0x46821d,_0x4c4624['options']);return _0x3132b2[_0x9f08('0x4b')](_0x46821d);}})[_0x9f08('0x27')](function(_0x3e6a8b){if(_0x3e6a8b){_0x22e513=_0x3e6a8b['length'];if(!_0x4c4624['query'][_0x9f08('0x3a')](_0x9f08('0x4e'))){_0x46821d[_0x9f08('0x1d')]=qs[_0x9f08('0x1d')](_0x4c4624[_0x9f08('0x33')][_0x9f08('0x1d')]);_0x46821d[_0x9f08('0x20')]=qs['offset'](_0x4c4624['query'][_0x9f08('0x20')]);}return _0x3132b2[_0x9f08('0x4b')](_0x46821d);}})[_0x9f08('0x27')](function(_0x496fc2){if(_0x496fc2){return _0x496fc2?{'count':_0x22e513,'rows':_0x496fc2}:null;}})[_0x9f08('0x27')](respondWithResult(_0x3d7c0f,null))[_0x9f08('0x45')](handleError(_0x3d7c0f,null));};exports['addConfiguration']=function(_0x7c75fa,_0x48c97a,_0x284fb5){if(_0x7c75fa[_0x9f08('0x4a')]['id']){delete _0x7c75fa[_0x9f08('0x4a')]['id'];}return db[_0x9f08('0x2e')][_0x9f08('0x4c')]({'where':{'id':_0x7c75fa[_0x9f08('0x47')]['id']}})[_0x9f08('0x27')](handleEntityNotFound(_0x48c97a,null))[_0x9f08('0x27')](function(_0x2280ea){if(_0x2280ea){_0x7c75fa['body']['AccountId']=_0x2280ea['id'];_0x7c75fa[_0x9f08('0x4a')][_0x9f08('0x4f')]=integrations[_0x9f08('0x50')](_0x7c75fa['body'][_0x9f08('0x51')],_0x7c75fa[_0x9f08('0x4a')]['type']);_0x7c75fa[_0x9f08('0x4a')][_0x9f08('0x52')]=integrations['getDescriptions'](_0x7c75fa[_0x9f08('0x4a')][_0x9f08('0x51')],_0x7c75fa['body'][_0x9f08('0x30')]);return db[_0x9f08('0x4d')][_0x9f08('0x53')](_0x7c75fa[_0x9f08('0x4a')],{'include':[{'model':db[_0x9f08('0x54')],'as':_0x9f08('0x4f')},{'model':db['FreshdeskField'],'as':_0x9f08('0x52')}]});}return null;})[_0x9f08('0x27')](respondWithResult(_0x48c97a,null))[_0x9f08('0x45')](handleError(_0x48c97a,null));};exports[_0x9f08('0x55')]=function(_0x41788a,_0x30c3b2,_0xe7c2f){var _0x357778='';return db[_0x9f08('0x2e')][_0x9f08('0x4c')]({'where':{'id':_0x41788a[_0x9f08('0x47')]['id']},'attributes':['id',_0x9f08('0x56'),_0x9f08('0x57')]})['then'](handleEntityNotFound(_0x30c3b2,null))['then'](function(_0x57bc17){if(_0x57bc17){_0x357778=_0x57bc17[_0x9f08('0x56')];var _0x5cb5ea=_0x357778['slice'](-0x1);if(_0x5cb5ea==='/'){_0x357778=_0x357778[_0x9f08('0x58')](0x0,_0x357778[_0x9f08('0x59')](_0x5cb5ea));}return rp({'method':'GET','uri':util[_0x9f08('0x5a')](_0x9f08('0x5b'),_0x357778,_0x9f08('0x5c')),'headers':{'Authorization':util[_0x9f08('0x5a')](_0x9f08('0x5d'),new Buffer(util[_0x9f08('0x5a')]('%s:X',_0x57bc17[_0x9f08('0x57')]))['toString']('base64'))},'json':!![]});}})['then'](function(_0x20f79d){if(_0x20f79d){var _0x529362=[_0x9f08('0x5e'),'subject',_0x9f08('0x5f'),_0x9f08('0x60'),_0x9f08('0x1a'),'priority',_0x9f08('0x61'),'source',_0x9f08('0x62'),_0x9f08('0x61'),_0x9f08('0x63')];_[_0x9f08('0x64')](_0x20f79d,function(_0x1a1cfe){return _0x529362[_0x9f08('0x65')](_0x1a1cfe[_0x9f08('0x2a')])||!_0x1a1cfe['default']&&_0x1a1cfe[_0x9f08('0x30')]!==_0x9f08('0x66')&&_0x1a1cfe[_0x9f08('0x30')]!==_0x9f08('0x67');});return{'count':_0x20f79d[_0x9f08('0x39')],'rows':_[_0x9f08('0x2d')](_0x20f79d,function(_0x57330f){return{'id':_0x57330f['name'],'name':_0x57330f['label'],'custom':!_0x57330f['default'],'options':_0x57330f['choices']?_[_0x9f08('0x2d')](_0x57330f[_0x9f08('0x68')],function(_0x464bde){return{'name':_[_0x9f08('0x69')](_0x464bde),'value':_0x464bde};}):[]};})};}})[_0x9f08('0x27')](respondWithResult(_0x30c3b2,null))[_0x9f08('0x45')](function(_0x492c73){var _0x103f17=_0x41788a[_0x9f08('0x33')][_0x9f08('0x6a')]?0x1f4:_0x492c73[_0x9f08('0x6b')]||0x1f4;logger[_0x9f08('0x6c')](_0x9f08('0x6d'),_0x9f08('0x55'),_0x103f17,JSON[_0x9f08('0x6e')](_0x492c73));delete _0x492c73[_0x9f08('0x2a')];if(_0x103f17===0x191){_0x103f17=0x190;}_0x30c3b2['status'](_0x103f17)[_0x9f08('0x2b')](_0x41788a[_0x9f08('0x33')][_0x9f08('0x6a')]?{'message':'Wrong\x20credentials','statusCode':_0x492c73['statusCode']}:_0x492c73);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 894531f..53f2037 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 _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 +var _0x992b=['request-promise','rimraf','../../config/environment','./intFreshdeskAccount.attributes','exports','define','FreshdeskAccount','lodash','../../config/logger','api','moment','bluebird'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x992b,0x127));var _0xb992=function(_0x4aec02,_0x28480d){_0x4aec02=_0x4aec02-0x0;var _0x20b230=_0x992b[_0x4aec02];return _0x20b230;};'use strict';var _=require(_0xb992('0x0'));var util=require('util');var logger=require(_0xb992('0x1'))(_0xb992('0x2'));var moment=require(_0xb992('0x3'));var BPromise=require(_0xb992('0x4'));var rp=require(_0xb992('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb992('0x6'));var config=require(_0xb992('0x7'));var attributes=require(_0xb992('0x8'));var integrations=require('../../components/integrations/configuration');module[_0xb992('0x9')]=function(_0x504244,_0x48ffd8){return _0x504244[_0xb992('0xa')](_0xb992('0xb'),attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index 3e57686..14ec675 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 _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 +var _0x64d0=['bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','model','map','include','catch','ShowFreshdeskAccount','find','lodash','util','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x64d0,0xf2));var _0x064d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x64d0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x064d('0x0'));var util=require(_0x064d('0x1'));var moment=require(_0x064d('0x2'));var BPromise=require(_0x064d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x064d('0x4'));var db=require(_0x064d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x064d('0x6'))('rpc');var config=require(_0x064d('0x7'));var jayson=require(_0x064d('0x8'));var client=jayson[_0x064d('0x9')][_0x064d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x55d1e9,_0x5de95d,_0x51bcc4){return new BPromise(function(_0x350771,_0x3b0d81){return client[_0x064d('0xb')](_0x55d1e9,_0x51bcc4)[_0x064d('0xc')](function(_0x26d5d1){logger['info'](_0x064d('0xd'),_0x5de95d,_0x064d('0xe'));logger[_0x064d('0xf')](_0x064d('0x10'),_0x5de95d,'request\x20sent',JSON[_0x064d('0x11')](_0x26d5d1));if(_0x26d5d1[_0x064d('0x12')]){if(_0x26d5d1[_0x064d('0x12')]['code']===0x1f4){logger[_0x064d('0x12')](_0x064d('0xd'),_0x5de95d,_0x26d5d1[_0x064d('0x12')][_0x064d('0x13')]);return _0x3b0d81(_0x26d5d1['error']['message']);}logger[_0x064d('0x12')](_0x064d('0xd'),_0x5de95d,_0x26d5d1[_0x064d('0x12')][_0x064d('0x13')]);return _0x350771(_0x26d5d1[_0x064d('0x12')]['message']);}else{logger[_0x064d('0x14')](_0x064d('0xd'),_0x5de95d,_0x064d('0xe'));_0x350771(_0x26d5d1[_0x064d('0x15')][_0x064d('0x13')]);}})['catch'](function(_0x4e35f8){logger[_0x064d('0x12')](_0x064d('0xd'),_0x5de95d,_0x4e35f8);_0x3b0d81(_0x4e35f8);});});}exports[_0x064d('0x16')]=function(_0x524a83){var _0x40bc77=this;return new Promise(function(_0x4f707a,_0x29d1c1){return db[_0x064d('0x17')][_0x064d('0x18')]({'raw':_0x524a83[_0x064d('0x19')]?_0x524a83['options'][_0x064d('0x1a')]===undefined?!![]:![]:!![],'where':_0x524a83['options']?_0x524a83[_0x064d('0x19')][_0x064d('0x1b')]||null:null,'attributes':_0x524a83[_0x064d('0x19')]?_0x524a83[_0x064d('0x19')][_0x064d('0x1c')]||null:null,'limit':_0x524a83['options']?_0x524a83[_0x064d('0x19')]['limit']||null:null,'include':_0x524a83['options']?_0x524a83[_0x064d('0x19')]['include']?_['map'](_0x524a83[_0x064d('0x19')]['include'],function(_0x1506b5){return{'model':db[_0x1506b5[_0x064d('0x1d')]],'as':_0x1506b5['as'],'attributes':_0x1506b5[_0x064d('0x1c')],'include':_0x1506b5['include']?_[_0x064d('0x1e')](_0x1506b5['include'],function(_0x2199be){return{'model':db[_0x2199be[_0x064d('0x1d')]],'as':_0x2199be['as'],'attributes':_0x2199be[_0x064d('0x1c')],'include':_0x2199be[_0x064d('0x1f')]?_[_0x064d('0x1e')](_0x2199be['include'],function(_0x133f3a){return{'model':db[_0x133f3a[_0x064d('0x1d')]],'as':_0x133f3a['as'],'attributes':_0x133f3a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5d352b){logger[_0x064d('0x14')]('GetFreshdeskAccount',_0x524a83);logger['debug'](_0x064d('0x16'),_0x524a83,JSON[_0x064d('0x11')](_0x5d352b));_0x4f707a(_0x5d352b);})[_0x064d('0x20')](function(_0x45869c){logger[_0x064d('0x12')](_0x064d('0x16'),_0x45869c[_0x064d('0x13')],_0x524a83);_0x29d1c1(_0x40bc77[_0x064d('0x12')](0x1f4,_0x45869c[_0x064d('0x13')]));});});};exports[_0x064d('0x21')]=function(_0x108251){var _0xa0cd3f=this;return new Promise(function(_0x5ba54a,_0x5ca2c3){return db['FreshdeskAccount'][_0x064d('0x22')]({'raw':_0x108251[_0x064d('0x19')]?_0x108251['options']['raw']===undefined?!![]:![]:!![],'where':_0x108251[_0x064d('0x19')]?_0x108251[_0x064d('0x19')]['where']||null:null,'attributes':_0x108251[_0x064d('0x19')]?_0x108251[_0x064d('0x19')][_0x064d('0x1c')]||null:null,'include':_0x108251[_0x064d('0x19')]?_0x108251[_0x064d('0x19')][_0x064d('0x1f')]?_[_0x064d('0x1e')](_0x108251['options'][_0x064d('0x1f')],function(_0x5677d5){return{'model':db[_0x5677d5[_0x064d('0x1d')]],'as':_0x5677d5['as'],'attributes':_0x5677d5[_0x064d('0x1c')],'include':_0x5677d5[_0x064d('0x1f')]?_[_0x064d('0x1e')](_0x5677d5[_0x064d('0x1f')],function(_0x4b870a){return{'model':db[_0x4b870a[_0x064d('0x1d')]],'as':_0x4b870a['as'],'attributes':_0x4b870a[_0x064d('0x1c')],'include':_0x4b870a['include']?_['map'](_0x4b870a[_0x064d('0x1f')],function(_0x10c336){return{'model':db[_0x10c336['model']],'as':_0x10c336['as'],'attributes':_0x10c336['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4a3466){logger['info'](_0x064d('0x21'),_0x108251);logger['debug']('ShowFreshdeskAccount',_0x108251,JSON[_0x064d('0x11')](_0x4a3466));_0x5ba54a(_0x4a3466);})[_0x064d('0x20')](function(_0xd0cd40){logger['error'](_0x064d('0x21'),_0xd0cd40[_0x064d('0x13')],_0x108251);_0x5ca2c3(_0xa0cd3f[_0x064d('0x12')](0x1f4,_0xd0cd40[_0x064d('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index cf6b1ac..309bf68 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 _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 +var _0x866a=['../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put','destroy','exports','multer','Router','fs-extra','../../components/auth/service'];(function(_0x3ef6bb,_0x1bb97f){var _0xa5f12a=function(_0x23f548){while(--_0x23f548){_0x3ef6bb['push'](_0x3ef6bb['shift']());}};_0xa5f12a(++_0x1bb97f);}(_0x866a,0x1c8));var _0xa866=function(_0x11cd17,_0x489e02){_0x11cd17=_0x11cd17-0x0;var _0x3343ad=_0x866a[_0x11cd17];return _0x3343ad;};'use strict';var multer=require(_0xa866('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa866('0x1')]();var fs_extra=require(_0xa866('0x2'));var auth=require(_0xa866('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xa866('0x4'));var controller=require(_0xa866('0x5'));router[_0xa866('0x6')]('/',auth[_0xa866('0x7')](),controller['index']);router[_0xa866('0x6')](_0xa866('0x8'),auth[_0xa866('0x7')](),controller[_0xa866('0x9')]);router[_0xa866('0x6')](_0xa866('0xa'),auth['isAuthenticated'](),controller[_0xa866('0xb')]);router[_0xa866('0x6')]('/:id/subjects',auth[_0xa866('0x7')](),controller[_0xa866('0xc')]);router[_0xa866('0x6')](_0xa866('0xd'),auth[_0xa866('0x7')](),controller[_0xa866('0xe')]);router[_0xa866('0x6')](_0xa866('0xf'),auth[_0xa866('0x7')](),controller[_0xa866('0x10')]);router[_0xa866('0x11')]('/',auth[_0xa866('0x7')](),controller[_0xa866('0x12')]);router[_0xa866('0x11')](_0xa866('0xf'),auth[_0xa866('0x7')](),controller[_0xa866('0x13')]);router[_0xa866('0x14')](_0xa866('0x8'),auth[_0xa866('0x7')](),controller['update']);router['delete'](_0xa866('0x8'),auth[_0xa866('0x7')](),controller[_0xa866('0x15')]);module[_0xa866('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index f2426c8..ca5ec6d 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 _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 +var _0xbdd5=['sequelize','exports','STRING'];(function(_0x355576,_0x566533){var _0x218785=function(_0x4ebbf5){while(--_0x4ebbf5){_0x355576['push'](_0x355576['shift']());}};_0x218785(++_0x566533);}(_0xbdd5,0xe7));var _0x5bdd=function(_0x15b785,_0x4d07ba){_0x15b785=_0x15b785-0x0;var _0x4af90f=_0xbdd5[_0x15b785];return _0x4af90f;};'use strict';var Sequelize=require(_0x5bdd('0x0'));module[_0x5bdd('0x1')]={'name':{'type':Sequelize[_0x5bdd('0x2')]},'description':{'type':Sequelize[_0x5bdd('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index c695718..c0d29f7 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 _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 +var _0xadc0=['mustache','util','path','sox','ejs','lodash','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','pick','filter','merge','type','VIRTUAL','options','FreshdeskConfiguration','includeAll','include','catch','show','params','keys','rawAttributes','create','body','find','getFields','findOne','FreshdeskField','order','sort','getSubjects','getDescriptions','getTags','Tag','setTags','eml-format','zip-dir','fast-json-patch','request-promise','bluebird'];(function(_0x2f57b2,_0xa8e91a){var _0x5ace77=function(_0x59c00a){while(--_0x59c00a){_0x2f57b2['push'](_0x2f57b2['shift']());}};_0x5ace77(++_0xa8e91a);}(_0xadc0,0x99));var _0x0adc=function(_0x34de2c,_0x1120c9){_0x34de2c=_0x34de2c-0x0;var _0x4cd6ca=_0xadc0[_0x34de2c];return _0x4cd6ca;};'use strict';var emlformat=require(_0x0adc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0adc('0x1'));var jsonpatch=require(_0x0adc('0x2'));var rp=require(_0x0adc('0x3'));var moment=require('moment');var BPromise=require(_0x0adc('0x4'));var Mustache=require(_0x0adc('0x5'));var util=require(_0x0adc('0x6'));var path=require(_0x0adc('0x7'));var sox=require(_0x0adc('0x8'));var csv=require('to-csv');var ejs=require(_0x0adc('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0adc('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0adc('0xb'));var toCsv=require('to-csv');var querystring=require(_0x0adc('0xc'));var Papa=require(_0x0adc('0xd'));var Redis=require('ioredis');var authService=require(_0x0adc('0xe'));var qs=require(_0x0adc('0xf'));var as=require(_0x0adc('0x10'));var hardwareService=require(_0x0adc('0x11'));var logger=require(_0x0adc('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x0adc('0x13'));var licenseUtil=require(_0x0adc('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x392fad,_0x32ebea){_0x32ebea=_0x32ebea||0xcc;return function(_0x33cb83){if(_0x33cb83){return _0x392fad[_0x0adc('0x15')](_0x32ebea);}return _0x392fad[_0x0adc('0x16')](_0x32ebea)[_0x0adc('0x17')]();};}function respondWithResult(_0x58203a,_0x17a33e){_0x17a33e=_0x17a33e||0xc8;return function(_0x2b806e){if(_0x2b806e){return _0x58203a[_0x0adc('0x16')](_0x17a33e)[_0x0adc('0x18')](_0x2b806e);}};}function respondWithFilteredResult(_0x294628,_0x586fa2){return function(_0x3ff668){if(_0x3ff668){var _0x1da143=typeof _0x586fa2['offset']===_0x0adc('0x19')&&typeof _0x586fa2['limit']===_0x0adc('0x19');var _0x1c6150=_0x3ff668['count'];var _0x40a2ed=_0x1da143?0x0:_0x586fa2['offset'];var _0x493b11=_0x1da143?_0x3ff668['count']:_0x586fa2[_0x0adc('0x1a')]+_0x586fa2[_0x0adc('0x1b')];var _0x3ebb77;if(_0x493b11>=_0x1c6150){_0x493b11=_0x1c6150;_0x3ebb77=0xc8;}else{_0x3ebb77=0xce;}_0x294628['status'](_0x3ebb77);return _0x294628[_0x0adc('0x1c')](_0x0adc('0x1d'),_0x40a2ed+'-'+_0x493b11+'/'+_0x1c6150)['json'](_0x3ff668);}return null;};}function patchUpdates(_0x1a36d0){return function(_0xf96a1f){try{jsonpatch[_0x0adc('0x1e')](_0xf96a1f,_0x1a36d0,!![]);}catch(_0x3f0576){return BPromise[_0x0adc('0x1f')](_0x3f0576);}return _0xf96a1f[_0x0adc('0x20')]();};}function saveUpdates(_0x8b962b,_0x544440){return function(_0x2883c6){if(_0x2883c6){return _0x2883c6['update'](_0x8b962b)[_0x0adc('0x21')](function(_0x1f2086){return _0x1f2086;});}return null;};}function removeEntity(_0x43535e,_0x2d5ac7){return function(_0x174992){if(_0x174992){return _0x174992[_0x0adc('0x22')]()[_0x0adc('0x21')](function(){_0x43535e[_0x0adc('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b6f10,_0x2fcf79){return function(_0x10f4e3){if(!_0x10f4e3){_0x3b6f10[_0x0adc('0x15')](0x194);}return _0x10f4e3;};}function handleError(_0xc8ad1f,_0x2886e6){_0x2886e6=_0x2886e6||0x1f4;return function(_0x26d559){logger[_0x0adc('0x23')](_0x26d559[_0x0adc('0x24')]);if(_0x26d559[_0x0adc('0x25')]){delete _0x26d559[_0x0adc('0x25')];}_0xc8ad1f[_0x0adc('0x16')](_0x2886e6)['send'](_0x26d559);};}exports[_0x0adc('0x26')]=function(_0x1a0e6d,_0x233e8c){var _0x13afd2={},_0x141c7c={},_0x38532f={'count':0x0,'rows':[]};var _0x35d62b=_[_0x0adc('0x27')](db['FreshdeskConfiguration']['rawAttributes'],function(_0x15efe4){return{'name':_0x15efe4[_0x0adc('0x28')],'type':_0x15efe4['type'][_0x0adc('0x29')]};});_0x141c7c[_0x0adc('0x2a')]=_[_0x0adc('0x27')](_0x35d62b,'name');_0x141c7c[_0x0adc('0x2b')]=_['keys'](_0x1a0e6d[_0x0adc('0x2b')]);_0x141c7c[_0x0adc('0x2c')]=_[_0x0adc('0x2d')](_0x141c7c[_0x0adc('0x2a')],_0x141c7c[_0x0adc('0x2b')]);_0x13afd2[_0x0adc('0x2e')]=_[_0x0adc('0x2d')](_0x141c7c['model'],qs['fields'](_0x1a0e6d[_0x0adc('0x2b')][_0x0adc('0x2f')]));_0x13afd2[_0x0adc('0x2e')]=_0x13afd2[_0x0adc('0x2e')][_0x0adc('0x30')]?_0x13afd2['attributes']:_0x141c7c[_0x0adc('0x2a')];if(!_0x1a0e6d[_0x0adc('0x2b')][_0x0adc('0x31')](_0x0adc('0x32'))){_0x13afd2['limit']=qs[_0x0adc('0x1b')](_0x1a0e6d[_0x0adc('0x2b')][_0x0adc('0x1b')]);_0x13afd2[_0x0adc('0x1a')]=qs[_0x0adc('0x1a')](_0x1a0e6d[_0x0adc('0x2b')][_0x0adc('0x1a')]);}_0x13afd2['order']=qs['sort'](_0x1a0e6d[_0x0adc('0x2b')]['sort']);_0x13afd2[_0x0adc('0x33')]=qs[_0x0adc('0x2c')](_[_0x0adc('0x34')](_0x1a0e6d[_0x0adc('0x2b')],_0x141c7c[_0x0adc('0x2c')]),_0x35d62b);if(_0x1a0e6d[_0x0adc('0x2b')][_0x0adc('0x35')]){_0x13afd2[_0x0adc('0x33')]=_[_0x0adc('0x36')](_0x13afd2[_0x0adc('0x33')],{'$or':_[_0x0adc('0x27')](_0x35d62b,function(_0xa830c8){if(_0xa830c8[_0x0adc('0x37')]!==_0x0adc('0x38')){var _0x48bfab={};_0x48bfab[_0xa830c8[_0x0adc('0x25')]]={'$like':'%'+_0x1a0e6d[_0x0adc('0x2b')][_0x0adc('0x35')]+'%'};return _0x48bfab;}})});}_0x13afd2=_[_0x0adc('0x36')]({},_0x13afd2,_0x1a0e6d[_0x0adc('0x39')]);var _0x1090ce={'where':_0x13afd2[_0x0adc('0x33')]};return db[_0x0adc('0x3a')]['count'](_0x1090ce)[_0x0adc('0x21')](function(_0x2f6739){_0x38532f['count']=_0x2f6739;if(_0x1a0e6d['query'][_0x0adc('0x3b')]){_0x13afd2[_0x0adc('0x3c')]=[{'all':!![]}];}return db['FreshdeskConfiguration']['findAll'](_0x13afd2);})[_0x0adc('0x21')](function(_0x1217a1){_0x38532f['rows']=_0x1217a1;return _0x38532f;})['then'](respondWithFilteredResult(_0x233e8c,_0x13afd2))[_0x0adc('0x3d')](handleError(_0x233e8c,null));};exports[_0x0adc('0x3e')]=function(_0x32dac2,_0x301a6c){var _0x2ceea1={'raw':![],'where':{'id':_0x32dac2[_0x0adc('0x3f')]['id']}},_0x4f5dfe={};_0x4f5dfe[_0x0adc('0x2a')]=_[_0x0adc('0x40')](db[_0x0adc('0x3a')][_0x0adc('0x41')]);_0x4f5dfe['query']=_[_0x0adc('0x40')](_0x32dac2[_0x0adc('0x2b')]);_0x4f5dfe[_0x0adc('0x2c')]=_[_0x0adc('0x2d')](_0x4f5dfe[_0x0adc('0x2a')],_0x4f5dfe[_0x0adc('0x2b')]);_0x2ceea1[_0x0adc('0x2e')]=_['intersection'](_0x4f5dfe[_0x0adc('0x2a')],qs[_0x0adc('0x2f')](_0x32dac2[_0x0adc('0x2b')][_0x0adc('0x2f')]));_0x2ceea1[_0x0adc('0x2e')]=_0x2ceea1['attributes'][_0x0adc('0x30')]?_0x2ceea1[_0x0adc('0x2e')]:_0x4f5dfe[_0x0adc('0x2a')];if(_0x32dac2[_0x0adc('0x2b')][_0x0adc('0x3b')]){_0x2ceea1[_0x0adc('0x3c')]=[{'all':!![]}];}_0x2ceea1=_[_0x0adc('0x36')]({},_0x2ceea1,_0x32dac2['options']);return db[_0x0adc('0x3a')]['find'](_0x2ceea1)[_0x0adc('0x21')](handleEntityNotFound(_0x301a6c,null))['then'](respondWithResult(_0x301a6c,null))[_0x0adc('0x3d')](handleError(_0x301a6c,null));};exports[_0x0adc('0x42')]=function(_0x516247,_0x59f959){return db[_0x0adc('0x3a')][_0x0adc('0x42')](_0x516247[_0x0adc('0x43')],{})[_0x0adc('0x21')](respondWithResult(_0x59f959,0xc9))['catch'](handleError(_0x59f959,null));};exports['update']=function(_0x1fdd4f,_0x1725a0){if(_0x1fdd4f['body']['id']){delete _0x1fdd4f[_0x0adc('0x43')]['id'];}return db[_0x0adc('0x3a')][_0x0adc('0x44')]({'where':{'id':_0x1fdd4f[_0x0adc('0x3f')]['id']}})[_0x0adc('0x21')](handleEntityNotFound(_0x1725a0,null))['then'](saveUpdates(_0x1fdd4f[_0x0adc('0x43')],null))['then'](respondWithResult(_0x1725a0,null))[_0x0adc('0x3d')](handleError(_0x1725a0,null));};exports[_0x0adc('0x22')]=function(_0xd335b5,_0x279b42){return db[_0x0adc('0x3a')][_0x0adc('0x44')]({'where':{'id':_0xd335b5[_0x0adc('0x3f')]['id']}})[_0x0adc('0x21')](handleEntityNotFound(_0x279b42,null))['then'](removeEntity(_0x279b42,null))[_0x0adc('0x3d')](handleError(_0x279b42,null));};exports[_0x0adc('0x45')]=function(_0x1bc249,_0x37ad9f,_0x3cd009){var _0x37467f={};var _0x24bd55={};var _0x2a641f;var _0x1ff490;return db[_0x0adc('0x3a')][_0x0adc('0x46')]({'where':{'id':_0x1bc249[_0x0adc('0x3f')]['id']}})[_0x0adc('0x21')](handleEntityNotFound(_0x37ad9f,null))[_0x0adc('0x21')](function(_0xe8de65){if(_0xe8de65){_0x2a641f=_0xe8de65;_0x24bd55['model']=_[_0x0adc('0x40')](db[_0x0adc('0x47')]['rawAttributes']);_0x24bd55['query']=_[_0x0adc('0x40')](_0x1bc249[_0x0adc('0x2b')]);_0x24bd55[_0x0adc('0x2c')]=_[_0x0adc('0x2d')](_0x24bd55[_0x0adc('0x2a')],_0x24bd55[_0x0adc('0x2b')]);_0x37467f[_0x0adc('0x2e')]=_[_0x0adc('0x2d')](_0x24bd55[_0x0adc('0x2a')],qs['fields'](_0x1bc249[_0x0adc('0x2b')]['fields']));_0x37467f['attributes']=_0x37467f[_0x0adc('0x2e')]['length']?_0x37467f[_0x0adc('0x2e')]:_0x24bd55[_0x0adc('0x2a')];_0x37467f[_0x0adc('0x48')]=qs[_0x0adc('0x49')](_0x1bc249[_0x0adc('0x2b')][_0x0adc('0x49')]);_0x37467f[_0x0adc('0x33')]=qs[_0x0adc('0x2c')](_[_0x0adc('0x34')](_0x1bc249['query'],_0x24bd55[_0x0adc('0x2c')]));if(_0x1bc249['query'][_0x0adc('0x35')]){_0x37467f[_0x0adc('0x33')]=_[_0x0adc('0x36')](_0x37467f['where'],{'$or':_[_0x0adc('0x27')](_0x37467f['attributes'],function(_0x43c57a){var _0x5046f6={};_0x5046f6[_0x43c57a]={'$like':'%'+_0x1bc249[_0x0adc('0x2b')][_0x0adc('0x35')]+'%'};return _0x5046f6;})});}_0x37467f=_[_0x0adc('0x36')]({},_0x37467f,_0x1bc249[_0x0adc('0x39')]);return _0x2a641f[_0x0adc('0x45')](_0x37467f);}})['then'](function(_0x1153c4){if(_0x1153c4){_0x1ff490=_0x1153c4[_0x0adc('0x30')];if(!_0x1bc249[_0x0adc('0x2b')]['hasOwnProperty']('nolimit')){_0x37467f[_0x0adc('0x1b')]=qs[_0x0adc('0x1b')](_0x1bc249[_0x0adc('0x2b')][_0x0adc('0x1b')]);_0x37467f['offset']=qs[_0x0adc('0x1a')](_0x1bc249['query'][_0x0adc('0x1a')]);}return _0x2a641f['getFields'](_0x37467f);}})[_0x0adc('0x21')](function(_0x26444c){if(_0x26444c){return _0x26444c?{'count':_0x1ff490,'rows':_0x26444c}:null;}})[_0x0adc('0x21')](respondWithResult(_0x37ad9f,null))[_0x0adc('0x3d')](handleError(_0x37ad9f,null));};exports[_0x0adc('0x4a')]=function(_0x4c4438,_0x3d2e1d,_0x3c0f53){var _0x254492={};var _0x5a29af={};var _0x4e1266;var _0x3cf9f2;return db[_0x0adc('0x3a')][_0x0adc('0x46')]({'where':{'id':_0x4c4438[_0x0adc('0x3f')]['id']}})[_0x0adc('0x21')](handleEntityNotFound(_0x3d2e1d,null))[_0x0adc('0x21')](function(_0x38b913){if(_0x38b913){_0x4e1266=_0x38b913;_0x5a29af[_0x0adc('0x2a')]=_[_0x0adc('0x40')](db['FreshdeskField'][_0x0adc('0x41')]);_0x5a29af[_0x0adc('0x2b')]=_[_0x0adc('0x40')](_0x4c4438[_0x0adc('0x2b')]);_0x5a29af[_0x0adc('0x2c')]=_['intersection'](_0x5a29af[_0x0adc('0x2a')],_0x5a29af[_0x0adc('0x2b')]);_0x254492[_0x0adc('0x2e')]=_[_0x0adc('0x2d')](_0x5a29af[_0x0adc('0x2a')],qs[_0x0adc('0x2f')](_0x4c4438['query'][_0x0adc('0x2f')]));_0x254492[_0x0adc('0x2e')]=_0x254492[_0x0adc('0x2e')][_0x0adc('0x30')]?_0x254492['attributes']:_0x5a29af[_0x0adc('0x2a')];_0x254492[_0x0adc('0x48')]=qs[_0x0adc('0x49')](_0x4c4438[_0x0adc('0x2b')]['sort']);_0x254492['where']=qs[_0x0adc('0x2c')](_[_0x0adc('0x34')](_0x4c4438[_0x0adc('0x2b')],_0x5a29af[_0x0adc('0x2c')]));if(_0x4c4438[_0x0adc('0x2b')]['filter']){_0x254492[_0x0adc('0x33')]=_['merge'](_0x254492[_0x0adc('0x33')],{'$or':_[_0x0adc('0x27')](_0x254492[_0x0adc('0x2e')],function(_0x3ef334){var _0x513e2f={};_0x513e2f[_0x3ef334]={'$like':'%'+_0x4c4438['query'][_0x0adc('0x35')]+'%'};return _0x513e2f;})});}_0x254492=_[_0x0adc('0x36')]({},_0x254492,_0x4c4438[_0x0adc('0x39')]);return _0x4e1266[_0x0adc('0x4a')](_0x254492);}})[_0x0adc('0x21')](function(_0x5c7d5f){if(_0x5c7d5f){_0x3cf9f2=_0x5c7d5f['length'];if(!_0x4c4438[_0x0adc('0x2b')]['hasOwnProperty'](_0x0adc('0x32'))){_0x254492['limit']=qs[_0x0adc('0x1b')](_0x4c4438[_0x0adc('0x2b')][_0x0adc('0x1b')]);_0x254492[_0x0adc('0x1a')]=qs[_0x0adc('0x1a')](_0x4c4438[_0x0adc('0x2b')][_0x0adc('0x1a')]);}return _0x4e1266[_0x0adc('0x4a')](_0x254492);}})[_0x0adc('0x21')](function(_0x5ef04a){if(_0x5ef04a){return _0x5ef04a?{'count':_0x3cf9f2,'rows':_0x5ef04a}:null;}})['then'](respondWithResult(_0x3d2e1d,null))[_0x0adc('0x3d')](handleError(_0x3d2e1d,null));};exports[_0x0adc('0x4b')]=function(_0x476827,_0x3b5bab,_0x16775b){var _0x2b9bab={};var _0x2d6777={};var _0x3667a9;var _0x3449e1;return db[_0x0adc('0x3a')]['findOne']({'where':{'id':_0x476827[_0x0adc('0x3f')]['id']}})[_0x0adc('0x21')](handleEntityNotFound(_0x3b5bab,null))[_0x0adc('0x21')](function(_0x4f0c9b){if(_0x4f0c9b){_0x3667a9=_0x4f0c9b;_0x2d6777[_0x0adc('0x2a')]=_['keys'](db[_0x0adc('0x47')][_0x0adc('0x41')]);_0x2d6777[_0x0adc('0x2b')]=_['keys'](_0x476827['query']);_0x2d6777['filters']=_[_0x0adc('0x2d')](_0x2d6777['model'],_0x2d6777[_0x0adc('0x2b')]);_0x2b9bab['attributes']=_[_0x0adc('0x2d')](_0x2d6777[_0x0adc('0x2a')],qs[_0x0adc('0x2f')](_0x476827[_0x0adc('0x2b')][_0x0adc('0x2f')]));_0x2b9bab[_0x0adc('0x2e')]=_0x2b9bab[_0x0adc('0x2e')][_0x0adc('0x30')]?_0x2b9bab[_0x0adc('0x2e')]:_0x2d6777[_0x0adc('0x2a')];_0x2b9bab[_0x0adc('0x48')]=qs[_0x0adc('0x49')](_0x476827['query']['sort']);_0x2b9bab[_0x0adc('0x33')]=qs[_0x0adc('0x2c')](_[_0x0adc('0x34')](_0x476827[_0x0adc('0x2b')],_0x2d6777[_0x0adc('0x2c')]));if(_0x476827[_0x0adc('0x2b')][_0x0adc('0x35')]){_0x2b9bab['where']=_[_0x0adc('0x36')](_0x2b9bab[_0x0adc('0x33')],{'$or':_[_0x0adc('0x27')](_0x2b9bab[_0x0adc('0x2e')],function(_0x4ad802){var _0x4634d5={};_0x4634d5[_0x4ad802]={'$like':'%'+_0x476827[_0x0adc('0x2b')][_0x0adc('0x35')]+'%'};return _0x4634d5;})});}_0x2b9bab=_[_0x0adc('0x36')]({},_0x2b9bab,_0x476827[_0x0adc('0x39')]);return _0x3667a9[_0x0adc('0x4b')](_0x2b9bab);}})[_0x0adc('0x21')](function(_0x2d3201){if(_0x2d3201){_0x3449e1=_0x2d3201[_0x0adc('0x30')];if(!_0x476827['query'][_0x0adc('0x31')](_0x0adc('0x32'))){_0x2b9bab[_0x0adc('0x1b')]=qs[_0x0adc('0x1b')](_0x476827[_0x0adc('0x2b')][_0x0adc('0x1b')]);_0x2b9bab[_0x0adc('0x1a')]=qs[_0x0adc('0x1a')](_0x476827[_0x0adc('0x2b')][_0x0adc('0x1a')]);}return _0x3667a9['getDescriptions'](_0x2b9bab);}})[_0x0adc('0x21')](function(_0x2afdce){if(_0x2afdce){return _0x2afdce?{'count':_0x3449e1,'rows':_0x2afdce}:null;}})['then'](respondWithResult(_0x3b5bab,null))[_0x0adc('0x3d')](handleError(_0x3b5bab,null));};exports[_0x0adc('0x4c')]=function(_0x4ddc5b,_0x39275f,_0x609907){var _0x476ac0={};var _0x1f56d3={};var _0x2517cd;var _0x42da16;return db[_0x0adc('0x3a')][_0x0adc('0x46')]({'where':{'id':_0x4ddc5b['params']['id']}})[_0x0adc('0x21')](handleEntityNotFound(_0x39275f,null))[_0x0adc('0x21')](function(_0x18c668){if(_0x18c668){_0x2517cd=_0x18c668;_0x1f56d3[_0x0adc('0x2a')]=_[_0x0adc('0x40')](db[_0x0adc('0x4d')][_0x0adc('0x41')]);_0x1f56d3['query']=_['keys'](_0x4ddc5b['query']);_0x1f56d3[_0x0adc('0x2c')]=_['intersection'](_0x1f56d3[_0x0adc('0x2a')],_0x1f56d3[_0x0adc('0x2b')]);_0x476ac0[_0x0adc('0x2e')]=_['intersection'](_0x1f56d3[_0x0adc('0x2a')],qs[_0x0adc('0x2f')](_0x4ddc5b[_0x0adc('0x2b')]['fields']));_0x476ac0[_0x0adc('0x2e')]=_0x476ac0[_0x0adc('0x2e')]['length']?_0x476ac0['attributes']:_0x1f56d3[_0x0adc('0x2a')];_0x476ac0[_0x0adc('0x48')]=qs[_0x0adc('0x49')](_0x4ddc5b['query'][_0x0adc('0x49')]);_0x476ac0[_0x0adc('0x33')]=qs['filters'](_[_0x0adc('0x34')](_0x4ddc5b[_0x0adc('0x2b')],_0x1f56d3[_0x0adc('0x2c')]));if(_0x4ddc5b[_0x0adc('0x2b')][_0x0adc('0x35')]){_0x476ac0['where']=_[_0x0adc('0x36')](_0x476ac0[_0x0adc('0x33')],{'$or':_[_0x0adc('0x27')](_0x476ac0[_0x0adc('0x2e')],function(_0x171751){var _0x25a82c={};_0x25a82c[_0x171751]={'$like':'%'+_0x4ddc5b[_0x0adc('0x2b')][_0x0adc('0x35')]+'%'};return _0x25a82c;})});}_0x476ac0=_['merge']({},_0x476ac0,_0x4ddc5b['options']);return _0x2517cd[_0x0adc('0x4c')](_0x476ac0);}})[_0x0adc('0x21')](function(_0x36fdbe){if(_0x36fdbe){_0x42da16=_0x36fdbe['length'];if(!_0x4ddc5b[_0x0adc('0x2b')][_0x0adc('0x31')](_0x0adc('0x32'))){_0x476ac0[_0x0adc('0x1b')]=qs[_0x0adc('0x1b')](_0x4ddc5b['query'][_0x0adc('0x1b')]);_0x476ac0[_0x0adc('0x1a')]=qs[_0x0adc('0x1a')](_0x4ddc5b['query'][_0x0adc('0x1a')]);}return _0x2517cd[_0x0adc('0x4c')](_0x476ac0);}})['then'](function(_0x40f529){if(_0x40f529){return _0x40f529?{'count':_0x42da16,'rows':_0x40f529}:null;}})[_0x0adc('0x21')](respondWithResult(_0x39275f,null))[_0x0adc('0x3d')](handleError(_0x39275f,null));};exports[_0x0adc('0x4e')]=function(_0x5f0ab4,_0x2fc977,_0x567ebe){if(_0x5f0ab4[_0x0adc('0x43')]['id']){delete _0x5f0ab4[_0x0adc('0x43')]['id'];}return db[_0x0adc('0x3a')]['findOne']({'where':{'id':_0x5f0ab4['params']['id']}})['then'](handleEntityNotFound(_0x2fc977,null))[_0x0adc('0x21')](function(_0x1b3d89){if(_0x1b3d89){return _0x1b3d89['setTags'](_0x5f0ab4[_0x0adc('0x43')]['ids']||[]);}return null;})[_0x0adc('0x21')](respondWithResult(_0x2fc977,null))['catch'](handleError(_0x2fc977,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index abf91ff..84a716c 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 _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 +var _0x9db5=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations'];(function(_0x253162,_0x5938a8){var _0x2012bb=function(_0x3c6f80){while(--_0x3c6f80){_0x253162['push'](_0x253162['shift']());}};_0x2012bb(++_0x5938a8);}(_0x9db5,0x16c));var _0x59db=function(_0x41c705,_0x367e9a){_0x41c705=_0x41c705-0x0;var _0x26c418=_0x9db5[_0x41c705];return _0x26c418;};'use strict';var _=require(_0x59db('0x0'));var util=require(_0x59db('0x1'));var logger=require(_0x59db('0x2'))(_0x59db('0x3'));var moment=require(_0x59db('0x4'));var BPromise=require(_0x59db('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x59db('0x6'));var rimraf=require(_0x59db('0x7'));var config=require(_0x59db('0x8'));var attributes=require(_0x59db('0x9'));module[_0x59db('0xa')]=function(_0x4f3877,_0xa75f2){return _0x4f3877[_0x59db('0xb')](_0x59db('0xc'),attributes,{'tableName':_0x59db('0xd'),'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 2c95cd9..0cbeca8 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 _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 +var _0x7f83=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','request\x20sent','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x55201c,_0x1917ba){var _0x5d17e1=function(_0x17e835){while(--_0x17e835){_0x55201c['push'](_0x55201c['shift']());}};_0x5d17e1(++_0x1917ba);}(_0x7f83,0x9a));var _0x37f8=function(_0x4c087b,_0x3a8ea5){_0x4c087b=_0x4c087b-0x0;var _0x52b55a=_0x7f83[_0x4c087b];return _0x52b55a;};'use strict';var _=require(_0x37f8('0x0'));var util=require(_0x37f8('0x1'));var moment=require(_0x37f8('0x2'));var BPromise=require(_0x37f8('0x3'));var rs=require(_0x37f8('0x4'));var fs=require('fs');var Redis=require(_0x37f8('0x5'));var db=require(_0x37f8('0x6'))['db'];var utils=require(_0x37f8('0x7'));var logger=require(_0x37f8('0x8'))(_0x37f8('0x9'));var config=require(_0x37f8('0xa'));var jayson=require(_0x37f8('0xb'));var client=jayson[_0x37f8('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c368f,_0x98b209,_0x5d10f2){return new BPromise(function(_0x2c0b20,_0x9dadaa){return client[_0x37f8('0xd')](_0x5c368f,_0x5d10f2)[_0x37f8('0xe')](function(_0x12ded2){logger[_0x37f8('0xf')](_0x37f8('0x10'),_0x98b209,'request\x20sent');logger[_0x37f8('0x11')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x98b209,_0x37f8('0x12'),JSON['stringify'](_0x12ded2));if(_0x12ded2[_0x37f8('0x13')]){if(_0x12ded2[_0x37f8('0x13')][_0x37f8('0x14')]===0x1f4){logger['error'](_0x37f8('0x10'),_0x98b209,_0x12ded2['error']['message']);return _0x9dadaa(_0x12ded2[_0x37f8('0x13')]['message']);}logger[_0x37f8('0x13')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x98b209,_0x12ded2[_0x37f8('0x13')]['message']);return _0x2c0b20(_0x12ded2[_0x37f8('0x13')][_0x37f8('0x15')]);}else{logger[_0x37f8('0xf')](_0x37f8('0x10'),_0x98b209,'request\x20sent');_0x2c0b20(_0x12ded2['result'][_0x37f8('0x15')]);}})[_0x37f8('0x16')](function(_0x449e7b){logger[_0x37f8('0x13')](_0x37f8('0x10'),_0x98b209,_0x449e7b);_0x9dadaa(_0x449e7b);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 042f275..89b9545 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 _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 +var _0x6677=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','isAuthenticated','index','get','post','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x4f5d29,_0x58c507){var _0x52d907=function(_0x21cc25){while(--_0x21cc25){_0x4f5d29['push'](_0x4f5d29['shift']());}};_0x52d907(++_0x58c507);}(_0x6677,0xa6));var _0x7667=function(_0x1a6f00,_0x228aff){_0x1a6f00=_0x1a6f00-0x0;var _0x3a9e6b=_0x6677[_0x1a6f00];return _0x3a9e6b;};'use strict';var multer=require(_0x7667('0x0'));var util=require('util');var path=require(_0x7667('0x1'));var timeout=require(_0x7667('0x2'));var express=require(_0x7667('0x3'));var router=express[_0x7667('0x4')]();var fs_extra=require(_0x7667('0x5'));var auth=require(_0x7667('0x6'));var interaction=require(_0x7667('0x7'));var config=require(_0x7667('0x8'));var controller=require(_0x7667('0x9'));router['get']('/',auth[_0x7667('0xa')](),controller[_0x7667('0xb')]);router[_0x7667('0xc')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x7667('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7667('0xe')]('/:id',auth[_0x7667('0xa')](),controller[_0x7667('0xf')]);router[_0x7667('0x10')]('/:id',auth[_0x7667('0xa')](),controller[_0x7667('0x11')]);module[_0x7667('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 03db00d..fc5d1ca 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 _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 +var _0x7bd7=['ENUM','customVariable','STRING','string','variable','BOOLEAN','sequelize','exports'];(function(_0x3fbfae,_0x5622ca){var _0x5db097=function(_0x1d7629){while(--_0x1d7629){_0x3fbfae['push'](_0x3fbfae['shift']());}};_0x5db097(++_0x5622ca);}(_0x7bd7,0xd6));var _0x77bd=function(_0x31e8da,_0x433e48){_0x31e8da=_0x31e8da-0x0;var _0x3def8d=_0x7bd7[_0x31e8da];return _0x3def8d;};'use strict';var Sequelize=require(_0x77bd('0x0'));module[_0x77bd('0x1')]={'type':{'type':Sequelize[_0x77bd('0x2')]('string','variable',_0x77bd('0x3'),'keyValue','picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x77bd('0x4')]},'key':{'type':Sequelize[_0x77bd('0x4')]},'keyType':{'type':Sequelize[_0x77bd('0x2')](_0x77bd('0x5'),_0x77bd('0x6'),_0x77bd('0x3'))},'keyContent':{'type':Sequelize[_0x77bd('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x77bd('0x4')]},'customField':{'type':Sequelize[_0x77bd('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x77bd('0x4')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index e9c720c..9eb9abc 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 _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 +var _0x16d2=['lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','error','stack','name','send','map','FreshdeskField','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','params','merge','find','catch','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra'];(function(_0x4805b4,_0x16108a){var _0x2bceab=function(_0x573a55){while(--_0x573a55){_0x4805b4['push'](_0x4805b4['shift']());}};_0x2bceab(++_0x16108a);}(_0x16d2,0x123));var _0x216d=function(_0x320cf5,_0x4e437d){_0x320cf5=_0x320cf5-0x0;var _0xa77006=_0x16d2[_0x320cf5];return _0xa77006;};'use strict';var emlformat=require(_0x216d('0x0'));var rimraf=require(_0x216d('0x1'));var zipdir=require(_0x216d('0x2'));var jsonpatch=require(_0x216d('0x3'));var rp=require(_0x216d('0x4'));var moment=require(_0x216d('0x5'));var BPromise=require(_0x216d('0x6'));var Mustache=require(_0x216d('0x7'));var util=require(_0x216d('0x8'));var path=require('path');var sox=require(_0x216d('0x9'));var csv=require(_0x216d('0xa'));var ejs=require(_0x216d('0xb'));var fs=require('fs');var fs_extra=require(_0x216d('0xc'));var _=require(_0x216d('0xd'));var squel=require(_0x216d('0xe'));var crypto=require(_0x216d('0xf'));var jsforce=require(_0x216d('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x216d('0xa'));var querystring=require(_0x216d('0x11'));var Papa=require(_0x216d('0x12'));var Redis=require(_0x216d('0x13'));var authService=require(_0x216d('0x14'));var qs=require(_0x216d('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x216d('0x16'));var logger=require('../../config/logger')(_0x216d('0x17'));var utils=require(_0x216d('0x18'));var config=require(_0x216d('0x19'));var licenseUtil=require(_0x216d('0x1a'));var db=require(_0x216d('0x1b'))['db'];function respondWithStatusCode(_0x23ecf9,_0x4c92d9){_0x4c92d9=_0x4c92d9||0xcc;return function(_0xb36a43){if(_0xb36a43){return _0x23ecf9['sendStatus'](_0x4c92d9);}return _0x23ecf9[_0x216d('0x1c')](_0x4c92d9)[_0x216d('0x1d')]();};}function respondWithResult(_0x4dc2a2,_0x165c19){_0x165c19=_0x165c19||0xc8;return function(_0x322e4b){if(_0x322e4b){return _0x4dc2a2['status'](_0x165c19)[_0x216d('0x1e')](_0x322e4b);}};}function respondWithFilteredResult(_0x494e92,_0x448c0d){return function(_0xf571a4){if(_0xf571a4){var _0x4631b0=typeof _0x448c0d[_0x216d('0x1f')]===_0x216d('0x20')&&typeof _0x448c0d[_0x216d('0x21')]===_0x216d('0x20');var _0x1496fe=_0xf571a4[_0x216d('0x22')];var _0x53d464=_0x4631b0?0x0:_0x448c0d[_0x216d('0x1f')];var _0x5124ab=_0x4631b0?_0xf571a4['count']:_0x448c0d[_0x216d('0x1f')]+_0x448c0d[_0x216d('0x21')];var _0x574758;if(_0x5124ab>=_0x1496fe){_0x5124ab=_0x1496fe;_0x574758=0xc8;}else{_0x574758=0xce;}_0x494e92[_0x216d('0x1c')](_0x574758);return _0x494e92[_0x216d('0x23')]('Content-Range',_0x53d464+'-'+_0x5124ab+'/'+_0x1496fe)[_0x216d('0x1e')](_0xf571a4);}return null;};}function patchUpdates(_0x13b8e0){return function(_0x430e81){try{jsonpatch[_0x216d('0x24')](_0x430e81,_0x13b8e0,!![]);}catch(_0x5c3e03){return BPromise[_0x216d('0x25')](_0x5c3e03);}return _0x430e81[_0x216d('0x26')]();};}function saveUpdates(_0x10f299,_0x438981){return function(_0x206782){if(_0x206782){return _0x206782['update'](_0x10f299)[_0x216d('0x27')](function(_0x1bd4db){return _0x1bd4db;});}return null;};}function removeEntity(_0x188494,_0x2880c6){return function(_0x6fa4b3){if(_0x6fa4b3){return _0x6fa4b3['destroy']()[_0x216d('0x27')](function(){_0x188494[_0x216d('0x1c')](0xcc)[_0x216d('0x1d')]();});}};}function handleEntityNotFound(_0x5998a1,_0x4ec8a7){return function(_0x56460f){if(!_0x56460f){_0x5998a1['sendStatus'](0x194);}return _0x56460f;};}function handleError(_0x5eb444,_0x32f240){_0x32f240=_0x32f240||0x1f4;return function(_0x470d8a){logger[_0x216d('0x28')](_0x470d8a[_0x216d('0x29')]);if(_0x470d8a[_0x216d('0x2a')]){delete _0x470d8a['name'];}_0x5eb444['status'](_0x32f240)[_0x216d('0x2b')](_0x470d8a);};}exports['index']=function(_0x23d1c3,_0x42abbe){var _0x10f7c6={},_0x20bc16={},_0x307f2b={'count':0x0,'rows':[]};var _0x12bcab=_[_0x216d('0x2c')](db[_0x216d('0x2d')][_0x216d('0x2e')],function(_0x28f56a){return{'name':_0x28f56a[_0x216d('0x2f')],'type':_0x28f56a[_0x216d('0x30')][_0x216d('0x31')]};});_0x20bc16['model']=_[_0x216d('0x2c')](_0x12bcab,_0x216d('0x2a'));_0x20bc16[_0x216d('0x32')]=_['keys'](_0x23d1c3[_0x216d('0x32')]);_0x20bc16[_0x216d('0x33')]=_[_0x216d('0x34')](_0x20bc16[_0x216d('0x35')],_0x20bc16['query']);_0x10f7c6[_0x216d('0x36')]=_[_0x216d('0x34')](_0x20bc16[_0x216d('0x35')],qs[_0x216d('0x37')](_0x23d1c3[_0x216d('0x32')][_0x216d('0x37')]));_0x10f7c6[_0x216d('0x36')]=_0x10f7c6[_0x216d('0x36')][_0x216d('0x38')]?_0x10f7c6[_0x216d('0x36')]:_0x20bc16[_0x216d('0x35')];if(!_0x23d1c3['query'][_0x216d('0x39')](_0x216d('0x3a'))){_0x10f7c6[_0x216d('0x21')]=qs['limit'](_0x23d1c3[_0x216d('0x32')][_0x216d('0x21')]);_0x10f7c6['offset']=qs[_0x216d('0x1f')](_0x23d1c3['query']['offset']);}_0x10f7c6[_0x216d('0x3b')]=qs[_0x216d('0x3c')](_0x23d1c3[_0x216d('0x32')][_0x216d('0x3c')]);_0x10f7c6['where']=qs['filters'](_['pick'](_0x23d1c3[_0x216d('0x32')],_0x20bc16[_0x216d('0x33')]),_0x12bcab);if(_0x23d1c3['query'][_0x216d('0x3d')]){_0x10f7c6[_0x216d('0x3e')]=_['merge'](_0x10f7c6[_0x216d('0x3e')],{'$or':_[_0x216d('0x2c')](_0x12bcab,function(_0x2476a0){if(_0x2476a0[_0x216d('0x30')]!==_0x216d('0x3f')){var _0x2e857e={};_0x2e857e[_0x2476a0[_0x216d('0x2a')]]={'$like':'%'+_0x23d1c3[_0x216d('0x32')]['filter']+'%'};return _0x2e857e;}})});}_0x10f7c6=_['merge']({},_0x10f7c6,_0x23d1c3[_0x216d('0x40')]);var _0x2be24f={'where':_0x10f7c6['where']};return db[_0x216d('0x2d')][_0x216d('0x22')](_0x2be24f)[_0x216d('0x27')](function(_0x47f796){_0x307f2b[_0x216d('0x22')]=_0x47f796;if(_0x23d1c3[_0x216d('0x32')][_0x216d('0x41')]){_0x10f7c6[_0x216d('0x42')]=[{'all':!![]}];}return db['FreshdeskField'][_0x216d('0x43')](_0x10f7c6);})[_0x216d('0x27')](function(_0x5665d7){_0x307f2b[_0x216d('0x44')]=_0x5665d7;return _0x307f2b;})[_0x216d('0x27')](respondWithFilteredResult(_0x42abbe,_0x10f7c6))['catch'](handleError(_0x42abbe,null));};exports['show']=function(_0x330ec8,_0x440bc9){var _0x3c491e={'raw':!![],'where':{'id':_0x330ec8[_0x216d('0x45')]['id']}},_0x498efe={};_0x498efe['model']=_['keys'](db[_0x216d('0x2d')][_0x216d('0x2e')]);_0x498efe[_0x216d('0x32')]=_['keys'](_0x330ec8[_0x216d('0x32')]);_0x498efe['filters']=_[_0x216d('0x34')](_0x498efe[_0x216d('0x35')],_0x498efe[_0x216d('0x32')]);_0x3c491e['attributes']=_[_0x216d('0x34')](_0x498efe[_0x216d('0x35')],qs[_0x216d('0x37')](_0x330ec8[_0x216d('0x32')]['fields']));_0x3c491e['attributes']=_0x3c491e['attributes'][_0x216d('0x38')]?_0x3c491e[_0x216d('0x36')]:_0x498efe[_0x216d('0x35')];if(_0x330ec8[_0x216d('0x32')][_0x216d('0x41')]){_0x3c491e[_0x216d('0x42')]=[{'all':!![]}];}_0x3c491e=_[_0x216d('0x46')]({},_0x3c491e,_0x330ec8[_0x216d('0x40')]);return db['FreshdeskField'][_0x216d('0x47')](_0x3c491e)[_0x216d('0x27')](handleEntityNotFound(_0x440bc9,null))[_0x216d('0x27')](respondWithResult(_0x440bc9,null))[_0x216d('0x48')](handleError(_0x440bc9,null));};exports['create']=function(_0x31b8a1,_0x542e1b){return db[_0x216d('0x2d')][_0x216d('0x49')](_0x31b8a1[_0x216d('0x4a')],{})['then'](respondWithResult(_0x542e1b,0xc9))['catch'](handleError(_0x542e1b,null));};exports[_0x216d('0x4b')]=function(_0x32d499,_0x3932a3){if(_0x32d499[_0x216d('0x4a')]['id']){delete _0x32d499[_0x216d('0x4a')]['id'];}return db[_0x216d('0x2d')]['find']({'where':{'id':_0x32d499['params']['id']}})[_0x216d('0x27')](handleEntityNotFound(_0x3932a3,null))['then'](saveUpdates(_0x32d499[_0x216d('0x4a')],null))[_0x216d('0x27')](respondWithResult(_0x3932a3,null))['catch'](handleError(_0x3932a3,null));};exports['destroy']=function(_0x5f37e3,_0x4bac14){return db[_0x216d('0x2d')][_0x216d('0x47')]({'where':{'id':_0x5f37e3[_0x216d('0x45')]['id']}})[_0x216d('0x27')](handleEntityNotFound(_0x4bac14,null))[_0x216d('0x27')](removeEntity(_0x4bac14,null))[_0x216d('0x48')](handleError(_0x4bac14,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index ebd92e1..1b115ff 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 _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 +var _0xdc91=['api','moment','request-promise','path','rimraf','./intFreshdeskField.attributes','define','FreshdeskField','int_freshdesk_fields','idField','lodash','util','../../config/logger'];(function(_0x5aa023,_0x1cf1d2){var _0x31ceb5=function(_0x40f643){while(--_0x40f643){_0x5aa023['push'](_0x5aa023['shift']());}};_0x31ceb5(++_0x1cf1d2);}(_0xdc91,0x183));var _0x1dc9=function(_0x315b13,_0x3f5da3){_0x315b13=_0x315b13-0x0;var _0x2adc94=_0xdc91[_0x315b13];return _0x2adc94;};'use strict';var _=require(_0x1dc9('0x0'));var util=require(_0x1dc9('0x1'));var logger=require(_0x1dc9('0x2'))(_0x1dc9('0x3'));var moment=require(_0x1dc9('0x4'));var BPromise=require('bluebird');var rp=require(_0x1dc9('0x5'));var fs=require('fs');var path=require(_0x1dc9('0x6'));var rimraf=require(_0x1dc9('0x7'));var config=require('../../config/environment');var attributes=require(_0x1dc9('0x8'));module['exports']=function(_0x167133,_0x1a596b){return _0x167133[_0x1dc9('0x9')](_0x1dc9('0xa'),attributes,{'tableName':_0x1dc9('0xb'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0x1dc9('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 747fcc3..cf52d50 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 _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 +var _0x1568=['moment','bluebird','ioredis','jayson/promise','client','http','request','then','FreshdeskField,\x20%s,\x20%s','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util'];(function(_0x326c48,_0x31eee6){var _0xf71bc5=function(_0x391b95){while(--_0x391b95){_0x326c48['push'](_0x326c48['shift']());}};_0xf71bc5(++_0x31eee6);}(_0x1568,0x163));var _0x8156=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1568[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8156('0x0'));var util=require(_0x8156('0x1'));var moment=require(_0x8156('0x2'));var BPromise=require(_0x8156('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8156('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x8156('0x5'));var client=jayson[_0x8156('0x6')][_0x8156('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1ebdcd,_0x26af97,_0x20c0cf){return new BPromise(function(_0x381fab,_0x200ed1){return client[_0x8156('0x8')](_0x1ebdcd,_0x20c0cf)[_0x8156('0x9')](function(_0x54f86e){logger['info'](_0x8156('0xa'),_0x26af97,'request\x20sent');logger[_0x8156('0xb')](_0x8156('0xc'),_0x26af97,_0x8156('0xd'),JSON[_0x8156('0xe')](_0x54f86e));if(_0x54f86e[_0x8156('0xf')]){if(_0x54f86e[_0x8156('0xf')][_0x8156('0x10')]===0x1f4){logger[_0x8156('0xf')](_0x8156('0xa'),_0x26af97,_0x54f86e[_0x8156('0xf')][_0x8156('0x11')]);return _0x200ed1(_0x54f86e[_0x8156('0xf')]['message']);}logger[_0x8156('0xf')](_0x8156('0xa'),_0x26af97,_0x54f86e[_0x8156('0xf')]['message']);return _0x381fab(_0x54f86e[_0x8156('0xf')]['message']);}else{logger[_0x8156('0x12')](_0x8156('0xa'),_0x26af97,'request\x20sent');_0x381fab(_0x54f86e[_0x8156('0x13')][_0x8156('0x11')]);}})[_0x8156('0x14')](function(_0xb1388a){logger['error'](_0x8156('0xa'),_0x26af97,_0xb1388a);_0x200ed1(_0xb1388a);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 31c95de..244c8f4 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 _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 +var _0x2547=['addConfiguration','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','create'];(function(_0x4f527e,_0x4fddac){var _0x509653=function(_0x410680){while(--_0x410680){_0x4f527e['push'](_0x4f527e['shift']());}};_0x509653(++_0x4fddac);}(_0x2547,0x1cd));var _0x7254=function(_0x3753e6,_0x8d7ee){_0x3753e6=_0x3753e6-0x0;var _0x27195f=_0x2547[_0x3753e6];return _0x27195f;};'use strict';var multer=require('multer');var util=require(_0x7254('0x0'));var path=require(_0x7254('0x1'));var timeout=require(_0x7254('0x2'));var express=require(_0x7254('0x3'));var router=express[_0x7254('0x4')]();var fs_extra=require(_0x7254('0x5'));var auth=require(_0x7254('0x6'));var interaction=require(_0x7254('0x7'));var config=require('../../config/environment');var controller=require(_0x7254('0x8'));router[_0x7254('0x9')]('/',auth[_0x7254('0xa')](),controller[_0x7254('0xb')]);router['get'](_0x7254('0xc'),auth[_0x7254('0xa')](),controller[_0x7254('0xd')]);router['get'](_0x7254('0xe'),auth['isAuthenticated'](),controller['getConfigurations']);router['get'](_0x7254('0xf'),auth[_0x7254('0xa')](),controller[_0x7254('0x10')]);router[_0x7254('0x11')]('/',auth[_0x7254('0xa')](),controller[_0x7254('0x12')]);router['post'](_0x7254('0xe'),auth['isAuthenticated'](),controller[_0x7254('0x13')]);router['put'](_0x7254('0xc'),auth[_0x7254('0xa')](),controller[_0x7254('0x14')]);router[_0x7254('0x15')](_0x7254('0xc'),auth[_0x7254('0xa')](),controller[_0x7254('0x16')]);module[_0x7254('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 f25f02c..b528c2a 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 _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 +var _0x955f=['exports','STRING','sequelize'];(function(_0x267766,_0x53746c){var _0x11ba9d=function(_0x53b6c5){while(--_0x53b6c5){_0x267766['push'](_0x267766['shift']());}};_0x11ba9d(++_0x53746c);}(_0x955f,0x1eb));var _0xf955=function(_0xb2e744,_0x135d84){_0xb2e744=_0xb2e744-0x0;var _0x26e1d6=_0x955f[_0xb2e744];return _0x26e1d6;};'use strict';var Sequelize=require(_0xf955('0x0'));module[_0xf955('0x1')]={'name':{'type':Sequelize[_0xf955('0x2')]},'description':{'type':Sequelize[_0xf955('0x2')]},'username':{'type':Sequelize[_0xf955('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0xf955('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xf955('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index fa8abb9..aaf6d20 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 _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 +var _0xef1b=['length','hasOwnProperty','nolimit','filters','pick','merge','where','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','getConfigurations','findOne','FreshsalesConfiguration','sort','addConfiguration','Subjects','getSubjects','Descriptions','getDescriptions','channel','FreshsalesField','getFields','username','remoteUri','slice','substring','lastIndexOf','format','%s%s','/api/selector/owners','apiKey','users','Requested\x20Resource\x20not\x20Found','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','limit','undefined','offset','count','set','Content-Range','apply','update','then','destroy','error','stack','name','send','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0xef1b,0x16b));var _0xbef1=function(_0xc65c67,_0x2ba05e){_0xc65c67=_0xc65c67-0x0;var _0x37f12e=_0xef1b[_0xc65c67];return _0x37f12e;};'use strict';var emlformat=require(_0xbef1('0x0'));var rimraf=require(_0xbef1('0x1'));var zipdir=require(_0xbef1('0x2'));var jsonpatch=require(_0xbef1('0x3'));var rp=require(_0xbef1('0x4'));var moment=require(_0xbef1('0x5'));var BPromise=require(_0xbef1('0x6'));var Mustache=require('mustache');var util=require(_0xbef1('0x7'));var path=require(_0xbef1('0x8'));var sox=require(_0xbef1('0x9'));var csv=require(_0xbef1('0xa'));var ejs=require(_0xbef1('0xb'));var fs=require('fs');var fs_extra=require(_0xbef1('0xc'));var _=require(_0xbef1('0xd'));var squel=require('squel');var crypto=require(_0xbef1('0xe'));var jsforce=require(_0xbef1('0xf'));var deskjs=require(_0xbef1('0x10'));var toCsv=require(_0xbef1('0xa'));var querystring=require(_0xbef1('0x11'));var Papa=require('papaparse');var Redis=require(_0xbef1('0x12'));var authService=require(_0xbef1('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xbef1('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbef1('0x15'))(_0xbef1('0x16'));var utils=require(_0xbef1('0x17'));var config=require(_0xbef1('0x18'));var licenseUtil=require(_0xbef1('0x19'));var db=require(_0xbef1('0x1a'))['db'];var integrations=require(_0xbef1('0x1b'));function respondWithStatusCode(_0x1c245f,_0x286170){_0x286170=_0x286170||0xcc;return function(_0x4f58d1){if(_0x4f58d1){return _0x1c245f[_0xbef1('0x1c')](_0x286170);}return _0x1c245f['status'](_0x286170)[_0xbef1('0x1d')]();};}function respondWithResult(_0x4bab05,_0x8a6510){_0x8a6510=_0x8a6510||0xc8;return function(_0x29d199){if(_0x29d199){return _0x4bab05[_0xbef1('0x1e')](_0x8a6510)[_0xbef1('0x1f')](_0x29d199);}};}function respondWithFilteredResult(_0x13776e,_0x5ca8c4){return function(_0x315290){if(_0x315290){var _0x4e44db=typeof _0x5ca8c4['offset']==='undefined'&&typeof _0x5ca8c4[_0xbef1('0x20')]===_0xbef1('0x21');var _0x147cbc=_0x315290['count'];var _0x42c47f=_0x4e44db?0x0:_0x5ca8c4[_0xbef1('0x22')];var _0x41b63e=_0x4e44db?_0x315290[_0xbef1('0x23')]:_0x5ca8c4['offset']+_0x5ca8c4['limit'];var _0x7ad96a;if(_0x41b63e>=_0x147cbc){_0x41b63e=_0x147cbc;_0x7ad96a=0xc8;}else{_0x7ad96a=0xce;}_0x13776e['status'](_0x7ad96a);return _0x13776e[_0xbef1('0x24')](_0xbef1('0x25'),_0x42c47f+'-'+_0x41b63e+'/'+_0x147cbc)[_0xbef1('0x1f')](_0x315290);}return null;};}function patchUpdates(_0x52fc5e){return function(_0x50b4eb){try{jsonpatch[_0xbef1('0x26')](_0x50b4eb,_0x52fc5e,!![]);}catch(_0x1f4d3b){return BPromise['reject'](_0x1f4d3b);}return _0x50b4eb['save']();};}function saveUpdates(_0x51a17c,_0x3b7e72){return function(_0x2320fe){if(_0x2320fe){return _0x2320fe[_0xbef1('0x27')](_0x51a17c)[_0xbef1('0x28')](function(_0x383a29){return _0x383a29;});}return null;};}function removeEntity(_0x902413,_0x498831){return function(_0x18b78b){if(_0x18b78b){return _0x18b78b[_0xbef1('0x29')]()[_0xbef1('0x28')](function(){_0x902413[_0xbef1('0x1e')](0xcc)[_0xbef1('0x1d')]();});}};}function handleEntityNotFound(_0x11977b,_0x330394){return function(_0x3558b8){if(!_0x3558b8){_0x11977b[_0xbef1('0x1c')](0x194);}return _0x3558b8;};}function handleError(_0x4d379e,_0x145338){_0x145338=_0x145338||0x1f4;return function(_0x21df2b){logger[_0xbef1('0x2a')](_0x21df2b[_0xbef1('0x2b')]);if(_0x21df2b[_0xbef1('0x2c')]){delete _0x21df2b[_0xbef1('0x2c')];}_0x4d379e[_0xbef1('0x1e')](_0x145338)[_0xbef1('0x2d')](_0x21df2b);};}exports['index']=function(_0x360c29,_0x445c9c){var _0x5995ea={},_0x3500f6={},_0x4d9d8c={'count':0x0,'rows':[]};var _0xd1e0eb=_[_0xbef1('0x2e')](db[_0xbef1('0x2f')][_0xbef1('0x30')],function(_0x105815){return{'name':_0x105815[_0xbef1('0x31')],'type':_0x105815[_0xbef1('0x32')][_0xbef1('0x33')]};});_0x3500f6[_0xbef1('0x34')]=_['map'](_0xd1e0eb,_0xbef1('0x2c'));_0x3500f6[_0xbef1('0x35')]=_['keys'](_0x360c29[_0xbef1('0x35')]);_0x3500f6['filters']=_['intersection'](_0x3500f6[_0xbef1('0x34')],_0x3500f6[_0xbef1('0x35')]);_0x5995ea[_0xbef1('0x36')]=_[_0xbef1('0x37')](_0x3500f6[_0xbef1('0x34')],qs[_0xbef1('0x38')](_0x360c29[_0xbef1('0x35')][_0xbef1('0x38')]));_0x5995ea[_0xbef1('0x36')]=_0x5995ea[_0xbef1('0x36')][_0xbef1('0x39')]?_0x5995ea['attributes']:_0x3500f6[_0xbef1('0x34')];if(!_0x360c29[_0xbef1('0x35')][_0xbef1('0x3a')](_0xbef1('0x3b'))){_0x5995ea[_0xbef1('0x20')]=qs[_0xbef1('0x20')](_0x360c29['query'][_0xbef1('0x20')]);_0x5995ea[_0xbef1('0x22')]=qs[_0xbef1('0x22')](_0x360c29[_0xbef1('0x35')]['offset']);}_0x5995ea['order']=qs['sort'](_0x360c29[_0xbef1('0x35')]['sort']);_0x5995ea['where']=qs[_0xbef1('0x3c')](_[_0xbef1('0x3d')](_0x360c29[_0xbef1('0x35')],_0x3500f6[_0xbef1('0x3c')]),_0xd1e0eb);if(_0x360c29[_0xbef1('0x35')]['filter']){_0x5995ea['where']=_[_0xbef1('0x3e')](_0x5995ea[_0xbef1('0x3f')],{'$or':_['map'](_0xd1e0eb,function(_0x1407a3){if(_0x1407a3[_0xbef1('0x32')]!==_0xbef1('0x40')){var _0x4f24eb={};_0x4f24eb[_0x1407a3[_0xbef1('0x2c')]]={'$like':'%'+_0x360c29[_0xbef1('0x35')][_0xbef1('0x41')]+'%'};return _0x4f24eb;}})});}_0x5995ea=_[_0xbef1('0x3e')]({},_0x5995ea,_0x360c29[_0xbef1('0x42')]);var _0x15cb2d={'where':_0x5995ea[_0xbef1('0x3f')]};return db['FreshsalesAccount'][_0xbef1('0x23')](_0x15cb2d)[_0xbef1('0x28')](function(_0xbcf64e){_0x4d9d8c[_0xbef1('0x23')]=_0xbcf64e;if(_0x360c29[_0xbef1('0x35')][_0xbef1('0x43')]){_0x5995ea[_0xbef1('0x44')]=[{'all':!![]}];}return db[_0xbef1('0x2f')][_0xbef1('0x45')](_0x5995ea);})[_0xbef1('0x28')](function(_0x23fb0c){_0x4d9d8c[_0xbef1('0x46')]=_0x23fb0c;return _0x4d9d8c;})['then'](respondWithFilteredResult(_0x445c9c,_0x5995ea))[_0xbef1('0x47')](handleError(_0x445c9c,null));};exports[_0xbef1('0x48')]=function(_0x223989,_0x556e2a){var _0xcbf69c={'raw':![],'where':{'id':_0x223989[_0xbef1('0x49')]['id']}},_0x3ba59c={};_0x3ba59c[_0xbef1('0x34')]=_[_0xbef1('0x4a')](db[_0xbef1('0x2f')]['rawAttributes']);_0x3ba59c['query']=_[_0xbef1('0x4a')](_0x223989['query']);_0x3ba59c[_0xbef1('0x3c')]=_[_0xbef1('0x37')](_0x3ba59c[_0xbef1('0x34')],_0x3ba59c[_0xbef1('0x35')]);_0xcbf69c[_0xbef1('0x36')]=_[_0xbef1('0x37')](_0x3ba59c['model'],qs[_0xbef1('0x38')](_0x223989['query']['fields']));_0xcbf69c[_0xbef1('0x36')]=_0xcbf69c[_0xbef1('0x36')]['length']?_0xcbf69c[_0xbef1('0x36')]:_0x3ba59c[_0xbef1('0x34')];if(_0x223989['query'][_0xbef1('0x43')]){_0xcbf69c['include']=[{'all':!![]}];}_0xcbf69c=_[_0xbef1('0x3e')]({},_0xcbf69c,_0x223989[_0xbef1('0x42')]);return db[_0xbef1('0x2f')][_0xbef1('0x4b')](_0xcbf69c)[_0xbef1('0x28')](handleEntityNotFound(_0x556e2a,null))[_0xbef1('0x28')](respondWithResult(_0x556e2a,null))[_0xbef1('0x47')](handleError(_0x556e2a,null));};exports[_0xbef1('0x4c')]=function(_0x302fe1,_0x2fbbd2){return db[_0xbef1('0x2f')][_0xbef1('0x4c')](_0x302fe1['body'],{})[_0xbef1('0x28')](respondWithResult(_0x2fbbd2,0xc9))['catch'](handleError(_0x2fbbd2,null));};exports[_0xbef1('0x27')]=function(_0x1a5440,_0xf3fd21){if(_0x1a5440[_0xbef1('0x4d')]['id']){delete _0x1a5440[_0xbef1('0x4d')]['id'];}return db[_0xbef1('0x2f')][_0xbef1('0x4b')]({'where':{'id':_0x1a5440['params']['id']}})['then'](handleEntityNotFound(_0xf3fd21,null))[_0xbef1('0x28')](saveUpdates(_0x1a5440['body'],null))[_0xbef1('0x28')](respondWithResult(_0xf3fd21,null))[_0xbef1('0x47')](handleError(_0xf3fd21,null));};exports[_0xbef1('0x29')]=function(_0x1ca0e2,_0x14f044){return db[_0xbef1('0x2f')][_0xbef1('0x4b')]({'where':{'id':_0x1ca0e2[_0xbef1('0x49')]['id']}})[_0xbef1('0x28')](handleEntityNotFound(_0x14f044,null))[_0xbef1('0x28')](removeEntity(_0x14f044,null))[_0xbef1('0x47')](handleError(_0x14f044,null));};exports[_0xbef1('0x4e')]=function(_0x170a47,_0x36a3b8,_0x407df1){var _0x4bb73b={};var _0x1588d5={};var _0x4aa0b9;var _0x3d8879;return db[_0xbef1('0x2f')][_0xbef1('0x4f')]({'where':{'id':_0x170a47[_0xbef1('0x49')]['id']}})[_0xbef1('0x28')](handleEntityNotFound(_0x36a3b8,null))[_0xbef1('0x28')](function(_0x33c20b){if(_0x33c20b){_0x4aa0b9=_0x33c20b;_0x1588d5[_0xbef1('0x34')]=_[_0xbef1('0x4a')](db[_0xbef1('0x50')][_0xbef1('0x30')]);_0x1588d5['query']=_[_0xbef1('0x4a')](_0x170a47[_0xbef1('0x35')]);_0x1588d5['filters']=_[_0xbef1('0x37')](_0x1588d5[_0xbef1('0x34')],_0x1588d5[_0xbef1('0x35')]);_0x4bb73b[_0xbef1('0x36')]=_[_0xbef1('0x37')](_0x1588d5[_0xbef1('0x34')],qs[_0xbef1('0x38')](_0x170a47['query'][_0xbef1('0x38')]));_0x4bb73b[_0xbef1('0x36')]=_0x4bb73b[_0xbef1('0x36')]['length']?_0x4bb73b[_0xbef1('0x36')]:_0x1588d5[_0xbef1('0x34')];_0x4bb73b['order']=qs[_0xbef1('0x51')](_0x170a47[_0xbef1('0x35')][_0xbef1('0x51')]);_0x4bb73b[_0xbef1('0x3f')]=qs[_0xbef1('0x3c')](_[_0xbef1('0x3d')](_0x170a47[_0xbef1('0x35')],_0x1588d5[_0xbef1('0x3c')]));if(_0x170a47[_0xbef1('0x35')][_0xbef1('0x41')]){_0x4bb73b[_0xbef1('0x3f')]=_['merge'](_0x4bb73b[_0xbef1('0x3f')],{'$or':_[_0xbef1('0x2e')](_0x4bb73b['attributes'],function(_0xec4c9){var _0xb07bb0={};_0xb07bb0[_0xec4c9]={'$like':'%'+_0x170a47['query'][_0xbef1('0x41')]+'%'};return _0xb07bb0;})});}_0x4bb73b=_[_0xbef1('0x3e')]({},_0x4bb73b,_0x170a47['options']);return _0x4aa0b9[_0xbef1('0x4e')](_0x4bb73b);}})[_0xbef1('0x28')](function(_0x579dd2){if(_0x579dd2){_0x3d8879=_0x579dd2[_0xbef1('0x39')];if(!_0x170a47[_0xbef1('0x35')][_0xbef1('0x3a')]('nolimit')){_0x4bb73b['limit']=qs['limit'](_0x170a47[_0xbef1('0x35')][_0xbef1('0x20')]);_0x4bb73b['offset']=qs[_0xbef1('0x22')](_0x170a47[_0xbef1('0x35')][_0xbef1('0x22')]);}return _0x4aa0b9[_0xbef1('0x4e')](_0x4bb73b);}})[_0xbef1('0x28')](function(_0x2a7e92){if(_0x2a7e92){return _0x2a7e92?{'count':_0x3d8879,'rows':_0x2a7e92}:null;}})['then'](respondWithResult(_0x36a3b8,null))[_0xbef1('0x47')](handleError(_0x36a3b8,null));};exports[_0xbef1('0x52')]=function(_0x3417c4,_0x46c0bd,_0xeef973){if(_0x3417c4[_0xbef1('0x4d')]['id']){delete _0x3417c4[_0xbef1('0x4d')]['id'];}return db[_0xbef1('0x2f')][_0xbef1('0x4f')]({'where':{'id':_0x3417c4[_0xbef1('0x49')]['id']}})[_0xbef1('0x28')](handleEntityNotFound(_0x46c0bd,null))[_0xbef1('0x28')](function(_0x2889cd){if(_0x2889cd){_0x3417c4[_0xbef1('0x4d')]['AccountId']=_0x2889cd['id'];_0x3417c4[_0xbef1('0x4d')][_0xbef1('0x53')]=integrations[_0xbef1('0x54')](_0x3417c4['body']['channel'],_0x3417c4[_0xbef1('0x4d')][_0xbef1('0x32')]);_0x3417c4[_0xbef1('0x4d')][_0xbef1('0x55')]=integrations[_0xbef1('0x56')](_0x3417c4['body'][_0xbef1('0x57')],_0x3417c4[_0xbef1('0x4d')][_0xbef1('0x32')]);return db[_0xbef1('0x50')][_0xbef1('0x4c')](_0x3417c4[_0xbef1('0x4d')],{'include':[{'model':db[_0xbef1('0x58')],'as':_0xbef1('0x53')},{'model':db[_0xbef1('0x58')],'as':'Descriptions'}]});}return null;})[_0xbef1('0x28')](respondWithResult(_0x46c0bd,null))[_0xbef1('0x47')](handleError(_0x46c0bd,null));};exports[_0xbef1('0x59')]=function(_0x170a4d,_0xec42f8,_0x5d330b){var _0x3f7a7a='';var _0x92fd51='';return db[_0xbef1('0x2f')][_0xbef1('0x4f')]({'where':{'id':_0x170a4d[_0xbef1('0x49')]['id']},'attributes':['id','username','remoteUri','apiKey']})[_0xbef1('0x28')](handleEntityNotFound(_0xec42f8,null))[_0xbef1('0x28')](function(_0x51d9d5){if(_0x51d9d5){_0x92fd51=_0x51d9d5[_0xbef1('0x5a')];_0x3f7a7a=_0x51d9d5[_0xbef1('0x5b')];var _0x42fad9=_0x51d9d5[_0xbef1('0x5b')][_0xbef1('0x5c')](-0x1);if(_0x42fad9==='/'){_0x3f7a7a=_0x3f7a7a[_0xbef1('0x5d')](0x0,_0x3f7a7a[_0xbef1('0x5e')](_0x42fad9));}return rp({'method':'GET','uri':util[_0xbef1('0x5f')](_0xbef1('0x60'),_0x3f7a7a,_0xbef1('0x61')),'headers':{'Authorization':'Token\x20token='+_0x51d9d5[_0xbef1('0x62')]},'json':!![]});}})['then'](function(_0x4ba7cb){if(_0x4ba7cb){var _0x3b10ab=_0x4ba7cb[_0xbef1('0x63')];var _0x599634=![];var _0x1442e6=null;for(_0x1442e6=0x0;_0x1442e6<_0x3b10ab[_0xbef1('0x39')];_0x1442e6++){if(_0x3b10ab[_0x1442e6]['email']===_0x92fd51){_0x599634=!![];}}if(_0x599634){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xbef1('0x64')});}}})['then'](respondWithResult(_0xec42f8,null))[_0xbef1('0x47')](function(_0x4abcae){var _0x53a4df=_0x170a4d[_0xbef1('0x35')][_0xbef1('0x65')]?0x1f4:_0x4abcae[_0xbef1('0x66')]||0x1f4;logger[_0xbef1('0x2a')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x53a4df,JSON[_0xbef1('0x67')](_0x4abcae));delete _0x4abcae['name'];if(_0x53a4df===0x191){_0x53a4df=0x190;}_0xec42f8[_0xbef1('0x1e')](_0x53a4df)[_0xbef1('0x2d')](_0x170a4d['query'][_0xbef1('0x65')]?{'message':_0xbef1('0x68'),'statusCode':_0x4abcae[_0xbef1('0x66')]}:_0x4abcae);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index b14de17..58bc944 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 _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 +var _0x4991=['lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','define','FreshsalesAccount','int_freshsales_accounts'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4991,0xf7));var _0x1499=function(_0x53fa4e,_0x4ce870){_0x53fa4e=_0x53fa4e-0x0;var _0x118705=_0x4991[_0x53fa4e];return _0x118705;};'use strict';var _=require(_0x1499('0x0'));var util=require('util');var logger=require(_0x1499('0x1'))('api');var moment=require(_0x1499('0x2'));var BPromise=require(_0x1499('0x3'));var rp=require(_0x1499('0x4'));var fs=require('fs');var path=require(_0x1499('0x5'));var rimraf=require(_0x1499('0x6'));var config=require(_0x1499('0x7'));var attributes=require(_0x1499('0x8'));var integrations=require(_0x1499('0x9'));module['exports']=function(_0x2a8e96,_0x1c3bd7){return _0x2a8e96[_0x1499('0xa')](_0x1499('0xb'),attributes,{'tableName':_0x1499('0xc'),'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 c2a9dbc..8a625eb 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 _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 +var _0x4888=['FreshsalesAccount','findAll','options','raw','where','attributes','limit','map','include','model','catch','ShowFreshsalesAccount','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetFreshsalesAccount'];(function(_0x2fd95a,_0x5d9dc8){var _0x18b6f6=function(_0x149ba6){while(--_0x149ba6){_0x2fd95a['push'](_0x2fd95a['shift']());}};_0x18b6f6(++_0x5d9dc8);}(_0x4888,0x198));var _0x8488=function(_0x501035,_0x3c1742){_0x501035=_0x501035-0x0;var _0x4dd166=_0x4888[_0x501035];return _0x4dd166;};'use strict';var _=require('lodash');var util=require(_0x8488('0x0'));var moment=require(_0x8488('0x1'));var BPromise=require(_0x8488('0x2'));var rs=require(_0x8488('0x3'));var fs=require('fs');var Redis=require(_0x8488('0x4'));var db=require(_0x8488('0x5'))['db'];var utils=require(_0x8488('0x6'));var logger=require('../../config/logger')(_0x8488('0x7'));var config=require(_0x8488('0x8'));var jayson=require(_0x8488('0x9'));var client=jayson[_0x8488('0xa')][_0x8488('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x19e508,_0x5250a1,_0x5b30a7){return new BPromise(function(_0x56aad0,_0x568a82){return client[_0x8488('0xc')](_0x19e508,_0x5b30a7)[_0x8488('0xd')](function(_0x542bd8){logger[_0x8488('0xe')](_0x8488('0xf'),_0x5250a1,_0x8488('0x10'));logger[_0x8488('0x11')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x5250a1,_0x8488('0x10'),JSON[_0x8488('0x12')](_0x542bd8));if(_0x542bd8[_0x8488('0x13')]){if(_0x542bd8[_0x8488('0x13')][_0x8488('0x14')]===0x1f4){logger['error'](_0x8488('0xf'),_0x5250a1,_0x542bd8[_0x8488('0x13')]['message']);return _0x568a82(_0x542bd8['error'][_0x8488('0x15')]);}logger['error'](_0x8488('0xf'),_0x5250a1,_0x542bd8['error']['message']);return _0x56aad0(_0x542bd8[_0x8488('0x13')][_0x8488('0x15')]);}else{logger[_0x8488('0xe')](_0x8488('0xf'),_0x5250a1,_0x8488('0x10'));_0x56aad0(_0x542bd8[_0x8488('0x16')][_0x8488('0x15')]);}})['catch'](function(_0x3dad45){logger[_0x8488('0x13')](_0x8488('0xf'),_0x5250a1,_0x3dad45);_0x568a82(_0x3dad45);});});}exports[_0x8488('0x17')]=function(_0x60ae2f){var _0x39775f=this;return new Promise(function(_0x1aedb1,_0x27c62a){return db[_0x8488('0x18')][_0x8488('0x19')]({'raw':_0x60ae2f[_0x8488('0x1a')]?_0x60ae2f[_0x8488('0x1a')][_0x8488('0x1b')]===undefined?!![]:![]:!![],'where':_0x60ae2f['options']?_0x60ae2f['options'][_0x8488('0x1c')]||null:null,'attributes':_0x60ae2f[_0x8488('0x1a')]?_0x60ae2f[_0x8488('0x1a')][_0x8488('0x1d')]||null:null,'limit':_0x60ae2f[_0x8488('0x1a')]?_0x60ae2f[_0x8488('0x1a')][_0x8488('0x1e')]||null:null,'include':_0x60ae2f[_0x8488('0x1a')]?_0x60ae2f[_0x8488('0x1a')]['include']?_[_0x8488('0x1f')](_0x60ae2f[_0x8488('0x1a')][_0x8488('0x20')],function(_0x1361a6){return{'model':db[_0x1361a6[_0x8488('0x21')]],'as':_0x1361a6['as'],'attributes':_0x1361a6['attributes'],'include':_0x1361a6['include']?_['map'](_0x1361a6['include'],function(_0x472624){return{'model':db[_0x472624['model']],'as':_0x472624['as'],'attributes':_0x472624['attributes'],'include':_0x472624[_0x8488('0x20')]?_[_0x8488('0x1f')](_0x472624[_0x8488('0x20')],function(_0x6ebee0){return{'model':db[_0x6ebee0[_0x8488('0x21')]],'as':_0x6ebee0['as'],'attributes':_0x6ebee0['attributes']};}):[]};}):[]};}):[]:[]})[_0x8488('0xd')](function(_0x38c137){logger[_0x8488('0xe')](_0x8488('0x17'),_0x60ae2f);logger[_0x8488('0x11')](_0x8488('0x17'),_0x60ae2f,JSON[_0x8488('0x12')](_0x38c137));_0x1aedb1(_0x38c137);})[_0x8488('0x22')](function(_0x368f9c){logger[_0x8488('0x13')](_0x8488('0x17'),_0x368f9c['message'],_0x60ae2f);_0x27c62a(_0x39775f['error'](0x1f4,_0x368f9c['message']));});});};exports[_0x8488('0x23')]=function(_0x408c36){var _0x19cf42=this;return new Promise(function(_0x121dcc,_0x117321){return db[_0x8488('0x18')]['find']({'raw':_0x408c36[_0x8488('0x1a')]?_0x408c36[_0x8488('0x1a')][_0x8488('0x1b')]===undefined?!![]:![]:!![],'where':_0x408c36[_0x8488('0x1a')]?_0x408c36[_0x8488('0x1a')]['where']||null:null,'attributes':_0x408c36[_0x8488('0x1a')]?_0x408c36[_0x8488('0x1a')]['attributes']||null:null,'include':_0x408c36[_0x8488('0x1a')]?_0x408c36[_0x8488('0x1a')][_0x8488('0x20')]?_[_0x8488('0x1f')](_0x408c36[_0x8488('0x1a')]['include'],function(_0x44c8f3){return{'model':db[_0x44c8f3[_0x8488('0x21')]],'as':_0x44c8f3['as'],'attributes':_0x44c8f3[_0x8488('0x1d')],'include':_0x44c8f3['include']?_[_0x8488('0x1f')](_0x44c8f3['include'],function(_0x205ccc){return{'model':db[_0x205ccc[_0x8488('0x21')]],'as':_0x205ccc['as'],'attributes':_0x205ccc[_0x8488('0x1d')],'include':_0x205ccc[_0x8488('0x20')]?_['map'](_0x205ccc[_0x8488('0x20')],function(_0xe71bd9){return{'model':db[_0xe71bd9[_0x8488('0x21')]],'as':_0xe71bd9['as'],'attributes':_0xe71bd9['attributes']};}):[]};}):[]};}):[]:[]})[_0x8488('0xd')](function(_0x17bfea){logger[_0x8488('0xe')](_0x8488('0x23'),_0x408c36);logger[_0x8488('0x11')](_0x8488('0x23'),_0x408c36,JSON[_0x8488('0x12')](_0x17bfea));_0x121dcc(_0x17bfea);})[_0x8488('0x22')](function(_0x1a8235){logger[_0x8488('0x13')](_0x8488('0x23'),_0x1a8235['message'],_0x408c36);_0x117321(_0x19cf42['error'](0x1f4,_0x1a8235[_0x8488('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 6dee340..dd3900a 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 _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 +var _0x4f73=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','/:id','/:id/subjects','getSubjects','/:id/fields','getFields','post','update','delete','destroy','multer','util','path'];(function(_0x2c146b,_0x39eee8){var _0x5e808c=function(_0x5a702d){while(--_0x5a702d){_0x2c146b['push'](_0x2c146b['shift']());}};_0x5e808c(++_0x39eee8);}(_0x4f73,0x14d));var _0x34f7=function(_0x1ca4cc,_0x402c23){_0x1ca4cc=_0x1ca4cc-0x0;var _0x108010=_0x4f73[_0x1ca4cc];return _0x108010;};'use strict';var multer=require(_0x34f7('0x0'));var util=require(_0x34f7('0x1'));var path=require(_0x34f7('0x2'));var timeout=require(_0x34f7('0x3'));var express=require(_0x34f7('0x4'));var router=express['Router']();var fs_extra=require(_0x34f7('0x5'));var auth=require(_0x34f7('0x6'));var interaction=require(_0x34f7('0x7'));var config=require(_0x34f7('0x8'));var controller=require(_0x34f7('0x9'));router[_0x34f7('0xa')]('/',auth[_0x34f7('0xb')](),controller['index']);router['get'](_0x34f7('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x34f7('0xa')](_0x34f7('0xd'),auth['isAuthenticated'](),controller[_0x34f7('0xe')]);router[_0x34f7('0xa')]('/:id/descriptions',auth[_0x34f7('0xb')](),controller['getDescriptions']);router[_0x34f7('0xa')](_0x34f7('0xf'),auth[_0x34f7('0xb')](),controller[_0x34f7('0x10')]);router[_0x34f7('0x11')]('/',auth[_0x34f7('0xb')](),controller['create']);router['put'](_0x34f7('0xc'),auth[_0x34f7('0xb')](),controller[_0x34f7('0x12')]);router[_0x34f7('0x13')](_0x34f7('0xc'),auth[_0x34f7('0xb')](),controller[_0x34f7('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 99a0792..a699403 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 _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 +var _0xaa15=['STRING','exports'];(function(_0x4a5d6c,_0x2c74d4){var _0xc78eb8=function(_0x5260f1){while(--_0x5260f1){_0x4a5d6c['push'](_0x4a5d6c['shift']());}};_0xc78eb8(++_0x2c74d4);}(_0xaa15,0xd3));var _0x5aa1=function(_0x1ba201,_0x2138fd){_0x1ba201=_0x1ba201-0x0;var _0x30b611=_0xaa15[_0x1ba201];return _0x30b611;};'use strict';var Sequelize=require('sequelize');module[_0x5aa1('0x0')]={'name':{'type':Sequelize[_0x5aa1('0x1')]},'description':{'type':Sequelize[_0x5aa1('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 287d521..39600e4 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 _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 +var _0xcef5=['undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','sendStatus','name','send','index','FreshsalesConfiguration','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','update','findOne','FreshsalesField','filter','getSubjects','getDescriptions','getFields','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','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'];(function(_0x5c8827,_0x5bc5d7){var _0x50ffd5=function(_0x4121bc){while(--_0x4121bc){_0x5c8827['push'](_0x5c8827['shift']());}};_0x50ffd5(++_0x5bc5d7);}(_0xcef5,0x86));var _0x5cef=function(_0x47f5c7,_0xf9ba7f){_0x47f5c7=_0x47f5c7-0x0;var _0x4eaec6=_0xcef5[_0x47f5c7];return _0x4eaec6;};'use strict';var emlformat=require(_0x5cef('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5cef('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5cef('0x2'));var moment=require('moment');var BPromise=require(_0x5cef('0x3'));var Mustache=require(_0x5cef('0x4'));var util=require(_0x5cef('0x5'));var path=require(_0x5cef('0x6'));var sox=require(_0x5cef('0x7'));var csv=require(_0x5cef('0x8'));var ejs=require(_0x5cef('0x9'));var fs=require('fs');var fs_extra=require(_0x5cef('0xa'));var _=require(_0x5cef('0xb'));var squel=require(_0x5cef('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5cef('0x8'));var querystring=require(_0x5cef('0xd'));var Papa=require(_0x5cef('0xe'));var Redis=require(_0x5cef('0xf'));var authService=require(_0x5cef('0x10'));var qs=require(_0x5cef('0x11'));var as=require(_0x5cef('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5cef('0x13'))(_0x5cef('0x14'));var utils=require(_0x5cef('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x5cef('0x16'));var db=require(_0x5cef('0x17'))['db'];function respondWithStatusCode(_0x3b9324,_0x22e4f2){_0x22e4f2=_0x22e4f2||0xcc;return function(_0x1f606a){if(_0x1f606a){return _0x3b9324['sendStatus'](_0x22e4f2);}return _0x3b9324[_0x5cef('0x18')](_0x22e4f2)[_0x5cef('0x19')]();};}function respondWithResult(_0x3da636,_0x3f24f8){_0x3f24f8=_0x3f24f8||0xc8;return function(_0x528074){if(_0x528074){return _0x3da636[_0x5cef('0x18')](_0x3f24f8)[_0x5cef('0x1a')](_0x528074);}};}function respondWithFilteredResult(_0x49d93c,_0x49d5d7){return function(_0x2810bf){if(_0x2810bf){var _0xf34564=typeof _0x49d5d7[_0x5cef('0x1b')]===_0x5cef('0x1c')&&typeof _0x49d5d7['limit']===_0x5cef('0x1c');var _0x435d37=_0x2810bf['count'];var _0xb2e3af=_0xf34564?0x0:_0x49d5d7[_0x5cef('0x1b')];var _0x2b3a54=_0xf34564?_0x2810bf[_0x5cef('0x1d')]:_0x49d5d7['offset']+_0x49d5d7[_0x5cef('0x1e')];var _0x13c3e2;if(_0x2b3a54>=_0x435d37){_0x2b3a54=_0x435d37;_0x13c3e2=0xc8;}else{_0x13c3e2=0xce;}_0x49d93c['status'](_0x13c3e2);return _0x49d93c[_0x5cef('0x1f')](_0x5cef('0x20'),_0xb2e3af+'-'+_0x2b3a54+'/'+_0x435d37)[_0x5cef('0x1a')](_0x2810bf);}return null;};}function patchUpdates(_0x4ee0a4){return function(_0x479b70){try{jsonpatch[_0x5cef('0x21')](_0x479b70,_0x4ee0a4,!![]);}catch(_0x4882c2){return BPromise[_0x5cef('0x22')](_0x4882c2);}return _0x479b70[_0x5cef('0x23')]();};}function saveUpdates(_0x3b6b4c,_0x2c599d){return function(_0x43a11b){if(_0x43a11b){return _0x43a11b['update'](_0x3b6b4c)[_0x5cef('0x24')](function(_0x2d5e02){return _0x2d5e02;});}return null;};}function removeEntity(_0x5763ae,_0x1a9551){return function(_0x14c1bd){if(_0x14c1bd){return _0x14c1bd[_0x5cef('0x25')]()[_0x5cef('0x24')](function(){_0x5763ae[_0x5cef('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9a5cea,_0x11a09c){return function(_0x209c9f){if(!_0x209c9f){_0x9a5cea[_0x5cef('0x26')](0x194);}return _0x209c9f;};}function handleError(_0x4f3f93,_0x4b729e){_0x4b729e=_0x4b729e||0x1f4;return function(_0x2208ee){logger['error'](_0x2208ee['stack']);if(_0x2208ee['name']){delete _0x2208ee[_0x5cef('0x27')];}_0x4f3f93['status'](_0x4b729e)[_0x5cef('0x28')](_0x2208ee);};}exports[_0x5cef('0x29')]=function(_0x54801b,_0x2d3ecd){var _0x2c7428={},_0x236a2c={},_0x281eab={'count':0x0,'rows':[]};var _0xd52ae5=_['map'](db[_0x5cef('0x2a')][_0x5cef('0x2b')],function(_0x53e574){return{'name':_0x53e574[_0x5cef('0x2c')],'type':_0x53e574[_0x5cef('0x2d')][_0x5cef('0x2e')]};});_0x236a2c[_0x5cef('0x2f')]=_[_0x5cef('0x30')](_0xd52ae5,'name');_0x236a2c['query']=_[_0x5cef('0x31')](_0x54801b[_0x5cef('0x32')]);_0x236a2c[_0x5cef('0x33')]=_[_0x5cef('0x34')](_0x236a2c[_0x5cef('0x2f')],_0x236a2c[_0x5cef('0x32')]);_0x2c7428[_0x5cef('0x35')]=_[_0x5cef('0x34')](_0x236a2c[_0x5cef('0x2f')],qs[_0x5cef('0x36')](_0x54801b[_0x5cef('0x32')][_0x5cef('0x36')]));_0x2c7428[_0x5cef('0x35')]=_0x2c7428[_0x5cef('0x35')][_0x5cef('0x37')]?_0x2c7428[_0x5cef('0x35')]:_0x236a2c[_0x5cef('0x2f')];if(!_0x54801b[_0x5cef('0x32')][_0x5cef('0x38')](_0x5cef('0x39'))){_0x2c7428['limit']=qs[_0x5cef('0x1e')](_0x54801b[_0x5cef('0x32')]['limit']);_0x2c7428[_0x5cef('0x1b')]=qs[_0x5cef('0x1b')](_0x54801b[_0x5cef('0x32')][_0x5cef('0x1b')]);}_0x2c7428[_0x5cef('0x3a')]=qs[_0x5cef('0x3b')](_0x54801b['query']['sort']);_0x2c7428[_0x5cef('0x3c')]=qs[_0x5cef('0x33')](_[_0x5cef('0x3d')](_0x54801b[_0x5cef('0x32')],_0x236a2c['filters']),_0xd52ae5);if(_0x54801b[_0x5cef('0x32')]['filter']){_0x2c7428[_0x5cef('0x3c')]=_[_0x5cef('0x3e')](_0x2c7428[_0x5cef('0x3c')],{'$or':_[_0x5cef('0x30')](_0xd52ae5,function(_0xf57eb3){if(_0xf57eb3[_0x5cef('0x2d')]!==_0x5cef('0x3f')){var _0x411088={};_0x411088[_0xf57eb3[_0x5cef('0x27')]]={'$like':'%'+_0x54801b['query']['filter']+'%'};return _0x411088;}})});}_0x2c7428=_[_0x5cef('0x3e')]({},_0x2c7428,_0x54801b[_0x5cef('0x40')]);var _0x2ac86a={'where':_0x2c7428[_0x5cef('0x3c')]};return db[_0x5cef('0x2a')][_0x5cef('0x1d')](_0x2ac86a)['then'](function(_0x41f36e){_0x281eab[_0x5cef('0x1d')]=_0x41f36e;if(_0x54801b[_0x5cef('0x32')][_0x5cef('0x41')]){_0x2c7428[_0x5cef('0x42')]=[{'all':!![]}];}return db[_0x5cef('0x2a')][_0x5cef('0x43')](_0x2c7428);})[_0x5cef('0x24')](function(_0x2947ee){_0x281eab[_0x5cef('0x44')]=_0x2947ee;return _0x281eab;})[_0x5cef('0x24')](respondWithFilteredResult(_0x2d3ecd,_0x2c7428))[_0x5cef('0x45')](handleError(_0x2d3ecd,null));};exports['show']=function(_0x5a69ce,_0x42c4bf){var _0x1c8635={'raw':![],'where':{'id':_0x5a69ce[_0x5cef('0x46')]['id']}},_0x37a17a={};_0x37a17a['model']=_['keys'](db[_0x5cef('0x2a')][_0x5cef('0x2b')]);_0x37a17a['query']=_[_0x5cef('0x31')](_0x5a69ce['query']);_0x37a17a[_0x5cef('0x33')]=_[_0x5cef('0x34')](_0x37a17a[_0x5cef('0x2f')],_0x37a17a[_0x5cef('0x32')]);_0x1c8635[_0x5cef('0x35')]=_['intersection'](_0x37a17a['model'],qs[_0x5cef('0x36')](_0x5a69ce[_0x5cef('0x32')][_0x5cef('0x36')]));_0x1c8635[_0x5cef('0x35')]=_0x1c8635[_0x5cef('0x35')]['length']?_0x1c8635[_0x5cef('0x35')]:_0x37a17a['model'];if(_0x5a69ce[_0x5cef('0x32')][_0x5cef('0x41')]){_0x1c8635[_0x5cef('0x42')]=[{'all':!![]}];}_0x1c8635=_[_0x5cef('0x3e')]({},_0x1c8635,_0x5a69ce[_0x5cef('0x40')]);return db['FreshsalesConfiguration'][_0x5cef('0x47')](_0x1c8635)[_0x5cef('0x24')](handleEntityNotFound(_0x42c4bf,null))[_0x5cef('0x24')](respondWithResult(_0x42c4bf,null))[_0x5cef('0x45')](handleError(_0x42c4bf,null));};exports[_0x5cef('0x48')]=function(_0x2b1024,_0x15e964){return db[_0x5cef('0x2a')][_0x5cef('0x48')](_0x2b1024[_0x5cef('0x49')],{})['then'](respondWithResult(_0x15e964,0xc9))[_0x5cef('0x45')](handleError(_0x15e964,null));};exports[_0x5cef('0x4a')]=function(_0x4717b9,_0x5a102e){if(_0x4717b9['body']['id']){delete _0x4717b9[_0x5cef('0x49')]['id'];}return db[_0x5cef('0x2a')][_0x5cef('0x47')]({'where':{'id':_0x4717b9[_0x5cef('0x46')]['id']}})['then'](handleEntityNotFound(_0x5a102e,null))[_0x5cef('0x24')](saveUpdates(_0x4717b9[_0x5cef('0x49')],null))['then'](respondWithResult(_0x5a102e,null))[_0x5cef('0x45')](handleError(_0x5a102e,null));};exports[_0x5cef('0x25')]=function(_0x558c1b,_0x389752){return db[_0x5cef('0x2a')][_0x5cef('0x47')]({'where':{'id':_0x558c1b[_0x5cef('0x46')]['id']}})[_0x5cef('0x24')](handleEntityNotFound(_0x389752,null))[_0x5cef('0x24')](removeEntity(_0x389752,null))[_0x5cef('0x45')](handleError(_0x389752,null));};exports['getSubjects']=function(_0x23ac44,_0x49db35,_0x696ec8){var _0x1381a1={};var _0x3d1155={};var _0x3b2dc2;var _0x40f611;return db[_0x5cef('0x2a')][_0x5cef('0x4b')]({'where':{'id':_0x23ac44['params']['id']}})[_0x5cef('0x24')](handleEntityNotFound(_0x49db35,null))[_0x5cef('0x24')](function(_0x361a52){if(_0x361a52){_0x3b2dc2=_0x361a52;_0x3d1155[_0x5cef('0x2f')]=_['keys'](db[_0x5cef('0x4c')]['rawAttributes']);_0x3d1155['query']=_[_0x5cef('0x31')](_0x23ac44['query']);_0x3d1155[_0x5cef('0x33')]=_[_0x5cef('0x34')](_0x3d1155[_0x5cef('0x2f')],_0x3d1155['query']);_0x1381a1[_0x5cef('0x35')]=_[_0x5cef('0x34')](_0x3d1155[_0x5cef('0x2f')],qs[_0x5cef('0x36')](_0x23ac44[_0x5cef('0x32')][_0x5cef('0x36')]));_0x1381a1[_0x5cef('0x35')]=_0x1381a1[_0x5cef('0x35')][_0x5cef('0x37')]?_0x1381a1['attributes']:_0x3d1155[_0x5cef('0x2f')];_0x1381a1[_0x5cef('0x3a')]=qs[_0x5cef('0x3b')](_0x23ac44[_0x5cef('0x32')]['sort']);_0x1381a1[_0x5cef('0x3c')]=qs[_0x5cef('0x33')](_['pick'](_0x23ac44['query'],_0x3d1155[_0x5cef('0x33')]));if(_0x23ac44[_0x5cef('0x32')][_0x5cef('0x4d')]){_0x1381a1[_0x5cef('0x3c')]=_[_0x5cef('0x3e')](_0x1381a1[_0x5cef('0x3c')],{'$or':_[_0x5cef('0x30')](_0x1381a1[_0x5cef('0x35')],function(_0x73543d){var _0x1c2521={};_0x1c2521[_0x73543d]={'$like':'%'+_0x23ac44[_0x5cef('0x32')]['filter']+'%'};return _0x1c2521;})});}_0x1381a1=_['merge']({},_0x1381a1,_0x23ac44[_0x5cef('0x40')]);return _0x3b2dc2['getSubjects'](_0x1381a1);}})[_0x5cef('0x24')](function(_0x4d1d64){if(_0x4d1d64){_0x40f611=_0x4d1d64[_0x5cef('0x37')];if(!_0x23ac44[_0x5cef('0x32')]['hasOwnProperty'](_0x5cef('0x39'))){_0x1381a1[_0x5cef('0x1e')]=qs[_0x5cef('0x1e')](_0x23ac44[_0x5cef('0x32')][_0x5cef('0x1e')]);_0x1381a1[_0x5cef('0x1b')]=qs[_0x5cef('0x1b')](_0x23ac44[_0x5cef('0x32')][_0x5cef('0x1b')]);}return _0x3b2dc2[_0x5cef('0x4e')](_0x1381a1);}})[_0x5cef('0x24')](function(_0x3f7523){if(_0x3f7523){return _0x3f7523?{'count':_0x40f611,'rows':_0x3f7523}:null;}})[_0x5cef('0x24')](respondWithResult(_0x49db35,null))[_0x5cef('0x45')](handleError(_0x49db35,null));};exports[_0x5cef('0x4f')]=function(_0x2043ea,_0x31e89f,_0x22849e){var _0x217339={};var _0x25a9fb={};var _0x55f92e;var _0x4a4b19;return db[_0x5cef('0x2a')][_0x5cef('0x4b')]({'where':{'id':_0x2043ea['params']['id']}})['then'](handleEntityNotFound(_0x31e89f,null))[_0x5cef('0x24')](function(_0x221678){if(_0x221678){_0x55f92e=_0x221678;_0x25a9fb['model']=_[_0x5cef('0x31')](db[_0x5cef('0x4c')][_0x5cef('0x2b')]);_0x25a9fb[_0x5cef('0x32')]=_[_0x5cef('0x31')](_0x2043ea[_0x5cef('0x32')]);_0x25a9fb['filters']=_[_0x5cef('0x34')](_0x25a9fb[_0x5cef('0x2f')],_0x25a9fb[_0x5cef('0x32')]);_0x217339[_0x5cef('0x35')]=_[_0x5cef('0x34')](_0x25a9fb['model'],qs['fields'](_0x2043ea[_0x5cef('0x32')][_0x5cef('0x36')]));_0x217339[_0x5cef('0x35')]=_0x217339[_0x5cef('0x35')][_0x5cef('0x37')]?_0x217339[_0x5cef('0x35')]:_0x25a9fb[_0x5cef('0x2f')];_0x217339[_0x5cef('0x3a')]=qs[_0x5cef('0x3b')](_0x2043ea[_0x5cef('0x32')][_0x5cef('0x3b')]);_0x217339[_0x5cef('0x3c')]=qs[_0x5cef('0x33')](_[_0x5cef('0x3d')](_0x2043ea[_0x5cef('0x32')],_0x25a9fb[_0x5cef('0x33')]));if(_0x2043ea[_0x5cef('0x32')][_0x5cef('0x4d')]){_0x217339[_0x5cef('0x3c')]=_['merge'](_0x217339[_0x5cef('0x3c')],{'$or':_['map'](_0x217339['attributes'],function(_0x20a4e6){var _0x5b5182={};_0x5b5182[_0x20a4e6]={'$like':'%'+_0x2043ea[_0x5cef('0x32')][_0x5cef('0x4d')]+'%'};return _0x5b5182;})});}_0x217339=_[_0x5cef('0x3e')]({},_0x217339,_0x2043ea['options']);return _0x55f92e[_0x5cef('0x4f')](_0x217339);}})[_0x5cef('0x24')](function(_0x378ddf){if(_0x378ddf){_0x4a4b19=_0x378ddf[_0x5cef('0x37')];if(!_0x2043ea[_0x5cef('0x32')]['hasOwnProperty']('nolimit')){_0x217339['limit']=qs[_0x5cef('0x1e')](_0x2043ea[_0x5cef('0x32')][_0x5cef('0x1e')]);_0x217339[_0x5cef('0x1b')]=qs[_0x5cef('0x1b')](_0x2043ea['query'][_0x5cef('0x1b')]);}return _0x55f92e['getDescriptions'](_0x217339);}})['then'](function(_0x456af6){if(_0x456af6){return _0x456af6?{'count':_0x4a4b19,'rows':_0x456af6}:null;}})['then'](respondWithResult(_0x31e89f,null))['catch'](handleError(_0x31e89f,null));};exports[_0x5cef('0x50')]=function(_0x5843e9,_0xe38458,_0x5c66f6){var _0xdd2b1={};var _0xfba26c={};var _0x54d723;var _0x45bc41;return db['FreshsalesConfiguration'][_0x5cef('0x4b')]({'where':{'id':_0x5843e9['params']['id']}})[_0x5cef('0x24')](handleEntityNotFound(_0xe38458,null))[_0x5cef('0x24')](function(_0x5559c0){if(_0x5559c0){_0x54d723=_0x5559c0;_0xfba26c[_0x5cef('0x2f')]=_[_0x5cef('0x31')](db[_0x5cef('0x4c')][_0x5cef('0x2b')]);_0xfba26c[_0x5cef('0x32')]=_[_0x5cef('0x31')](_0x5843e9[_0x5cef('0x32')]);_0xfba26c['filters']=_[_0x5cef('0x34')](_0xfba26c[_0x5cef('0x2f')],_0xfba26c[_0x5cef('0x32')]);_0xdd2b1[_0x5cef('0x35')]=_['intersection'](_0xfba26c['model'],qs['fields'](_0x5843e9[_0x5cef('0x32')][_0x5cef('0x36')]));_0xdd2b1[_0x5cef('0x35')]=_0xdd2b1['attributes'][_0x5cef('0x37')]?_0xdd2b1['attributes']:_0xfba26c['model'];_0xdd2b1['order']=qs[_0x5cef('0x3b')](_0x5843e9['query']['sort']);_0xdd2b1['where']=qs[_0x5cef('0x33')](_[_0x5cef('0x3d')](_0x5843e9[_0x5cef('0x32')],_0xfba26c['filters']));if(_0x5843e9[_0x5cef('0x32')][_0x5cef('0x4d')]){_0xdd2b1['where']=_[_0x5cef('0x3e')](_0xdd2b1[_0x5cef('0x3c')],{'$or':_[_0x5cef('0x30')](_0xdd2b1[_0x5cef('0x35')],function(_0x53beeb){var _0x39fc9d={};_0x39fc9d[_0x53beeb]={'$like':'%'+_0x5843e9[_0x5cef('0x32')][_0x5cef('0x4d')]+'%'};return _0x39fc9d;})});}_0xdd2b1=_[_0x5cef('0x3e')]({},_0xdd2b1,_0x5843e9[_0x5cef('0x40')]);return _0x54d723[_0x5cef('0x50')](_0xdd2b1);}})[_0x5cef('0x24')](function(_0x1965b1){if(_0x1965b1){_0x45bc41=_0x1965b1['length'];if(!_0x5843e9['query'][_0x5cef('0x38')](_0x5cef('0x39'))){_0xdd2b1['limit']=qs['limit'](_0x5843e9['query']['limit']);_0xdd2b1[_0x5cef('0x1b')]=qs[_0x5cef('0x1b')](_0x5843e9[_0x5cef('0x32')][_0x5cef('0x1b')]);}return _0x54d723[_0x5cef('0x50')](_0xdd2b1);}})[_0x5cef('0x24')](function(_0x18a022){if(_0x18a022){return _0x18a022?{'count':_0x45bc41,'rows':_0x18a022}:null;}})['then'](respondWithResult(_0xe38458,null))[_0x5cef('0x45')](handleError(_0xe38458,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 1492244..9e5d8cb 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 _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 +var _0x27e8=['int_freshsales_configurations','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','define'];(function(_0x1ee0a1,_0x51058e){var _0x1d2d5b=function(_0x35cfb5){while(--_0x35cfb5){_0x1ee0a1['push'](_0x1ee0a1['shift']());}};_0x1d2d5b(++_0x51058e);}(_0x27e8,0x114));var _0x827e=function(_0x621a59,_0x215711){_0x621a59=_0x621a59-0x0;var _0x47b0c6=_0x27e8[_0x621a59];return _0x47b0c6;};'use strict';var _=require(_0x827e('0x0'));var util=require(_0x827e('0x1'));var logger=require(_0x827e('0x2'))(_0x827e('0x3'));var moment=require(_0x827e('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x827e('0x5'));var rimraf=require(_0x827e('0x6'));var config=require(_0x827e('0x7'));var attributes=require(_0x827e('0x8'));module['exports']=function(_0x185d31,_0x4c179a){return _0x185d31[_0x827e('0x9')]('FreshsalesConfiguration',attributes,{'tableName':_0x827e('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 7521bf7..13e46f9 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 _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 +var _0x0bf1=['FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshsalesConfiguration,\x20%s,\x20%s','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','request\x20sent','debug'];(function(_0x2bf034,_0x378b4f){var _0x254655=function(_0x1b4c6a){while(--_0x1b4c6a){_0x2bf034['push'](_0x2bf034['shift']());}};_0x254655(++_0x378b4f);}(_0x0bf1,0x1a6));var _0x10bf=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x0bf1[_0x3b380d];return _0x54502b;};'use strict';var _=require('lodash');var util=require(_0x10bf('0x0'));var moment=require(_0x10bf('0x1'));var BPromise=require(_0x10bf('0x2'));var rs=require(_0x10bf('0x3'));var fs=require('fs');var Redis=require(_0x10bf('0x4'));var db=require(_0x10bf('0x5'))['db'];var utils=require(_0x10bf('0x6'));var logger=require(_0x10bf('0x7'))(_0x10bf('0x8'));var config=require('../../config/environment');var jayson=require(_0x10bf('0x9'));var client=jayson['client'][_0x10bf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c0378,_0x1baab,_0x6818ee){return new BPromise(function(_0x47f529,_0x1b939f){return client['request'](_0x2c0378,_0x6818ee)[_0x10bf('0xb')](function(_0x4a400e){logger[_0x10bf('0xc')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x1baab,_0x10bf('0xd'));logger[_0x10bf('0xe')](_0x10bf('0xf'),_0x1baab,_0x10bf('0xd'),JSON[_0x10bf('0x10')](_0x4a400e));if(_0x4a400e[_0x10bf('0x11')]){if(_0x4a400e[_0x10bf('0x11')][_0x10bf('0x12')]===0x1f4){logger[_0x10bf('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x1baab,_0x4a400e['error'][_0x10bf('0x13')]);return _0x1b939f(_0x4a400e[_0x10bf('0x11')][_0x10bf('0x13')]);}logger['error'](_0x10bf('0x14'),_0x1baab,_0x4a400e['error'][_0x10bf('0x13')]);return _0x47f529(_0x4a400e['error'][_0x10bf('0x13')]);}else{logger['info'](_0x10bf('0x14'),_0x1baab,_0x10bf('0xd'));_0x47f529(_0x4a400e[_0x10bf('0x15')]['message']);}})[_0x10bf('0x16')](function(_0xe8d575){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x1baab,_0xe8d575);_0x1b939f(_0xe8d575);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 7e93b42..0181ff5 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 _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 +var _0xf7f3=['get','index','isAuthenticated','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xf7f3,0x12a));var _0x3f7f=function(_0x5f1953,_0x28058a){_0x5f1953=_0x5f1953-0x0;var _0x253804=_0xf7f3[_0x5f1953];return _0x253804;};'use strict';var multer=require(_0x3f7f('0x0'));var util=require(_0x3f7f('0x1'));var path=require(_0x3f7f('0x2'));var timeout=require(_0x3f7f('0x3'));var express=require(_0x3f7f('0x4'));var router=express[_0x3f7f('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3f7f('0x6'));var config=require(_0x3f7f('0x7'));var controller=require('./intFreshsalesField.controller');router[_0x3f7f('0x8')]('/',auth['isAuthenticated'](),controller[_0x3f7f('0x9')]);router[_0x3f7f('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x3f7f('0xa')](),controller[_0x3f7f('0xb')]);router[_0x3f7f('0xc')](_0x3f7f('0xd'),auth[_0x3f7f('0xa')](),controller[_0x3f7f('0xe')]);router[_0x3f7f('0xf')](_0x3f7f('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x3f7f('0x10')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 2c11235..29159d9 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 _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 +var _0x2c4d=['sequelize','ENUM','string','variable','keyValue','picklist','STRING','customVariable'];(function(_0x24bbe9,_0x1f16e3){var _0x27af41=function(_0x36a850){while(--_0x36a850){_0x24bbe9['push'](_0x24bbe9['shift']());}};_0x27af41(++_0x1f16e3);}(_0x2c4d,0x120));var _0xd2c4=function(_0x494986,_0x4debb8){_0x494986=_0x494986-0x0;var _0x1c805b=_0x2c4d[_0x494986];return _0x1c805b;};'use strict';var Sequelize=require(_0xd2c4('0x0'));module['exports']={'type':{'type':Sequelize[_0xd2c4('0x1')](_0xd2c4('0x2'),_0xd2c4('0x3'),'customVariable',_0xd2c4('0x4'),_0xd2c4('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xd2c4('0x6')]},'keyType':{'type':Sequelize[_0xd2c4('0x1')](_0xd2c4('0x2'),_0xd2c4('0x3'),_0xd2c4('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xd2c4('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd2c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 0a96f72..ec3dc12 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 _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 +var _0xdb42=['create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','error','stack','name','index','map','FreshsalesField','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','merge','find'];(function(_0x1b5bb3,_0x43ae0c){var _0x1fe97c=function(_0xb436a0){while(--_0xb436a0){_0x1b5bb3['push'](_0x1b5bb3['shift']());}};_0x1fe97c(++_0x43ae0c);}(_0xdb42,0x184));var _0x2db4=function(_0x2ed2bd,_0x4eda85){_0x2ed2bd=_0x2ed2bd-0x0;var _0x57ff49=_0xdb42[_0x2ed2bd];return _0x57ff49;};'use strict';var emlformat=require(_0x2db4('0x0'));var rimraf=require(_0x2db4('0x1'));var zipdir=require(_0x2db4('0x2'));var jsonpatch=require(_0x2db4('0x3'));var rp=require(_0x2db4('0x4'));var moment=require('moment');var BPromise=require(_0x2db4('0x5'));var Mustache=require(_0x2db4('0x6'));var util=require(_0x2db4('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x2db4('0x8'));var ejs=require(_0x2db4('0x9'));var fs=require('fs');var fs_extra=require(_0x2db4('0xa'));var _=require(_0x2db4('0xb'));var squel=require(_0x2db4('0xc'));var crypto=require(_0x2db4('0xd'));var jsforce=require(_0x2db4('0xe'));var deskjs=require(_0x2db4('0xf'));var toCsv=require(_0x2db4('0x8'));var querystring=require(_0x2db4('0x10'));var Papa=require(_0x2db4('0x11'));var Redis=require(_0x2db4('0x12'));var authService=require(_0x2db4('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x2db4('0x14'));var hardwareService=require(_0x2db4('0x15'));var logger=require(_0x2db4('0x16'))('api');var utils=require(_0x2db4('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x2db4('0x18'));var db=require(_0x2db4('0x19'))['db'];function respondWithStatusCode(_0x2da465,_0x2fa26e){_0x2fa26e=_0x2fa26e||0xcc;return function(_0x10b2a1){if(_0x10b2a1){return _0x2da465[_0x2db4('0x1a')](_0x2fa26e);}return _0x2da465[_0x2db4('0x1b')](_0x2fa26e)[_0x2db4('0x1c')]();};}function respondWithResult(_0x5ac46f,_0x4fa449){_0x4fa449=_0x4fa449||0xc8;return function(_0x2bb0e0){if(_0x2bb0e0){return _0x5ac46f[_0x2db4('0x1b')](_0x4fa449)[_0x2db4('0x1d')](_0x2bb0e0);}};}function respondWithFilteredResult(_0x418cac,_0xee240){return function(_0x54a86c){if(_0x54a86c){var _0x549bb5=typeof _0xee240[_0x2db4('0x1e')]==='undefined'&&typeof _0xee240[_0x2db4('0x1f')]===_0x2db4('0x20');var _0x12209b=_0x54a86c[_0x2db4('0x21')];var _0x563fe9=_0x549bb5?0x0:_0xee240[_0x2db4('0x1e')];var _0x53c1f9=_0x549bb5?_0x54a86c['count']:_0xee240[_0x2db4('0x1e')]+_0xee240[_0x2db4('0x1f')];var _0x56c318;if(_0x53c1f9>=_0x12209b){_0x53c1f9=_0x12209b;_0x56c318=0xc8;}else{_0x56c318=0xce;}_0x418cac[_0x2db4('0x1b')](_0x56c318);return _0x418cac[_0x2db4('0x22')](_0x2db4('0x23'),_0x563fe9+'-'+_0x53c1f9+'/'+_0x12209b)['json'](_0x54a86c);}return null;};}function patchUpdates(_0x590d6a){return function(_0x55371b){try{jsonpatch[_0x2db4('0x24')](_0x55371b,_0x590d6a,!![]);}catch(_0x28d848){return BPromise[_0x2db4('0x25')](_0x28d848);}return _0x55371b['save']();};}function saveUpdates(_0x39bfc4,_0x5eea8d){return function(_0x5a1298){if(_0x5a1298){return _0x5a1298[_0x2db4('0x26')](_0x39bfc4)[_0x2db4('0x27')](function(_0x8df5d1){return _0x8df5d1;});}return null;};}function removeEntity(_0x7e439f,_0x554c2a){return function(_0x4ad16a){if(_0x4ad16a){return _0x4ad16a['destroy']()['then'](function(){_0x7e439f[_0x2db4('0x1b')](0xcc)[_0x2db4('0x1c')]();});}};}function handleEntityNotFound(_0x14975a,_0x4d2884){return function(_0x12f549){if(!_0x12f549){_0x14975a[_0x2db4('0x1a')](0x194);}return _0x12f549;};}function handleError(_0x2c69c0,_0x11aeb9){_0x11aeb9=_0x11aeb9||0x1f4;return function(_0x488376){logger[_0x2db4('0x28')](_0x488376[_0x2db4('0x29')]);if(_0x488376['name']){delete _0x488376[_0x2db4('0x2a')];}_0x2c69c0[_0x2db4('0x1b')](_0x11aeb9)['send'](_0x488376);};}exports[_0x2db4('0x2b')]=function(_0x3d2d9b,_0x239c44){var _0x3e2030={},_0x284b8c={},_0x2069dc={'count':0x0,'rows':[]};var _0x4f4c7f=_[_0x2db4('0x2c')](db[_0x2db4('0x2d')][_0x2db4('0x2e')],function(_0xa01ec1){return{'name':_0xa01ec1[_0x2db4('0x2f')],'type':_0xa01ec1[_0x2db4('0x30')][_0x2db4('0x31')]};});_0x284b8c[_0x2db4('0x32')]=_[_0x2db4('0x2c')](_0x4f4c7f,_0x2db4('0x2a'));_0x284b8c[_0x2db4('0x33')]=_[_0x2db4('0x34')](_0x3d2d9b['query']);_0x284b8c[_0x2db4('0x35')]=_['intersection'](_0x284b8c['model'],_0x284b8c[_0x2db4('0x33')]);_0x3e2030[_0x2db4('0x36')]=_[_0x2db4('0x37')](_0x284b8c[_0x2db4('0x32')],qs['fields'](_0x3d2d9b[_0x2db4('0x33')][_0x2db4('0x38')]));_0x3e2030[_0x2db4('0x36')]=_0x3e2030['attributes'][_0x2db4('0x39')]?_0x3e2030[_0x2db4('0x36')]:_0x284b8c[_0x2db4('0x32')];if(!_0x3d2d9b[_0x2db4('0x33')][_0x2db4('0x3a')](_0x2db4('0x3b'))){_0x3e2030[_0x2db4('0x1f')]=qs[_0x2db4('0x1f')](_0x3d2d9b[_0x2db4('0x33')][_0x2db4('0x1f')]);_0x3e2030[_0x2db4('0x1e')]=qs['offset'](_0x3d2d9b['query'][_0x2db4('0x1e')]);}_0x3e2030['order']=qs[_0x2db4('0x3c')](_0x3d2d9b[_0x2db4('0x33')][_0x2db4('0x3c')]);_0x3e2030[_0x2db4('0x3d')]=qs[_0x2db4('0x35')](_[_0x2db4('0x3e')](_0x3d2d9b[_0x2db4('0x33')],_0x284b8c[_0x2db4('0x35')]),_0x4f4c7f);if(_0x3d2d9b[_0x2db4('0x33')][_0x2db4('0x3f')]){_0x3e2030['where']=_['merge'](_0x3e2030[_0x2db4('0x3d')],{'$or':_[_0x2db4('0x2c')](_0x4f4c7f,function(_0x2837bc){if(_0x2837bc['type']!==_0x2db4('0x40')){var _0x2410df={};_0x2410df[_0x2837bc[_0x2db4('0x2a')]]={'$like':'%'+_0x3d2d9b[_0x2db4('0x33')][_0x2db4('0x3f')]+'%'};return _0x2410df;}})});}_0x3e2030=_['merge']({},_0x3e2030,_0x3d2d9b[_0x2db4('0x41')]);var _0x1f8796={'where':_0x3e2030[_0x2db4('0x3d')]};return db[_0x2db4('0x2d')][_0x2db4('0x21')](_0x1f8796)[_0x2db4('0x27')](function(_0x3c8f9f){_0x2069dc[_0x2db4('0x21')]=_0x3c8f9f;if(_0x3d2d9b['query'][_0x2db4('0x42')]){_0x3e2030[_0x2db4('0x43')]=[{'all':!![]}];}return db[_0x2db4('0x2d')][_0x2db4('0x44')](_0x3e2030);})[_0x2db4('0x27')](function(_0x3b449f){_0x2069dc[_0x2db4('0x45')]=_0x3b449f;return _0x2069dc;})['then'](respondWithFilteredResult(_0x239c44,_0x3e2030))[_0x2db4('0x46')](handleError(_0x239c44,null));};exports['show']=function(_0x172af2,_0x4bfb4b){var _0x398c28={'raw':!![],'where':{'id':_0x172af2[_0x2db4('0x47')]['id']}},_0x11d592={};_0x11d592['model']=_['keys'](db[_0x2db4('0x2d')]['rawAttributes']);_0x11d592[_0x2db4('0x33')]=_[_0x2db4('0x34')](_0x172af2[_0x2db4('0x33')]);_0x11d592[_0x2db4('0x35')]=_['intersection'](_0x11d592[_0x2db4('0x32')],_0x11d592[_0x2db4('0x33')]);_0x398c28[_0x2db4('0x36')]=_['intersection'](_0x11d592[_0x2db4('0x32')],qs[_0x2db4('0x38')](_0x172af2['query'][_0x2db4('0x38')]));_0x398c28[_0x2db4('0x36')]=_0x398c28[_0x2db4('0x36')][_0x2db4('0x39')]?_0x398c28['attributes']:_0x11d592[_0x2db4('0x32')];if(_0x172af2[_0x2db4('0x33')][_0x2db4('0x42')]){_0x398c28[_0x2db4('0x43')]=[{'all':!![]}];}_0x398c28=_[_0x2db4('0x48')]({},_0x398c28,_0x172af2[_0x2db4('0x41')]);return db[_0x2db4('0x2d')][_0x2db4('0x49')](_0x398c28)[_0x2db4('0x27')](handleEntityNotFound(_0x4bfb4b,null))[_0x2db4('0x27')](respondWithResult(_0x4bfb4b,null))[_0x2db4('0x46')](handleError(_0x4bfb4b,null));};exports['create']=function(_0x29ff51,_0x3cab01){return db[_0x2db4('0x2d')][_0x2db4('0x4a')](_0x29ff51[_0x2db4('0x4b')],{})[_0x2db4('0x27')](respondWithResult(_0x3cab01,0xc9))[_0x2db4('0x46')](handleError(_0x3cab01,null));};exports[_0x2db4('0x26')]=function(_0x2466bb,_0x3ada8e){if(_0x2466bb[_0x2db4('0x4b')]['id']){delete _0x2466bb['body']['id'];}return db['FreshsalesField']['find']({'where':{'id':_0x2466bb[_0x2db4('0x47')]['id']}})[_0x2db4('0x27')](handleEntityNotFound(_0x3ada8e,null))[_0x2db4('0x27')](saveUpdates(_0x2466bb[_0x2db4('0x4b')],null))['then'](respondWithResult(_0x3ada8e,null))[_0x2db4('0x46')](handleError(_0x3ada8e,null));};exports[_0x2db4('0x4c')]=function(_0x41836a,_0x412973){return db[_0x2db4('0x2d')][_0x2db4('0x49')]({'where':{'id':_0x41836a[_0x2db4('0x47')]['id']}})[_0x2db4('0x27')](handleEntityNotFound(_0x412973,null))['then'](removeEntity(_0x412973,null))[_0x2db4('0x46')](handleError(_0x412973,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 4490610..7996548 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 _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 +var _0x20d6=['../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','freshsales_unique_index','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x24baf7,_0x43871f){var _0x47449e=function(_0x2e0333){while(--_0x2e0333){_0x24baf7['push'](_0x24baf7['shift']());}};_0x47449e(++_0x43871f);}(_0x20d6,0x1b8));var _0x620d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x20d6[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x620d('0x0'));var util=require(_0x620d('0x1'));var logger=require(_0x620d('0x2'))(_0x620d('0x3'));var moment=require('moment');var BPromise=require(_0x620d('0x4'));var rp=require(_0x620d('0x5'));var fs=require('fs');var path=require(_0x620d('0x6'));var rimraf=require(_0x620d('0x7'));var config=require(_0x620d('0x8'));var attributes=require(_0x620d('0x9'));module[_0x620d('0xa')]=function(_0x46fc14,_0x28e29a){return _0x46fc14[_0x620d('0xb')](_0x620d('0xc'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0x620d('0xd'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index 9deec51..177c13d 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 _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 +var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x4d453c,_0x311b8c){var _0x4c80ac=function(_0x5548c0){while(--_0x5548c0){_0x4d453c['push'](_0x4d453c['shift']());}};_0x4c80ac(++_0x311b8c);}(_0xadb5,0xad));var _0x5adb=function(_0x396953,_0x4194b3){_0x396953=_0x396953-0x0;var _0x2dd3d8=_0xadb5[_0x396953];return _0x2dd3d8;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('FreshsalesField,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 0dd7a13..b57e8cb 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_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 +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(_0x5e73fc,_0xc0d57){var _0x32e4f2=function(_0x46b189){while(--_0x46b189){_0x5e73fc['push'](_0x5e73fc['shift']());}};_0x32e4f2(++_0xc0d57);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 918a46b..26ca3af 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 _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 +var _0x1a3b=['exports','STRING','username','ENUM','integrationTab','sequelize'];(function(_0x35c780,_0x3ff28b){var _0x355fdb=function(_0x49898f){while(--_0x49898f){_0x35c780['push'](_0x35c780['shift']());}};_0x355fdb(++_0x3ff28b);}(_0x1a3b,0x83));var _0xb1a3=function(_0x20785b,_0x22901a){_0x20785b=_0x20785b-0x0;var _0x2dec3e=_0x1a3b[_0x20785b];return _0x2dec3e;};'use strict';var Sequelize=require(_0xb1a3('0x0'));module[_0xb1a3('0x1')]={'name':{'type':Sequelize[_0xb1a3('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xb1a3('0x2')],'unique':_0xb1a3('0x3')},'remoteUri':{'type':Sequelize[_0xb1a3('0x2')]},'password':{'type':Sequelize[_0xb1a3('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xb1a3('0x2')]},'securityToken':{'type':Sequelize[_0xb1a3('0x2')]},'serverUrl':{'type':Sequelize[_0xb1a3('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xb1a3('0x4')](_0xb1a3('0x5'),'newTab'),'defaultValue':_0xb1a3('0x5')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 97c4921..e162179 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 _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 +var _0xfa2d=['value','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','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','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','apply','reject','save','update','then','error','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','SalesforceAccount','includeAll','include','findAll','rows','params','keys','find','catch','create','body','destroy','getConfigurations','SalesforceConfiguration','hasOwnProperty','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getFields','remoteUri','clientId','clientSecret','username','password','securityToken','slice','lastIndexOf','Connection','isNil','ticketType','OwnerId','ActivityDate','IsReminderSet','Subject','string','int','boolean','email','phone','includes','label','custom','picklistValues'];(function(_0x2c913e,_0x174dd7){var _0x1941a0=function(_0xfe8f33){while(--_0xfe8f33){_0x2c913e['push'](_0x2c913e['shift']());}};_0x1941a0(++_0x174dd7);}(_0xfa2d,0x16d));var _0xdfa2=function(_0x3d043f,_0x75a7af){_0x3d043f=_0x3d043f-0x0;var _0x23d2c7=_0xfa2d[_0x3d043f];return _0x23d2c7;};'use strict';var emlformat=require(_0xdfa2('0x0'));var rimraf=require(_0xdfa2('0x1'));var zipdir=require(_0xdfa2('0x2'));var jsonpatch=require(_0xdfa2('0x3'));var rp=require('request-promise');var moment=require(_0xdfa2('0x4'));var BPromise=require(_0xdfa2('0x5'));var Mustache=require('mustache');var util=require(_0xdfa2('0x6'));var path=require(_0xdfa2('0x7'));var sox=require(_0xdfa2('0x8'));var csv=require(_0xdfa2('0x9'));var ejs=require(_0xdfa2('0xa'));var fs=require('fs');var fs_extra=require(_0xdfa2('0xb'));var _=require(_0xdfa2('0xc'));var squel=require('squel');var crypto=require(_0xdfa2('0xd'));var jsforce=require(_0xdfa2('0xe'));var deskjs=require(_0xdfa2('0xf'));var toCsv=require('to-csv');var querystring=require(_0xdfa2('0x10'));var Papa=require(_0xdfa2('0x11'));var Redis=require(_0xdfa2('0x12'));var authService=require(_0xdfa2('0x13'));var qs=require(_0xdfa2('0x14'));var as=require(_0xdfa2('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdfa2('0x16'))(_0xdfa2('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xdfa2('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0xdfa2('0x19'));function respondWithStatusCode(_0x4f13c2,_0x149aad){_0x149aad=_0x149aad||0xcc;return function(_0x9e606e){if(_0x9e606e){return _0x4f13c2[_0xdfa2('0x1a')](_0x149aad);}return _0x4f13c2[_0xdfa2('0x1b')](_0x149aad)[_0xdfa2('0x1c')]();};}function respondWithResult(_0x19b165,_0x59cc61){_0x59cc61=_0x59cc61||0xc8;return function(_0x5c6e46){if(_0x5c6e46){return _0x19b165['status'](_0x59cc61)[_0xdfa2('0x1d')](_0x5c6e46);}};}function respondWithFilteredResult(_0x542f4f,_0x4a73f2){return function(_0xd13676){if(_0xd13676){var _0x25df05=typeof _0x4a73f2[_0xdfa2('0x1e')]===_0xdfa2('0x1f')&&typeof _0x4a73f2['limit']===_0xdfa2('0x1f');var _0x3e7cd1=_0xd13676[_0xdfa2('0x20')];var _0xf49204=_0x25df05?0x0:_0x4a73f2[_0xdfa2('0x1e')];var _0x55ad07=_0x25df05?_0xd13676[_0xdfa2('0x20')]:_0x4a73f2[_0xdfa2('0x1e')]+_0x4a73f2[_0xdfa2('0x21')];var _0x38ce1d;if(_0x55ad07>=_0x3e7cd1){_0x55ad07=_0x3e7cd1;_0x38ce1d=0xc8;}else{_0x38ce1d=0xce;}_0x542f4f[_0xdfa2('0x1b')](_0x38ce1d);return _0x542f4f['set']('Content-Range',_0xf49204+'-'+_0x55ad07+'/'+_0x3e7cd1)[_0xdfa2('0x1d')](_0xd13676);}return null;};}function patchUpdates(_0x5246b4){return function(_0x4b1092){try{jsonpatch[_0xdfa2('0x22')](_0x4b1092,_0x5246b4,!![]);}catch(_0x2cfdef){return BPromise[_0xdfa2('0x23')](_0x2cfdef);}return _0x4b1092[_0xdfa2('0x24')]();};}function saveUpdates(_0x5479c7,_0xd580f9){return function(_0x2fe4ac){if(_0x2fe4ac){return _0x2fe4ac[_0xdfa2('0x25')](_0x5479c7)['then'](function(_0x42acbf){return _0x42acbf;});}return null;};}function removeEntity(_0x17a869,_0x429f49){return function(_0x4b7470){if(_0x4b7470){return _0x4b7470['destroy']()[_0xdfa2('0x26')](function(){_0x17a869['status'](0xcc)[_0xdfa2('0x1c')]();});}};}function handleEntityNotFound(_0x16bd37,_0x5c40ee){return function(_0x19686e){if(!_0x19686e){_0x16bd37[_0xdfa2('0x1a')](0x194);}return _0x19686e;};}function handleError(_0x18582b,_0x3dd198){_0x3dd198=_0x3dd198||0x1f4;return function(_0x8f2aa7){logger[_0xdfa2('0x27')](_0x8f2aa7['stack']);if(_0x8f2aa7[_0xdfa2('0x28')]){delete _0x8f2aa7[_0xdfa2('0x28')];}_0x18582b[_0xdfa2('0x1b')](_0x3dd198)[_0xdfa2('0x29')](_0x8f2aa7);};}exports[_0xdfa2('0x2a')]=function(_0x64e643,_0x1f59cd){var _0x31b6f0={},_0x1d269e={},_0x1fe35e={'count':0x0,'rows':[]};var _0x143fff=_[_0xdfa2('0x2b')](db['SalesforceAccount'][_0xdfa2('0x2c')],function(_0x31fda6){return{'name':_0x31fda6[_0xdfa2('0x2d')],'type':_0x31fda6['type'][_0xdfa2('0x2e')]};});_0x1d269e[_0xdfa2('0x2f')]=_[_0xdfa2('0x2b')](_0x143fff,_0xdfa2('0x28'));_0x1d269e[_0xdfa2('0x30')]=_['keys'](_0x64e643[_0xdfa2('0x30')]);_0x1d269e[_0xdfa2('0x31')]=_[_0xdfa2('0x32')](_0x1d269e[_0xdfa2('0x2f')],_0x1d269e[_0xdfa2('0x30')]);_0x31b6f0[_0xdfa2('0x33')]=_['intersection'](_0x1d269e[_0xdfa2('0x2f')],qs[_0xdfa2('0x34')](_0x64e643[_0xdfa2('0x30')]['fields']));_0x31b6f0[_0xdfa2('0x33')]=_0x31b6f0[_0xdfa2('0x33')][_0xdfa2('0x35')]?_0x31b6f0[_0xdfa2('0x33')]:_0x1d269e['model'];if(!_0x64e643[_0xdfa2('0x30')]['hasOwnProperty'](_0xdfa2('0x36'))){_0x31b6f0[_0xdfa2('0x21')]=qs[_0xdfa2('0x21')](_0x64e643['query']['limit']);_0x31b6f0['offset']=qs[_0xdfa2('0x1e')](_0x64e643[_0xdfa2('0x30')][_0xdfa2('0x1e')]);}_0x31b6f0[_0xdfa2('0x37')]=qs[_0xdfa2('0x38')](_0x64e643[_0xdfa2('0x30')]['sort']);_0x31b6f0[_0xdfa2('0x39')]=qs['filters'](_[_0xdfa2('0x3a')](_0x64e643[_0xdfa2('0x30')],_0x1d269e[_0xdfa2('0x31')]),_0x143fff);if(_0x64e643[_0xdfa2('0x30')][_0xdfa2('0x3b')]){_0x31b6f0[_0xdfa2('0x39')]=_[_0xdfa2('0x3c')](_0x31b6f0[_0xdfa2('0x39')],{'$or':_[_0xdfa2('0x2b')](_0x143fff,function(_0x4cea2e){if(_0x4cea2e[_0xdfa2('0x3d')]!==_0xdfa2('0x3e')){var _0x3e1799={};_0x3e1799[_0x4cea2e[_0xdfa2('0x28')]]={'$like':'%'+_0x64e643['query'][_0xdfa2('0x3b')]+'%'};return _0x3e1799;}})});}_0x31b6f0=_['merge']({},_0x31b6f0,_0x64e643[_0xdfa2('0x3f')]);var _0x732ea7={'where':_0x31b6f0['where']};return db[_0xdfa2('0x40')][_0xdfa2('0x20')](_0x732ea7)[_0xdfa2('0x26')](function(_0x30f288){_0x1fe35e[_0xdfa2('0x20')]=_0x30f288;if(_0x64e643[_0xdfa2('0x30')][_0xdfa2('0x41')]){_0x31b6f0[_0xdfa2('0x42')]=[{'all':!![]}];}return db[_0xdfa2('0x40')][_0xdfa2('0x43')](_0x31b6f0);})['then'](function(_0x61eff5){_0x1fe35e[_0xdfa2('0x44')]=_0x61eff5;return _0x1fe35e;})[_0xdfa2('0x26')](respondWithFilteredResult(_0x1f59cd,_0x31b6f0))['catch'](handleError(_0x1f59cd,null));};exports['show']=function(_0x5aad92,_0x2a2dfb){var _0x252629={'raw':![],'where':{'id':_0x5aad92[_0xdfa2('0x45')]['id']}},_0x1403a9={};_0x1403a9[_0xdfa2('0x2f')]=_[_0xdfa2('0x46')](db['SalesforceAccount'][_0xdfa2('0x2c')]);_0x1403a9[_0xdfa2('0x30')]=_[_0xdfa2('0x46')](_0x5aad92[_0xdfa2('0x30')]);_0x1403a9[_0xdfa2('0x31')]=_[_0xdfa2('0x32')](_0x1403a9[_0xdfa2('0x2f')],_0x1403a9[_0xdfa2('0x30')]);_0x252629['attributes']=_['intersection'](_0x1403a9[_0xdfa2('0x2f')],qs[_0xdfa2('0x34')](_0x5aad92[_0xdfa2('0x30')][_0xdfa2('0x34')]));_0x252629[_0xdfa2('0x33')]=_0x252629['attributes'][_0xdfa2('0x35')]?_0x252629[_0xdfa2('0x33')]:_0x1403a9[_0xdfa2('0x2f')];if(_0x5aad92['query'][_0xdfa2('0x41')]){_0x252629[_0xdfa2('0x42')]=[{'all':!![]}];}_0x252629=_[_0xdfa2('0x3c')]({},_0x252629,_0x5aad92[_0xdfa2('0x3f')]);return db[_0xdfa2('0x40')][_0xdfa2('0x47')](_0x252629)[_0xdfa2('0x26')](handleEntityNotFound(_0x2a2dfb,null))[_0xdfa2('0x26')](respondWithResult(_0x2a2dfb,null))[_0xdfa2('0x48')](handleError(_0x2a2dfb,null));};exports[_0xdfa2('0x49')]=function(_0x42324a,_0x4a9e47){return db['SalesforceAccount'][_0xdfa2('0x49')](_0x42324a[_0xdfa2('0x4a')],{})[_0xdfa2('0x26')](respondWithResult(_0x4a9e47,0xc9))[_0xdfa2('0x48')](handleError(_0x4a9e47,null));};exports[_0xdfa2('0x25')]=function(_0x16cd8b,_0x3def52){if(_0x16cd8b[_0xdfa2('0x4a')]['id']){delete _0x16cd8b[_0xdfa2('0x4a')]['id'];}return db[_0xdfa2('0x40')]['find']({'where':{'id':_0x16cd8b[_0xdfa2('0x45')]['id']}})['then'](handleEntityNotFound(_0x3def52,null))[_0xdfa2('0x26')](saveUpdates(_0x16cd8b[_0xdfa2('0x4a')],null))['then'](respondWithResult(_0x3def52,null))[_0xdfa2('0x48')](handleError(_0x3def52,null));};exports[_0xdfa2('0x4b')]=function(_0x14357e,_0x3947e9){return db['SalesforceAccount'][_0xdfa2('0x47')]({'where':{'id':_0x14357e[_0xdfa2('0x45')]['id']}})[_0xdfa2('0x26')](handleEntityNotFound(_0x3947e9,null))[_0xdfa2('0x26')](removeEntity(_0x3947e9,null))['catch'](handleError(_0x3947e9,null));};exports[_0xdfa2('0x4c')]=function(_0xd02e28,_0x264e0e,_0x3b70ee){var _0x5dd6a9={};var _0xc9e59a={};var _0x27c014;var _0x3bfbac;return db['SalesforceAccount']['findOne']({'where':{'id':_0xd02e28[_0xdfa2('0x45')]['id']}})[_0xdfa2('0x26')](handleEntityNotFound(_0x264e0e,null))[_0xdfa2('0x26')](function(_0x264997){if(_0x264997){_0x27c014=_0x264997;_0xc9e59a['model']=_[_0xdfa2('0x46')](db[_0xdfa2('0x4d')]['rawAttributes']);_0xc9e59a[_0xdfa2('0x30')]=_[_0xdfa2('0x46')](_0xd02e28[_0xdfa2('0x30')]);_0xc9e59a['filters']=_[_0xdfa2('0x32')](_0xc9e59a[_0xdfa2('0x2f')],_0xc9e59a[_0xdfa2('0x30')]);_0x5dd6a9['attributes']=_[_0xdfa2('0x32')](_0xc9e59a['model'],qs[_0xdfa2('0x34')](_0xd02e28[_0xdfa2('0x30')]['fields']));_0x5dd6a9[_0xdfa2('0x33')]=_0x5dd6a9['attributes'][_0xdfa2('0x35')]?_0x5dd6a9[_0xdfa2('0x33')]:_0xc9e59a[_0xdfa2('0x2f')];_0x5dd6a9[_0xdfa2('0x37')]=qs[_0xdfa2('0x38')](_0xd02e28[_0xdfa2('0x30')][_0xdfa2('0x38')]);_0x5dd6a9[_0xdfa2('0x39')]=qs[_0xdfa2('0x31')](_[_0xdfa2('0x3a')](_0xd02e28[_0xdfa2('0x30')],_0xc9e59a['filters']));if(_0xd02e28[_0xdfa2('0x30')][_0xdfa2('0x3b')]){_0x5dd6a9[_0xdfa2('0x39')]=_[_0xdfa2('0x3c')](_0x5dd6a9[_0xdfa2('0x39')],{'$or':_[_0xdfa2('0x2b')](_0x5dd6a9[_0xdfa2('0x33')],function(_0x4b36fd){var _0x3517af={};_0x3517af[_0x4b36fd]={'$like':'%'+_0xd02e28[_0xdfa2('0x30')][_0xdfa2('0x3b')]+'%'};return _0x3517af;})});}_0x5dd6a9=_[_0xdfa2('0x3c')]({},_0x5dd6a9,_0xd02e28[_0xdfa2('0x3f')]);return _0x27c014[_0xdfa2('0x4c')](_0x5dd6a9);}})[_0xdfa2('0x26')](function(_0x45bebf){if(_0x45bebf){_0x3bfbac=_0x45bebf[_0xdfa2('0x35')];if(!_0xd02e28[_0xdfa2('0x30')][_0xdfa2('0x4e')]('nolimit')){_0x5dd6a9[_0xdfa2('0x21')]=qs[_0xdfa2('0x21')](_0xd02e28['query'][_0xdfa2('0x21')]);_0x5dd6a9[_0xdfa2('0x1e')]=qs[_0xdfa2('0x1e')](_0xd02e28[_0xdfa2('0x30')]['offset']);}return _0x27c014['getConfigurations'](_0x5dd6a9);}})[_0xdfa2('0x26')](function(_0x14162a){if(_0x14162a){return _0x14162a?{'count':_0x3bfbac,'rows':_0x14162a}:null;}})[_0xdfa2('0x26')](respondWithResult(_0x264e0e,null))['catch'](handleError(_0x264e0e,null));};exports[_0xdfa2('0x4f')]=function(_0x2de760,_0x877483,_0x4494e7){if(_0x2de760['body']['id']){delete _0x2de760[_0xdfa2('0x4a')]['id'];}return db[_0xdfa2('0x40')][_0xdfa2('0x50')]({'where':{'id':_0x2de760[_0xdfa2('0x45')]['id']}})[_0xdfa2('0x26')](handleEntityNotFound(_0x877483,null))[_0xdfa2('0x26')](function(_0x18b54f){if(_0x18b54f){_0x2de760[_0xdfa2('0x4a')][_0xdfa2('0x51')]=_0x18b54f['id'];_0x2de760[_0xdfa2('0x4a')][_0xdfa2('0x52')]=integrations[_0xdfa2('0x53')](_0x2de760['body'][_0xdfa2('0x54')],_0x2de760[_0xdfa2('0x4a')][_0xdfa2('0x3d')]);_0x2de760[_0xdfa2('0x4a')][_0xdfa2('0x55')]=integrations['getDescriptions'](_0x2de760[_0xdfa2('0x4a')][_0xdfa2('0x54')],_0x2de760[_0xdfa2('0x4a')][_0xdfa2('0x3d')]);return db[_0xdfa2('0x4d')]['create'](_0x2de760[_0xdfa2('0x4a')],{'include':[{'model':db['SalesforceField'],'as':_0xdfa2('0x52')},{'model':db['SalesforceField'],'as':_0xdfa2('0x55')}]});}return null;})[_0xdfa2('0x26')](respondWithResult(_0x877483,null))[_0xdfa2('0x48')](handleError(_0x877483,null));};exports[_0xdfa2('0x56')]=function(_0x3d2e69,_0x42d2a7,_0x5115e5){var _0x4e9fe7;var _0x1c66bd='';var _0x35fd37='Task';return db['SalesforceAccount'][_0xdfa2('0x50')]({'where':{'id':_0x3d2e69['params']['id']},'attributes':['id',_0xdfa2('0x57'),_0xdfa2('0x58'),_0xdfa2('0x59'),_0xdfa2('0x5a'),_0xdfa2('0x5b'),_0xdfa2('0x5c')]})[_0xdfa2('0x26')](handleEntityNotFound(_0x42d2a7,null))[_0xdfa2('0x26')](function(_0x59653a){if(_0x59653a){_0x1c66bd=_0x59653a[_0xdfa2('0x57')];var _0x433739=_0x1c66bd[_0xdfa2('0x5d')](-0x1);if(_0x433739==='/'){_0x1c66bd=_0x1c66bd['substring'](0x0,_0x1c66bd[_0xdfa2('0x5e')](_0x433739));}_0x4e9fe7=new jsforce[(_0xdfa2('0x5f'))]({'oauth2':{'loginUrl':_0x1c66bd,'clientId':_0x59653a[_0xdfa2('0x58')],'clientSecret':_0x59653a[_0xdfa2('0x59')]}});return _0x4e9fe7['login'](_0x59653a[_0xdfa2('0x5a')],_0x59653a[_0xdfa2('0x5b')]['concat'](_0x59653a[_0xdfa2('0x5c')]));}})[_0xdfa2('0x26')](function(_0x278d24){if(_0x278d24){if(!_[_0xdfa2('0x60')](_0x3d2e69[_0xdfa2('0x30')][_0xdfa2('0x61')])){_0x35fd37=_0x3d2e69[_0xdfa2('0x30')]['ticketType'];}return _0x4e9fe7['sobject'](_0x35fd37)['describe']();}})[_0xdfa2('0x26')](function(_0x488436){var _0x114eb4=[_0xdfa2('0x62'),_0xdfa2('0x63'),_0xdfa2('0x64'),'IsRecurrence',_0xdfa2('0x65'),'Description'];var _0x104a84=[_0xdfa2('0x66'),_0xdfa2('0x67'),'picklist',_0xdfa2('0x68'),_0xdfa2('0x69'),'textarea',_0xdfa2('0x6a')];if(_0x488436){_['remove'](_0x488436[_0xdfa2('0x34')],function(_0x4abe8a){return _0x114eb4['includes'](_0x4abe8a[_0xdfa2('0x28')])||!_0x104a84[_0xdfa2('0x6b')](_0x4abe8a[_0xdfa2('0x3d')]);});return{'count':_0x488436['fields'][_0xdfa2('0x35')],'rows':_[_0xdfa2('0x2b')](_0x488436[_0xdfa2('0x34')],function(_0x285d71){return{'id':_0x285d71[_0xdfa2('0x28')],'name':_0x285d71[_0xdfa2('0x6c')],'custom':_0x285d71[_0xdfa2('0x6d')],'options':_0x285d71[_0xdfa2('0x6e')][_0xdfa2('0x35')]>0x0?_[_0xdfa2('0x2b')](_0x285d71[_0xdfa2('0x6e')],function(_0x302523){return{'name':_0x302523[_0xdfa2('0x6c')],'value':_0x302523[_0xdfa2('0x6f')]};}):_0x285d71[_0xdfa2('0x3d')]==_0xdfa2('0x68')?[{'name':'True','value':_0xdfa2('0x70')},{'name':_0xdfa2('0x71'),'value':_0xdfa2('0x72')}]:[]};})};}})[_0xdfa2('0x26')](respondWithResult(_0x42d2a7,null))['catch'](function(_0x28c46e){var _0x3fc1aa=_0x3d2e69[_0xdfa2('0x30')][_0xdfa2('0x73')]?0x1f4:_0x28c46e[_0xdfa2('0x74')]||0x1f4;logger[_0xdfa2('0x27')](_0xdfa2('0x75'),'getFields',_0x3fc1aa,JSON['stringify'](_0x28c46e));delete _0x28c46e[_0xdfa2('0x28')];if(_0x3fc1aa===0x191){_0x3fc1aa=0x190;}_0x42d2a7[_0xdfa2('0x1b')](_0x3fc1aa)[_0xdfa2('0x29')](_0x3d2e69['query']['test']?{'message':_0xdfa2('0x76'),'statusCode':_0x28c46e[_0xdfa2('0x74')]}:_0x28c46e);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index bcad994..cae94d0 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 _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 +var _0x1393=['define','SalesforceAccount','util','../../config/logger','api','bluebird','request-promise','exports'];(function(_0x347d3c,_0x4d22cc){var _0x159a5b=function(_0x1cf87f){while(--_0x1cf87f){_0x347d3c['push'](_0x347d3c['shift']());}};_0x159a5b(++_0x4d22cc);}(_0x1393,0x92));var _0x3139=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x1393[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require('lodash');var util=require(_0x3139('0x0'));var logger=require(_0x3139('0x1'))(_0x3139('0x2'));var moment=require('moment');var BPromise=require(_0x3139('0x3'));var rp=require(_0x3139('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intSalesforceAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x3139('0x5')]=function(_0x5b11e5,_0x5f344d){return _0x5b11e5[_0x3139('0x6')](_0x3139('0x7'),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 3ef6b93..20d754d 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 _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 +var _0x1357=['result','catch','GetSalesforceAccount','SalesforceAccount','options','where','attributes','limit','include','model','map','stringify','find','raw','ShowSalesforceAccount','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','message','info'];(function(_0x5c8084,_0xd1d821){var _0x199433=function(_0x5c63a2){while(--_0x5c63a2){_0x5c8084['push'](_0x5c8084['shift']());}};_0x199433(++_0xd1d821);}(_0x1357,0x1b3));var _0x7135=function(_0x175bd2,_0x222445){_0x175bd2=_0x175bd2-0x0;var _0x53b4a0=_0x1357[_0x175bd2];return _0x53b4a0;};'use strict';var _=require(_0x7135('0x0'));var util=require(_0x7135('0x1'));var moment=require(_0x7135('0x2'));var BPromise=require('bluebird');var rs=require(_0x7135('0x3'));var fs=require('fs');var Redis=require(_0x7135('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7135('0x5'));var logger=require(_0x7135('0x6'))('rpc');var config=require(_0x7135('0x7'));var jayson=require(_0x7135('0x8'));var client=jayson[_0x7135('0x9')][_0x7135('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa17981,_0x4d4948,_0x1457df){return new BPromise(function(_0x53d27c,_0x4f8476){return client[_0x7135('0xb')](_0xa17981,_0x1457df)[_0x7135('0xc')](function(_0x13b2d5){logger['info'](_0x7135('0xd'),_0x4d4948,_0x7135('0xe'));logger[_0x7135('0xf')](_0x7135('0x10'),_0x4d4948,_0x7135('0xe'),JSON['stringify'](_0x13b2d5));if(_0x13b2d5['error']){if(_0x13b2d5[_0x7135('0x11')]['code']===0x1f4){logger[_0x7135('0x11')](_0x7135('0xd'),_0x4d4948,_0x13b2d5['error'][_0x7135('0x12')]);return _0x4f8476(_0x13b2d5[_0x7135('0x11')][_0x7135('0x12')]);}logger[_0x7135('0x11')](_0x7135('0xd'),_0x4d4948,_0x13b2d5[_0x7135('0x11')]['message']);return _0x53d27c(_0x13b2d5[_0x7135('0x11')][_0x7135('0x12')]);}else{logger[_0x7135('0x13')](_0x7135('0xd'),_0x4d4948,_0x7135('0xe'));_0x53d27c(_0x13b2d5[_0x7135('0x14')][_0x7135('0x12')]);}})[_0x7135('0x15')](function(_0x25744c){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x4d4948,_0x25744c);_0x4f8476(_0x25744c);});});}exports[_0x7135('0x16')]=function(_0x301d18){var _0x43799d=this;return new Promise(function(_0x3f3c5b,_0x32de94){return db[_0x7135('0x17')]['findAll']({'raw':_0x301d18[_0x7135('0x18')]?_0x301d18['options']['raw']===undefined?!![]:![]:!![],'where':_0x301d18[_0x7135('0x18')]?_0x301d18[_0x7135('0x18')][_0x7135('0x19')]||null:null,'attributes':_0x301d18[_0x7135('0x18')]?_0x301d18[_0x7135('0x18')][_0x7135('0x1a')]||null:null,'limit':_0x301d18[_0x7135('0x18')]?_0x301d18[_0x7135('0x18')][_0x7135('0x1b')]||null:null,'include':_0x301d18[_0x7135('0x18')]?_0x301d18[_0x7135('0x18')][_0x7135('0x1c')]?_['map'](_0x301d18[_0x7135('0x18')][_0x7135('0x1c')],function(_0x27a4bf){return{'model':db[_0x27a4bf[_0x7135('0x1d')]],'as':_0x27a4bf['as'],'attributes':_0x27a4bf[_0x7135('0x1a')],'include':_0x27a4bf[_0x7135('0x1c')]?_[_0x7135('0x1e')](_0x27a4bf['include'],function(_0x5c02cd){return{'model':db[_0x5c02cd[_0x7135('0x1d')]],'as':_0x5c02cd['as'],'attributes':_0x5c02cd[_0x7135('0x1a')],'include':_0x5c02cd[_0x7135('0x1c')]?_['map'](_0x5c02cd['include'],function(_0x47d1ce){return{'model':db[_0x47d1ce[_0x7135('0x1d')]],'as':_0x47d1ce['as'],'attributes':_0x47d1ce['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x147ac4){logger[_0x7135('0x13')](_0x7135('0x16'),_0x301d18);logger[_0x7135('0xf')]('GetSalesforceAccount',_0x301d18,JSON[_0x7135('0x1f')](_0x147ac4));_0x3f3c5b(_0x147ac4);})['catch'](function(_0x2f2dbd){logger[_0x7135('0x11')](_0x7135('0x16'),_0x2f2dbd[_0x7135('0x12')],_0x301d18);_0x32de94(_0x43799d['error'](0x1f4,_0x2f2dbd[_0x7135('0x12')]));});});};exports['ShowSalesforceAccount']=function(_0x34cfac){var _0x481a4f=this;return new Promise(function(_0x1afe4c,_0x3d6b58){return db[_0x7135('0x17')][_0x7135('0x20')]({'raw':_0x34cfac[_0x7135('0x18')]?_0x34cfac['options'][_0x7135('0x21')]===undefined?!![]:![]:!![],'where':_0x34cfac[_0x7135('0x18')]?_0x34cfac[_0x7135('0x18')]['where']||null:null,'attributes':_0x34cfac[_0x7135('0x18')]?_0x34cfac[_0x7135('0x18')]['attributes']||null:null,'include':_0x34cfac[_0x7135('0x18')]?_0x34cfac[_0x7135('0x18')]['include']?_[_0x7135('0x1e')](_0x34cfac[_0x7135('0x18')][_0x7135('0x1c')],function(_0x484627){return{'model':db[_0x484627[_0x7135('0x1d')]],'as':_0x484627['as'],'attributes':_0x484627['attributes'],'include':_0x484627['include']?_[_0x7135('0x1e')](_0x484627[_0x7135('0x1c')],function(_0x201733){return{'model':db[_0x201733[_0x7135('0x1d')]],'as':_0x201733['as'],'attributes':_0x201733[_0x7135('0x1a')],'include':_0x201733[_0x7135('0x1c')]?_[_0x7135('0x1e')](_0x201733[_0x7135('0x1c')],function(_0x466ff9){return{'model':db[_0x466ff9[_0x7135('0x1d')]],'as':_0x466ff9['as'],'attributes':_0x466ff9[_0x7135('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x7135('0xc')](function(_0x17b92c){logger[_0x7135('0x13')]('ShowSalesforceAccount',_0x34cfac);logger[_0x7135('0xf')](_0x7135('0x22'),_0x34cfac,JSON[_0x7135('0x1f')](_0x17b92c));_0x1afe4c(_0x17b92c);})[_0x7135('0x15')](function(_0x2287eb){logger[_0x7135('0x11')](_0x7135('0x22'),_0x2287eb[_0x7135('0x12')],_0x34cfac);_0x3d6b58(_0x481a4f[_0x7135('0x11')](0x1f4,_0x2287eb[_0x7135('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index d4931da..87d0201 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','put','update','delete','destroy','exports','util','connect-timeout'];(function(_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 +var _0x0b0e=['post','create','put','/:id','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions'];(function(_0x3a6efd,_0x2a5102){var _0x487b9a=function(_0x104f89){while(--_0x104f89){_0x3a6efd['push'](_0x3a6efd['shift']());}};_0x487b9a(++_0x2a5102);}(_0x0b0e,0x187));var _0xe0b0=function(_0x16ecad,_0x205047){_0x16ecad=_0x16ecad-0x0;var _0x313ff7=_0x0b0e[_0x16ecad];return _0x313ff7;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['getFields']);router[_0xe0b0('0x9')](_0xe0b0('0xe'),auth['isAuthenticated'](),controller[_0xe0b0('0xf')]);router[_0xe0b0('0x9')]('/:id/descriptions',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x11')]('/',auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x15')]);router['delete'](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x16')]);module[_0xe0b0('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 24dde8d..36822e4 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 _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 +var _0x6cdd=['ENUM','Task','Case','contact_lead','lead','account_contact_lead','account','nothing','contact','exports','STRING'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0x6cdd,0x8d));var _0xd6cd=function(_0x2f85c5,_0x406274){_0x2f85c5=_0x2f85c5-0x0;var _0x141bba=_0x6cdd[_0x2f85c5];return _0x141bba;};'use strict';var Sequelize=require('sequelize');module[_0xd6cd('0x0')]={'name':{'type':Sequelize[_0xd6cd('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0xd6cd('0x2')](_0xd6cd('0x3'),_0xd6cd('0x4')),'defaultValue':_0xd6cd('0x3')},'moduleSearch':{'type':Sequelize[_0xd6cd('0x2')](_0xd6cd('0x5'),'contact',_0xd6cd('0x6'),_0xd6cd('0x7'),_0xd6cd('0x8')),'defaultValue':_0xd6cd('0x5')},'moduleCreate':{'type':Sequelize[_0xd6cd('0x2')](_0xd6cd('0x9'),_0xd6cd('0xa'),_0xd6cd('0x6'),_0xd6cd('0x8')),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0xd6cd('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0xd6cd('0x1')]},'additionalSearchContact':{'type':Sequelize[_0xd6cd('0x1')]},'additionalSearchLead':{'type':Sequelize[_0xd6cd('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 07b7f8b..d21d99a 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 _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 +var _0x1670=['desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','rawAttributes','fieldName','type','map','keys','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','SalesforceConfiguration','includeAll','include','findAll','rows','show','create','body','find','params','catch','getFields','findOne','hasOwnProperty','getSubjects','getDescriptions','SalesforceField','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x4eb096,_0x3d9fff){var _0x32927f=function(_0x4e0455){while(--_0x4e0455){_0x4eb096['push'](_0x4eb096['shift']());}};_0x32927f(++_0x3d9fff);}(_0x1670,0x9a));var _0x0167=function(_0xe91974,_0x2c1424){_0xe91974=_0xe91974-0x0;var _0x56740e=_0x1670[_0xe91974];return _0x56740e;};'use strict';var emlformat=require(_0x0167('0x0'));var rimraf=require(_0x0167('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0167('0x2'));var rp=require('request-promise');var moment=require(_0x0167('0x3'));var BPromise=require(_0x0167('0x4'));var Mustache=require(_0x0167('0x5'));var util=require(_0x0167('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0167('0x7'));var ejs=require(_0x0167('0x8'));var fs=require('fs');var fs_extra=require(_0x0167('0x9'));var _=require(_0x0167('0xa'));var squel=require(_0x0167('0xb'));var crypto=require(_0x0167('0xc'));var jsforce=require(_0x0167('0xd'));var deskjs=require(_0x0167('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0167('0xf'));var Redis=require(_0x0167('0x10'));var authService=require(_0x0167('0x11'));var qs=require(_0x0167('0x12'));var as=require(_0x0167('0x13'));var hardwareService=require(_0x0167('0x14'));var logger=require(_0x0167('0x15'))(_0x0167('0x16'));var utils=require(_0x0167('0x17'));var config=require(_0x0167('0x18'));var licenseUtil=require(_0x0167('0x19'));var db=require(_0x0167('0x1a'))['db'];function respondWithStatusCode(_0x34ac02,_0x2ebfa3){_0x2ebfa3=_0x2ebfa3||0xcc;return function(_0x570965){if(_0x570965){return _0x34ac02[_0x0167('0x1b')](_0x2ebfa3);}return _0x34ac02['status'](_0x2ebfa3)[_0x0167('0x1c')]();};}function respondWithResult(_0x5eb5f9,_0x7744d1){_0x7744d1=_0x7744d1||0xc8;return function(_0x39e644){if(_0x39e644){return _0x5eb5f9[_0x0167('0x1d')](_0x7744d1)['json'](_0x39e644);}};}function respondWithFilteredResult(_0x50c1a3,_0x547dea){return function(_0x2eeaa7){if(_0x2eeaa7){var _0x7ae6e7=typeof _0x547dea['offset']===_0x0167('0x1e')&&typeof _0x547dea['limit']==='undefined';var _0x38f934=_0x2eeaa7['count'];var _0x22f07c=_0x7ae6e7?0x0:_0x547dea['offset'];var _0x16094a=_0x7ae6e7?_0x2eeaa7[_0x0167('0x1f')]:_0x547dea[_0x0167('0x20')]+_0x547dea[_0x0167('0x21')];var _0xc3f9fe;if(_0x16094a>=_0x38f934){_0x16094a=_0x38f934;_0xc3f9fe=0xc8;}else{_0xc3f9fe=0xce;}_0x50c1a3[_0x0167('0x1d')](_0xc3f9fe);return _0x50c1a3[_0x0167('0x22')](_0x0167('0x23'),_0x22f07c+'-'+_0x16094a+'/'+_0x38f934)[_0x0167('0x24')](_0x2eeaa7);}return null;};}function patchUpdates(_0x7c626){return function(_0x221d7c){try{jsonpatch[_0x0167('0x25')](_0x221d7c,_0x7c626,!![]);}catch(_0x5ba3d0){return BPromise[_0x0167('0x26')](_0x5ba3d0);}return _0x221d7c[_0x0167('0x27')]();};}function saveUpdates(_0x2375ff,_0x480245){return function(_0x2f69c3){if(_0x2f69c3){return _0x2f69c3[_0x0167('0x28')](_0x2375ff)[_0x0167('0x29')](function(_0x3c0a58){return _0x3c0a58;});}return null;};}function removeEntity(_0x5d25df,_0x38e811){return function(_0x4e8618){if(_0x4e8618){return _0x4e8618[_0x0167('0x2a')]()[_0x0167('0x29')](function(){_0x5d25df[_0x0167('0x1d')](0xcc)[_0x0167('0x1c')]();});}};}function handleEntityNotFound(_0x46231b,_0x41c8f9){return function(_0x31c5eb){if(!_0x31c5eb){_0x46231b['sendStatus'](0x194);}return _0x31c5eb;};}function handleError(_0x358b97,_0x436865){_0x436865=_0x436865||0x1f4;return function(_0x23a863){logger['error'](_0x23a863[_0x0167('0x2b')]);if(_0x23a863[_0x0167('0x2c')]){delete _0x23a863['name'];}_0x358b97[_0x0167('0x1d')](_0x436865)[_0x0167('0x2d')](_0x23a863);};}exports['index']=function(_0x31bbdc,_0x44dd56){var _0x4179d4={},_0x5610ef={},_0x210a3d={'count':0x0,'rows':[]};var _0x39b105=_['map'](db['SalesforceConfiguration'][_0x0167('0x2e')],function(_0x124763){return{'name':_0x124763[_0x0167('0x2f')],'type':_0x124763[_0x0167('0x30')]['key']};});_0x5610ef['model']=_[_0x0167('0x31')](_0x39b105,'name');_0x5610ef['query']=_[_0x0167('0x32')](_0x31bbdc[_0x0167('0x33')]);_0x5610ef[_0x0167('0x34')]=_[_0x0167('0x35')](_0x5610ef[_0x0167('0x36')],_0x5610ef[_0x0167('0x33')]);_0x4179d4[_0x0167('0x37')]=_['intersection'](_0x5610ef['model'],qs[_0x0167('0x38')](_0x31bbdc[_0x0167('0x33')][_0x0167('0x38')]));_0x4179d4[_0x0167('0x37')]=_0x4179d4[_0x0167('0x37')][_0x0167('0x39')]?_0x4179d4['attributes']:_0x5610ef[_0x0167('0x36')];if(!_0x31bbdc['query']['hasOwnProperty'](_0x0167('0x3a'))){_0x4179d4[_0x0167('0x21')]=qs[_0x0167('0x21')](_0x31bbdc['query'][_0x0167('0x21')]);_0x4179d4[_0x0167('0x20')]=qs[_0x0167('0x20')](_0x31bbdc[_0x0167('0x33')]['offset']);}_0x4179d4[_0x0167('0x3b')]=qs[_0x0167('0x3c')](_0x31bbdc[_0x0167('0x33')]['sort']);_0x4179d4[_0x0167('0x3d')]=qs[_0x0167('0x34')](_[_0x0167('0x3e')](_0x31bbdc[_0x0167('0x33')],_0x5610ef[_0x0167('0x34')]),_0x39b105);if(_0x31bbdc['query'][_0x0167('0x3f')]){_0x4179d4[_0x0167('0x3d')]=_['merge'](_0x4179d4[_0x0167('0x3d')],{'$or':_[_0x0167('0x31')](_0x39b105,function(_0x179f4d){if(_0x179f4d[_0x0167('0x30')]!==_0x0167('0x40')){var _0xfcc906={};_0xfcc906[_0x179f4d['name']]={'$like':'%'+_0x31bbdc[_0x0167('0x33')][_0x0167('0x3f')]+'%'};return _0xfcc906;}})});}_0x4179d4=_[_0x0167('0x41')]({},_0x4179d4,_0x31bbdc[_0x0167('0x42')]);var _0x49dc4d={'where':_0x4179d4[_0x0167('0x3d')]};return db[_0x0167('0x43')]['count'](_0x49dc4d)[_0x0167('0x29')](function(_0x3c393a){_0x210a3d[_0x0167('0x1f')]=_0x3c393a;if(_0x31bbdc['query'][_0x0167('0x44')]){_0x4179d4[_0x0167('0x45')]=[{'all':!![]}];}return db[_0x0167('0x43')][_0x0167('0x46')](_0x4179d4);})[_0x0167('0x29')](function(_0x42183d){_0x210a3d[_0x0167('0x47')]=_0x42183d;return _0x210a3d;})[_0x0167('0x29')](respondWithFilteredResult(_0x44dd56,_0x4179d4))['catch'](handleError(_0x44dd56,null));};exports[_0x0167('0x48')]=function(_0x47d862,_0x45f0d5){var _0x237969={'raw':![],'where':{'id':_0x47d862['params']['id']}},_0x31d3da={};_0x31d3da['model']=_['keys'](db[_0x0167('0x43')][_0x0167('0x2e')]);_0x31d3da[_0x0167('0x33')]=_[_0x0167('0x32')](_0x47d862[_0x0167('0x33')]);_0x31d3da[_0x0167('0x34')]=_['intersection'](_0x31d3da['model'],_0x31d3da['query']);_0x237969[_0x0167('0x37')]=_['intersection'](_0x31d3da[_0x0167('0x36')],qs[_0x0167('0x38')](_0x47d862[_0x0167('0x33')][_0x0167('0x38')]));_0x237969['attributes']=_0x237969[_0x0167('0x37')][_0x0167('0x39')]?_0x237969[_0x0167('0x37')]:_0x31d3da[_0x0167('0x36')];if(_0x47d862[_0x0167('0x33')][_0x0167('0x44')]){_0x237969[_0x0167('0x45')]=[{'all':!![]}];}_0x237969=_[_0x0167('0x41')]({},_0x237969,_0x47d862[_0x0167('0x42')]);return db[_0x0167('0x43')]['find'](_0x237969)['then'](handleEntityNotFound(_0x45f0d5,null))[_0x0167('0x29')](respondWithResult(_0x45f0d5,null))['catch'](handleError(_0x45f0d5,null));};exports[_0x0167('0x49')]=function(_0x4d9315,_0x2c3efc){return db['SalesforceConfiguration'][_0x0167('0x49')](_0x4d9315[_0x0167('0x4a')],{})['then'](respondWithResult(_0x2c3efc,0xc9))['catch'](handleError(_0x2c3efc,null));};exports['update']=function(_0x174a7a,_0x55aaa0){if(_0x174a7a['body']['id']){delete _0x174a7a[_0x0167('0x4a')]['id'];}return db['SalesforceConfiguration'][_0x0167('0x4b')]({'where':{'id':_0x174a7a[_0x0167('0x4c')]['id']}})[_0x0167('0x29')](handleEntityNotFound(_0x55aaa0,null))['then'](saveUpdates(_0x174a7a[_0x0167('0x4a')],null))['then'](respondWithResult(_0x55aaa0,null))['catch'](handleError(_0x55aaa0,null));};exports['destroy']=function(_0xecc47d,_0x396c91){return db[_0x0167('0x43')][_0x0167('0x4b')]({'where':{'id':_0xecc47d[_0x0167('0x4c')]['id']}})['then'](handleEntityNotFound(_0x396c91,null))[_0x0167('0x29')](removeEntity(_0x396c91,null))[_0x0167('0x4d')](handleError(_0x396c91,null));};exports[_0x0167('0x4e')]=function(_0x441b4e,_0x5af280,_0x59d846){var _0x19af14={};var _0x5b3ffd={};var _0x3a9e01;var _0x1deb9c;return db[_0x0167('0x43')][_0x0167('0x4f')]({'where':{'id':_0x441b4e[_0x0167('0x4c')]['id']}})[_0x0167('0x29')](handleEntityNotFound(_0x5af280,null))[_0x0167('0x29')](function(_0xcd0908){if(_0xcd0908){_0x3a9e01=_0xcd0908;_0x5b3ffd[_0x0167('0x36')]=_[_0x0167('0x32')](db['SalesforceField']['rawAttributes']);_0x5b3ffd[_0x0167('0x33')]=_['keys'](_0x441b4e[_0x0167('0x33')]);_0x5b3ffd[_0x0167('0x34')]=_['intersection'](_0x5b3ffd[_0x0167('0x36')],_0x5b3ffd[_0x0167('0x33')]);_0x19af14['attributes']=_[_0x0167('0x35')](_0x5b3ffd[_0x0167('0x36')],qs[_0x0167('0x38')](_0x441b4e[_0x0167('0x33')]['fields']));_0x19af14[_0x0167('0x37')]=_0x19af14[_0x0167('0x37')][_0x0167('0x39')]?_0x19af14['attributes']:_0x5b3ffd[_0x0167('0x36')];_0x19af14[_0x0167('0x3b')]=qs[_0x0167('0x3c')](_0x441b4e[_0x0167('0x33')][_0x0167('0x3c')]);_0x19af14[_0x0167('0x3d')]=qs[_0x0167('0x34')](_[_0x0167('0x3e')](_0x441b4e[_0x0167('0x33')],_0x5b3ffd['filters']));if(_0x441b4e[_0x0167('0x33')][_0x0167('0x3f')]){_0x19af14[_0x0167('0x3d')]=_[_0x0167('0x41')](_0x19af14[_0x0167('0x3d')],{'$or':_[_0x0167('0x31')](_0x19af14['attributes'],function(_0x1f160c){var _0x4da582={};_0x4da582[_0x1f160c]={'$like':'%'+_0x441b4e['query']['filter']+'%'};return _0x4da582;})});}_0x19af14=_[_0x0167('0x41')]({},_0x19af14,_0x441b4e[_0x0167('0x42')]);return _0x3a9e01[_0x0167('0x4e')](_0x19af14);}})[_0x0167('0x29')](function(_0x4546f0){if(_0x4546f0){_0x1deb9c=_0x4546f0['length'];if(!_0x441b4e[_0x0167('0x33')][_0x0167('0x50')]('nolimit')){_0x19af14[_0x0167('0x21')]=qs[_0x0167('0x21')](_0x441b4e[_0x0167('0x33')][_0x0167('0x21')]);_0x19af14['offset']=qs['offset'](_0x441b4e[_0x0167('0x33')][_0x0167('0x20')]);}return _0x3a9e01[_0x0167('0x4e')](_0x19af14);}})[_0x0167('0x29')](function(_0xd24cbd){if(_0xd24cbd){return _0xd24cbd?{'count':_0x1deb9c,'rows':_0xd24cbd}:null;}})[_0x0167('0x29')](respondWithResult(_0x5af280,null))[_0x0167('0x4d')](handleError(_0x5af280,null));};exports[_0x0167('0x51')]=function(_0x2227ef,_0x3b5c80,_0x5ed240){var _0x385040={};var _0x127f95={};var _0x44fd93;var _0x3cd485;return db[_0x0167('0x43')][_0x0167('0x4f')]({'where':{'id':_0x2227ef[_0x0167('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3b5c80,null))[_0x0167('0x29')](function(_0x926b99){if(_0x926b99){_0x44fd93=_0x926b99;_0x127f95['model']=_[_0x0167('0x32')](db['SalesforceField'][_0x0167('0x2e')]);_0x127f95[_0x0167('0x33')]=_[_0x0167('0x32')](_0x2227ef['query']);_0x127f95[_0x0167('0x34')]=_[_0x0167('0x35')](_0x127f95['model'],_0x127f95[_0x0167('0x33')]);_0x385040['attributes']=_[_0x0167('0x35')](_0x127f95['model'],qs[_0x0167('0x38')](_0x2227ef[_0x0167('0x33')]['fields']));_0x385040[_0x0167('0x37')]=_0x385040[_0x0167('0x37')][_0x0167('0x39')]?_0x385040[_0x0167('0x37')]:_0x127f95['model'];_0x385040['order']=qs[_0x0167('0x3c')](_0x2227ef[_0x0167('0x33')][_0x0167('0x3c')]);_0x385040[_0x0167('0x3d')]=qs['filters'](_[_0x0167('0x3e')](_0x2227ef['query'],_0x127f95[_0x0167('0x34')]));if(_0x2227ef['query']['filter']){_0x385040[_0x0167('0x3d')]=_[_0x0167('0x41')](_0x385040[_0x0167('0x3d')],{'$or':_[_0x0167('0x31')](_0x385040['attributes'],function(_0x2bc03c){var _0x5b3c96={};_0x5b3c96[_0x2bc03c]={'$like':'%'+_0x2227ef[_0x0167('0x33')][_0x0167('0x3f')]+'%'};return _0x5b3c96;})});}_0x385040=_[_0x0167('0x41')]({},_0x385040,_0x2227ef[_0x0167('0x42')]);return _0x44fd93[_0x0167('0x51')](_0x385040);}})[_0x0167('0x29')](function(_0x2da1f0){if(_0x2da1f0){_0x3cd485=_0x2da1f0['length'];if(!_0x2227ef[_0x0167('0x33')]['hasOwnProperty'](_0x0167('0x3a'))){_0x385040[_0x0167('0x21')]=qs['limit'](_0x2227ef['query']['limit']);_0x385040[_0x0167('0x20')]=qs[_0x0167('0x20')](_0x2227ef['query']['offset']);}return _0x44fd93[_0x0167('0x51')](_0x385040);}})[_0x0167('0x29')](function(_0x546ce9){if(_0x546ce9){return _0x546ce9?{'count':_0x3cd485,'rows':_0x546ce9}:null;}})[_0x0167('0x29')](respondWithResult(_0x3b5c80,null))[_0x0167('0x4d')](handleError(_0x3b5c80,null));};exports[_0x0167('0x52')]=function(_0x30d32e,_0x426bf4,_0x3c0bca){var _0x54a216={};var _0x25b543={};var _0x133cbb;var _0x5cd4b1;return db[_0x0167('0x43')][_0x0167('0x4f')]({'where':{'id':_0x30d32e[_0x0167('0x4c')]['id']}})[_0x0167('0x29')](handleEntityNotFound(_0x426bf4,null))[_0x0167('0x29')](function(_0x55c5d0){if(_0x55c5d0){_0x133cbb=_0x55c5d0;_0x25b543['model']=_['keys'](db[_0x0167('0x53')][_0x0167('0x2e')]);_0x25b543[_0x0167('0x33')]=_[_0x0167('0x32')](_0x30d32e[_0x0167('0x33')]);_0x25b543['filters']=_[_0x0167('0x35')](_0x25b543[_0x0167('0x36')],_0x25b543[_0x0167('0x33')]);_0x54a216[_0x0167('0x37')]=_[_0x0167('0x35')](_0x25b543[_0x0167('0x36')],qs['fields'](_0x30d32e['query'][_0x0167('0x38')]));_0x54a216[_0x0167('0x37')]=_0x54a216['attributes'][_0x0167('0x39')]?_0x54a216[_0x0167('0x37')]:_0x25b543[_0x0167('0x36')];_0x54a216[_0x0167('0x3b')]=qs[_0x0167('0x3c')](_0x30d32e[_0x0167('0x33')][_0x0167('0x3c')]);_0x54a216[_0x0167('0x3d')]=qs['filters'](_[_0x0167('0x3e')](_0x30d32e[_0x0167('0x33')],_0x25b543[_0x0167('0x34')]));if(_0x30d32e[_0x0167('0x33')][_0x0167('0x3f')]){_0x54a216[_0x0167('0x3d')]=_[_0x0167('0x41')](_0x54a216['where'],{'$or':_[_0x0167('0x31')](_0x54a216[_0x0167('0x37')],function(_0x4bf055){var _0x54866e={};_0x54866e[_0x4bf055]={'$like':'%'+_0x30d32e[_0x0167('0x33')][_0x0167('0x3f')]+'%'};return _0x54866e;})});}_0x54a216=_[_0x0167('0x41')]({},_0x54a216,_0x30d32e[_0x0167('0x42')]);return _0x133cbb['getDescriptions'](_0x54a216);}})['then'](function(_0x15e0a5){if(_0x15e0a5){_0x5cd4b1=_0x15e0a5['length'];if(!_0x30d32e['query'][_0x0167('0x50')](_0x0167('0x3a'))){_0x54a216['limit']=qs['limit'](_0x30d32e[_0x0167('0x33')]['limit']);_0x54a216[_0x0167('0x20')]=qs[_0x0167('0x20')](_0x30d32e[_0x0167('0x33')][_0x0167('0x20')]);}return _0x133cbb[_0x0167('0x52')](_0x54a216);}})[_0x0167('0x29')](function(_0x189f8a){if(_0x189f8a){return _0x189f8a?{'count':_0x5cd4b1,'rows':_0x189f8a}:null;}})[_0x0167('0x29')](respondWithResult(_0x426bf4,null))[_0x0167('0x4d')](handleError(_0x426bf4,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 039c028..db165b7 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 _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 +var _0xdff8=['util','../../config/logger','api','bluebird','rimraf','./intSalesforceConfiguration.attributes','define','SalesforceConfiguration','lodash'];(function(_0x3cd451,_0x26e81a){var _0x571ce6=function(_0x27af9e){while(--_0x27af9e){_0x3cd451['push'](_0x3cd451['shift']());}};_0x571ce6(++_0x26e81a);}(_0xdff8,0x19d));var _0x8dff=function(_0x1237b5,_0x4786ad){_0x1237b5=_0x1237b5-0x0;var _0x5a2b68=_0xdff8[_0x1237b5];return _0x5a2b68;};'use strict';var _=require(_0x8dff('0x0'));var util=require(_0x8dff('0x1'));var logger=require(_0x8dff('0x2'))(_0x8dff('0x3'));var moment=require('moment');var BPromise=require(_0x8dff('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8dff('0x5'));var config=require('../../config/environment');var attributes=require(_0x8dff('0x6'));module['exports']=function(_0x1bd78c,_0x9d3a64){return _0x1bd78c[_0x8dff('0x7')](_0x8dff('0x8'),attributes,{'tableName':'int_salesforce_configurations','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 9de2493..e9d3923 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 _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 +var _0xabce=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','SalesforceConfiguration,\x20%s,\x20%s','message','info','catch','lodash','util','ioredis'];(function(_0x545e86,_0x46a2ed){var _0xa98055=function(_0x41aa23){while(--_0x41aa23){_0x545e86['push'](_0x545e86['shift']());}};_0xa98055(++_0x46a2ed);}(_0xabce,0x69));var _0xeabc=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0xabce[_0x15bc81];return _0x59440e;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeabc('0x2'));var db=require(_0xeabc('0x3'))['db'];var utils=require(_0xeabc('0x4'));var logger=require(_0xeabc('0x5'))('rpc');var config=require(_0xeabc('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xeabc('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xd461ed,_0x10deda,_0x12e2b6){return new BPromise(function(_0xb820bf,_0x181841){return client[_0xeabc('0x8')](_0xd461ed,_0x12e2b6)[_0xeabc('0x9')](function(_0x2c1dba){logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x10deda,_0xeabc('0xa'));logger[_0xeabc('0xb')](_0xeabc('0xc'),_0x10deda,'request\x20sent',JSON['stringify'](_0x2c1dba));if(_0x2c1dba['error']){if(_0x2c1dba[_0xeabc('0xd')]['code']===0x1f4){logger['error'](_0xeabc('0xe'),_0x10deda,_0x2c1dba[_0xeabc('0xd')][_0xeabc('0xf')]);return _0x181841(_0x2c1dba[_0xeabc('0xd')][_0xeabc('0xf')]);}logger[_0xeabc('0xd')](_0xeabc('0xe'),_0x10deda,_0x2c1dba['error'][_0xeabc('0xf')]);return _0xb820bf(_0x2c1dba[_0xeabc('0xd')]['message']);}else{logger[_0xeabc('0x10')](_0xeabc('0xe'),_0x10deda,_0xeabc('0xa'));_0xb820bf(_0x2c1dba['result'][_0xeabc('0xf')]);}})[_0xeabc('0x11')](function(_0x535b76){logger[_0xeabc('0xd')](_0xeabc('0xe'),_0x10deda,_0x535b76);_0x181841(_0x535b76);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 6353d0a..ff3aaac 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 _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 +var _0xb7c9=['fs-extra','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','index','/:id','isAuthenticated','show','put','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0xb7c9,0x8b));var _0x9b7c=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0xb7c9[_0x411017];return _0x2adeea;};'use strict';var multer=require(_0x9b7c('0x0'));var util=require(_0x9b7c('0x1'));var path=require(_0x9b7c('0x2'));var timeout=require('connect-timeout');var express=require(_0x9b7c('0x3'));var router=express[_0x9b7c('0x4')]();var fs_extra=require(_0x9b7c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9b7c('0x6'));var config=require(_0x9b7c('0x7'));var controller=require(_0x9b7c('0x8'));router[_0x9b7c('0x9')]('/',auth['isAuthenticated'](),controller[_0x9b7c('0xa')]);router['get'](_0x9b7c('0xb'),auth[_0x9b7c('0xc')](),controller[_0x9b7c('0xd')]);router['post']('/',auth[_0x9b7c('0xc')](),controller['create']);router[_0x9b7c('0xe')](_0x9b7c('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x9b7c('0xf')](_0x9b7c('0xb'),auth[_0x9b7c('0xc')](),controller[_0x9b7c('0x10')]);module[_0x9b7c('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 13ad121..0accbdb 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 _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 +var _0xe5d9=['STRING','ENUM','variable','customVariable','exports','string','keyValue','picklist'];(function(_0x375072,_0x1ad2ed){var _0x3e82e7=function(_0x2a03ec){while(--_0x2a03ec){_0x375072['push'](_0x375072['shift']());}};_0x3e82e7(++_0x1ad2ed);}(_0xe5d9,0x1c4));var _0x9e5d=function(_0x39cc09,_0x500de7){_0x39cc09=_0x39cc09-0x0;var _0x10eadd=_0xe5d9[_0x39cc09];return _0x10eadd;};'use strict';var Sequelize=require('sequelize');module[_0x9e5d('0x0')]={'type':{'type':Sequelize['ENUM'](_0x9e5d('0x1'),'variable','customVariable',_0x9e5d('0x2'),_0x9e5d('0x3')),'defaultValue':_0x9e5d('0x1')},'content':{'type':Sequelize[_0x9e5d('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x9e5d('0x5')](_0x9e5d('0x1'),_0x9e5d('0x6'),_0x9e5d('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x9e5d('0x4')]},'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 001df72..80ad23e 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 _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 +var _0xc6d2=['name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','SalesforceField','findAll','catch','show','params','create','body','find','eml-format','rimraf','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','count','limit','Content-Range','json','apply','reject','save','update','destroy','then','sendStatus','error','stack'];(function(_0x36e2f9,_0x257de5){var _0x567768=function(_0x37f7b1){while(--_0x37f7b1){_0x36e2f9['push'](_0x36e2f9['shift']());}};_0x567768(++_0x257de5);}(_0xc6d2,0xb5));var _0x2c6d=function(_0x39b989,_0x58efc7){_0x39b989=_0x39b989-0x0;var _0x588ac6=_0xc6d2[_0x39b989];return _0x588ac6;};'use strict';var emlformat=require(_0x2c6d('0x0'));var rimraf=require(_0x2c6d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2c6d('0x2'));var path=require(_0x2c6d('0x3'));var sox=require(_0x2c6d('0x4'));var csv=require(_0x2c6d('0x5'));var ejs=require(_0x2c6d('0x6'));var fs=require('fs');var fs_extra=require(_0x2c6d('0x7'));var _=require(_0x2c6d('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2c6d('0x9'));var deskjs=require(_0x2c6d('0xa'));var toCsv=require(_0x2c6d('0x5'));var querystring=require(_0x2c6d('0xb'));var Papa=require(_0x2c6d('0xc'));var Redis=require('ioredis');var authService=require(_0x2c6d('0xd'));var qs=require(_0x2c6d('0xe'));var as=require(_0x2c6d('0xf'));var hardwareService=require(_0x2c6d('0x10'));var logger=require(_0x2c6d('0x11'))('api');var utils=require(_0x2c6d('0x12'));var config=require(_0x2c6d('0x13'));var licenseUtil=require(_0x2c6d('0x14'));var db=require(_0x2c6d('0x15'))['db'];function respondWithStatusCode(_0x5361bc,_0x2275dc){_0x2275dc=_0x2275dc||0xcc;return function(_0x47b2dd){if(_0x47b2dd){return _0x5361bc['sendStatus'](_0x2275dc);}return _0x5361bc['status'](_0x2275dc)['end']();};}function respondWithResult(_0x1c22c4,_0x48b11e){_0x48b11e=_0x48b11e||0xc8;return function(_0x9637e){if(_0x9637e){return _0x1c22c4[_0x2c6d('0x16')](_0x48b11e)['json'](_0x9637e);}};}function respondWithFilteredResult(_0x1727b6,_0x34daca){return function(_0x4177ed){if(_0x4177ed){var _0xdf70df=typeof _0x34daca[_0x2c6d('0x17')]===_0x2c6d('0x18')&&typeof _0x34daca['limit']===_0x2c6d('0x18');var _0x33c781=_0x4177ed[_0x2c6d('0x19')];var _0x968578=_0xdf70df?0x0:_0x34daca[_0x2c6d('0x17')];var _0x3ba61a=_0xdf70df?_0x4177ed[_0x2c6d('0x19')]:_0x34daca[_0x2c6d('0x17')]+_0x34daca[_0x2c6d('0x1a')];var _0x308383;if(_0x3ba61a>=_0x33c781){_0x3ba61a=_0x33c781;_0x308383=0xc8;}else{_0x308383=0xce;}_0x1727b6[_0x2c6d('0x16')](_0x308383);return _0x1727b6['set'](_0x2c6d('0x1b'),_0x968578+'-'+_0x3ba61a+'/'+_0x33c781)[_0x2c6d('0x1c')](_0x4177ed);}return null;};}function patchUpdates(_0x59c04f){return function(_0x4a6fa2){try{jsonpatch[_0x2c6d('0x1d')](_0x4a6fa2,_0x59c04f,!![]);}catch(_0x4cfe9d){return BPromise[_0x2c6d('0x1e')](_0x4cfe9d);}return _0x4a6fa2[_0x2c6d('0x1f')]();};}function saveUpdates(_0x3c4433,_0x338830){return function(_0x100bd5){if(_0x100bd5){return _0x100bd5[_0x2c6d('0x20')](_0x3c4433)['then'](function(_0x937667){return _0x937667;});}return null;};}function removeEntity(_0x32bba6,_0x235333){return function(_0x26f9cc){if(_0x26f9cc){return _0x26f9cc[_0x2c6d('0x21')]()[_0x2c6d('0x22')](function(){_0x32bba6[_0x2c6d('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5dc82d,_0x23d244){return function(_0x1233ea){if(!_0x1233ea){_0x5dc82d[_0x2c6d('0x23')](0x194);}return _0x1233ea;};}function handleError(_0x2a5324,_0xd98047){_0xd98047=_0xd98047||0x1f4;return function(_0xc7a4ae){logger[_0x2c6d('0x24')](_0xc7a4ae[_0x2c6d('0x25')]);if(_0xc7a4ae[_0x2c6d('0x26')]){delete _0xc7a4ae[_0x2c6d('0x26')];}_0x2a5324[_0x2c6d('0x16')](_0xd98047)[_0x2c6d('0x27')](_0xc7a4ae);};}exports[_0x2c6d('0x28')]=function(_0x471904,_0x31949a){var _0x274163={},_0x2df851={},_0x257d98={'count':0x0,'rows':[]};var _0x1ab1a7=_[_0x2c6d('0x29')](db['SalesforceField'][_0x2c6d('0x2a')],function(_0x553890){return{'name':_0x553890[_0x2c6d('0x2b')],'type':_0x553890[_0x2c6d('0x2c')][_0x2c6d('0x2d')]};});_0x2df851['model']=_[_0x2c6d('0x29')](_0x1ab1a7,'name');_0x2df851[_0x2c6d('0x2e')]=_[_0x2c6d('0x2f')](_0x471904[_0x2c6d('0x2e')]);_0x2df851[_0x2c6d('0x30')]=_[_0x2c6d('0x31')](_0x2df851['model'],_0x2df851[_0x2c6d('0x2e')]);_0x274163[_0x2c6d('0x32')]=_[_0x2c6d('0x31')](_0x2df851[_0x2c6d('0x33')],qs[_0x2c6d('0x34')](_0x471904[_0x2c6d('0x2e')][_0x2c6d('0x34')]));_0x274163[_0x2c6d('0x32')]=_0x274163[_0x2c6d('0x32')][_0x2c6d('0x35')]?_0x274163[_0x2c6d('0x32')]:_0x2df851['model'];if(!_0x471904[_0x2c6d('0x2e')][_0x2c6d('0x36')]('nolimit')){_0x274163[_0x2c6d('0x1a')]=qs[_0x2c6d('0x1a')](_0x471904[_0x2c6d('0x2e')][_0x2c6d('0x1a')]);_0x274163['offset']=qs['offset'](_0x471904['query'][_0x2c6d('0x17')]);}_0x274163[_0x2c6d('0x37')]=qs[_0x2c6d('0x38')](_0x471904[_0x2c6d('0x2e')][_0x2c6d('0x38')]);_0x274163[_0x2c6d('0x39')]=qs['filters'](_[_0x2c6d('0x3a')](_0x471904[_0x2c6d('0x2e')],_0x2df851['filters']),_0x1ab1a7);if(_0x471904[_0x2c6d('0x2e')][_0x2c6d('0x3b')]){_0x274163[_0x2c6d('0x39')]=_['merge'](_0x274163[_0x2c6d('0x39')],{'$or':_[_0x2c6d('0x29')](_0x1ab1a7,function(_0xfe5673){if(_0xfe5673[_0x2c6d('0x2c')]!==_0x2c6d('0x3c')){var _0x455130={};_0x455130[_0xfe5673['name']]={'$like':'%'+_0x471904[_0x2c6d('0x2e')][_0x2c6d('0x3b')]+'%'};return _0x455130;}})});}_0x274163=_[_0x2c6d('0x3d')]({},_0x274163,_0x471904[_0x2c6d('0x3e')]);var _0x562b53={'where':_0x274163[_0x2c6d('0x39')]};return db['SalesforceField'][_0x2c6d('0x19')](_0x562b53)[_0x2c6d('0x22')](function(_0x1a584e){_0x257d98['count']=_0x1a584e;if(_0x471904[_0x2c6d('0x2e')][_0x2c6d('0x3f')]){_0x274163[_0x2c6d('0x40')]=[{'all':!![]}];}return db[_0x2c6d('0x41')][_0x2c6d('0x42')](_0x274163);})[_0x2c6d('0x22')](function(_0x3a478f){_0x257d98['rows']=_0x3a478f;return _0x257d98;})[_0x2c6d('0x22')](respondWithFilteredResult(_0x31949a,_0x274163))[_0x2c6d('0x43')](handleError(_0x31949a,null));};exports[_0x2c6d('0x44')]=function(_0x38ee52,_0x20d068){var _0x55cd5f={'raw':!![],'where':{'id':_0x38ee52[_0x2c6d('0x45')]['id']}},_0x50d4d9={};_0x50d4d9[_0x2c6d('0x33')]=_[_0x2c6d('0x2f')](db[_0x2c6d('0x41')]['rawAttributes']);_0x50d4d9[_0x2c6d('0x2e')]=_[_0x2c6d('0x2f')](_0x38ee52[_0x2c6d('0x2e')]);_0x50d4d9[_0x2c6d('0x30')]=_[_0x2c6d('0x31')](_0x50d4d9[_0x2c6d('0x33')],_0x50d4d9['query']);_0x55cd5f[_0x2c6d('0x32')]=_['intersection'](_0x50d4d9[_0x2c6d('0x33')],qs[_0x2c6d('0x34')](_0x38ee52[_0x2c6d('0x2e')][_0x2c6d('0x34')]));_0x55cd5f[_0x2c6d('0x32')]=_0x55cd5f['attributes']['length']?_0x55cd5f[_0x2c6d('0x32')]:_0x50d4d9[_0x2c6d('0x33')];if(_0x38ee52[_0x2c6d('0x2e')][_0x2c6d('0x3f')]){_0x55cd5f[_0x2c6d('0x40')]=[{'all':!![]}];}_0x55cd5f=_[_0x2c6d('0x3d')]({},_0x55cd5f,_0x38ee52[_0x2c6d('0x3e')]);return db[_0x2c6d('0x41')]['find'](_0x55cd5f)[_0x2c6d('0x22')](handleEntityNotFound(_0x20d068,null))[_0x2c6d('0x22')](respondWithResult(_0x20d068,null))['catch'](handleError(_0x20d068,null));};exports[_0x2c6d('0x46')]=function(_0x4efe1b,_0x522287){return db['SalesforceField'][_0x2c6d('0x46')](_0x4efe1b[_0x2c6d('0x47')],{})[_0x2c6d('0x22')](respondWithResult(_0x522287,0xc9))[_0x2c6d('0x43')](handleError(_0x522287,null));};exports[_0x2c6d('0x20')]=function(_0x29de60,_0x10894c){if(_0x29de60[_0x2c6d('0x47')]['id']){delete _0x29de60['body']['id'];}return db[_0x2c6d('0x41')][_0x2c6d('0x48')]({'where':{'id':_0x29de60[_0x2c6d('0x45')]['id']}})['then'](handleEntityNotFound(_0x10894c,null))[_0x2c6d('0x22')](saveUpdates(_0x29de60['body'],null))['then'](respondWithResult(_0x10894c,null))[_0x2c6d('0x43')](handleError(_0x10894c,null));};exports[_0x2c6d('0x21')]=function(_0x38c161,_0x5b976e){return db['SalesforceField'][_0x2c6d('0x48')]({'where':{'id':_0x38c161[_0x2c6d('0x45')]['id']}})['then'](handleEntityNotFound(_0x5b976e,null))['then'](removeEntity(_0x5b976e,null))[_0x2c6d('0x43')](handleError(_0x5b976e,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 7f5048a..4aefb47 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 _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 +var _0x4359=['./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x2b39c5,_0x13e9b6){var _0x446a51=function(_0x217bff){while(--_0x217bff){_0x2b39c5['push'](_0x2b39c5['shift']());}};_0x446a51(++_0x13e9b6);}(_0x4359,0x116));var _0x9435=function(_0x5e5de0,_0x55d99b){_0x5e5de0=_0x5e5de0-0x0;var _0x3f06eb=_0x4359[_0x5e5de0];return _0x3f06eb;};'use strict';var _=require(_0x9435('0x0'));var util=require(_0x9435('0x1'));var logger=require(_0x9435('0x2'))(_0x9435('0x3'));var moment=require(_0x9435('0x4'));var BPromise=require('bluebird');var rp=require(_0x9435('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9435('0x6'));var config=require('../../config/environment');var attributes=require(_0x9435('0x7'));module[_0x9435('0x8')]=function(_0xd58692,_0x32146d){return _0xd58692[_0x9435('0x9')](_0x9435('0xa'),attributes,{'tableName':_0x9435('0xb'),'paranoid':![],'indexes':[{'name':_0x9435('0xc'),'fields':[_0x9435('0xd'),_0x9435('0xe')],'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 eb35ae0..30fc96a 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 _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 +var _0xf1cf=['stringify','error','code','SalesforceField,\x20%s,\x20%s','message','info','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s'];(function(_0x2599c0,_0x23716c){var _0x1adaec=function(_0x5291e1){while(--_0x5291e1){_0x2599c0['push'](_0x2599c0['shift']());}};_0x1adaec(++_0x23716c);}(_0xf1cf,0x99));var _0xff1c=function(_0x3c07f8,_0x55082f){_0x3c07f8=_0x3c07f8-0x0;var _0x139006=_0xf1cf[_0x3c07f8];return _0x139006;};'use strict';var _=require(_0xff1c('0x0'));var util=require(_0xff1c('0x1'));var moment=require(_0xff1c('0x2'));var BPromise=require(_0xff1c('0x3'));var rs=require(_0xff1c('0x4'));var fs=require('fs');var Redis=require(_0xff1c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xff1c('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xff1c('0x7'));var jayson=require(_0xff1c('0x8'));var client=jayson[_0xff1c('0x9')][_0xff1c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x298d7c,_0x3538fd,_0x73a08d){return new BPromise(function(_0x3fccf3,_0x36b49c){return client['request'](_0x298d7c,_0x73a08d)[_0xff1c('0xb')](function(_0x343d42){logger['info']('SalesforceField,\x20%s,\x20%s',_0x3538fd,_0xff1c('0xc'));logger[_0xff1c('0xd')](_0xff1c('0xe'),_0x3538fd,_0xff1c('0xc'),JSON[_0xff1c('0xf')](_0x343d42));if(_0x343d42[_0xff1c('0x10')]){if(_0x343d42[_0xff1c('0x10')][_0xff1c('0x11')]===0x1f4){logger[_0xff1c('0x10')](_0xff1c('0x12'),_0x3538fd,_0x343d42[_0xff1c('0x10')][_0xff1c('0x13')]);return _0x36b49c(_0x343d42[_0xff1c('0x10')][_0xff1c('0x13')]);}logger[_0xff1c('0x10')](_0xff1c('0x12'),_0x3538fd,_0x343d42['error'][_0xff1c('0x13')]);return _0x3fccf3(_0x343d42[_0xff1c('0x10')]['message']);}else{logger[_0xff1c('0x14')](_0xff1c('0x12'),_0x3538fd,'request\x20sent');_0x3fccf3(_0x343d42['result'][_0xff1c('0x13')]);}})['catch'](function(_0x329713){logger[_0xff1c('0x10')](_0xff1c('0x12'),_0x3538fd,_0x329713);_0x36b49c(_0x329713);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 40e8400..787c6ce 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 _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 +var _0x6364=['put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','create'];(function(_0x3ccdf8,_0x584ceb){var _0x243dab=function(_0x1a90d1){while(--_0x1a90d1){_0x3ccdf8['push'](_0x3ccdf8['shift']());}};_0x243dab(++_0x584ceb);}(_0x6364,0x8f));var _0x4636=function(_0x873810,_0x4362b9){_0x873810=_0x873810-0x0;var _0x4ff339=_0x6364[_0x873810];return _0x4ff339;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4636('0x0'));var timeout=require(_0x4636('0x1'));var express=require(_0x4636('0x2'));var router=express[_0x4636('0x3')]();var fs_extra=require(_0x4636('0x4'));var auth=require(_0x4636('0x5'));var interaction=require(_0x4636('0x6'));var config=require(_0x4636('0x7'));var controller=require('./intServicenowAccount.controller');router[_0x4636('0x8')]('/',auth[_0x4636('0x9')](),controller[_0x4636('0xa')]);router[_0x4636('0x8')](_0x4636('0xb'),auth['isAuthenticated'](),controller[_0x4636('0xc')]);router[_0x4636('0x8')](_0x4636('0xd'),auth[_0x4636('0x9')](),controller['getConfigurations']);router[_0x4636('0x8')](_0x4636('0xe'),auth[_0x4636('0x9')](),controller[_0x4636('0xf')]);router[_0x4636('0x10')]('/',auth['isAuthenticated'](),controller[_0x4636('0x11')]);router[_0x4636('0x10')](_0x4636('0xd'),auth[_0x4636('0x9')](),controller['addConfiguration']);router[_0x4636('0x12')](_0x4636('0xb'),auth[_0x4636('0x9')](),controller[_0x4636('0x13')]);router[_0x4636('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x4636('0x15')]);module[_0x4636('0x16')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 4355940..7f278d4 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 _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 +var _0x8e7f=['remoteUri','sequelize','exports','STRING','username'];(function(_0x88efe4,_0x5e298b){var _0x43650b=function(_0x5bc3c7){while(--_0x5bc3c7){_0x88efe4['push'](_0x88efe4['shift']());}};_0x43650b(++_0x5e298b);}(_0x8e7f,0x150));var _0xf8e7=function(_0x155fca,_0xbad4f2){_0x155fca=_0x155fca-0x0;var _0x2320da=_0x8e7f[_0x155fca];return _0x2320da;};'use strict';var Sequelize=require(_0xf8e7('0x0'));module[_0xf8e7('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf8e7('0x2')]},'username':{'type':Sequelize[_0xf8e7('0x2')],'unique':_0xf8e7('0x3')},'password':{'type':Sequelize[_0xf8e7('0x2')]},'email':{'type':Sequelize[_0xf8e7('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xf8e7('0x4')},'serverUrl':{'type':Sequelize[_0xf8e7('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 82e1c28..135b786 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 _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 +var _0x7ae1=['problem_id','company','activity_due','severity','comments','sla_due','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','category','username','password','email','remoteUri','serverUrl','slice','substring','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','push','all','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','test','statusCode','Wrong\x20credentials','boolean','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','value','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','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','end','json','offset','undefined','count','status','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','ServicenowAccount','rawAttributes','fieldName','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','create','body','find','destroy','getConfigurations','findOne','ServicenowConfiguration','pick','nolimit','addConfiguration','AccountId','Subjects','getSubjects','ServicenowField','getFields','made_sla','hold_reason','subcategory','notify','incident_state','parent','sys_updated_on','approval_history','resolved_by','user_input','sys_created_on','sys_domain','state','sys_created_by','knowledge','closed_at','delivery_plan','impact','business_service','priority','rfc','time_worked','opened_at','business_duration','work_end','reopened_time','caller_id','approval_set','short_description','close_code','correlation_display','delivery_task','work_start','assignment_group','business_stc','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','sys_id','contact_type','reopened_by','urgency'];(function(_0xde5963,_0x55853b){var _0x32313e=function(_0x44f4ce){while(--_0x44f4ce){_0xde5963['push'](_0xde5963['shift']());}};_0x32313e(++_0x55853b);}(_0x7ae1,0x1a1));var _0x17ae=function(_0x2984d9,_0x2c44d8){_0x2984d9=_0x2984d9-0x0;var _0x57c663=_0x7ae1[_0x2984d9];return _0x57c663;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x17ae('0x0'));var zipdir=require(_0x17ae('0x1'));var jsonpatch=require(_0x17ae('0x2'));var rp=require(_0x17ae('0x3'));var moment=require(_0x17ae('0x4'));var BPromise=require(_0x17ae('0x5'));var Mustache=require('mustache');var util=require(_0x17ae('0x6'));var path=require(_0x17ae('0x7'));var sox=require(_0x17ae('0x8'));var csv=require(_0x17ae('0x9'));var ejs=require(_0x17ae('0xa'));var fs=require('fs');var fs_extra=require(_0x17ae('0xb'));var _=require(_0x17ae('0xc'));var squel=require(_0x17ae('0xd'));var crypto=require(_0x17ae('0xe'));var jsforce=require(_0x17ae('0xf'));var deskjs=require(_0x17ae('0x10'));var toCsv=require('to-csv');var querystring=require(_0x17ae('0x11'));var Papa=require(_0x17ae('0x12'));var Redis=require('ioredis');var authService=require(_0x17ae('0x13'));var qs=require(_0x17ae('0x14'));var as=require(_0x17ae('0x15'));var hardwareService=require(_0x17ae('0x16'));var logger=require(_0x17ae('0x17'))(_0x17ae('0x18'));var utils=require('../../config/utils');var config=require(_0x17ae('0x19'));var licenseUtil=require(_0x17ae('0x1a'));var db=require(_0x17ae('0x1b'))['db'];var integrations=require(_0x17ae('0x1c'));function respondWithStatusCode(_0x5ef7ba,_0x4673c5){_0x4673c5=_0x4673c5||0xcc;return function(_0x449803){if(_0x449803){return _0x5ef7ba[_0x17ae('0x1d')](_0x4673c5);}return _0x5ef7ba['status'](_0x4673c5)[_0x17ae('0x1e')]();};}function respondWithResult(_0x2fa7b3,_0x270e71){_0x270e71=_0x270e71||0xc8;return function(_0x3c0517){if(_0x3c0517){return _0x2fa7b3['status'](_0x270e71)[_0x17ae('0x1f')](_0x3c0517);}};}function respondWithFilteredResult(_0x4fe602,_0x47397a){return function(_0x5f5e02){if(_0x5f5e02){var _0x274903=typeof _0x47397a[_0x17ae('0x20')]===_0x17ae('0x21')&&typeof _0x47397a['limit']===_0x17ae('0x21');var _0x26dc16=_0x5f5e02['count'];var _0x303660=_0x274903?0x0:_0x47397a[_0x17ae('0x20')];var _0x3d854c=_0x274903?_0x5f5e02[_0x17ae('0x22')]:_0x47397a[_0x17ae('0x20')]+_0x47397a['limit'];var _0x4b476f;if(_0x3d854c>=_0x26dc16){_0x3d854c=_0x26dc16;_0x4b476f=0xc8;}else{_0x4b476f=0xce;}_0x4fe602[_0x17ae('0x23')](_0x4b476f);return _0x4fe602[_0x17ae('0x24')](_0x17ae('0x25'),_0x303660+'-'+_0x3d854c+'/'+_0x26dc16)['json'](_0x5f5e02);}return null;};}function patchUpdates(_0x18ac25){return function(_0x1f19fa){try{jsonpatch[_0x17ae('0x26')](_0x1f19fa,_0x18ac25,!![]);}catch(_0x396974){return BPromise[_0x17ae('0x27')](_0x396974);}return _0x1f19fa[_0x17ae('0x28')]();};}function saveUpdates(_0x2dbe41,_0x4ba9f4){return function(_0x5eaad0){if(_0x5eaad0){return _0x5eaad0[_0x17ae('0x29')](_0x2dbe41)[_0x17ae('0x2a')](function(_0x163d81){return _0x163d81;});}return null;};}function removeEntity(_0x76d3c8,_0x1eefaa){return function(_0x2a334d){if(_0x2a334d){return _0x2a334d['destroy']()[_0x17ae('0x2a')](function(){_0x76d3c8['status'](0xcc)[_0x17ae('0x1e')]();});}};}function handleEntityNotFound(_0x19a3d9,_0x1f6230){return function(_0x5ac28b){if(!_0x5ac28b){_0x19a3d9['sendStatus'](0x194);}return _0x5ac28b;};}function handleError(_0x2f24cc,_0x36951a){_0x36951a=_0x36951a||0x1f4;return function(_0x3c65c2){logger[_0x17ae('0x2b')](_0x3c65c2[_0x17ae('0x2c')]);if(_0x3c65c2[_0x17ae('0x2d')]){delete _0x3c65c2[_0x17ae('0x2d')];}_0x2f24cc[_0x17ae('0x23')](_0x36951a)[_0x17ae('0x2e')](_0x3c65c2);};}exports['index']=function(_0x586fd1,_0x184e2b){var _0x42ca33={},_0x33d7f6={},_0x43e757={'count':0x0,'rows':[]};var _0x539329=_['map'](db[_0x17ae('0x2f')][_0x17ae('0x30')],function(_0x14e624){return{'name':_0x14e624[_0x17ae('0x31')],'type':_0x14e624['type']['key']};});_0x33d7f6[_0x17ae('0x32')]=_[_0x17ae('0x33')](_0x539329,_0x17ae('0x2d'));_0x33d7f6[_0x17ae('0x34')]=_[_0x17ae('0x35')](_0x586fd1[_0x17ae('0x34')]);_0x33d7f6[_0x17ae('0x36')]=_[_0x17ae('0x37')](_0x33d7f6[_0x17ae('0x32')],_0x33d7f6['query']);_0x42ca33['attributes']=_[_0x17ae('0x37')](_0x33d7f6[_0x17ae('0x32')],qs[_0x17ae('0x38')](_0x586fd1[_0x17ae('0x34')][_0x17ae('0x38')]));_0x42ca33['attributes']=_0x42ca33[_0x17ae('0x39')][_0x17ae('0x3a')]?_0x42ca33[_0x17ae('0x39')]:_0x33d7f6[_0x17ae('0x32')];if(!_0x586fd1[_0x17ae('0x34')][_0x17ae('0x3b')]('nolimit')){_0x42ca33[_0x17ae('0x3c')]=qs['limit'](_0x586fd1[_0x17ae('0x34')][_0x17ae('0x3c')]);_0x42ca33['offset']=qs[_0x17ae('0x20')](_0x586fd1[_0x17ae('0x34')][_0x17ae('0x20')]);}_0x42ca33[_0x17ae('0x3d')]=qs[_0x17ae('0x3e')](_0x586fd1[_0x17ae('0x34')][_0x17ae('0x3e')]);_0x42ca33[_0x17ae('0x3f')]=qs[_0x17ae('0x36')](_['pick'](_0x586fd1[_0x17ae('0x34')],_0x33d7f6['filters']),_0x539329);if(_0x586fd1['query'][_0x17ae('0x40')]){_0x42ca33['where']=_['merge'](_0x42ca33[_0x17ae('0x3f')],{'$or':_[_0x17ae('0x33')](_0x539329,function(_0x1b41b5){if(_0x1b41b5[_0x17ae('0x41')]!==_0x17ae('0x42')){var _0x589754={};_0x589754[_0x1b41b5[_0x17ae('0x2d')]]={'$like':'%'+_0x586fd1[_0x17ae('0x34')][_0x17ae('0x40')]+'%'};return _0x589754;}})});}_0x42ca33=_[_0x17ae('0x43')]({},_0x42ca33,_0x586fd1[_0x17ae('0x44')]);var _0x3dcb49={'where':_0x42ca33[_0x17ae('0x3f')]};return db[_0x17ae('0x2f')][_0x17ae('0x22')](_0x3dcb49)[_0x17ae('0x2a')](function(_0x1620b9){_0x43e757[_0x17ae('0x22')]=_0x1620b9;if(_0x586fd1[_0x17ae('0x34')][_0x17ae('0x45')]){_0x42ca33[_0x17ae('0x46')]=[{'all':!![]}];}return db['ServicenowAccount'][_0x17ae('0x47')](_0x42ca33);})[_0x17ae('0x2a')](function(_0x25f75f){_0x43e757[_0x17ae('0x48')]=_0x25f75f;return _0x43e757;})[_0x17ae('0x2a')](respondWithFilteredResult(_0x184e2b,_0x42ca33))[_0x17ae('0x49')](handleError(_0x184e2b,null));};exports['show']=function(_0x50b85c,_0x2e38a8){var _0xa775ab={'raw':![],'where':{'id':_0x50b85c[_0x17ae('0x4a')]['id']}},_0x45dca2={};_0x45dca2['model']=_[_0x17ae('0x35')](db['ServicenowAccount'][_0x17ae('0x30')]);_0x45dca2['query']=_[_0x17ae('0x35')](_0x50b85c[_0x17ae('0x34')]);_0x45dca2[_0x17ae('0x36')]=_[_0x17ae('0x37')](_0x45dca2['model'],_0x45dca2[_0x17ae('0x34')]);_0xa775ab[_0x17ae('0x39')]=_[_0x17ae('0x37')](_0x45dca2[_0x17ae('0x32')],qs['fields'](_0x50b85c[_0x17ae('0x34')]['fields']));_0xa775ab[_0x17ae('0x39')]=_0xa775ab['attributes'][_0x17ae('0x3a')]?_0xa775ab[_0x17ae('0x39')]:_0x45dca2[_0x17ae('0x32')];if(_0x50b85c[_0x17ae('0x34')]['includeAll']){_0xa775ab[_0x17ae('0x46')]=[{'all':!![]}];}_0xa775ab=_[_0x17ae('0x43')]({},_0xa775ab,_0x50b85c[_0x17ae('0x44')]);return db[_0x17ae('0x2f')]['find'](_0xa775ab)['then'](handleEntityNotFound(_0x2e38a8,null))[_0x17ae('0x2a')](respondWithResult(_0x2e38a8,null))[_0x17ae('0x49')](handleError(_0x2e38a8,null));};exports[_0x17ae('0x4b')]=function(_0x1e68c3,_0x13e973){return db[_0x17ae('0x2f')][_0x17ae('0x4b')](_0x1e68c3[_0x17ae('0x4c')],{})[_0x17ae('0x2a')](respondWithResult(_0x13e973,0xc9))[_0x17ae('0x49')](handleError(_0x13e973,null));};exports[_0x17ae('0x29')]=function(_0x5ea2b8,_0xa68037){if(_0x5ea2b8[_0x17ae('0x4c')]['id']){delete _0x5ea2b8[_0x17ae('0x4c')]['id'];}return db[_0x17ae('0x2f')][_0x17ae('0x4d')]({'where':{'id':_0x5ea2b8[_0x17ae('0x4a')]['id']}})[_0x17ae('0x2a')](handleEntityNotFound(_0xa68037,null))[_0x17ae('0x2a')](saveUpdates(_0x5ea2b8[_0x17ae('0x4c')],null))['then'](respondWithResult(_0xa68037,null))[_0x17ae('0x49')](handleError(_0xa68037,null));};exports[_0x17ae('0x4e')]=function(_0x4a0bc1,_0x462fa1){return db['ServicenowAccount'][_0x17ae('0x4d')]({'where':{'id':_0x4a0bc1['params']['id']}})[_0x17ae('0x2a')](handleEntityNotFound(_0x462fa1,null))['then'](removeEntity(_0x462fa1,null))[_0x17ae('0x49')](handleError(_0x462fa1,null));};exports[_0x17ae('0x4f')]=function(_0x497d19,_0x27357f,_0x40c9e7){var _0x4f88fb={};var _0x3d136f={};var _0x16c1ad;var _0x52317d;return db[_0x17ae('0x2f')][_0x17ae('0x50')]({'where':{'id':_0x497d19[_0x17ae('0x4a')]['id']}})[_0x17ae('0x2a')](handleEntityNotFound(_0x27357f,null))[_0x17ae('0x2a')](function(_0x49a681){if(_0x49a681){_0x16c1ad=_0x49a681;_0x3d136f[_0x17ae('0x32')]=_[_0x17ae('0x35')](db[_0x17ae('0x51')][_0x17ae('0x30')]);_0x3d136f[_0x17ae('0x34')]=_[_0x17ae('0x35')](_0x497d19[_0x17ae('0x34')]);_0x3d136f['filters']=_[_0x17ae('0x37')](_0x3d136f[_0x17ae('0x32')],_0x3d136f['query']);_0x4f88fb[_0x17ae('0x39')]=_[_0x17ae('0x37')](_0x3d136f['model'],qs[_0x17ae('0x38')](_0x497d19[_0x17ae('0x34')][_0x17ae('0x38')]));_0x4f88fb[_0x17ae('0x39')]=_0x4f88fb[_0x17ae('0x39')][_0x17ae('0x3a')]?_0x4f88fb[_0x17ae('0x39')]:_0x3d136f[_0x17ae('0x32')];_0x4f88fb[_0x17ae('0x3d')]=qs[_0x17ae('0x3e')](_0x497d19['query'][_0x17ae('0x3e')]);_0x4f88fb['where']=qs[_0x17ae('0x36')](_[_0x17ae('0x52')](_0x497d19[_0x17ae('0x34')],_0x3d136f['filters']));if(_0x497d19[_0x17ae('0x34')][_0x17ae('0x40')]){_0x4f88fb['where']=_[_0x17ae('0x43')](_0x4f88fb[_0x17ae('0x3f')],{'$or':_[_0x17ae('0x33')](_0x4f88fb[_0x17ae('0x39')],function(_0x1ed10f){var _0x2f7b6c={};_0x2f7b6c[_0x1ed10f]={'$like':'%'+_0x497d19[_0x17ae('0x34')][_0x17ae('0x40')]+'%'};return _0x2f7b6c;})});}_0x4f88fb=_['merge']({},_0x4f88fb,_0x497d19[_0x17ae('0x44')]);return _0x16c1ad[_0x17ae('0x4f')](_0x4f88fb);}})['then'](function(_0x460545){if(_0x460545){_0x52317d=_0x460545['length'];if(!_0x497d19[_0x17ae('0x34')][_0x17ae('0x3b')](_0x17ae('0x53'))){_0x4f88fb[_0x17ae('0x3c')]=qs[_0x17ae('0x3c')](_0x497d19[_0x17ae('0x34')][_0x17ae('0x3c')]);_0x4f88fb['offset']=qs[_0x17ae('0x20')](_0x497d19['query']['offset']);}return _0x16c1ad['getConfigurations'](_0x4f88fb);}})[_0x17ae('0x2a')](function(_0x51988e){if(_0x51988e){return _0x51988e?{'count':_0x52317d,'rows':_0x51988e}:null;}})['then'](respondWithResult(_0x27357f,null))['catch'](handleError(_0x27357f,null));};exports[_0x17ae('0x54')]=function(_0x4e36de,_0x1b643f,_0x4cd949){if(_0x4e36de[_0x17ae('0x4c')]['id']){delete _0x4e36de['body']['id'];}return db[_0x17ae('0x2f')][_0x17ae('0x50')]({'where':{'id':_0x4e36de[_0x17ae('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1b643f,null))[_0x17ae('0x2a')](function(_0x3a4e16){if(_0x3a4e16){_0x4e36de[_0x17ae('0x4c')][_0x17ae('0x55')]=_0x3a4e16['id'];_0x4e36de[_0x17ae('0x4c')][_0x17ae('0x56')]=integrations[_0x17ae('0x57')](_0x4e36de[_0x17ae('0x4c')]['channel'],_0x4e36de['body']['type']);_0x4e36de[_0x17ae('0x4c')]['Descriptions']=integrations['getDescriptions'](_0x4e36de[_0x17ae('0x4c')]['channel'],_0x4e36de['body'][_0x17ae('0x41')]);return db[_0x17ae('0x51')]['create'](_0x4e36de[_0x17ae('0x4c')],{'include':[{'model':db[_0x17ae('0x58')],'as':_0x17ae('0x56')},{'model':db['ServicenowField'],'as':'Descriptions'}]});}return null;})[_0x17ae('0x2a')](respondWithResult(_0x1b643f,null))[_0x17ae('0x49')](handleError(_0x1b643f,null));};exports[_0x17ae('0x59')]=function(_0x3cfe2c,_0x705b56,_0x2f6020){var _0x3a9ff1=[_0x17ae('0x5a'),_0x17ae('0x5b'),'knowledge',_0x17ae('0x5c'),'close_code',_0x17ae('0x5d'),_0x17ae('0x5e'),'severity','category'];var _0x1cc1a5=[_0x17ae('0x5f'),_0x17ae('0x5a'),'caused_by','watch_list','upon_reject',_0x17ae('0x60'),'child_incidents','hold_reason',_0x17ae('0x61'),'number',_0x17ae('0x62'),'sys_updated_by','opened_by',_0x17ae('0x63'),_0x17ae('0x64'),_0x17ae('0x65'),_0x17ae('0x66'),_0x17ae('0x67'),_0x17ae('0x68'),_0x17ae('0x3d'),'calendar_stc',_0x17ae('0x69'),'cmdb_ci',_0x17ae('0x6a'),_0x17ae('0x6b'),'active','work_notes_list',_0x17ae('0x6c'),_0x17ae('0x6d'),'sys_domain_path',_0x17ae('0x6e'),_0x17ae('0x6f'),'expected_start',_0x17ae('0x70'),_0x17ae('0x71'),'group_list',_0x17ae('0x72'),_0x17ae('0x73'),'resolved_at',_0x17ae('0x74'),_0x17ae('0x75'),_0x17ae('0x5c'),'work_notes',_0x17ae('0x76'),_0x17ae('0x77'),_0x17ae('0x78'),_0x17ae('0x79'),_0x17ae('0x7a'),_0x17ae('0x7b'),_0x17ae('0x7c'),'additional_assignee_list',_0x17ae('0x7d'),_0x17ae('0x7e'),'notify',_0x17ae('0x7f'),_0x17ae('0x80'),_0x17ae('0x81'),_0x17ae('0x82'),'parent_incident',_0x17ae('0x83'),_0x17ae('0x84'),_0x17ae('0x85'),'incident_state',_0x17ae('0x86'),_0x17ae('0x87'),_0x17ae('0x88'),'reassignment_count',_0x17ae('0x89'),'assigned_to',_0x17ae('0x8a'),_0x17ae('0x8b'),_0x17ae('0x8c'),'approval',_0x17ae('0x8d'),_0x17ae('0x8e'),_0x17ae('0x8f'),_0x17ae('0x90'),_0x17ae('0x91'),_0x17ae('0x92'),_0x17ae('0x93'),_0x17ae('0x94'),'location',_0x17ae('0x95')];var _0x286e07='';var _0x15c112='';var _0x54b7cc=[];var _0x5b8ec4='';var _0x3b8036='';var _0x537193=[];var _0x1269a3='';var _0x184272='';var _0x150890={};var _0x316f86='';return db['ServicenowAccount'][_0x17ae('0x50')]({'where':{'id':_0x3cfe2c[_0x17ae('0x4a')]['id']},'attributes':['id',_0x17ae('0x96'),_0x17ae('0x97'),_0x17ae('0x98'),_0x17ae('0x99'),_0x17ae('0x9a')]})[_0x17ae('0x2a')](handleEntityNotFound(_0x705b56,null))[_0x17ae('0x2a')](function(_0x42ac92){if(_0x42ac92){_0x316f86=_0x42ac92[_0x17ae('0x99')];var _0x47a86d=_0x316f86[_0x17ae('0x9b')](-0x1);if(_0x47a86d==='/'){_0x316f86=_0x316f86[_0x17ae('0x9c')](0x0,_0x316f86['lastIndexOf'](_0x47a86d));}_0x184272=util['format'](_0x17ae('0x9d'),_0x316f86);_0x1269a3=util['format'](_0x17ae('0x9e'),_0x316f86);_0x150890={'user':_0x42ac92[_0x17ae('0x96')],'pass':_0x42ac92['password']};var _0x371d90={'method':_0x17ae('0x9f'),'uri':_0x184272+_0x17ae('0xa0'),'auth':_0x150890,'json':!![]};return rp(_0x371d90);}})[_0x17ae('0x2a')](function(_0x4e91d7){if(_0x4e91d7[_0x17ae('0xa1')][_0x17ae('0x3a')]>0x0){_0x286e07=_0x4e91d7[_0x17ae('0xa1')];}console[_0x17ae('0xa2')](_0x17ae('0xa3'),_0x286e07);_0x537193=[];_0x15c112=Object[_0x17ae('0xa4')]([],_0x286e07);_[_0x17ae('0xa5')](_0x15c112,function(_0x245511){return!_0x3a9ff1[_0x17ae('0xa6')](_0x245511[_0x17ae('0x2d')]);});_0x15c112[_0x17ae('0xa7')](function(_0x428ab8){var _0x59203e=createFieldObject(_0x1269a3,_0x150890,_0x428ab8[_0x17ae('0xa8')],_0x428ab8[_0x17ae('0x2d')],_0x428ab8[_0x17ae('0xa9')],![]);_0x537193[_0x17ae('0xaa')](_0x59203e);});return Promise[_0x17ae('0xab')](_0x537193);})['then'](function(_0x3c7ea9){_0x54b7cc=_0x3c7ea9;_0x5b8ec4=Object[_0x17ae('0xa4')]([],_0x286e07);console['log']('TCL:\x20_object',_0x286e07);_[_0x17ae('0xa5')](_0x5b8ec4,function(_0x420a47){return _0x1cc1a5[_0x17ae('0xa6')](_0x420a47[_0x17ae('0x2d')]);});console[_0x17ae('0xa2')](_0x17ae('0xac'),_0x5b8ec4);_0x537193=[];_0x5b8ec4[_0x17ae('0xa7')](function(_0x224050){var _0x20d528=createFieldObject(_0x1269a3,_0x150890,_0x224050[_0x17ae('0xa8')],_0x224050['name'],_0x224050[_0x17ae('0xa9')],!![]);_0x537193[_0x17ae('0xaa')](_0x20d528);});return Promise[_0x17ae('0xab')](_0x537193);})['then'](function(_0x5ea5af){_0x3b8036=_0x5ea5af;var _0x4482f6=_0x54b7cc[_0x17ae('0xad')](_0x3b8036);return{'count':_0x4482f6['length'],'rows':_0x4482f6};})[_0x17ae('0x2a')](respondWithResult(_0x705b56,null))[_0x17ae('0x49')](function(_0x2d5951){console[_0x17ae('0xa2')]('ServiceNow\x20error:\x20'+_0x2d5951);var _0x3abea6=_0x3cfe2c[_0x17ae('0x34')][_0x17ae('0xae')]?0x1f4:_0x2d5951[_0x17ae('0xaf')]||0x1f4;logger[_0x17ae('0x2b')](_0x2d5951['stack']);delete _0x2d5951[_0x17ae('0x2d')];if(_0x3abea6===0x191){_0x3abea6=0x190;}_0x705b56[_0x17ae('0x23')](_0x3abea6)['send'](_0x3cfe2c['query'][_0x17ae('0xae')]?{'message':_0x17ae('0xb0'),'statusCode':_0x2d5951['statusCode']}:_0x2d5951);});};function createFieldObject(_0x3c530b,_0x2682db,_0x19e086,_0x150054,_0xb32b17,_0x340f35){return new Promise(function(_0x3d913d,_0x399ddb){var _0x24838e={'id':_0x150054,'name':_0xb32b17,'custom':_0x340f35};if(_0x19e086===_0x17ae('0xb1')){_0x24838e[_0x17ae('0x44')]=[{'name':_0x17ae('0xb2'),'value':_0x17ae('0xb3')},{'name':_0x17ae('0xb4'),'value':_0x17ae('0xb5')}];_0x3d913d(_0x24838e);}else{var _0x253555={'method':_0x17ae('0x9f'),'uri':_0x3c530b+_0x17ae('0xb6')+_0x150054,'auth':_0x2682db,'json':!![]};return rp(_0x253555)[_0x17ae('0x2a')](function(_0x4ce854){var _0x2f2267=[];if(_0x4ce854[_0x17ae('0xa1')]['length']>0x0){_0x4ce854[_0x17ae('0xa1')][_0x17ae('0xa7')](function(_0x6b7783){if(_0x6b7783['inactive']===_0x17ae('0xb5')){var _0x34e698={'name':_0x6b7783['label'],'value':_0x6b7783[_0x17ae('0xb7')]};_0x2f2267['push'](_0x34e698);}});}_0x24838e['options']=_0x2f2267;if(_0x24838e[_0x17ae('0x44')][_0x17ae('0x3a')]>0x0){_0x3d913d(_0x24838e);}else{if(_0x340f35==![]){_0x3d913d();}else{_0x3d913d(_0x24838e);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 3f61cfc..1181031 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 _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 +var _0x3eea=['bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','int_servicenow_accounts','lodash','../../config/logger','api','moment'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x1aeb77,_0x3560a2){_0x1aeb77=_0x1aeb77-0x0;var _0x2129cc=_0x3eea[_0x1aeb77];return _0x2129cc;};'use strict';var _=require(_0xa3ee('0x0'));var util=require('util');var logger=require(_0xa3ee('0x1'))(_0xa3ee('0x2'));var moment=require(_0xa3ee('0x3'));var BPromise=require(_0xa3ee('0x4'));var rp=require(_0xa3ee('0x5'));var fs=require('fs');var path=require(_0xa3ee('0x6'));var rimraf=require(_0xa3ee('0x7'));var config=require(_0xa3ee('0x8'));var attributes=require(_0xa3ee('0x9'));var integrations=require(_0xa3ee('0xa'));module[_0xa3ee('0xb')]=function(_0x5776bb,_0x538bf9){return _0x5776bb[_0xa3ee('0xc')]('ServicenowAccount',attributes,{'tableName':_0xa3ee('0xd'),'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 6d08988..0aa4767 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 _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 +var _0x5b74=['then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','where','attributes','limit','include','model','map','raw','ShowServicenowAccount','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x1eff0a,_0x42a064){var _0x2d43ed=function(_0x10f329){while(--_0x10f329){_0x1eff0a['push'](_0x1eff0a['shift']());}};_0x2d43ed(++_0x42a064);}(_0x5b74,0x1a4));var _0x45b7=function(_0x1b07fa,_0x31c47b){_0x1b07fa=_0x1b07fa-0x0;var _0x5a6bc1=_0x5b74[_0x1b07fa];return _0x5a6bc1;};'use strict';var _=require(_0x45b7('0x0'));var util=require(_0x45b7('0x1'));var moment=require(_0x45b7('0x2'));var BPromise=require(_0x45b7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x45b7('0x4'));var db=require(_0x45b7('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x45b7('0x6'));var config=require(_0x45b7('0x7'));var jayson=require(_0x45b7('0x8'));var client=jayson[_0x45b7('0x9')][_0x45b7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x529be9,_0x3c5d02,_0x7066d1){return new BPromise(function(_0x210d61,_0x4d8b5b){return client[_0x45b7('0xb')](_0x529be9,_0x7066d1)[_0x45b7('0xc')](function(_0x5dae3d){logger[_0x45b7('0xd')](_0x45b7('0xe'),_0x3c5d02,_0x45b7('0xf'));logger[_0x45b7('0x10')](_0x45b7('0x11'),_0x3c5d02,'request\x20sent',JSON[_0x45b7('0x12')](_0x5dae3d));if(_0x5dae3d['error']){if(_0x5dae3d[_0x45b7('0x13')][_0x45b7('0x14')]===0x1f4){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x3c5d02,_0x5dae3d[_0x45b7('0x13')][_0x45b7('0x15')]);return _0x4d8b5b(_0x5dae3d['error'][_0x45b7('0x15')]);}logger['error'](_0x45b7('0xe'),_0x3c5d02,_0x5dae3d[_0x45b7('0x13')][_0x45b7('0x15')]);return _0x210d61(_0x5dae3d[_0x45b7('0x13')][_0x45b7('0x15')]);}else{logger[_0x45b7('0xd')](_0x45b7('0xe'),_0x3c5d02,_0x45b7('0xf'));_0x210d61(_0x5dae3d[_0x45b7('0x16')][_0x45b7('0x15')]);}})[_0x45b7('0x17')](function(_0x17670c){logger['error'](_0x45b7('0xe'),_0x3c5d02,_0x17670c);_0x4d8b5b(_0x17670c);});});}exports[_0x45b7('0x18')]=function(_0x5092d7){var _0x5e7353=this;return new Promise(function(_0x569f55,_0x4a6ae0){return db[_0x45b7('0x19')][_0x45b7('0x1a')]({'raw':_0x5092d7[_0x45b7('0x1b')]?_0x5092d7[_0x45b7('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x5092d7[_0x45b7('0x1b')]?_0x5092d7[_0x45b7('0x1b')][_0x45b7('0x1c')]||null:null,'attributes':_0x5092d7['options']?_0x5092d7['options'][_0x45b7('0x1d')]||null:null,'limit':_0x5092d7[_0x45b7('0x1b')]?_0x5092d7[_0x45b7('0x1b')][_0x45b7('0x1e')]||null:null,'include':_0x5092d7[_0x45b7('0x1b')]?_0x5092d7[_0x45b7('0x1b')]['include']?_['map'](_0x5092d7[_0x45b7('0x1b')][_0x45b7('0x1f')],function(_0x4ce8e2){return{'model':db[_0x4ce8e2[_0x45b7('0x20')]],'as':_0x4ce8e2['as'],'attributes':_0x4ce8e2[_0x45b7('0x1d')],'include':_0x4ce8e2['include']?_[_0x45b7('0x21')](_0x4ce8e2[_0x45b7('0x1f')],function(_0x5ab997){return{'model':db[_0x5ab997[_0x45b7('0x20')]],'as':_0x5ab997['as'],'attributes':_0x5ab997[_0x45b7('0x1d')],'include':_0x5ab997['include']?_[_0x45b7('0x21')](_0x5ab997[_0x45b7('0x1f')],function(_0x151989){return{'model':db[_0x151989[_0x45b7('0x20')]],'as':_0x151989['as'],'attributes':_0x151989[_0x45b7('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47cb14){logger[_0x45b7('0xd')]('GetServicenowAccount',_0x5092d7);logger[_0x45b7('0x10')](_0x45b7('0x18'),_0x5092d7,JSON[_0x45b7('0x12')](_0x47cb14));_0x569f55(_0x47cb14);})[_0x45b7('0x17')](function(_0x387e22){logger['error'](_0x45b7('0x18'),_0x387e22[_0x45b7('0x15')],_0x5092d7);_0x4a6ae0(_0x5e7353[_0x45b7('0x13')](0x1f4,_0x387e22[_0x45b7('0x15')]));});});};exports['ShowServicenowAccount']=function(_0x3470ff){var _0xfc5750=this;return new Promise(function(_0x5733af,_0x16ac1c){return db[_0x45b7('0x19')]['find']({'raw':_0x3470ff['options']?_0x3470ff[_0x45b7('0x1b')][_0x45b7('0x22')]===undefined?!![]:![]:!![],'where':_0x3470ff['options']?_0x3470ff[_0x45b7('0x1b')][_0x45b7('0x1c')]||null:null,'attributes':_0x3470ff['options']?_0x3470ff[_0x45b7('0x1b')]['attributes']||null:null,'include':_0x3470ff[_0x45b7('0x1b')]?_0x3470ff[_0x45b7('0x1b')][_0x45b7('0x1f')]?_[_0x45b7('0x21')](_0x3470ff[_0x45b7('0x1b')][_0x45b7('0x1f')],function(_0x3fd6b9){return{'model':db[_0x3fd6b9[_0x45b7('0x20')]],'as':_0x3fd6b9['as'],'attributes':_0x3fd6b9[_0x45b7('0x1d')],'include':_0x3fd6b9[_0x45b7('0x1f')]?_[_0x45b7('0x21')](_0x3fd6b9['include'],function(_0x156f1c){return{'model':db[_0x156f1c['model']],'as':_0x156f1c['as'],'attributes':_0x156f1c[_0x45b7('0x1d')],'include':_0x156f1c[_0x45b7('0x1f')]?_[_0x45b7('0x21')](_0x156f1c[_0x45b7('0x1f')],function(_0x5badcd){return{'model':db[_0x5badcd[_0x45b7('0x20')]],'as':_0x5badcd['as'],'attributes':_0x5badcd[_0x45b7('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x45b7('0xc')](function(_0x42d8d5){logger[_0x45b7('0xd')]('ShowServicenowAccount',_0x3470ff);logger[_0x45b7('0x10')](_0x45b7('0x23'),_0x3470ff,JSON[_0x45b7('0x12')](_0x42d8d5));_0x5733af(_0x42d8d5);})[_0x45b7('0x17')](function(_0x14c880){logger[_0x45b7('0x13')](_0x45b7('0x23'),_0x14c880[_0x45b7('0x15')],_0x3470ff);_0x16ac1c(_0xfc5750[_0x45b7('0x13')](0x1f4,_0x14c880[_0x45b7('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 37a1c6b..4665f98 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 _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 +var _0x46f5=['util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','show','isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','destroy','multer'];(function(_0xc48069,_0x5c404b){var _0x39c083=function(_0x19c389){while(--_0x19c389){_0xc48069['push'](_0xc48069['shift']());}};_0x39c083(++_0x5c404b);}(_0x46f5,0x72));var _0x546f=function(_0x5b5e99,_0x1cb685){_0x5b5e99=_0x5b5e99-0x0;var _0x5bcdd2=_0x46f5[_0x5b5e99];return _0x5bcdd2;};'use strict';var multer=require(_0x546f('0x0'));var util=require(_0x546f('0x1'));var path=require(_0x546f('0x2'));var timeout=require(_0x546f('0x3'));var express=require('express');var router=express[_0x546f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x546f('0x5'));var interaction=require(_0x546f('0x6'));var config=require(_0x546f('0x7'));var controller=require('./intServicenowConfiguration.controller');router[_0x546f('0x8')]('/',auth['isAuthenticated'](),controller[_0x546f('0x9')]);router[_0x546f('0x8')](_0x546f('0xa'),auth['isAuthenticated'](),controller[_0x546f('0xb')]);router['get']('/:id/fields',auth[_0x546f('0xc')](),controller[_0x546f('0xd')]);router[_0x546f('0x8')](_0x546f('0xe'),auth['isAuthenticated'](),controller[_0x546f('0xf')]);router['get'](_0x546f('0x10'),auth[_0x546f('0xc')](),controller[_0x546f('0x11')]);router[_0x546f('0x12')]('/',auth[_0x546f('0xc')](),controller[_0x546f('0x13')]);router[_0x546f('0x14')](_0x546f('0xa'),auth[_0x546f('0xc')](),controller[_0x546f('0x15')]);router['delete'](_0x546f('0xa'),auth['isAuthenticated'](),controller[_0x546f('0x16')]);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 fde7d9a..e099051 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 _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 +var _0x0d39=['sequelize','STRING'];(function(_0x5f5c34,_0x23e89){var _0x48c0a7=function(_0x12124a){while(--_0x12124a){_0x5f5c34['push'](_0x5f5c34['shift']());}};_0x48c0a7(++_0x23e89);}(_0x0d39,0x150));var _0x90d3=function(_0x8cacd2,_0x14a935){_0x8cacd2=_0x8cacd2-0x0;var _0x3eeeff=_0x0d39[_0x8cacd2];return _0x3eeeff;};'use strict';var Sequelize=require(_0x90d3('0x0'));module['exports']={'name':{'type':Sequelize[_0x90d3('0x1')]},'description':{'type':Sequelize[_0x90d3('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index cb83971..b2118b0 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 _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 +var _0x077d=['moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','status','end','error','name','index','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','ServicenowConfiguration','includeAll','include','findAll','rows','catch','params','find','body','destroy','getFields','getSubjects','ServicenowField','getDescriptions','eml-format','rimraf','zip-dir'];(function(_0x50401f,_0x3dabcc){var _0x179b89=function(_0x5670dc){while(--_0x5670dc){_0x50401f['push'](_0x50401f['shift']());}};_0x179b89(++_0x3dabcc);}(_0x077d,0x192));var _0xd077=function(_0x4d8be5,_0x13c53e){_0x4d8be5=_0x4d8be5-0x0;var _0x1517ca=_0x077d[_0x4d8be5];return _0x1517ca;};'use strict';var emlformat=require(_0xd077('0x0'));var rimraf=require(_0xd077('0x1'));var zipdir=require(_0xd077('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd077('0x3'));var BPromise=require(_0xd077('0x4'));var Mustache=require(_0xd077('0x5'));var util=require(_0xd077('0x6'));var path=require(_0xd077('0x7'));var sox=require(_0xd077('0x8'));var csv=require('to-csv');var ejs=require(_0xd077('0x9'));var fs=require('fs');var fs_extra=require(_0xd077('0xa'));var _=require(_0xd077('0xb'));var squel=require(_0xd077('0xc'));var crypto=require(_0xd077('0xd'));var jsforce=require(_0xd077('0xe'));var deskjs=require(_0xd077('0xf'));var toCsv=require(_0xd077('0x10'));var querystring=require(_0xd077('0x11'));var Papa=require(_0xd077('0x12'));var Redis=require(_0xd077('0x13'));var authService=require(_0xd077('0x14'));var qs=require(_0xd077('0x15'));var as=require(_0xd077('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd077('0x17'))(_0xd077('0x18'));var utils=require(_0xd077('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd077('0x1a'))['db'];function respondWithStatusCode(_0x3c3fa7,_0xa41124){_0xa41124=_0xa41124||0xcc;return function(_0x329cdd){if(_0x329cdd){return _0x3c3fa7[_0xd077('0x1b')](_0xa41124);}return _0x3c3fa7['status'](_0xa41124)['end']();};}function respondWithResult(_0x43cd9d,_0x38e9ad){_0x38e9ad=_0x38e9ad||0xc8;return function(_0x28448a){if(_0x28448a){return _0x43cd9d['status'](_0x38e9ad)['json'](_0x28448a);}};}function respondWithFilteredResult(_0x5c99c0,_0x19ef75){return function(_0xcd820e){if(_0xcd820e){var _0x335d08=typeof _0x19ef75[_0xd077('0x1c')]===_0xd077('0x1d')&&typeof _0x19ef75[_0xd077('0x1e')]===_0xd077('0x1d');var _0x40839c=_0xcd820e[_0xd077('0x1f')];var _0x2a6977=_0x335d08?0x0:_0x19ef75[_0xd077('0x1c')];var _0x2ca11c=_0x335d08?_0xcd820e[_0xd077('0x1f')]:_0x19ef75['offset']+_0x19ef75[_0xd077('0x1e')];var _0x558dea;if(_0x2ca11c>=_0x40839c){_0x2ca11c=_0x40839c;_0x558dea=0xc8;}else{_0x558dea=0xce;}_0x5c99c0['status'](_0x558dea);return _0x5c99c0[_0xd077('0x20')](_0xd077('0x21'),_0x2a6977+'-'+_0x2ca11c+'/'+_0x40839c)[_0xd077('0x22')](_0xcd820e);}return null;};}function patchUpdates(_0x2125aa){return function(_0x2ebc4c){try{jsonpatch[_0xd077('0x23')](_0x2ebc4c,_0x2125aa,!![]);}catch(_0x5770eb){return BPromise[_0xd077('0x24')](_0x5770eb);}return _0x2ebc4c['save']();};}function saveUpdates(_0x595b4e,_0x1f5142){return function(_0x138e0f){if(_0x138e0f){return _0x138e0f[_0xd077('0x25')](_0x595b4e)[_0xd077('0x26')](function(_0x318e22){return _0x318e22;});}return null;};}function removeEntity(_0x3357ee,_0x3391b6){return function(_0x3ca2be){if(_0x3ca2be){return _0x3ca2be['destroy']()[_0xd077('0x26')](function(){_0x3357ee[_0xd077('0x27')](0xcc)[_0xd077('0x28')]();});}};}function handleEntityNotFound(_0x59ddff,_0x98b0c4){return function(_0x484d05){if(!_0x484d05){_0x59ddff[_0xd077('0x1b')](0x194);}return _0x484d05;};}function handleError(_0x3bcc97,_0x357bff){_0x357bff=_0x357bff||0x1f4;return function(_0xc78a89){logger[_0xd077('0x29')](_0xc78a89['stack']);if(_0xc78a89[_0xd077('0x2a')]){delete _0xc78a89[_0xd077('0x2a')];}_0x3bcc97['status'](_0x357bff)['send'](_0xc78a89);};}exports[_0xd077('0x2b')]=function(_0x1db4af,_0x266924){var _0x11b211={},_0x379c44={},_0x18b57f={'count':0x0,'rows':[]};var _0x51d8ca=_['map'](db['ServicenowConfiguration'][_0xd077('0x2c')],function(_0x59c008){return{'name':_0x59c008[_0xd077('0x2d')],'type':_0x59c008[_0xd077('0x2e')][_0xd077('0x2f')]};});_0x379c44['model']=_[_0xd077('0x30')](_0x51d8ca,_0xd077('0x2a'));_0x379c44[_0xd077('0x31')]=_[_0xd077('0x32')](_0x1db4af[_0xd077('0x31')]);_0x379c44[_0xd077('0x33')]=_[_0xd077('0x34')](_0x379c44[_0xd077('0x35')],_0x379c44[_0xd077('0x31')]);_0x11b211['attributes']=_[_0xd077('0x34')](_0x379c44['model'],qs[_0xd077('0x36')](_0x1db4af[_0xd077('0x31')][_0xd077('0x36')]));_0x11b211[_0xd077('0x37')]=_0x11b211['attributes'][_0xd077('0x38')]?_0x11b211[_0xd077('0x37')]:_0x379c44['model'];if(!_0x1db4af[_0xd077('0x31')][_0xd077('0x39')](_0xd077('0x3a'))){_0x11b211['limit']=qs[_0xd077('0x1e')](_0x1db4af[_0xd077('0x31')][_0xd077('0x1e')]);_0x11b211[_0xd077('0x1c')]=qs[_0xd077('0x1c')](_0x1db4af[_0xd077('0x31')]['offset']);}_0x11b211[_0xd077('0x3b')]=qs[_0xd077('0x3c')](_0x1db4af[_0xd077('0x31')]['sort']);_0x11b211[_0xd077('0x3d')]=qs['filters'](_[_0xd077('0x3e')](_0x1db4af[_0xd077('0x31')],_0x379c44[_0xd077('0x33')]),_0x51d8ca);if(_0x1db4af['query'][_0xd077('0x3f')]){_0x11b211[_0xd077('0x3d')]=_['merge'](_0x11b211[_0xd077('0x3d')],{'$or':_[_0xd077('0x30')](_0x51d8ca,function(_0x4ef5b1){if(_0x4ef5b1['type']!==_0xd077('0x40')){var _0x147f13={};_0x147f13[_0x4ef5b1[_0xd077('0x2a')]]={'$like':'%'+_0x1db4af['query'][_0xd077('0x3f')]+'%'};return _0x147f13;}})});}_0x11b211=_[_0xd077('0x41')]({},_0x11b211,_0x1db4af[_0xd077('0x42')]);var _0x5c8000={'where':_0x11b211['where']};return db[_0xd077('0x43')][_0xd077('0x1f')](_0x5c8000)[_0xd077('0x26')](function(_0x196296){_0x18b57f[_0xd077('0x1f')]=_0x196296;if(_0x1db4af[_0xd077('0x31')][_0xd077('0x44')]){_0x11b211[_0xd077('0x45')]=[{'all':!![]}];}return db[_0xd077('0x43')][_0xd077('0x46')](_0x11b211);})[_0xd077('0x26')](function(_0xfeaf38){_0x18b57f[_0xd077('0x47')]=_0xfeaf38;return _0x18b57f;})['then'](respondWithFilteredResult(_0x266924,_0x11b211))[_0xd077('0x48')](handleError(_0x266924,null));};exports['show']=function(_0x6c4b20,_0x3c40ab){var _0x621632={'raw':![],'where':{'id':_0x6c4b20[_0xd077('0x49')]['id']}},_0x521d96={};_0x521d96[_0xd077('0x35')]=_[_0xd077('0x32')](db[_0xd077('0x43')][_0xd077('0x2c')]);_0x521d96[_0xd077('0x31')]=_['keys'](_0x6c4b20[_0xd077('0x31')]);_0x521d96[_0xd077('0x33')]=_[_0xd077('0x34')](_0x521d96['model'],_0x521d96['query']);_0x621632['attributes']=_[_0xd077('0x34')](_0x521d96['model'],qs[_0xd077('0x36')](_0x6c4b20[_0xd077('0x31')]['fields']));_0x621632[_0xd077('0x37')]=_0x621632[_0xd077('0x37')][_0xd077('0x38')]?_0x621632[_0xd077('0x37')]:_0x521d96[_0xd077('0x35')];if(_0x6c4b20[_0xd077('0x31')]['includeAll']){_0x621632[_0xd077('0x45')]=[{'all':!![]}];}_0x621632=_[_0xd077('0x41')]({},_0x621632,_0x6c4b20[_0xd077('0x42')]);return db['ServicenowConfiguration'][_0xd077('0x4a')](_0x621632)[_0xd077('0x26')](handleEntityNotFound(_0x3c40ab,null))[_0xd077('0x26')](respondWithResult(_0x3c40ab,null))[_0xd077('0x48')](handleError(_0x3c40ab,null));};exports['create']=function(_0x2118e9,_0x4bf97c){return db[_0xd077('0x43')]['create'](_0x2118e9[_0xd077('0x4b')],{})[_0xd077('0x26')](respondWithResult(_0x4bf97c,0xc9))[_0xd077('0x48')](handleError(_0x4bf97c,null));};exports[_0xd077('0x25')]=function(_0x19e617,_0x5bf248){if(_0x19e617[_0xd077('0x4b')]['id']){delete _0x19e617[_0xd077('0x4b')]['id'];}return db[_0xd077('0x43')][_0xd077('0x4a')]({'where':{'id':_0x19e617[_0xd077('0x49')]['id']}})['then'](handleEntityNotFound(_0x5bf248,null))['then'](saveUpdates(_0x19e617[_0xd077('0x4b')],null))['then'](respondWithResult(_0x5bf248,null))[_0xd077('0x48')](handleError(_0x5bf248,null));};exports[_0xd077('0x4c')]=function(_0x321d46,_0x7e9ceb){return db[_0xd077('0x43')][_0xd077('0x4a')]({'where':{'id':_0x321d46[_0xd077('0x49')]['id']}})[_0xd077('0x26')](handleEntityNotFound(_0x7e9ceb,null))['then'](removeEntity(_0x7e9ceb,null))[_0xd077('0x48')](handleError(_0x7e9ceb,null));};exports[_0xd077('0x4d')]=function(_0x2c31f5,_0x535b7c,_0xd59f86){var _0xa97e3c={};var _0x3bd0d1={};var _0x30ac47;var _0x1327a2;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x2c31f5[_0xd077('0x49')]['id']}})[_0xd077('0x26')](handleEntityNotFound(_0x535b7c,null))[_0xd077('0x26')](function(_0x13f080){if(_0x13f080){_0x30ac47=_0x13f080;_0x3bd0d1[_0xd077('0x35')]=_['keys'](db['ServicenowField']['rawAttributes']);_0x3bd0d1[_0xd077('0x31')]=_[_0xd077('0x32')](_0x2c31f5[_0xd077('0x31')]);_0x3bd0d1[_0xd077('0x33')]=_[_0xd077('0x34')](_0x3bd0d1[_0xd077('0x35')],_0x3bd0d1['query']);_0xa97e3c[_0xd077('0x37')]=_['intersection'](_0x3bd0d1[_0xd077('0x35')],qs[_0xd077('0x36')](_0x2c31f5['query'][_0xd077('0x36')]));_0xa97e3c['attributes']=_0xa97e3c[_0xd077('0x37')]['length']?_0xa97e3c['attributes']:_0x3bd0d1['model'];_0xa97e3c[_0xd077('0x3b')]=qs['sort'](_0x2c31f5['query'][_0xd077('0x3c')]);_0xa97e3c[_0xd077('0x3d')]=qs[_0xd077('0x33')](_[_0xd077('0x3e')](_0x2c31f5['query'],_0x3bd0d1[_0xd077('0x33')]));if(_0x2c31f5['query'][_0xd077('0x3f')]){_0xa97e3c[_0xd077('0x3d')]=_[_0xd077('0x41')](_0xa97e3c[_0xd077('0x3d')],{'$or':_[_0xd077('0x30')](_0xa97e3c[_0xd077('0x37')],function(_0x31dccd){var _0x589e43={};_0x589e43[_0x31dccd]={'$like':'%'+_0x2c31f5['query'][_0xd077('0x3f')]+'%'};return _0x589e43;})});}_0xa97e3c=_['merge']({},_0xa97e3c,_0x2c31f5[_0xd077('0x42')]);return _0x30ac47['getFields'](_0xa97e3c);}})[_0xd077('0x26')](function(_0x22cfaf){if(_0x22cfaf){_0x1327a2=_0x22cfaf['length'];if(!_0x2c31f5[_0xd077('0x31')]['hasOwnProperty'](_0xd077('0x3a'))){_0xa97e3c[_0xd077('0x1e')]=qs[_0xd077('0x1e')](_0x2c31f5[_0xd077('0x31')][_0xd077('0x1e')]);_0xa97e3c[_0xd077('0x1c')]=qs[_0xd077('0x1c')](_0x2c31f5[_0xd077('0x31')][_0xd077('0x1c')]);}return _0x30ac47[_0xd077('0x4d')](_0xa97e3c);}})[_0xd077('0x26')](function(_0x3baa46){if(_0x3baa46){return _0x3baa46?{'count':_0x1327a2,'rows':_0x3baa46}:null;}})[_0xd077('0x26')](respondWithResult(_0x535b7c,null))[_0xd077('0x48')](handleError(_0x535b7c,null));};exports[_0xd077('0x4e')]=function(_0x46fd6f,_0x46f5e2,_0x3eeccb){var _0x2e1944={};var _0x5842c8={};var _0xca1b9c;var _0x2fbab1;return db[_0xd077('0x43')]['findOne']({'where':{'id':_0x46fd6f[_0xd077('0x49')]['id']}})['then'](handleEntityNotFound(_0x46f5e2,null))['then'](function(_0x191fb8){if(_0x191fb8){_0xca1b9c=_0x191fb8;_0x5842c8[_0xd077('0x35')]=_['keys'](db[_0xd077('0x4f')][_0xd077('0x2c')]);_0x5842c8[_0xd077('0x31')]=_['keys'](_0x46fd6f[_0xd077('0x31')]);_0x5842c8[_0xd077('0x33')]=_[_0xd077('0x34')](_0x5842c8[_0xd077('0x35')],_0x5842c8[_0xd077('0x31')]);_0x2e1944[_0xd077('0x37')]=_[_0xd077('0x34')](_0x5842c8[_0xd077('0x35')],qs[_0xd077('0x36')](_0x46fd6f[_0xd077('0x31')]['fields']));_0x2e1944[_0xd077('0x37')]=_0x2e1944[_0xd077('0x37')][_0xd077('0x38')]?_0x2e1944[_0xd077('0x37')]:_0x5842c8[_0xd077('0x35')];_0x2e1944[_0xd077('0x3b')]=qs[_0xd077('0x3c')](_0x46fd6f[_0xd077('0x31')][_0xd077('0x3c')]);_0x2e1944['where']=qs[_0xd077('0x33')](_[_0xd077('0x3e')](_0x46fd6f[_0xd077('0x31')],_0x5842c8[_0xd077('0x33')]));if(_0x46fd6f['query']['filter']){_0x2e1944[_0xd077('0x3d')]=_[_0xd077('0x41')](_0x2e1944[_0xd077('0x3d')],{'$or':_[_0xd077('0x30')](_0x2e1944['attributes'],function(_0x160730){var _0x5eaefa={};_0x5eaefa[_0x160730]={'$like':'%'+_0x46fd6f[_0xd077('0x31')][_0xd077('0x3f')]+'%'};return _0x5eaefa;})});}_0x2e1944=_['merge']({},_0x2e1944,_0x46fd6f[_0xd077('0x42')]);return _0xca1b9c[_0xd077('0x4e')](_0x2e1944);}})['then'](function(_0x4f5abf){if(_0x4f5abf){_0x2fbab1=_0x4f5abf[_0xd077('0x38')];if(!_0x46fd6f[_0xd077('0x31')][_0xd077('0x39')](_0xd077('0x3a'))){_0x2e1944[_0xd077('0x1e')]=qs[_0xd077('0x1e')](_0x46fd6f[_0xd077('0x31')]['limit']);_0x2e1944[_0xd077('0x1c')]=qs[_0xd077('0x1c')](_0x46fd6f[_0xd077('0x31')]['offset']);}return _0xca1b9c[_0xd077('0x4e')](_0x2e1944);}})[_0xd077('0x26')](function(_0x666d59){if(_0x666d59){return _0x666d59?{'count':_0x2fbab1,'rows':_0x666d59}:null;}})[_0xd077('0x26')](respondWithResult(_0x46f5e2,null))['catch'](handleError(_0x46f5e2,null));};exports[_0xd077('0x50')]=function(_0x32c1d7,_0x1aad39,_0x514c78){var _0x5b0f53={};var _0x295e18={};var _0x1178b3;var _0x15df9c;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x32c1d7['params']['id']}})['then'](handleEntityNotFound(_0x1aad39,null))['then'](function(_0x56b08c){if(_0x56b08c){_0x1178b3=_0x56b08c;_0x295e18[_0xd077('0x35')]=_[_0xd077('0x32')](db['ServicenowField'][_0xd077('0x2c')]);_0x295e18[_0xd077('0x31')]=_[_0xd077('0x32')](_0x32c1d7[_0xd077('0x31')]);_0x295e18[_0xd077('0x33')]=_[_0xd077('0x34')](_0x295e18[_0xd077('0x35')],_0x295e18['query']);_0x5b0f53[_0xd077('0x37')]=_[_0xd077('0x34')](_0x295e18[_0xd077('0x35')],qs[_0xd077('0x36')](_0x32c1d7[_0xd077('0x31')]['fields']));_0x5b0f53['attributes']=_0x5b0f53[_0xd077('0x37')][_0xd077('0x38')]?_0x5b0f53[_0xd077('0x37')]:_0x295e18[_0xd077('0x35')];_0x5b0f53[_0xd077('0x3b')]=qs['sort'](_0x32c1d7[_0xd077('0x31')][_0xd077('0x3c')]);_0x5b0f53[_0xd077('0x3d')]=qs[_0xd077('0x33')](_[_0xd077('0x3e')](_0x32c1d7[_0xd077('0x31')],_0x295e18[_0xd077('0x33')]));if(_0x32c1d7[_0xd077('0x31')]['filter']){_0x5b0f53[_0xd077('0x3d')]=_[_0xd077('0x41')](_0x5b0f53[_0xd077('0x3d')],{'$or':_['map'](_0x5b0f53[_0xd077('0x37')],function(_0x7b851a){var _0x47b009={};_0x47b009[_0x7b851a]={'$like':'%'+_0x32c1d7[_0xd077('0x31')][_0xd077('0x3f')]+'%'};return _0x47b009;})});}_0x5b0f53=_[_0xd077('0x41')]({},_0x5b0f53,_0x32c1d7[_0xd077('0x42')]);return _0x1178b3[_0xd077('0x50')](_0x5b0f53);}})[_0xd077('0x26')](function(_0x2f8092){if(_0x2f8092){_0x15df9c=_0x2f8092[_0xd077('0x38')];if(!_0x32c1d7['query'][_0xd077('0x39')]('nolimit')){_0x5b0f53['limit']=qs[_0xd077('0x1e')](_0x32c1d7[_0xd077('0x31')][_0xd077('0x1e')]);_0x5b0f53[_0xd077('0x1c')]=qs['offset'](_0x32c1d7[_0xd077('0x31')][_0xd077('0x1c')]);}return _0x1178b3[_0xd077('0x50')](_0x5b0f53);}})[_0xd077('0x26')](function(_0x3642b8){if(_0x3642b8){return _0x3642b8?{'count':_0x15df9c,'rows':_0x3642b8}:null;}})[_0xd077('0x26')](respondWithResult(_0x1aad39,null))[_0xd077('0x48')](handleError(_0x1aad39,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 7eb18e6..4589727 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 _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 +var _0x390a=['api','bluebird','request-promise','path','rimraf','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','lodash','util','../../config/logger'];(function(_0x1c7137,_0x4c7c26){var _0xeb4432=function(_0x26d850){while(--_0x26d850){_0x1c7137['push'](_0x1c7137['shift']());}};_0xeb4432(++_0x4c7c26);}(_0x390a,0xc9));var _0xa390=function(_0x520f3c,_0x48335f){_0x520f3c=_0x520f3c-0x0;var _0x445db9=_0x390a[_0x520f3c];return _0x445db9;};'use strict';var _=require(_0xa390('0x0'));var util=require(_0xa390('0x1'));var logger=require(_0xa390('0x2'))(_0xa390('0x3'));var moment=require('moment');var BPromise=require(_0xa390('0x4'));var rp=require(_0xa390('0x5'));var fs=require('fs');var path=require(_0xa390('0x6'));var rimraf=require(_0xa390('0x7'));var config=require('../../config/environment');var attributes=require(_0xa390('0x8'));module[_0xa390('0x9')]=function(_0x3d7cd7,_0x4ac9f5){return _0x3d7cd7[_0xa390('0xa')](_0xa390('0xb'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 349f831..5d0f427 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 _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 +var _0x5cd1=['info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','ServicenowConfiguration,\x20%s,\x20%s','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x2842b4,_0x2b1b7b){var _0x2b9521=function(_0x3613b8){while(--_0x3613b8){_0x2842b4['push'](_0x2842b4['shift']());}};_0x2b9521(++_0x2b1b7b);}(_0x5cd1,0x137));var _0x15cd=function(_0x2fedfd,_0xc018df){_0x2fedfd=_0x2fedfd-0x0;var _0x391853=_0x5cd1[_0x2fedfd];return _0x391853;};'use strict';var _=require('lodash');var util=require(_0x15cd('0x0'));var moment=require(_0x15cd('0x1'));var BPromise=require(_0x15cd('0x2'));var rs=require(_0x15cd('0x3'));var fs=require('fs');var Redis=require(_0x15cd('0x4'));var db=require(_0x15cd('0x5'))['db'];var utils=require(_0x15cd('0x6'));var logger=require(_0x15cd('0x7'))(_0x15cd('0x8'));var config=require(_0x15cd('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x14523a,_0x273fa0,_0xfbeec8){return new BPromise(function(_0x2aa238,_0x8087eb){return client[_0x15cd('0xa')](_0x14523a,_0xfbeec8)[_0x15cd('0xb')](function(_0x5cf06c){logger['info'](_0x15cd('0xc'),_0x273fa0,'request\x20sent');logger[_0x15cd('0xd')](_0x15cd('0xe'),_0x273fa0,_0x15cd('0xf'),JSON['stringify'](_0x5cf06c));if(_0x5cf06c[_0x15cd('0x10')]){if(_0x5cf06c[_0x15cd('0x10')][_0x15cd('0x11')]===0x1f4){logger[_0x15cd('0x10')](_0x15cd('0xc'),_0x273fa0,_0x5cf06c[_0x15cd('0x10')][_0x15cd('0x12')]);return _0x8087eb(_0x5cf06c[_0x15cd('0x10')][_0x15cd('0x12')]);}logger[_0x15cd('0x10')](_0x15cd('0xc'),_0x273fa0,_0x5cf06c[_0x15cd('0x10')][_0x15cd('0x12')]);return _0x2aa238(_0x5cf06c[_0x15cd('0x10')][_0x15cd('0x12')]);}else{logger[_0x15cd('0x13')](_0x15cd('0xc'),_0x273fa0,_0x15cd('0xf'));_0x2aa238(_0x5cf06c[_0x15cd('0x14')][_0x15cd('0x12')]);}})[_0x15cd('0x15')](function(_0x4caae9){logger[_0x15cd('0x10')](_0x15cd('0xc'),_0x273fa0,_0x4caae9);_0x8087eb(_0x4caae9);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 709dc68..c8610ac 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 _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 +var _0x8be4=['index','/:id','show','post','isAuthenticated','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get'];(function(_0x409e72,_0x2c5061){var _0x51ca54=function(_0xcb4e75){while(--_0xcb4e75){_0x409e72['push'](_0x409e72['shift']());}};_0x51ca54(++_0x2c5061);}(_0x8be4,0x129));var _0x48be=function(_0xb0b922,_0x183826){_0xb0b922=_0xb0b922-0x0;var _0x5dc41e=_0x8be4[_0xb0b922];return _0x5dc41e;};'use strict';var multer=require('multer');var util=require(_0x48be('0x0'));var path=require(_0x48be('0x1'));var timeout=require(_0x48be('0x2'));var express=require(_0x48be('0x3'));var router=express[_0x48be('0x4')]();var fs_extra=require(_0x48be('0x5'));var auth=require(_0x48be('0x6'));var interaction=require(_0x48be('0x7'));var config=require('../../config/environment');var controller=require('./intServicenowField.controller');router[_0x48be('0x8')]('/',auth['isAuthenticated'](),controller[_0x48be('0x9')]);router[_0x48be('0x8')](_0x48be('0xa'),auth['isAuthenticated'](),controller[_0x48be('0xb')]);router[_0x48be('0xc')]('/',auth[_0x48be('0xd')](),controller['create']);router[_0x48be('0xe')](_0x48be('0xa'),auth[_0x48be('0xd')](),controller[_0x48be('0xf')]);router['delete'](_0x48be('0xa'),auth[_0x48be('0xd')](),controller[_0x48be('0x10')]);module[_0x48be('0x11')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index a804a21..20ab002 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 _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 +var _0xdb99=['STRING','variable','BOOLEAN','ENUM','string','customVariable','keyValue','picklist'];(function(_0x15d60e,_0x4e846d){var _0x5c6452=function(_0x1ca41c){while(--_0x1ca41c){_0x15d60e['push'](_0x15d60e['shift']());}};_0x5c6452(++_0x4e846d);}(_0xdb99,0xdb));var _0x9db9=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0xdb99[_0x35885a];return _0xe86249;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x9db9('0x0')](_0x9db9('0x1'),'variable',_0x9db9('0x2'),_0x9db9('0x3'),_0x9db9('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x9db9('0x5')]},'key':{'type':Sequelize[_0x9db9('0x5')]},'keyType':{'type':Sequelize[_0x9db9('0x0')]('string',_0x9db9('0x6'),_0x9db9('0x2'))},'keyContent':{'type':Sequelize[_0x9db9('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x9db9('0x5')]},'customField':{'type':Sequelize[_0x9db9('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9db9('0x5')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index a44b022..b655cfd 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 _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 +var _0x058a=['moment','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','count','offset','limit','json','apply','reject','save','update','then','destroy','error','stack','name','index','map','ServicenowField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','catch','show','length','create','body','params','eml-format','rimraf','request-promise'];(function(_0x4aefb9,_0x55959c){var _0x3152dc=function(_0x5f5bd5){while(--_0x5f5bd5){_0x4aefb9['push'](_0x4aefb9['shift']());}};_0x3152dc(++_0x55959c);}(_0x058a,0xde));var _0xa058=function(_0x18f64f,_0x1b3c55){_0x18f64f=_0x18f64f-0x0;var _0x45cf0f=_0x058a[_0x18f64f];return _0x45cf0f;};'use strict';var emlformat=require(_0xa058('0x0'));var rimraf=require(_0xa058('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa058('0x2'));var moment=require(_0xa058('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa058('0x4'));var util=require(_0xa058('0x5'));var path=require(_0xa058('0x6'));var sox=require('sox');var csv=require(_0xa058('0x7'));var ejs=require(_0xa058('0x8'));var fs=require('fs');var fs_extra=require(_0xa058('0x9'));var _=require('lodash');var squel=require(_0xa058('0xa'));var crypto=require(_0xa058('0xb'));var jsforce=require(_0xa058('0xc'));var deskjs=require(_0xa058('0xd'));var toCsv=require(_0xa058('0x7'));var querystring=require(_0xa058('0xe'));var Papa=require(_0xa058('0xf'));var Redis=require(_0xa058('0x10'));var authService=require(_0xa058('0x11'));var qs=require(_0xa058('0x12'));var as=require(_0xa058('0x13'));var hardwareService=require(_0xa058('0x14'));var logger=require(_0xa058('0x15'))(_0xa058('0x16'));var utils=require(_0xa058('0x17'));var config=require(_0xa058('0x18'));var licenseUtil=require(_0xa058('0x19'));var db=require(_0xa058('0x1a'))['db'];function respondWithStatusCode(_0x1da6cf,_0x3511ca){_0x3511ca=_0x3511ca||0xcc;return function(_0x5b50ca){if(_0x5b50ca){return _0x1da6cf[_0xa058('0x1b')](_0x3511ca);}return _0x1da6cf['status'](_0x3511ca)[_0xa058('0x1c')]();};}function respondWithResult(_0x5b198c,_0x3d49){_0x3d49=_0x3d49||0xc8;return function(_0x56f577){if(_0x56f577){return _0x5b198c[_0xa058('0x1d')](_0x3d49)['json'](_0x56f577);}};}function respondWithFilteredResult(_0x28cea,_0x28b309){return function(_0x52409d){if(_0x52409d){var _0x1d7a19=typeof _0x28b309['offset']==='undefined'&&typeof _0x28b309['limit']===_0xa058('0x1e');var _0x4edf7a=_0x52409d[_0xa058('0x1f')];var _0x54a873=_0x1d7a19?0x0:_0x28b309[_0xa058('0x20')];var _0x53c9bd=_0x1d7a19?_0x52409d['count']:_0x28b309[_0xa058('0x20')]+_0x28b309[_0xa058('0x21')];var _0x37487f;if(_0x53c9bd>=_0x4edf7a){_0x53c9bd=_0x4edf7a;_0x37487f=0xc8;}else{_0x37487f=0xce;}_0x28cea[_0xa058('0x1d')](_0x37487f);return _0x28cea['set']('Content-Range',_0x54a873+'-'+_0x53c9bd+'/'+_0x4edf7a)[_0xa058('0x22')](_0x52409d);}return null;};}function patchUpdates(_0x226376){return function(_0x40c908){try{jsonpatch[_0xa058('0x23')](_0x40c908,_0x226376,!![]);}catch(_0x49ab0a){return BPromise[_0xa058('0x24')](_0x49ab0a);}return _0x40c908[_0xa058('0x25')]();};}function saveUpdates(_0x5d090c,_0x52c793){return function(_0x41ee7f){if(_0x41ee7f){return _0x41ee7f[_0xa058('0x26')](_0x5d090c)[_0xa058('0x27')](function(_0x46d742){return _0x46d742;});}return null;};}function removeEntity(_0x14010e,_0x2882d0){return function(_0x315e68){if(_0x315e68){return _0x315e68[_0xa058('0x28')]()[_0xa058('0x27')](function(){_0x14010e[_0xa058('0x1d')](0xcc)[_0xa058('0x1c')]();});}};}function handleEntityNotFound(_0x46e02a,_0xa2260c){return function(_0x320bb0){if(!_0x320bb0){_0x46e02a['sendStatus'](0x194);}return _0x320bb0;};}function handleError(_0x4972d6,_0x3c81c3){_0x3c81c3=_0x3c81c3||0x1f4;return function(_0x1c5259){logger[_0xa058('0x29')](_0x1c5259[_0xa058('0x2a')]);if(_0x1c5259[_0xa058('0x2b')]){delete _0x1c5259['name'];}_0x4972d6[_0xa058('0x1d')](_0x3c81c3)['send'](_0x1c5259);};}exports[_0xa058('0x2c')]=function(_0x8ff1b5,_0x5e4059){var _0x12fd8b={},_0x5cf24a={},_0x2ceab9={'count':0x0,'rows':[]};var _0x4797cb=_[_0xa058('0x2d')](db[_0xa058('0x2e')][_0xa058('0x2f')],function(_0x1ff7c4){return{'name':_0x1ff7c4[_0xa058('0x30')],'type':_0x1ff7c4[_0xa058('0x31')][_0xa058('0x32')]};});_0x5cf24a[_0xa058('0x33')]=_[_0xa058('0x2d')](_0x4797cb,'name');_0x5cf24a[_0xa058('0x34')]=_[_0xa058('0x35')](_0x8ff1b5[_0xa058('0x34')]);_0x5cf24a[_0xa058('0x36')]=_['intersection'](_0x5cf24a['model'],_0x5cf24a[_0xa058('0x34')]);_0x12fd8b['attributes']=_[_0xa058('0x37')](_0x5cf24a[_0xa058('0x33')],qs['fields'](_0x8ff1b5[_0xa058('0x34')][_0xa058('0x38')]));_0x12fd8b[_0xa058('0x39')]=_0x12fd8b[_0xa058('0x39')]['length']?_0x12fd8b['attributes']:_0x5cf24a[_0xa058('0x33')];if(!_0x8ff1b5[_0xa058('0x34')][_0xa058('0x3a')](_0xa058('0x3b'))){_0x12fd8b[_0xa058('0x21')]=qs[_0xa058('0x21')](_0x8ff1b5[_0xa058('0x34')]['limit']);_0x12fd8b['offset']=qs['offset'](_0x8ff1b5[_0xa058('0x34')][_0xa058('0x20')]);}_0x12fd8b[_0xa058('0x3c')]=qs['sort'](_0x8ff1b5['query'][_0xa058('0x3d')]);_0x12fd8b[_0xa058('0x3e')]=qs[_0xa058('0x36')](_['pick'](_0x8ff1b5['query'],_0x5cf24a['filters']),_0x4797cb);if(_0x8ff1b5[_0xa058('0x34')][_0xa058('0x3f')]){_0x12fd8b[_0xa058('0x3e')]=_[_0xa058('0x40')](_0x12fd8b[_0xa058('0x3e')],{'$or':_['map'](_0x4797cb,function(_0x28a6b2){if(_0x28a6b2[_0xa058('0x31')]!==_0xa058('0x41')){var _0x46d350={};_0x46d350[_0x28a6b2[_0xa058('0x2b')]]={'$like':'%'+_0x8ff1b5[_0xa058('0x34')]['filter']+'%'};return _0x46d350;}})});}_0x12fd8b=_[_0xa058('0x40')]({},_0x12fd8b,_0x8ff1b5[_0xa058('0x42')]);var _0x62046b={'where':_0x12fd8b[_0xa058('0x3e')]};return db[_0xa058('0x2e')][_0xa058('0x1f')](_0x62046b)['then'](function(_0x38e3aa){_0x2ceab9['count']=_0x38e3aa;if(_0x8ff1b5[_0xa058('0x34')][_0xa058('0x43')]){_0x12fd8b[_0xa058('0x44')]=[{'all':!![]}];}return db['ServicenowField']['findAll'](_0x12fd8b);})[_0xa058('0x27')](function(_0x45ebd4){_0x2ceab9['rows']=_0x45ebd4;return _0x2ceab9;})[_0xa058('0x27')](respondWithFilteredResult(_0x5e4059,_0x12fd8b))[_0xa058('0x45')](handleError(_0x5e4059,null));};exports[_0xa058('0x46')]=function(_0x5b1922,_0x43824f){var _0x1e8a51={'raw':!![],'where':{'id':_0x5b1922['params']['id']}},_0x44be54={};_0x44be54[_0xa058('0x33')]=_[_0xa058('0x35')](db[_0xa058('0x2e')][_0xa058('0x2f')]);_0x44be54['query']=_[_0xa058('0x35')](_0x5b1922[_0xa058('0x34')]);_0x44be54[_0xa058('0x36')]=_['intersection'](_0x44be54[_0xa058('0x33')],_0x44be54[_0xa058('0x34')]);_0x1e8a51[_0xa058('0x39')]=_[_0xa058('0x37')](_0x44be54['model'],qs[_0xa058('0x38')](_0x5b1922['query'][_0xa058('0x38')]));_0x1e8a51[_0xa058('0x39')]=_0x1e8a51[_0xa058('0x39')][_0xa058('0x47')]?_0x1e8a51['attributes']:_0x44be54[_0xa058('0x33')];if(_0x5b1922['query'][_0xa058('0x43')]){_0x1e8a51[_0xa058('0x44')]=[{'all':!![]}];}_0x1e8a51=_['merge']({},_0x1e8a51,_0x5b1922[_0xa058('0x42')]);return db[_0xa058('0x2e')]['find'](_0x1e8a51)[_0xa058('0x27')](handleEntityNotFound(_0x43824f,null))[_0xa058('0x27')](respondWithResult(_0x43824f,null))['catch'](handleError(_0x43824f,null));};exports[_0xa058('0x48')]=function(_0x1199cc,_0x1ff7b0){return db[_0xa058('0x2e')][_0xa058('0x48')](_0x1199cc[_0xa058('0x49')],{})['then'](respondWithResult(_0x1ff7b0,0xc9))[_0xa058('0x45')](handleError(_0x1ff7b0,null));};exports[_0xa058('0x26')]=function(_0x57cf82,_0x2f52f7){if(_0x57cf82['body']['id']){delete _0x57cf82[_0xa058('0x49')]['id'];}return db[_0xa058('0x2e')]['find']({'where':{'id':_0x57cf82['params']['id']}})[_0xa058('0x27')](handleEntityNotFound(_0x2f52f7,null))['then'](saveUpdates(_0x57cf82[_0xa058('0x49')],null))[_0xa058('0x27')](respondWithResult(_0x2f52f7,null))['catch'](handleError(_0x2f52f7,null));};exports['destroy']=function(_0x420e00,_0xbfb0e9){return db['ServicenowField']['find']({'where':{'id':_0x420e00[_0xa058('0x4a')]['id']}})['then'](handleEntityNotFound(_0xbfb0e9,null))[_0xa058('0x27')](removeEntity(_0xbfb0e9,null))[_0xa058('0x45')](handleError(_0xbfb0e9,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 997b6f1..bfdc3f6 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 _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 +var _0x1e59=['path','rimraf','../../config/environment','./intServicenowField.attributes','exports','ServicenowField','int_servicenow_fields','servicenow_unique_index','FieldId','lodash','util','../../config/logger','moment','request-promise'];(function(_0x52e848,_0x295d07){var _0x123741=function(_0x146d15){while(--_0x146d15){_0x52e848['push'](_0x52e848['shift']());}};_0x123741(++_0x295d07);}(_0x1e59,0x121));var _0x91e5=function(_0x409ce5,_0x1fb551){_0x409ce5=_0x409ce5-0x0;var _0x1708f0=_0x1e59[_0x409ce5];return _0x1708f0;};'use strict';var _=require(_0x91e5('0x0'));var util=require(_0x91e5('0x1'));var logger=require(_0x91e5('0x2'))('api');var moment=require(_0x91e5('0x3'));var BPromise=require('bluebird');var rp=require(_0x91e5('0x4'));var fs=require('fs');var path=require(_0x91e5('0x5'));var rimraf=require(_0x91e5('0x6'));var config=require(_0x91e5('0x7'));var attributes=require(_0x91e5('0x8'));module[_0x91e5('0x9')]=function(_0x420d97,_0x3ee479){return _0x420d97['define'](_0x91e5('0xa'),attributes,{'tableName':_0x91e5('0xb'),'paranoid':![],'indexes':[{'name':_0x91e5('0xc'),'fields':['idField',_0x91e5('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index b4263d2..e15283d 100644 --- a/server/api/intServicenowField/intServicenowField.rpc.js +++ b/server/api/intServicenowField/intServicenowField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf4eb=['ServicenowField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_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 +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(_0x11fa3d,_0x27dd8e){var _0x364bb2=function(_0x43062c){while(--_0x43062c){_0x11fa3d['push'](_0x11fa3d['shift']());}};_0x364bb2(++_0x27dd8e);}(_0x70e0,0x17b));var _0x070e=function(_0x47c682,_0x5a999b){_0x47c682=_0x47c682-0x0;var _0x477908=_0x70e0[_0x47c682];return _0x477908;};'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 diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 7191d6c..09d388a 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 _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 +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(_0x29df70,_0x3614b1){var _0x522f34=function(_0xad9e34){while(--_0xad9e34){_0x29df70['push'](_0x29df70['shift']());}};_0x522f34(++_0x3614b1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'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 ecb6a83..664b126 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(_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 +var _0xa9e0=['remoteUri','sequelize','exports','STRING','username'];(function(_0x946484,_0xaebcd6){var _0xd3c7c4=function(_0x1dc9a0){while(--_0x1dc9a0){_0x946484['push'](_0x946484['shift']());}};_0xd3c7c4(++_0xaebcd6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0a9e('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0a9e('0x2')],'unique':_0x0a9e('0x4')},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index 286c8af..d52700f 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 _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 +var _0xb0f8=['rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','json','offset','limit','undefined','count','status','set','Content-Range','reject','update','then','destroy','error','stack','name','index','map','SugarcrmAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','order','pick','hasOwnProperty','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','created_by','date_start','duration_hours','parent_id','parent_type','direction','username','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','password','PLAIN','Invalid\x20Login','Password\x20Expired','Calls','module_fields','remove','includes','label','endsWith','values','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials'];(function(_0x52e764,_0x5634f5){var _0x57d01e=function(_0xf33008){while(--_0xf33008){_0x52e764['push'](_0x52e764['shift']());}};_0x57d01e(++_0x5634f5);}(_0xb0f8,0xf2));var _0x8b0f=function(_0x39866f,_0x4f7480){_0x39866f=_0x39866f-0x0;var _0x14748e=_0xb0f8[_0x39866f];return _0x14748e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8b0f('0x0'));var zipdir=require(_0x8b0f('0x1'));var jsonpatch=require(_0x8b0f('0x2'));var rp=require('request-promise');var moment=require(_0x8b0f('0x3'));var BPromise=require(_0x8b0f('0x4'));var Mustache=require(_0x8b0f('0x5'));var util=require(_0x8b0f('0x6'));var path=require('path');var sox=require(_0x8b0f('0x7'));var csv=require('to-csv');var ejs=require(_0x8b0f('0x8'));var fs=require('fs');var fs_extra=require(_0x8b0f('0x9'));var _=require('lodash');var squel=require(_0x8b0f('0xa'));var crypto=require(_0x8b0f('0xb'));var jsforce=require(_0x8b0f('0xc'));var deskjs=require(_0x8b0f('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8b0f('0xe'));var authService=require(_0x8b0f('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x8b0f('0x10'));var hardwareService=require(_0x8b0f('0x11'));var logger=require('../../config/logger')(_0x8b0f('0x12'));var utils=require('../../config/utils');var config=require(_0x8b0f('0x13'));var licenseUtil=require(_0x8b0f('0x14'));var db=require(_0x8b0f('0x15'))['db'];var integrations=require(_0x8b0f('0x16'));function respondWithStatusCode(_0x14a4a2,_0x356c80){_0x356c80=_0x356c80||0xcc;return function(_0x3bb517){if(_0x3bb517){return _0x14a4a2[_0x8b0f('0x17')](_0x356c80);}return _0x14a4a2['status'](_0x356c80)[_0x8b0f('0x18')]();};}function respondWithResult(_0x265a0f,_0x429e9b){_0x429e9b=_0x429e9b||0xc8;return function(_0x1c342a){if(_0x1c342a){return _0x265a0f['status'](_0x429e9b)[_0x8b0f('0x19')](_0x1c342a);}};}function respondWithFilteredResult(_0x5ae0c6,_0x32d17c){return function(_0x40efd2){if(_0x40efd2){var _0x1e8571=typeof _0x32d17c[_0x8b0f('0x1a')]==='undefined'&&typeof _0x32d17c[_0x8b0f('0x1b')]===_0x8b0f('0x1c');var _0x5a2fbe=_0x40efd2[_0x8b0f('0x1d')];var _0x362cd4=_0x1e8571?0x0:_0x32d17c[_0x8b0f('0x1a')];var _0x9dec14=_0x1e8571?_0x40efd2[_0x8b0f('0x1d')]:_0x32d17c[_0x8b0f('0x1a')]+_0x32d17c[_0x8b0f('0x1b')];var _0x257c2c;if(_0x9dec14>=_0x5a2fbe){_0x9dec14=_0x5a2fbe;_0x257c2c=0xc8;}else{_0x257c2c=0xce;}_0x5ae0c6[_0x8b0f('0x1e')](_0x257c2c);return _0x5ae0c6[_0x8b0f('0x1f')](_0x8b0f('0x20'),_0x362cd4+'-'+_0x9dec14+'/'+_0x5a2fbe)['json'](_0x40efd2);}return null;};}function patchUpdates(_0x23d9c6){return function(_0x5b71f6){try{jsonpatch['apply'](_0x5b71f6,_0x23d9c6,!![]);}catch(_0x4ccc38){return BPromise[_0x8b0f('0x21')](_0x4ccc38);}return _0x5b71f6['save']();};}function saveUpdates(_0x2ce840,_0x22bf18){return function(_0x1dac3c){if(_0x1dac3c){return _0x1dac3c[_0x8b0f('0x22')](_0x2ce840)[_0x8b0f('0x23')](function(_0x3e237c){return _0x3e237c;});}return null;};}function removeEntity(_0x35abed,_0x5e9d08){return function(_0x5d7bd7){if(_0x5d7bd7){return _0x5d7bd7[_0x8b0f('0x24')]()[_0x8b0f('0x23')](function(){_0x35abed['status'](0xcc)[_0x8b0f('0x18')]();});}};}function handleEntityNotFound(_0x17257d,_0x20860e){return function(_0x5d61d4){if(!_0x5d61d4){_0x17257d[_0x8b0f('0x17')](0x194);}return _0x5d61d4;};}function handleError(_0x5485de,_0x1b49df){_0x1b49df=_0x1b49df||0x1f4;return function(_0x28861f){logger[_0x8b0f('0x25')](_0x28861f[_0x8b0f('0x26')]);if(_0x28861f['name']){delete _0x28861f[_0x8b0f('0x27')];}_0x5485de[_0x8b0f('0x1e')](_0x1b49df)['send'](_0x28861f);};}exports[_0x8b0f('0x28')]=function(_0x4f112e,_0x36366f){var _0x56f457={},_0x528b91={},_0x39a6d9={'count':0x0,'rows':[]};var _0x236271=_[_0x8b0f('0x29')](db[_0x8b0f('0x2a')][_0x8b0f('0x2b')],function(_0x454131){return{'name':_0x454131[_0x8b0f('0x2c')],'type':_0x454131[_0x8b0f('0x2d')][_0x8b0f('0x2e')]};});_0x528b91[_0x8b0f('0x2f')]=_[_0x8b0f('0x29')](_0x236271,_0x8b0f('0x27'));_0x528b91[_0x8b0f('0x30')]=_[_0x8b0f('0x31')](_0x4f112e['query']);_0x528b91[_0x8b0f('0x32')]=_[_0x8b0f('0x33')](_0x528b91[_0x8b0f('0x2f')],_0x528b91[_0x8b0f('0x30')]);_0x56f457['attributes']=_[_0x8b0f('0x33')](_0x528b91[_0x8b0f('0x2f')],qs['fields'](_0x4f112e[_0x8b0f('0x30')][_0x8b0f('0x34')]));_0x56f457['attributes']=_0x56f457['attributes']['length']?_0x56f457[_0x8b0f('0x35')]:_0x528b91['model'];if(!_0x4f112e[_0x8b0f('0x30')]['hasOwnProperty'](_0x8b0f('0x36'))){_0x56f457[_0x8b0f('0x1b')]=qs[_0x8b0f('0x1b')](_0x4f112e['query'][_0x8b0f('0x1b')]);_0x56f457[_0x8b0f('0x1a')]=qs[_0x8b0f('0x1a')](_0x4f112e[_0x8b0f('0x30')]['offset']);}_0x56f457['order']=qs[_0x8b0f('0x37')](_0x4f112e[_0x8b0f('0x30')][_0x8b0f('0x37')]);_0x56f457[_0x8b0f('0x38')]=qs[_0x8b0f('0x32')](_['pick'](_0x4f112e[_0x8b0f('0x30')],_0x528b91[_0x8b0f('0x32')]),_0x236271);if(_0x4f112e[_0x8b0f('0x30')][_0x8b0f('0x39')]){_0x56f457[_0x8b0f('0x38')]=_[_0x8b0f('0x3a')](_0x56f457[_0x8b0f('0x38')],{'$or':_['map'](_0x236271,function(_0x18a6f3){if(_0x18a6f3[_0x8b0f('0x2d')]!==_0x8b0f('0x3b')){var _0xafcb16={};_0xafcb16[_0x18a6f3['name']]={'$like':'%'+_0x4f112e[_0x8b0f('0x30')][_0x8b0f('0x39')]+'%'};return _0xafcb16;}})});}_0x56f457=_['merge']({},_0x56f457,_0x4f112e[_0x8b0f('0x3c')]);var _0x4c48a3={'where':_0x56f457[_0x8b0f('0x38')]};return db['SugarcrmAccount']['count'](_0x4c48a3)['then'](function(_0x3a1df0){_0x39a6d9[_0x8b0f('0x1d')]=_0x3a1df0;if(_0x4f112e['query'][_0x8b0f('0x3d')]){_0x56f457[_0x8b0f('0x3e')]=[{'all':!![]}];}return db[_0x8b0f('0x2a')][_0x8b0f('0x3f')](_0x56f457);})[_0x8b0f('0x23')](function(_0x10f255){_0x39a6d9[_0x8b0f('0x40')]=_0x10f255;return _0x39a6d9;})[_0x8b0f('0x23')](respondWithFilteredResult(_0x36366f,_0x56f457))[_0x8b0f('0x41')](handleError(_0x36366f,null));};exports[_0x8b0f('0x42')]=function(_0x52180e,_0x100709){var _0x3809d1={'raw':![],'where':{'id':_0x52180e[_0x8b0f('0x43')]['id']}},_0x138978={};_0x138978[_0x8b0f('0x2f')]=_[_0x8b0f('0x31')](db['SugarcrmAccount'][_0x8b0f('0x2b')]);_0x138978[_0x8b0f('0x30')]=_[_0x8b0f('0x31')](_0x52180e[_0x8b0f('0x30')]);_0x138978[_0x8b0f('0x32')]=_[_0x8b0f('0x33')](_0x138978[_0x8b0f('0x2f')],_0x138978['query']);_0x3809d1[_0x8b0f('0x35')]=_[_0x8b0f('0x33')](_0x138978[_0x8b0f('0x2f')],qs[_0x8b0f('0x34')](_0x52180e['query'][_0x8b0f('0x34')]));_0x3809d1[_0x8b0f('0x35')]=_0x3809d1[_0x8b0f('0x35')][_0x8b0f('0x44')]?_0x3809d1[_0x8b0f('0x35')]:_0x138978[_0x8b0f('0x2f')];if(_0x52180e[_0x8b0f('0x30')][_0x8b0f('0x3d')]){_0x3809d1[_0x8b0f('0x3e')]=[{'all':!![]}];}_0x3809d1=_['merge']({},_0x3809d1,_0x52180e[_0x8b0f('0x3c')]);return db[_0x8b0f('0x2a')][_0x8b0f('0x45')](_0x3809d1)['then'](handleEntityNotFound(_0x100709,null))[_0x8b0f('0x23')](respondWithResult(_0x100709,null))[_0x8b0f('0x41')](handleError(_0x100709,null));};exports[_0x8b0f('0x46')]=function(_0x365084,_0x335c10){return db[_0x8b0f('0x2a')][_0x8b0f('0x46')](_0x365084[_0x8b0f('0x47')],{})[_0x8b0f('0x23')](respondWithResult(_0x335c10,0xc9))[_0x8b0f('0x41')](handleError(_0x335c10,null));};exports[_0x8b0f('0x22')]=function(_0x19e16b,_0x30fbe5){if(_0x19e16b[_0x8b0f('0x47')]['id']){delete _0x19e16b[_0x8b0f('0x47')]['id'];}return db[_0x8b0f('0x2a')][_0x8b0f('0x45')]({'where':{'id':_0x19e16b[_0x8b0f('0x43')]['id']}})[_0x8b0f('0x23')](handleEntityNotFound(_0x30fbe5,null))[_0x8b0f('0x23')](saveUpdates(_0x19e16b['body'],null))[_0x8b0f('0x23')](respondWithResult(_0x30fbe5,null))['catch'](handleError(_0x30fbe5,null));};exports[_0x8b0f('0x24')]=function(_0x5ce5e3,_0x363041){return db[_0x8b0f('0x2a')]['find']({'where':{'id':_0x5ce5e3[_0x8b0f('0x43')]['id']}})[_0x8b0f('0x23')](handleEntityNotFound(_0x363041,null))[_0x8b0f('0x23')](removeEntity(_0x363041,null))['catch'](handleError(_0x363041,null));};exports[_0x8b0f('0x48')]=function(_0x2bf9ab,_0x20cd42,_0x3e3470){var _0x40d223={};var _0x36c6d8={};var _0x36a06b;var _0x4499a3;return db[_0x8b0f('0x2a')][_0x8b0f('0x49')]({'where':{'id':_0x2bf9ab['params']['id']}})[_0x8b0f('0x23')](handleEntityNotFound(_0x20cd42,null))['then'](function(_0x5426b4){if(_0x5426b4){_0x36a06b=_0x5426b4;_0x36c6d8[_0x8b0f('0x2f')]=_[_0x8b0f('0x31')](db[_0x8b0f('0x4a')][_0x8b0f('0x2b')]);_0x36c6d8['query']=_[_0x8b0f('0x31')](_0x2bf9ab[_0x8b0f('0x30')]);_0x36c6d8[_0x8b0f('0x32')]=_[_0x8b0f('0x33')](_0x36c6d8[_0x8b0f('0x2f')],_0x36c6d8[_0x8b0f('0x30')]);_0x40d223[_0x8b0f('0x35')]=_['intersection'](_0x36c6d8[_0x8b0f('0x2f')],qs[_0x8b0f('0x34')](_0x2bf9ab[_0x8b0f('0x30')][_0x8b0f('0x34')]));_0x40d223['attributes']=_0x40d223[_0x8b0f('0x35')]['length']?_0x40d223['attributes']:_0x36c6d8['model'];_0x40d223[_0x8b0f('0x4b')]=qs[_0x8b0f('0x37')](_0x2bf9ab[_0x8b0f('0x30')][_0x8b0f('0x37')]);_0x40d223[_0x8b0f('0x38')]=qs['filters'](_[_0x8b0f('0x4c')](_0x2bf9ab[_0x8b0f('0x30')],_0x36c6d8[_0x8b0f('0x32')]));if(_0x2bf9ab[_0x8b0f('0x30')][_0x8b0f('0x39')]){_0x40d223['where']=_[_0x8b0f('0x3a')](_0x40d223[_0x8b0f('0x38')],{'$or':_[_0x8b0f('0x29')](_0x40d223[_0x8b0f('0x35')],function(_0x1ad1ec){var _0x53e9be={};_0x53e9be[_0x1ad1ec]={'$like':'%'+_0x2bf9ab[_0x8b0f('0x30')][_0x8b0f('0x39')]+'%'};return _0x53e9be;})});}_0x40d223=_[_0x8b0f('0x3a')]({},_0x40d223,_0x2bf9ab[_0x8b0f('0x3c')]);return _0x36a06b[_0x8b0f('0x48')](_0x40d223);}})[_0x8b0f('0x23')](function(_0x4c3f74){if(_0x4c3f74){_0x4499a3=_0x4c3f74['length'];if(!_0x2bf9ab[_0x8b0f('0x30')][_0x8b0f('0x4d')](_0x8b0f('0x36'))){_0x40d223[_0x8b0f('0x1b')]=qs[_0x8b0f('0x1b')](_0x2bf9ab[_0x8b0f('0x30')][_0x8b0f('0x1b')]);_0x40d223[_0x8b0f('0x1a')]=qs['offset'](_0x2bf9ab[_0x8b0f('0x30')][_0x8b0f('0x1a')]);}return _0x36a06b[_0x8b0f('0x48')](_0x40d223);}})['then'](function(_0x169dbd){if(_0x169dbd){return _0x169dbd?{'count':_0x4499a3,'rows':_0x169dbd}:null;}})[_0x8b0f('0x23')](respondWithResult(_0x20cd42,null))['catch'](handleError(_0x20cd42,null));};exports[_0x8b0f('0x4e')]=function(_0x52d98a,_0x2df29e,_0x1f7bc9){if(_0x52d98a['body']['id']){delete _0x52d98a[_0x8b0f('0x47')]['id'];}return db['SugarcrmAccount']['findOne']({'where':{'id':_0x52d98a[_0x8b0f('0x43')]['id']}})['then'](handleEntityNotFound(_0x2df29e,null))[_0x8b0f('0x23')](function(_0x1a67f4){if(_0x1a67f4){_0x52d98a[_0x8b0f('0x47')][_0x8b0f('0x4f')]=_0x1a67f4['id'];_0x52d98a[_0x8b0f('0x47')]['Subjects']=integrations[_0x8b0f('0x50')](_0x52d98a[_0x8b0f('0x47')][_0x8b0f('0x51')],_0x52d98a[_0x8b0f('0x47')][_0x8b0f('0x2d')]);_0x52d98a[_0x8b0f('0x47')][_0x8b0f('0x52')]=integrations[_0x8b0f('0x53')](_0x52d98a['body'][_0x8b0f('0x51')],_0x52d98a[_0x8b0f('0x47')][_0x8b0f('0x2d')]);return db[_0x8b0f('0x4a')][_0x8b0f('0x46')](_0x52d98a['body'],{'include':[{'model':db[_0x8b0f('0x54')],'as':'Subjects'},{'model':db['SugarcrmField'],'as':'Descriptions'}]});}return null;})[_0x8b0f('0x23')](respondWithResult(_0x2df29e,null))[_0x8b0f('0x41')](handleError(_0x2df29e,null));};exports[_0x8b0f('0x55')]=function(_0x4e6d03,_0x136ce6,_0x5aedf5){var _0x38a6e2='';var _0x4bbce7=['id','name',_0x8b0f('0x56'),_0x8b0f('0x57'),'description',_0x8b0f('0x58'),_0x8b0f('0x59'),'duration_minutes',_0x8b0f('0x5a'),_0x8b0f('0x5b'),'parent_name',_0x8b0f('0x5c')];return db[_0x8b0f('0x2a')][_0x8b0f('0x49')]({'where':{'id':_0x4e6d03[_0x8b0f('0x43')]['id']},'attributes':['id',_0x8b0f('0x5d'),'password',_0x8b0f('0x5e')]})['then'](handleEntityNotFound(_0x136ce6,null))[_0x8b0f('0x23')](function(_0x1bc478){if(_0x1bc478){_0x38a6e2=_0x1bc478[_0x8b0f('0x5e')];var _0x2418d8=_0x38a6e2[_0x8b0f('0x5f')](-0x1);if(_0x2418d8==='/'){_0x38a6e2=_0x38a6e2[_0x8b0f('0x60')](0x0,_0x38a6e2[_0x8b0f('0x61')](_0x2418d8));}return rp({'method':_0x8b0f('0x62'),'uri':util[_0x8b0f('0x63')](_0x8b0f('0x64'),_0x38a6e2,_0x8b0f('0x65')),'json':!![],'form':{'method':_0x8b0f('0x66'),'input_type':_0x8b0f('0x67'),'response_type':_0x8b0f('0x67'),'rest_data':JSON[_0x8b0f('0x68')]({'user_auth':{'user_name':_0x1bc478[_0x8b0f('0x5d')],'password':_0x1bc478[_0x8b0f('0x69')],'encryption':_0x8b0f('0x6a')},'application':'xCALLY\x20Motion\x20Integration'})}});}})['then'](function(_0x2abddc){if(_0x2abddc&&_0x2abddc[_0x8b0f('0x27')]!==_0x8b0f('0x6b')&&_0x2abddc[_0x8b0f('0x27')]!==_0x8b0f('0x6c')){return rp({'method':_0x8b0f('0x62'),'uri':util['format'](_0x8b0f('0x64'),_0x38a6e2,_0x8b0f('0x65')),'json':!![],'form':{'method':'get_module_fields','input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x8b0f('0x68')]({'session':_0x2abddc['id'],'module_name':_0x8b0f('0x6d')})}})[_0x8b0f('0x23')](function(_0x2c0d8c){if(_0x2c0d8c){var _0x3cae31=_['values'](_0x2c0d8c[_0x8b0f('0x6e')]);_[_0x8b0f('0x6f')](_0x3cae31,function(_0x228572){return _0x4bbce7[_0x8b0f('0x70')](_0x228572[_0x8b0f('0x27')]);});return{'count':_0x3cae31[_0x8b0f('0x44')],'rows':_[_0x8b0f('0x29')](_0x3cae31,function(_0x43ee84){return{'id':_0x43ee84[_0x8b0f('0x27')],'name':_0x43ee84[_0x8b0f('0x71')],'custom':_[_0x8b0f('0x72')](_0x43ee84[_0x8b0f('0x27')],'_c')?!![]:![],'options':_0x43ee84[_0x8b0f('0x3c')]?_[_0x8b0f('0x29')](_[_0x8b0f('0x73')](_0x43ee84['options']),function(_0x411932){return{'name':_0x411932[_0x8b0f('0x74')],'value':_0x411932['name']};}):[]};})};}})['then'](respondWithResult(_0x136ce6,null))[_0x8b0f('0x41')](function(_0x2d1a10){var _0x1ef192=_0x4e6d03[_0x8b0f('0x30')]['test']?0x1f4:_0x2d1a10[_0x8b0f('0x75')]||0x1f4;logger[_0x8b0f('0x25')](_0x8b0f('0x76'),_0x8b0f('0x55'),_0x1ef192,JSON[_0x8b0f('0x68')](_0x2d1a10));delete _0x2d1a10['name'];if(_0x1ef192===0x191){_0x1ef192=0x190;}_0x136ce6['status'](_0x1ef192)['send'](_0x4e6d03['query'][_0x8b0f('0x77')]?{'message':_0x8b0f('0x78'),'statusCode':_0x2d1a10[_0x8b0f('0x75')]}:_0x2d1a10);});}else{var _0x140edc=0x1f4;_0x136ce6['status'](_0x140edc)['send']({'message':_0x8b0f('0x78'),'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 325cfb9..aac463a 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 _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 +var _0xfb93=['../../config/logger','api','bluebird','request-promise','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','SugarcrmAccount','int_sugarcrm_accounts','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfb93,0x111));var _0x3fb9=function(_0x322d30,_0x1b99ec){_0x322d30=_0x322d30-0x0;var _0xa47a22=_0xfb93[_0x322d30];return _0xa47a22;};'use strict';var _=require(_0x3fb9('0x0'));var util=require(_0x3fb9('0x1'));var logger=require(_0x3fb9('0x2'))(_0x3fb9('0x3'));var moment=require('moment');var BPromise=require(_0x3fb9('0x4'));var rp=require(_0x3fb9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3fb9('0x6'));var integrations=require(_0x3fb9('0x7'));module[_0x3fb9('0x8')]=function(_0x118c1f,_0x5b601e){return _0x118c1f['define'](_0x3fb9('0x9'),attributes,{'tableName':_0x3fb9('0xa'),'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 336dc30..172d5ab 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 _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 +var _0x5ca0=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','SugarcrmAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetSugarcrmAccount','ShowSugarcrmAccount','find','lodash','moment'];(function(_0x560623,_0x5c748a){var _0x2a9089=function(_0x565d41){while(--_0x565d41){_0x560623['push'](_0x560623['shift']());}};_0x2a9089(++_0x5c748a);}(_0x5ca0,0x166));var _0x05ca=function(_0x407faf,_0x290209){_0x407faf=_0x407faf-0x0;var _0x3d24c7=_0x5ca0[_0x407faf];return _0x3d24c7;};'use strict';var _=require(_0x05ca('0x0'));var util=require('util');var moment=require(_0x05ca('0x1'));var BPromise=require(_0x05ca('0x2'));var rs=require(_0x05ca('0x3'));var fs=require('fs');var Redis=require(_0x05ca('0x4'));var db=require(_0x05ca('0x5'))['db'];var utils=require(_0x05ca('0x6'));var logger=require(_0x05ca('0x7'))(_0x05ca('0x8'));var config=require('../../config/environment');var jayson=require(_0x05ca('0x9'));var client=jayson['client'][_0x05ca('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5fd95e,_0x30695d,_0xdc4e2c){return new BPromise(function(_0x182790,_0x11aa24){return client[_0x05ca('0xb')](_0x5fd95e,_0xdc4e2c)[_0x05ca('0xc')](function(_0x2f5c05){logger[_0x05ca('0xd')](_0x05ca('0xe'),_0x30695d,_0x05ca('0xf'));logger[_0x05ca('0x10')](_0x05ca('0x11'),_0x30695d,_0x05ca('0xf'),JSON[_0x05ca('0x12')](_0x2f5c05));if(_0x2f5c05[_0x05ca('0x13')]){if(_0x2f5c05['error']['code']===0x1f4){logger[_0x05ca('0x13')](_0x05ca('0xe'),_0x30695d,_0x2f5c05[_0x05ca('0x13')][_0x05ca('0x14')]);return _0x11aa24(_0x2f5c05[_0x05ca('0x13')][_0x05ca('0x14')]);}logger[_0x05ca('0x13')](_0x05ca('0xe'),_0x30695d,_0x2f5c05[_0x05ca('0x13')][_0x05ca('0x14')]);return _0x182790(_0x2f5c05[_0x05ca('0x13')][_0x05ca('0x14')]);}else{logger[_0x05ca('0xd')](_0x05ca('0xe'),_0x30695d,_0x05ca('0xf'));_0x182790(_0x2f5c05[_0x05ca('0x15')][_0x05ca('0x14')]);}})[_0x05ca('0x16')](function(_0x57985e){logger['error'](_0x05ca('0xe'),_0x30695d,_0x57985e);_0x11aa24(_0x57985e);});});}exports['GetSugarcrmAccount']=function(_0x496bf5){var _0x36d7a7=this;return new Promise(function(_0x38aeac,_0x4d42d7){return db[_0x05ca('0x17')][_0x05ca('0x18')]({'raw':_0x496bf5['options']?_0x496bf5[_0x05ca('0x19')][_0x05ca('0x1a')]===undefined?!![]:![]:!![],'where':_0x496bf5[_0x05ca('0x19')]?_0x496bf5[_0x05ca('0x19')][_0x05ca('0x1b')]||null:null,'attributes':_0x496bf5[_0x05ca('0x19')]?_0x496bf5['options'][_0x05ca('0x1c')]||null:null,'limit':_0x496bf5[_0x05ca('0x19')]?_0x496bf5['options'][_0x05ca('0x1d')]||null:null,'include':_0x496bf5[_0x05ca('0x19')]?_0x496bf5[_0x05ca('0x19')][_0x05ca('0x1e')]?_[_0x05ca('0x1f')](_0x496bf5['options'][_0x05ca('0x1e')],function(_0x7688b5){return{'model':db[_0x7688b5[_0x05ca('0x20')]],'as':_0x7688b5['as'],'attributes':_0x7688b5[_0x05ca('0x1c')],'include':_0x7688b5[_0x05ca('0x1e')]?_[_0x05ca('0x1f')](_0x7688b5[_0x05ca('0x1e')],function(_0x426238){return{'model':db[_0x426238[_0x05ca('0x20')]],'as':_0x426238['as'],'attributes':_0x426238['attributes'],'include':_0x426238[_0x05ca('0x1e')]?_[_0x05ca('0x1f')](_0x426238[_0x05ca('0x1e')],function(_0x4afc04){return{'model':db[_0x4afc04[_0x05ca('0x20')]],'as':_0x4afc04['as'],'attributes':_0x4afc04[_0x05ca('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4abee3){logger[_0x05ca('0xd')]('GetSugarcrmAccount',_0x496bf5);logger[_0x05ca('0x10')](_0x05ca('0x21'),_0x496bf5,JSON[_0x05ca('0x12')](_0x4abee3));_0x38aeac(_0x4abee3);})['catch'](function(_0x1396de){logger[_0x05ca('0x13')](_0x05ca('0x21'),_0x1396de[_0x05ca('0x14')],_0x496bf5);_0x4d42d7(_0x36d7a7[_0x05ca('0x13')](0x1f4,_0x1396de['message']));});});};exports[_0x05ca('0x22')]=function(_0x50a0be){var _0x41a43a=this;return new Promise(function(_0x5466d0,_0x247cf5){return db['SugarcrmAccount'][_0x05ca('0x23')]({'raw':_0x50a0be[_0x05ca('0x19')]?_0x50a0be[_0x05ca('0x19')][_0x05ca('0x1a')]===undefined?!![]:![]:!![],'where':_0x50a0be[_0x05ca('0x19')]?_0x50a0be['options'][_0x05ca('0x1b')]||null:null,'attributes':_0x50a0be['options']?_0x50a0be['options']['attributes']||null:null,'include':_0x50a0be[_0x05ca('0x19')]?_0x50a0be[_0x05ca('0x19')][_0x05ca('0x1e')]?_[_0x05ca('0x1f')](_0x50a0be[_0x05ca('0x19')][_0x05ca('0x1e')],function(_0x19f259){return{'model':db[_0x19f259['model']],'as':_0x19f259['as'],'attributes':_0x19f259[_0x05ca('0x1c')],'include':_0x19f259[_0x05ca('0x1e')]?_['map'](_0x19f259['include'],function(_0x3b46bb){return{'model':db[_0x3b46bb[_0x05ca('0x20')]],'as':_0x3b46bb['as'],'attributes':_0x3b46bb[_0x05ca('0x1c')],'include':_0x3b46bb[_0x05ca('0x1e')]?_['map'](_0x3b46bb[_0x05ca('0x1e')],function(_0x2988ca){return{'model':db[_0x2988ca[_0x05ca('0x20')]],'as':_0x2988ca['as'],'attributes':_0x2988ca[_0x05ca('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5ba7fd){logger[_0x05ca('0xd')](_0x05ca('0x22'),_0x50a0be);logger[_0x05ca('0x10')]('ShowSugarcrmAccount',_0x50a0be,JSON['stringify'](_0x5ba7fd));_0x5466d0(_0x5ba7fd);})['catch'](function(_0x3ddcb3){logger['error'](_0x05ca('0x22'),_0x3ddcb3[_0x05ca('0x14')],_0x50a0be);_0x247cf5(_0x41a43a['error'](0x1f4,_0x3ddcb3['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 7343020..32e3dcf 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 _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 +var _0xe02a=['index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated'];(function(_0x1a4c39,_0x22b9be){var _0x174630=function(_0x61241c){while(--_0x61241c){_0x1a4c39['push'](_0x1a4c39['shift']());}};_0x174630(++_0x22b9be);}(_0xe02a,0x1ae));var _0xae02=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xe02a[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require(_0xae02('0x0'));var util=require(_0xae02('0x1'));var path=require(_0xae02('0x2'));var timeout=require(_0xae02('0x3'));var express=require(_0xae02('0x4'));var router=express[_0xae02('0x5')]();var fs_extra=require(_0xae02('0x6'));var auth=require(_0xae02('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xae02('0x8'));var controller=require(_0xae02('0x9'));router[_0xae02('0xa')]('/',auth[_0xae02('0xb')](),controller[_0xae02('0xc')]);router[_0xae02('0xa')](_0xae02('0xd'),auth['isAuthenticated'](),controller[_0xae02('0xe')]);router[_0xae02('0xa')](_0xae02('0xf'),auth[_0xae02('0xb')](),controller[_0xae02('0x10')]);router[_0xae02('0xa')](_0xae02('0x11'),auth[_0xae02('0xb')](),controller[_0xae02('0x12')]);router['get'](_0xae02('0x13'),auth[_0xae02('0xb')](),controller[_0xae02('0x14')]);router['post']('/',auth[_0xae02('0xb')](),controller['create']);router[_0xae02('0x15')](_0xae02('0xd'),auth['isAuthenticated'](),controller[_0xae02('0x16')]);router[_0xae02('0x17')](_0xae02('0xd'),auth['isAuthenticated'](),controller[_0xae02('0x18')]);module[_0xae02('0x19')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 016b2c4..703f8f2 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 _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 +var _0x0f73=['STRING','exports'];(function(_0x12d15e,_0x2037e3){var _0x2412d2=function(_0x55ef4f){while(--_0x55ef4f){_0x12d15e['push'](_0x12d15e['shift']());}};_0x2412d2(++_0x2037e3);}(_0x0f73,0x145));var _0x30f7=function(_0x46e0b2,_0x3b088a){_0x46e0b2=_0x46e0b2-0x0;var _0x40a8f0=_0x0f73[_0x46e0b2];return _0x40a8f0;};'use strict';var Sequelize=require('sequelize');module[_0x30f7('0x0')]={'name':{'type':Sequelize[_0x30f7('0x1')]},'description':{'type':Sequelize[_0x30f7('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 7f22390..1c1d9ad 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 _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 +var _0x441a=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','count','status','Content-Range','reject','save','then','destroy','name','SugarcrmConfiguration','rawAttributes','fieldName','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','includeAll','findAll','show','keys','include','options','find','catch','create','body','update','params','getFields','findOne','pick','getSubjects','SugarcrmField','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','ioredis','../../components/auth/service'];(function(_0x541d92,_0x16b898){var _0x5838dc=function(_0x3abb3a){while(--_0x3abb3a){_0x541d92['push'](_0x541d92['shift']());}};_0x5838dc(++_0x16b898);}(_0x441a,0x87));var _0xa441=function(_0x310504,_0x26ad95){_0x310504=_0x310504-0x0;var _0x5b36d0=_0x441a[_0x310504];return _0x5b36d0;};'use strict';var emlformat=require(_0xa441('0x0'));var rimraf=require(_0xa441('0x1'));var zipdir=require(_0xa441('0x2'));var jsonpatch=require(_0xa441('0x3'));var rp=require(_0xa441('0x4'));var moment=require(_0xa441('0x5'));var BPromise=require(_0xa441('0x6'));var Mustache=require(_0xa441('0x7'));var util=require('util');var path=require(_0xa441('0x8'));var sox=require('sox');var csv=require(_0xa441('0x9'));var ejs=require(_0xa441('0xa'));var fs=require('fs');var fs_extra=require(_0xa441('0xb'));var _=require(_0xa441('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa441('0xd'));var deskjs=require(_0xa441('0xe'));var toCsv=require(_0xa441('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa441('0xf'));var authService=require(_0xa441('0x10'));var qs=require(_0xa441('0x11'));var as=require(_0xa441('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa441('0x13'))(_0xa441('0x14'));var utils=require(_0xa441('0x15'));var config=require(_0xa441('0x16'));var licenseUtil=require(_0xa441('0x17'));var db=require(_0xa441('0x18'))['db'];function respondWithStatusCode(_0x2640ce,_0x4e65c1){_0x4e65c1=_0x4e65c1||0xcc;return function(_0x5b54bc){if(_0x5b54bc){return _0x2640ce[_0xa441('0x19')](_0x4e65c1);}return _0x2640ce['status'](_0x4e65c1)[_0xa441('0x1a')]();};}function respondWithResult(_0x521bae,_0x4a9775){_0x4a9775=_0x4a9775||0xc8;return function(_0x1fbfd6){if(_0x1fbfd6){return _0x521bae['status'](_0x4a9775)[_0xa441('0x1b')](_0x1fbfd6);}};}function respondWithFilteredResult(_0x9d1641,_0x32f3f4){return function(_0x47de4a){if(_0x47de4a){var _0x15aa74=typeof _0x32f3f4[_0xa441('0x1c')]==='undefined'&&typeof _0x32f3f4[_0xa441('0x1d')]==='undefined';var _0x464284=_0x47de4a[_0xa441('0x1e')];var _0x455985=_0x15aa74?0x0:_0x32f3f4[_0xa441('0x1c')];var _0x3f5186=_0x15aa74?_0x47de4a[_0xa441('0x1e')]:_0x32f3f4[_0xa441('0x1c')]+_0x32f3f4[_0xa441('0x1d')];var _0x8656fa;if(_0x3f5186>=_0x464284){_0x3f5186=_0x464284;_0x8656fa=0xc8;}else{_0x8656fa=0xce;}_0x9d1641[_0xa441('0x1f')](_0x8656fa);return _0x9d1641['set'](_0xa441('0x20'),_0x455985+'-'+_0x3f5186+'/'+_0x464284)['json'](_0x47de4a);}return null;};}function patchUpdates(_0x497508){return function(_0x81f76){try{jsonpatch['apply'](_0x81f76,_0x497508,!![]);}catch(_0x2c04dc){return BPromise[_0xa441('0x21')](_0x2c04dc);}return _0x81f76[_0xa441('0x22')]();};}function saveUpdates(_0x32afef,_0x4c64cc){return function(_0x59aed5){if(_0x59aed5){return _0x59aed5['update'](_0x32afef)[_0xa441('0x23')](function(_0x32b797){return _0x32b797;});}return null;};}function removeEntity(_0x528ed8,_0x41d146){return function(_0x4b073a){if(_0x4b073a){return _0x4b073a[_0xa441('0x24')]()['then'](function(){_0x528ed8[_0xa441('0x1f')](0xcc)[_0xa441('0x1a')]();});}};}function handleEntityNotFound(_0x50946b,_0x58166d){return function(_0x11f2df){if(!_0x11f2df){_0x50946b['sendStatus'](0x194);}return _0x11f2df;};}function handleError(_0x5b934c,_0x4dcb81){_0x4dcb81=_0x4dcb81||0x1f4;return function(_0x3c8136){logger['error'](_0x3c8136['stack']);if(_0x3c8136[_0xa441('0x25')]){delete _0x3c8136[_0xa441('0x25')];}_0x5b934c[_0xa441('0x1f')](_0x4dcb81)['send'](_0x3c8136);};}exports['index']=function(_0x974d62,_0x3714fc){var _0x3c0e00={},_0x40d950={},_0x437869={'count':0x0,'rows':[]};var _0xbbf32c=_['map'](db[_0xa441('0x26')][_0xa441('0x27')],function(_0x57c910){return{'name':_0x57c910[_0xa441('0x28')],'type':_0x57c910['type'][_0xa441('0x29')]};});_0x40d950[_0xa441('0x2a')]=_[_0xa441('0x2b')](_0xbbf32c,_0xa441('0x25'));_0x40d950[_0xa441('0x2c')]=_['keys'](_0x974d62[_0xa441('0x2c')]);_0x40d950['filters']=_[_0xa441('0x2d')](_0x40d950[_0xa441('0x2a')],_0x40d950[_0xa441('0x2c')]);_0x3c0e00[_0xa441('0x2e')]=_['intersection'](_0x40d950[_0xa441('0x2a')],qs[_0xa441('0x2f')](_0x974d62[_0xa441('0x2c')][_0xa441('0x2f')]));_0x3c0e00['attributes']=_0x3c0e00[_0xa441('0x2e')][_0xa441('0x30')]?_0x3c0e00[_0xa441('0x2e')]:_0x40d950[_0xa441('0x2a')];if(!_0x974d62[_0xa441('0x2c')][_0xa441('0x31')](_0xa441('0x32'))){_0x3c0e00[_0xa441('0x1d')]=qs['limit'](_0x974d62[_0xa441('0x2c')]['limit']);_0x3c0e00['offset']=qs['offset'](_0x974d62[_0xa441('0x2c')][_0xa441('0x1c')]);}_0x3c0e00[_0xa441('0x33')]=qs[_0xa441('0x34')](_0x974d62[_0xa441('0x2c')][_0xa441('0x34')]);_0x3c0e00[_0xa441('0x35')]=qs['filters'](_['pick'](_0x974d62[_0xa441('0x2c')],_0x40d950[_0xa441('0x36')]),_0xbbf32c);if(_0x974d62[_0xa441('0x2c')][_0xa441('0x37')]){_0x3c0e00[_0xa441('0x35')]=_['merge'](_0x3c0e00['where'],{'$or':_[_0xa441('0x2b')](_0xbbf32c,function(_0x239624){if(_0x239624['type']!==_0xa441('0x38')){var _0xbc5e92={};_0xbc5e92[_0x239624[_0xa441('0x25')]]={'$like':'%'+_0x974d62[_0xa441('0x2c')][_0xa441('0x37')]+'%'};return _0xbc5e92;}})});}_0x3c0e00=_[_0xa441('0x39')]({},_0x3c0e00,_0x974d62['options']);var _0xffc30b={'where':_0x3c0e00[_0xa441('0x35')]};return db['SugarcrmConfiguration'][_0xa441('0x1e')](_0xffc30b)[_0xa441('0x23')](function(_0x49de5e){_0x437869['count']=_0x49de5e;if(_0x974d62['query'][_0xa441('0x3a')]){_0x3c0e00['include']=[{'all':!![]}];}return db[_0xa441('0x26')][_0xa441('0x3b')](_0x3c0e00);})['then'](function(_0x2e0b47){_0x437869['rows']=_0x2e0b47;return _0x437869;})[_0xa441('0x23')](respondWithFilteredResult(_0x3714fc,_0x3c0e00))['catch'](handleError(_0x3714fc,null));};exports[_0xa441('0x3c')]=function(_0x1e5e76,_0x5bd21d){var _0x4ecade={'raw':![],'where':{'id':_0x1e5e76['params']['id']}},_0xa3ff6={};_0xa3ff6[_0xa441('0x2a')]=_[_0xa441('0x3d')](db[_0xa441('0x26')]['rawAttributes']);_0xa3ff6[_0xa441('0x2c')]=_[_0xa441('0x3d')](_0x1e5e76['query']);_0xa3ff6[_0xa441('0x36')]=_['intersection'](_0xa3ff6[_0xa441('0x2a')],_0xa3ff6[_0xa441('0x2c')]);_0x4ecade['attributes']=_[_0xa441('0x2d')](_0xa3ff6['model'],qs[_0xa441('0x2f')](_0x1e5e76[_0xa441('0x2c')][_0xa441('0x2f')]));_0x4ecade[_0xa441('0x2e')]=_0x4ecade['attributes'][_0xa441('0x30')]?_0x4ecade[_0xa441('0x2e')]:_0xa3ff6[_0xa441('0x2a')];if(_0x1e5e76[_0xa441('0x2c')]['includeAll']){_0x4ecade[_0xa441('0x3e')]=[{'all':!![]}];}_0x4ecade=_['merge']({},_0x4ecade,_0x1e5e76[_0xa441('0x3f')]);return db[_0xa441('0x26')][_0xa441('0x40')](_0x4ecade)[_0xa441('0x23')](handleEntityNotFound(_0x5bd21d,null))[_0xa441('0x23')](respondWithResult(_0x5bd21d,null))[_0xa441('0x41')](handleError(_0x5bd21d,null));};exports[_0xa441('0x42')]=function(_0x440e3a,_0x39dabb){return db[_0xa441('0x26')][_0xa441('0x42')](_0x440e3a[_0xa441('0x43')],{})['then'](respondWithResult(_0x39dabb,0xc9))[_0xa441('0x41')](handleError(_0x39dabb,null));};exports[_0xa441('0x44')]=function(_0x4667f9,_0x241b68){if(_0x4667f9[_0xa441('0x43')]['id']){delete _0x4667f9[_0xa441('0x43')]['id'];}return db['SugarcrmConfiguration'][_0xa441('0x40')]({'where':{'id':_0x4667f9[_0xa441('0x45')]['id']}})[_0xa441('0x23')](handleEntityNotFound(_0x241b68,null))[_0xa441('0x23')](saveUpdates(_0x4667f9[_0xa441('0x43')],null))[_0xa441('0x23')](respondWithResult(_0x241b68,null))['catch'](handleError(_0x241b68,null));};exports[_0xa441('0x24')]=function(_0x2a1654,_0x394c89){return db[_0xa441('0x26')]['find']({'where':{'id':_0x2a1654[_0xa441('0x45')]['id']}})[_0xa441('0x23')](handleEntityNotFound(_0x394c89,null))[_0xa441('0x23')](removeEntity(_0x394c89,null))[_0xa441('0x41')](handleError(_0x394c89,null));};exports[_0xa441('0x46')]=function(_0x312f91,_0x1c8712,_0x1c014d){var _0x43cb53={};var _0x491ccc={};var _0x5d388f;var _0x7c4232;return db[_0xa441('0x26')][_0xa441('0x47')]({'where':{'id':_0x312f91[_0xa441('0x45')]['id']}})[_0xa441('0x23')](handleEntityNotFound(_0x1c8712,null))['then'](function(_0xc0aa76){if(_0xc0aa76){_0x5d388f=_0xc0aa76;_0x491ccc[_0xa441('0x2a')]=_[_0xa441('0x3d')](db['SugarcrmField']['rawAttributes']);_0x491ccc['query']=_[_0xa441('0x3d')](_0x312f91[_0xa441('0x2c')]);_0x491ccc['filters']=_[_0xa441('0x2d')](_0x491ccc['model'],_0x491ccc[_0xa441('0x2c')]);_0x43cb53[_0xa441('0x2e')]=_['intersection'](_0x491ccc[_0xa441('0x2a')],qs[_0xa441('0x2f')](_0x312f91[_0xa441('0x2c')][_0xa441('0x2f')]));_0x43cb53[_0xa441('0x2e')]=_0x43cb53[_0xa441('0x2e')]['length']?_0x43cb53['attributes']:_0x491ccc[_0xa441('0x2a')];_0x43cb53[_0xa441('0x33')]=qs[_0xa441('0x34')](_0x312f91[_0xa441('0x2c')][_0xa441('0x34')]);_0x43cb53[_0xa441('0x35')]=qs[_0xa441('0x36')](_[_0xa441('0x48')](_0x312f91['query'],_0x491ccc[_0xa441('0x36')]));if(_0x312f91[_0xa441('0x2c')][_0xa441('0x37')]){_0x43cb53[_0xa441('0x35')]=_[_0xa441('0x39')](_0x43cb53[_0xa441('0x35')],{'$or':_['map'](_0x43cb53[_0xa441('0x2e')],function(_0x5db1ff){var _0x3b576d={};_0x3b576d[_0x5db1ff]={'$like':'%'+_0x312f91['query']['filter']+'%'};return _0x3b576d;})});}_0x43cb53=_[_0xa441('0x39')]({},_0x43cb53,_0x312f91[_0xa441('0x3f')]);return _0x5d388f[_0xa441('0x46')](_0x43cb53);}})['then'](function(_0x2683ac){if(_0x2683ac){_0x7c4232=_0x2683ac[_0xa441('0x30')];if(!_0x312f91[_0xa441('0x2c')]['hasOwnProperty'](_0xa441('0x32'))){_0x43cb53['limit']=qs['limit'](_0x312f91[_0xa441('0x2c')][_0xa441('0x1d')]);_0x43cb53[_0xa441('0x1c')]=qs[_0xa441('0x1c')](_0x312f91[_0xa441('0x2c')]['offset']);}return _0x5d388f[_0xa441('0x46')](_0x43cb53);}})[_0xa441('0x23')](function(_0x13f9e8){if(_0x13f9e8){return _0x13f9e8?{'count':_0x7c4232,'rows':_0x13f9e8}:null;}})[_0xa441('0x23')](respondWithResult(_0x1c8712,null))['catch'](handleError(_0x1c8712,null));};exports[_0xa441('0x49')]=function(_0x37cf67,_0x32be6f,_0x1e63fc){var _0x364679={};var _0x17cebd={};var _0x167ca4;var _0x43678e;return db[_0xa441('0x26')][_0xa441('0x47')]({'where':{'id':_0x37cf67['params']['id']}})['then'](handleEntityNotFound(_0x32be6f,null))[_0xa441('0x23')](function(_0x407bd0){if(_0x407bd0){_0x167ca4=_0x407bd0;_0x17cebd[_0xa441('0x2a')]=_[_0xa441('0x3d')](db[_0xa441('0x4a')][_0xa441('0x27')]);_0x17cebd[_0xa441('0x2c')]=_[_0xa441('0x3d')](_0x37cf67[_0xa441('0x2c')]);_0x17cebd['filters']=_['intersection'](_0x17cebd[_0xa441('0x2a')],_0x17cebd[_0xa441('0x2c')]);_0x364679[_0xa441('0x2e')]=_['intersection'](_0x17cebd['model'],qs[_0xa441('0x2f')](_0x37cf67['query'][_0xa441('0x2f')]));_0x364679[_0xa441('0x2e')]=_0x364679[_0xa441('0x2e')][_0xa441('0x30')]?_0x364679[_0xa441('0x2e')]:_0x17cebd[_0xa441('0x2a')];_0x364679[_0xa441('0x33')]=qs['sort'](_0x37cf67[_0xa441('0x2c')][_0xa441('0x34')]);_0x364679[_0xa441('0x35')]=qs[_0xa441('0x36')](_['pick'](_0x37cf67['query'],_0x17cebd[_0xa441('0x36')]));if(_0x37cf67['query']['filter']){_0x364679['where']=_[_0xa441('0x39')](_0x364679[_0xa441('0x35')],{'$or':_[_0xa441('0x2b')](_0x364679[_0xa441('0x2e')],function(_0x2952da){var _0x256910={};_0x256910[_0x2952da]={'$like':'%'+_0x37cf67[_0xa441('0x2c')][_0xa441('0x37')]+'%'};return _0x256910;})});}_0x364679=_['merge']({},_0x364679,_0x37cf67['options']);return _0x167ca4[_0xa441('0x49')](_0x364679);}})['then'](function(_0x582511){if(_0x582511){_0x43678e=_0x582511[_0xa441('0x30')];if(!_0x37cf67[_0xa441('0x2c')]['hasOwnProperty']('nolimit')){_0x364679['limit']=qs[_0xa441('0x1d')](_0x37cf67[_0xa441('0x2c')]['limit']);_0x364679['offset']=qs[_0xa441('0x1c')](_0x37cf67['query'][_0xa441('0x1c')]);}return _0x167ca4['getSubjects'](_0x364679);}})[_0xa441('0x23')](function(_0x4103a3){if(_0x4103a3){return _0x4103a3?{'count':_0x43678e,'rows':_0x4103a3}:null;}})[_0xa441('0x23')](respondWithResult(_0x32be6f,null))['catch'](handleError(_0x32be6f,null));};exports[_0xa441('0x4b')]=function(_0x4dcdd3,_0x2ea689,_0x4e076c){var _0x137043={};var _0x3dcbb2={};var _0x551a65;var _0x3f39b8;return db[_0xa441('0x26')][_0xa441('0x47')]({'where':{'id':_0x4dcdd3['params']['id']}})[_0xa441('0x23')](handleEntityNotFound(_0x2ea689,null))[_0xa441('0x23')](function(_0xd4ba16){if(_0xd4ba16){_0x551a65=_0xd4ba16;_0x3dcbb2[_0xa441('0x2a')]=_[_0xa441('0x3d')](db[_0xa441('0x4a')]['rawAttributes']);_0x3dcbb2[_0xa441('0x2c')]=_[_0xa441('0x3d')](_0x4dcdd3[_0xa441('0x2c')]);_0x3dcbb2[_0xa441('0x36')]=_[_0xa441('0x2d')](_0x3dcbb2[_0xa441('0x2a')],_0x3dcbb2[_0xa441('0x2c')]);_0x137043['attributes']=_['intersection'](_0x3dcbb2[_0xa441('0x2a')],qs[_0xa441('0x2f')](_0x4dcdd3[_0xa441('0x2c')][_0xa441('0x2f')]));_0x137043[_0xa441('0x2e')]=_0x137043[_0xa441('0x2e')][_0xa441('0x30')]?_0x137043[_0xa441('0x2e')]:_0x3dcbb2['model'];_0x137043['order']=qs['sort'](_0x4dcdd3[_0xa441('0x2c')][_0xa441('0x34')]);_0x137043['where']=qs[_0xa441('0x36')](_[_0xa441('0x48')](_0x4dcdd3[_0xa441('0x2c')],_0x3dcbb2[_0xa441('0x36')]));if(_0x4dcdd3['query']['filter']){_0x137043[_0xa441('0x35')]=_[_0xa441('0x39')](_0x137043[_0xa441('0x35')],{'$or':_[_0xa441('0x2b')](_0x137043[_0xa441('0x2e')],function(_0x52ecaa){var _0xe9d0f6={};_0xe9d0f6[_0x52ecaa]={'$like':'%'+_0x4dcdd3[_0xa441('0x2c')][_0xa441('0x37')]+'%'};return _0xe9d0f6;})});}_0x137043=_[_0xa441('0x39')]({},_0x137043,_0x4dcdd3[_0xa441('0x3f')]);return _0x551a65[_0xa441('0x4b')](_0x137043);}})[_0xa441('0x23')](function(_0x130023){if(_0x130023){_0x3f39b8=_0x130023['length'];if(!_0x4dcdd3[_0xa441('0x2c')][_0xa441('0x31')]('nolimit')){_0x137043['limit']=qs[_0xa441('0x1d')](_0x4dcdd3[_0xa441('0x2c')]['limit']);_0x137043[_0xa441('0x1c')]=qs[_0xa441('0x1c')](_0x4dcdd3[_0xa441('0x2c')][_0xa441('0x1c')]);}return _0x551a65[_0xa441('0x4b')](_0x137043);}})[_0xa441('0x23')](function(_0x7e2774){if(_0x7e2774){return _0x7e2774?{'count':_0x3f39b8,'rows':_0x7e2774}:null;}})[_0xa441('0x23')](respondWithResult(_0x2ea689,null))[_0xa441('0x41')](handleError(_0x2ea689,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index f2c55d3..bfca76f 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 _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 +var _0x4bfa=['SugarcrmConfiguration','int_sugarcrm_configurations','lodash','../../config/logger','moment','request-promise','path','rimraf','./intSugarcrmConfiguration.attributes','exports','define'];(function(_0x512583,_0x3db66b){var _0x3ae8f4=function(_0x3b649d){while(--_0x3b649d){_0x512583['push'](_0x512583['shift']());}};_0x3ae8f4(++_0x3db66b);}(_0x4bfa,0xb2));var _0xa4bf=function(_0x317b63,_0x2acf92){_0x317b63=_0x317b63-0x0;var _0x36a2e2=_0x4bfa[_0x317b63];return _0x36a2e2;};'use strict';var _=require(_0xa4bf('0x0'));var util=require('util');var logger=require(_0xa4bf('0x1'))('api');var moment=require(_0xa4bf('0x2'));var BPromise=require('bluebird');var rp=require(_0xa4bf('0x3'));var fs=require('fs');var path=require(_0xa4bf('0x4'));var rimraf=require(_0xa4bf('0x5'));var config=require('../../config/environment');var attributes=require(_0xa4bf('0x6'));module[_0xa4bf('0x7')]=function(_0x3d27f7,_0x300d56){return _0x3d27f7[_0xa4bf('0x8')](_0xa4bf('0x9'),attributes,{'tableName':_0xa4bf('0xa'),'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 25ff08e..5051f69 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 _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 +var _0xc1ca=['../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x43ceed,_0x59008b){var _0x3105fd=function(_0xf797aa){while(--_0xf797aa){_0x43ceed['push'](_0x43ceed['shift']());}};_0x3105fd(++_0x59008b);}(_0xc1ca,0x15f));var _0xac1c=function(_0x50a03a,_0x1f2b97){_0x50a03a=_0x50a03a-0x0;var _0x38be4e=_0xc1ca[_0x50a03a];return _0x38be4e;};'use strict';var _=require(_0xac1c('0x0'));var util=require(_0xac1c('0x1'));var moment=require(_0xac1c('0x2'));var BPromise=require(_0xac1c('0x3'));var rs=require(_0xac1c('0x4'));var fs=require('fs');var Redis=require(_0xac1c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xac1c('0x6'));var logger=require(_0xac1c('0x7'))(_0xac1c('0x8'));var config=require('../../config/environment');var jayson=require(_0xac1c('0x9'));var client=jayson[_0xac1c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d8278,_0x4b8346,_0x9d21c6){return new BPromise(function(_0x13ea53,_0x408582){return client['request'](_0x1d8278,_0x9d21c6)[_0xac1c('0xb')](function(_0x5dc503){logger[_0xac1c('0xc')](_0xac1c('0xd'),_0x4b8346,'request\x20sent');logger[_0xac1c('0xe')](_0xac1c('0xf'),_0x4b8346,_0xac1c('0x10'),JSON[_0xac1c('0x11')](_0x5dc503));if(_0x5dc503[_0xac1c('0x12')]){if(_0x5dc503[_0xac1c('0x12')]['code']===0x1f4){logger[_0xac1c('0x12')](_0xac1c('0xd'),_0x4b8346,_0x5dc503[_0xac1c('0x12')][_0xac1c('0x13')]);return _0x408582(_0x5dc503[_0xac1c('0x12')]['message']);}logger[_0xac1c('0x12')](_0xac1c('0xd'),_0x4b8346,_0x5dc503[_0xac1c('0x12')][_0xac1c('0x13')]);return _0x13ea53(_0x5dc503[_0xac1c('0x12')][_0xac1c('0x13')]);}else{logger[_0xac1c('0xc')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x4b8346,_0xac1c('0x10'));_0x13ea53(_0x5dc503['result'][_0xac1c('0x13')]);}})[_0xac1c('0x14')](function(_0xb991e3){logger[_0xac1c('0x12')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x4b8346,_0xb991e3);_0x408582(_0xb991e3);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index f0caff3..854213f 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 _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 +var _0x465f=['update','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','post'];(function(_0x32b5dc,_0x45bb2b){var _0x3adde2=function(_0x216152){while(--_0x216152){_0x32b5dc['push'](_0x32b5dc['shift']());}};_0x3adde2(++_0x45bb2b);}(_0x465f,0xd2));var _0xf465=function(_0x5abb7c,_0x24f7ad){_0x5abb7c=_0x5abb7c-0x0;var _0x2bb99f=_0x465f[_0x5abb7c];return _0x2bb99f;};'use strict';var multer=require(_0xf465('0x0'));var util=require(_0xf465('0x1'));var path=require(_0xf465('0x2'));var timeout=require(_0xf465('0x3'));var express=require('express');var router=express[_0xf465('0x4')]();var fs_extra=require(_0xf465('0x5'));var auth=require(_0xf465('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf465('0x7'));var controller=require('./intSugarcrmField.controller');router[_0xf465('0x8')]('/',auth[_0xf465('0x9')](),controller[_0xf465('0xa')]);router[_0xf465('0x8')](_0xf465('0xb'),auth[_0xf465('0x9')](),controller[_0xf465('0xc')]);router[_0xf465('0xd')]('/',auth[_0xf465('0x9')](),controller['create']);router['put']('/:id',auth[_0xf465('0x9')](),controller[_0xf465('0xe')]);router['delete'](_0xf465('0xb'),auth[_0xf465('0x9')](),controller[_0xf465('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 57d6048..6d05c74 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 _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 +var _0xd471=['exports','ENUM','string','variable','customVariable','picklist','STRING','BOOLEAN','sequelize'];(function(_0x4e2425,_0xaa212c){var _0x476baa=function(_0x375532){while(--_0x375532){_0x4e2425['push'](_0x4e2425['shift']());}};_0x476baa(++_0xaa212c);}(_0xd471,0xe9));var _0x1d47=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0xd471[_0x122096];return _0x3d1966;};'use strict';var Sequelize=require(_0x1d47('0x0'));module[_0x1d47('0x1')]={'type':{'type':Sequelize[_0x1d47('0x2')](_0x1d47('0x3'),_0x1d47('0x4'),_0x1d47('0x5'),'keyValue',_0x1d47('0x6')),'defaultValue':_0x1d47('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x1d47('0x7')]},'keyType':{'type':Sequelize[_0x1d47('0x2')](_0x1d47('0x3'),'variable',_0x1d47('0x5'))},'keyContent':{'type':Sequelize[_0x1d47('0x7')]},'idField':{'type':Sequelize[_0x1d47('0x7')]},'nameField':{'type':Sequelize[_0x1d47('0x7')]},'customField':{'type':Sequelize[_0x1d47('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1d47('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index e427da2..7b9356e 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 _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 +var _0x7cfe=['VIRTUAL','filter','includeAll','findAll','catch','show','params','SugarcrmField','options','create','body','update','find','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','where','pick','merge'];(function(_0xf1d488,_0x24fc7d){var _0x558c04=function(_0x2cf908){while(--_0x2cf908){_0xf1d488['push'](_0xf1d488['shift']());}};_0x558c04(++_0x24fc7d);}(_0x7cfe,0x97));var _0xe7cf=function(_0x64ee64,_0x212835){_0x64ee64=_0x64ee64-0x0;var _0x68dcd7=_0x7cfe[_0x64ee64];return _0x68dcd7;};'use strict';var emlformat=require(_0xe7cf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe7cf('0x1'));var jsonpatch=require(_0xe7cf('0x2'));var rp=require('request-promise');var moment=require(_0xe7cf('0x3'));var BPromise=require(_0xe7cf('0x4'));var Mustache=require(_0xe7cf('0x5'));var util=require('util');var path=require(_0xe7cf('0x6'));var sox=require(_0xe7cf('0x7'));var csv=require('to-csv');var ejs=require(_0xe7cf('0x8'));var fs=require('fs');var fs_extra=require(_0xe7cf('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe7cf('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xe7cf('0xb'));var toCsv=require('to-csv');var querystring=require(_0xe7cf('0xc'));var Papa=require(_0xe7cf('0xd'));var Redis=require(_0xe7cf('0xe'));var authService=require(_0xe7cf('0xf'));var qs=require(_0xe7cf('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xe7cf('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xe7cf('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x244a71,_0x24b281){_0x24b281=_0x24b281||0xcc;return function(_0xe39eef){if(_0xe39eef){return _0x244a71[_0xe7cf('0x13')](_0x24b281);}return _0x244a71[_0xe7cf('0x14')](_0x24b281)['end']();};}function respondWithResult(_0x263a0c,_0x5bcdb3){_0x5bcdb3=_0x5bcdb3||0xc8;return function(_0x38099f){if(_0x38099f){return _0x263a0c[_0xe7cf('0x14')](_0x5bcdb3)[_0xe7cf('0x15')](_0x38099f);}};}function respondWithFilteredResult(_0x39e82b,_0x1f5789){return function(_0x42abd8){if(_0x42abd8){var _0x206e8b=typeof _0x1f5789['offset']===_0xe7cf('0x16')&&typeof _0x1f5789[_0xe7cf('0x17')]==='undefined';var _0x50168b=_0x42abd8['count'];var _0x1082f1=_0x206e8b?0x0:_0x1f5789['offset'];var _0x150bef=_0x206e8b?_0x42abd8[_0xe7cf('0x18')]:_0x1f5789[_0xe7cf('0x19')]+_0x1f5789['limit'];var _0x270b9f;if(_0x150bef>=_0x50168b){_0x150bef=_0x50168b;_0x270b9f=0xc8;}else{_0x270b9f=0xce;}_0x39e82b[_0xe7cf('0x14')](_0x270b9f);return _0x39e82b[_0xe7cf('0x1a')](_0xe7cf('0x1b'),_0x1082f1+'-'+_0x150bef+'/'+_0x50168b)[_0xe7cf('0x15')](_0x42abd8);}return null;};}function patchUpdates(_0x24988e){return function(_0x64be3d){try{jsonpatch[_0xe7cf('0x1c')](_0x64be3d,_0x24988e,!![]);}catch(_0x1fe09f){return BPromise[_0xe7cf('0x1d')](_0x1fe09f);}return _0x64be3d[_0xe7cf('0x1e')]();};}function saveUpdates(_0xb59370,_0x2d2746){return function(_0xdc6063){if(_0xdc6063){return _0xdc6063['update'](_0xb59370)[_0xe7cf('0x1f')](function(_0x238baa){return _0x238baa;});}return null;};}function removeEntity(_0x112dca,_0x49fe1f){return function(_0x2cfe40){if(_0x2cfe40){return _0x2cfe40[_0xe7cf('0x20')]()[_0xe7cf('0x1f')](function(){_0x112dca[_0xe7cf('0x14')](0xcc)[_0xe7cf('0x21')]();});}};}function handleEntityNotFound(_0x948940,_0x2d5dea){return function(_0x2759b7){if(!_0x2759b7){_0x948940['sendStatus'](0x194);}return _0x2759b7;};}function handleError(_0x5bd2f7,_0x4765fb){_0x4765fb=_0x4765fb||0x1f4;return function(_0x4236ab){logger[_0xe7cf('0x22')](_0x4236ab[_0xe7cf('0x23')]);if(_0x4236ab[_0xe7cf('0x24')]){delete _0x4236ab[_0xe7cf('0x24')];}_0x5bd2f7[_0xe7cf('0x14')](_0x4765fb)[_0xe7cf('0x25')](_0x4236ab);};}exports[_0xe7cf('0x26')]=function(_0x15186d,_0x2aa4b8){var _0x5b7cc3={},_0x5f196d={},_0x5d2b34={'count':0x0,'rows':[]};var _0x14dbb7=_[_0xe7cf('0x27')](db['SugarcrmField'][_0xe7cf('0x28')],function(_0x1b6254){return{'name':_0x1b6254[_0xe7cf('0x29')],'type':_0x1b6254[_0xe7cf('0x2a')]['key']};});_0x5f196d['model']=_['map'](_0x14dbb7,_0xe7cf('0x24'));_0x5f196d[_0xe7cf('0x2b')]=_[_0xe7cf('0x2c')](_0x15186d['query']);_0x5f196d[_0xe7cf('0x2d')]=_[_0xe7cf('0x2e')](_0x5f196d[_0xe7cf('0x2f')],_0x5f196d[_0xe7cf('0x2b')]);_0x5b7cc3['attributes']=_['intersection'](_0x5f196d[_0xe7cf('0x2f')],qs[_0xe7cf('0x30')](_0x15186d[_0xe7cf('0x2b')][_0xe7cf('0x30')]));_0x5b7cc3[_0xe7cf('0x31')]=_0x5b7cc3[_0xe7cf('0x31')][_0xe7cf('0x32')]?_0x5b7cc3[_0xe7cf('0x31')]:_0x5f196d[_0xe7cf('0x2f')];if(!_0x15186d[_0xe7cf('0x2b')][_0xe7cf('0x33')]('nolimit')){_0x5b7cc3[_0xe7cf('0x17')]=qs['limit'](_0x15186d[_0xe7cf('0x2b')][_0xe7cf('0x17')]);_0x5b7cc3[_0xe7cf('0x19')]=qs[_0xe7cf('0x19')](_0x15186d[_0xe7cf('0x2b')][_0xe7cf('0x19')]);}_0x5b7cc3[_0xe7cf('0x34')]=qs['sort'](_0x15186d['query']['sort']);_0x5b7cc3[_0xe7cf('0x35')]=qs['filters'](_[_0xe7cf('0x36')](_0x15186d[_0xe7cf('0x2b')],_0x5f196d['filters']),_0x14dbb7);if(_0x15186d[_0xe7cf('0x2b')]['filter']){_0x5b7cc3[_0xe7cf('0x35')]=_[_0xe7cf('0x37')](_0x5b7cc3['where'],{'$or':_[_0xe7cf('0x27')](_0x14dbb7,function(_0x49096b){if(_0x49096b[_0xe7cf('0x2a')]!==_0xe7cf('0x38')){var _0x108045={};_0x108045[_0x49096b['name']]={'$like':'%'+_0x15186d['query'][_0xe7cf('0x39')]+'%'};return _0x108045;}})});}_0x5b7cc3=_['merge']({},_0x5b7cc3,_0x15186d['options']);var _0x1fcf41={'where':_0x5b7cc3['where']};return db['SugarcrmField'][_0xe7cf('0x18')](_0x1fcf41)[_0xe7cf('0x1f')](function(_0x58722b){_0x5d2b34[_0xe7cf('0x18')]=_0x58722b;if(_0x15186d[_0xe7cf('0x2b')][_0xe7cf('0x3a')]){_0x5b7cc3['include']=[{'all':!![]}];}return db['SugarcrmField'][_0xe7cf('0x3b')](_0x5b7cc3);})[_0xe7cf('0x1f')](function(_0x1c746a){_0x5d2b34['rows']=_0x1c746a;return _0x5d2b34;})[_0xe7cf('0x1f')](respondWithFilteredResult(_0x2aa4b8,_0x5b7cc3))[_0xe7cf('0x3c')](handleError(_0x2aa4b8,null));};exports[_0xe7cf('0x3d')]=function(_0x27da32,_0x4e6220){var _0x56001f={'raw':!![],'where':{'id':_0x27da32[_0xe7cf('0x3e')]['id']}},_0x59e6aa={};_0x59e6aa[_0xe7cf('0x2f')]=_[_0xe7cf('0x2c')](db[_0xe7cf('0x3f')]['rawAttributes']);_0x59e6aa['query']=_[_0xe7cf('0x2c')](_0x27da32[_0xe7cf('0x2b')]);_0x59e6aa[_0xe7cf('0x2d')]=_[_0xe7cf('0x2e')](_0x59e6aa[_0xe7cf('0x2f')],_0x59e6aa[_0xe7cf('0x2b')]);_0x56001f[_0xe7cf('0x31')]=_[_0xe7cf('0x2e')](_0x59e6aa['model'],qs[_0xe7cf('0x30')](_0x27da32[_0xe7cf('0x2b')][_0xe7cf('0x30')]));_0x56001f[_0xe7cf('0x31')]=_0x56001f[_0xe7cf('0x31')][_0xe7cf('0x32')]?_0x56001f[_0xe7cf('0x31')]:_0x59e6aa['model'];if(_0x27da32[_0xe7cf('0x2b')][_0xe7cf('0x3a')]){_0x56001f['include']=[{'all':!![]}];}_0x56001f=_[_0xe7cf('0x37')]({},_0x56001f,_0x27da32[_0xe7cf('0x40')]);return db[_0xe7cf('0x3f')]['find'](_0x56001f)['then'](handleEntityNotFound(_0x4e6220,null))[_0xe7cf('0x1f')](respondWithResult(_0x4e6220,null))[_0xe7cf('0x3c')](handleError(_0x4e6220,null));};exports[_0xe7cf('0x41')]=function(_0x354ea8,_0x25902b){return db[_0xe7cf('0x3f')][_0xe7cf('0x41')](_0x354ea8[_0xe7cf('0x42')],{})[_0xe7cf('0x1f')](respondWithResult(_0x25902b,0xc9))[_0xe7cf('0x3c')](handleError(_0x25902b,null));};exports[_0xe7cf('0x43')]=function(_0x487400,_0x88da59){if(_0x487400[_0xe7cf('0x42')]['id']){delete _0x487400[_0xe7cf('0x42')]['id'];}return db[_0xe7cf('0x3f')][_0xe7cf('0x44')]({'where':{'id':_0x487400[_0xe7cf('0x3e')]['id']}})[_0xe7cf('0x1f')](handleEntityNotFound(_0x88da59,null))[_0xe7cf('0x1f')](saveUpdates(_0x487400['body'],null))[_0xe7cf('0x1f')](respondWithResult(_0x88da59,null))[_0xe7cf('0x3c')](handleError(_0x88da59,null));};exports[_0xe7cf('0x20')]=function(_0x54629e,_0x5860de){return db['SugarcrmField']['find']({'where':{'id':_0x54629e[_0xe7cf('0x3e')]['id']}})[_0xe7cf('0x1f')](handleEntityNotFound(_0x5860de,null))[_0xe7cf('0x1f')](removeEntity(_0x5860de,null))[_0xe7cf('0x3c')](handleError(_0x5860de,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 6e4ddd9..99ae577 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 _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 +var _0xc4f6=['rimraf','../../config/environment','./intSugarcrmField.attributes','int_sugarcrm_fields','idField','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0xc4f6,0xc9));var _0x6c4f=function(_0x563bd4,_0x4fde01){_0x563bd4=_0x563bd4-0x0;var _0x4803af=_0xc4f6[_0x563bd4];return _0x4803af;};'use strict';var _=require('lodash');var util=require(_0x6c4f('0x0'));var logger=require(_0x6c4f('0x1'))(_0x6c4f('0x2'));var moment=require(_0x6c4f('0x3'));var BPromise=require(_0x6c4f('0x4'));var rp=require(_0x6c4f('0x5'));var fs=require('fs');var path=require(_0x6c4f('0x6'));var rimraf=require(_0x6c4f('0x7'));var config=require(_0x6c4f('0x8'));var attributes=require(_0x6c4f('0x9'));module['exports']=function(_0x4a8261,_0x511a05){return _0x4a8261['define']('SugarcrmField',attributes,{'tableName':_0x6c4f('0xa'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0x6c4f('0xb'),_0x6c4f('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index dd5587f..bd0ece5 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 _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 +var _0x8d5a=['client','http','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','error','message','result','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x8d5a,0x1c5));var _0xa8d5=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x8d5a[_0x1a36a5];return _0x746243;};'use strict';var _=require('lodash');var util=require(_0xa8d5('0x0'));var moment=require(_0xa8d5('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa8d5('0x2'));var db=require(_0xa8d5('0x3'))['db'];var utils=require(_0xa8d5('0x4'));var logger=require(_0xa8d5('0x5'))(_0xa8d5('0x6'));var config=require(_0xa8d5('0x7'));var jayson=require(_0xa8d5('0x8'));var client=jayson[_0xa8d5('0x9')][_0xa8d5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d4a3f,_0x24b9d9,_0x1e495b){return new BPromise(function(_0x218f8b,_0x175913){return client[_0xa8d5('0xb')](_0x4d4a3f,_0x1e495b)[_0xa8d5('0xc')](function(_0x1a97a8){logger[_0xa8d5('0xd')](_0xa8d5('0xe'),_0x24b9d9,_0xa8d5('0xf'));logger[_0xa8d5('0x10')](_0xa8d5('0x11'),_0x24b9d9,_0xa8d5('0xf'),JSON['stringify'](_0x1a97a8));if(_0x1a97a8['error']){if(_0x1a97a8[_0xa8d5('0x12')]['code']===0x1f4){logger[_0xa8d5('0x12')](_0xa8d5('0xe'),_0x24b9d9,_0x1a97a8[_0xa8d5('0x12')][_0xa8d5('0x13')]);return _0x175913(_0x1a97a8[_0xa8d5('0x12')]['message']);}logger[_0xa8d5('0x12')](_0xa8d5('0xe'),_0x24b9d9,_0x1a97a8[_0xa8d5('0x12')]['message']);return _0x218f8b(_0x1a97a8[_0xa8d5('0x12')][_0xa8d5('0x13')]);}else{logger[_0xa8d5('0xd')](_0xa8d5('0xe'),_0x24b9d9,'request\x20sent');_0x218f8b(_0x1a97a8[_0xa8d5('0x14')]['message']);}})[_0xa8d5('0x15')](function(_0x4ca848){logger[_0xa8d5('0x12')]('SugarcrmField,\x20%s,\x20%s',_0x24b9d9,_0x4ca848);_0x175913(_0x4ca848);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 9e35fb5..f994bd7 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 _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 +var _0x1455=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','isAuthenticated','index','get','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update','destroy','exports','multer','util','path','express','Router'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1455,0x97));var _0x5145=function(_0x17ca12,_0x1c9cf4){_0x17ca12=_0x17ca12-0x0;var _0x2093ab=_0x1455[_0x17ca12];return _0x2093ab;};'use strict';var multer=require(_0x5145('0x0'));var util=require(_0x5145('0x1'));var path=require(_0x5145('0x2'));var timeout=require('connect-timeout');var express=require(_0x5145('0x3'));var router=express[_0x5145('0x4')]();var fs_extra=require(_0x5145('0x5'));var auth=require(_0x5145('0x6'));var interaction=require(_0x5145('0x7'));var config=require(_0x5145('0x8'));var controller=require(_0x5145('0x9'));router['get']('/',auth[_0x5145('0xa')](),controller[_0x5145('0xb')]);router[_0x5145('0xc')]('/:id',auth[_0x5145('0xa')](),controller[_0x5145('0xd')]);router[_0x5145('0xc')](_0x5145('0xe'),auth['isAuthenticated'](),controller[_0x5145('0xf')]);router[_0x5145('0xc')](_0x5145('0x10'),auth[_0x5145('0xa')](),controller[_0x5145('0x11')]);router[_0x5145('0x12')]('/',auth[_0x5145('0xa')](),controller[_0x5145('0x13')]);router[_0x5145('0x12')](_0x5145('0xe'),auth[_0x5145('0xa')](),controller[_0x5145('0x14')]);router[_0x5145('0x15')](_0x5145('0x16'),auth['isAuthenticated'](),controller[_0x5145('0x17')]);router['delete'](_0x5145('0x16'),auth['isAuthenticated'](),controller[_0x5145('0x18')]);module[_0x5145('0x19')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index d1b81e3..7202dc4 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 _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 +var _0x858e=['exports','STRING','HelpDesk'];(function(_0x3d1692,_0x5526ea){var _0x53db93=function(_0x1240ca){while(--_0x1240ca){_0x3d1692['push'](_0x3d1692['shift']());}};_0x53db93(++_0x5526ea);}(_0x858e,0x102));var _0xe858=function(_0x153a9f,_0x4ab2bd){_0x153a9f=_0x153a9f-0x0;var _0x11b1e0=_0x858e[_0x153a9f];return _0x11b1e0;};'use strict';var Sequelize=require('sequelize');module[_0xe858('0x0')]={'name':{'type':Sequelize[_0xe858('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xe858('0x1')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0xe858('0x1')],'allowNull':![],'defaultValue':_0xe858('0x2')},'remoteUri':{'type':Sequelize[_0xe858('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xe858('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index f5c5883..44ff7a4 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 _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 +var _0x9b8c=['POST','login','result','token','sessionName','remove','editable','false','label','startsWith','picklist','picklistValues','log','vTiger\x20error:\x20','statusCode','error','test','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','count','limit','set','reject','save','update','destroy','then','end','name','send','index','map','VtigerAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','getConfigurations','findOne','VtigerConfiguration','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','username','description','moduleName','remoteUri','accessKey','slice','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success'];(function(_0x3d4876,_0x366386){var _0x58ca9d=function(_0x5bd045){while(--_0x5bd045){_0x3d4876['push'](_0x3d4876['shift']());}};_0x58ca9d(++_0x366386);}(_0x9b8c,0x85));var _0xc9b8=function(_0x40015a,_0x415db5){_0x40015a=_0x40015a-0x0;var _0x42f8a4=_0x9b8c[_0x40015a];return _0x42f8a4;};'use strict';var emlformat=require(_0xc9b8('0x0'));var rimraf=require(_0xc9b8('0x1'));var zipdir=require(_0xc9b8('0x2'));var jsonpatch=require(_0xc9b8('0x3'));var rp=require(_0xc9b8('0x4'));var moment=require(_0xc9b8('0x5'));var BPromise=require(_0xc9b8('0x6'));var Mustache=require(_0xc9b8('0x7'));var util=require(_0xc9b8('0x8'));var path=require(_0xc9b8('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc9b8('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc9b8('0xb'));var squel=require(_0xc9b8('0xc'));var crypto=require(_0xc9b8('0xd'));var jsforce=require(_0xc9b8('0xe'));var deskjs=require(_0xc9b8('0xf'));var toCsv=require(_0xc9b8('0x10'));var querystring=require('querystring');var Papa=require(_0xc9b8('0x11'));var Redis=require(_0xc9b8('0x12'));var authService=require(_0xc9b8('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xc9b8('0x14'));var hardwareService=require(_0xc9b8('0x15'));var logger=require(_0xc9b8('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc9b8('0x17'));var db=require(_0xc9b8('0x18'))['db'];var integrations=require(_0xc9b8('0x19'));function respondWithStatusCode(_0x37770c,_0x521755){_0x521755=_0x521755||0xcc;return function(_0x1cf207){if(_0x1cf207){return _0x37770c[_0xc9b8('0x1a')](_0x521755);}return _0x37770c['status'](_0x521755)['end']();};}function respondWithResult(_0x2bce18,_0x5b65a1){_0x5b65a1=_0x5b65a1||0xc8;return function(_0x26576b){if(_0x26576b){return _0x2bce18[_0xc9b8('0x1b')](_0x5b65a1)[_0xc9b8('0x1c')](_0x26576b);}};}function respondWithFilteredResult(_0x843ae5,_0x4ff74f){return function(_0x212196){if(_0x212196){var _0x26702d=typeof _0x4ff74f[_0xc9b8('0x1d')]==='undefined'&&typeof _0x4ff74f['limit']===_0xc9b8('0x1e');var _0x190580=_0x212196[_0xc9b8('0x1f')];var _0x5e578c=_0x26702d?0x0:_0x4ff74f[_0xc9b8('0x1d')];var _0x1bf106=_0x26702d?_0x212196[_0xc9b8('0x1f')]:_0x4ff74f[_0xc9b8('0x1d')]+_0x4ff74f[_0xc9b8('0x20')];var _0x172ff0;if(_0x1bf106>=_0x190580){_0x1bf106=_0x190580;_0x172ff0=0xc8;}else{_0x172ff0=0xce;}_0x843ae5['status'](_0x172ff0);return _0x843ae5[_0xc9b8('0x21')]('Content-Range',_0x5e578c+'-'+_0x1bf106+'/'+_0x190580)[_0xc9b8('0x1c')](_0x212196);}return null;};}function patchUpdates(_0x3bfaa8){return function(_0x665570){try{jsonpatch['apply'](_0x665570,_0x3bfaa8,!![]);}catch(_0x26b157){return BPromise[_0xc9b8('0x22')](_0x26b157);}return _0x665570[_0xc9b8('0x23')]();};}function saveUpdates(_0x48cee0,_0x1c8faa){return function(_0x26cfb8){if(_0x26cfb8){return _0x26cfb8[_0xc9b8('0x24')](_0x48cee0)['then'](function(_0x246244){return _0x246244;});}return null;};}function removeEntity(_0x44afa9,_0xd041c2){return function(_0x4bd754){if(_0x4bd754){return _0x4bd754[_0xc9b8('0x25')]()[_0xc9b8('0x26')](function(){_0x44afa9['status'](0xcc)[_0xc9b8('0x27')]();});}};}function handleEntityNotFound(_0x1007ba,_0xfbb214){return function(_0x5950d4){if(!_0x5950d4){_0x1007ba[_0xc9b8('0x1a')](0x194);}return _0x5950d4;};}function handleError(_0x1b6cd0,_0x4e370b){_0x4e370b=_0x4e370b||0x1f4;return function(_0x5ded28){logger['error'](_0x5ded28['stack']);if(_0x5ded28[_0xc9b8('0x28')]){delete _0x5ded28[_0xc9b8('0x28')];}_0x1b6cd0[_0xc9b8('0x1b')](_0x4e370b)[_0xc9b8('0x29')](_0x5ded28);};}exports[_0xc9b8('0x2a')]=function(_0x1265db,_0x57c899){var _0x2c0f77={},_0x1b76c1={},_0x101908={'count':0x0,'rows':[]};var _0x56d15c=_[_0xc9b8('0x2b')](db[_0xc9b8('0x2c')][_0xc9b8('0x2d')],function(_0x4f83b8){return{'name':_0x4f83b8[_0xc9b8('0x2e')],'type':_0x4f83b8[_0xc9b8('0x2f')][_0xc9b8('0x30')]};});_0x1b76c1[_0xc9b8('0x31')]=_[_0xc9b8('0x2b')](_0x56d15c,_0xc9b8('0x28'));_0x1b76c1[_0xc9b8('0x32')]=_[_0xc9b8('0x33')](_0x1265db[_0xc9b8('0x32')]);_0x1b76c1[_0xc9b8('0x34')]=_[_0xc9b8('0x35')](_0x1b76c1[_0xc9b8('0x31')],_0x1b76c1[_0xc9b8('0x32')]);_0x2c0f77[_0xc9b8('0x36')]=_[_0xc9b8('0x35')](_0x1b76c1[_0xc9b8('0x31')],qs[_0xc9b8('0x37')](_0x1265db[_0xc9b8('0x32')][_0xc9b8('0x37')]));_0x2c0f77[_0xc9b8('0x36')]=_0x2c0f77['attributes'][_0xc9b8('0x38')]?_0x2c0f77['attributes']:_0x1b76c1[_0xc9b8('0x31')];if(!_0x1265db[_0xc9b8('0x32')]['hasOwnProperty'](_0xc9b8('0x39'))){_0x2c0f77['limit']=qs[_0xc9b8('0x20')](_0x1265db[_0xc9b8('0x32')][_0xc9b8('0x20')]);_0x2c0f77[_0xc9b8('0x1d')]=qs['offset'](_0x1265db[_0xc9b8('0x32')][_0xc9b8('0x1d')]);}_0x2c0f77[_0xc9b8('0x3a')]=qs[_0xc9b8('0x3b')](_0x1265db[_0xc9b8('0x32')]['sort']);_0x2c0f77['where']=qs[_0xc9b8('0x34')](_[_0xc9b8('0x3c')](_0x1265db[_0xc9b8('0x32')],_0x1b76c1[_0xc9b8('0x34')]),_0x56d15c);if(_0x1265db[_0xc9b8('0x32')][_0xc9b8('0x3d')]){_0x2c0f77[_0xc9b8('0x3e')]=_[_0xc9b8('0x3f')](_0x2c0f77[_0xc9b8('0x3e')],{'$or':_[_0xc9b8('0x2b')](_0x56d15c,function(_0x1f4f7e){if(_0x1f4f7e[_0xc9b8('0x2f')]!==_0xc9b8('0x40')){var _0x506670={};_0x506670[_0x1f4f7e[_0xc9b8('0x28')]]={'$like':'%'+_0x1265db['query'][_0xc9b8('0x3d')]+'%'};return _0x506670;}})});}_0x2c0f77=_[_0xc9b8('0x3f')]({},_0x2c0f77,_0x1265db[_0xc9b8('0x41')]);var _0x3f4206={'where':_0x2c0f77[_0xc9b8('0x3e')]};return db[_0xc9b8('0x2c')][_0xc9b8('0x1f')](_0x3f4206)['then'](function(_0x3b9b65){_0x101908[_0xc9b8('0x1f')]=_0x3b9b65;if(_0x1265db[_0xc9b8('0x32')][_0xc9b8('0x42')]){_0x2c0f77[_0xc9b8('0x43')]=[{'all':!![]}];}return db[_0xc9b8('0x2c')][_0xc9b8('0x44')](_0x2c0f77);})['then'](function(_0x351b7c){_0x101908['rows']=_0x351b7c;return _0x101908;})[_0xc9b8('0x26')](respondWithFilteredResult(_0x57c899,_0x2c0f77))[_0xc9b8('0x45')](handleError(_0x57c899,null));};exports[_0xc9b8('0x46')]=function(_0x12a8ac,_0x2edb7c){var _0x2d8252={'raw':![],'where':{'id':_0x12a8ac[_0xc9b8('0x47')]['id']}},_0x34f9a1={};_0x34f9a1[_0xc9b8('0x31')]=_['keys'](db[_0xc9b8('0x2c')][_0xc9b8('0x2d')]);_0x34f9a1[_0xc9b8('0x32')]=_[_0xc9b8('0x33')](_0x12a8ac[_0xc9b8('0x32')]);_0x34f9a1[_0xc9b8('0x34')]=_['intersection'](_0x34f9a1[_0xc9b8('0x31')],_0x34f9a1[_0xc9b8('0x32')]);_0x2d8252['attributes']=_[_0xc9b8('0x35')](_0x34f9a1[_0xc9b8('0x31')],qs[_0xc9b8('0x37')](_0x12a8ac['query']['fields']));_0x2d8252[_0xc9b8('0x36')]=_0x2d8252[_0xc9b8('0x36')][_0xc9b8('0x38')]?_0x2d8252['attributes']:_0x34f9a1[_0xc9b8('0x31')];if(_0x12a8ac[_0xc9b8('0x32')][_0xc9b8('0x42')]){_0x2d8252[_0xc9b8('0x43')]=[{'all':!![]}];}_0x2d8252=_[_0xc9b8('0x3f')]({},_0x2d8252,_0x12a8ac[_0xc9b8('0x41')]);return db['VtigerAccount'][_0xc9b8('0x48')](_0x2d8252)['then'](handleEntityNotFound(_0x2edb7c,null))[_0xc9b8('0x26')](respondWithResult(_0x2edb7c,null))[_0xc9b8('0x45')](handleError(_0x2edb7c,null));};exports[_0xc9b8('0x49')]=function(_0x3d2c98,_0x4f9c04){return db[_0xc9b8('0x2c')][_0xc9b8('0x49')](_0x3d2c98[_0xc9b8('0x4a')],{})[_0xc9b8('0x26')](respondWithResult(_0x4f9c04,0xc9))['catch'](handleError(_0x4f9c04,null));};exports[_0xc9b8('0x24')]=function(_0x9eab3f,_0x3c390d){if(_0x9eab3f[_0xc9b8('0x4a')]['id']){delete _0x9eab3f['body']['id'];}return db[_0xc9b8('0x2c')][_0xc9b8('0x48')]({'where':{'id':_0x9eab3f[_0xc9b8('0x47')]['id']}})[_0xc9b8('0x26')](handleEntityNotFound(_0x3c390d,null))['then'](saveUpdates(_0x9eab3f['body'],null))[_0xc9b8('0x26')](respondWithResult(_0x3c390d,null))[_0xc9b8('0x45')](handleError(_0x3c390d,null));};exports[_0xc9b8('0x25')]=function(_0xf5c8d4,_0x5ef2a2){return db['VtigerAccount'][_0xc9b8('0x48')]({'where':{'id':_0xf5c8d4[_0xc9b8('0x47')]['id']}})['then'](handleEntityNotFound(_0x5ef2a2,null))[_0xc9b8('0x26')](removeEntity(_0x5ef2a2,null))[_0xc9b8('0x45')](handleError(_0x5ef2a2,null));};exports[_0xc9b8('0x4b')]=function(_0xcfb541,_0x3a7239,_0x3af315){var _0x17e69d={};var _0x4d952a={};var _0x5aa861;var _0x494c59;return db[_0xc9b8('0x2c')][_0xc9b8('0x4c')]({'where':{'id':_0xcfb541[_0xc9b8('0x47')]['id']}})['then'](handleEntityNotFound(_0x3a7239,null))[_0xc9b8('0x26')](function(_0x2d1a82){if(_0x2d1a82){_0x5aa861=_0x2d1a82;_0x4d952a['model']=_['keys'](db[_0xc9b8('0x4d')]['rawAttributes']);_0x4d952a[_0xc9b8('0x32')]=_[_0xc9b8('0x33')](_0xcfb541[_0xc9b8('0x32')]);_0x4d952a[_0xc9b8('0x34')]=_[_0xc9b8('0x35')](_0x4d952a['model'],_0x4d952a[_0xc9b8('0x32')]);_0x17e69d[_0xc9b8('0x36')]=_[_0xc9b8('0x35')](_0x4d952a[_0xc9b8('0x31')],qs[_0xc9b8('0x37')](_0xcfb541[_0xc9b8('0x32')][_0xc9b8('0x37')]));_0x17e69d[_0xc9b8('0x36')]=_0x17e69d[_0xc9b8('0x36')]['length']?_0x17e69d[_0xc9b8('0x36')]:_0x4d952a['model'];_0x17e69d[_0xc9b8('0x3a')]=qs[_0xc9b8('0x3b')](_0xcfb541[_0xc9b8('0x32')]['sort']);_0x17e69d['where']=qs[_0xc9b8('0x34')](_['pick'](_0xcfb541[_0xc9b8('0x32')],_0x4d952a[_0xc9b8('0x34')]));if(_0xcfb541[_0xc9b8('0x32')][_0xc9b8('0x3d')]){_0x17e69d['where']=_[_0xc9b8('0x3f')](_0x17e69d[_0xc9b8('0x3e')],{'$or':_[_0xc9b8('0x2b')](_0x17e69d[_0xc9b8('0x36')],function(_0x23fa43){var _0x555790={};_0x555790[_0x23fa43]={'$like':'%'+_0xcfb541[_0xc9b8('0x32')][_0xc9b8('0x3d')]+'%'};return _0x555790;})});}_0x17e69d=_['merge']({},_0x17e69d,_0xcfb541[_0xc9b8('0x41')]);return _0x5aa861['getConfigurations'](_0x17e69d);}})[_0xc9b8('0x26')](function(_0x1f9996){if(_0x1f9996){_0x494c59=_0x1f9996['length'];if(!_0xcfb541['query']['hasOwnProperty'](_0xc9b8('0x39'))){_0x17e69d['limit']=qs[_0xc9b8('0x20')](_0xcfb541[_0xc9b8('0x32')][_0xc9b8('0x20')]);_0x17e69d['offset']=qs['offset'](_0xcfb541[_0xc9b8('0x32')][_0xc9b8('0x1d')]);}return _0x5aa861['getConfigurations'](_0x17e69d);}})[_0xc9b8('0x26')](function(_0x50db83){if(_0x50db83){return _0x50db83?{'count':_0x494c59,'rows':_0x50db83}:null;}})[_0xc9b8('0x26')](respondWithResult(_0x3a7239,null))[_0xc9b8('0x45')](handleError(_0x3a7239,null));};exports[_0xc9b8('0x4e')]=function(_0x59ba4d,_0xa9db74,_0x2301c2){if(_0x59ba4d[_0xc9b8('0x4a')]['id']){delete _0x59ba4d[_0xc9b8('0x4a')]['id'];}return db['VtigerAccount']['findOne']({'where':{'id':_0x59ba4d['params']['id']}})[_0xc9b8('0x26')](handleEntityNotFound(_0xa9db74,null))[_0xc9b8('0x26')](function(_0x224c27){if(_0x224c27){_0x59ba4d[_0xc9b8('0x4a')]['AccountId']=_0x224c27['id'];_0x59ba4d[_0xc9b8('0x4a')][_0xc9b8('0x4f')]=integrations[_0xc9b8('0x50')](_0x59ba4d[_0xc9b8('0x4a')][_0xc9b8('0x51')],_0x59ba4d[_0xc9b8('0x4a')][_0xc9b8('0x2f')]);_0x59ba4d[_0xc9b8('0x4a')][_0xc9b8('0x52')]=integrations[_0xc9b8('0x53')](_0x59ba4d['body']['channel'],_0x59ba4d[_0xc9b8('0x4a')][_0xc9b8('0x2f')]);return db[_0xc9b8('0x4d')][_0xc9b8('0x49')](_0x59ba4d[_0xc9b8('0x4a')],{'include':[{'model':db[_0xc9b8('0x54')],'as':_0xc9b8('0x4f')},{'model':db[_0xc9b8('0x54')],'as':_0xc9b8('0x52')}]});}return null;})[_0xc9b8('0x26')](respondWithResult(_0xa9db74,null))[_0xc9b8('0x45')](handleError(_0xa9db74,null));};var md5=require(_0xc9b8('0x55'));exports[_0xc9b8('0x56')]=function(_0x1c4707,_0x48f6ac,_0x40abfa){var _0xc4c62e=null;var _0x3cfee1=null;var _0x52e668=null;var _0x4dbc48=null;var _0x1b67b8='';return db[_0xc9b8('0x2c')][_0xc9b8('0x4c')]({'where':{'id':_0x1c4707[_0xc9b8('0x47')]['id']},'attributes':['id',_0xc9b8('0x28'),_0xc9b8('0x57'),_0xc9b8('0x58'),_0xc9b8('0x59'),_0xc9b8('0x5a'),'serverUrl',_0xc9b8('0x5b')]})[_0xc9b8('0x26')](handleEntityNotFound(_0x48f6ac,null))['then'](function(_0x2668c5){if(_0x2668c5){_0xc4c62e=_0x2668c5['username'];_0x3cfee1=_0x2668c5[_0xc9b8('0x5b')];_0x52e668=_0x2668c5[_0xc9b8('0x59')];_0x1b67b8=_0x2668c5[_0xc9b8('0x5a')];var _0x1f9cf9=_0x1b67b8[_0xc9b8('0x5c')](-0x1);if(_0x1f9cf9==='/'){_0x1b67b8=_0x1b67b8['substring'](0x0,_0x1b67b8[_0xc9b8('0x5d')](_0x1f9cf9));}_0x4dbc48=util[_0xc9b8('0x5e')](_0xc9b8('0x5f'),_0x1b67b8);var _0x1822f2={'method':_0xc9b8('0x60'),'uri':_0x4dbc48,'qs':{'operation':_0xc9b8('0x61'),'username':_0x2668c5[_0xc9b8('0x57')]},'json':!![]};return rp(_0x1822f2);}})[_0xc9b8('0x26')](function(_0x4ef2a4){if(_0x4ef2a4[_0xc9b8('0x62')]){var _0x2f0b03={'method':_0xc9b8('0x63'),'uri':_0x4dbc48,'form':{'operation':_0xc9b8('0x64'),'username':_0xc4c62e,'accessKey':md5(_0x4ef2a4[_0xc9b8('0x65')][_0xc9b8('0x66')]+_0x3cfee1)},'json':!![]};return rp(_0x2f0b03);}})[_0xc9b8('0x26')](function(_0x5a80ff){if(_0x5a80ff[_0xc9b8('0x62')]){var _0x408bf0={'method':_0xc9b8('0x60'),'uri':_0x4dbc48,'qs':{'operation':'describe','username':_0xc4c62e,'sessionName':_0x5a80ff['result'][_0xc9b8('0x67')],'elementType':_0x52e668},'json':!![]};return rp(_0x408bf0);}})[_0xc9b8('0x26')](function(_0x210a30){if(_0x210a30[_0xc9b8('0x62')]){var _0x3ba149=['autogenerated','reference','owner'];_['remove'](_0x210a30[_0xc9b8('0x65')][_0xc9b8('0x37')],function(_0x479228){return _0x3ba149['includes'](_0x479228[_0xc9b8('0x2f')]['name']);});_[_0xc9b8('0x68')](_0x210a30['result'][_0xc9b8('0x37')],function(_0x27c314){return _0x27c314[_0xc9b8('0x69')]===_0xc9b8('0x6a');});return{'count':_0x210a30[_0xc9b8('0x65')][_0xc9b8('0x37')][_0xc9b8('0x38')],'rows':_[_0xc9b8('0x2b')](_0x210a30[_0xc9b8('0x65')][_0xc9b8('0x37')],function(_0x1f86ca){return{'id':_0x1f86ca[_0xc9b8('0x28')],'name':_0x1f86ca[_0xc9b8('0x6b')],'custom':_[_0xc9b8('0x6c')](_0x1f86ca[_0xc9b8('0x28')],'cf_')?!![]:![],'options':_0x1f86ca[_0xc9b8('0x2f')][_0xc9b8('0x28')]===_0xc9b8('0x6d')&&_0x1f86ca[_0xc9b8('0x2f')][_0xc9b8('0x6e')][_0xc9b8('0x38')]>0x0?_[_0xc9b8('0x2b')](_0x1f86ca[_0xc9b8('0x2f')][_0xc9b8('0x6e')],function(_0x246ab1){return{'name':_0x246ab1['label'],'value':_0x246ab1['value']};}):[]};})};}})['then'](respondWithResult(_0x48f6ac,null))[_0xc9b8('0x45')](function(_0x35d71e){console[_0xc9b8('0x6f')](_0xc9b8('0x70')+_0x35d71e);var _0x49db92=_0x1c4707[_0xc9b8('0x32')]['test']?0x1f4:_0x35d71e[_0xc9b8('0x71')]||0x1f4;logger[_0xc9b8('0x72')]('getFields,\x20%s,\x20%s,\x20%s',_0xc9b8('0x56'),_0x49db92,JSON['stringify'](_0x35d71e));delete _0x35d71e[_0xc9b8('0x28')];if(_0x49db92===0x191){_0x49db92=0x190;}_0x48f6ac[_0xc9b8('0x1b')](_0x49db92)[_0xc9b8('0x29')](_0x1c4707[_0xc9b8('0x32')][_0xc9b8('0x73')]?{'message':'Wrong\x20credentials','statusCode':_0x35d71e[_0xc9b8('0x71')]}:_0x35d71e);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 3dcebbc..83b4a6e 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 _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 +var _0x8d63=['./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x8d63,0x1d4));var _0x38d6=function(_0x11ab0b,_0x4d603a){_0x11ab0b=_0x11ab0b-0x0;var _0x5c3c7a=_0x8d63[_0x11ab0b];return _0x5c3c7a;};'use strict';var _=require(_0x38d6('0x0'));var util=require(_0x38d6('0x1'));var logger=require(_0x38d6('0x2'))(_0x38d6('0x3'));var moment=require(_0x38d6('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x38d6('0x5'));var rimraf=require(_0x38d6('0x6'));var config=require(_0x38d6('0x7'));var attributes=require(_0x38d6('0x8'));var integrations=require(_0x38d6('0x9'));module[_0x38d6('0xa')]=function(_0x1f2b4d,_0x38d83a){return _0x1f2b4d[_0x38d6('0xb')](_0x38d6('0xc'),attributes,{'tableName':_0x38d6('0xd'),'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 1fcb3a4..276f192 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 _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 +var _0xb574=['where','attributes','include','map','model','ShowVtigerAccount','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw'];(function(_0x3a4318,_0x13c6eb){var _0x36d746=function(_0x508617){while(--_0x508617){_0x3a4318['push'](_0x3a4318['shift']());}};_0x36d746(++_0x13c6eb);}(_0xb574,0x106));var _0x4b57=function(_0x109caf,_0x1e76e4){_0x109caf=_0x109caf-0x0;var _0x35e2af=_0xb574[_0x109caf];return _0x35e2af;};'use strict';var _=require(_0x4b57('0x0'));var util=require(_0x4b57('0x1'));var moment=require('moment');var BPromise=require(_0x4b57('0x2'));var rs=require(_0x4b57('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4b57('0x4'))['db'];var utils=require(_0x4b57('0x5'));var logger=require(_0x4b57('0x6'))(_0x4b57('0x7'));var config=require(_0x4b57('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4b57('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a4a0f,_0x585d86,_0x4b2d65){return new BPromise(function(_0x548ee8,_0x291e54){return client[_0x4b57('0xa')](_0x4a4a0f,_0x4b2d65)[_0x4b57('0xb')](function(_0x3b112d){logger[_0x4b57('0xc')](_0x4b57('0xd'),_0x585d86,_0x4b57('0xe'));logger[_0x4b57('0xf')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x585d86,_0x4b57('0xe'),JSON[_0x4b57('0x10')](_0x3b112d));if(_0x3b112d[_0x4b57('0x11')]){if(_0x3b112d['error']['code']===0x1f4){logger[_0x4b57('0x11')](_0x4b57('0xd'),_0x585d86,_0x3b112d[_0x4b57('0x11')][_0x4b57('0x12')]);return _0x291e54(_0x3b112d[_0x4b57('0x11')][_0x4b57('0x12')]);}logger[_0x4b57('0x11')](_0x4b57('0xd'),_0x585d86,_0x3b112d[_0x4b57('0x11')]['message']);return _0x548ee8(_0x3b112d['error'][_0x4b57('0x12')]);}else{logger[_0x4b57('0xc')](_0x4b57('0xd'),_0x585d86,'request\x20sent');_0x548ee8(_0x3b112d[_0x4b57('0x13')]['message']);}})[_0x4b57('0x14')](function(_0x42aff4){logger[_0x4b57('0x11')](_0x4b57('0xd'),_0x585d86,_0x42aff4);_0x291e54(_0x42aff4);});});}exports[_0x4b57('0x15')]=function(_0xfb71cc){var _0x4ede42=this;return new Promise(function(_0x1b35ff,_0x1a0b72){return db[_0x4b57('0x16')][_0x4b57('0x17')]({'raw':_0xfb71cc['options']?_0xfb71cc[_0x4b57('0x18')][_0x4b57('0x19')]===undefined?!![]:![]:!![],'where':_0xfb71cc[_0x4b57('0x18')]?_0xfb71cc[_0x4b57('0x18')][_0x4b57('0x1a')]||null:null,'attributes':_0xfb71cc[_0x4b57('0x18')]?_0xfb71cc['options'][_0x4b57('0x1b')]||null:null,'limit':_0xfb71cc[_0x4b57('0x18')]?_0xfb71cc[_0x4b57('0x18')]['limit']||null:null,'include':_0xfb71cc[_0x4b57('0x18')]?_0xfb71cc[_0x4b57('0x18')][_0x4b57('0x1c')]?_[_0x4b57('0x1d')](_0xfb71cc['options'][_0x4b57('0x1c')],function(_0x368c5f){return{'model':db[_0x368c5f['model']],'as':_0x368c5f['as'],'attributes':_0x368c5f[_0x4b57('0x1b')],'include':_0x368c5f[_0x4b57('0x1c')]?_[_0x4b57('0x1d')](_0x368c5f[_0x4b57('0x1c')],function(_0x540eff){return{'model':db[_0x540eff[_0x4b57('0x1e')]],'as':_0x540eff['as'],'attributes':_0x540eff['attributes'],'include':_0x540eff[_0x4b57('0x1c')]?_['map'](_0x540eff[_0x4b57('0x1c')],function(_0x2dc9d8){return{'model':db[_0x2dc9d8[_0x4b57('0x1e')]],'as':_0x2dc9d8['as'],'attributes':_0x2dc9d8[_0x4b57('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4b57('0xb')](function(_0x392e37){logger['info']('GetVtigerAccount',_0xfb71cc);logger[_0x4b57('0xf')]('GetVtigerAccount',_0xfb71cc,JSON[_0x4b57('0x10')](_0x392e37));_0x1b35ff(_0x392e37);})[_0x4b57('0x14')](function(_0x874cf7){logger[_0x4b57('0x11')](_0x4b57('0x15'),_0x874cf7[_0x4b57('0x12')],_0xfb71cc);_0x1a0b72(_0x4ede42['error'](0x1f4,_0x874cf7[_0x4b57('0x12')]));});});};exports[_0x4b57('0x1f')]=function(_0x68be27){var _0x3cd331=this;return new Promise(function(_0x4ccf89,_0xa91ba){return db[_0x4b57('0x16')]['find']({'raw':_0x68be27[_0x4b57('0x18')]?_0x68be27[_0x4b57('0x18')][_0x4b57('0x19')]===undefined?!![]:![]:!![],'where':_0x68be27[_0x4b57('0x18')]?_0x68be27['options']['where']||null:null,'attributes':_0x68be27['options']?_0x68be27[_0x4b57('0x18')][_0x4b57('0x1b')]||null:null,'include':_0x68be27[_0x4b57('0x18')]?_0x68be27[_0x4b57('0x18')][_0x4b57('0x1c')]?_['map'](_0x68be27[_0x4b57('0x18')][_0x4b57('0x1c')],function(_0x1fd3f7){return{'model':db[_0x1fd3f7['model']],'as':_0x1fd3f7['as'],'attributes':_0x1fd3f7[_0x4b57('0x1b')],'include':_0x1fd3f7[_0x4b57('0x1c')]?_[_0x4b57('0x1d')](_0x1fd3f7['include'],function(_0x28a0ee){return{'model':db[_0x28a0ee[_0x4b57('0x1e')]],'as':_0x28a0ee['as'],'attributes':_0x28a0ee['attributes'],'include':_0x28a0ee[_0x4b57('0x1c')]?_[_0x4b57('0x1d')](_0x28a0ee[_0x4b57('0x1c')],function(_0x91f32e){return{'model':db[_0x91f32e[_0x4b57('0x1e')]],'as':_0x91f32e['as'],'attributes':_0x91f32e[_0x4b57('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1f9f76){logger[_0x4b57('0xc')](_0x4b57('0x1f'),_0x68be27);logger[_0x4b57('0xf')](_0x4b57('0x1f'),_0x68be27,JSON[_0x4b57('0x10')](_0x1f9f76));_0x4ccf89(_0x1f9f76);})[_0x4b57('0x14')](function(_0x4c5b82){logger['error'](_0x4b57('0x1f'),_0x4c5b82[_0x4b57('0x12')],_0x68be27);_0xa91ba(_0x3cd331[_0x4b57('0x11')](0x1f4,_0x4c5b82['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 33408eb..0c7de82 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 _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 +var _0xa1fb=['getSubjects','/:id/descriptions','post','create','put','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','index','/:id','isAuthenticated','/:id/fields','/:id/subjects'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xa1fb,0x17e));var _0xba1f=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xa1fb[_0x2d2c16];return _0x53f2fb;};'use strict';var multer=require(_0xba1f('0x0'));var util=require(_0xba1f('0x1'));var path=require(_0xba1f('0x2'));var timeout=require('connect-timeout');var express=require(_0xba1f('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xba1f('0x4'));var interaction=require(_0xba1f('0x5'));var config=require(_0xba1f('0x6'));var controller=require(_0xba1f('0x7'));router[_0xba1f('0x8')]('/',auth['isAuthenticated'](),controller[_0xba1f('0x9')]);router[_0xba1f('0x8')](_0xba1f('0xa'),auth[_0xba1f('0xb')](),controller['show']);router[_0xba1f('0x8')](_0xba1f('0xc'),auth[_0xba1f('0xb')](),controller['getFields']);router[_0xba1f('0x8')](_0xba1f('0xd'),auth[_0xba1f('0xb')](),controller[_0xba1f('0xe')]);router['get'](_0xba1f('0xf'),auth[_0xba1f('0xb')](),controller['getDescriptions']);router[_0xba1f('0x10')]('/',auth[_0xba1f('0xb')](),controller[_0xba1f('0x11')]);router[_0xba1f('0x12')](_0xba1f('0xa'),auth[_0xba1f('0xb')](),controller['update']);router[_0xba1f('0x13')](_0xba1f('0xa'),auth[_0xba1f('0xb')](),controller[_0xba1f('0x14')]);module[_0xba1f('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index e079950..b16ceac 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 _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 +var _0x3015=['exports','STRING','sequelize'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3015,0x17c));var _0x5301=function(_0x5719ee,_0x34791c){_0x5719ee=_0x5719ee-0x0;var _0x2005e7=_0x3015[_0x5719ee];return _0x2005e7;};'use strict';var Sequelize=require(_0x5301('0x0'));module[_0x5301('0x1')]={'name':{'type':Sequelize[_0x5301('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index f524156..d88b2f8 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 _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 +var _0xb79c=['body','getFields','findOne','hasOwnProperty','VtigerField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','json','apply','reject','destroy','then','stack','send','map','rawAttributes','type','key','model','name','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','VtigerConfiguration','findAll','show','params','options','find','create','catch'];(function(_0x3a8d27,_0x555172){var _0x4daf4f=function(_0x57f758){while(--_0x57f758){_0x3a8d27['push'](_0x3a8d27['shift']());}};_0x4daf4f(++_0x555172);}(_0xb79c,0x1e7));var _0xcb79=function(_0x4a3aa3,_0x249884){_0x4a3aa3=_0x4a3aa3-0x0;var _0x5db5f6=_0xb79c[_0x4a3aa3];return _0x5db5f6;};'use strict';var emlformat=require(_0xcb79('0x0'));var rimraf=require(_0xcb79('0x1'));var zipdir=require(_0xcb79('0x2'));var jsonpatch=require(_0xcb79('0x3'));var rp=require(_0xcb79('0x4'));var moment=require('moment');var BPromise=require(_0xcb79('0x5'));var Mustache=require('mustache');var util=require(_0xcb79('0x6'));var path=require(_0xcb79('0x7'));var sox=require(_0xcb79('0x8'));var csv=require(_0xcb79('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcb79('0xa'));var _=require(_0xcb79('0xb'));var squel=require('squel');var crypto=require(_0xcb79('0xc'));var jsforce=require(_0xcb79('0xd'));var deskjs=require(_0xcb79('0xe'));var toCsv=require(_0xcb79('0x9'));var querystring=require(_0xcb79('0xf'));var Papa=require(_0xcb79('0x10'));var Redis=require(_0xcb79('0x11'));var authService=require(_0xcb79('0x12'));var qs=require(_0xcb79('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcb79('0x14'));var logger=require(_0xcb79('0x15'))(_0xcb79('0x16'));var utils=require(_0xcb79('0x17'));var config=require(_0xcb79('0x18'));var licenseUtil=require(_0xcb79('0x19'));var db=require(_0xcb79('0x1a'))['db'];function respondWithStatusCode(_0x5601a0,_0x2e0055){_0x2e0055=_0x2e0055||0xcc;return function(_0x20d83c){if(_0x20d83c){return _0x5601a0[_0xcb79('0x1b')](_0x2e0055);}return _0x5601a0[_0xcb79('0x1c')](_0x2e0055)[_0xcb79('0x1d')]();};}function respondWithResult(_0x1fd613,_0x299c24){_0x299c24=_0x299c24||0xc8;return function(_0x3bc92f){if(_0x3bc92f){return _0x1fd613[_0xcb79('0x1c')](_0x299c24)['json'](_0x3bc92f);}};}function respondWithFilteredResult(_0x4b3b60,_0x2cd1bc){return function(_0x1f2d6d){if(_0x1f2d6d){var _0x26a5b2=typeof _0x2cd1bc[_0xcb79('0x1e')]==='undefined'&&typeof _0x2cd1bc[_0xcb79('0x1f')]===_0xcb79('0x20');var _0x5e4171=_0x1f2d6d[_0xcb79('0x21')];var _0x4b769e=_0x26a5b2?0x0:_0x2cd1bc[_0xcb79('0x1e')];var _0x51fd60=_0x26a5b2?_0x1f2d6d[_0xcb79('0x21')]:_0x2cd1bc['offset']+_0x2cd1bc['limit'];var _0x56d285;if(_0x51fd60>=_0x5e4171){_0x51fd60=_0x5e4171;_0x56d285=0xc8;}else{_0x56d285=0xce;}_0x4b3b60[_0xcb79('0x1c')](_0x56d285);return _0x4b3b60[_0xcb79('0x22')]('Content-Range',_0x4b769e+'-'+_0x51fd60+'/'+_0x5e4171)[_0xcb79('0x23')](_0x1f2d6d);}return null;};}function patchUpdates(_0x2317fb){return function(_0x5e6562){try{jsonpatch[_0xcb79('0x24')](_0x5e6562,_0x2317fb,!![]);}catch(_0x2e043b){return BPromise[_0xcb79('0x25')](_0x2e043b);}return _0x5e6562['save']();};}function saveUpdates(_0x2dcbae,_0x22dc2d){return function(_0x1d06fd){if(_0x1d06fd){return _0x1d06fd['update'](_0x2dcbae)['then'](function(_0x311548){return _0x311548;});}return null;};}function removeEntity(_0x43f74c,_0x84f849){return function(_0x418ff7){if(_0x418ff7){return _0x418ff7[_0xcb79('0x26')]()[_0xcb79('0x27')](function(){_0x43f74c[_0xcb79('0x1c')](0xcc)[_0xcb79('0x1d')]();});}};}function handleEntityNotFound(_0x522b60,_0x106df6){return function(_0x304144){if(!_0x304144){_0x522b60[_0xcb79('0x1b')](0x194);}return _0x304144;};}function handleError(_0x2b6606,_0x501a86){_0x501a86=_0x501a86||0x1f4;return function(_0x5c7507){logger['error'](_0x5c7507[_0xcb79('0x28')]);if(_0x5c7507['name']){delete _0x5c7507['name'];}_0x2b6606[_0xcb79('0x1c')](_0x501a86)[_0xcb79('0x29')](_0x5c7507);};}exports['index']=function(_0x537313,_0x4352a9){var _0x2f405f={},_0x521aa8={},_0x4e1abd={'count':0x0,'rows':[]};var _0x560e0b=_[_0xcb79('0x2a')](db['VtigerConfiguration'][_0xcb79('0x2b')],function(_0x1e5859){return{'name':_0x1e5859['fieldName'],'type':_0x1e5859[_0xcb79('0x2c')][_0xcb79('0x2d')]};});_0x521aa8[_0xcb79('0x2e')]=_[_0xcb79('0x2a')](_0x560e0b,_0xcb79('0x2f'));_0x521aa8['query']=_[_0xcb79('0x30')](_0x537313[_0xcb79('0x31')]);_0x521aa8[_0xcb79('0x32')]=_[_0xcb79('0x33')](_0x521aa8[_0xcb79('0x2e')],_0x521aa8['query']);_0x2f405f['attributes']=_[_0xcb79('0x33')](_0x521aa8[_0xcb79('0x2e')],qs[_0xcb79('0x34')](_0x537313[_0xcb79('0x31')][_0xcb79('0x34')]));_0x2f405f[_0xcb79('0x35')]=_0x2f405f[_0xcb79('0x35')][_0xcb79('0x36')]?_0x2f405f[_0xcb79('0x35')]:_0x521aa8['model'];if(!_0x537313[_0xcb79('0x31')]['hasOwnProperty'](_0xcb79('0x37'))){_0x2f405f[_0xcb79('0x1f')]=qs[_0xcb79('0x1f')](_0x537313[_0xcb79('0x31')][_0xcb79('0x1f')]);_0x2f405f[_0xcb79('0x1e')]=qs[_0xcb79('0x1e')](_0x537313[_0xcb79('0x31')][_0xcb79('0x1e')]);}_0x2f405f[_0xcb79('0x38')]=qs['sort'](_0x537313[_0xcb79('0x31')][_0xcb79('0x39')]);_0x2f405f[_0xcb79('0x3a')]=qs[_0xcb79('0x32')](_[_0xcb79('0x3b')](_0x537313[_0xcb79('0x31')],_0x521aa8[_0xcb79('0x32')]),_0x560e0b);if(_0x537313['query'][_0xcb79('0x3c')]){_0x2f405f[_0xcb79('0x3a')]=_[_0xcb79('0x3d')](_0x2f405f['where'],{'$or':_['map'](_0x560e0b,function(_0x4737b5){if(_0x4737b5['type']!==_0xcb79('0x3e')){var _0x266177={};_0x266177[_0x4737b5[_0xcb79('0x2f')]]={'$like':'%'+_0x537313[_0xcb79('0x31')]['filter']+'%'};return _0x266177;}})});}_0x2f405f=_['merge']({},_0x2f405f,_0x537313['options']);var _0x572c79={'where':_0x2f405f[_0xcb79('0x3a')]};return db['VtigerConfiguration']['count'](_0x572c79)[_0xcb79('0x27')](function(_0x2f964b){_0x4e1abd['count']=_0x2f964b;if(_0x537313[_0xcb79('0x31')][_0xcb79('0x3f')]){_0x2f405f[_0xcb79('0x40')]=[{'all':!![]}];}return db[_0xcb79('0x41')][_0xcb79('0x42')](_0x2f405f);})[_0xcb79('0x27')](function(_0x1fd6f7){_0x4e1abd['rows']=_0x1fd6f7;return _0x4e1abd;})[_0xcb79('0x27')](respondWithFilteredResult(_0x4352a9,_0x2f405f))['catch'](handleError(_0x4352a9,null));};exports[_0xcb79('0x43')]=function(_0x240d95,_0x1d06a3){var _0x5b59b7={'raw':![],'where':{'id':_0x240d95[_0xcb79('0x44')]['id']}},_0x2257a9={};_0x2257a9[_0xcb79('0x2e')]=_['keys'](db['VtigerConfiguration'][_0xcb79('0x2b')]);_0x2257a9[_0xcb79('0x31')]=_[_0xcb79('0x30')](_0x240d95[_0xcb79('0x31')]);_0x2257a9['filters']=_[_0xcb79('0x33')](_0x2257a9[_0xcb79('0x2e')],_0x2257a9[_0xcb79('0x31')]);_0x5b59b7[_0xcb79('0x35')]=_[_0xcb79('0x33')](_0x2257a9[_0xcb79('0x2e')],qs[_0xcb79('0x34')](_0x240d95[_0xcb79('0x31')][_0xcb79('0x34')]));_0x5b59b7[_0xcb79('0x35')]=_0x5b59b7[_0xcb79('0x35')][_0xcb79('0x36')]?_0x5b59b7['attributes']:_0x2257a9[_0xcb79('0x2e')];if(_0x240d95['query']['includeAll']){_0x5b59b7[_0xcb79('0x40')]=[{'all':!![]}];}_0x5b59b7=_[_0xcb79('0x3d')]({},_0x5b59b7,_0x240d95[_0xcb79('0x45')]);return db[_0xcb79('0x41')][_0xcb79('0x46')](_0x5b59b7)[_0xcb79('0x27')](handleEntityNotFound(_0x1d06a3,null))['then'](respondWithResult(_0x1d06a3,null))['catch'](handleError(_0x1d06a3,null));};exports[_0xcb79('0x47')]=function(_0x3147de,_0x117e22){return db[_0xcb79('0x41')][_0xcb79('0x47')](_0x3147de['body'],{})['then'](respondWithResult(_0x117e22,0xc9))[_0xcb79('0x48')](handleError(_0x117e22,null));};exports['update']=function(_0xdcae90,_0x23e2c1){if(_0xdcae90['body']['id']){delete _0xdcae90[_0xcb79('0x49')]['id'];}return db[_0xcb79('0x41')][_0xcb79('0x46')]({'where':{'id':_0xdcae90[_0xcb79('0x44')]['id']}})[_0xcb79('0x27')](handleEntityNotFound(_0x23e2c1,null))[_0xcb79('0x27')](saveUpdates(_0xdcae90['body'],null))[_0xcb79('0x27')](respondWithResult(_0x23e2c1,null))['catch'](handleError(_0x23e2c1,null));};exports['destroy']=function(_0x24d98a,_0x42e519){return db[_0xcb79('0x41')][_0xcb79('0x46')]({'where':{'id':_0x24d98a[_0xcb79('0x44')]['id']}})['then'](handleEntityNotFound(_0x42e519,null))['then'](removeEntity(_0x42e519,null))['catch'](handleError(_0x42e519,null));};exports[_0xcb79('0x4a')]=function(_0x5070e5,_0x4f00b4,_0x1a6a15){var _0x449e18={};var _0x1cd337={};var _0x20f39e;var _0x20d325;return db[_0xcb79('0x41')][_0xcb79('0x4b')]({'where':{'id':_0x5070e5[_0xcb79('0x44')]['id']}})['then'](handleEntityNotFound(_0x4f00b4,null))[_0xcb79('0x27')](function(_0x265976){if(_0x265976){_0x20f39e=_0x265976;_0x1cd337[_0xcb79('0x2e')]=_[_0xcb79('0x30')](db['VtigerField'][_0xcb79('0x2b')]);_0x1cd337[_0xcb79('0x31')]=_[_0xcb79('0x30')](_0x5070e5[_0xcb79('0x31')]);_0x1cd337[_0xcb79('0x32')]=_['intersection'](_0x1cd337['model'],_0x1cd337[_0xcb79('0x31')]);_0x449e18[_0xcb79('0x35')]=_[_0xcb79('0x33')](_0x1cd337[_0xcb79('0x2e')],qs[_0xcb79('0x34')](_0x5070e5[_0xcb79('0x31')][_0xcb79('0x34')]));_0x449e18[_0xcb79('0x35')]=_0x449e18[_0xcb79('0x35')]['length']?_0x449e18[_0xcb79('0x35')]:_0x1cd337['model'];_0x449e18[_0xcb79('0x38')]=qs[_0xcb79('0x39')](_0x5070e5['query'][_0xcb79('0x39')]);_0x449e18[_0xcb79('0x3a')]=qs[_0xcb79('0x32')](_[_0xcb79('0x3b')](_0x5070e5[_0xcb79('0x31')],_0x1cd337[_0xcb79('0x32')]));if(_0x5070e5[_0xcb79('0x31')][_0xcb79('0x3c')]){_0x449e18[_0xcb79('0x3a')]=_[_0xcb79('0x3d')](_0x449e18[_0xcb79('0x3a')],{'$or':_[_0xcb79('0x2a')](_0x449e18['attributes'],function(_0x40b786){var _0x5b697d={};_0x5b697d[_0x40b786]={'$like':'%'+_0x5070e5[_0xcb79('0x31')][_0xcb79('0x3c')]+'%'};return _0x5b697d;})});}_0x449e18=_[_0xcb79('0x3d')]({},_0x449e18,_0x5070e5[_0xcb79('0x45')]);return _0x20f39e[_0xcb79('0x4a')](_0x449e18);}})[_0xcb79('0x27')](function(_0x72ca62){if(_0x72ca62){_0x20d325=_0x72ca62['length'];if(!_0x5070e5[_0xcb79('0x31')][_0xcb79('0x4c')](_0xcb79('0x37'))){_0x449e18[_0xcb79('0x1f')]=qs[_0xcb79('0x1f')](_0x5070e5[_0xcb79('0x31')][_0xcb79('0x1f')]);_0x449e18[_0xcb79('0x1e')]=qs[_0xcb79('0x1e')](_0x5070e5[_0xcb79('0x31')]['offset']);}return _0x20f39e[_0xcb79('0x4a')](_0x449e18);}})[_0xcb79('0x27')](function(_0x55e1e3){if(_0x55e1e3){return _0x55e1e3?{'count':_0x20d325,'rows':_0x55e1e3}:null;}})[_0xcb79('0x27')](respondWithResult(_0x4f00b4,null))[_0xcb79('0x48')](handleError(_0x4f00b4,null));};exports['getSubjects']=function(_0x2f7ea8,_0x1d8652,_0x1d2794){var _0xc1ed08={};var _0x2a7074={};var _0x396441;var _0x113c92;return db[_0xcb79('0x41')][_0xcb79('0x4b')]({'where':{'id':_0x2f7ea8[_0xcb79('0x44')]['id']}})[_0xcb79('0x27')](handleEntityNotFound(_0x1d8652,null))[_0xcb79('0x27')](function(_0xa6c729){if(_0xa6c729){_0x396441=_0xa6c729;_0x2a7074[_0xcb79('0x2e')]=_['keys'](db[_0xcb79('0x4d')][_0xcb79('0x2b')]);_0x2a7074[_0xcb79('0x31')]=_['keys'](_0x2f7ea8['query']);_0x2a7074[_0xcb79('0x32')]=_[_0xcb79('0x33')](_0x2a7074[_0xcb79('0x2e')],_0x2a7074[_0xcb79('0x31')]);_0xc1ed08[_0xcb79('0x35')]=_[_0xcb79('0x33')](_0x2a7074['model'],qs[_0xcb79('0x34')](_0x2f7ea8[_0xcb79('0x31')]['fields']));_0xc1ed08[_0xcb79('0x35')]=_0xc1ed08[_0xcb79('0x35')]['length']?_0xc1ed08['attributes']:_0x2a7074[_0xcb79('0x2e')];_0xc1ed08['order']=qs['sort'](_0x2f7ea8['query'][_0xcb79('0x39')]);_0xc1ed08[_0xcb79('0x3a')]=qs[_0xcb79('0x32')](_[_0xcb79('0x3b')](_0x2f7ea8[_0xcb79('0x31')],_0x2a7074[_0xcb79('0x32')]));if(_0x2f7ea8[_0xcb79('0x31')][_0xcb79('0x3c')]){_0xc1ed08['where']=_['merge'](_0xc1ed08[_0xcb79('0x3a')],{'$or':_['map'](_0xc1ed08[_0xcb79('0x35')],function(_0x5b2849){var _0x16d722={};_0x16d722[_0x5b2849]={'$like':'%'+_0x2f7ea8[_0xcb79('0x31')][_0xcb79('0x3c')]+'%'};return _0x16d722;})});}_0xc1ed08=_[_0xcb79('0x3d')]({},_0xc1ed08,_0x2f7ea8['options']);return _0x396441['getSubjects'](_0xc1ed08);}})[_0xcb79('0x27')](function(_0x290d09){if(_0x290d09){_0x113c92=_0x290d09[_0xcb79('0x36')];if(!_0x2f7ea8[_0xcb79('0x31')][_0xcb79('0x4c')]('nolimit')){_0xc1ed08[_0xcb79('0x1f')]=qs[_0xcb79('0x1f')](_0x2f7ea8[_0xcb79('0x31')]['limit']);_0xc1ed08[_0xcb79('0x1e')]=qs['offset'](_0x2f7ea8['query'][_0xcb79('0x1e')]);}return _0x396441[_0xcb79('0x4e')](_0xc1ed08);}})[_0xcb79('0x27')](function(_0x520b4c){if(_0x520b4c){return _0x520b4c?{'count':_0x113c92,'rows':_0x520b4c}:null;}})[_0xcb79('0x27')](respondWithResult(_0x1d8652,null))[_0xcb79('0x48')](handleError(_0x1d8652,null));};exports[_0xcb79('0x4f')]=function(_0x54cd2c,_0x465372,_0x3b326d){var _0x4e8767={};var _0x47fae6={};var _0x3a4cad;var _0x413094;return db[_0xcb79('0x41')]['findOne']({'where':{'id':_0x54cd2c[_0xcb79('0x44')]['id']}})[_0xcb79('0x27')](handleEntityNotFound(_0x465372,null))[_0xcb79('0x27')](function(_0x5f16f4){if(_0x5f16f4){_0x3a4cad=_0x5f16f4;_0x47fae6['model']=_[_0xcb79('0x30')](db['VtigerField'][_0xcb79('0x2b')]);_0x47fae6['query']=_['keys'](_0x54cd2c[_0xcb79('0x31')]);_0x47fae6[_0xcb79('0x32')]=_[_0xcb79('0x33')](_0x47fae6[_0xcb79('0x2e')],_0x47fae6['query']);_0x4e8767[_0xcb79('0x35')]=_['intersection'](_0x47fae6[_0xcb79('0x2e')],qs[_0xcb79('0x34')](_0x54cd2c[_0xcb79('0x31')][_0xcb79('0x34')]));_0x4e8767['attributes']=_0x4e8767[_0xcb79('0x35')]['length']?_0x4e8767[_0xcb79('0x35')]:_0x47fae6[_0xcb79('0x2e')];_0x4e8767[_0xcb79('0x38')]=qs[_0xcb79('0x39')](_0x54cd2c[_0xcb79('0x31')][_0xcb79('0x39')]);_0x4e8767['where']=qs[_0xcb79('0x32')](_[_0xcb79('0x3b')](_0x54cd2c[_0xcb79('0x31')],_0x47fae6[_0xcb79('0x32')]));if(_0x54cd2c[_0xcb79('0x31')][_0xcb79('0x3c')]){_0x4e8767['where']=_[_0xcb79('0x3d')](_0x4e8767[_0xcb79('0x3a')],{'$or':_['map'](_0x4e8767[_0xcb79('0x35')],function(_0x52ae6e){var _0x19605b={};_0x19605b[_0x52ae6e]={'$like':'%'+_0x54cd2c[_0xcb79('0x31')][_0xcb79('0x3c')]+'%'};return _0x19605b;})});}_0x4e8767=_[_0xcb79('0x3d')]({},_0x4e8767,_0x54cd2c[_0xcb79('0x45')]);return _0x3a4cad[_0xcb79('0x4f')](_0x4e8767);}})[_0xcb79('0x27')](function(_0x31a296){if(_0x31a296){_0x413094=_0x31a296['length'];if(!_0x54cd2c[_0xcb79('0x31')][_0xcb79('0x4c')](_0xcb79('0x37'))){_0x4e8767[_0xcb79('0x1f')]=qs[_0xcb79('0x1f')](_0x54cd2c['query'][_0xcb79('0x1f')]);_0x4e8767[_0xcb79('0x1e')]=qs[_0xcb79('0x1e')](_0x54cd2c[_0xcb79('0x31')][_0xcb79('0x1e')]);}return _0x3a4cad[_0xcb79('0x4f')](_0x4e8767);}})[_0xcb79('0x27')](function(_0x86447c){if(_0x86447c){return _0x86447c?{'count':_0x413094,'rows':_0x86447c}:null;}})[_0xcb79('0x27')](respondWithResult(_0x465372,null))[_0xcb79('0x48')](handleError(_0x465372,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 7437dbd..6c88f85 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 _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 +var _0xa29c=['api','moment','bluebird','request-promise','path','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','util','../../config/logger'];(function(_0x12a27a,_0x53c1aa){var _0x409760=function(_0x16a06a){while(--_0x16a06a){_0x12a27a['push'](_0x12a27a['shift']());}};_0x409760(++_0x53c1aa);}(_0xa29c,0xb4));var _0xca29=function(_0x3c34e5,_0x1b9ef9){_0x3c34e5=_0x3c34e5-0x0;var _0x46de85=_0xa29c[_0x3c34e5];return _0x46de85;};'use strict';var _=require('lodash');var util=require(_0xca29('0x0'));var logger=require(_0xca29('0x1'))(_0xca29('0x2'));var moment=require(_0xca29('0x3'));var BPromise=require(_0xca29('0x4'));var rp=require(_0xca29('0x5'));var fs=require('fs');var path=require(_0xca29('0x6'));var rimraf=require('rimraf');var config=require(_0xca29('0x7'));var attributes=require(_0xca29('0x8'));module[_0xca29('0x9')]=function(_0x46ab8e,_0x39e091){return _0x46ab8e[_0xca29('0xa')](_0xca29('0xb'),attributes,{'tableName':_0xca29('0xc'),'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 11d8fd9..cddb908 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 _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 +var _0x1d3c=['info','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerConfiguration,\x20%s,\x20%s','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0xa63ea3,_0x4367ff){var _0x2aa5ff=function(_0x30dc84){while(--_0x30dc84){_0xa63ea3['push'](_0xa63ea3['shift']());}};_0x2aa5ff(++_0x4367ff);}(_0x1d3c,0xd8));var _0xc1d3=function(_0x4ec7f2,_0x3d92d2){_0x4ec7f2=_0x4ec7f2-0x0;var _0x118004=_0x1d3c[_0x4ec7f2];return _0x118004;};'use strict';var _=require(_0xc1d3('0x0'));var util=require(_0xc1d3('0x1'));var moment=require('moment');var BPromise=require(_0xc1d3('0x2'));var rs=require(_0xc1d3('0x3'));var fs=require('fs');var Redis=require(_0xc1d3('0x4'));var db=require(_0xc1d3('0x5'))['db'];var utils=require(_0xc1d3('0x6'));var logger=require(_0xc1d3('0x7'))(_0xc1d3('0x8'));var config=require(_0xc1d3('0x9'));var jayson=require(_0xc1d3('0xa'));var client=jayson[_0xc1d3('0xb')][_0xc1d3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x133e1c,_0x18fab2,_0x2cbfa0){return new BPromise(function(_0x38fd4c,_0x19b739){return client['request'](_0x133e1c,_0x2cbfa0)[_0xc1d3('0xd')](function(_0x21a43f){logger[_0xc1d3('0xe')]('VtigerConfiguration,\x20%s,\x20%s',_0x18fab2,_0xc1d3('0xf'));logger['debug'](_0xc1d3('0x10'),_0x18fab2,'request\x20sent',JSON[_0xc1d3('0x11')](_0x21a43f));if(_0x21a43f[_0xc1d3('0x12')]){if(_0x21a43f[_0xc1d3('0x12')][_0xc1d3('0x13')]===0x1f4){logger[_0xc1d3('0x12')](_0xc1d3('0x14'),_0x18fab2,_0x21a43f[_0xc1d3('0x12')]['message']);return _0x19b739(_0x21a43f[_0xc1d3('0x12')][_0xc1d3('0x15')]);}logger[_0xc1d3('0x12')](_0xc1d3('0x14'),_0x18fab2,_0x21a43f[_0xc1d3('0x12')]['message']);return _0x38fd4c(_0x21a43f[_0xc1d3('0x12')][_0xc1d3('0x15')]);}else{logger[_0xc1d3('0xe')](_0xc1d3('0x14'),_0x18fab2,_0xc1d3('0xf'));_0x38fd4c(_0x21a43f['result']['message']);}})[_0xc1d3('0x16')](function(_0x3cc045){logger[_0xc1d3('0x12')](_0xc1d3('0x14'),_0x18fab2,_0x3cc045);_0x19b739(_0x3cc045);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 584d029..a1a6b57 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 _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 +var _0x7656=['put','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x3f2c2e,_0x126aad){var _0x388e1a=function(_0x2b9b53){while(--_0x2b9b53){_0x3f2c2e['push'](_0x3f2c2e['shift']());}};_0x388e1a(++_0x126aad);}(_0x7656,0x108));var _0x6765=function(_0x5e94fd,_0x42d680){_0x5e94fd=_0x5e94fd-0x0;var _0x568362=_0x7656[_0x5e94fd];return _0x568362;};'use strict';var multer=require('multer');var util=require(_0x6765('0x0'));var path=require(_0x6765('0x1'));var timeout=require(_0x6765('0x2'));var express=require(_0x6765('0x3'));var router=express[_0x6765('0x4')]();var fs_extra=require(_0x6765('0x5'));var auth=require(_0x6765('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6765('0x7'));var controller=require(_0x6765('0x8'));router[_0x6765('0x9')]('/',auth[_0x6765('0xa')](),controller[_0x6765('0xb')]);router['get'](_0x6765('0xc'),auth[_0x6765('0xa')](),controller[_0x6765('0xd')]);router[_0x6765('0xe')]('/',auth['isAuthenticated'](),controller[_0x6765('0xf')]);router[_0x6765('0x10')](_0x6765('0xc'),auth['isAuthenticated'](),controller[_0x6765('0x11')]);router[_0x6765('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x6765('0x13')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index a98d1b4..113aedf 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 _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 +var _0x6150=['variable','customVariable','keyValue','picklist','STRING','ENUM','BOOLEAN','sequelize','exports','string'];(function(_0x18b56e,_0x13c6f8){var _0x88c6a0=function(_0x1eb045){while(--_0x1eb045){_0x18b56e['push'](_0x18b56e['shift']());}};_0x88c6a0(++_0x13c6f8);}(_0x6150,0x18d));var _0x0615=function(_0x420e90,_0x173b6b){_0x420e90=_0x420e90-0x0;var _0x46da6d=_0x6150[_0x420e90];return _0x46da6d;};'use strict';var Sequelize=require(_0x0615('0x0'));module[_0x0615('0x1')]={'type':{'type':Sequelize['ENUM'](_0x0615('0x2'),_0x0615('0x3'),_0x0615('0x4'),_0x0615('0x5'),_0x0615('0x6')),'defaultValue':_0x0615('0x2')},'content':{'type':Sequelize[_0x0615('0x7')]},'key':{'type':Sequelize[_0x0615('0x7')]},'keyType':{'type':Sequelize[_0x0615('0x8')](_0x0615('0x2'),_0x0615('0x3'),_0x0615('0x4'))},'keyContent':{'type':Sequelize[_0x0615('0x7')]},'idField':{'type':Sequelize[_0x0615('0x7')]},'nameField':{'type':Sequelize[_0x0615('0x7')]},'customField':{'type':Sequelize[_0x0615('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0615('0x7')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index d7b12ec..2dd3a51 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 _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 +var _0x9f5c=['filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','rows','catch','show','params','keys','intersection','includeAll','find','create','body','update','destroy','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','save','then','name','send','index','map','VtigerField','rawAttributes','fieldName','key','query'];(function(_0x4346bc,_0xfd9503){var _0x5b2097=function(_0x3d3304){while(--_0x3d3304){_0x4346bc['push'](_0x4346bc['shift']());}};_0x5b2097(++_0xfd9503);}(_0x9f5c,0x183));var _0xc9f5=function(_0x2a9852,_0x2e8fac){_0x2a9852=_0x2a9852-0x0;var _0x1ac6df=_0x9f5c[_0x2a9852];return _0x1ac6df;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc9f5('0x0'));var zipdir=require(_0xc9f5('0x1'));var jsonpatch=require(_0xc9f5('0x2'));var rp=require(_0xc9f5('0x3'));var moment=require('moment');var BPromise=require(_0xc9f5('0x4'));var Mustache=require('mustache');var util=require(_0xc9f5('0x5'));var path=require(_0xc9f5('0x6'));var sox=require(_0xc9f5('0x7'));var csv=require('to-csv');var ejs=require(_0xc9f5('0x8'));var fs=require('fs');var fs_extra=require(_0xc9f5('0x9'));var _=require(_0xc9f5('0xa'));var squel=require(_0xc9f5('0xb'));var crypto=require(_0xc9f5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc9f5('0xd'));var toCsv=require(_0xc9f5('0xe'));var querystring=require(_0xc9f5('0xf'));var Papa=require('papaparse');var Redis=require(_0xc9f5('0x10'));var authService=require(_0xc9f5('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc9f5('0x12'));var hardwareService=require(_0xc9f5('0x13'));var logger=require(_0xc9f5('0x14'))('api');var utils=require(_0xc9f5('0x15'));var config=require(_0xc9f5('0x16'));var licenseUtil=require(_0xc9f5('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x447e22,_0x704aca){_0x704aca=_0x704aca||0xcc;return function(_0x548775){if(_0x548775){return _0x447e22[_0xc9f5('0x18')](_0x704aca);}return _0x447e22[_0xc9f5('0x19')](_0x704aca)[_0xc9f5('0x1a')]();};}function respondWithResult(_0x54f41a,_0x4e040c){_0x4e040c=_0x4e040c||0xc8;return function(_0x3df53d){if(_0x3df53d){return _0x54f41a[_0xc9f5('0x19')](_0x4e040c)['json'](_0x3df53d);}};}function respondWithFilteredResult(_0x2b002f,_0x229fc1){return function(_0x1a7b50){if(_0x1a7b50){var _0x715463=typeof _0x229fc1[_0xc9f5('0x1b')]===_0xc9f5('0x1c')&&typeof _0x229fc1[_0xc9f5('0x1d')]===_0xc9f5('0x1c');var _0x2e0653=_0x1a7b50[_0xc9f5('0x1e')];var _0x52db30=_0x715463?0x0:_0x229fc1[_0xc9f5('0x1b')];var _0x20d2d2=_0x715463?_0x1a7b50[_0xc9f5('0x1e')]:_0x229fc1['offset']+_0x229fc1['limit'];var _0x303dc3;if(_0x20d2d2>=_0x2e0653){_0x20d2d2=_0x2e0653;_0x303dc3=0xc8;}else{_0x303dc3=0xce;}_0x2b002f[_0xc9f5('0x19')](_0x303dc3);return _0x2b002f[_0xc9f5('0x1f')](_0xc9f5('0x20'),_0x52db30+'-'+_0x20d2d2+'/'+_0x2e0653)['json'](_0x1a7b50);}return null;};}function patchUpdates(_0x462539){return function(_0x51df8d){try{jsonpatch[_0xc9f5('0x21')](_0x51df8d,_0x462539,!![]);}catch(_0x5f3ebf){return BPromise['reject'](_0x5f3ebf);}return _0x51df8d[_0xc9f5('0x22')]();};}function saveUpdates(_0xa66544,_0x4a19fe){return function(_0x41dc8a){if(_0x41dc8a){return _0x41dc8a['update'](_0xa66544)[_0xc9f5('0x23')](function(_0x29a455){return _0x29a455;});}return null;};}function removeEntity(_0xfce97b,_0x438d00){return function(_0x6c1eef){if(_0x6c1eef){return _0x6c1eef['destroy']()['then'](function(){_0xfce97b[_0xc9f5('0x19')](0xcc)[_0xc9f5('0x1a')]();});}};}function handleEntityNotFound(_0x336675,_0x2ec0ba){return function(_0x27df82){if(!_0x27df82){_0x336675[_0xc9f5('0x18')](0x194);}return _0x27df82;};}function handleError(_0x35e203,_0x5a3214){_0x5a3214=_0x5a3214||0x1f4;return function(_0x993afb){logger['error'](_0x993afb['stack']);if(_0x993afb[_0xc9f5('0x24')]){delete _0x993afb['name'];}_0x35e203['status'](_0x5a3214)[_0xc9f5('0x25')](_0x993afb);};}exports[_0xc9f5('0x26')]=function(_0x1899e4,_0x9c78be){var _0x5cc525={},_0x580c4c={},_0x136e62={'count':0x0,'rows':[]};var _0x54b3ee=_[_0xc9f5('0x27')](db[_0xc9f5('0x28')][_0xc9f5('0x29')],function(_0x467227){return{'name':_0x467227[_0xc9f5('0x2a')],'type':_0x467227['type'][_0xc9f5('0x2b')]};});_0x580c4c['model']=_[_0xc9f5('0x27')](_0x54b3ee,_0xc9f5('0x24'));_0x580c4c[_0xc9f5('0x2c')]=_['keys'](_0x1899e4[_0xc9f5('0x2c')]);_0x580c4c[_0xc9f5('0x2d')]=_['intersection'](_0x580c4c[_0xc9f5('0x2e')],_0x580c4c[_0xc9f5('0x2c')]);_0x5cc525[_0xc9f5('0x2f')]=_['intersection'](_0x580c4c[_0xc9f5('0x2e')],qs['fields'](_0x1899e4[_0xc9f5('0x2c')][_0xc9f5('0x30')]));_0x5cc525[_0xc9f5('0x2f')]=_0x5cc525[_0xc9f5('0x2f')][_0xc9f5('0x31')]?_0x5cc525[_0xc9f5('0x2f')]:_0x580c4c[_0xc9f5('0x2e')];if(!_0x1899e4[_0xc9f5('0x2c')][_0xc9f5('0x32')](_0xc9f5('0x33'))){_0x5cc525[_0xc9f5('0x1d')]=qs[_0xc9f5('0x1d')](_0x1899e4['query'][_0xc9f5('0x1d')]);_0x5cc525[_0xc9f5('0x1b')]=qs[_0xc9f5('0x1b')](_0x1899e4[_0xc9f5('0x2c')][_0xc9f5('0x1b')]);}_0x5cc525[_0xc9f5('0x34')]=qs['sort'](_0x1899e4[_0xc9f5('0x2c')][_0xc9f5('0x35')]);_0x5cc525[_0xc9f5('0x36')]=qs[_0xc9f5('0x2d')](_['pick'](_0x1899e4[_0xc9f5('0x2c')],_0x580c4c[_0xc9f5('0x2d')]),_0x54b3ee);if(_0x1899e4[_0xc9f5('0x2c')][_0xc9f5('0x37')]){_0x5cc525['where']=_[_0xc9f5('0x38')](_0x5cc525[_0xc9f5('0x36')],{'$or':_[_0xc9f5('0x27')](_0x54b3ee,function(_0x9c618){if(_0x9c618['type']!==_0xc9f5('0x39')){var _0x3002c1={};_0x3002c1[_0x9c618['name']]={'$like':'%'+_0x1899e4[_0xc9f5('0x2c')][_0xc9f5('0x37')]+'%'};return _0x3002c1;}})});}_0x5cc525=_[_0xc9f5('0x38')]({},_0x5cc525,_0x1899e4[_0xc9f5('0x3a')]);var _0x3d1e54={'where':_0x5cc525['where']};return db['VtigerField'][_0xc9f5('0x1e')](_0x3d1e54)[_0xc9f5('0x23')](function(_0x4bb13d){_0x136e62['count']=_0x4bb13d;if(_0x1899e4['query']['includeAll']){_0x5cc525[_0xc9f5('0x3b')]=[{'all':!![]}];}return db['VtigerField']['findAll'](_0x5cc525);})[_0xc9f5('0x23')](function(_0x341776){_0x136e62[_0xc9f5('0x3c')]=_0x341776;return _0x136e62;})[_0xc9f5('0x23')](respondWithFilteredResult(_0x9c78be,_0x5cc525))[_0xc9f5('0x3d')](handleError(_0x9c78be,null));};exports[_0xc9f5('0x3e')]=function(_0x454b6d,_0xe6eade){var _0x4719fe={'raw':!![],'where':{'id':_0x454b6d[_0xc9f5('0x3f')]['id']}},_0x3bc2f6={};_0x3bc2f6[_0xc9f5('0x2e')]=_[_0xc9f5('0x40')](db[_0xc9f5('0x28')][_0xc9f5('0x29')]);_0x3bc2f6[_0xc9f5('0x2c')]=_['keys'](_0x454b6d['query']);_0x3bc2f6[_0xc9f5('0x2d')]=_['intersection'](_0x3bc2f6[_0xc9f5('0x2e')],_0x3bc2f6[_0xc9f5('0x2c')]);_0x4719fe[_0xc9f5('0x2f')]=_[_0xc9f5('0x41')](_0x3bc2f6[_0xc9f5('0x2e')],qs['fields'](_0x454b6d[_0xc9f5('0x2c')][_0xc9f5('0x30')]));_0x4719fe[_0xc9f5('0x2f')]=_0x4719fe[_0xc9f5('0x2f')]['length']?_0x4719fe[_0xc9f5('0x2f')]:_0x3bc2f6[_0xc9f5('0x2e')];if(_0x454b6d[_0xc9f5('0x2c')][_0xc9f5('0x42')]){_0x4719fe[_0xc9f5('0x3b')]=[{'all':!![]}];}_0x4719fe=_['merge']({},_0x4719fe,_0x454b6d[_0xc9f5('0x3a')]);return db[_0xc9f5('0x28')][_0xc9f5('0x43')](_0x4719fe)[_0xc9f5('0x23')](handleEntityNotFound(_0xe6eade,null))[_0xc9f5('0x23')](respondWithResult(_0xe6eade,null))[_0xc9f5('0x3d')](handleError(_0xe6eade,null));};exports[_0xc9f5('0x44')]=function(_0x1370db,_0xba6df1){return db[_0xc9f5('0x28')][_0xc9f5('0x44')](_0x1370db[_0xc9f5('0x45')],{})[_0xc9f5('0x23')](respondWithResult(_0xba6df1,0xc9))[_0xc9f5('0x3d')](handleError(_0xba6df1,null));};exports[_0xc9f5('0x46')]=function(_0x57c817,_0x7e54f8){if(_0x57c817['body']['id']){delete _0x57c817[_0xc9f5('0x45')]['id'];}return db['VtigerField'][_0xc9f5('0x43')]({'where':{'id':_0x57c817[_0xc9f5('0x3f')]['id']}})['then'](handleEntityNotFound(_0x7e54f8,null))['then'](saveUpdates(_0x57c817[_0xc9f5('0x45')],null))[_0xc9f5('0x23')](respondWithResult(_0x7e54f8,null))[_0xc9f5('0x3d')](handleError(_0x7e54f8,null));};exports[_0xc9f5('0x47')]=function(_0x33c285,_0x495446){return db[_0xc9f5('0x28')]['find']({'where':{'id':_0x33c285['params']['id']}})[_0xc9f5('0x23')](handleEntityNotFound(_0x495446,null))['then'](removeEntity(_0x495446,null))[_0xc9f5('0x3d')](handleError(_0x495446,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index a5f62de..17695b3 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 _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 +var _0xb0a1=['./intVtigerField.attributes','VtigerField','vtiger_unique_index','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0xb0a1,0x86));var _0x1b0a=function(_0x4361c1,_0x175703){_0x4361c1=_0x4361c1-0x0;var _0x7d47bd=_0xb0a1[_0x4361c1];return _0x7d47bd;};'use strict';var _=require('lodash');var util=require(_0x1b0a('0x0'));var logger=require(_0x1b0a('0x1'))(_0x1b0a('0x2'));var moment=require(_0x1b0a('0x3'));var BPromise=require(_0x1b0a('0x4'));var rp=require(_0x1b0a('0x5'));var fs=require('fs');var path=require(_0x1b0a('0x6'));var rimraf=require(_0x1b0a('0x7'));var config=require(_0x1b0a('0x8'));var attributes=require(_0x1b0a('0x9'));module['exports']=function(_0x30a678,_0x246f72){return _0x30a678['define'](_0x1b0a('0xa'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x1b0a('0xb'),'fields':['idField',_0x1b0a('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 0241f8b..c020953 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 _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 +var _0xa596=['http','then','VtigerField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0xa596,0x1cc));var _0x6a59=function(_0x329133,_0x1d728e){_0x329133=_0x329133-0x0;var _0x351392=_0xa596[_0x329133];return _0x351392;};'use strict';var _=require('lodash');var util=require(_0x6a59('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6a59('0x1'));var fs=require('fs');var Redis=require(_0x6a59('0x2'));var db=require(_0x6a59('0x3'))['db'];var utils=require(_0x6a59('0x4'));var logger=require(_0x6a59('0x5'))(_0x6a59('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6a59('0x7')][_0x6a59('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5c4d11,_0x1bd269,_0x518274){return new BPromise(function(_0x15ed31,_0x3f170c){return client['request'](_0x5c4d11,_0x518274)[_0x6a59('0x9')](function(_0x595eb0){logger['info'](_0x6a59('0xa'),_0x1bd269,'request\x20sent');logger[_0x6a59('0xb')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x1bd269,_0x6a59('0xc'),JSON[_0x6a59('0xd')](_0x595eb0));if(_0x595eb0[_0x6a59('0xe')]){if(_0x595eb0[_0x6a59('0xe')][_0x6a59('0xf')]===0x1f4){logger[_0x6a59('0xe')](_0x6a59('0xa'),_0x1bd269,_0x595eb0[_0x6a59('0xe')][_0x6a59('0x10')]);return _0x3f170c(_0x595eb0[_0x6a59('0xe')][_0x6a59('0x10')]);}logger[_0x6a59('0xe')](_0x6a59('0xa'),_0x1bd269,_0x595eb0[_0x6a59('0xe')]['message']);return _0x15ed31(_0x595eb0[_0x6a59('0xe')][_0x6a59('0x10')]);}else{logger[_0x6a59('0x11')]('VtigerField,\x20%s,\x20%s',_0x1bd269,_0x6a59('0xc'));_0x15ed31(_0x595eb0['result'][_0x6a59('0x10')]);}})['catch'](function(_0x142b8b){logger[_0x6a59('0xe')]('VtigerField,\x20%s,\x20%s',_0x1bd269,_0x142b8b);_0x3f170c(_0x142b8b);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index e079201..d4174af 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 _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 +var _0x266d=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','update','exports','multer','util'];(function(_0x128450,_0x5869ba){var _0x4d80ed=function(_0x4a2da3){while(--_0x4a2da3){_0x128450['push'](_0x128450['shift']());}};_0x4d80ed(++_0x5869ba);}(_0x266d,0xb6));var _0xd266=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x266d[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xd266('0x0'));var util=require(_0xd266('0x1'));var path=require(_0xd266('0x2'));var timeout=require(_0xd266('0x3'));var express=require('express');var router=express[_0xd266('0x4')]();var fs_extra=require(_0xd266('0x5'));var auth=require(_0xd266('0x6'));var interaction=require(_0xd266('0x7'));var config=require(_0xd266('0x8'));var controller=require('./intZendeskAccount.controller');router['get']('/',auth[_0xd266('0x9')](),controller[_0xd266('0xa')]);router[_0xd266('0xb')](_0xd266('0xc'),auth[_0xd266('0x9')](),controller[_0xd266('0xd')]);router[_0xd266('0xb')](_0xd266('0xe'),auth[_0xd266('0x9')](),controller[_0xd266('0xf')]);router[_0xd266('0xb')](_0xd266('0x10'),auth[_0xd266('0x9')](),controller[_0xd266('0x11')]);router[_0xd266('0x12')]('/',auth[_0xd266('0x9')](),controller[_0xd266('0x13')]);router[_0xd266('0x12')](_0xd266('0xe'),auth[_0xd266('0x9')](),controller[_0xd266('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xd266('0x15')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xd266('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 6307ad2..1dfff61 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 _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 +var _0xa76e=['ENUM','integrationTab','exports','STRING','username','remoteUri','password'];(function(_0x33f83b,_0x2476ea){var _0x33949b=function(_0x231108){while(--_0x231108){_0x33f83b['push'](_0x33f83b['shift']());}};_0x33949b(++_0x2476ea);}(_0xa76e,0xfe));var _0xea76=function(_0x587ba2,_0x42eb40){_0x587ba2=_0x587ba2-0x0;var _0x50ec73=_0xa76e[_0x587ba2];return _0x50ec73;};'use strict';var Sequelize=require('sequelize');module[_0xea76('0x0')]={'name':{'type':Sequelize[_0xea76('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0xea76('0x2')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xea76('0x1')]},'remoteUri':{'type':Sequelize[_0xea76('0x1')],'unique':_0xea76('0x3')},'authType':{'type':Sequelize['ENUM'](_0xea76('0x4'),'token'),'defaultValue':_0xea76('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xea76('0x5')](_0xea76('0x6'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 23cee1f..a8bbc6e 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 _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 +var _0xd8b0=['ZendeskAccount','includeAll','include','findAll','rows','catch','params','keys','find','create','body','ZendeskConfiguration','options','getConfigurations','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','findOne','username','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','headers','Basic\x20%s','toString','base64','%s/token:%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','position','system_field_options','custom_field_options','test','statusCode','error','stringify','Wrong\x20credentials','eml-format','rimraf','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','reject','update','then','destroy','name','send','map','rawAttributes','fieldName','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL'];(function(_0x4dc7b9,_0x319d5a){var _0x3ab114=function(_0x51a9df){while(--_0x51a9df){_0x4dc7b9['push'](_0x4dc7b9['shift']());}};_0x3ab114(++_0x319d5a);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x0d8b('0x0'));var rimraf=require(_0x0d8b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0d8b('0x2'));var BPromise=require(_0x0d8b('0x3'));var Mustache=require(_0x0d8b('0x4'));var util=require(_0x0d8b('0x5'));var path=require(_0x0d8b('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0d8b('0x7'));var fs=require('fs');var fs_extra=require(_0x0d8b('0x8'));var _=require(_0x0d8b('0x9'));var squel=require('squel');var crypto=require(_0x0d8b('0xa'));var jsforce=require(_0x0d8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d8b('0xc'));var querystring=require(_0x0d8b('0xd'));var Papa=require(_0x0d8b('0xe'));var Redis=require(_0x0d8b('0xf'));var authService=require(_0x0d8b('0x10'));var qs=require(_0x0d8b('0x11'));var as=require(_0x0d8b('0x12'));var hardwareService=require(_0x0d8b('0x13'));var logger=require('../../config/logger')(_0x0d8b('0x14'));var utils=require('../../config/utils');var config=require(_0x0d8b('0x15'));var licenseUtil=require(_0x0d8b('0x16'));var db=require(_0x0d8b('0x17'))['db'];var integrations=require(_0x0d8b('0x18'));function respondWithStatusCode(_0x35a07b,_0x32bb1a){_0x32bb1a=_0x32bb1a||0xcc;return function(_0x15dd0f){if(_0x15dd0f){return _0x35a07b[_0x0d8b('0x19')](_0x32bb1a);}return _0x35a07b[_0x0d8b('0x1a')](_0x32bb1a)[_0x0d8b('0x1b')]();};}function respondWithResult(_0x5ad086,_0xe65334){_0xe65334=_0xe65334||0xc8;return function(_0x1567ce){if(_0x1567ce){return _0x5ad086[_0x0d8b('0x1a')](_0xe65334)['json'](_0x1567ce);}};}function respondWithFilteredResult(_0x23eb7b,_0xa86349){return function(_0x17f7df){if(_0x17f7df){var _0xe2e167=typeof _0xa86349[_0x0d8b('0x1c')]==='undefined'&&typeof _0xa86349[_0x0d8b('0x1d')]===_0x0d8b('0x1e');var _0x2fd0fc=_0x17f7df[_0x0d8b('0x1f')];var _0x333674=_0xe2e167?0x0:_0xa86349[_0x0d8b('0x1c')];var _0x264b39=_0xe2e167?_0x17f7df[_0x0d8b('0x1f')]:_0xa86349['offset']+_0xa86349[_0x0d8b('0x1d')];var _0x23d58f;if(_0x264b39>=_0x2fd0fc){_0x264b39=_0x2fd0fc;_0x23d58f=0xc8;}else{_0x23d58f=0xce;}_0x23eb7b[_0x0d8b('0x1a')](_0x23d58f);return _0x23eb7b[_0x0d8b('0x20')](_0x0d8b('0x21'),_0x333674+'-'+_0x264b39+'/'+_0x2fd0fc)[_0x0d8b('0x22')](_0x17f7df);}return null;};}function patchUpdates(_0x393beb){return function(_0x352c17){try{jsonpatch['apply'](_0x352c17,_0x393beb,!![]);}catch(_0x4f0a1a){return BPromise[_0x0d8b('0x23')](_0x4f0a1a);}return _0x352c17['save']();};}function saveUpdates(_0x56c729,_0x5527d8){return function(_0x238728){if(_0x238728){return _0x238728[_0x0d8b('0x24')](_0x56c729)[_0x0d8b('0x25')](function(_0x38efc8){return _0x38efc8;});}return null;};}function removeEntity(_0x221071,_0x2c64e2){return function(_0x30980c){if(_0x30980c){return _0x30980c[_0x0d8b('0x26')]()[_0x0d8b('0x25')](function(){_0x221071['status'](0xcc)[_0x0d8b('0x1b')]();});}};}function handleEntityNotFound(_0x4463ee,_0x5363e3){return function(_0xe1ef20){if(!_0xe1ef20){_0x4463ee['sendStatus'](0x194);}return _0xe1ef20;};}function handleError(_0x3dd149,_0x234bdd){_0x234bdd=_0x234bdd||0x1f4;return function(_0xa2af02){logger['error'](_0xa2af02['stack']);if(_0xa2af02[_0x0d8b('0x27')]){delete _0xa2af02[_0x0d8b('0x27')];}_0x3dd149['status'](_0x234bdd)[_0x0d8b('0x28')](_0xa2af02);};}exports['index']=function(_0x1b2b59,_0x4b59e5){var _0x97050a={},_0x48f24f={},_0x2ab00d={'count':0x0,'rows':[]};var _0x546bf6=_[_0x0d8b('0x29')](db['ZendeskAccount'][_0x0d8b('0x2a')],function(_0x106e4c){return{'name':_0x106e4c[_0x0d8b('0x2b')],'type':_0x106e4c['type']['key']};});_0x48f24f['model']=_[_0x0d8b('0x29')](_0x546bf6,'name');_0x48f24f[_0x0d8b('0x2c')]=_['keys'](_0x1b2b59['query']);_0x48f24f[_0x0d8b('0x2d')]=_[_0x0d8b('0x2e')](_0x48f24f[_0x0d8b('0x2f')],_0x48f24f[_0x0d8b('0x2c')]);_0x97050a[_0x0d8b('0x30')]=_[_0x0d8b('0x2e')](_0x48f24f[_0x0d8b('0x2f')],qs[_0x0d8b('0x31')](_0x1b2b59['query'][_0x0d8b('0x31')]));_0x97050a[_0x0d8b('0x30')]=_0x97050a['attributes'][_0x0d8b('0x32')]?_0x97050a[_0x0d8b('0x30')]:_0x48f24f[_0x0d8b('0x2f')];if(!_0x1b2b59['query'][_0x0d8b('0x33')](_0x0d8b('0x34'))){_0x97050a[_0x0d8b('0x1d')]=qs[_0x0d8b('0x1d')](_0x1b2b59[_0x0d8b('0x2c')]['limit']);_0x97050a[_0x0d8b('0x1c')]=qs[_0x0d8b('0x1c')](_0x1b2b59['query'][_0x0d8b('0x1c')]);}_0x97050a[_0x0d8b('0x35')]=qs[_0x0d8b('0x36')](_0x1b2b59[_0x0d8b('0x2c')][_0x0d8b('0x36')]);_0x97050a['where']=qs['filters'](_[_0x0d8b('0x37')](_0x1b2b59['query'],_0x48f24f['filters']),_0x546bf6);if(_0x1b2b59[_0x0d8b('0x2c')][_0x0d8b('0x38')]){_0x97050a[_0x0d8b('0x39')]=_[_0x0d8b('0x3a')](_0x97050a[_0x0d8b('0x39')],{'$or':_[_0x0d8b('0x29')](_0x546bf6,function(_0x579324){if(_0x579324[_0x0d8b('0x3b')]!==_0x0d8b('0x3c')){var _0x28fd82={};_0x28fd82[_0x579324[_0x0d8b('0x27')]]={'$like':'%'+_0x1b2b59[_0x0d8b('0x2c')][_0x0d8b('0x38')]+'%'};return _0x28fd82;}})});}_0x97050a=_[_0x0d8b('0x3a')]({},_0x97050a,_0x1b2b59['options']);var _0x1d06b6={'where':_0x97050a[_0x0d8b('0x39')]};return db[_0x0d8b('0x3d')][_0x0d8b('0x1f')](_0x1d06b6)['then'](function(_0xe0bf42){_0x2ab00d['count']=_0xe0bf42;if(_0x1b2b59[_0x0d8b('0x2c')][_0x0d8b('0x3e')]){_0x97050a[_0x0d8b('0x3f')]=[{'all':!![]}];}return db[_0x0d8b('0x3d')][_0x0d8b('0x40')](_0x97050a);})[_0x0d8b('0x25')](function(_0x1ff17d){_0x2ab00d[_0x0d8b('0x41')]=_0x1ff17d;return _0x2ab00d;})[_0x0d8b('0x25')](respondWithFilteredResult(_0x4b59e5,_0x97050a))[_0x0d8b('0x42')](handleError(_0x4b59e5,null));};exports['show']=function(_0x571acf,_0x576050){var _0x4d0811={'raw':![],'where':{'id':_0x571acf[_0x0d8b('0x43')]['id']}},_0x524d79={};_0x524d79[_0x0d8b('0x2f')]=_[_0x0d8b('0x44')](db['ZendeskAccount']['rawAttributes']);_0x524d79[_0x0d8b('0x2c')]=_[_0x0d8b('0x44')](_0x571acf[_0x0d8b('0x2c')]);_0x524d79['filters']=_[_0x0d8b('0x2e')](_0x524d79[_0x0d8b('0x2f')],_0x524d79['query']);_0x4d0811['attributes']=_[_0x0d8b('0x2e')](_0x524d79['model'],qs[_0x0d8b('0x31')](_0x571acf['query']['fields']));_0x4d0811[_0x0d8b('0x30')]=_0x4d0811[_0x0d8b('0x30')]['length']?_0x4d0811['attributes']:_0x524d79['model'];if(_0x571acf['query'][_0x0d8b('0x3e')]){_0x4d0811[_0x0d8b('0x3f')]=[{'all':!![]}];}_0x4d0811=_[_0x0d8b('0x3a')]({},_0x4d0811,_0x571acf['options']);return db[_0x0d8b('0x3d')][_0x0d8b('0x45')](_0x4d0811)[_0x0d8b('0x25')](handleEntityNotFound(_0x576050,null))[_0x0d8b('0x25')](respondWithResult(_0x576050,null))[_0x0d8b('0x42')](handleError(_0x576050,null));};exports[_0x0d8b('0x46')]=function(_0x11d22b,_0x1d5067){return db[_0x0d8b('0x3d')][_0x0d8b('0x46')](_0x11d22b[_0x0d8b('0x47')],{})[_0x0d8b('0x25')](respondWithResult(_0x1d5067,0xc9))[_0x0d8b('0x42')](handleError(_0x1d5067,null));};exports[_0x0d8b('0x24')]=function(_0x570af8,_0xdfcf32){if(_0x570af8[_0x0d8b('0x47')]['id']){delete _0x570af8[_0x0d8b('0x47')]['id'];}return db[_0x0d8b('0x3d')]['find']({'where':{'id':_0x570af8[_0x0d8b('0x43')]['id']}})['then'](handleEntityNotFound(_0xdfcf32,null))['then'](saveUpdates(_0x570af8[_0x0d8b('0x47')],null))[_0x0d8b('0x25')](respondWithResult(_0xdfcf32,null))[_0x0d8b('0x42')](handleError(_0xdfcf32,null));};exports[_0x0d8b('0x26')]=function(_0x505d22,_0x131579){return db[_0x0d8b('0x3d')][_0x0d8b('0x45')]({'where':{'id':_0x505d22[_0x0d8b('0x43')]['id']}})[_0x0d8b('0x25')](handleEntityNotFound(_0x131579,null))['then'](removeEntity(_0x131579,null))['catch'](handleError(_0x131579,null));};exports['getConfigurations']=function(_0x573f4f,_0x368ede,_0xf22c3c){var _0x5e3bb4={};var _0x4950a8={};var _0x44c5c1;var _0x3d3cb6;return db['ZendeskAccount']['findOne']({'where':{'id':_0x573f4f[_0x0d8b('0x43')]['id']}})[_0x0d8b('0x25')](handleEntityNotFound(_0x368ede,null))[_0x0d8b('0x25')](function(_0x346c0d){if(_0x346c0d){_0x44c5c1=_0x346c0d;_0x4950a8[_0x0d8b('0x2f')]=_['keys'](db[_0x0d8b('0x48')][_0x0d8b('0x2a')]);_0x4950a8['query']=_['keys'](_0x573f4f[_0x0d8b('0x2c')]);_0x4950a8[_0x0d8b('0x2d')]=_['intersection'](_0x4950a8['model'],_0x4950a8[_0x0d8b('0x2c')]);_0x5e3bb4[_0x0d8b('0x30')]=_[_0x0d8b('0x2e')](_0x4950a8[_0x0d8b('0x2f')],qs['fields'](_0x573f4f[_0x0d8b('0x2c')]['fields']));_0x5e3bb4['attributes']=_0x5e3bb4[_0x0d8b('0x30')][_0x0d8b('0x32')]?_0x5e3bb4['attributes']:_0x4950a8['model'];_0x5e3bb4[_0x0d8b('0x35')]=qs[_0x0d8b('0x36')](_0x573f4f[_0x0d8b('0x2c')][_0x0d8b('0x36')]);_0x5e3bb4[_0x0d8b('0x39')]=qs[_0x0d8b('0x2d')](_[_0x0d8b('0x37')](_0x573f4f[_0x0d8b('0x2c')],_0x4950a8['filters']));if(_0x573f4f[_0x0d8b('0x2c')][_0x0d8b('0x38')]){_0x5e3bb4[_0x0d8b('0x39')]=_[_0x0d8b('0x3a')](_0x5e3bb4[_0x0d8b('0x39')],{'$or':_[_0x0d8b('0x29')](_0x5e3bb4[_0x0d8b('0x30')],function(_0x1c78b6){var _0x375684={};_0x375684[_0x1c78b6]={'$like':'%'+_0x573f4f['query'][_0x0d8b('0x38')]+'%'};return _0x375684;})});}_0x5e3bb4=_[_0x0d8b('0x3a')]({},_0x5e3bb4,_0x573f4f[_0x0d8b('0x49')]);return _0x44c5c1[_0x0d8b('0x4a')](_0x5e3bb4);}})[_0x0d8b('0x25')](function(_0x577951){if(_0x577951){_0x3d3cb6=_0x577951[_0x0d8b('0x32')];if(!_0x573f4f[_0x0d8b('0x2c')][_0x0d8b('0x33')](_0x0d8b('0x34'))){_0x5e3bb4[_0x0d8b('0x1d')]=qs['limit'](_0x573f4f['query'][_0x0d8b('0x1d')]);_0x5e3bb4[_0x0d8b('0x1c')]=qs[_0x0d8b('0x1c')](_0x573f4f[_0x0d8b('0x2c')]['offset']);}return _0x44c5c1[_0x0d8b('0x4a')](_0x5e3bb4);}})[_0x0d8b('0x25')](function(_0x8c0bbe){if(_0x8c0bbe){return _0x8c0bbe?{'count':_0x3d3cb6,'rows':_0x8c0bbe}:null;}})['then'](respondWithResult(_0x368ede,null))[_0x0d8b('0x42')](handleError(_0x368ede,null));};exports['addConfiguration']=function(_0x2fce07,_0x3ed63e,_0x1efce6){if(_0x2fce07[_0x0d8b('0x47')]['id']){delete _0x2fce07[_0x0d8b('0x47')]['id'];}return db[_0x0d8b('0x3d')]['findOne']({'where':{'id':_0x2fce07[_0x0d8b('0x43')]['id']}})['then'](handleEntityNotFound(_0x3ed63e,null))[_0x0d8b('0x25')](function(_0x4577c8){if(_0x4577c8){_0x2fce07[_0x0d8b('0x47')][_0x0d8b('0x4b')]=_0x4577c8['id'];_0x2fce07['body'][_0x0d8b('0x4c')]=integrations[_0x0d8b('0x4d')](_0x2fce07[_0x0d8b('0x47')][_0x0d8b('0x4e')],_0x2fce07[_0x0d8b('0x47')][_0x0d8b('0x3b')]);_0x2fce07[_0x0d8b('0x47')][_0x0d8b('0x4f')]=integrations[_0x0d8b('0x50')](_0x2fce07[_0x0d8b('0x47')]['channel'],_0x2fce07['body'][_0x0d8b('0x3b')]);return db[_0x0d8b('0x48')]['create'](_0x2fce07[_0x0d8b('0x47')],{'include':[{'model':db['ZendeskField'],'as':'Subjects'},{'model':db[_0x0d8b('0x51')],'as':_0x0d8b('0x4f')}]});}return null;})['then'](respondWithResult(_0x3ed63e,null))['catch'](handleError(_0x3ed63e,null));};exports[_0x0d8b('0x52')]=function(_0x1c007b,_0x70e4b2,_0x435090){var _0x2ab72b='';return db[_0x0d8b('0x3d')][_0x0d8b('0x53')]({'where':{'id':_0x1c007b['params']['id']},'attributes':['id',_0x0d8b('0x54'),'password',_0x0d8b('0x55'),_0x0d8b('0x56'),_0x0d8b('0x57')]})[_0x0d8b('0x25')](handleEntityNotFound(_0x70e4b2,null))['then'](function(_0x3fe47d){if(_0x3fe47d){_0x2ab72b=_0x3fe47d['remoteUri'];var _0x3a356b=_0x2ab72b[_0x0d8b('0x58')](-0x1);if(_0x3a356b==='/'){_0x2ab72b=_0x2ab72b[_0x0d8b('0x59')](0x0,_0x2ab72b[_0x0d8b('0x5a')](_0x3a356b));}var _0xc5c35f={'method':_0x0d8b('0x5b'),'uri':util[_0x0d8b('0x5c')](_0x0d8b('0x5d'),_0x2ab72b,_0x0d8b('0x5e')),'json':!![]};switch(_0x3fe47d[_0x0d8b('0x56')]){case'password':_0xc5c35f[_0x0d8b('0x5f')]={'Authorization':util['format'](_0x0d8b('0x60'),new Buffer(util[_0x0d8b('0x5c')]('%s:%s',_0x3fe47d[_0x0d8b('0x54')],_0x3fe47d['password']))[_0x0d8b('0x61')](_0x0d8b('0x62')))};break;case _0x0d8b('0x55'):_0xc5c35f[_0x0d8b('0x5f')]={'Authorization':util[_0x0d8b('0x5c')](_0x0d8b('0x60'),new Buffer(util[_0x0d8b('0x5c')](_0x0d8b('0x63'),_0x3fe47d['username'],_0x3fe47d[_0x0d8b('0x55')]))[_0x0d8b('0x61')]('base64'))};break;default:throw new db[(_0x0d8b('0x64'))][(_0x0d8b('0x65'))](_0x0d8b('0x66'));}return rp(_0xc5c35f);}})[_0x0d8b('0x25')](function(_0x16141a){if(_0x16141a){var _0x9e44b4=[_0x0d8b('0x67'),_0x0d8b('0x68'),_0x0d8b('0x69'),_0x0d8b('0x6a')];_[_0x0d8b('0x6b')](_0x16141a[_0x0d8b('0x5e')],function(_0x50c0ff){return _0x9e44b4[_0x0d8b('0x6c')](_0x50c0ff[_0x0d8b('0x3b')]);});return{'count':_0x16141a[_0x0d8b('0x5e')]['length'],'rows':_['map'](_0x16141a[_0x0d8b('0x5e')],function(_0x3aeb45){return{'id':_0x3aeb45['id'],'name':_0x3aeb45[_0x0d8b('0x6d')]>0x7?_0x3aeb45['title']:_0x3aeb45['type'],'custom':_0x3aeb45[_0x0d8b('0x6d')]>0x7?!![]:![],'options':_0x3aeb45[_0x0d8b('0x6e')]?_0x3aeb45[_0x0d8b('0x6e')]:_0x3aeb45[_0x0d8b('0x6f')]?_0x3aeb45[_0x0d8b('0x6f')]:[]};})};}})[_0x0d8b('0x25')](respondWithResult(_0x70e4b2,null))[_0x0d8b('0x42')](function(_0x2c826b){var _0x20a3dd=_0x1c007b[_0x0d8b('0x2c')][_0x0d8b('0x70')]?0x1f4:_0x2c826b[_0x0d8b('0x71')]||0x1f4;logger[_0x0d8b('0x72')]('getFields,\x20%s,\x20%s,\x20%s',_0x0d8b('0x52'),_0x20a3dd,JSON[_0x0d8b('0x73')](_0x2c826b));delete _0x2c826b['name'];if(_0x20a3dd===0x191){_0x20a3dd=0x190;}_0x70e4b2['status'](_0x20a3dd)[_0x0d8b('0x28')](_0x1c007b[_0x0d8b('0x2c')][_0x0d8b('0x70')]?{'message':_0x0d8b('0x74'),'statusCode':_0x2c826b[_0x0d8b('0x71')]}:_0x2c826b);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index a03d211..55644ec 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 _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 +var _0x2e22=['rimraf','./intZendeskAccount.attributes','ZendeskAccount','int_zendesk_accounts','lodash','api','moment','bluebird','request-promise'];(function(_0x43d1af,_0x5c05e0){var _0x56cc3d=function(_0x4dca80){while(--_0x4dca80){_0x43d1af['push'](_0x43d1af['shift']());}};_0x56cc3d(++_0x5c05e0);}(_0x2e22,0x199));var _0x22e2=function(_0x37a505,_0x319129){_0x37a505=_0x37a505-0x0;var _0x5d094e=_0x2e22[_0x37a505];return _0x5d094e;};'use strict';var _=require(_0x22e2('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x22e2('0x1'));var moment=require(_0x22e2('0x2'));var BPromise=require(_0x22e2('0x3'));var rp=require(_0x22e2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x22e2('0x5'));var config=require('../../config/environment');var attributes=require(_0x22e2('0x6'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x1b31b5,_0x419e5d){return _0x1b31b5['define'](_0x22e2('0x7'),attributes,{'tableName':_0x22e2('0x8'),'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 122024d..01a76bf 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 _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 +var _0x00b7=['ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','options','raw','include','map','model','attributes','GetZendeskAccount','ShowZendeskAccount','ZendeskAccount','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then','info','ZendeskAccount,\x20%s,\x20%s','debug'];(function(_0x4c2585,_0x1da407){var _0x37357f=function(_0x387cdc){while(--_0x387cdc){_0x4c2585['push'](_0x4c2585['shift']());}};_0x37357f(++_0x1da407);}(_0x00b7,0x13c));var _0x700b=function(_0x5c83cf,_0x2ddf72){_0x5c83cf=_0x5c83cf-0x0;var _0x5e7fd1=_0x00b7[_0x5c83cf];return _0x5e7fd1;};'use strict';var _=require(_0x700b('0x0'));var util=require('util');var moment=require(_0x700b('0x1'));var BPromise=require(_0x700b('0x2'));var rs=require(_0x700b('0x3'));var fs=require('fs');var Redis=require(_0x700b('0x4'));var db=require(_0x700b('0x5'))['db'];var utils=require(_0x700b('0x6'));var logger=require(_0x700b('0x7'))(_0x700b('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x700b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c27a5,_0x2425d8,_0x2bb6af){return new BPromise(function(_0x3b74b0,_0x43b7df){return client['request'](_0x4c27a5,_0x2bb6af)[_0x700b('0xa')](function(_0xc11f7c){logger[_0x700b('0xb')](_0x700b('0xc'),_0x2425d8,'request\x20sent');logger[_0x700b('0xd')](_0x700b('0xe'),_0x2425d8,_0x700b('0xf'),JSON[_0x700b('0x10')](_0xc11f7c));if(_0xc11f7c[_0x700b('0x11')]){if(_0xc11f7c[_0x700b('0x11')][_0x700b('0x12')]===0x1f4){logger[_0x700b('0x11')](_0x700b('0xc'),_0x2425d8,_0xc11f7c['error'][_0x700b('0x13')]);return _0x43b7df(_0xc11f7c['error'][_0x700b('0x13')]);}logger['error'](_0x700b('0xc'),_0x2425d8,_0xc11f7c[_0x700b('0x11')]['message']);return _0x3b74b0(_0xc11f7c['error'][_0x700b('0x13')]);}else{logger[_0x700b('0xb')]('ZendeskAccount,\x20%s,\x20%s',_0x2425d8,_0x700b('0xf'));_0x3b74b0(_0xc11f7c['result'][_0x700b('0x13')]);}})[_0x700b('0x14')](function(_0x26948f){logger['error'](_0x700b('0xc'),_0x2425d8,_0x26948f);_0x43b7df(_0x26948f);});});}exports['GetZendeskAccount']=function(_0x422b1a){var _0x31654f=this;return new Promise(function(_0x3cc614,_0x1de27f){return db['ZendeskAccount']['findAll']({'raw':_0x422b1a[_0x700b('0x15')]?_0x422b1a['options'][_0x700b('0x16')]===undefined?!![]:![]:!![],'where':_0x422b1a[_0x700b('0x15')]?_0x422b1a[_0x700b('0x15')]['where']||null:null,'attributes':_0x422b1a[_0x700b('0x15')]?_0x422b1a[_0x700b('0x15')]['attributes']||null:null,'limit':_0x422b1a[_0x700b('0x15')]?_0x422b1a[_0x700b('0x15')]['limit']||null:null,'include':_0x422b1a['options']?_0x422b1a['options'][_0x700b('0x17')]?_[_0x700b('0x18')](_0x422b1a[_0x700b('0x15')][_0x700b('0x17')],function(_0x5f2d86){return{'model':db[_0x5f2d86[_0x700b('0x19')]],'as':_0x5f2d86['as'],'attributes':_0x5f2d86[_0x700b('0x1a')],'include':_0x5f2d86[_0x700b('0x17')]?_['map'](_0x5f2d86['include'],function(_0x27a49d){return{'model':db[_0x27a49d[_0x700b('0x19')]],'as':_0x27a49d['as'],'attributes':_0x27a49d['attributes'],'include':_0x27a49d[_0x700b('0x17')]?_['map'](_0x27a49d[_0x700b('0x17')],function(_0x5cfefe){return{'model':db[_0x5cfefe[_0x700b('0x19')]],'as':_0x5cfefe['as'],'attributes':_0x5cfefe['attributes']};}):[]};}):[]};}):[]:[]})[_0x700b('0xa')](function(_0x9c5ec6){logger[_0x700b('0xb')](_0x700b('0x1b'),_0x422b1a);logger[_0x700b('0xd')]('GetZendeskAccount',_0x422b1a,JSON[_0x700b('0x10')](_0x9c5ec6));_0x3cc614(_0x9c5ec6);})[_0x700b('0x14')](function(_0x50f11e){logger['error'](_0x700b('0x1b'),_0x50f11e[_0x700b('0x13')],_0x422b1a);_0x1de27f(_0x31654f[_0x700b('0x11')](0x1f4,_0x50f11e['message']));});});};exports[_0x700b('0x1c')]=function(_0x2d5c67){var _0x5c7a30=this;return new Promise(function(_0x2a8ec4,_0x9949df){return db[_0x700b('0x1d')]['find']({'raw':_0x2d5c67[_0x700b('0x15')]?_0x2d5c67[_0x700b('0x15')][_0x700b('0x16')]===undefined?!![]:![]:!![],'where':_0x2d5c67[_0x700b('0x15')]?_0x2d5c67[_0x700b('0x15')]['where']||null:null,'attributes':_0x2d5c67[_0x700b('0x15')]?_0x2d5c67[_0x700b('0x15')]['attributes']||null:null,'include':_0x2d5c67[_0x700b('0x15')]?_0x2d5c67[_0x700b('0x15')][_0x700b('0x17')]?_[_0x700b('0x18')](_0x2d5c67['options'][_0x700b('0x17')],function(_0x118a89){return{'model':db[_0x118a89[_0x700b('0x19')]],'as':_0x118a89['as'],'attributes':_0x118a89[_0x700b('0x1a')],'include':_0x118a89[_0x700b('0x17')]?_[_0x700b('0x18')](_0x118a89[_0x700b('0x17')],function(_0xe64392){return{'model':db[_0xe64392[_0x700b('0x19')]],'as':_0xe64392['as'],'attributes':_0xe64392[_0x700b('0x1a')],'include':_0xe64392[_0x700b('0x17')]?_[_0x700b('0x18')](_0xe64392[_0x700b('0x17')],function(_0x109562){return{'model':db[_0x109562[_0x700b('0x19')]],'as':_0x109562['as'],'attributes':_0x109562[_0x700b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x700b('0xa')](function(_0x39bd28){logger[_0x700b('0xb')](_0x700b('0x1c'),_0x2d5c67);logger[_0x700b('0xd')]('ShowZendeskAccount',_0x2d5c67,JSON[_0x700b('0x10')](_0x39bd28));_0x2a8ec4(_0x39bd28);})[_0x700b('0x14')](function(_0x2085fa){logger[_0x700b('0x11')](_0x700b('0x1c'),_0x2085fa['message'],_0x2d5c67);_0x9949df(_0x5c7a30[_0x700b('0x11')](0x1f4,_0x2085fa[_0x700b('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 255d4e4..b468290 100644 --- a/server/api/intZendeskConfiguration/index.js +++ b/server/api/intZendeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5c00=['path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','getFields','/:id/subjects','getSubjects','/:id/tags','post','create','setTags','put','/:id','delete','destroy','exports','multer','util'];(function(_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 +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(_0x32feef,_0x1a551f){var _0x473315=function(_0x4eee7b){while(--_0x4eee7b){_0x32feef['push'](_0x32feef['shift']());}};_0x473315(++_0x1a551f);}(_0x5c00,0x17e));var _0x05c0=function(_0x2ed1ad,_0x1fb8a1){_0x2ed1ad=_0x2ed1ad-0x0;var _0x1deb5e=_0x5c00[_0x2ed1ad];return _0x1deb5e;};'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 cb447f1..9d9464f 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 _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 +var _0x07e2=['exports','STRING'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x07e2,0x19e));var _0x207e=function(_0x3904e9,_0x1c0782){_0x3904e9=_0x3904e9-0x0;var _0x1ba0e0=_0x07e2[_0x3904e9];return _0x1ba0e0;};'use strict';var Sequelize=require('sequelize');module[_0x207e('0x0')]={'name':{'type':Sequelize[_0x207e('0x1')]},'description':{'type':Sequelize[_0x207e('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index d90cf1a..1ad5580 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 _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 +var _0x771e=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','ZendeskConfiguration','includeAll','findAll','catch','show','params','include','create','find','body','getFields','ZendeskField','rawAttributes','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','ids','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0xf6b3cd,_0xb5508c){var _0x1a2bcd=function(_0x3817fc){while(--_0x3817fc){_0xf6b3cd['push'](_0xf6b3cd['shift']());}};_0x1a2bcd(++_0xb5508c);}(_0x771e,0xff));var _0xe771=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x771e[_0x2641f9];return _0x585741;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe771('0x0'));var jsonpatch=require(_0xe771('0x1'));var rp=require(_0xe771('0x2'));var moment=require(_0xe771('0x3'));var BPromise=require(_0xe771('0x4'));var Mustache=require(_0xe771('0x5'));var util=require(_0xe771('0x6'));var path=require(_0xe771('0x7'));var sox=require('sox');var csv=require(_0xe771('0x8'));var ejs=require(_0xe771('0x9'));var fs=require('fs');var fs_extra=require(_0xe771('0xa'));var _=require(_0xe771('0xb'));var squel=require(_0xe771('0xc'));var crypto=require(_0xe771('0xd'));var jsforce=require(_0xe771('0xe'));var deskjs=require(_0xe771('0xf'));var toCsv=require(_0xe771('0x8'));var querystring=require(_0xe771('0x10'));var Papa=require(_0xe771('0x11'));var Redis=require(_0xe771('0x12'));var authService=require(_0xe771('0x13'));var qs=require(_0xe771('0x14'));var as=require(_0xe771('0x15'));var hardwareService=require(_0xe771('0x16'));var logger=require(_0xe771('0x17'))(_0xe771('0x18'));var utils=require(_0xe771('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xe771('0x1a'));var db=require(_0xe771('0x1b'))['db'];function respondWithStatusCode(_0x419128,_0xc170cd){_0xc170cd=_0xc170cd||0xcc;return function(_0x3d948e){if(_0x3d948e){return _0x419128[_0xe771('0x1c')](_0xc170cd);}return _0x419128[_0xe771('0x1d')](_0xc170cd)[_0xe771('0x1e')]();};}function respondWithResult(_0x5242aa,_0x12de1f){_0x12de1f=_0x12de1f||0xc8;return function(_0xdb421){if(_0xdb421){return _0x5242aa[_0xe771('0x1d')](_0x12de1f)[_0xe771('0x1f')](_0xdb421);}};}function respondWithFilteredResult(_0x6fafd5,_0x81a130){return function(_0x17bbe1){if(_0x17bbe1){var _0x1a15a0=typeof _0x81a130[_0xe771('0x20')]===_0xe771('0x21')&&typeof _0x81a130[_0xe771('0x22')]===_0xe771('0x21');var _0x27d729=_0x17bbe1['count'];var _0x421b5c=_0x1a15a0?0x0:_0x81a130[_0xe771('0x20')];var _0x5a2a77=_0x1a15a0?_0x17bbe1[_0xe771('0x23')]:_0x81a130[_0xe771('0x20')]+_0x81a130[_0xe771('0x22')];var _0x24c140;if(_0x5a2a77>=_0x27d729){_0x5a2a77=_0x27d729;_0x24c140=0xc8;}else{_0x24c140=0xce;}_0x6fafd5['status'](_0x24c140);return _0x6fafd5[_0xe771('0x24')](_0xe771('0x25'),_0x421b5c+'-'+_0x5a2a77+'/'+_0x27d729)[_0xe771('0x1f')](_0x17bbe1);}return null;};}function patchUpdates(_0x27b7f1){return function(_0x276cb4){try{jsonpatch[_0xe771('0x26')](_0x276cb4,_0x27b7f1,!![]);}catch(_0x4acedd){return BPromise[_0xe771('0x27')](_0x4acedd);}return _0x276cb4[_0xe771('0x28')]();};}function saveUpdates(_0x1ba574,_0x19a3d1){return function(_0x181a94){if(_0x181a94){return _0x181a94[_0xe771('0x29')](_0x1ba574)[_0xe771('0x2a')](function(_0x281034){return _0x281034;});}return null;};}function removeEntity(_0xbd6980,_0x302082){return function(_0x31a8ce){if(_0x31a8ce){return _0x31a8ce[_0xe771('0x2b')]()[_0xe771('0x2a')](function(){_0xbd6980[_0xe771('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a2c3e,_0x28cc51){return function(_0x154960){if(!_0x154960){_0x2a2c3e[_0xe771('0x1c')](0x194);}return _0x154960;};}function handleError(_0x40dbef,_0x1f8d9b){_0x1f8d9b=_0x1f8d9b||0x1f4;return function(_0x420b99){logger[_0xe771('0x2c')](_0x420b99[_0xe771('0x2d')]);if(_0x420b99['name']){delete _0x420b99[_0xe771('0x2e')];}_0x40dbef[_0xe771('0x1d')](_0x1f8d9b)[_0xe771('0x2f')](_0x420b99);};}exports[_0xe771('0x30')]=function(_0x4848b6,_0x2157bb){var _0x41f9d6={},_0xe48797={},_0x14e261={'count':0x0,'rows':[]};var _0x48a301=_[_0xe771('0x31')](db['ZendeskConfiguration']['rawAttributes'],function(_0x277e4a){return{'name':_0x277e4a[_0xe771('0x32')],'type':_0x277e4a['type'][_0xe771('0x33')]};});_0xe48797[_0xe771('0x34')]=_[_0xe771('0x31')](_0x48a301,_0xe771('0x2e'));_0xe48797[_0xe771('0x35')]=_[_0xe771('0x36')](_0x4848b6['query']);_0xe48797[_0xe771('0x37')]=_[_0xe771('0x38')](_0xe48797[_0xe771('0x34')],_0xe48797['query']);_0x41f9d6[_0xe771('0x39')]=_[_0xe771('0x38')](_0xe48797['model'],qs[_0xe771('0x3a')](_0x4848b6['query']['fields']));_0x41f9d6[_0xe771('0x39')]=_0x41f9d6[_0xe771('0x39')][_0xe771('0x3b')]?_0x41f9d6['attributes']:_0xe48797[_0xe771('0x34')];if(!_0x4848b6[_0xe771('0x35')][_0xe771('0x3c')](_0xe771('0x3d'))){_0x41f9d6['limit']=qs[_0xe771('0x22')](_0x4848b6[_0xe771('0x35')]['limit']);_0x41f9d6[_0xe771('0x20')]=qs[_0xe771('0x20')](_0x4848b6['query'][_0xe771('0x20')]);}_0x41f9d6[_0xe771('0x3e')]=qs[_0xe771('0x3f')](_0x4848b6[_0xe771('0x35')][_0xe771('0x3f')]);_0x41f9d6[_0xe771('0x40')]=qs['filters'](_[_0xe771('0x41')](_0x4848b6[_0xe771('0x35')],_0xe48797[_0xe771('0x37')]),_0x48a301);if(_0x4848b6['query']['filter']){_0x41f9d6['where']=_[_0xe771('0x42')](_0x41f9d6['where'],{'$or':_['map'](_0x48a301,function(_0x37b64f){if(_0x37b64f[_0xe771('0x43')]!==_0xe771('0x44')){var _0x19c9a0={};_0x19c9a0[_0x37b64f[_0xe771('0x2e')]]={'$like':'%'+_0x4848b6[_0xe771('0x35')][_0xe771('0x45')]+'%'};return _0x19c9a0;}})});}_0x41f9d6=_[_0xe771('0x42')]({},_0x41f9d6,_0x4848b6[_0xe771('0x46')]);var _0x10343a={'where':_0x41f9d6[_0xe771('0x40')]};return db[_0xe771('0x47')][_0xe771('0x23')](_0x10343a)[_0xe771('0x2a')](function(_0x1dc129){_0x14e261[_0xe771('0x23')]=_0x1dc129;if(_0x4848b6[_0xe771('0x35')][_0xe771('0x48')]){_0x41f9d6['include']=[{'all':!![]}];}return db[_0xe771('0x47')][_0xe771('0x49')](_0x41f9d6);})[_0xe771('0x2a')](function(_0x23f342){_0x14e261['rows']=_0x23f342;return _0x14e261;})[_0xe771('0x2a')](respondWithFilteredResult(_0x2157bb,_0x41f9d6))[_0xe771('0x4a')](handleError(_0x2157bb,null));};exports[_0xe771('0x4b')]=function(_0x5a6698,_0x18fa44){var _0x2b291f={'raw':![],'where':{'id':_0x5a6698[_0xe771('0x4c')]['id']}},_0x480117={};_0x480117[_0xe771('0x34')]=_[_0xe771('0x36')](db[_0xe771('0x47')]['rawAttributes']);_0x480117['query']=_[_0xe771('0x36')](_0x5a6698[_0xe771('0x35')]);_0x480117[_0xe771('0x37')]=_[_0xe771('0x38')](_0x480117['model'],_0x480117[_0xe771('0x35')]);_0x2b291f[_0xe771('0x39')]=_[_0xe771('0x38')](_0x480117[_0xe771('0x34')],qs[_0xe771('0x3a')](_0x5a6698[_0xe771('0x35')][_0xe771('0x3a')]));_0x2b291f[_0xe771('0x39')]=_0x2b291f[_0xe771('0x39')]['length']?_0x2b291f[_0xe771('0x39')]:_0x480117[_0xe771('0x34')];if(_0x5a6698['query'][_0xe771('0x48')]){_0x2b291f[_0xe771('0x4d')]=[{'all':!![]}];}_0x2b291f=_[_0xe771('0x42')]({},_0x2b291f,_0x5a6698['options']);return db[_0xe771('0x47')]['find'](_0x2b291f)['then'](handleEntityNotFound(_0x18fa44,null))[_0xe771('0x2a')](respondWithResult(_0x18fa44,null))[_0xe771('0x4a')](handleError(_0x18fa44,null));};exports['create']=function(_0xe35706,_0x5d0d36){return db[_0xe771('0x47')][_0xe771('0x4e')](_0xe35706['body'],{})[_0xe771('0x2a')](respondWithResult(_0x5d0d36,0xc9))[_0xe771('0x4a')](handleError(_0x5d0d36,null));};exports[_0xe771('0x29')]=function(_0x58da98,_0xb3b818){if(_0x58da98['body']['id']){delete _0x58da98['body']['id'];}return db[_0xe771('0x47')][_0xe771('0x4f')]({'where':{'id':_0x58da98[_0xe771('0x4c')]['id']}})[_0xe771('0x2a')](handleEntityNotFound(_0xb3b818,null))[_0xe771('0x2a')](saveUpdates(_0x58da98[_0xe771('0x50')],null))[_0xe771('0x2a')](respondWithResult(_0xb3b818,null))[_0xe771('0x4a')](handleError(_0xb3b818,null));};exports['destroy']=function(_0x24dfa3,_0x3143b4){return db[_0xe771('0x47')][_0xe771('0x4f')]({'where':{'id':_0x24dfa3[_0xe771('0x4c')]['id']}})[_0xe771('0x2a')](handleEntityNotFound(_0x3143b4,null))['then'](removeEntity(_0x3143b4,null))['catch'](handleError(_0x3143b4,null));};exports[_0xe771('0x51')]=function(_0x16b73b,_0x39147f,_0x116bfb){var _0x48497e={};var _0x211644={};var _0x135d7f;var _0x5b8664;return db[_0xe771('0x47')]['findOne']({'where':{'id':_0x16b73b[_0xe771('0x4c')]['id']}})[_0xe771('0x2a')](handleEntityNotFound(_0x39147f,null))[_0xe771('0x2a')](function(_0x2ea0a1){if(_0x2ea0a1){_0x135d7f=_0x2ea0a1;_0x211644[_0xe771('0x34')]=_[_0xe771('0x36')](db[_0xe771('0x52')][_0xe771('0x53')]);_0x211644[_0xe771('0x35')]=_[_0xe771('0x36')](_0x16b73b['query']);_0x211644[_0xe771('0x37')]=_[_0xe771('0x38')](_0x211644[_0xe771('0x34')],_0x211644[_0xe771('0x35')]);_0x48497e['attributes']=_[_0xe771('0x38')](_0x211644['model'],qs[_0xe771('0x3a')](_0x16b73b['query']['fields']));_0x48497e[_0xe771('0x39')]=_0x48497e['attributes'][_0xe771('0x3b')]?_0x48497e[_0xe771('0x39')]:_0x211644['model'];_0x48497e[_0xe771('0x3e')]=qs['sort'](_0x16b73b[_0xe771('0x35')][_0xe771('0x3f')]);_0x48497e[_0xe771('0x40')]=qs[_0xe771('0x37')](_[_0xe771('0x41')](_0x16b73b['query'],_0x211644['filters']));if(_0x16b73b['query']['filter']){_0x48497e[_0xe771('0x40')]=_[_0xe771('0x42')](_0x48497e['where'],{'$or':_[_0xe771('0x31')](_0x48497e[_0xe771('0x39')],function(_0x3d3194){var _0x147488={};_0x147488[_0x3d3194]={'$like':'%'+_0x16b73b[_0xe771('0x35')][_0xe771('0x45')]+'%'};return _0x147488;})});}_0x48497e=_[_0xe771('0x42')]({},_0x48497e,_0x16b73b[_0xe771('0x46')]);return _0x135d7f[_0xe771('0x51')](_0x48497e);}})[_0xe771('0x2a')](function(_0x1b8dad){if(_0x1b8dad){_0x5b8664=_0x1b8dad[_0xe771('0x3b')];if(!_0x16b73b[_0xe771('0x35')][_0xe771('0x3c')](_0xe771('0x3d'))){_0x48497e[_0xe771('0x22')]=qs[_0xe771('0x22')](_0x16b73b['query'][_0xe771('0x22')]);_0x48497e[_0xe771('0x20')]=qs[_0xe771('0x20')](_0x16b73b[_0xe771('0x35')][_0xe771('0x20')]);}return _0x135d7f['getFields'](_0x48497e);}})[_0xe771('0x2a')](function(_0xecc15d){if(_0xecc15d){return _0xecc15d?{'count':_0x5b8664,'rows':_0xecc15d}:null;}})[_0xe771('0x2a')](respondWithResult(_0x39147f,null))[_0xe771('0x4a')](handleError(_0x39147f,null));};exports[_0xe771('0x54')]=function(_0x43a6dc,_0x19a38a,_0x34e32f){var _0x5ba676={};var _0x5f1d1d={};var _0x30c0d6;var _0x4ac27f;return db[_0xe771('0x47')][_0xe771('0x55')]({'where':{'id':_0x43a6dc[_0xe771('0x4c')]['id']}})[_0xe771('0x2a')](handleEntityNotFound(_0x19a38a,null))[_0xe771('0x2a')](function(_0x5bff78){if(_0x5bff78){_0x30c0d6=_0x5bff78;_0x5f1d1d[_0xe771('0x34')]=_[_0xe771('0x36')](db['ZendeskField'][_0xe771('0x53')]);_0x5f1d1d[_0xe771('0x35')]=_[_0xe771('0x36')](_0x43a6dc[_0xe771('0x35')]);_0x5f1d1d['filters']=_['intersection'](_0x5f1d1d[_0xe771('0x34')],_0x5f1d1d['query']);_0x5ba676[_0xe771('0x39')]=_[_0xe771('0x38')](_0x5f1d1d[_0xe771('0x34')],qs[_0xe771('0x3a')](_0x43a6dc[_0xe771('0x35')]['fields']));_0x5ba676[_0xe771('0x39')]=_0x5ba676['attributes']['length']?_0x5ba676['attributes']:_0x5f1d1d['model'];_0x5ba676[_0xe771('0x3e')]=qs['sort'](_0x43a6dc['query'][_0xe771('0x3f')]);_0x5ba676[_0xe771('0x40')]=qs[_0xe771('0x37')](_[_0xe771('0x41')](_0x43a6dc[_0xe771('0x35')],_0x5f1d1d['filters']));if(_0x43a6dc[_0xe771('0x35')]['filter']){_0x5ba676[_0xe771('0x40')]=_['merge'](_0x5ba676['where'],{'$or':_[_0xe771('0x31')](_0x5ba676[_0xe771('0x39')],function(_0x2eaaaf){var _0x2b7c4d={};_0x2b7c4d[_0x2eaaaf]={'$like':'%'+_0x43a6dc[_0xe771('0x35')][_0xe771('0x45')]+'%'};return _0x2b7c4d;})});}_0x5ba676=_[_0xe771('0x42')]({},_0x5ba676,_0x43a6dc[_0xe771('0x46')]);return _0x30c0d6[_0xe771('0x54')](_0x5ba676);}})['then'](function(_0x470bb9){if(_0x470bb9){_0x4ac27f=_0x470bb9['length'];if(!_0x43a6dc[_0xe771('0x35')]['hasOwnProperty']('nolimit')){_0x5ba676[_0xe771('0x22')]=qs[_0xe771('0x22')](_0x43a6dc[_0xe771('0x35')][_0xe771('0x22')]);_0x5ba676[_0xe771('0x20')]=qs[_0xe771('0x20')](_0x43a6dc[_0xe771('0x35')]['offset']);}return _0x30c0d6['getSubjects'](_0x5ba676);}})[_0xe771('0x2a')](function(_0x4ca0cc){if(_0x4ca0cc){return _0x4ca0cc?{'count':_0x4ac27f,'rows':_0x4ca0cc}:null;}})[_0xe771('0x2a')](respondWithResult(_0x19a38a,null))[_0xe771('0x4a')](handleError(_0x19a38a,null));};exports[_0xe771('0x56')]=function(_0x22e293,_0x2a4bba,_0x43efa8){var _0x4abdf5={};var _0x41e148={};var _0x3d765f;var _0xad9ef8;return db[_0xe771('0x47')][_0xe771('0x55')]({'where':{'id':_0x22e293[_0xe771('0x4c')]['id']}})[_0xe771('0x2a')](handleEntityNotFound(_0x2a4bba,null))[_0xe771('0x2a')](function(_0x1fb883){if(_0x1fb883){_0x3d765f=_0x1fb883;_0x41e148[_0xe771('0x34')]=_[_0xe771('0x36')](db['ZendeskField'][_0xe771('0x53')]);_0x41e148[_0xe771('0x35')]=_[_0xe771('0x36')](_0x22e293[_0xe771('0x35')]);_0x41e148['filters']=_[_0xe771('0x38')](_0x41e148[_0xe771('0x34')],_0x41e148[_0xe771('0x35')]);_0x4abdf5[_0xe771('0x39')]=_['intersection'](_0x41e148['model'],qs[_0xe771('0x3a')](_0x22e293['query']['fields']));_0x4abdf5[_0xe771('0x39')]=_0x4abdf5[_0xe771('0x39')][_0xe771('0x3b')]?_0x4abdf5['attributes']:_0x41e148[_0xe771('0x34')];_0x4abdf5[_0xe771('0x3e')]=qs['sort'](_0x22e293[_0xe771('0x35')][_0xe771('0x3f')]);_0x4abdf5['where']=qs[_0xe771('0x37')](_[_0xe771('0x41')](_0x22e293['query'],_0x41e148[_0xe771('0x37')]));if(_0x22e293[_0xe771('0x35')][_0xe771('0x45')]){_0x4abdf5[_0xe771('0x40')]=_[_0xe771('0x42')](_0x4abdf5[_0xe771('0x40')],{'$or':_['map'](_0x4abdf5[_0xe771('0x39')],function(_0xaf37dc){var _0x2ae71d={};_0x2ae71d[_0xaf37dc]={'$like':'%'+_0x22e293[_0xe771('0x35')][_0xe771('0x45')]+'%'};return _0x2ae71d;})});}_0x4abdf5=_[_0xe771('0x42')]({},_0x4abdf5,_0x22e293[_0xe771('0x46')]);return _0x3d765f[_0xe771('0x56')](_0x4abdf5);}})[_0xe771('0x2a')](function(_0x2fa652){if(_0x2fa652){_0xad9ef8=_0x2fa652['length'];if(!_0x22e293[_0xe771('0x35')][_0xe771('0x3c')]('nolimit')){_0x4abdf5[_0xe771('0x22')]=qs[_0xe771('0x22')](_0x22e293[_0xe771('0x35')][_0xe771('0x22')]);_0x4abdf5['offset']=qs[_0xe771('0x20')](_0x22e293[_0xe771('0x35')][_0xe771('0x20')]);}return _0x3d765f[_0xe771('0x56')](_0x4abdf5);}})[_0xe771('0x2a')](function(_0x3475e9){if(_0x3475e9){return _0x3475e9?{'count':_0xad9ef8,'rows':_0x3475e9}:null;}})['then'](respondWithResult(_0x2a4bba,null))[_0xe771('0x4a')](handleError(_0x2a4bba,null));};exports[_0xe771('0x57')]=function(_0x4a0124,_0x3546db,_0x271b00){var _0x4793a5={};var _0x1e2d41={};var _0x2d18b9;var _0x59da2d;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x4a0124[_0xe771('0x4c')]['id']}})[_0xe771('0x2a')](handleEntityNotFound(_0x3546db,null))['then'](function(_0x411e8c){if(_0x411e8c){_0x2d18b9=_0x411e8c;_0x1e2d41[_0xe771('0x34')]=_[_0xe771('0x36')](db[_0xe771('0x58')][_0xe771('0x53')]);_0x1e2d41[_0xe771('0x35')]=_[_0xe771('0x36')](_0x4a0124[_0xe771('0x35')]);_0x1e2d41[_0xe771('0x37')]=_[_0xe771('0x38')](_0x1e2d41[_0xe771('0x34')],_0x1e2d41[_0xe771('0x35')]);_0x4793a5[_0xe771('0x39')]=_[_0xe771('0x38')](_0x1e2d41[_0xe771('0x34')],qs['fields'](_0x4a0124['query']['fields']));_0x4793a5[_0xe771('0x39')]=_0x4793a5[_0xe771('0x39')]['length']?_0x4793a5[_0xe771('0x39')]:_0x1e2d41['model'];_0x4793a5['order']=qs[_0xe771('0x3f')](_0x4a0124[_0xe771('0x35')][_0xe771('0x3f')]);_0x4793a5['where']=qs[_0xe771('0x37')](_[_0xe771('0x41')](_0x4a0124[_0xe771('0x35')],_0x1e2d41['filters']));if(_0x4a0124[_0xe771('0x35')][_0xe771('0x45')]){_0x4793a5[_0xe771('0x40')]=_[_0xe771('0x42')](_0x4793a5[_0xe771('0x40')],{'$or':_[_0xe771('0x31')](_0x4793a5['attributes'],function(_0x1850d1){var _0x33f245={};_0x33f245[_0x1850d1]={'$like':'%'+_0x4a0124[_0xe771('0x35')][_0xe771('0x45')]+'%'};return _0x33f245;})});}_0x4793a5=_[_0xe771('0x42')]({},_0x4793a5,_0x4a0124[_0xe771('0x46')]);return _0x2d18b9['getTags'](_0x4793a5);}})[_0xe771('0x2a')](function(_0x214b6f){if(_0x214b6f){_0x59da2d=_0x214b6f[_0xe771('0x3b')];if(!_0x4a0124['query'][_0xe771('0x3c')](_0xe771('0x3d'))){_0x4793a5[_0xe771('0x22')]=qs[_0xe771('0x22')](_0x4a0124['query'][_0xe771('0x22')]);_0x4793a5[_0xe771('0x20')]=qs[_0xe771('0x20')](_0x4a0124['query'][_0xe771('0x20')]);}return _0x2d18b9[_0xe771('0x57')](_0x4793a5);}})[_0xe771('0x2a')](function(_0x23724d){if(_0x23724d){return _0x23724d?{'count':_0x59da2d,'rows':_0x23724d}:null;}})[_0xe771('0x2a')](respondWithResult(_0x3546db,null))[_0xe771('0x4a')](handleError(_0x3546db,null));};exports[_0xe771('0x59')]=function(_0x31ab91,_0x34a7d6,_0x57e5f3){if(_0x31ab91[_0xe771('0x50')]['id']){delete _0x31ab91[_0xe771('0x50')]['id'];}return db[_0xe771('0x47')]['findOne']({'where':{'id':_0x31ab91[_0xe771('0x4c')]['id']}})[_0xe771('0x2a')](handleEntityNotFound(_0x34a7d6,null))[_0xe771('0x2a')](function(_0x5077aa){if(_0x5077aa){return _0x5077aa[_0xe771('0x59')](_0x31ab91[_0xe771('0x50')][_0xe771('0x5a')]||[]);}return null;})['then'](respondWithResult(_0x34a7d6,null))['catch'](handleError(_0x34a7d6,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index df8bfe2..99716fb 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 _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 +var _0x9354=['../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0xb8cfbe,_0x2e81b6){var _0x227d51=function(_0x5cb1ff){while(--_0x5cb1ff){_0xb8cfbe['push'](_0xb8cfbe['shift']());}};_0x227d51(++_0x2e81b6);}(_0x9354,0x96));var _0x4935=function(_0x2de81b,_0x322f1d){_0x2de81b=_0x2de81b-0x0;var _0x3df553=_0x9354[_0x2de81b];return _0x3df553;};'use strict';var _=require('lodash');var util=require(_0x4935('0x0'));var logger=require(_0x4935('0x1'))('api');var moment=require(_0x4935('0x2'));var BPromise=require(_0x4935('0x3'));var rp=require(_0x4935('0x4'));var fs=require('fs');var path=require(_0x4935('0x5'));var rimraf=require('rimraf');var config=require(_0x4935('0x6'));var attributes=require(_0x4935('0x7'));module[_0x4935('0x8')]=function(_0x2d518a,_0x263864){return _0x2d518a[_0x4935('0x9')](_0x4935('0xa'),attributes,{'tableName':_0x4935('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 42360a8..9fe61ed 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 _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 +var _0xc70d=['http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x13439e,_0x39fb41){var _0x2a04cd=function(_0x156fd5){while(--_0x156fd5){_0x13439e['push'](_0x13439e['shift']());}};_0x2a04cd(++_0x39fb41);}(_0xc70d,0xae));var _0xdc70=function(_0x1107d5,_0x3b1c0a){_0x1107d5=_0x1107d5-0x0;var _0x3fbb36=_0xc70d[_0x1107d5];return _0x3fbb36;};'use strict';var _=require('lodash');var util=require(_0xdc70('0x0'));var moment=require(_0xdc70('0x1'));var BPromise=require(_0xdc70('0x2'));var rs=require(_0xdc70('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdc70('0x4'))['db'];var utils=require(_0xdc70('0x5'));var logger=require(_0xdc70('0x6'))(_0xdc70('0x7'));var config=require(_0xdc70('0x8'));var jayson=require(_0xdc70('0x9'));var client=jayson['client'][_0xdc70('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5dcf32,_0x56bc37,_0x3c862e){return new BPromise(function(_0x144ebf,_0xe77e10){return client[_0xdc70('0xb')](_0x5dcf32,_0x3c862e)[_0xdc70('0xc')](function(_0x474e06){logger[_0xdc70('0xd')](_0xdc70('0xe'),_0x56bc37,'request\x20sent');logger['debug'](_0xdc70('0xf'),_0x56bc37,_0xdc70('0x10'),JSON[_0xdc70('0x11')](_0x474e06));if(_0x474e06['error']){if(_0x474e06[_0xdc70('0x12')][_0xdc70('0x13')]===0x1f4){logger[_0xdc70('0x12')](_0xdc70('0xe'),_0x56bc37,_0x474e06['error'][_0xdc70('0x14')]);return _0xe77e10(_0x474e06[_0xdc70('0x12')][_0xdc70('0x14')]);}logger[_0xdc70('0x12')](_0xdc70('0xe'),_0x56bc37,_0x474e06[_0xdc70('0x12')]['message']);return _0x144ebf(_0x474e06[_0xdc70('0x12')]['message']);}else{logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x56bc37,_0xdc70('0x10'));_0x144ebf(_0x474e06[_0xdc70('0x15')]['message']);}})[_0xdc70('0x16')](function(_0x3684f8){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x56bc37,_0x3684f8);_0xe77e10(_0x3684f8);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 7d41921..8d724e7 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 _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 +var _0x1748=['multer','path','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0x1748,0x1a0));var _0x8174=function(_0x196f42,_0x1c126){_0x196f42=_0x196f42-0x0;var _0x405be6=_0x1748[_0x196f42];return _0x405be6;};'use strict';var multer=require(_0x8174('0x0'));var util=require('util');var path=require(_0x8174('0x1'));var timeout=require('connect-timeout');var express=require(_0x8174('0x2'));var router=express[_0x8174('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8174('0x4'));var interaction=require(_0x8174('0x5'));var config=require('../../config/environment');var controller=require('./intZendeskField.controller');router[_0x8174('0x6')]('/',auth[_0x8174('0x7')](),controller[_0x8174('0x8')]);router[_0x8174('0x6')](_0x8174('0x9'),auth[_0x8174('0x7')](),controller[_0x8174('0xa')]);router[_0x8174('0xb')]('/',auth['isAuthenticated'](),controller[_0x8174('0xc')]);router[_0x8174('0xd')](_0x8174('0x9'),auth[_0x8174('0x7')](),controller[_0x8174('0xe')]);router['delete'](_0x8174('0x9'),auth[_0x8174('0x7')](),controller[_0x8174('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 177e510..1f1e2f7 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 _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 +var _0x3a7b=['ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports'];(function(_0x836465,_0x5442ae){var _0x2150ea=function(_0x4f4bc2){while(--_0x4f4bc2){_0x836465['push'](_0x836465['shift']());}};_0x2150ea(++_0x5442ae);}(_0x3a7b,0x16f));var _0xb3a7=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x3a7b[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0xb3a7('0x0'));module[_0xb3a7('0x1')]={'type':{'type':Sequelize[_0xb3a7('0x2')](_0xb3a7('0x3'),_0xb3a7('0x4'),_0xb3a7('0x5'),_0xb3a7('0x6'),'picklist'),'defaultValue':_0xb3a7('0x3')},'content':{'type':Sequelize[_0xb3a7('0x7')]},'key':{'type':Sequelize[_0xb3a7('0x7')]},'keyType':{'type':Sequelize[_0xb3a7('0x2')]('string',_0xb3a7('0x4'),_0xb3a7('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xb3a7('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xb3a7('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 5e598ab..f891a06 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 _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 +var _0x3f1e=['query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','includeAll','findAll','rows','catch','show','params','options','create','body','destroy','find','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','Content-Range','json','apply','save','update','then','error','stack','send','index','map','ZendeskField','rawAttributes','fieldName','type','key','model'];(function(_0x2d6c6b,_0xffe0f7){var _0x18c083=function(_0x301fa0){while(--_0x301fa0){_0x2d6c6b['push'](_0x2d6c6b['shift']());}};_0x18c083(++_0xffe0f7);}(_0x3f1e,0x1dc));var _0xe3f1=function(_0x13effd,_0x72361){_0x13effd=_0x13effd-0x0;var _0x2611df=_0x3f1e[_0x13effd];return _0x2611df;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe3f1('0x0'));var zipdir=require(_0xe3f1('0x1'));var jsonpatch=require(_0xe3f1('0x2'));var rp=require(_0xe3f1('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe3f1('0x4'));var util=require(_0xe3f1('0x5'));var path=require(_0xe3f1('0x6'));var sox=require(_0xe3f1('0x7'));var csv=require(_0xe3f1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe3f1('0x9'));var _=require('lodash');var squel=require(_0xe3f1('0xa'));var crypto=require(_0xe3f1('0xb'));var jsforce=require(_0xe3f1('0xc'));var deskjs=require(_0xe3f1('0xd'));var toCsv=require(_0xe3f1('0x8'));var querystring=require(_0xe3f1('0xe'));var Papa=require(_0xe3f1('0xf'));var Redis=require(_0xe3f1('0x10'));var authService=require(_0xe3f1('0x11'));var qs=require(_0xe3f1('0x12'));var as=require(_0xe3f1('0x13'));var hardwareService=require(_0xe3f1('0x14'));var logger=require('../../config/logger')(_0xe3f1('0x15'));var utils=require(_0xe3f1('0x16'));var config=require(_0xe3f1('0x17'));var licenseUtil=require(_0xe3f1('0x18'));var db=require(_0xe3f1('0x19'))['db'];function respondWithStatusCode(_0x1ec78b,_0x29bfa2){_0x29bfa2=_0x29bfa2||0xcc;return function(_0x21677f){if(_0x21677f){return _0x1ec78b[_0xe3f1('0x1a')](_0x29bfa2);}return _0x1ec78b[_0xe3f1('0x1b')](_0x29bfa2)[_0xe3f1('0x1c')]();};}function respondWithResult(_0x2eb354,_0x1d4dfb){_0x1d4dfb=_0x1d4dfb||0xc8;return function(_0x74fac1){if(_0x74fac1){return _0x2eb354[_0xe3f1('0x1b')](_0x1d4dfb)['json'](_0x74fac1);}};}function respondWithFilteredResult(_0x3835c5,_0x16e2da){return function(_0x127b4e){if(_0x127b4e){var _0x42c263=typeof _0x16e2da[_0xe3f1('0x1d')]===_0xe3f1('0x1e')&&typeof _0x16e2da['limit']==='undefined';var _0x38dc80=_0x127b4e[_0xe3f1('0x1f')];var _0x32e17f=_0x42c263?0x0:_0x16e2da[_0xe3f1('0x1d')];var _0x57fc47=_0x42c263?_0x127b4e[_0xe3f1('0x1f')]:_0x16e2da[_0xe3f1('0x1d')]+_0x16e2da['limit'];var _0x49d3fb;if(_0x57fc47>=_0x38dc80){_0x57fc47=_0x38dc80;_0x49d3fb=0xc8;}else{_0x49d3fb=0xce;}_0x3835c5[_0xe3f1('0x1b')](_0x49d3fb);return _0x3835c5['set'](_0xe3f1('0x20'),_0x32e17f+'-'+_0x57fc47+'/'+_0x38dc80)[_0xe3f1('0x21')](_0x127b4e);}return null;};}function patchUpdates(_0x36fcea){return function(_0x19aa0f){try{jsonpatch[_0xe3f1('0x22')](_0x19aa0f,_0x36fcea,!![]);}catch(_0x518f22){return BPromise['reject'](_0x518f22);}return _0x19aa0f[_0xe3f1('0x23')]();};}function saveUpdates(_0x38dbe1,_0x4b9aa4){return function(_0x4182e3){if(_0x4182e3){return _0x4182e3[_0xe3f1('0x24')](_0x38dbe1)[_0xe3f1('0x25')](function(_0x5948ee){return _0x5948ee;});}return null;};}function removeEntity(_0x57790c,_0x1abd8d){return function(_0xc55929){if(_0xc55929){return _0xc55929['destroy']()[_0xe3f1('0x25')](function(){_0x57790c[_0xe3f1('0x1b')](0xcc)[_0xe3f1('0x1c')]();});}};}function handleEntityNotFound(_0x5df456,_0x138e00){return function(_0x36c50a){if(!_0x36c50a){_0x5df456[_0xe3f1('0x1a')](0x194);}return _0x36c50a;};}function handleError(_0xdda7a,_0x33efe2){_0x33efe2=_0x33efe2||0x1f4;return function(_0x3b8e54){logger[_0xe3f1('0x26')](_0x3b8e54[_0xe3f1('0x27')]);if(_0x3b8e54['name']){delete _0x3b8e54['name'];}_0xdda7a[_0xe3f1('0x1b')](_0x33efe2)[_0xe3f1('0x28')](_0x3b8e54);};}exports[_0xe3f1('0x29')]=function(_0x5cf25a,_0x5eebc2){var _0xad36e7={},_0x56ba2c={},_0x1b42e5={'count':0x0,'rows':[]};var _0x39e496=_[_0xe3f1('0x2a')](db[_0xe3f1('0x2b')][_0xe3f1('0x2c')],function(_0x301ab9){return{'name':_0x301ab9[_0xe3f1('0x2d')],'type':_0x301ab9[_0xe3f1('0x2e')][_0xe3f1('0x2f')]};});_0x56ba2c[_0xe3f1('0x30')]=_[_0xe3f1('0x2a')](_0x39e496,'name');_0x56ba2c[_0xe3f1('0x31')]=_[_0xe3f1('0x32')](_0x5cf25a[_0xe3f1('0x31')]);_0x56ba2c[_0xe3f1('0x33')]=_['intersection'](_0x56ba2c[_0xe3f1('0x30')],_0x56ba2c[_0xe3f1('0x31')]);_0xad36e7['attributes']=_[_0xe3f1('0x34')](_0x56ba2c['model'],qs[_0xe3f1('0x35')](_0x5cf25a['query']['fields']));_0xad36e7['attributes']=_0xad36e7[_0xe3f1('0x36')][_0xe3f1('0x37')]?_0xad36e7[_0xe3f1('0x36')]:_0x56ba2c['model'];if(!_0x5cf25a[_0xe3f1('0x31')][_0xe3f1('0x38')]('nolimit')){_0xad36e7['limit']=qs[_0xe3f1('0x39')](_0x5cf25a[_0xe3f1('0x31')][_0xe3f1('0x39')]);_0xad36e7[_0xe3f1('0x1d')]=qs[_0xe3f1('0x1d')](_0x5cf25a[_0xe3f1('0x31')][_0xe3f1('0x1d')]);}_0xad36e7[_0xe3f1('0x3a')]=qs[_0xe3f1('0x3b')](_0x5cf25a[_0xe3f1('0x31')][_0xe3f1('0x3b')]);_0xad36e7[_0xe3f1('0x3c')]=qs[_0xe3f1('0x33')](_[_0xe3f1('0x3d')](_0x5cf25a['query'],_0x56ba2c[_0xe3f1('0x33')]),_0x39e496);if(_0x5cf25a[_0xe3f1('0x31')][_0xe3f1('0x3e')]){_0xad36e7[_0xe3f1('0x3c')]=_[_0xe3f1('0x3f')](_0xad36e7['where'],{'$or':_[_0xe3f1('0x2a')](_0x39e496,function(_0x30f58d){if(_0x30f58d['type']!=='VIRTUAL'){var _0x249387={};_0x249387[_0x30f58d['name']]={'$like':'%'+_0x5cf25a['query'][_0xe3f1('0x3e')]+'%'};return _0x249387;}})});}_0xad36e7=_[_0xe3f1('0x3f')]({},_0xad36e7,_0x5cf25a['options']);var _0x4b8fb5={'where':_0xad36e7[_0xe3f1('0x3c')]};return db[_0xe3f1('0x2b')]['count'](_0x4b8fb5)['then'](function(_0x21719d){_0x1b42e5[_0xe3f1('0x1f')]=_0x21719d;if(_0x5cf25a[_0xe3f1('0x31')][_0xe3f1('0x40')]){_0xad36e7['include']=[{'all':!![]}];}return db[_0xe3f1('0x2b')][_0xe3f1('0x41')](_0xad36e7);})[_0xe3f1('0x25')](function(_0x3c1ae0){_0x1b42e5[_0xe3f1('0x42')]=_0x3c1ae0;return _0x1b42e5;})[_0xe3f1('0x25')](respondWithFilteredResult(_0x5eebc2,_0xad36e7))[_0xe3f1('0x43')](handleError(_0x5eebc2,null));};exports[_0xe3f1('0x44')]=function(_0x13da17,_0x1d5b33){var _0x2bd6e1={'raw':!![],'where':{'id':_0x13da17[_0xe3f1('0x45')]['id']}},_0x59041a={};_0x59041a[_0xe3f1('0x30')]=_['keys'](db['ZendeskField'][_0xe3f1('0x2c')]);_0x59041a[_0xe3f1('0x31')]=_[_0xe3f1('0x32')](_0x13da17[_0xe3f1('0x31')]);_0x59041a[_0xe3f1('0x33')]=_['intersection'](_0x59041a['model'],_0x59041a[_0xe3f1('0x31')]);_0x2bd6e1['attributes']=_['intersection'](_0x59041a[_0xe3f1('0x30')],qs[_0xe3f1('0x35')](_0x13da17['query'][_0xe3f1('0x35')]));_0x2bd6e1['attributes']=_0x2bd6e1[_0xe3f1('0x36')][_0xe3f1('0x37')]?_0x2bd6e1[_0xe3f1('0x36')]:_0x59041a[_0xe3f1('0x30')];if(_0x13da17[_0xe3f1('0x31')]['includeAll']){_0x2bd6e1['include']=[{'all':!![]}];}_0x2bd6e1=_['merge']({},_0x2bd6e1,_0x13da17[_0xe3f1('0x46')]);return db[_0xe3f1('0x2b')]['find'](_0x2bd6e1)['then'](handleEntityNotFound(_0x1d5b33,null))[_0xe3f1('0x25')](respondWithResult(_0x1d5b33,null))[_0xe3f1('0x43')](handleError(_0x1d5b33,null));};exports[_0xe3f1('0x47')]=function(_0x7bf1d2,_0x2c366b){return db[_0xe3f1('0x2b')][_0xe3f1('0x47')](_0x7bf1d2[_0xe3f1('0x48')],{})['then'](respondWithResult(_0x2c366b,0xc9))[_0xe3f1('0x43')](handleError(_0x2c366b,null));};exports[_0xe3f1('0x24')]=function(_0x3f13da,_0x345e54){if(_0x3f13da[_0xe3f1('0x48')]['id']){delete _0x3f13da['body']['id'];}return db[_0xe3f1('0x2b')]['find']({'where':{'id':_0x3f13da['params']['id']}})[_0xe3f1('0x25')](handleEntityNotFound(_0x345e54,null))[_0xe3f1('0x25')](saveUpdates(_0x3f13da[_0xe3f1('0x48')],null))[_0xe3f1('0x25')](respondWithResult(_0x345e54,null))[_0xe3f1('0x43')](handleError(_0x345e54,null));};exports[_0xe3f1('0x49')]=function(_0x5a5e83,_0x5b7f1e){return db[_0xe3f1('0x2b')][_0xe3f1('0x4a')]({'where':{'id':_0x5a5e83['params']['id']}})[_0xe3f1('0x25')](handleEntityNotFound(_0x5b7f1e,null))[_0xe3f1('0x25')](removeEntity(_0x5b7f1e,null))[_0xe3f1('0x43')](handleError(_0x5b7f1e,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index d353b53..9bf4159 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 _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 +var _0xc0ed=['ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','path','rimraf','./intZendeskField.attributes','exports','define'];(function(_0x487c3d,_0x5a1995){var _0x576b1c=function(_0x4ac5fe){while(--_0x4ac5fe){_0x487c3d['push'](_0x487c3d['shift']());}};_0x576b1c(++_0x5a1995);}(_0xc0ed,0xb9));var _0xdc0e=function(_0x47bd48,_0x38bf3e){_0x47bd48=_0x47bd48-0x0;var _0x5e655f=_0xc0ed[_0x47bd48];return _0x5e655f;};'use strict';var _=require(_0xdc0e('0x0'));var util=require(_0xdc0e('0x1'));var logger=require(_0xdc0e('0x2'))(_0xdc0e('0x3'));var moment=require(_0xdc0e('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xdc0e('0x5'));var rimraf=require(_0xdc0e('0x6'));var config=require('../../config/environment');var attributes=require(_0xdc0e('0x7'));module[_0xdc0e('0x8')]=function(_0xa2aceb,_0xedd1df){return _0xa2aceb[_0xdc0e('0x9')](_0xdc0e('0xa'),attributes,{'tableName':_0xdc0e('0xb'),'paranoid':![],'indexes':[{'name':_0xdc0e('0xc'),'fields':[_0xdc0e('0xd'),_0xdc0e('0xe')],'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 7f1cb70..f75ee6a 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 _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 +var _0xf4d2=['error','code','ZendeskField,\x20%s,\x20%s','message','info','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','client','request','then','debug','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x2a6f87,_0x4a359f){var _0x58b881=function(_0x405650){while(--_0x405650){_0x2a6f87['push'](_0x2a6f87['shift']());}};_0x58b881(++_0x4a359f);}(_0xf4d2,0x1bb));var _0x2f4d=function(_0x5c1d2b,_0x3c2845){_0x5c1d2b=_0x5c1d2b-0x0;var _0x527841=_0xf4d2[_0x5c1d2b];return _0x527841;};'use strict';var _=require('lodash');var util=require(_0x2f4d('0x0'));var moment=require(_0x2f4d('0x1'));var BPromise=require(_0x2f4d('0x2'));var rs=require(_0x2f4d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2f4d('0x4'))['db'];var utils=require(_0x2f4d('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x2f4d('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x2f4d('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1caa92,_0x438afa,_0x3d860){return new BPromise(function(_0x3aae03,_0x266573){return client[_0x2f4d('0x8')](_0x1caa92,_0x3d860)[_0x2f4d('0x9')](function(_0x339a1e){logger['info']('ZendeskField,\x20%s,\x20%s',_0x438afa,'request\x20sent');logger[_0x2f4d('0xa')](_0x2f4d('0xb'),_0x438afa,_0x2f4d('0xc'),JSON['stringify'](_0x339a1e));if(_0x339a1e[_0x2f4d('0xd')]){if(_0x339a1e[_0x2f4d('0xd')][_0x2f4d('0xe')]===0x1f4){logger[_0x2f4d('0xd')](_0x2f4d('0xf'),_0x438afa,_0x339a1e[_0x2f4d('0xd')][_0x2f4d('0x10')]);return _0x266573(_0x339a1e[_0x2f4d('0xd')][_0x2f4d('0x10')]);}logger[_0x2f4d('0xd')](_0x2f4d('0xf'),_0x438afa,_0x339a1e[_0x2f4d('0xd')]['message']);return _0x3aae03(_0x339a1e['error'][_0x2f4d('0x10')]);}else{logger[_0x2f4d('0x11')](_0x2f4d('0xf'),_0x438afa,'request\x20sent');_0x3aae03(_0x339a1e['result']['message']);}})[_0x2f4d('0x12')](function(_0x1a0f1e){logger[_0x2f4d('0xd')](_0x2f4d('0xf'),_0x438afa,_0x1a0f1e);_0x266573(_0x1a0f1e);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 56a1323..f4ee9a6 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 _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 +var _0x892d=['getConfigurations','/:id/fields','getFields','create','post','addConfiguration','update','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','/:id','get','/:id/configurations'];(function(_0x2dffdf,_0x49a3a2){var _0x5cf31b=function(_0x25a63d){while(--_0x25a63d){_0x2dffdf['push'](_0x2dffdf['shift']());}};_0x5cf31b(++_0x49a3a2);}(_0x892d,0x9d));var _0xd892=function(_0xde7ed0,_0x5ab227){_0xde7ed0=_0xde7ed0-0x0;var _0x43dd80=_0x892d[_0xde7ed0];return _0x43dd80;};'use strict';var multer=require(_0xd892('0x0'));var util=require(_0xd892('0x1'));var path=require('path');var timeout=require(_0xd892('0x2'));var express=require(_0xd892('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd892('0x4'));var interaction=require(_0xd892('0x5'));var config=require('../../config/environment');var controller=require('./intZohoAccount.controller');router['get']('/',auth[_0xd892('0x6')](),controller[_0xd892('0x7')]);router['get'](_0xd892('0x8'),auth['isAuthenticated'](),controller['show']);router[_0xd892('0x9')](_0xd892('0xa'),auth[_0xd892('0x6')](),controller[_0xd892('0xb')]);router[_0xd892('0x9')](_0xd892('0xc'),auth[_0xd892('0x6')](),controller[_0xd892('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd892('0xe')]);router[_0xd892('0xf')](_0xd892('0xa'),auth['isAuthenticated'](),controller[_0xd892('0x10')]);router['put'](_0xd892('0x8'),auth[_0xd892('0x6')](),controller[_0xd892('0x11')]);router[_0xd892('0x12')](_0xd892('0x8'),auth[_0xd892('0x6')](),controller[_0xd892('0x13')]);module[_0xd892('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 0795a56..2d5070a 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 _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 +var _0x702d=['sequelize','exports','STRING'];(function(_0x2cfbfb,_0x32a3c7){var _0x507278=function(_0x1c791a){while(--_0x1c791a){_0x2cfbfb['push'](_0x2cfbfb['shift']());}};_0x507278(++_0x32a3c7);}(_0x702d,0x147));var _0xd702=function(_0x436533,_0x2339ec){_0x436533=_0x436533-0x0;var _0x3cf802=_0x702d[_0x436533];return _0x3cf802;};'use strict';var Sequelize=require(_0xd702('0x0'));module[_0xd702('0x1')]={'name':{'type':Sequelize[_0xd702('0x2')]},'description':{'type':Sequelize[_0xd702('0x2')]},'host':{'type':Sequelize[_0xd702('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xd702('0x2')]},'clientSecret':{'type':Sequelize[_0xd702('0x2')]},'serverUrl':{'type':Sequelize[_0xd702('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xd702('0x2')]},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index cc50782..c432e19 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 _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 +var _0x3d55=['json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','map','ZohoAccount','type','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','create','body','update','find','findOne','ZohoConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','refreshToken','clientSecret','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','clientId','serverUrl','code','zoho.eu','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','Calls','Zoho-oauthtoken\x20','response','Owner','Subject','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','push','custom_field','data_type','pick_list_values','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end'];(function(_0x2cd3d8,_0x5ddfb0){var _0x1ee6e1=function(_0x39b230){while(--_0x39b230){_0x2cd3d8['push'](_0x2cd3d8['shift']());}};_0x1ee6e1(++_0x5ddfb0);}(_0x3d55,0x165));var _0x53d5=function(_0x59ab65,_0x410a52){_0x59ab65=_0x59ab65-0x0;var _0x57db9b=_0x3d55[_0x59ab65];return _0x57db9b;};'use strict';var emlformat=require(_0x53d5('0x0'));var rimraf=require(_0x53d5('0x1'));var zipdir=require(_0x53d5('0x2'));var jsonpatch=require(_0x53d5('0x3'));var rp=require('request-promise');var moment=require(_0x53d5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x53d5('0x5'));var util=require(_0x53d5('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x53d5('0x7'));var fs=require('fs');var fs_extra=require(_0x53d5('0x8'));var _=require('lodash');var squel=require(_0x53d5('0x9'));var crypto=require(_0x53d5('0xa'));var jsforce=require(_0x53d5('0xb'));var deskjs=require(_0x53d5('0xc'));var toCsv=require('to-csv');var querystring=require(_0x53d5('0xd'));var Papa=require(_0x53d5('0xe'));var Redis=require(_0x53d5('0xf'));var authService=require(_0x53d5('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x53d5('0x11'));var logger=require(_0x53d5('0x12'))(_0x53d5('0x13'));var utils=require('../../config/utils');var config=require(_0x53d5('0x14'));var licenseUtil=require(_0x53d5('0x15'));var db=require(_0x53d5('0x16'))['db'];var integrations=require(_0x53d5('0x17'));function respondWithStatusCode(_0x4db3cb,_0x34c99a){_0x34c99a=_0x34c99a||0xcc;return function(_0x10f6c4){if(_0x10f6c4){return _0x4db3cb[_0x53d5('0x18')](_0x34c99a);}return _0x4db3cb[_0x53d5('0x19')](_0x34c99a)[_0x53d5('0x1a')]();};}function respondWithResult(_0x284868,_0xc737c0){_0xc737c0=_0xc737c0||0xc8;return function(_0x440197){if(_0x440197){return _0x284868[_0x53d5('0x19')](_0xc737c0)[_0x53d5('0x1b')](_0x440197);}};}function respondWithFilteredResult(_0x282202,_0x179bef){return function(_0x3df7b2){if(_0x3df7b2){var _0x653605=typeof _0x179bef[_0x53d5('0x1c')]===_0x53d5('0x1d')&&typeof _0x179bef[_0x53d5('0x1e')]===_0x53d5('0x1d');var _0x3afd6c=_0x3df7b2[_0x53d5('0x1f')];var _0x28f244=_0x653605?0x0:_0x179bef[_0x53d5('0x1c')];var _0x405f77=_0x653605?_0x3df7b2['count']:_0x179bef[_0x53d5('0x1c')]+_0x179bef[_0x53d5('0x1e')];var _0x290f37;if(_0x405f77>=_0x3afd6c){_0x405f77=_0x3afd6c;_0x290f37=0xc8;}else{_0x290f37=0xce;}_0x282202['status'](_0x290f37);return _0x282202[_0x53d5('0x20')](_0x53d5('0x21'),_0x28f244+'-'+_0x405f77+'/'+_0x3afd6c)[_0x53d5('0x1b')](_0x3df7b2);}return null;};}function patchUpdates(_0x1a63fe){return function(_0x128253){try{jsonpatch[_0x53d5('0x22')](_0x128253,_0x1a63fe,!![]);}catch(_0x533ef9){return BPromise[_0x53d5('0x23')](_0x533ef9);}return _0x128253[_0x53d5('0x24')]();};}function saveUpdates(_0x3e9aa0,_0x21ae52){return function(_0x488a81){if(_0x488a81){return _0x488a81['update'](_0x3e9aa0)[_0x53d5('0x25')](function(_0x19e813){return _0x19e813;});}return null;};}function removeEntity(_0x2cc685,_0x4dc3ae){return function(_0x455ed8){if(_0x455ed8){return _0x455ed8[_0x53d5('0x26')]()[_0x53d5('0x25')](function(){_0x2cc685[_0x53d5('0x19')](0xcc)[_0x53d5('0x1a')]();});}};}function handleEntityNotFound(_0x22181b,_0x3f298a){return function(_0x315c75){if(!_0x315c75){_0x22181b['sendStatus'](0x194);}return _0x315c75;};}function handleError(_0x35b80a,_0x17f742){_0x17f742=_0x17f742||0x1f4;return function(_0x134a50){logger[_0x53d5('0x27')](_0x134a50[_0x53d5('0x28')]);if(_0x134a50[_0x53d5('0x29')]){delete _0x134a50[_0x53d5('0x29')];}_0x35b80a[_0x53d5('0x19')](_0x17f742)[_0x53d5('0x2a')](_0x134a50);};}exports['index']=function(_0x1760d8,_0x3ba09f){var _0x162d4d={},_0x2b2925={},_0x31f8c3={'count':0x0,'rows':[]};var _0xfb2b4f=_[_0x53d5('0x2b')](db[_0x53d5('0x2c')]['rawAttributes'],function(_0x391fd3){return{'name':_0x391fd3['fieldName'],'type':_0x391fd3[_0x53d5('0x2d')]['key']};});_0x2b2925[_0x53d5('0x2e')]=_['map'](_0xfb2b4f,'name');_0x2b2925[_0x53d5('0x2f')]=_[_0x53d5('0x30')](_0x1760d8[_0x53d5('0x2f')]);_0x2b2925['filters']=_['intersection'](_0x2b2925[_0x53d5('0x2e')],_0x2b2925['query']);_0x162d4d['attributes']=_[_0x53d5('0x31')](_0x2b2925[_0x53d5('0x2e')],qs[_0x53d5('0x32')](_0x1760d8[_0x53d5('0x2f')][_0x53d5('0x32')]));_0x162d4d[_0x53d5('0x33')]=_0x162d4d[_0x53d5('0x33')]['length']?_0x162d4d[_0x53d5('0x33')]:_0x2b2925[_0x53d5('0x2e')];if(!_0x1760d8[_0x53d5('0x2f')][_0x53d5('0x34')](_0x53d5('0x35'))){_0x162d4d['limit']=qs[_0x53d5('0x1e')](_0x1760d8[_0x53d5('0x2f')][_0x53d5('0x1e')]);_0x162d4d[_0x53d5('0x1c')]=qs[_0x53d5('0x1c')](_0x1760d8['query'][_0x53d5('0x1c')]);}_0x162d4d[_0x53d5('0x36')]=qs['sort'](_0x1760d8[_0x53d5('0x2f')][_0x53d5('0x37')]);_0x162d4d[_0x53d5('0x38')]=qs['filters'](_[_0x53d5('0x39')](_0x1760d8[_0x53d5('0x2f')],_0x2b2925[_0x53d5('0x3a')]),_0xfb2b4f);if(_0x1760d8[_0x53d5('0x2f')][_0x53d5('0x3b')]){_0x162d4d['where']=_['merge'](_0x162d4d['where'],{'$or':_[_0x53d5('0x2b')](_0xfb2b4f,function(_0x20f1fa){if(_0x20f1fa[_0x53d5('0x2d')]!=='VIRTUAL'){var _0x37091a={};_0x37091a[_0x20f1fa['name']]={'$like':'%'+_0x1760d8[_0x53d5('0x2f')]['filter']+'%'};return _0x37091a;}})});}_0x162d4d=_[_0x53d5('0x3c')]({},_0x162d4d,_0x1760d8[_0x53d5('0x3d')]);var _0x7df39f={'where':_0x162d4d['where']};return db[_0x53d5('0x2c')]['count'](_0x7df39f)[_0x53d5('0x25')](function(_0xef9dc2){_0x31f8c3['count']=_0xef9dc2;if(_0x1760d8[_0x53d5('0x2f')][_0x53d5('0x3e')]){_0x162d4d[_0x53d5('0x3f')]=[{'all':!![]}];}return db[_0x53d5('0x2c')][_0x53d5('0x40')](_0x162d4d);})[_0x53d5('0x25')](function(_0x35beb0){_0x31f8c3[_0x53d5('0x41')]=_0x35beb0;return _0x31f8c3;})[_0x53d5('0x25')](respondWithFilteredResult(_0x3ba09f,_0x162d4d))[_0x53d5('0x42')](handleError(_0x3ba09f,null));};exports[_0x53d5('0x43')]=function(_0x136beb,_0x5563f0){var _0x4eb2ab={'raw':![],'where':{'id':_0x136beb[_0x53d5('0x44')]['id']}},_0x34b77e={};_0x34b77e['model']=_[_0x53d5('0x30')](db[_0x53d5('0x2c')][_0x53d5('0x45')]);_0x34b77e[_0x53d5('0x2f')]=_[_0x53d5('0x30')](_0x136beb[_0x53d5('0x2f')]);_0x34b77e['filters']=_[_0x53d5('0x31')](_0x34b77e[_0x53d5('0x2e')],_0x34b77e['query']);_0x4eb2ab[_0x53d5('0x33')]=_['intersection'](_0x34b77e[_0x53d5('0x2e')],qs[_0x53d5('0x32')](_0x136beb[_0x53d5('0x2f')][_0x53d5('0x32')]));_0x4eb2ab[_0x53d5('0x33')]=_0x4eb2ab['attributes'][_0x53d5('0x46')]?_0x4eb2ab['attributes']:_0x34b77e[_0x53d5('0x2e')];if(_0x136beb['query'][_0x53d5('0x3e')]){_0x4eb2ab['include']=[{'all':!![]}];}_0x4eb2ab=_['merge']({},_0x4eb2ab,_0x136beb[_0x53d5('0x3d')]);return db['ZohoAccount']['find'](_0x4eb2ab)[_0x53d5('0x25')](handleEntityNotFound(_0x5563f0,null))[_0x53d5('0x25')](respondWithResult(_0x5563f0,null))[_0x53d5('0x42')](handleError(_0x5563f0,null));};exports[_0x53d5('0x47')]=function(_0x2056cf,_0x5ceb26){return db[_0x53d5('0x2c')][_0x53d5('0x47')](_0x2056cf[_0x53d5('0x48')],{})['then'](respondWithResult(_0x5ceb26,0xc9))['catch'](handleError(_0x5ceb26,null));};exports[_0x53d5('0x49')]=function(_0x28abda,_0x1ab1be){if(_0x28abda[_0x53d5('0x48')]['id']){delete _0x28abda[_0x53d5('0x48')]['id'];}return db['ZohoAccount'][_0x53d5('0x4a')]({'where':{'id':_0x28abda[_0x53d5('0x44')]['id']}})[_0x53d5('0x25')](handleEntityNotFound(_0x1ab1be,null))[_0x53d5('0x25')](saveUpdates(_0x28abda[_0x53d5('0x48')],null))[_0x53d5('0x25')](respondWithResult(_0x1ab1be,null))[_0x53d5('0x42')](handleError(_0x1ab1be,null));};exports[_0x53d5('0x26')]=function(_0x5c8f7b,_0x3bc71b){return db[_0x53d5('0x2c')]['find']({'where':{'id':_0x5c8f7b[_0x53d5('0x44')]['id']}})['then'](handleEntityNotFound(_0x3bc71b,null))[_0x53d5('0x25')](removeEntity(_0x3bc71b,null))[_0x53d5('0x42')](handleError(_0x3bc71b,null));};exports['getConfigurations']=function(_0xfcc27e,_0xb5b38b,_0x2e1307){var _0x41a610={};var _0x1a250a={};var _0x135b0e;var _0x1cb35c;return db[_0x53d5('0x2c')][_0x53d5('0x4b')]({'where':{'id':_0xfcc27e['params']['id']}})['then'](handleEntityNotFound(_0xb5b38b,null))[_0x53d5('0x25')](function(_0x4de1fe){if(_0x4de1fe){_0x135b0e=_0x4de1fe;_0x1a250a['model']=_[_0x53d5('0x30')](db[_0x53d5('0x4c')][_0x53d5('0x45')]);_0x1a250a[_0x53d5('0x2f')]=_['keys'](_0xfcc27e[_0x53d5('0x2f')]);_0x1a250a[_0x53d5('0x3a')]=_[_0x53d5('0x31')](_0x1a250a[_0x53d5('0x2e')],_0x1a250a[_0x53d5('0x2f')]);_0x41a610[_0x53d5('0x33')]=_[_0x53d5('0x31')](_0x1a250a[_0x53d5('0x2e')],qs['fields'](_0xfcc27e[_0x53d5('0x2f')][_0x53d5('0x32')]));_0x41a610['attributes']=_0x41a610[_0x53d5('0x33')][_0x53d5('0x46')]?_0x41a610[_0x53d5('0x33')]:_0x1a250a[_0x53d5('0x2e')];_0x41a610[_0x53d5('0x36')]=qs[_0x53d5('0x37')](_0xfcc27e[_0x53d5('0x2f')][_0x53d5('0x37')]);_0x41a610['where']=qs[_0x53d5('0x3a')](_['pick'](_0xfcc27e[_0x53d5('0x2f')],_0x1a250a[_0x53d5('0x3a')]));if(_0xfcc27e['query']['filter']){_0x41a610[_0x53d5('0x38')]=_[_0x53d5('0x3c')](_0x41a610[_0x53d5('0x38')],{'$or':_[_0x53d5('0x2b')](_0x41a610['attributes'],function(_0x13dda5){var _0x56fdb2={};_0x56fdb2[_0x13dda5]={'$like':'%'+_0xfcc27e[_0x53d5('0x2f')][_0x53d5('0x3b')]+'%'};return _0x56fdb2;})});}_0x41a610=_['merge']({},_0x41a610,_0xfcc27e['options']);return _0x135b0e[_0x53d5('0x4d')](_0x41a610);}})[_0x53d5('0x25')](function(_0x12ab70){if(_0x12ab70){_0x1cb35c=_0x12ab70[_0x53d5('0x46')];if(!_0xfcc27e[_0x53d5('0x2f')]['hasOwnProperty'](_0x53d5('0x35'))){_0x41a610[_0x53d5('0x1e')]=qs[_0x53d5('0x1e')](_0xfcc27e[_0x53d5('0x2f')]['limit']);_0x41a610[_0x53d5('0x1c')]=qs[_0x53d5('0x1c')](_0xfcc27e[_0x53d5('0x2f')][_0x53d5('0x1c')]);}return _0x135b0e[_0x53d5('0x4d')](_0x41a610);}})[_0x53d5('0x25')](function(_0x2aa8c3){if(_0x2aa8c3){return _0x2aa8c3?{'count':_0x1cb35c,'rows':_0x2aa8c3}:null;}})[_0x53d5('0x25')](respondWithResult(_0xb5b38b,null))[_0x53d5('0x42')](handleError(_0xb5b38b,null));};exports[_0x53d5('0x4e')]=function(_0x565f73,_0x29f5d6,_0x453082){if(_0x565f73[_0x53d5('0x48')]['id']){delete _0x565f73['body']['id'];}return db[_0x53d5('0x2c')]['findOne']({'where':{'id':_0x565f73[_0x53d5('0x44')]['id']}})['then'](handleEntityNotFound(_0x29f5d6,null))[_0x53d5('0x25')](function(_0x2993e9){if(_0x2993e9){_0x565f73[_0x53d5('0x48')][_0x53d5('0x4f')]=_0x2993e9['id'];_0x565f73[_0x53d5('0x48')][_0x53d5('0x50')]=integrations[_0x53d5('0x51')](_0x565f73['body'][_0x53d5('0x52')],_0x565f73['body'][_0x53d5('0x2d')]);_0x565f73['body'][_0x53d5('0x53')]=integrations['getDescriptions'](_0x565f73[_0x53d5('0x48')][_0x53d5('0x52')],_0x565f73[_0x53d5('0x48')]['type']);return db[_0x53d5('0x4c')][_0x53d5('0x47')](_0x565f73[_0x53d5('0x48')],{'include':[{'model':db[_0x53d5('0x54')],'as':'Subjects'},{'model':db[_0x53d5('0x54')],'as':_0x53d5('0x53')}]});}return null;})['then'](respondWithResult(_0x29f5d6,null))[_0x53d5('0x42')](handleError(_0x29f5d6,null));};function getAccessToken(_0x1d9693){return new Promise(function(_0x1c9574,_0x2c13b1){var _0xfb8584;switch(_0x1d9693[_0x53d5('0x55')]){case'US':_0xfb8584=_0x53d5('0x56');break;case'AU':_0xfb8584=_0x53d5('0x57');break;case'EU':_0xfb8584=_0x53d5('0x58');break;case'IN':_0xfb8584=_0x53d5('0x59');break;case'CN':_0xfb8584='https://accounts.zoho.com.cn';break;default:_0xfb8584='https://accounts.zoho.eu';break;}var _0x37d422={'method':_0x53d5('0x5a'),'uri':_0xfb8584+_0x53d5('0x5b'),'qs':{'refresh_token':_0x1d9693[_0x53d5('0x5c')],'client_id':_0x1d9693['clientId'],'client_secret':_0x1d9693[_0x53d5('0x5d')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x37d422)['then'](function(_0x2bbb44){if(_0x2bbb44[_0x53d5('0x5e')]){_0x1c9574(_0x2bbb44['access_token']);}else{_0x2c13b1(_0x53d5('0x5f'));}})[_0x53d5('0x42')](function(_0x30451f){_0x2c13b1(_0x30451f);});});}exports[_0x53d5('0x60')]=function(_0x328a79,_0x2c8304,_0x490b1e){var _0x405f20,_0x358e29,_0x44d894,_0x1fa910,_0x40d8a7;return db[_0x53d5('0x2c')][_0x53d5('0x4b')]({'where':{'id':_0x328a79[_0x53d5('0x44')]['id']},'attributes':['id',_0x53d5('0x61'),_0x53d5('0x55'),_0x53d5('0x62'),_0x53d5('0x5d'),_0x53d5('0x63'),_0x53d5('0x64'),_0x53d5('0x5c')]})[_0x53d5('0x25')](handleEntityNotFound(_0x2c8304,null))[_0x53d5('0x25')](function(_0x10ba4f){_0x40d8a7=_0x10ba4f;_0x405f20=_0x40d8a7[_0x53d5('0x61')];_0x358e29=_0x405f20===_0x53d5('0x65')?'eu':'com';_0x44d894=_0x40d8a7['serverUrl'];var _0x54d5ea=_0x44d894['slice'](-0x1);if(_0x54d5ea==='/'||_0x54d5ea==='\x5c'||_0x54d5ea===':'){_0x44d894=_0x44d894[_0x53d5('0x66')](0x0,_0x44d894[_0x53d5('0x67')](_0x54d5ea));}if(!_0x40d8a7[_0x53d5('0x5c')]){throw new Error(_0x53d5('0x68'));}return getAccessToken(_0x40d8a7);})[_0x53d5('0x25')](function(_0x3a4bf4){if(_0x3a4bf4){return rp({'method':_0x53d5('0x69'),'uri':util['format']('https://www.zohoapis.%s/crm/v2/settings/fields',_0x358e29),'qs':{'module':_0x53d5('0x6a')},'headers':{'Authorization':_0x53d5('0x6b')+_0x3a4bf4},'json':!![]});}})[_0x53d5('0x25')](function(_0x51d95f){if(_0x51d95f){if(_0x51d95f[_0x53d5('0x6c')]&&_0x51d95f['response'][_0x53d5('0x27')]){throw new Error(_0x51d95f[_0x53d5('0x6c')][_0x53d5('0x27')]['message']);}var _0x4f17c4=[];var _0x1aa094=[];var _0x470f99=[_0x53d5('0x6d'),_0x53d5('0x6e'),'Description',_0x53d5('0x6f'),_0x53d5('0x70'),_0x53d5('0x71'),_0x53d5('0x72'),_0x53d5('0x73')];_0x1aa094=_[_0x53d5('0x74')](_0x51d95f[_0x53d5('0x32')],function(_0xfbdc67){return _0x470f99[_0x53d5('0x75')](_0xfbdc67[_0x53d5('0x76')]);});for(var _0x4533ef=0x0;_0x4533ef<_0x1aa094[_0x53d5('0x46')];_0x4533ef++){if(_0x1aa094[_0x4533ef][_0x53d5('0x77')]===![]){_0x4f17c4[_0x53d5('0x78')]({'id':_0x1aa094[_0x4533ef]['id'],'name':_0x1aa094[_0x4533ef]['display_label'],'custom':_0x1aa094[_0x4533ef][_0x53d5('0x79')],'options':_0x1aa094[_0x4533ef][_0x53d5('0x7a')]==='picklist'&&_0x1aa094[_0x4533ef][_0x53d5('0x7b')]['length']>-0x1?_[_0x53d5('0x2b')](_0x1aa094[_0x4533ef][_0x53d5('0x7b')],function(_0x261dd3){return{'name':_0x261dd3,'value':_0x261dd3};}):[]});}}return{'count':_0x4f17c4[_0x53d5('0x46')],'rows':_0x4f17c4};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x2c8304,null))['catch'](function(_0x18371c){var _0x54bcca=_0x328a79['query'][_0x53d5('0x7c')]?0x1f4:_0x18371c[_0x53d5('0x7d')]||0x1f4;logger[_0x53d5('0x27')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x54bcca,JSON[_0x53d5('0x7e')](_0x18371c));delete _0x18371c[_0x53d5('0x29')];if(_0x54bcca===0x191){_0x54bcca=0x190;}_0x2c8304['status'](_0x54bcca)[_0x53d5('0x2a')](_0x328a79['query'][_0x53d5('0x7c')]?{'message':_0x53d5('0x7f'),'statusCode':_0x18371c['statusCode']}:_0x18371c);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 660692f..2206f7e 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 _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 +var _0x745b=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','define','changed','zone','serverUrl','clientSecret','host','slice','lastIndexOf','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','clientId','code','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','substring','https://accounts.zoho.com.au','https://accounts.zoho.in','catch','lodash'];(function(_0x5bcadb,_0x35270a){var _0x501049=function(_0xa2c00b){while(--_0xa2c00b){_0x5bcadb['push'](_0x5bcadb['shift']());}};_0x501049(++_0x35270a);}(_0x745b,0x125));var _0xb745=function(_0x4f977a,_0x33a702){_0x4f977a=_0x4f977a-0x0;var _0x3617c5=_0x745b[_0x4f977a];return _0x3617c5;};'use strict';var _=require(_0xb745('0x0'));var util=require(_0xb745('0x1'));var logger=require(_0xb745('0x2'))(_0xb745('0x3'));var moment=require(_0xb745('0x4'));var BPromise=require(_0xb745('0x5'));var rp=require(_0xb745('0x6'));var fs=require('fs');var path=require(_0xb745('0x7'));var rimraf=require('rimraf');var config=require(_0xb745('0x8'));var attributes=require(_0xb745('0x9'));var integrations=require(_0xb745('0xa'));module['exports']=function(_0x1dcd98,_0x20d052){return _0x1dcd98[_0xb745('0xb')]('ZohoAccount',attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3c9f1e,_0x3789e7,_0x2aa15a){if(_0x3c9f1e[_0xb745('0xc')](_0xb745('0xd'))||_0x3c9f1e[_0xb745('0xc')](_0xb745('0xe'))||_0x3c9f1e[_0xb745('0xc')]('clientId')||_0x3c9f1e[_0xb745('0xc')](_0xb745('0xf'))||_0x3c9f1e['changed']('code')||_0x3c9f1e[_0xb745('0xc')](_0xb745('0x10'))){var _0xe7147c,_0x3969e0;_0xe7147c=_0x3c9f1e[_0xb745('0xe')];var _0x1294fb=_0xe7147c[_0xb745('0x11')](-0x1);if(_0x1294fb==='/'||_0x1294fb==='\x5c'||_0x1294fb===':'){_0xe7147c=_0xe7147c['substring'](0x0,_0xe7147c[_0xb745('0x12')](_0x1294fb));}switch(_0x3c9f1e['zone']){case'US':_0x3969e0='https://accounts.zoho.com';break;case'AU':_0x3969e0='https://accounts.zoho.com.au';break;case'IN':_0x3969e0='https://accounts.zoho.in';break;case'CN':_0x3969e0=_0xb745('0x13');break;default:_0x3969e0=_0xb745('0x14');break;}var _0x5dd8da={'method':_0xb745('0x15'),'uri':_0x3969e0+_0xb745('0x16'),'form':{'grant_type':_0xb745('0x17'),'client_id':_0x3c9f1e[_0xb745('0x18')],'client_secret':_0x3c9f1e[_0xb745('0xf')],'redirect_uri':_0x3c9f1e[_0xb745('0xe')],'code':_0x3c9f1e[_0xb745('0x19')]},'headers':{'Content-Type':_0xb745('0x1a')}};return rp(_0x5dd8da)[_0xb745('0x1b')](function(_0x5ba942){var _0x1b4917=JSON[_0xb745('0x1c')](_0x5ba942);if(_0x1b4917[_0xb745('0x1d')]){_0x3c9f1e[_0xb745('0x1e')]=_0x1b4917[_0xb745('0x1d')];logger[_0xb745('0x1f')](util[_0xb745('0x20')](_0xb745('0x21'),_0x3c9f1e[_0xb745('0x22')],_0x3c9f1e['id']));}else{logger[_0xb745('0x23')](util['format'](_0xb745('0x24'),_0x3c9f1e[_0xb745('0x22')],_0x3c9f1e['id']),util[_0xb745('0x25')](_0x1b4917,{'showHidden':![],'depth':null}));}return _0x2aa15a(null,_0x3789e7);})['catch'](function(_0x318939){logger[_0xb745('0x23')](util[_0xb745('0x20')](_0xb745('0x24'),_0x3c9f1e[_0xb745('0x22')],_0x3c9f1e['id']),util[_0xb745('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x2aa15a(_0x318939);});}else{return _0x2aa15a(null,_0x3789e7);}},'beforeUpdate':function(_0x2624e0,_0x387154,_0x16eb67){if(_0x2624e0[_0xb745('0xc')](_0xb745('0xd'))||_0x2624e0[_0xb745('0xc')](_0xb745('0xe'))||_0x2624e0[_0xb745('0xc')](_0xb745('0x18'))||_0x2624e0[_0xb745('0xc')](_0xb745('0xf'))||_0x2624e0[_0xb745('0xc')](_0xb745('0x19'))||_0x2624e0[_0xb745('0xc')](_0xb745('0x10'))){var _0x317dd1,_0x149f0f;_0x317dd1=_0x2624e0[_0xb745('0xe')];var _0x3e3a24=_0x317dd1[_0xb745('0x11')](-0x1);if(_0x3e3a24==='/'||_0x3e3a24==='\x5c'||_0x3e3a24===':'){_0x317dd1=_0x317dd1[_0xb745('0x26')](0x0,_0x317dd1['lastIndexOf'](_0x3e3a24));}switch(_0x2624e0[_0xb745('0xd')]){case'US':_0x149f0f='https://accounts.zoho.com';break;case'AU':_0x149f0f=_0xb745('0x27');break;case'IN':_0x149f0f=_0xb745('0x28');break;case'CN':_0x149f0f=_0xb745('0x13');break;default:_0x149f0f=_0xb745('0x14');break;}var _0x121f5f={'method':_0xb745('0x15'),'uri':_0x149f0f+'/oauth/v2/token','form':{'grant_type':_0xb745('0x17'),'client_id':_0x2624e0[_0xb745('0x18')],'client_secret':_0x2624e0[_0xb745('0xf')],'redirect_uri':_0x2624e0[_0xb745('0xe')],'code':_0x2624e0[_0xb745('0x19')]},'headers':{'Content-Type':_0xb745('0x1a')}};return rp(_0x121f5f)['then'](function(_0x32a9f6){var _0x2744fa=JSON['parse'](_0x32a9f6);if(_0x2744fa[_0xb745('0x1d')]){_0x2624e0[_0xb745('0x1e')]=_0x2744fa['refresh_token'];logger[_0xb745('0x1f')](util[_0xb745('0x20')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x2624e0[_0xb745('0x22')],_0x2624e0['id']));}else{logger['error'](util['format'](_0xb745('0x24'),_0x2624e0['name'],_0x2624e0['id']),util[_0xb745('0x25')](_0x2744fa,{'showHidden':![],'depth':null}));}return _0x16eb67(null,_0x387154);})[_0xb745('0x29')](function(_0x46f6d2){logger['error'](util['format'](_0xb745('0x24'),_0x2624e0[_0xb745('0x22')],_0x2624e0['id']),util[_0xb745('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x16eb67(_0x46f6d2);});}else{return _0x16eb67(null,_0x387154);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index eef49ae..3249069 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 _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 +var _0x65cb=['stringify','error','code','message','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','debug','find','ShowZohoAccount','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s'];(function(_0x2b477c,_0x25edf5){var _0x36af20=function(_0x281052){while(--_0x281052){_0x2b477c['push'](_0x2b477c['shift']());}};_0x36af20(++_0x25edf5);}(_0x65cb,0xa4));var _0xb65c=function(_0x292830,_0x2fcac2){_0x292830=_0x292830-0x0;var _0x23d6f7=_0x65cb[_0x292830];return _0x23d6f7;};'use strict';var _=require(_0xb65c('0x0'));var util=require('util');var moment=require(_0xb65c('0x1'));var BPromise=require(_0xb65c('0x2'));var rs=require(_0xb65c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb65c('0x4'))['db'];var utils=require(_0xb65c('0x5'));var logger=require(_0xb65c('0x6'))(_0xb65c('0x7'));var config=require(_0xb65c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb65c('0x9')][_0xb65c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25087d,_0xacb77d,_0x112f07){return new BPromise(function(_0x23dffb,_0x22b6a3){return client[_0xb65c('0xb')](_0x25087d,_0x112f07)['then'](function(_0x43e68f){logger[_0xb65c('0xc')](_0xb65c('0xd'),_0xacb77d,_0xb65c('0xe'));logger['debug'](_0xb65c('0xf'),_0xacb77d,'request\x20sent',JSON[_0xb65c('0x10')](_0x43e68f));if(_0x43e68f[_0xb65c('0x11')]){if(_0x43e68f[_0xb65c('0x11')][_0xb65c('0x12')]===0x1f4){logger[_0xb65c('0x11')](_0xb65c('0xd'),_0xacb77d,_0x43e68f['error'][_0xb65c('0x13')]);return _0x22b6a3(_0x43e68f[_0xb65c('0x11')][_0xb65c('0x13')]);}logger[_0xb65c('0x11')](_0xb65c('0xd'),_0xacb77d,_0x43e68f[_0xb65c('0x11')][_0xb65c('0x13')]);return _0x23dffb(_0x43e68f['error'][_0xb65c('0x13')]);}else{logger[_0xb65c('0xc')]('ZohoAccount,\x20%s,\x20%s',_0xacb77d,_0xb65c('0xe'));_0x23dffb(_0x43e68f['result'][_0xb65c('0x13')]);}})[_0xb65c('0x14')](function(_0x2666e4){logger[_0xb65c('0x11')](_0xb65c('0xd'),_0xacb77d,_0x2666e4);_0x22b6a3(_0x2666e4);});});}exports[_0xb65c('0x15')]=function(_0x1bca9d){var _0x203c7b=this;return new Promise(function(_0x199b13,_0x74a729){return db[_0xb65c('0x16')][_0xb65c('0x17')]({'raw':_0x1bca9d[_0xb65c('0x18')]?_0x1bca9d[_0xb65c('0x18')][_0xb65c('0x19')]===undefined?!![]:![]:!![],'where':_0x1bca9d['options']?_0x1bca9d[_0xb65c('0x18')][_0xb65c('0x1a')]||null:null,'attributes':_0x1bca9d[_0xb65c('0x18')]?_0x1bca9d[_0xb65c('0x18')][_0xb65c('0x1b')]||null:null,'limit':_0x1bca9d[_0xb65c('0x18')]?_0x1bca9d[_0xb65c('0x18')][_0xb65c('0x1c')]||null:null,'include':_0x1bca9d[_0xb65c('0x18')]?_0x1bca9d[_0xb65c('0x18')][_0xb65c('0x1d')]?_[_0xb65c('0x1e')](_0x1bca9d[_0xb65c('0x18')][_0xb65c('0x1d')],function(_0xe16c8f){return{'model':db[_0xe16c8f[_0xb65c('0x1f')]],'as':_0xe16c8f['as'],'attributes':_0xe16c8f[_0xb65c('0x1b')],'include':_0xe16c8f['include']?_[_0xb65c('0x1e')](_0xe16c8f[_0xb65c('0x1d')],function(_0x29c0c0){return{'model':db[_0x29c0c0['model']],'as':_0x29c0c0['as'],'attributes':_0x29c0c0[_0xb65c('0x1b')],'include':_0x29c0c0[_0xb65c('0x1d')]?_['map'](_0x29c0c0['include'],function(_0x4033bd){return{'model':db[_0x4033bd[_0xb65c('0x1f')]],'as':_0x4033bd['as'],'attributes':_0x4033bd[_0xb65c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb65c('0x20')](function(_0x4a9b0c){logger[_0xb65c('0xc')](_0xb65c('0x15'),_0x1bca9d);logger[_0xb65c('0x21')](_0xb65c('0x15'),_0x1bca9d,JSON[_0xb65c('0x10')](_0x4a9b0c));_0x199b13(_0x4a9b0c);})[_0xb65c('0x14')](function(_0x5158d9){logger[_0xb65c('0x11')](_0xb65c('0x15'),_0x5158d9[_0xb65c('0x13')],_0x1bca9d);_0x74a729(_0x203c7b['error'](0x1f4,_0x5158d9[_0xb65c('0x13')]));});});};exports['ShowZohoAccount']=function(_0x393320){var _0x1284cd=this;return new Promise(function(_0x48eb26,_0x123cf4){return db[_0xb65c('0x16')][_0xb65c('0x22')]({'raw':_0x393320[_0xb65c('0x18')]?_0x393320[_0xb65c('0x18')][_0xb65c('0x19')]===undefined?!![]:![]:!![],'where':_0x393320[_0xb65c('0x18')]?_0x393320[_0xb65c('0x18')]['where']||null:null,'attributes':_0x393320[_0xb65c('0x18')]?_0x393320[_0xb65c('0x18')][_0xb65c('0x1b')]||null:null,'include':_0x393320['options']?_0x393320['options'][_0xb65c('0x1d')]?_['map'](_0x393320[_0xb65c('0x18')]['include'],function(_0x34c7c1){return{'model':db[_0x34c7c1[_0xb65c('0x1f')]],'as':_0x34c7c1['as'],'attributes':_0x34c7c1[_0xb65c('0x1b')],'include':_0x34c7c1[_0xb65c('0x1d')]?_['map'](_0x34c7c1[_0xb65c('0x1d')],function(_0x590520){return{'model':db[_0x590520[_0xb65c('0x1f')]],'as':_0x590520['as'],'attributes':_0x590520['attributes'],'include':_0x590520[_0xb65c('0x1d')]?_[_0xb65c('0x1e')](_0x590520[_0xb65c('0x1d')],function(_0x2b9c85){return{'model':db[_0x2b9c85['model']],'as':_0x2b9c85['as'],'attributes':_0x2b9c85[_0xb65c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb65c('0x20')](function(_0x272bd9){logger['info'](_0xb65c('0x23'),_0x393320);logger[_0xb65c('0x21')]('ShowZohoAccount',_0x393320,JSON['stringify'](_0x272bd9));_0x48eb26(_0x272bd9);})[_0xb65c('0x14')](function(_0x18f21c){logger[_0xb65c('0x11')](_0xb65c('0x23'),_0x18f21c['message'],_0x393320);_0x123cf4(_0x1284cd[_0xb65c('0x11')](0x1f4,_0x18f21c[_0xb65c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 77e0c1c..0d346a5 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 _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 +var _0x8e7a=['/:id/fields','getSubjects','/:id/descriptions','getDescriptions','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x48df82,_0x31b380){var _0x3350ce=function(_0x31876c){while(--_0x31876c){_0x48df82['push'](_0x48df82['shift']());}};_0x3350ce(++_0x31b380);}(_0x8e7a,0x112));var _0xa8e7=function(_0x36d0af,_0x3f6f87){_0x36d0af=_0x36d0af-0x0;var _0x132e35=_0x8e7a[_0x36d0af];return _0x132e35;};'use strict';var multer=require(_0xa8e7('0x0'));var util=require(_0xa8e7('0x1'));var path=require(_0xa8e7('0x2'));var timeout=require(_0xa8e7('0x3'));var express=require(_0xa8e7('0x4'));var router=express['Router']();var fs_extra=require(_0xa8e7('0x5'));var auth=require(_0xa8e7('0x6'));var interaction=require(_0xa8e7('0x7'));var config=require(_0xa8e7('0x8'));var controller=require('./intZohoConfiguration.controller');router[_0xa8e7('0x9')]('/',auth[_0xa8e7('0xa')](),controller[_0xa8e7('0xb')]);router[_0xa8e7('0x9')](_0xa8e7('0xc'),auth['isAuthenticated'](),controller[_0xa8e7('0xd')]);router['get'](_0xa8e7('0xe'),auth[_0xa8e7('0xa')](),controller['getFields']);router[_0xa8e7('0x9')]('/:id/subjects',auth[_0xa8e7('0xa')](),controller[_0xa8e7('0xf')]);router['get'](_0xa8e7('0x10'),auth[_0xa8e7('0xa')](),controller[_0xa8e7('0x11')]);router['post']('/',auth[_0xa8e7('0xa')](),controller[_0xa8e7('0x12')]);router[_0xa8e7('0x13')]('/:id',auth[_0xa8e7('0xa')](),controller[_0xa8e7('0x14')]);router[_0xa8e7('0x15')]('/:id',auth[_0xa8e7('0xa')](),controller[_0xa8e7('0x16')]);module[_0xa8e7('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 3529706..1088663 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 _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 +var _0xfdd7=['ENUM','contact','nothing','lead','contact_lead','STRING','sequelize','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfdd7,0x156));var _0x7fdd=function(_0xce974e,_0x414bc4){_0xce974e=_0xce974e-0x0;var _0x4cc8c4=_0xfdd7[_0xce974e];return _0x4cc8c4;};'use strict';var Sequelize=require(_0x7fdd('0x0'));module[_0x7fdd('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0x7fdd('0x2')]('lead',_0x7fdd('0x3'),_0x7fdd('0x4')),'defaultValue':_0x7fdd('0x5')},'moduleSearch':{'type':Sequelize[_0x7fdd('0x2')](_0x7fdd('0x6'),_0x7fdd('0x3'),'lead'),'defaultValue':_0x7fdd('0x6')},'description':{'type':Sequelize[_0x7fdd('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index a4a4296..db37bd6 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 _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 +var _0x935a=['end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','ZohoConfiguration','rawAttributes','type','key','model','map','query','keys','filters','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','catch','show','params','includeAll','options','find','create','body','findOne','ZohoField','intersection','hasOwnProperty','getFields','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x935a,0xd2));var _0xa935=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x935a[_0x1e4360];return _0x31e6b4;};'use strict';var emlformat=require(_0xa935('0x0'));var rimraf=require(_0xa935('0x1'));var zipdir=require(_0xa935('0x2'));var jsonpatch=require(_0xa935('0x3'));var rp=require('request-promise');var moment=require(_0xa935('0x4'));var BPromise=require(_0xa935('0x5'));var Mustache=require(_0xa935('0x6'));var util=require(_0xa935('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xa935('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa935('0x9'));var _=require('lodash');var squel=require(_0xa935('0xa'));var crypto=require(_0xa935('0xb'));var jsforce=require(_0xa935('0xc'));var deskjs=require(_0xa935('0xd'));var toCsv=require('to-csv');var querystring=require(_0xa935('0xe'));var Papa=require('papaparse');var Redis=require(_0xa935('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa935('0x10'));var hardwareService=require(_0xa935('0x11'));var logger=require(_0xa935('0x12'))('api');var utils=require(_0xa935('0x13'));var config=require(_0xa935('0x14'));var licenseUtil=require(_0xa935('0x15'));var db=require(_0xa935('0x16'))['db'];function respondWithStatusCode(_0x137256,_0x210b32){_0x210b32=_0x210b32||0xcc;return function(_0x4a53ad){if(_0x4a53ad){return _0x137256['sendStatus'](_0x210b32);}return _0x137256[_0xa935('0x17')](_0x210b32)[_0xa935('0x18')]();};}function respondWithResult(_0xc409fd,_0x70474c){_0x70474c=_0x70474c||0xc8;return function(_0x1b7058){if(_0x1b7058){return _0xc409fd[_0xa935('0x17')](_0x70474c)[_0xa935('0x19')](_0x1b7058);}};}function respondWithFilteredResult(_0x18049b,_0x5e4b41){return function(_0x3e46c4){if(_0x3e46c4){var _0x3ca535=typeof _0x5e4b41[_0xa935('0x1a')]==='undefined'&&typeof _0x5e4b41['limit']===_0xa935('0x1b');var _0x4c9575=_0x3e46c4[_0xa935('0x1c')];var _0x39c2d5=_0x3ca535?0x0:_0x5e4b41[_0xa935('0x1a')];var _0xc6650a=_0x3ca535?_0x3e46c4[_0xa935('0x1c')]:_0x5e4b41[_0xa935('0x1a')]+_0x5e4b41[_0xa935('0x1d')];var _0x4a5eb3;if(_0xc6650a>=_0x4c9575){_0xc6650a=_0x4c9575;_0x4a5eb3=0xc8;}else{_0x4a5eb3=0xce;}_0x18049b[_0xa935('0x17')](_0x4a5eb3);return _0x18049b[_0xa935('0x1e')](_0xa935('0x1f'),_0x39c2d5+'-'+_0xc6650a+'/'+_0x4c9575)[_0xa935('0x19')](_0x3e46c4);}return null;};}function patchUpdates(_0x47f0b6){return function(_0x3b7e2c){try{jsonpatch[_0xa935('0x20')](_0x3b7e2c,_0x47f0b6,!![]);}catch(_0x1164b1){return BPromise['reject'](_0x1164b1);}return _0x3b7e2c[_0xa935('0x21')]();};}function saveUpdates(_0x1e9620,_0xbe29bd){return function(_0x246932){if(_0x246932){return _0x246932[_0xa935('0x22')](_0x1e9620)[_0xa935('0x23')](function(_0x32d4cb){return _0x32d4cb;});}return null;};}function removeEntity(_0x32339f,_0x2a1ecc){return function(_0x155d07){if(_0x155d07){return _0x155d07[_0xa935('0x24')]()[_0xa935('0x23')](function(){_0x32339f['status'](0xcc)[_0xa935('0x18')]();});}};}function handleEntityNotFound(_0x18723d,_0x5c2e5c){return function(_0x48be44){if(!_0x48be44){_0x18723d['sendStatus'](0x194);}return _0x48be44;};}function handleError(_0x9b97,_0xa217df){_0xa217df=_0xa217df||0x1f4;return function(_0x1dd64e){logger[_0xa935('0x25')](_0x1dd64e[_0xa935('0x26')]);if(_0x1dd64e[_0xa935('0x27')]){delete _0x1dd64e[_0xa935('0x27')];}_0x9b97[_0xa935('0x17')](_0xa217df)[_0xa935('0x28')](_0x1dd64e);};}exports['index']=function(_0xfc41d6,_0x46f712){var _0x36a2ac={},_0x2437eb={},_0x3d6093={'count':0x0,'rows':[]};var _0x379b21=_['map'](db[_0xa935('0x29')][_0xa935('0x2a')],function(_0xafecb5){return{'name':_0xafecb5['fieldName'],'type':_0xafecb5[_0xa935('0x2b')][_0xa935('0x2c')]};});_0x2437eb[_0xa935('0x2d')]=_[_0xa935('0x2e')](_0x379b21,_0xa935('0x27'));_0x2437eb[_0xa935('0x2f')]=_[_0xa935('0x30')](_0xfc41d6[_0xa935('0x2f')]);_0x2437eb[_0xa935('0x31')]=_['intersection'](_0x2437eb[_0xa935('0x2d')],_0x2437eb[_0xa935('0x2f')]);_0x36a2ac[_0xa935('0x32')]=_['intersection'](_0x2437eb[_0xa935('0x2d')],qs[_0xa935('0x33')](_0xfc41d6[_0xa935('0x2f')]['fields']));_0x36a2ac[_0xa935('0x32')]=_0x36a2ac[_0xa935('0x32')][_0xa935('0x34')]?_0x36a2ac['attributes']:_0x2437eb['model'];if(!_0xfc41d6[_0xa935('0x2f')]['hasOwnProperty'](_0xa935('0x35'))){_0x36a2ac[_0xa935('0x1d')]=qs[_0xa935('0x1d')](_0xfc41d6[_0xa935('0x2f')][_0xa935('0x1d')]);_0x36a2ac['offset']=qs[_0xa935('0x1a')](_0xfc41d6[_0xa935('0x2f')][_0xa935('0x1a')]);}_0x36a2ac[_0xa935('0x36')]=qs['sort'](_0xfc41d6['query'][_0xa935('0x37')]);_0x36a2ac[_0xa935('0x38')]=qs[_0xa935('0x31')](_[_0xa935('0x39')](_0xfc41d6[_0xa935('0x2f')],_0x2437eb['filters']),_0x379b21);if(_0xfc41d6[_0xa935('0x2f')][_0xa935('0x3a')]){_0x36a2ac['where']=_[_0xa935('0x3b')](_0x36a2ac['where'],{'$or':_['map'](_0x379b21,function(_0x169d6e){if(_0x169d6e[_0xa935('0x2b')]!==_0xa935('0x3c')){var _0x216459={};_0x216459[_0x169d6e[_0xa935('0x27')]]={'$like':'%'+_0xfc41d6[_0xa935('0x2f')][_0xa935('0x3a')]+'%'};return _0x216459;}})});}_0x36a2ac=_[_0xa935('0x3b')]({},_0x36a2ac,_0xfc41d6['options']);var _0x27c1c2={'where':_0x36a2ac[_0xa935('0x38')]};return db[_0xa935('0x29')][_0xa935('0x1c')](_0x27c1c2)['then'](function(_0xa25ff1){_0x3d6093['count']=_0xa25ff1;if(_0xfc41d6[_0xa935('0x2f')]['includeAll']){_0x36a2ac[_0xa935('0x3d')]=[{'all':!![]}];}return db['ZohoConfiguration'][_0xa935('0x3e')](_0x36a2ac);})['then'](function(_0x1cd1ba){_0x3d6093['rows']=_0x1cd1ba;return _0x3d6093;})[_0xa935('0x23')](respondWithFilteredResult(_0x46f712,_0x36a2ac))[_0xa935('0x3f')](handleError(_0x46f712,null));};exports[_0xa935('0x40')]=function(_0x38d31f,_0x131761){var _0x5e47f4={'raw':![],'where':{'id':_0x38d31f[_0xa935('0x41')]['id']}},_0x2afd2b={};_0x2afd2b['model']=_[_0xa935('0x30')](db[_0xa935('0x29')][_0xa935('0x2a')]);_0x2afd2b['query']=_['keys'](_0x38d31f[_0xa935('0x2f')]);_0x2afd2b[_0xa935('0x31')]=_['intersection'](_0x2afd2b[_0xa935('0x2d')],_0x2afd2b[_0xa935('0x2f')]);_0x5e47f4[_0xa935('0x32')]=_['intersection'](_0x2afd2b[_0xa935('0x2d')],qs['fields'](_0x38d31f[_0xa935('0x2f')][_0xa935('0x33')]));_0x5e47f4[_0xa935('0x32')]=_0x5e47f4[_0xa935('0x32')][_0xa935('0x34')]?_0x5e47f4[_0xa935('0x32')]:_0x2afd2b[_0xa935('0x2d')];if(_0x38d31f['query'][_0xa935('0x42')]){_0x5e47f4[_0xa935('0x3d')]=[{'all':!![]}];}_0x5e47f4=_[_0xa935('0x3b')]({},_0x5e47f4,_0x38d31f[_0xa935('0x43')]);return db[_0xa935('0x29')][_0xa935('0x44')](_0x5e47f4)[_0xa935('0x23')](handleEntityNotFound(_0x131761,null))[_0xa935('0x23')](respondWithResult(_0x131761,null))['catch'](handleError(_0x131761,null));};exports[_0xa935('0x45')]=function(_0x3d80eb,_0x1a6fe8){return db[_0xa935('0x29')]['create'](_0x3d80eb[_0xa935('0x46')],{})['then'](respondWithResult(_0x1a6fe8,0xc9))[_0xa935('0x3f')](handleError(_0x1a6fe8,null));};exports['update']=function(_0x24b70c,_0x3365e1){if(_0x24b70c[_0xa935('0x46')]['id']){delete _0x24b70c['body']['id'];}return db[_0xa935('0x29')][_0xa935('0x44')]({'where':{'id':_0x24b70c[_0xa935('0x41')]['id']}})[_0xa935('0x23')](handleEntityNotFound(_0x3365e1,null))['then'](saveUpdates(_0x24b70c[_0xa935('0x46')],null))[_0xa935('0x23')](respondWithResult(_0x3365e1,null))[_0xa935('0x3f')](handleError(_0x3365e1,null));};exports[_0xa935('0x24')]=function(_0x31429b,_0x2ce1d3){return db['ZohoConfiguration'][_0xa935('0x44')]({'where':{'id':_0x31429b[_0xa935('0x41')]['id']}})[_0xa935('0x23')](handleEntityNotFound(_0x2ce1d3,null))[_0xa935('0x23')](removeEntity(_0x2ce1d3,null))[_0xa935('0x3f')](handleError(_0x2ce1d3,null));};exports['getFields']=function(_0x201379,_0x2e168a,_0x1d29b8){var _0x2290d9={};var _0x2642f4={};var _0x16ff3d;var _0x577f13;return db['ZohoConfiguration'][_0xa935('0x47')]({'where':{'id':_0x201379[_0xa935('0x41')]['id']}})[_0xa935('0x23')](handleEntityNotFound(_0x2e168a,null))[_0xa935('0x23')](function(_0x52e744){if(_0x52e744){_0x16ff3d=_0x52e744;_0x2642f4[_0xa935('0x2d')]=_[_0xa935('0x30')](db[_0xa935('0x48')][_0xa935('0x2a')]);_0x2642f4['query']=_['keys'](_0x201379['query']);_0x2642f4['filters']=_[_0xa935('0x49')](_0x2642f4['model'],_0x2642f4[_0xa935('0x2f')]);_0x2290d9[_0xa935('0x32')]=_[_0xa935('0x49')](_0x2642f4['model'],qs[_0xa935('0x33')](_0x201379[_0xa935('0x2f')][_0xa935('0x33')]));_0x2290d9[_0xa935('0x32')]=_0x2290d9['attributes'][_0xa935('0x34')]?_0x2290d9['attributes']:_0x2642f4[_0xa935('0x2d')];_0x2290d9['order']=qs['sort'](_0x201379[_0xa935('0x2f')]['sort']);_0x2290d9[_0xa935('0x38')]=qs[_0xa935('0x31')](_[_0xa935('0x39')](_0x201379[_0xa935('0x2f')],_0x2642f4[_0xa935('0x31')]));if(_0x201379[_0xa935('0x2f')][_0xa935('0x3a')]){_0x2290d9[_0xa935('0x38')]=_['merge'](_0x2290d9[_0xa935('0x38')],{'$or':_[_0xa935('0x2e')](_0x2290d9['attributes'],function(_0x4e1e2c){var _0x52e3c0={};_0x52e3c0[_0x4e1e2c]={'$like':'%'+_0x201379['query'][_0xa935('0x3a')]+'%'};return _0x52e3c0;})});}_0x2290d9=_['merge']({},_0x2290d9,_0x201379[_0xa935('0x43')]);return _0x16ff3d['getFields'](_0x2290d9);}})['then'](function(_0x55cdc4){if(_0x55cdc4){_0x577f13=_0x55cdc4[_0xa935('0x34')];if(!_0x201379[_0xa935('0x2f')][_0xa935('0x4a')](_0xa935('0x35'))){_0x2290d9[_0xa935('0x1d')]=qs[_0xa935('0x1d')](_0x201379[_0xa935('0x2f')][_0xa935('0x1d')]);_0x2290d9[_0xa935('0x1a')]=qs[_0xa935('0x1a')](_0x201379[_0xa935('0x2f')][_0xa935('0x1a')]);}return _0x16ff3d[_0xa935('0x4b')](_0x2290d9);}})[_0xa935('0x23')](function(_0x288f6f){if(_0x288f6f){return _0x288f6f?{'count':_0x577f13,'rows':_0x288f6f}:null;}})[_0xa935('0x23')](respondWithResult(_0x2e168a,null))[_0xa935('0x3f')](handleError(_0x2e168a,null));};exports['getSubjects']=function(_0x2e918b,_0x240e7f,_0x490dff){var _0x286f57={};var _0x106d73={};var _0x5a14c7;var _0x59e178;return db[_0xa935('0x29')][_0xa935('0x47')]({'where':{'id':_0x2e918b[_0xa935('0x41')]['id']}})[_0xa935('0x23')](handleEntityNotFound(_0x240e7f,null))[_0xa935('0x23')](function(_0x5ef016){if(_0x5ef016){_0x5a14c7=_0x5ef016;_0x106d73['model']=_[_0xa935('0x30')](db[_0xa935('0x48')][_0xa935('0x2a')]);_0x106d73[_0xa935('0x2f')]=_[_0xa935('0x30')](_0x2e918b[_0xa935('0x2f')]);_0x106d73[_0xa935('0x31')]=_[_0xa935('0x49')](_0x106d73[_0xa935('0x2d')],_0x106d73[_0xa935('0x2f')]);_0x286f57[_0xa935('0x32')]=_[_0xa935('0x49')](_0x106d73[_0xa935('0x2d')],qs[_0xa935('0x33')](_0x2e918b[_0xa935('0x2f')]['fields']));_0x286f57[_0xa935('0x32')]=_0x286f57['attributes'][_0xa935('0x34')]?_0x286f57[_0xa935('0x32')]:_0x106d73[_0xa935('0x2d')];_0x286f57[_0xa935('0x36')]=qs[_0xa935('0x37')](_0x2e918b['query'][_0xa935('0x37')]);_0x286f57[_0xa935('0x38')]=qs[_0xa935('0x31')](_[_0xa935('0x39')](_0x2e918b['query'],_0x106d73[_0xa935('0x31')]));if(_0x2e918b[_0xa935('0x2f')][_0xa935('0x3a')]){_0x286f57[_0xa935('0x38')]=_['merge'](_0x286f57[_0xa935('0x38')],{'$or':_['map'](_0x286f57[_0xa935('0x32')],function(_0x81a2f1){var _0x127364={};_0x127364[_0x81a2f1]={'$like':'%'+_0x2e918b[_0xa935('0x2f')][_0xa935('0x3a')]+'%'};return _0x127364;})});}_0x286f57=_['merge']({},_0x286f57,_0x2e918b[_0xa935('0x43')]);return _0x5a14c7[_0xa935('0x4c')](_0x286f57);}})[_0xa935('0x23')](function(_0x3cae0f){if(_0x3cae0f){_0x59e178=_0x3cae0f[_0xa935('0x34')];if(!_0x2e918b[_0xa935('0x2f')][_0xa935('0x4a')]('nolimit')){_0x286f57[_0xa935('0x1d')]=qs[_0xa935('0x1d')](_0x2e918b[_0xa935('0x2f')]['limit']);_0x286f57[_0xa935('0x1a')]=qs[_0xa935('0x1a')](_0x2e918b[_0xa935('0x2f')]['offset']);}return _0x5a14c7[_0xa935('0x4c')](_0x286f57);}})[_0xa935('0x23')](function(_0x45b73a){if(_0x45b73a){return _0x45b73a?{'count':_0x59e178,'rows':_0x45b73a}:null;}})['then'](respondWithResult(_0x240e7f,null))[_0xa935('0x3f')](handleError(_0x240e7f,null));};exports[_0xa935('0x4d')]=function(_0x30f301,_0x42c095,_0x4a0c0b){var _0x224bb8={};var _0x87afc6={};var _0x1bb635;var _0x456439;return db[_0xa935('0x29')][_0xa935('0x47')]({'where':{'id':_0x30f301[_0xa935('0x41')]['id']}})[_0xa935('0x23')](handleEntityNotFound(_0x42c095,null))[_0xa935('0x23')](function(_0x41c8d5){if(_0x41c8d5){_0x1bb635=_0x41c8d5;_0x87afc6[_0xa935('0x2d')]=_['keys'](db[_0xa935('0x48')][_0xa935('0x2a')]);_0x87afc6[_0xa935('0x2f')]=_['keys'](_0x30f301[_0xa935('0x2f')]);_0x87afc6['filters']=_[_0xa935('0x49')](_0x87afc6[_0xa935('0x2d')],_0x87afc6[_0xa935('0x2f')]);_0x224bb8[_0xa935('0x32')]=_['intersection'](_0x87afc6['model'],qs['fields'](_0x30f301['query']['fields']));_0x224bb8[_0xa935('0x32')]=_0x224bb8[_0xa935('0x32')][_0xa935('0x34')]?_0x224bb8['attributes']:_0x87afc6[_0xa935('0x2d')];_0x224bb8[_0xa935('0x36')]=qs['sort'](_0x30f301['query'][_0xa935('0x37')]);_0x224bb8[_0xa935('0x38')]=qs[_0xa935('0x31')](_[_0xa935('0x39')](_0x30f301[_0xa935('0x2f')],_0x87afc6[_0xa935('0x31')]));if(_0x30f301[_0xa935('0x2f')][_0xa935('0x3a')]){_0x224bb8['where']=_[_0xa935('0x3b')](_0x224bb8[_0xa935('0x38')],{'$or':_[_0xa935('0x2e')](_0x224bb8[_0xa935('0x32')],function(_0xf8aee5){var _0x4b1d53={};_0x4b1d53[_0xf8aee5]={'$like':'%'+_0x30f301[_0xa935('0x2f')][_0xa935('0x3a')]+'%'};return _0x4b1d53;})});}_0x224bb8=_['merge']({},_0x224bb8,_0x30f301['options']);return _0x1bb635[_0xa935('0x4d')](_0x224bb8);}})[_0xa935('0x23')](function(_0x475c4f){if(_0x475c4f){_0x456439=_0x475c4f[_0xa935('0x34')];if(!_0x30f301[_0xa935('0x2f')]['hasOwnProperty'](_0xa935('0x35'))){_0x224bb8[_0xa935('0x1d')]=qs[_0xa935('0x1d')](_0x30f301[_0xa935('0x2f')][_0xa935('0x1d')]);_0x224bb8[_0xa935('0x1a')]=qs[_0xa935('0x1a')](_0x30f301[_0xa935('0x2f')][_0xa935('0x1a')]);}return _0x1bb635[_0xa935('0x4d')](_0x224bb8);}})[_0xa935('0x23')](function(_0x32703c){if(_0x32703c){return _0x32703c?{'count':_0x456439,'rows':_0x32703c}:null;}})[_0xa935('0x23')](respondWithResult(_0x42c095,null))[_0xa935('0x3f')](handleError(_0x42c095,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 9bb8784..9dc9d00 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 _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 +var _0x33f4=['exports','define','ZohoConfiguration','lodash','util','../../config/logger','api','request-promise','path','../../config/environment','./intZohoConfiguration.attributes'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x33f4,0x121));var _0x433f=function(_0x2de7ae,_0x1383da){_0x2de7ae=_0x2de7ae-0x0;var _0x29c5ba=_0x33f4[_0x2de7ae];return _0x29c5ba;};'use strict';var _=require(_0x433f('0x0'));var util=require(_0x433f('0x1'));var logger=require(_0x433f('0x2'))(_0x433f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x433f('0x4'));var fs=require('fs');var path=require(_0x433f('0x5'));var rimraf=require('rimraf');var config=require(_0x433f('0x6'));var attributes=require(_0x433f('0x7'));module[_0x433f('0x8')]=function(_0x2f0efc,_0x152320){return _0x2f0efc[_0x433f('0x9')](_0x433f('0xa'),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 54980e2..97ed200 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 _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 +var _0x8891=['info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1f765b,_0x5488bd){var _0x43c955=function(_0xf3a435){while(--_0xf3a435){_0x1f765b['push'](_0x1f765b['shift']());}};_0x43c955(++_0x5488bd);}(_0x8891,0x148));var _0x1889=function(_0x156a77,_0x522c13){_0x156a77=_0x156a77-0x0;var _0x32398a=_0x8891[_0x156a77];return _0x32398a;};'use strict';var _=require(_0x1889('0x0'));var util=require(_0x1889('0x1'));var moment=require(_0x1889('0x2'));var BPromise=require('bluebird');var rs=require(_0x1889('0x3'));var fs=require('fs');var Redis=require(_0x1889('0x4'));var db=require(_0x1889('0x5'))['db'];var utils=require(_0x1889('0x6'));var logger=require(_0x1889('0x7'))('rpc');var config=require(_0x1889('0x8'));var jayson=require(_0x1889('0x9'));var client=jayson[_0x1889('0xa')][_0x1889('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x31baa3,_0x473363,_0x3e837c){return new BPromise(function(_0x1a9225,_0x35af06){return client[_0x1889('0xc')](_0x31baa3,_0x3e837c)[_0x1889('0xd')](function(_0x32c576){logger['info'](_0x1889('0xe'),_0x473363,_0x1889('0xf'));logger[_0x1889('0x10')](_0x1889('0x11'),_0x473363,_0x1889('0xf'),JSON[_0x1889('0x12')](_0x32c576));if(_0x32c576['error']){if(_0x32c576[_0x1889('0x13')][_0x1889('0x14')]===0x1f4){logger[_0x1889('0x13')](_0x1889('0xe'),_0x473363,_0x32c576['error'][_0x1889('0x15')]);return _0x35af06(_0x32c576[_0x1889('0x13')][_0x1889('0x15')]);}logger[_0x1889('0x13')]('ZohoConfiguration,\x20%s,\x20%s',_0x473363,_0x32c576[_0x1889('0x13')][_0x1889('0x15')]);return _0x1a9225(_0x32c576[_0x1889('0x13')][_0x1889('0x15')]);}else{logger[_0x1889('0x16')](_0x1889('0xe'),_0x473363,_0x1889('0xf'));_0x1a9225(_0x32c576[_0x1889('0x17')][_0x1889('0x15')]);}})[_0x1889('0x18')](function(_0x3df7b7){logger[_0x1889('0x13')](_0x1889('0xe'),_0x473363,_0x3df7b7);_0x35af06(_0x3df7b7);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index ff63394..5853437 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 _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 +var _0x7d56=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id','show','put','update'];(function(_0x2fa019,_0x26e5f1){var _0x1c720f=function(_0x2ecddc){while(--_0x2ecddc){_0x2fa019['push'](_0x2fa019['shift']());}};_0x1c720f(++_0x26e5f1);}(_0x7d56,0x156));var _0x67d5=function(_0x20b7ab,_0x527469){_0x20b7ab=_0x20b7ab-0x0;var _0x2cb293=_0x7d56[_0x20b7ab];return _0x2cb293;};'use strict';var multer=require(_0x67d5('0x0'));var util=require(_0x67d5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x67d5('0x2')]();var fs_extra=require(_0x67d5('0x3'));var auth=require(_0x67d5('0x4'));var interaction=require(_0x67d5('0x5'));var config=require(_0x67d5('0x6'));var controller=require(_0x67d5('0x7'));router[_0x67d5('0x8')]('/',auth[_0x67d5('0x9')](),controller[_0x67d5('0xa')]);router['get'](_0x67d5('0xb'),auth['isAuthenticated'](),controller[_0x67d5('0xc')]);router['post']('/',auth[_0x67d5('0x9')](),controller['create']);router[_0x67d5('0xd')](_0x67d5('0xb'),auth['isAuthenticated'](),controller[_0x67d5('0xe')]);router['delete']('/:id',auth[_0x67d5('0x9')](),controller[_0x67d5('0xf')]);module[_0x67d5('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 0c38a37..ff4b1c8 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 _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 +var _0x9aad=['string','STRING','customVariable','BOOLEAN','sequelize','ENUM','variable','keyValue','picklist'];(function(_0x28b050,_0x10889c){var _0x3a7670=function(_0x572fb9){while(--_0x572fb9){_0x28b050['push'](_0x28b050['shift']());}};_0x3a7670(++_0x10889c);}(_0x9aad,0xca));var _0xd9aa=function(_0x3594d3,_0x521d3c){_0x3594d3=_0x3594d3-0x0;var _0x50a324=_0x9aad[_0x3594d3];return _0x50a324;};'use strict';var Sequelize=require(_0xd9aa('0x0'));module['exports']={'type':{'type':Sequelize[_0xd9aa('0x1')]('string',_0xd9aa('0x2'),'customVariable',_0xd9aa('0x3'),_0xd9aa('0x4')),'defaultValue':_0xd9aa('0x5')},'content':{'type':Sequelize[_0xd9aa('0x6')]},'key':{'type':Sequelize[_0xd9aa('0x6')]},'keyType':{'type':Sequelize[_0xd9aa('0x1')](_0xd9aa('0x5'),_0xd9aa('0x2'),_0xd9aa('0x7'))},'keyContent':{'type':Sequelize[_0xd9aa('0x6')]},'idField':{'type':Sequelize[_0xd9aa('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xd9aa('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd9aa('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 62947ec..d9cac2a 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 _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 +var _0x76f4=['../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','undefined','count','status','set','apply','reject','save','update','then','destroy','error','stack','name','map','ZohoField','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','length','hasOwnProperty','nolimit','sort','where','filters','filter','VIRTUAL','merge','includeAll','include','findAll','fields','find','create','body','catch','params','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x3ff2f9,_0x544ba1){var _0x3b0913=function(_0x554288){while(--_0x554288){_0x3ff2f9['push'](_0x3ff2f9['shift']());}};_0x3b0913(++_0x544ba1);}(_0x76f4,0x1e0));var _0x476f=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x76f4[_0x4baae2];return _0x1a2285;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x476f('0x0'));var jsonpatch=require(_0x476f('0x1'));var rp=require(_0x476f('0x2'));var moment=require(_0x476f('0x3'));var BPromise=require(_0x476f('0x4'));var Mustache=require(_0x476f('0x5'));var util=require('util');var path=require('path');var sox=require(_0x476f('0x6'));var csv=require(_0x476f('0x7'));var ejs=require(_0x476f('0x8'));var fs=require('fs');var fs_extra=require(_0x476f('0x9'));var _=require(_0x476f('0xa'));var squel=require(_0x476f('0xb'));var crypto=require(_0x476f('0xc'));var jsforce=require(_0x476f('0xd'));var deskjs=require(_0x476f('0xe'));var toCsv=require(_0x476f('0x7'));var querystring=require(_0x476f('0xf'));var Papa=require(_0x476f('0x10'));var Redis=require(_0x476f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x476f('0x12'));var as=require(_0x476f('0x13'));var hardwareService=require(_0x476f('0x14'));var logger=require(_0x476f('0x15'))(_0x476f('0x16'));var utils=require(_0x476f('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x476f('0x18'));var db=require(_0x476f('0x19'))['db'];function respondWithStatusCode(_0x2cd221,_0x166dd5){_0x166dd5=_0x166dd5||0xcc;return function(_0x2269cf){if(_0x2269cf){return _0x2cd221[_0x476f('0x1a')](_0x166dd5);}return _0x2cd221['status'](_0x166dd5)[_0x476f('0x1b')]();};}function respondWithResult(_0xd96e1f,_0x228f07){_0x228f07=_0x228f07||0xc8;return function(_0x559fb7){if(_0x559fb7){return _0xd96e1f['status'](_0x228f07)[_0x476f('0x1c')](_0x559fb7);}};}function respondWithFilteredResult(_0x3209cc,_0x763405){return function(_0x539a57){if(_0x539a57){var _0x9a7aad=typeof _0x763405[_0x476f('0x1d')]==='undefined'&&typeof _0x763405[_0x476f('0x1e')]===_0x476f('0x1f');var _0x44b6c3=_0x539a57[_0x476f('0x20')];var _0x4e7674=_0x9a7aad?0x0:_0x763405['offset'];var _0x1b1185=_0x9a7aad?_0x539a57[_0x476f('0x20')]:_0x763405[_0x476f('0x1d')]+_0x763405[_0x476f('0x1e')];var _0xb952e;if(_0x1b1185>=_0x44b6c3){_0x1b1185=_0x44b6c3;_0xb952e=0xc8;}else{_0xb952e=0xce;}_0x3209cc[_0x476f('0x21')](_0xb952e);return _0x3209cc[_0x476f('0x22')]('Content-Range',_0x4e7674+'-'+_0x1b1185+'/'+_0x44b6c3)['json'](_0x539a57);}return null;};}function patchUpdates(_0x1bfb1e){return function(_0x4932f5){try{jsonpatch[_0x476f('0x23')](_0x4932f5,_0x1bfb1e,!![]);}catch(_0x5b99bb){return BPromise[_0x476f('0x24')](_0x5b99bb);}return _0x4932f5[_0x476f('0x25')]();};}function saveUpdates(_0x56675a,_0x2cf353){return function(_0x1cbe06){if(_0x1cbe06){return _0x1cbe06[_0x476f('0x26')](_0x56675a)[_0x476f('0x27')](function(_0x12931f){return _0x12931f;});}return null;};}function removeEntity(_0x1f446b,_0x59bf13){return function(_0x3944b7){if(_0x3944b7){return _0x3944b7[_0x476f('0x28')]()[_0x476f('0x27')](function(){_0x1f446b['status'](0xcc)[_0x476f('0x1b')]();});}};}function handleEntityNotFound(_0x101acc,_0x37b6dd){return function(_0x1690a2){if(!_0x1690a2){_0x101acc[_0x476f('0x1a')](0x194);}return _0x1690a2;};}function handleError(_0x2a1f15,_0x2fc035){_0x2fc035=_0x2fc035||0x1f4;return function(_0x137c9a){logger[_0x476f('0x29')](_0x137c9a[_0x476f('0x2a')]);if(_0x137c9a['name']){delete _0x137c9a[_0x476f('0x2b')];}_0x2a1f15[_0x476f('0x21')](_0x2fc035)['send'](_0x137c9a);};}exports['index']=function(_0x35e86a,_0xa2a186){var _0x1d1e98={},_0x49ba87={},_0x9218c4={'count':0x0,'rows':[]};var _0x19f580=_[_0x476f('0x2c')](db[_0x476f('0x2d')][_0x476f('0x2e')],function(_0x57e30f){return{'name':_0x57e30f[_0x476f('0x2f')],'type':_0x57e30f['type'][_0x476f('0x30')]};});_0x49ba87[_0x476f('0x31')]=_['map'](_0x19f580,'name');_0x49ba87[_0x476f('0x32')]=_[_0x476f('0x33')](_0x35e86a[_0x476f('0x32')]);_0x49ba87['filters']=_['intersection'](_0x49ba87[_0x476f('0x31')],_0x49ba87[_0x476f('0x32')]);_0x1d1e98[_0x476f('0x34')]=_[_0x476f('0x35')](_0x49ba87[_0x476f('0x31')],qs['fields'](_0x35e86a[_0x476f('0x32')]['fields']));_0x1d1e98[_0x476f('0x34')]=_0x1d1e98[_0x476f('0x34')][_0x476f('0x36')]?_0x1d1e98['attributes']:_0x49ba87[_0x476f('0x31')];if(!_0x35e86a[_0x476f('0x32')][_0x476f('0x37')](_0x476f('0x38'))){_0x1d1e98['limit']=qs[_0x476f('0x1e')](_0x35e86a[_0x476f('0x32')][_0x476f('0x1e')]);_0x1d1e98[_0x476f('0x1d')]=qs[_0x476f('0x1d')](_0x35e86a[_0x476f('0x32')]['offset']);}_0x1d1e98['order']=qs['sort'](_0x35e86a[_0x476f('0x32')][_0x476f('0x39')]);_0x1d1e98[_0x476f('0x3a')]=qs['filters'](_['pick'](_0x35e86a[_0x476f('0x32')],_0x49ba87[_0x476f('0x3b')]),_0x19f580);if(_0x35e86a[_0x476f('0x32')][_0x476f('0x3c')]){_0x1d1e98[_0x476f('0x3a')]=_['merge'](_0x1d1e98[_0x476f('0x3a')],{'$or':_[_0x476f('0x2c')](_0x19f580,function(_0x3d8058){if(_0x3d8058['type']!==_0x476f('0x3d')){var _0x42068d={};_0x42068d[_0x3d8058[_0x476f('0x2b')]]={'$like':'%'+_0x35e86a[_0x476f('0x32')]['filter']+'%'};return _0x42068d;}})});}_0x1d1e98=_[_0x476f('0x3e')]({},_0x1d1e98,_0x35e86a['options']);var _0x12e420={'where':_0x1d1e98[_0x476f('0x3a')]};return db['ZohoField'][_0x476f('0x20')](_0x12e420)[_0x476f('0x27')](function(_0x8dfddd){_0x9218c4[_0x476f('0x20')]=_0x8dfddd;if(_0x35e86a['query'][_0x476f('0x3f')]){_0x1d1e98[_0x476f('0x40')]=[{'all':!![]}];}return db[_0x476f('0x2d')][_0x476f('0x41')](_0x1d1e98);})[_0x476f('0x27')](function(_0x1cad34){_0x9218c4['rows']=_0x1cad34;return _0x9218c4;})[_0x476f('0x27')](respondWithFilteredResult(_0xa2a186,_0x1d1e98))['catch'](handleError(_0xa2a186,null));};exports['show']=function(_0x29da73,_0x1fe5d5){var _0x194a8c={'raw':!![],'where':{'id':_0x29da73['params']['id']}},_0x157a93={};_0x157a93[_0x476f('0x31')]=_[_0x476f('0x33')](db[_0x476f('0x2d')]['rawAttributes']);_0x157a93[_0x476f('0x32')]=_['keys'](_0x29da73['query']);_0x157a93['filters']=_[_0x476f('0x35')](_0x157a93[_0x476f('0x31')],_0x157a93['query']);_0x194a8c['attributes']=_[_0x476f('0x35')](_0x157a93[_0x476f('0x31')],qs[_0x476f('0x42')](_0x29da73[_0x476f('0x32')][_0x476f('0x42')]));_0x194a8c['attributes']=_0x194a8c['attributes'][_0x476f('0x36')]?_0x194a8c[_0x476f('0x34')]:_0x157a93[_0x476f('0x31')];if(_0x29da73[_0x476f('0x32')][_0x476f('0x3f')]){_0x194a8c[_0x476f('0x40')]=[{'all':!![]}];}_0x194a8c=_[_0x476f('0x3e')]({},_0x194a8c,_0x29da73['options']);return db[_0x476f('0x2d')][_0x476f('0x43')](_0x194a8c)[_0x476f('0x27')](handleEntityNotFound(_0x1fe5d5,null))['then'](respondWithResult(_0x1fe5d5,null))['catch'](handleError(_0x1fe5d5,null));};exports[_0x476f('0x44')]=function(_0x341d72,_0x108151){return db[_0x476f('0x2d')]['create'](_0x341d72[_0x476f('0x45')],{})[_0x476f('0x27')](respondWithResult(_0x108151,0xc9))[_0x476f('0x46')](handleError(_0x108151,null));};exports[_0x476f('0x26')]=function(_0x12c6f3,_0x92ab2f){if(_0x12c6f3[_0x476f('0x45')]['id']){delete _0x12c6f3['body']['id'];}return db['ZohoField'][_0x476f('0x43')]({'where':{'id':_0x12c6f3[_0x476f('0x47')]['id']}})['then'](handleEntityNotFound(_0x92ab2f,null))[_0x476f('0x27')](saveUpdates(_0x12c6f3[_0x476f('0x45')],null))['then'](respondWithResult(_0x92ab2f,null))['catch'](handleError(_0x92ab2f,null));};exports[_0x476f('0x28')]=function(_0x5d49d4,_0x1aebb6){return db[_0x476f('0x2d')][_0x476f('0x43')]({'where':{'id':_0x5d49d4['params']['id']}})[_0x476f('0x27')](handleEntityNotFound(_0x1aebb6,null))[_0x476f('0x27')](removeEntity(_0x1aebb6,null))[_0x476f('0x46')](handleError(_0x1aebb6,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index d04f2b7..85dd39e 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 _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 +var _0x4888=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intZohoField.attributes','exports','define','FieldId'];(function(_0x5e44d9,_0x150c5b){var _0xc8e22b=function(_0x26d1f2){while(--_0x26d1f2){_0x5e44d9['push'](_0x5e44d9['shift']());}};_0xc8e22b(++_0x150c5b);}(_0x4888,0x198));var _0x8488=function(_0x4b26b5,_0x4f71fd){_0x4b26b5=_0x4b26b5-0x0;var _0x4dec71=_0x4888[_0x4b26b5];return _0x4dec71;};'use strict';var _=require('lodash');var util=require(_0x8488('0x0'));var logger=require(_0x8488('0x1'))(_0x8488('0x2'));var moment=require(_0x8488('0x3'));var BPromise=require(_0x8488('0x4'));var rp=require(_0x8488('0x5'));var fs=require('fs');var path=require(_0x8488('0x6'));var rimraf=require('rimraf');var config=require(_0x8488('0x7'));var attributes=require(_0x8488('0x8'));module[_0x8488('0x9')]=function(_0x421292,_0x326887){return _0x421292[_0x8488('0xa')]('ZohoField',attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':['idField',_0x8488('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index f7ab11f..7c8f1f1 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 _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 +var _0xea1c=['client','request\x20sent','debug','stringify','error','ZohoField,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x11ed01,_0xde71d){var _0x46c595=function(_0x4b1bcb){while(--_0x4b1bcb){_0x11ed01['push'](_0x11ed01['shift']());}};_0x46c595(++_0xde71d);}(_0xea1c,0xf9));var _0xcea1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xea1c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xcea1('0x0'));var util=require(_0xcea1('0x1'));var moment=require(_0xcea1('0x2'));var BPromise=require(_0xcea1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcea1('0x4'));var db=require(_0xcea1('0x5'))['db'];var utils=require(_0xcea1('0x6'));var logger=require(_0xcea1('0x7'))(_0xcea1('0x8'));var config=require(_0xcea1('0x9'));var jayson=require(_0xcea1('0xa'));var client=jayson[_0xcea1('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x879b7e,_0x3f419e,_0x201f2a){return new BPromise(function(_0x31b6c4,_0x2a6869){return client['request'](_0x879b7e,_0x201f2a)['then'](function(_0x21d7cc){logger['info']('ZohoField,\x20%s,\x20%s',_0x3f419e,_0xcea1('0xc'));logger[_0xcea1('0xd')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x3f419e,_0xcea1('0xc'),JSON[_0xcea1('0xe')](_0x21d7cc));if(_0x21d7cc[_0xcea1('0xf')]){if(_0x21d7cc[_0xcea1('0xf')]['code']===0x1f4){logger[_0xcea1('0xf')](_0xcea1('0x10'),_0x3f419e,_0x21d7cc[_0xcea1('0xf')][_0xcea1('0x11')]);return _0x2a6869(_0x21d7cc['error'][_0xcea1('0x11')]);}logger[_0xcea1('0xf')](_0xcea1('0x10'),_0x3f419e,_0x21d7cc['error'][_0xcea1('0x11')]);return _0x31b6c4(_0x21d7cc[_0xcea1('0xf')][_0xcea1('0x11')]);}else{logger[_0xcea1('0x12')](_0xcea1('0x10'),_0x3f419e,_0xcea1('0xc'));_0x31b6c4(_0x21d7cc['result'][_0xcea1('0x11')]);}})[_0xcea1('0x13')](function(_0x53f153){logger[_0xcea1('0xf')](_0xcea1('0x10'),_0x3f419e,_0x53f153);_0x2a6869(_0x53f153);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index cf12868..a3aeccc 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_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 +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x474809,_0x433483){var _0x92a40f=function(_0x35ebb0){while(--_0x35ebb0){_0x474809['push'](_0x474809['shift']());}};_0x92a40f(++_0x433483);}(_0xe706,0xa3));var _0x6e70=function(_0x2f3f72,_0x49057e){_0x2f3f72=_0x2f3f72-0x0;var _0x31f206=_0xe706[_0x2f3f72];return _0x31f206;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 92eec4d..be165ab 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 _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 +var _0x2e76=['state','sequelize','unique_name_and_version','STRING','app.js','BOOLEAN'];(function(_0xf26e77,_0x429091){var _0x3256fe=function(_0x3e6a51){while(--_0x3e6a51){_0xf26e77['push'](_0xf26e77['shift']());}};_0x3256fe(++_0x429091);}(_0x2e76,0x199));var _0x62e7=function(_0x1fbd64,_0x5e3f8a){_0x1fbd64=_0x1fbd64-0x0;var _0x52d396=_0x2e76[_0x1fbd64];return _0x52d396;};'use strict';var Sequelize=require(_0x62e7('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x62e7('0x1')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x62e7('0x1')},'main':{'type':Sequelize[_0x62e7('0x2')],'defaultValue':_0x62e7('0x3')},'filename':{'type':Sequelize[_0x62e7('0x2')]},'path':{'type':Sequelize[_0x62e7('0x2')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0x62e7('0x4')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0x62e7('0x2')],'unique':_0x62e7('0x5')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x62e7('0x2')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 51ad9be..e4f146a 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 _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 +var _0x01d9=['map','Integration','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','catch','show','params','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../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','apply','save','update','then','destroy','error','name','send','index'];(function(_0x51cf9f,_0x2b3b29){var _0x56207c=function(_0x22230a){while(--_0x22230a){_0x51cf9f['push'](_0x51cf9f['shift']());}};_0x56207c(++_0x2b3b29);}(_0x01d9,0x6c));var _0x901d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x01d9[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x901d('0x0'));var rimraf=require(_0x901d('0x1'));var zipdir=require(_0x901d('0x2'));var jsonpatch=require(_0x901d('0x3'));var rp=require('request-promise');var moment=require(_0x901d('0x4'));var BPromise=require(_0x901d('0x5'));var Mustache=require(_0x901d('0x6'));var util=require(_0x901d('0x7'));var path=require(_0x901d('0x8'));var sox=require(_0x901d('0x9'));var csv=require(_0x901d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x901d('0xb'));var _=require(_0x901d('0xc'));var squel=require(_0x901d('0xd'));var crypto=require(_0x901d('0xe'));var jsforce=require(_0x901d('0xf'));var deskjs=require(_0x901d('0x10'));var toCsv=require(_0x901d('0xa'));var querystring=require(_0x901d('0x11'));var Papa=require(_0x901d('0x12'));var Redis=require(_0x901d('0x13'));var authService=require(_0x901d('0x14'));var qs=require(_0x901d('0x15'));var as=require(_0x901d('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x901d('0x17'))('api');var utils=require(_0x901d('0x18'));var config=require(_0x901d('0x19'));var licenseUtil=require(_0x901d('0x1a'));var db=require(_0x901d('0x1b'))['db'];function respondWithStatusCode(_0x15ebaf,_0x5d2345){_0x5d2345=_0x5d2345||0xcc;return function(_0x1d8117){if(_0x1d8117){return _0x15ebaf[_0x901d('0x1c')](_0x5d2345);}return _0x15ebaf[_0x901d('0x1d')](_0x5d2345)[_0x901d('0x1e')]();};}function respondWithResult(_0xb8869a,_0x14d99b){_0x14d99b=_0x14d99b||0xc8;return function(_0x530a2b){if(_0x530a2b){return _0xb8869a[_0x901d('0x1d')](_0x14d99b)[_0x901d('0x1f')](_0x530a2b);}};}function respondWithFilteredResult(_0x11b0cc,_0x17d451){return function(_0x1aba97){if(_0x1aba97){var _0x7dd5f4=typeof _0x17d451[_0x901d('0x20')]===_0x901d('0x21')&&typeof _0x17d451[_0x901d('0x22')]===_0x901d('0x21');var _0x28caae=_0x1aba97[_0x901d('0x23')];var _0x285353=_0x7dd5f4?0x0:_0x17d451[_0x901d('0x20')];var _0x38f42b=_0x7dd5f4?_0x1aba97[_0x901d('0x23')]:_0x17d451[_0x901d('0x20')]+_0x17d451[_0x901d('0x22')];var _0x57d518;if(_0x38f42b>=_0x28caae){_0x38f42b=_0x28caae;_0x57d518=0xc8;}else{_0x57d518=0xce;}_0x11b0cc[_0x901d('0x1d')](_0x57d518);return _0x11b0cc[_0x901d('0x24')]('Content-Range',_0x285353+'-'+_0x38f42b+'/'+_0x28caae)['json'](_0x1aba97);}return null;};}function patchUpdates(_0x496a06){return function(_0x53f8ae){try{jsonpatch[_0x901d('0x25')](_0x53f8ae,_0x496a06,!![]);}catch(_0x44ea6f){return BPromise['reject'](_0x44ea6f);}return _0x53f8ae[_0x901d('0x26')]();};}function saveUpdates(_0x3ea3f6,_0x488e24){return function(_0x20778b){if(_0x20778b){return _0x20778b[_0x901d('0x27')](_0x3ea3f6)[_0x901d('0x28')](function(_0x3f80b9){return _0x3f80b9;});}return null;};}function removeEntity(_0x1e7d36,_0x1818d3){return function(_0x46e5c6){if(_0x46e5c6){return _0x46e5c6[_0x901d('0x29')]()['then'](function(){_0x1e7d36[_0x901d('0x1d')](0xcc)[_0x901d('0x1e')]();});}};}function handleEntityNotFound(_0xbc89a5,_0x1f0ee5){return function(_0x557809){if(!_0x557809){_0xbc89a5[_0x901d('0x1c')](0x194);}return _0x557809;};}function handleError(_0x23fd43,_0x27f4ca){_0x27f4ca=_0x27f4ca||0x1f4;return function(_0x3cbe43){logger[_0x901d('0x2a')](_0x3cbe43['stack']);if(_0x3cbe43[_0x901d('0x2b')]){delete _0x3cbe43[_0x901d('0x2b')];}_0x23fd43[_0x901d('0x1d')](_0x27f4ca)[_0x901d('0x2c')](_0x3cbe43);};}exports[_0x901d('0x2d')]=function(_0x3de9b9,_0x48e86e){var _0xae6dfe={},_0x533038={},_0x128830={'count':0x0,'rows':[]};var _0x389fd9=_[_0x901d('0x2e')](db[_0x901d('0x2f')][_0x901d('0x30')],function(_0x20df02){return{'name':_0x20df02[_0x901d('0x31')],'type':_0x20df02[_0x901d('0x32')][_0x901d('0x33')]};});_0x533038[_0x901d('0x34')]=_[_0x901d('0x2e')](_0x389fd9,_0x901d('0x2b'));_0x533038[_0x901d('0x35')]=_[_0x901d('0x36')](_0x3de9b9[_0x901d('0x35')]);_0x533038['filters']=_[_0x901d('0x37')](_0x533038[_0x901d('0x34')],_0x533038[_0x901d('0x35')]);_0xae6dfe['attributes']=_[_0x901d('0x37')](_0x533038[_0x901d('0x34')],qs[_0x901d('0x38')](_0x3de9b9[_0x901d('0x35')][_0x901d('0x38')]));_0xae6dfe[_0x901d('0x39')]=_0xae6dfe[_0x901d('0x39')][_0x901d('0x3a')]?_0xae6dfe[_0x901d('0x39')]:_0x533038[_0x901d('0x34')];if(!_0x3de9b9['query']['hasOwnProperty'](_0x901d('0x3b'))){_0xae6dfe['limit']=qs[_0x901d('0x22')](_0x3de9b9[_0x901d('0x35')]['limit']);_0xae6dfe[_0x901d('0x20')]=qs[_0x901d('0x20')](_0x3de9b9[_0x901d('0x35')]['offset']);}_0xae6dfe[_0x901d('0x3c')]=qs[_0x901d('0x3d')](_0x3de9b9[_0x901d('0x35')][_0x901d('0x3d')]);_0xae6dfe[_0x901d('0x3e')]=qs[_0x901d('0x3f')](_[_0x901d('0x40')](_0x3de9b9[_0x901d('0x35')],_0x533038[_0x901d('0x3f')]),_0x389fd9);if(_0x3de9b9[_0x901d('0x35')][_0x901d('0x41')]){_0xae6dfe[_0x901d('0x3e')]=_[_0x901d('0x42')](_0xae6dfe[_0x901d('0x3e')],{'$or':_[_0x901d('0x2e')](_0x389fd9,function(_0x1644d8){if(_0x1644d8['type']!==_0x901d('0x43')){var _0x423cab={};_0x423cab[_0x1644d8['name']]={'$like':'%'+_0x3de9b9['query'][_0x901d('0x41')]+'%'};return _0x423cab;}})});}_0xae6dfe=_['merge']({},_0xae6dfe,_0x3de9b9[_0x901d('0x44')]);var _0x3d0556={'where':_0xae6dfe[_0x901d('0x3e')]};return db[_0x901d('0x2f')][_0x901d('0x23')](_0x3d0556)[_0x901d('0x28')](function(_0x5df4cb){_0x128830['count']=_0x5df4cb;if(_0x3de9b9['query']['includeAll']){_0xae6dfe[_0x901d('0x45')]=[{'all':!![]}];}return db[_0x901d('0x2f')]['findAll'](_0xae6dfe);})[_0x901d('0x28')](function(_0x22fc44){_0x128830['rows']=_0x22fc44;return _0x128830;})[_0x901d('0x28')](respondWithFilteredResult(_0x48e86e,_0xae6dfe))[_0x901d('0x46')](handleError(_0x48e86e,null));};exports[_0x901d('0x47')]=function(_0x2c1895,_0x53663d){var _0x5aeb41={'raw':![],'where':{'id':_0x2c1895[_0x901d('0x48')]['id']}},_0xa9c008={};_0xa9c008[_0x901d('0x34')]=_[_0x901d('0x36')](db[_0x901d('0x2f')][_0x901d('0x30')]);_0xa9c008[_0x901d('0x35')]=_[_0x901d('0x36')](_0x2c1895[_0x901d('0x35')]);_0xa9c008[_0x901d('0x3f')]=_[_0x901d('0x37')](_0xa9c008['model'],_0xa9c008[_0x901d('0x35')]);_0x5aeb41['attributes']=_[_0x901d('0x37')](_0xa9c008['model'],qs[_0x901d('0x38')](_0x2c1895['query'][_0x901d('0x38')]));_0x5aeb41[_0x901d('0x39')]=_0x5aeb41[_0x901d('0x39')][_0x901d('0x3a')]?_0x5aeb41[_0x901d('0x39')]:_0xa9c008[_0x901d('0x34')];if(_0x2c1895[_0x901d('0x35')][_0x901d('0x49')]){_0x5aeb41[_0x901d('0x45')]=[{'all':!![]}];}_0x5aeb41=_[_0x901d('0x42')]({},_0x5aeb41,_0x2c1895[_0x901d('0x44')]);return db['Integration'][_0x901d('0x4a')](_0x5aeb41)[_0x901d('0x28')](handleEntityNotFound(_0x53663d,null))[_0x901d('0x28')](respondWithResult(_0x53663d,null))[_0x901d('0x46')](handleError(_0x53663d,null));};exports[_0x901d('0x4b')]=function(_0x24b6fa,_0x27459b){return db[_0x901d('0x2f')][_0x901d('0x4b')](_0x24b6fa[_0x901d('0x4c')],{})[_0x901d('0x28')](respondWithResult(_0x27459b,0xc9))[_0x901d('0x46')](handleError(_0x27459b,null));};exports[_0x901d('0x27')]=function(_0x23f2a9,_0x4888e8){if(_0x23f2a9['body']['id']){delete _0x23f2a9[_0x901d('0x4c')]['id'];}return db[_0x901d('0x2f')][_0x901d('0x4a')]({'where':{'id':_0x23f2a9[_0x901d('0x48')]['id']}})[_0x901d('0x28')](handleEntityNotFound(_0x4888e8,null))['then'](saveUpdates(_0x23f2a9['body'],null))[_0x901d('0x28')](respondWithResult(_0x4888e8,null))[_0x901d('0x46')](handleError(_0x4888e8,null));};exports['destroy']=function(_0x23673d,_0x165207){return db['Integration'][_0x901d('0x4a')]({'where':{'id':_0x23673d['params']['id']}})[_0x901d('0x28')](handleEntityNotFound(_0x165207,null))[_0x901d('0x28')](removeEntity(_0x165207,null))[_0x901d('0x46')](handleError(_0x165207,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index b6d539d..4fd1e1f 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 _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 +var _0x1ced=['../../config/logger','moment','bluebird','path','../../config/environment','./integration.attributes','exports','define','Integration','integrations','lodash','util'];(function(_0x564dff,_0x32bdc5){var _0x283988=function(_0x289c8d){while(--_0x289c8d){_0x564dff['push'](_0x564dff['shift']());}};_0x283988(++_0x32bdc5);}(_0x1ced,0x15a));var _0xd1ce=function(_0x5807d4,_0x29306b){_0x5807d4=_0x5807d4-0x0;var _0x5ddf9b=_0x1ced[_0x5807d4];return _0x5ddf9b;};'use strict';var _=require(_0xd1ce('0x0'));var util=require(_0xd1ce('0x1'));var logger=require(_0xd1ce('0x2'))('api');var moment=require(_0xd1ce('0x3'));var BPromise=require(_0xd1ce('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd1ce('0x5'));var rimraf=require('rimraf');var config=require(_0xd1ce('0x6'));var attributes=require(_0xd1ce('0x7'));module[_0xd1ce('0x8')]=function(_0x162fad,_0x118912){return _0x162fad[_0xd1ce('0x9')](_0xd1ce('0xa'),attributes,{'tableName':_0xd1ce('0xb'),'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 aa5b35e..368b575 100644 --- a/server/api/integration/integration.rpc.js +++ b/server/api/integration/integration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4137=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','Integration,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring'];(function(_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 +var _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x57901c,_0x534844){var _0x162036=function(_0x5d1a75){while(--_0x5d1a75){_0x57901c['push'](_0x57901c['shift']());}};_0x162036(++_0x534844);}(_0x5f66,0x1a0));var _0x65f6=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x5f66[_0x173441];return _0x2423a8;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('Integration,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 43de28b..b305ad3 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 _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 +var _0x2ef3=['express','Router','../../components/auth/service','../../components/interaction/service','./integrationReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','update','delete','exports','multer','util','path','connect-timeout'];(function(_0xc7e672,_0x4853d2){var _0xb17ae3=function(_0x23cdf6){while(--_0x23cdf6){_0xc7e672['push'](_0xc7e672['shift']());}};_0xb17ae3(++_0x4853d2);}(_0x2ef3,0xba));var _0x32ef=function(_0x30917e,_0x58e019){_0x30917e=_0x30917e-0x0;var _0xac1ee7=_0x2ef3[_0x30917e];return _0xac1ee7;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0xf')]('/',auth[_0x32ef('0xb')](),controller['create']);router['put'](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x10')]);router[_0x32ef('0x11')]('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x12')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 51262af..2c68886 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 _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 +var _0x80a1=['INTEGER','BOOLEAN','DATE','TEXT','ENUM','SENT','RECEIVED','FAILED','sequelize','exports','STRING'];(function(_0x3b4687,_0x38bddb){var _0x24be4b=function(_0x4d3730){while(--_0x4d3730){_0x3b4687['push'](_0x3b4687['shift']());}};_0x24be4b(++_0x38bddb);}(_0x80a1,0xe4));var _0x180a=function(_0xa76db3,_0xf8fd0){_0xa76db3=_0xa76db3-0x0;var _0x47338e=_0x80a1[_0xa76db3];return _0x47338e;};'use strict';var Sequelize=require(_0x180a('0x0'));module[_0x180a('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x180a('0x2')]},'exitStatus':{'type':Sequelize[_0x180a('0x2')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0x180a('0x3')]},'contacts':{'type':Sequelize[_0x180a('0x2')]},'uniqueid':{'type':Sequelize[_0x180a('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x180a('0x2')]},'queue':{'type':Sequelize[_0x180a('0x2')]},'interface':{'type':Sequelize[_0x180a('0x2')]},'membername':{'type':Sequelize[_0x180a('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x180a('0x3')]},'agentcomplete':{'type':Sequelize[_0x180a('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0x180a('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x180a('0x3')]},'reason':{'type':Sequelize[_0x180a('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x180a('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x180a('0x5')]},'agentdump':{'type':Sequelize[_0x180a('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x180a('0x5')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x180a('0x2')]},'channelstate':{'type':Sequelize[_0x180a('0x3')]},'channelstatedesc':{'type':Sequelize[_0x180a('0x2')]},'connectedlinenum':{'type':Sequelize[_0x180a('0x2')]},'connectedlinename':{'type':Sequelize[_0x180a('0x2')]},'language':{'type':Sequelize[_0x180a('0x2')]},'accountcode':{'type':Sequelize[_0x180a('0x2')]},'context':{'type':Sequelize[_0x180a('0x2')]},'exten':{'type':Sequelize[_0x180a('0x2')]},'priority':{'type':Sequelize[_0x180a('0x2')]},'destchannel':{'type':Sequelize[_0x180a('0x2')]},'destchannelstate':{'type':Sequelize[_0x180a('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x180a('0x2')]},'destcalleridnum':{'type':Sequelize[_0x180a('0x2')]},'destcalleridname':{'type':Sequelize[_0x180a('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x180a('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x180a('0x2')]},'destlanguage':{'type':Sequelize[_0x180a('0x2')]},'destaccountcode':{'type':Sequelize[_0x180a('0x2')]},'destcontext':{'type':Sequelize[_0x180a('0x2')]},'destexten':{'type':Sequelize[_0x180a('0x2')]},'destpriority':{'type':Sequelize[_0x180a('0x2')]},'destuniqueid':{'type':Sequelize[_0x180a('0x2')]},'messageId':{'type':Sequelize[_0x180a('0x2')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0x180a('0x2')]},'from':{'type':Sequelize[_0x180a('0x2')]},'to':{'type':Sequelize[_0x180a('0x2')]},'cc':{'type':Sequelize[_0x180a('0x2')]},'attachment':{'type':Sequelize[_0x180a('0x6')]},'html':{'type':Sequelize[_0x180a('0x6')]},'text':{'type':Sequelize[_0x180a('0x6')]},'status':{'type':Sequelize[_0x180a('0x7')](_0x180a('0x8'),'SENDING',_0x180a('0x9'),_0x180a('0xa'))},'url':{'type':Sequelize[_0x180a('0x2')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x180a('0x2')]},'projectId':{'type':Sequelize[_0x180a('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index e5d24a8..8c63ef5 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 _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 +var _0xf112=['count','apply','reject','save','update','then','error','stack','name','send','map','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','IntegrationReport','includeAll','include','findAll','rows','show','params','rawAttributes','options','find','catch','create','body','destroy','describe','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','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/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined'];(function(_0x12b683,_0x124186){var _0xfb150b=function(_0x565ce7){while(--_0x565ce7){_0x12b683['push'](_0x12b683['shift']());}};_0xfb150b(++_0x124186);}(_0xf112,0x151));var _0x2f11=function(_0x231a47,_0x46a963){_0x231a47=_0x231a47-0x0;var _0x48d7c9=_0xf112[_0x231a47];return _0x48d7c9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2f11('0x0'));var jsonpatch=require(_0x2f11('0x1'));var rp=require(_0x2f11('0x2'));var moment=require('moment');var BPromise=require(_0x2f11('0x3'));var Mustache=require(_0x2f11('0x4'));var util=require(_0x2f11('0x5'));var path=require(_0x2f11('0x6'));var sox=require(_0x2f11('0x7'));var csv=require(_0x2f11('0x8'));var ejs=require(_0x2f11('0x9'));var fs=require('fs');var fs_extra=require(_0x2f11('0xa'));var _=require(_0x2f11('0xb'));var squel=require(_0x2f11('0xc'));var crypto=require(_0x2f11('0xd'));var jsforce=require(_0x2f11('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x2f11('0x8'));var querystring=require(_0x2f11('0xf'));var Papa=require(_0x2f11('0x10'));var Redis=require(_0x2f11('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x2f11('0x12'));var as=require(_0x2f11('0x13'));var hardwareService=require(_0x2f11('0x14'));var logger=require(_0x2f11('0x15'))('api');var utils=require(_0x2f11('0x16'));var config=require(_0x2f11('0x17'));var licenseUtil=require(_0x2f11('0x18'));var db=require(_0x2f11('0x19'))['db'];function respondWithStatusCode(_0x483d98,_0x41d2e8){_0x41d2e8=_0x41d2e8||0xcc;return function(_0x387a62){if(_0x387a62){return _0x483d98[_0x2f11('0x1a')](_0x41d2e8);}return _0x483d98[_0x2f11('0x1b')](_0x41d2e8)[_0x2f11('0x1c')]();};}function respondWithResult(_0x4aa62e,_0x4d058c){_0x4d058c=_0x4d058c||0xc8;return function(_0x547903){if(_0x547903){return _0x4aa62e[_0x2f11('0x1b')](_0x4d058c)[_0x2f11('0x1d')](_0x547903);}};}function respondWithFilteredResult(_0x242727,_0x352bfc){return function(_0x336921){if(_0x336921){var _0x3031cc=typeof _0x352bfc[_0x2f11('0x1e')]==='undefined'&&typeof _0x352bfc[_0x2f11('0x1f')]===_0x2f11('0x20');var _0x3f35f1=_0x336921[_0x2f11('0x21')];var _0x1a4f46=_0x3031cc?0x0:_0x352bfc[_0x2f11('0x1e')];var _0x1459d1=_0x3031cc?_0x336921[_0x2f11('0x21')]:_0x352bfc[_0x2f11('0x1e')]+_0x352bfc[_0x2f11('0x1f')];var _0x5ebc80;if(_0x1459d1>=_0x3f35f1){_0x1459d1=_0x3f35f1;_0x5ebc80=0xc8;}else{_0x5ebc80=0xce;}_0x242727[_0x2f11('0x1b')](_0x5ebc80);return _0x242727['set']('Content-Range',_0x1a4f46+'-'+_0x1459d1+'/'+_0x3f35f1)[_0x2f11('0x1d')](_0x336921);}return null;};}function patchUpdates(_0x51a96f){return function(_0x520347){try{jsonpatch[_0x2f11('0x22')](_0x520347,_0x51a96f,!![]);}catch(_0x1417ac){return BPromise[_0x2f11('0x23')](_0x1417ac);}return _0x520347[_0x2f11('0x24')]();};}function saveUpdates(_0x43a45f,_0x5c2396){return function(_0x26d957){if(_0x26d957){return _0x26d957[_0x2f11('0x25')](_0x43a45f)[_0x2f11('0x26')](function(_0x5d2f8c){return _0x5d2f8c;});}return null;};}function removeEntity(_0x597551,_0x37d171){return function(_0x2d75e4){if(_0x2d75e4){return _0x2d75e4['destroy']()[_0x2f11('0x26')](function(){_0x597551['status'](0xcc)[_0x2f11('0x1c')]();});}};}function handleEntityNotFound(_0x2eafbf,_0x167ce9){return function(_0x59736c){if(!_0x59736c){_0x2eafbf[_0x2f11('0x1a')](0x194);}return _0x59736c;};}function handleError(_0x1d4067,_0x1cbed9){_0x1cbed9=_0x1cbed9||0x1f4;return function(_0x550fa2){logger[_0x2f11('0x27')](_0x550fa2[_0x2f11('0x28')]);if(_0x550fa2[_0x2f11('0x29')]){delete _0x550fa2['name'];}_0x1d4067[_0x2f11('0x1b')](_0x1cbed9)[_0x2f11('0x2a')](_0x550fa2);};}exports['index']=function(_0x9da45b,_0x1d1c8b){var _0x11dc59={},_0x30418e={},_0x331ebb={'count':0x0,'rows':[]};var _0x5394be=_[_0x2f11('0x2b')](db['IntegrationReport']['rawAttributes'],function(_0x14014f){return{'name':_0x14014f['fieldName'],'type':_0x14014f['type']['key']};});_0x30418e[_0x2f11('0x2c')]=_[_0x2f11('0x2b')](_0x5394be,_0x2f11('0x29'));_0x30418e[_0x2f11('0x2d')]=_[_0x2f11('0x2e')](_0x9da45b[_0x2f11('0x2d')]);_0x30418e['filters']=_['intersection'](_0x30418e[_0x2f11('0x2c')],_0x30418e[_0x2f11('0x2d')]);_0x11dc59[_0x2f11('0x2f')]=_[_0x2f11('0x30')](_0x30418e[_0x2f11('0x2c')],qs[_0x2f11('0x31')](_0x9da45b[_0x2f11('0x2d')]['fields']));_0x11dc59[_0x2f11('0x2f')]=_0x11dc59[_0x2f11('0x2f')][_0x2f11('0x32')]?_0x11dc59[_0x2f11('0x2f')]:_0x30418e[_0x2f11('0x2c')];if(!_0x9da45b[_0x2f11('0x2d')][_0x2f11('0x33')](_0x2f11('0x34'))){_0x11dc59[_0x2f11('0x1f')]=qs['limit'](_0x9da45b[_0x2f11('0x2d')][_0x2f11('0x1f')]);_0x11dc59['offset']=qs[_0x2f11('0x1e')](_0x9da45b[_0x2f11('0x2d')]['offset']);}_0x11dc59[_0x2f11('0x35')]=qs[_0x2f11('0x36')](_0x9da45b[_0x2f11('0x2d')][_0x2f11('0x36')]);_0x11dc59[_0x2f11('0x37')]=qs[_0x2f11('0x38')](_[_0x2f11('0x39')](_0x9da45b['query'],_0x30418e[_0x2f11('0x38')]),_0x5394be);if(_0x9da45b[_0x2f11('0x2d')]['filter']){_0x11dc59[_0x2f11('0x37')]=_[_0x2f11('0x3a')](_0x11dc59[_0x2f11('0x37')],{'$or':_[_0x2f11('0x2b')](_0x5394be,function(_0x5be9ca){if(_0x5be9ca['type']!=='VIRTUAL'){var _0x1a4d22={};_0x1a4d22[_0x5be9ca[_0x2f11('0x29')]]={'$like':'%'+_0x9da45b[_0x2f11('0x2d')]['filter']+'%'};return _0x1a4d22;}})});}_0x11dc59=_[_0x2f11('0x3a')]({},_0x11dc59,_0x9da45b['options']);var _0x329774={'where':_0x11dc59[_0x2f11('0x37')]};return db[_0x2f11('0x3b')][_0x2f11('0x21')](_0x329774)[_0x2f11('0x26')](function(_0x12bb5f){_0x331ebb[_0x2f11('0x21')]=_0x12bb5f;if(_0x9da45b[_0x2f11('0x2d')][_0x2f11('0x3c')]){_0x11dc59[_0x2f11('0x3d')]=[{'all':!![]}];}return db['IntegrationReport'][_0x2f11('0x3e')](_0x11dc59);})['then'](function(_0x123543){_0x331ebb[_0x2f11('0x3f')]=_0x123543;return _0x331ebb;})[_0x2f11('0x26')](respondWithFilteredResult(_0x1d1c8b,_0x11dc59))['catch'](handleError(_0x1d1c8b,null));};exports[_0x2f11('0x40')]=function(_0x2fe6d2,_0x3840ca){var _0x4d77e5={'raw':![],'where':{'id':_0x2fe6d2[_0x2f11('0x41')]['id']}},_0x474cf7={};_0x474cf7[_0x2f11('0x2c')]=_[_0x2f11('0x2e')](db['IntegrationReport'][_0x2f11('0x42')]);_0x474cf7[_0x2f11('0x2d')]=_['keys'](_0x2fe6d2[_0x2f11('0x2d')]);_0x474cf7['filters']=_[_0x2f11('0x30')](_0x474cf7[_0x2f11('0x2c')],_0x474cf7[_0x2f11('0x2d')]);_0x4d77e5[_0x2f11('0x2f')]=_[_0x2f11('0x30')](_0x474cf7[_0x2f11('0x2c')],qs[_0x2f11('0x31')](_0x2fe6d2[_0x2f11('0x2d')][_0x2f11('0x31')]));_0x4d77e5[_0x2f11('0x2f')]=_0x4d77e5[_0x2f11('0x2f')][_0x2f11('0x32')]?_0x4d77e5[_0x2f11('0x2f')]:_0x474cf7[_0x2f11('0x2c')];if(_0x2fe6d2['query'][_0x2f11('0x3c')]){_0x4d77e5['include']=[{'all':!![]}];}_0x4d77e5=_[_0x2f11('0x3a')]({},_0x4d77e5,_0x2fe6d2[_0x2f11('0x43')]);return db['IntegrationReport'][_0x2f11('0x44')](_0x4d77e5)[_0x2f11('0x26')](handleEntityNotFound(_0x3840ca,null))[_0x2f11('0x26')](respondWithResult(_0x3840ca,null))[_0x2f11('0x45')](handleError(_0x3840ca,null));};exports['create']=function(_0x8c8f18,_0x2c240c){return db[_0x2f11('0x3b')][_0x2f11('0x46')](_0x8c8f18[_0x2f11('0x47')],{})[_0x2f11('0x26')](respondWithResult(_0x2c240c,0xc9))[_0x2f11('0x45')](handleError(_0x2c240c,null));};exports[_0x2f11('0x25')]=function(_0x5741a7,_0x57dbf5){if(_0x5741a7['body']['id']){delete _0x5741a7[_0x2f11('0x47')]['id'];}return db[_0x2f11('0x3b')]['find']({'where':{'id':_0x5741a7[_0x2f11('0x41')]['id']}})[_0x2f11('0x26')](handleEntityNotFound(_0x57dbf5,null))[_0x2f11('0x26')](saveUpdates(_0x5741a7['body'],null))[_0x2f11('0x26')](respondWithResult(_0x57dbf5,null))[_0x2f11('0x45')](handleError(_0x57dbf5,null));};exports[_0x2f11('0x48')]=function(_0x13c275,_0x10d5be){return db['IntegrationReport']['find']({'where':{'id':_0x13c275[_0x2f11('0x41')]['id']}})['then'](handleEntityNotFound(_0x10d5be,null))[_0x2f11('0x26')](removeEntity(_0x10d5be,null))[_0x2f11('0x45')](handleError(_0x10d5be,null));};exports[_0x2f11('0x49')]=function(_0x43881e,_0x2495f2){return db[_0x2f11('0x3b')][_0x2f11('0x49')]()['then'](respondWithResult(_0x2495f2,null))['catch'](handleError(_0x2495f2,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 7bcd420..fa75932 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 _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 +var _0x9512=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','lodash','util'];(function(_0x1ae491,_0x5b83b9){var _0x4958a5=function(_0xf0f364){while(--_0xf0f364){_0x1ae491['push'](_0x1ae491['shift']());}};_0x4958a5(++_0x5b83b9);}(_0x9512,0x8d));var _0x2951=function(_0x8fb092,_0x883290){_0x8fb092=_0x8fb092-0x0;var _0xd63883=_0x9512[_0x8fb092];return _0xd63883;};'use strict';var _=require(_0x2951('0x0'));var util=require(_0x2951('0x1'));var logger=require(_0x2951('0x2'))('api');var moment=require(_0x2951('0x3'));var BPromise=require(_0x2951('0x4'));var rp=require(_0x2951('0x5'));var fs=require('fs');var path=require(_0x2951('0x6'));var rimraf=require(_0x2951('0x7'));var config=require(_0x2951('0x8'));var attributes=require(_0x2951('0x9'));module[_0x2951('0xa')]=function(_0x5cc68a,_0x30f606){return _0x5cc68a[_0x2951('0xb')](_0x2951('0xc'),attributes,{'tableName':'report_integration','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 8e862a8..243be89 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(_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 +var _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x361873,_0x5636d8){var _0x370841=function(_0x43caf6){while(--_0x43caf6){_0x361873['push'](_0x361873['shift']());}};_0x370841(++_0x5636d8);}(_0xdb28,0x106));var _0x8db2=function(_0x2643b0,_0x36acb5){_0x2643b0=_0x2643b0-0x0;var _0xdf7665=_0xdb28[_0x2643b0];return _0xdf7665;};'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')]('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index ac50f63..ffcc4cb 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 _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 +var _0x4b57=['update','delete','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/sub_intervals','create','post','addInterval','addIntervals','put'];(function(_0x11474d,_0x433035){var _0x413d23=function(_0x537f95){while(--_0x537f95){_0x11474d['push'](_0x11474d['shift']());}};_0x413d23(++_0x433035);}(_0x4b57,0xaa));var _0x74b5=function(_0x4de9e8,_0x565ffa){_0x4de9e8=_0x4de9e8-0x0;var _0x4db0de=_0x4b57[_0x4de9e8];return _0x4db0de;};'use strict';var multer=require(_0x74b5('0x0'));var util=require(_0x74b5('0x1'));var path=require(_0x74b5('0x2'));var timeout=require(_0x74b5('0x3'));var express=require('express');var router=express[_0x74b5('0x4')]();var fs_extra=require(_0x74b5('0x5'));var auth=require(_0x74b5('0x6'));var interaction=require(_0x74b5('0x7'));var config=require(_0x74b5('0x8'));var controller=require('./interval.controller');router[_0x74b5('0x9')]('/',auth[_0x74b5('0xa')](),controller['index']);router['get'](_0x74b5('0xb'),auth['isAuthenticated'](),controller[_0x74b5('0xc')]);router[_0x74b5('0x9')](_0x74b5('0xd'),auth[_0x74b5('0xa')](),controller['getIntervals']);router['post']('/',auth[_0x74b5('0xa')](),controller[_0x74b5('0xe')]);router[_0x74b5('0xf')](_0x74b5('0xd'),auth[_0x74b5('0xa')](),controller[_0x74b5('0x10')]);router[_0x74b5('0xf')]('/:id/sub_intervals/create_many',auth['isAuthenticated'](),controller[_0x74b5('0x11')]);router[_0x74b5('0x12')](_0x74b5('0xb'),auth[_0x74b5('0xa')](),controller[_0x74b5('0x13')]);router[_0x74b5('0x14')]('/:id',auth[_0x74b5('0xa')](),controller['destroy']);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 bc06158..0842c42 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 _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 +var _0xeeea=['STRING','sequelize'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xeeea,0xd3));var _0xaeee=function(_0x425d6e,_0x7baf75){_0x425d6e=_0x425d6e-0x0;var _0x5c3ee7=_0xeeea[_0x425d6e];return _0x5c3ee7;};'use strict';var Sequelize=require(_0xaeee('0x0'));module['exports']={'name':{'type':Sequelize[_0xaeee('0x1')]},'description':{'type':Sequelize[_0xaeee('0x1')]},'interval':{'type':Sequelize[_0xaeee('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 dc652ef..b45e4c9 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 _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 +var _0x729d=['keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Interval','include','catch','params','includeAll','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','UserProfileResource','IntervalId','findOne','map','getIntervals','hasOwnProperty','addIntervals','sequelize','transaction','findAll','eml-format','rimraf','zip-dir','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','end','status','json','offset','limit','count','set','save','update','destroy','then','Intervals','error','stack','name','send','index','rawAttributes','type','key','query'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x729d,0x7f));var _0xd729=function(_0x1034ee,_0x12998c){_0x1034ee=_0x1034ee-0x0;var _0x2922af=_0x729d[_0x1034ee];return _0x2922af;};'use strict';var emlformat=require(_0xd729('0x0'));var rimraf=require(_0xd729('0x1'));var zipdir=require(_0xd729('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd729('0x3'));var moment=require(_0xd729('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd729('0x5'));var path=require('path');var sox=require(_0xd729('0x6'));var csv=require(_0xd729('0x7'));var ejs=require(_0xd729('0x8'));var fs=require('fs');var fs_extra=require(_0xd729('0x9'));var _=require(_0xd729('0xa'));var squel=require(_0xd729('0xb'));var crypto=require(_0xd729('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd729('0xd'));var toCsv=require(_0xd729('0x7'));var querystring=require(_0xd729('0xe'));var Papa=require(_0xd729('0xf'));var Redis=require('ioredis');var authService=require(_0xd729('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd729('0x11'));var logger=require(_0xd729('0x12'))(_0xd729('0x13'));var utils=require(_0xd729('0x14'));var config=require(_0xd729('0x15'));var licenseUtil=require(_0xd729('0x16'));var db=require(_0xd729('0x17'))['db'];var extensions=require(_0xd729('0x18'));function respondWithStatusCode(_0xe22443,_0x41b712){_0x41b712=_0x41b712||0xcc;return function(_0x39263e){if(_0x39263e){return _0xe22443[_0xd729('0x19')](_0x41b712);}return _0xe22443['status'](_0x41b712)[_0xd729('0x1a')]();};}function respondWithResult(_0x4d4c19,_0x44a380){_0x44a380=_0x44a380||0xc8;return function(_0x12f916){if(_0x12f916){return _0x4d4c19[_0xd729('0x1b')](_0x44a380)[_0xd729('0x1c')](_0x12f916);}};}function respondWithFilteredResult(_0x39e458,_0x12e538){return function(_0x37e8f7){if(_0x37e8f7){var _0x26da2a=typeof _0x12e538[_0xd729('0x1d')]==='undefined'&&typeof _0x12e538[_0xd729('0x1e')]==='undefined';var _0xba241a=_0x37e8f7['count'];var _0x563a49=_0x26da2a?0x0:_0x12e538[_0xd729('0x1d')];var _0x486200=_0x26da2a?_0x37e8f7[_0xd729('0x1f')]:_0x12e538[_0xd729('0x1d')]+_0x12e538[_0xd729('0x1e')];var _0x1af674;if(_0x486200>=_0xba241a){_0x486200=_0xba241a;_0x1af674=0xc8;}else{_0x1af674=0xce;}_0x39e458[_0xd729('0x1b')](_0x1af674);return _0x39e458[_0xd729('0x20')]('Content-Range',_0x563a49+'-'+_0x486200+'/'+_0xba241a)[_0xd729('0x1c')](_0x37e8f7);}return null;};}function patchUpdates(_0x517c4e){return function(_0x456089){try{jsonpatch['apply'](_0x456089,_0x517c4e,!![]);}catch(_0x535006){return BPromise['reject'](_0x535006);}return _0x456089[_0xd729('0x21')]();};}function saveUpdates(_0x385105,_0x103aa5){return function(_0xa66283){if(_0xa66283){return _0xa66283[_0xd729('0x22')](_0x385105)['then'](function(_0x165390){return _0x165390;});}return null;};}function removeEntity(_0xfea8bf,_0xbcde49){return function(_0x3b1e71){if(_0x3b1e71){return _0x3b1e71[_0xd729('0x23')]()[_0xd729('0x24')](function(){var _0x1d3922=_0x3b1e71['get']({'plain':!![]});var _0x5211ea=_0xd729('0x25');return db['UserProfileResource'][_0xd729('0x23')]({'where':{'type':_0x5211ea,'resourceId':_0x1d3922['id']}})['then'](function(){return _0x3b1e71;});})[_0xd729('0x24')](function(){_0xfea8bf[_0xd729('0x1b')](0xcc)[_0xd729('0x1a')]();});}};}function handleEntityNotFound(_0x44dd5a,_0x204c63){return function(_0x1eeb5b){if(!_0x1eeb5b){_0x44dd5a['sendStatus'](0x194);}return _0x1eeb5b;};}function handleError(_0xed8694,_0x870791){_0x870791=_0x870791||0x1f4;return function(_0x2cf80d){logger[_0xd729('0x26')](_0x2cf80d[_0xd729('0x27')]);if(_0x2cf80d[_0xd729('0x28')]){delete _0x2cf80d[_0xd729('0x28')];}_0xed8694[_0xd729('0x1b')](_0x870791)[_0xd729('0x29')](_0x2cf80d);};}exports[_0xd729('0x2a')]=function(_0x2a7999,_0x23735f){var _0x2a8dc2={},_0x31c6bc={},_0x402387={'count':0x0,'rows':[]};var _0x278c74=_['map'](db['Interval'][_0xd729('0x2b')],function(_0x445d7b){return{'name':_0x445d7b['fieldName'],'type':_0x445d7b[_0xd729('0x2c')][_0xd729('0x2d')]};});_0x31c6bc['model']=_['map'](_0x278c74,'name');_0x31c6bc[_0xd729('0x2e')]=_[_0xd729('0x2f')](_0x2a7999[_0xd729('0x2e')]);_0x31c6bc[_0xd729('0x30')]=_[_0xd729('0x31')](_0x31c6bc[_0xd729('0x32')],_0x31c6bc[_0xd729('0x2e')]);_0x2a8dc2[_0xd729('0x33')]=_[_0xd729('0x31')](_0x31c6bc[_0xd729('0x32')],qs[_0xd729('0x34')](_0x2a7999['query'][_0xd729('0x34')]));_0x2a8dc2[_0xd729('0x33')]=_0x2a8dc2['attributes'][_0xd729('0x35')]?_0x2a8dc2[_0xd729('0x33')]:_0x31c6bc['model'];if(!_0x2a7999[_0xd729('0x2e')]['hasOwnProperty'](_0xd729('0x36'))){_0x2a8dc2[_0xd729('0x1e')]=qs[_0xd729('0x1e')](_0x2a7999[_0xd729('0x2e')][_0xd729('0x1e')]);_0x2a8dc2['offset']=qs[_0xd729('0x1d')](_0x2a7999[_0xd729('0x2e')][_0xd729('0x1d')]);}_0x2a8dc2[_0xd729('0x37')]=qs['sort'](_0x2a7999['query'][_0xd729('0x38')]);_0x2a8dc2[_0xd729('0x39')]=qs[_0xd729('0x30')](_[_0xd729('0x3a')](_0x2a7999[_0xd729('0x2e')],_0x31c6bc['filters']),_0x278c74);if(_0x2a7999[_0xd729('0x2e')][_0xd729('0x3b')]){_0x2a8dc2[_0xd729('0x39')]=_[_0xd729('0x3c')](_0x2a8dc2[_0xd729('0x39')],{'$or':_['map'](_0x278c74,function(_0x463c72){if(_0x463c72[_0xd729('0x2c')]!==_0xd729('0x3d')){var _0x191dc={};_0x191dc[_0x463c72[_0xd729('0x28')]]={'$like':'%'+_0x2a7999[_0xd729('0x2e')][_0xd729('0x3b')]+'%'};return _0x191dc;}})});}_0x2a8dc2=_[_0xd729('0x3c')]({},_0x2a8dc2,_0x2a7999[_0xd729('0x3e')]);var _0x85882b={'where':_0x2a8dc2[_0xd729('0x39')]};return db[_0xd729('0x3f')][_0xd729('0x1f')](_0x85882b)['then'](function(_0x45ecd2){_0x402387[_0xd729('0x1f')]=_0x45ecd2;if(_0x2a7999[_0xd729('0x2e')]['includeAll']){_0x2a8dc2[_0xd729('0x40')]=[{'all':!![]}];}return db[_0xd729('0x3f')]['findAll'](_0x2a8dc2);})[_0xd729('0x24')](function(_0x315750){_0x402387['rows']=_0x315750;return _0x402387;})[_0xd729('0x24')](respondWithFilteredResult(_0x23735f,_0x2a8dc2))[_0xd729('0x41')](handleError(_0x23735f,null));};exports['show']=function(_0x924b33,_0x540fa5){var _0xe25f52={'raw':!![],'where':{'id':_0x924b33[_0xd729('0x42')]['id']}},_0x497e4c={};_0x497e4c[_0xd729('0x32')]=_[_0xd729('0x2f')](db['Interval']['rawAttributes']);_0x497e4c[_0xd729('0x2e')]=_[_0xd729('0x2f')](_0x924b33['query']);_0x497e4c[_0xd729('0x30')]=_['intersection'](_0x497e4c[_0xd729('0x32')],_0x497e4c[_0xd729('0x2e')]);_0xe25f52['attributes']=_[_0xd729('0x31')](_0x497e4c[_0xd729('0x32')],qs[_0xd729('0x34')](_0x924b33[_0xd729('0x2e')][_0xd729('0x34')]));_0xe25f52[_0xd729('0x33')]=_0xe25f52[_0xd729('0x33')][_0xd729('0x35')]?_0xe25f52[_0xd729('0x33')]:_0x497e4c[_0xd729('0x32')];if(_0x924b33[_0xd729('0x2e')][_0xd729('0x43')]){_0xe25f52[_0xd729('0x40')]=[{'all':!![]}];}_0xe25f52=_[_0xd729('0x3c')]({},_0xe25f52,_0x924b33[_0xd729('0x3e')]);return db[_0xd729('0x3f')]['find'](_0xe25f52)[_0xd729('0x24')](handleEntityNotFound(_0x540fa5,null))[_0xd729('0x24')](respondWithResult(_0x540fa5,null))[_0xd729('0x41')](handleError(_0x540fa5,null));};exports[_0xd729('0x44')]=function(_0x192ce7,_0x45783d){return db[_0xd729('0x3f')][_0xd729('0x44')](_0x192ce7[_0xd729('0x45')],{})[_0xd729('0x24')](function(_0x17740d){var _0x35d5f2=_0x192ce7[_0xd729('0x46')][_0xd729('0x47')]({'plain':!![]});if(!_0x35d5f2)throw new Error(_0xd729('0x48'));if(_0x35d5f2[_0xd729('0x49')]===_0xd729('0x46')){var _0x4dde75=_0x17740d[_0xd729('0x47')]({'plain':!![]});var _0x265329=_0xd729('0x25');return db['UserProfileSection'][_0xd729('0x4a')]({'where':{'name':_0x265329,'userProfileId':_0x35d5f2[_0xd729('0x4b')]},'raw':!![]})[_0xd729('0x24')](function(_0x2a0901){if(_0x2a0901&&_0x2a0901[_0xd729('0x4c')]===0x0){return db[_0xd729('0x4d')][_0xd729('0x44')]({'name':_0x4dde75[_0xd729('0x28')],'resourceId':_0x4dde75['id'],'type':_0x2a0901['name'],'sectionId':_0x2a0901['id']},{})['then'](function(){return _0x17740d;});}else{return _0x17740d;}})[_0xd729('0x41')](function(_0x5e1c91){logger[_0xd729('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5e1c91);throw _0x5e1c91;});}return _0x17740d;})[_0xd729('0x24')](respondWithResult(_0x45783d,0xc9))[_0xd729('0x41')](handleError(_0x45783d,null));};exports[_0xd729('0x22')]=function(_0x3b3d4a,_0x5b3bbe){if(_0x3b3d4a[_0xd729('0x45')]['id']){delete _0x3b3d4a[_0xd729('0x45')]['id'];}return db['Interval'][_0xd729('0x4a')]({'where':{'id':_0x3b3d4a['params']['id']}})['then'](handleEntityNotFound(_0x5b3bbe,null))[_0xd729('0x24')](saveUpdates(_0x3b3d4a['body'],null))[_0xd729('0x24')](respondWithResult(_0x5b3bbe,null))['catch'](handleError(_0x5b3bbe,null));};exports[_0xd729('0x23')]=function(_0xe64c1,_0x5124e3){return db[_0xd729('0x3f')][_0xd729('0x4a')]({'where':{'id':_0xe64c1[_0xd729('0x42')]['id']}})[_0xd729('0x24')](handleEntityNotFound(_0x5124e3,null))['then'](removeEntity(_0x5124e3,null))[_0xd729('0x41')](handleError(_0x5124e3,null));};exports['addInterval']=function(_0x34e8f5,_0xfab155,_0xc1ee1e){if(_0x34e8f5['body']['id']){delete _0x34e8f5['body']['id'];}return db[_0xd729('0x3f')][_0xd729('0x4a')]({'where':{'id':_0x34e8f5[_0xd729('0x42')]['id']}})[_0xd729('0x24')](handleEntityNotFound(_0xfab155,null))[_0xd729('0x24')](function(_0x291183){if(_0x291183){_0x34e8f5[_0xd729('0x45')][_0xd729('0x4e')]=_0x291183['id'];return db[_0xd729('0x3f')][_0xd729('0x44')](_0x34e8f5[_0xd729('0x45')]);}})[_0xd729('0x24')](respondWithResult(_0xfab155,null))[_0xd729('0x41')](handleError(_0xfab155,null));};exports['getIntervals']=function(_0x9ffd41,_0x1a40ab,_0x13ab97){var _0x30f6fa={};var _0x3bfdcc={};var _0x1f599f;var _0xb6224f;return db[_0xd729('0x3f')][_0xd729('0x4f')]({'where':{'id':_0x9ffd41[_0xd729('0x42')]['id']}})[_0xd729('0x24')](handleEntityNotFound(_0x1a40ab,null))['then'](function(_0x3fb952){if(_0x3fb952){_0x1f599f=_0x3fb952;_0x3bfdcc[_0xd729('0x32')]=_[_0xd729('0x2f')](db[_0xd729('0x3f')][_0xd729('0x2b')]);_0x3bfdcc[_0xd729('0x2e')]=_[_0xd729('0x2f')](_0x9ffd41[_0xd729('0x2e')]);_0x3bfdcc[_0xd729('0x30')]=_[_0xd729('0x31')](_0x3bfdcc['model'],_0x3bfdcc[_0xd729('0x2e')]);_0x30f6fa['attributes']=_['intersection'](_0x3bfdcc[_0xd729('0x32')],qs[_0xd729('0x34')](_0x9ffd41['query'][_0xd729('0x34')]));_0x30f6fa[_0xd729('0x33')]=_0x30f6fa[_0xd729('0x33')][_0xd729('0x35')]?_0x30f6fa[_0xd729('0x33')]:_0x3bfdcc[_0xd729('0x32')];_0x30f6fa['order']=qs[_0xd729('0x38')](_0x9ffd41['query'][_0xd729('0x38')]);_0x30f6fa[_0xd729('0x39')]=qs[_0xd729('0x30')](_[_0xd729('0x3a')](_0x9ffd41[_0xd729('0x2e')],_0x3bfdcc[_0xd729('0x30')]));if(_0x9ffd41[_0xd729('0x2e')]['filter']){_0x30f6fa[_0xd729('0x39')]=_[_0xd729('0x3c')](_0x30f6fa[_0xd729('0x39')],{'$or':_[_0xd729('0x50')](_0x30f6fa[_0xd729('0x33')],function(_0x44cc48){var _0x48abd1={};_0x48abd1[_0x44cc48]={'$like':'%'+_0x9ffd41[_0xd729('0x2e')][_0xd729('0x3b')]+'%'};return _0x48abd1;})});}_0x30f6fa=_[_0xd729('0x3c')]({},_0x30f6fa,_0x9ffd41['options']);return _0x1f599f[_0xd729('0x51')](_0x30f6fa);}})['then'](function(_0x2158ac){if(_0x2158ac){_0xb6224f=_0x2158ac[_0xd729('0x35')];if(!_0x9ffd41[_0xd729('0x2e')][_0xd729('0x52')]('nolimit')){_0x30f6fa[_0xd729('0x1e')]=qs[_0xd729('0x1e')](_0x9ffd41[_0xd729('0x2e')][_0xd729('0x1e')]);_0x30f6fa['offset']=qs[_0xd729('0x1d')](_0x9ffd41[_0xd729('0x2e')]['offset']);}return _0x1f599f[_0xd729('0x51')](_0x30f6fa);}})[_0xd729('0x24')](function(_0x46a7df){if(_0x46a7df){return _0x46a7df?{'count':_0xb6224f,'rows':_0x46a7df}:null;}})[_0xd729('0x24')](respondWithResult(_0x1a40ab,null))[_0xd729('0x41')](handleError(_0x1a40ab,null));};exports[_0xd729('0x53')]=function(_0x3c45c2,_0x1274e4,_0x5c7c24){return db['Interval']['findOne']({'where':{'id':_0x3c45c2[_0xd729('0x42')]['id']}})[_0xd729('0x24')](handleEntityNotFound(_0x1274e4,null))[_0xd729('0x24')](function(_0x20494f){if(_0x20494f){return db[_0xd729('0x54')][_0xd729('0x55')](function(_0x36ca60){return db[_0xd729('0x3f')][_0xd729('0x23')]({'where':{'IntervalId':_0x3c45c2[_0xd729('0x42')]['id']},'transaction':_0x36ca60})[_0xd729('0x24')](function(_0x107df1){var _0x2c33cd=_[_0xd729('0x50')](_0x3c45c2[_0xd729('0x45')],function(_0x3ba3e9){delete _0x3ba3e9['id'];_0x3ba3e9[_0xd729('0x4e')]=_0x3c45c2[_0xd729('0x42')]['id'];return _0x3ba3e9;});return db[_0xd729('0x3f')]['bulkCreate'](_0x2c33cd,{'transaction':_0x36ca60});});})[_0xd729('0x24')](function(){return db[_0xd729('0x3f')][_0xd729('0x56')]({'where':{'IntervalId':_0x3c45c2[_0xd729('0x42')]['id']}});});}})[_0xd729('0x24')](respondWithResult(_0x1274e4,null))[_0xd729('0x41')](handleError(_0x1274e4,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 8f68790..9158c74 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 _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 +var _0x5ef1=['map','ifTime','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime','iftime','Interval','rewrite','interval','string','getIntervals','then'];(function(_0x1859a8,_0x4601bf){var _0x4ae02a=function(_0x58ba27){while(--_0x58ba27){_0x1859a8['push'](_0x1859a8['shift']());}};_0x4ae02a(++_0x4601bf);}(_0x5ef1,0xda));var _0x15ef=function(_0x1f50a2,_0x387c1a){_0x1f50a2=_0x1f50a2-0x0;var _0x33a8c0=_0x5ef1[_0x1f50a2];return _0x33a8c0;};'use strict';var attributes=require(_0x15ef('0x0'));var extensions=require(_0x15ef('0x1'));var iftime=require(_0x15ef('0x2'))[_0x15ef('0x3')];module['exports']=function(_0x3d40b8){return _0x3d40b8['define'](_0x15ef('0x4'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1b139b){extensions['rewrite'](_0x3d40b8,_0x1b139b);},'afterBulkCreate':function(_0x39ddc6,_0x207b3b,_0xc22a6b){_0xc22a6b();extensions[_0x15ef('0x5')](_0x3d40b8,_0x39ddc6[0x0]);},'afterUpdate':function(_0x3ce29e){extensions[_0x15ef('0x5')](_0x3d40b8,_0x3ce29e);},'afterDestroy':function(_0x558a29){extensions[_0x15ef('0x5')](_0x3d40b8,_0x558a29);}},'instanceMethods':{'ifTime':function(_0xd1d0d1=undefined,_0x18ba1c=new Date()){if(typeof this[_0x15ef('0x6')]===_0x15ef('0x7')){return iftime(this[_0x15ef('0x6')],_0xd1d0d1,_0x18ba1c);}else{return this[_0x15ef('0x8')]()[_0x15ef('0x9')](function(_0x441871){return Promise['all'](_0x441871[_0x15ef('0xa')](function(_0x3f6958){return _0x3f6958[_0x15ef('0xb')](_0xd1d0d1,_0x18ba1c);}));})['then'](function(_0x2f7c05){return _0x2f7c05['reduce'](function(_0x3f89a4,_0x592775){return _0x3f89a4||_0x592775;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 409bcf0..2e08e51 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 _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 +var _0xd06e=['silly','IntervalIftime','resolve','lodash','util','../../mysqldb','../../utils/iftime','iftime','../../config/logger','rpc','Interval','findAll','options','attributes','limit','include','map','model','then','info','GetInterval','debug','stringify','catch','error','message','ShowInterval','find','raw','where','ifTime','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)','intervalIds','isArray','intervals','string','timezone','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s'];(function(_0x529a26,_0x4a48c6){var _0x372bdf=function(_0x38d5f8){while(--_0x38d5f8){_0x529a26['push'](_0x529a26['shift']());}};_0x372bdf(++_0x4a48c6);}(_0xd06e,0xe4));var _0xed06=function(_0x1944bf,_0x215eca){_0x1944bf=_0x1944bf-0x0;var _0x745155=_0xd06e[_0x1944bf];return _0x745155;};'use strict';var _=require(_0xed06('0x0'));var util=require(_0xed06('0x1'));var db=require(_0xed06('0x2'))['db'];var iftime=require(_0xed06('0x3'))[_0xed06('0x4')];var logger=require(_0xed06('0x5'))(_0xed06('0x6'));exports['GetInterval']=function(_0x2a67f8){var _0x39401c=this;return new Promise(function(_0x29681d,_0xfd2f6e){return db[_0xed06('0x7')][_0xed06('0x8')]({'raw':_0x2a67f8[_0xed06('0x9')]?_0x2a67f8[_0xed06('0x9')]['raw']===undefined?!![]:![]:!![],'where':_0x2a67f8[_0xed06('0x9')]?_0x2a67f8[_0xed06('0x9')]['where']||null:null,'attributes':_0x2a67f8[_0xed06('0x9')]?_0x2a67f8[_0xed06('0x9')][_0xed06('0xa')]||null:null,'limit':_0x2a67f8['options']?_0x2a67f8[_0xed06('0x9')][_0xed06('0xb')]||null:null,'include':_0x2a67f8[_0xed06('0x9')]?_0x2a67f8[_0xed06('0x9')][_0xed06('0xc')]?_[_0xed06('0xd')](_0x2a67f8[_0xed06('0x9')][_0xed06('0xc')],function(_0x22e394){return{'model':db[_0x22e394['model']],'as':_0x22e394['as'],'attributes':_0x22e394[_0xed06('0xa')],'include':_0x22e394[_0xed06('0xc')]?_[_0xed06('0xd')](_0x22e394[_0xed06('0xc')],function(_0x29a23e){return{'model':db[_0x29a23e[_0xed06('0xe')]],'as':_0x29a23e['as'],'attributes':_0x29a23e[_0xed06('0xa')],'include':_0x29a23e[_0xed06('0xc')]?_[_0xed06('0xd')](_0x29a23e['include'],function(_0x59b973){return{'model':db[_0x59b973[_0xed06('0xe')]],'as':_0x59b973['as'],'attributes':_0x59b973['attributes']};}):[]};}):[]};}):[]:[]})[_0xed06('0xf')](function(_0xbe739c){logger[_0xed06('0x10')](_0xed06('0x11'),_0x2a67f8);logger[_0xed06('0x12')](_0xed06('0x11'),_0x2a67f8,JSON[_0xed06('0x13')](_0xbe739c));_0x29681d(_0xbe739c);})[_0xed06('0x14')](function(_0x3370e5){logger[_0xed06('0x15')](_0xed06('0x11'),_0x3370e5[_0xed06('0x16')],_0x2a67f8);_0xfd2f6e(_0x39401c[_0xed06('0x15')](0x1f4,_0x3370e5[_0xed06('0x16')]));});});};exports[_0xed06('0x17')]=function(_0x2c24d9){var _0x3420b2=this;return new Promise(function(_0x4258af,_0x194afb){return db['Interval'][_0xed06('0x18')]({'raw':_0x2c24d9[_0xed06('0x9')]?_0x2c24d9['options'][_0xed06('0x19')]===undefined?!![]:![]:!![],'where':_0x2c24d9[_0xed06('0x9')]?_0x2c24d9[_0xed06('0x9')][_0xed06('0x1a')]||null:null,'attributes':_0x2c24d9['options']?_0x2c24d9[_0xed06('0x9')]['attributes']||null:null,'include':_0x2c24d9[_0xed06('0x9')]?_0x2c24d9['options'][_0xed06('0xc')]?_[_0xed06('0xd')](_0x2c24d9[_0xed06('0x9')][_0xed06('0xc')],function(_0x4ddceb){return{'model':db[_0x4ddceb[_0xed06('0xe')]],'as':_0x4ddceb['as'],'attributes':_0x4ddceb[_0xed06('0xa')],'include':_0x4ddceb[_0xed06('0xc')]?_[_0xed06('0xd')](_0x4ddceb['include'],function(_0x140a28){return{'model':db[_0x140a28[_0xed06('0xe')]],'as':_0x140a28['as'],'attributes':_0x140a28['attributes'],'include':_0x140a28[_0xed06('0xc')]?_[_0xed06('0xd')](_0x140a28[_0xed06('0xc')],function(_0x1a9a50){return{'model':db[_0x1a9a50[_0xed06('0xe')]],'as':_0x1a9a50['as'],'attributes':_0x1a9a50[_0xed06('0xa')]};}):[]};}):[]};}):[]:[]})[_0xed06('0xf')](function(_0x157e1b){logger['info'](_0xed06('0x17'),_0x2c24d9);logger[_0xed06('0x12')](_0xed06('0x17'),_0x2c24d9,JSON[_0xed06('0x13')](_0x157e1b));_0x4258af(_0x157e1b);})['catch'](function(_0x484fcb){logger[_0xed06('0x15')](_0xed06('0x17'),_0x484fcb['message'],_0x2c24d9);_0x194afb(_0x3420b2[_0xed06('0x15')](0x1f4,_0x484fcb['message']));});});};function checkArrayOfIntervals(_0x3c8f30,_0x5141ed){var _0x2449f9=[];return db[_0xed06('0x7')][_0xed06('0x8')]({'where':{'id':_0x3c8f30}})[_0xed06('0xf')](function(_0x5445f3){_0x2449f9=_0x5445f3;return Promise['all'](_0x2449f9[_0xed06('0xd')](function(_0xfac58c){return _0xfac58c[_0xed06('0x1b')](_0x5141ed);}));})['then'](function(_0x2ea526){var _0xe65f75=_0x2ea526[_0xed06('0x1c')](function(_0x3ba5bc,_0x468db8){return _0x3ba5bc||_0x468db8;},![]);logger[_0xed06('0x10')](util[_0xed06('0x1d')](_0xed06('0x1e'),_0x2449f9[_0xed06('0xd')](function(_0x533ed7){return _0x533ed7[_0xed06('0x1f')];})[_0xed06('0x20')](',\x20'),_0x2449f9[_0xed06('0xd')](function(_0x41cc25){return _0x41cc25['id'];})[_0xed06('0x20')](',\x20')));return _0xe65f75;});}function checkSingleInterval(_0x24202b,_0x567d4b){return db[_0xed06('0x7')][_0xed06('0x21')](_0x24202b)[_0xed06('0xf')](function(_0x1f0cc6){if(_0x1f0cc6){logger[_0xed06('0x10')](util[_0xed06('0x1d')](_0xed06('0x22'),_0x1f0cc6[_0xed06('0x1f')],_0x1f0cc6['id']));return _0x1f0cc6[_0xed06('0x1b')](_0x567d4b);}});}exports['IntervalIftime']=function(_0x5c2ef7){var _0x4fcef7=_0x5c2ef7[_0xed06('0x23')];var _0x7fae1d=Array[_0xed06('0x24')](_0x5c2ef7[_0xed06('0x25')])?_0x5c2ef7[_0xed06('0x25')]:typeof _0x5c2ef7[_0xed06('0x25')]===_0xed06('0x26')?[_0x5c2ef7[_0xed06('0x25')]]:[];var _0x1108d2=_0x5c2ef7[_0xed06('0x27')]||undefined;var _0x223a77=![];if(_0x7fae1d['length']){logger[_0xed06('0x10')](util[_0xed06('0x1d')](_0xed06('0x28'),_0x7fae1d['join'](';\x20')));}if(_0x1108d2){logger[_0xed06('0x10')](util[_0xed06('0x1d')](_0xed06('0x29'),_0x1108d2));}logger[_0xed06('0x12')]('Iftime',_0x223a77);logger[_0xed06('0x2a')](_0xed06('0x2b'),_0x5c2ef7);return Promise[_0xed06('0x2c')]()[_0xed06('0xf')](function(){if(Array[_0xed06('0x24')](_0x4fcef7)){return checkArrayOfIntervals(_0x4fcef7,_0x1108d2);}else if(_0x4fcef7){return checkSingleInterval(_0x4fcef7,_0x1108d2);}})['then'](function(_0x237adc){var _0x278258=_0x7fae1d['reduce'](function(_0x566033,_0x3ded79){return _0x566033||iftime(_0x3ded79,_0x1108d2);},![]);_0x223a77=_0x237adc||_0x278258;return _0x223a77;})[_0xed06('0x14')](function(_0x5d548e){logger[_0xed06('0x15')](_0xed06('0x2b'),_0x5c2ef7,_0x5d548e);throw this['error'](0x1f4,_0x5d548e[_0xed06('0x16')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 934ba6e..fdfd496 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller','post'];(function(_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 +var _0x5f2f=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller','post'];(function(_0x49765f,_0x3c8100){var _0x51f186=function(_0x25723d){while(--_0x25723d){_0x49765f['push'](_0x49765f['shift']());}};_0x51f186(++_0x3c8100);}(_0x5f2f,0x73));var _0xf5f2=function(_0x21cdd2,_0x423fdc){_0x21cdd2=_0x21cdd2-0x0;var _0x4c3ced=_0x5f2f[_0x21cdd2];return _0x4c3ced;};'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 ba52d94..ba3b6d9 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 _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 +var _0x3a61=['customfield_10102','track.xcallymotion.com','/rest/api/2/issue','toString','base64','request','setEncoding','utf8','data','end','status','statusCode','api.jira','write','openIssue','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','https','api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description','stringify','Bug','fields','customfield_11500','email','customfield_11501','oldToken','newToken','customfield_11504','reason'];(function(_0x2664fc,_0x1cc6e0){var _0x7f401a=function(_0x3977ea){while(--_0x3977ea){_0x2664fc['push'](_0x2664fc['shift']());}};_0x7f401a(++_0x1cc6e0);}(_0x3a61,0x94));var _0x13a6=function(_0x2b1762,_0x14b5ea){_0x2b1762=_0x2b1762-0x0;var _0x11863e=_0x3a61[_0x2b1762];return _0x11863e;};'use strict';var BPromise=require('bluebird');var https=require(_0x13a6('0x0'));var logger=require('../../config/logger')(_0x13a6('0x1'));var USERNAME=_0x13a6('0x2');var PASSWORD=_0x13a6('0x3');function openIssue(_0x111a10,_0x11033b){var _0x447133={'fields':{'project':{'key':_0x111a10[_0x13a6('0x4')]||_0x13a6('0x5')},'summary':(_0x111a10[_0x13a6('0x6')]||_0x13a6('0x7'))+_0x13a6('0x8')+_0x111a10['ip'],'description':_0x111a10[_0x13a6('0x9')]||JSON[_0x13a6('0xa')](_0x111a10),'issuetype':{'name':_0x111a10['issuetype']||_0x13a6('0xb')}}};_0x447133[_0x13a6('0xc')][_0x13a6('0xd')]=_0x111a10[_0x13a6('0xe')];_0x447133[_0x13a6('0xc')][_0x13a6('0xf')]=_0x111a10[_0x13a6('0x10')];_0x447133[_0x13a6('0xc')]['customfield_11502']=_0x111a10[_0x13a6('0x11')];_0x447133[_0x13a6('0xc')]['customfield_11503']=_0x111a10['name'];_0x447133[_0x13a6('0xc')][_0x13a6('0x12')]=_0x111a10[_0x13a6('0x13')];_0x447133[_0x13a6('0xc')][_0x13a6('0x14')]=_0x111a10['ip'];var _0x274975={'host':_0x13a6('0x15'),'port':0x1bb,'path':_0x13a6('0x16'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x13a6('0x17')](_0x13a6('0x18'))}};var _0x1ad69e=JSON[_0x13a6('0xa')](_0x447133);var _0x41f327=https[_0x13a6('0x19')](_0x274975,function(_0x1fe053){_0x1fe053[_0x13a6('0x1a')](_0x13a6('0x1b'));var _0x3d4e2c='';_0x1fe053['on'](_0x13a6('0x1c'),function(_0x2beb6a){_0x3d4e2c+=_0x2beb6a;});_0x1fe053['on'](_0x13a6('0x1d'),function(){if(_0x11033b){return _0x11033b[_0x13a6('0x1e')](_0x1fe053[_0x13a6('0x1f')])['json'](JSON['parse'](_0x3d4e2c));}});});_0x41f327['on']('error',function(_0x13cf2a){if(_0x11033b){return _0x11033b[_0x13a6('0x1e')](0x1f4)['json']({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x13a6('0x20')}]});}});_0x41f327[_0x13a6('0x21')](_0x1ad69e);_0x41f327[_0x13a6('0x1d')]();}exports[_0x13a6('0x22')]=openIssue;exports[_0x13a6('0x23')]=function(_0x2dae0a,_0x185417){_0x2dae0a[_0x13a6('0x24')]['ip']=_0x2dae0a[_0x13a6('0x25')][_0x13a6('0x26')]||_0x2dae0a[_0x13a6('0x27')][_0x13a6('0x28')]||_0x2dae0a[_0x13a6('0x29')][_0x13a6('0x28')]||_0x2dae0a[_0x13a6('0x27')][_0x13a6('0x29')][_0x13a6('0x28')];return openIssue(_0x2dae0a[_0x13a6('0x24')],_0x185417);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 4cf3987..1693e33 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 _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 +var _0x5b02=['destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','/describe','describe','show','post','create','put','/:id','update','delete'];(function(_0x21b922,_0x84bac4){var _0x2b444f=function(_0x283ab0){while(--_0x283ab0){_0x21b922['push'](_0x21b922['shift']());}};_0x2b444f(++_0x84bac4);}(_0x5b02,0xe9));var _0x25b0=function(_0x52ae0f,_0x398d8c){_0x52ae0f=_0x52ae0f-0x0;var _0x1e79ec=_0x5b02[_0x52ae0f];return _0x1e79ec;};'use strict';var multer=require(_0x25b0('0x0'));var util=require(_0x25b0('0x1'));var path=require(_0x25b0('0x2'));var timeout=require(_0x25b0('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x25b0('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x25b0('0x5'));var config=require(_0x25b0('0x6'));var controller=require(_0x25b0('0x7'));router[_0x25b0('0x8')]('/',auth[_0x25b0('0x9')](),controller['index']);router[_0x25b0('0x8')](_0x25b0('0xa'),auth['isAuthenticated'](),controller[_0x25b0('0xb')]);router['get']('/:id',auth[_0x25b0('0x9')](),controller[_0x25b0('0xc')]);router[_0x25b0('0xd')]('/',auth['isAuthenticated'](),controller[_0x25b0('0xe')]);router[_0x25b0('0xf')](_0x25b0('0x10'),auth[_0x25b0('0x9')](),controller[_0x25b0('0x11')]);router[_0x25b0('0x12')](_0x25b0('0x10'),auth[_0x25b0('0x9')](),controller[_0x25b0('0x13')]);module[_0x25b0('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 5ccc960..9541393 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(_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 +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x7a54,0x106));var _0x47a5=function(_0x25700c,_0x1682e0){_0x25700c=_0x25700c-0x0;var _0x13b303=_0x7a54[_0x25700c];return _0x13b303;};'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 6a02d66..a143325 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 _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 +var _0x432b=['jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','end','error','name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','query','intersection','attributes','length','hasOwnProperty','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','show','keys','fields','catch','create','update','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','sox','ejs','fs-extra','lodash','squel','crypto'];(function(_0x205e5a,_0x5c19fb){var _0x10da58=function(_0x1ba35d){while(--_0x1ba35d){_0x205e5a['push'](_0x205e5a['shift']());}};_0x10da58(++_0x5c19fb);}(_0x432b,0x161));var _0xb432=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x432b[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xb432('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb432('0x1'));var jsonpatch=require(_0xb432('0x2'));var rp=require(_0xb432('0x3'));var moment=require(_0xb432('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb432('0x5'));var path=require('path');var sox=require(_0xb432('0x6'));var csv=require('to-csv');var ejs=require(_0xb432('0x7'));var fs=require('fs');var fs_extra=require(_0xb432('0x8'));var _=require(_0xb432('0x9'));var squel=require(_0xb432('0xa'));var crypto=require(_0xb432('0xb'));var jsforce=require(_0xb432('0xc'));var deskjs=require(_0xb432('0xd'));var toCsv=require(_0xb432('0xe'));var querystring=require('querystring');var Papa=require(_0xb432('0xf'));var Redis=require(_0xb432('0x10'));var authService=require(_0xb432('0x11'));var qs=require(_0xb432('0x12'));var as=require(_0xb432('0x13'));var hardwareService=require(_0xb432('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xb432('0x15'));var config=require(_0xb432('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xb432('0x17'))['db'];function respondWithStatusCode(_0x323ae9,_0x2cfe96){_0x2cfe96=_0x2cfe96||0xcc;return function(_0x55d5f6){if(_0x55d5f6){return _0x323ae9[_0xb432('0x18')](_0x2cfe96);}return _0x323ae9[_0xb432('0x19')](_0x2cfe96)['end']();};}function respondWithResult(_0x272c47,_0xdac1e3){_0xdac1e3=_0xdac1e3||0xc8;return function(_0x427ad4){if(_0x427ad4){return _0x272c47[_0xb432('0x19')](_0xdac1e3)[_0xb432('0x1a')](_0x427ad4);}};}function respondWithFilteredResult(_0x526330,_0x5e4aae){return function(_0x42f81d){if(_0x42f81d){var _0x15bff1=typeof _0x5e4aae[_0xb432('0x1b')]===_0xb432('0x1c')&&typeof _0x5e4aae[_0xb432('0x1d')]===_0xb432('0x1c');var _0x21253c=_0x42f81d[_0xb432('0x1e')];var _0x375775=_0x15bff1?0x0:_0x5e4aae[_0xb432('0x1b')];var _0x4b780d=_0x15bff1?_0x42f81d['count']:_0x5e4aae[_0xb432('0x1b')]+_0x5e4aae[_0xb432('0x1d')];var _0x1ca584;if(_0x4b780d>=_0x21253c){_0x4b780d=_0x21253c;_0x1ca584=0xc8;}else{_0x1ca584=0xce;}_0x526330[_0xb432('0x19')](_0x1ca584);return _0x526330['set'](_0xb432('0x1f'),_0x375775+'-'+_0x4b780d+'/'+_0x21253c)[_0xb432('0x1a')](_0x42f81d);}return null;};}function patchUpdates(_0x284b5a){return function(_0x2fcbb1){try{jsonpatch[_0xb432('0x20')](_0x2fcbb1,_0x284b5a,!![]);}catch(_0x2903c4){return BPromise[_0xb432('0x21')](_0x2903c4);}return _0x2fcbb1[_0xb432('0x22')]();};}function saveUpdates(_0x4ec4f3,_0xacbcde){return function(_0x62ba65){if(_0x62ba65){return _0x62ba65['update'](_0x4ec4f3)[_0xb432('0x23')](function(_0xaad177){return _0xaad177;});}return null;};}function removeEntity(_0x302fce,_0x338113){return function(_0x2afd9a){if(_0x2afd9a){return _0x2afd9a[_0xb432('0x24')]()[_0xb432('0x23')](function(){_0x302fce[_0xb432('0x19')](0xcc)[_0xb432('0x25')]();});}};}function handleEntityNotFound(_0x43c0f5,_0x4d8234){return function(_0x19d249){if(!_0x19d249){_0x43c0f5[_0xb432('0x18')](0x194);}return _0x19d249;};}function handleError(_0x438978,_0xb0df62){_0xb0df62=_0xb0df62||0x1f4;return function(_0xbfb391){logger[_0xb432('0x26')](_0xbfb391['stack']);if(_0xbfb391[_0xb432('0x27')]){delete _0xbfb391[_0xb432('0x27')];}_0x438978[_0xb432('0x19')](_0xb0df62)[_0xb432('0x28')](_0xbfb391);};}exports[_0xb432('0x29')]=function(_0x3a155e,_0xc64658){var _0x406f61={},_0x1926b4={},_0x5257a3={'count':0x0,'rows':[]};var _0x4090b0=_[_0xb432('0x2a')](db[_0xb432('0x2b')][_0xb432('0x2c')],function(_0x400075){return{'name':_0x400075[_0xb432('0x2d')],'type':_0x400075[_0xb432('0x2e')][_0xb432('0x2f')]};});_0x1926b4[_0xb432('0x30')]=_[_0xb432('0x2a')](_0x4090b0,_0xb432('0x27'));_0x1926b4[_0xb432('0x31')]=_['keys'](_0x3a155e[_0xb432('0x31')]);_0x1926b4['filters']=_[_0xb432('0x32')](_0x1926b4[_0xb432('0x30')],_0x1926b4[_0xb432('0x31')]);_0x406f61[_0xb432('0x33')]=_[_0xb432('0x32')](_0x1926b4[_0xb432('0x30')],qs['fields'](_0x3a155e['query']['fields']));_0x406f61[_0xb432('0x33')]=_0x406f61[_0xb432('0x33')][_0xb432('0x34')]?_0x406f61[_0xb432('0x33')]:_0x1926b4['model'];if(!_0x3a155e['query'][_0xb432('0x35')]('nolimit')){_0x406f61[_0xb432('0x1d')]=qs[_0xb432('0x1d')](_0x3a155e['query'][_0xb432('0x1d')]);_0x406f61[_0xb432('0x1b')]=qs[_0xb432('0x1b')](_0x3a155e[_0xb432('0x31')][_0xb432('0x1b')]);}_0x406f61['order']=qs[_0xb432('0x36')](_0x3a155e[_0xb432('0x31')][_0xb432('0x36')]);_0x406f61[_0xb432('0x37')]=qs[_0xb432('0x38')](_[_0xb432('0x39')](_0x3a155e[_0xb432('0x31')],_0x1926b4['filters']),_0x4090b0);if(_0x3a155e['query'][_0xb432('0x3a')]){_0x406f61[_0xb432('0x37')]=_['merge'](_0x406f61[_0xb432('0x37')],{'$or':_[_0xb432('0x2a')](_0x4090b0,function(_0x41685d){if(_0x41685d[_0xb432('0x2e')]!==_0xb432('0x3b')){var _0x5bd66e={};_0x5bd66e[_0x41685d[_0xb432('0x27')]]={'$like':'%'+_0x3a155e[_0xb432('0x31')][_0xb432('0x3a')]+'%'};return _0x5bd66e;}})});}_0x406f61=_[_0xb432('0x3c')]({},_0x406f61,_0x3a155e[_0xb432('0x3d')]);var _0x169a8b={'where':_0x406f61[_0xb432('0x37')]};return db[_0xb432('0x2b')][_0xb432('0x1e')](_0x169a8b)['then'](function(_0x4d7c10){_0x5257a3[_0xb432('0x1e')]=_0x4d7c10;if(_0x3a155e[_0xb432('0x31')][_0xb432('0x3e')]){_0x406f61[_0xb432('0x3f')]=[{'all':!![]}];}return db[_0xb432('0x2b')][_0xb432('0x40')](_0x406f61);})[_0xb432('0x23')](function(_0x456bce){_0x5257a3['rows']=_0x456bce;return _0x5257a3;})['then'](respondWithFilteredResult(_0xc64658,_0x406f61))['catch'](handleError(_0xc64658,null));};exports[_0xb432('0x41')]=function(_0xd6e5cd,_0x37a030){var _0x21de3e={'raw':!![],'where':{'id':_0xd6e5cd['params']['id']}},_0x5d58b0={};_0x5d58b0[_0xb432('0x30')]=_[_0xb432('0x42')](db['JscriptyAnswerReport'][_0xb432('0x2c')]);_0x5d58b0['query']=_[_0xb432('0x42')](_0xd6e5cd[_0xb432('0x31')]);_0x5d58b0['filters']=_['intersection'](_0x5d58b0[_0xb432('0x30')],_0x5d58b0['query']);_0x21de3e[_0xb432('0x33')]=_[_0xb432('0x32')](_0x5d58b0['model'],qs[_0xb432('0x43')](_0xd6e5cd['query']['fields']));_0x21de3e['attributes']=_0x21de3e['attributes'][_0xb432('0x34')]?_0x21de3e['attributes']:_0x5d58b0[_0xb432('0x30')];if(_0xd6e5cd[_0xb432('0x31')]['includeAll']){_0x21de3e['include']=[{'all':!![]}];}_0x21de3e=_[_0xb432('0x3c')]({},_0x21de3e,_0xd6e5cd['options']);return db[_0xb432('0x2b')]['find'](_0x21de3e)[_0xb432('0x23')](handleEntityNotFound(_0x37a030,null))['then'](respondWithResult(_0x37a030,null))[_0xb432('0x44')](handleError(_0x37a030,null));};exports[_0xb432('0x45')]=function(_0x49b0b0,_0x5b20f9){return db['JscriptyAnswerReport'][_0xb432('0x45')](_0x49b0b0['body'],{})['then'](respondWithResult(_0x5b20f9,0xc9))[_0xb432('0x44')](handleError(_0x5b20f9,null));};exports[_0xb432('0x46')]=function(_0x178875,_0x4487ac){if(_0x178875[_0xb432('0x47')]['id']){delete _0x178875[_0xb432('0x47')]['id'];}return db['JscriptyAnswerReport']['find']({'where':{'id':_0x178875['params']['id']}})['then'](handleEntityNotFound(_0x4487ac,null))[_0xb432('0x23')](saveUpdates(_0x178875[_0xb432('0x47')],null))[_0xb432('0x23')](respondWithResult(_0x4487ac,null))[_0xb432('0x44')](handleError(_0x4487ac,null));};exports[_0xb432('0x24')]=function(_0x2ef288,_0x39fc72){return db['JscriptyAnswerReport']['find']({'where':{'id':_0x2ef288['params']['id']}})[_0xb432('0x23')](handleEntityNotFound(_0x39fc72,null))[_0xb432('0x23')](removeEntity(_0x39fc72,null))[_0xb432('0x44')](handleError(_0x39fc72,null));};exports[_0xb432('0x48')]=function(_0x244bd8,_0x56ddcc){return db['JscriptyAnswerReport'][_0xb432('0x48')]()[_0xb432('0x23')](respondWithResult(_0x56ddcc,null))[_0xb432('0x44')](handleError(_0x56ddcc,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index c45e1c7..778e3a5 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 _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 +var _0x7801=['report_jscripty_answers','util','../../config/logger','api','request-promise','path','../../config/environment','./jscriptyAnswerReport.attributes'];(function(_0x5a780e,_0x47ef27){var _0x3fadc6=function(_0x4d6396){while(--_0x4d6396){_0x5a780e['push'](_0x5a780e['shift']());}};_0x3fadc6(++_0x47ef27);}(_0x7801,0x1e1));var _0x1780=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x7801[_0x1035c1];return _0x308d67;};'use strict';var _=require('lodash');var util=require(_0x1780('0x0'));var logger=require(_0x1780('0x1'))(_0x1780('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1780('0x3'));var fs=require('fs');var path=require(_0x1780('0x4'));var rimraf=require('rimraf');var config=require(_0x1780('0x5'));var attributes=require(_0x1780('0x6'));module['exports']=function(_0x3cb12e,_0x17a6ea){return _0x3cb12e['define']('JscriptyAnswerReport',attributes,{'tableName':_0x1780('0x7'),'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 5c3ecce..9d48cfc 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 _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 +var _0x4227=['JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','http','then','info'];(function(_0x420d8d,_0x78b67f){var _0x4865d7=function(_0x2965df){while(--_0x2965df){_0x420d8d['push'](_0x420d8d['shift']());}};_0x4865d7(++_0x78b67f);}(_0x4227,0x171));var _0x7422=function(_0x1ba636,_0x2f6b8e){_0x1ba636=_0x1ba636-0x0;var _0x368a4a=_0x4227[_0x1ba636];return _0x368a4a;};'use strict';var _=require('lodash');var util=require(_0x7422('0x0'));var moment=require(_0x7422('0x1'));var BPromise=require(_0x7422('0x2'));var rs=require(_0x7422('0x3'));var fs=require('fs');var Redis=require(_0x7422('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7422('0x5'));var logger=require('../../config/logger')(_0x7422('0x6'));var config=require('../../config/environment');var jayson=require(_0x7422('0x7'));var client=jayson['client'][_0x7422('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x29d67f,_0x19a388,_0x507e43){return new BPromise(function(_0x51b8bc,_0x362f41){return client['request'](_0x29d67f,_0x507e43)[_0x7422('0x9')](function(_0x18f374){logger[_0x7422('0xa')](_0x7422('0xb'),_0x19a388,_0x7422('0xc'));logger[_0x7422('0xd')](_0x7422('0xe'),_0x19a388,_0x7422('0xc'),JSON[_0x7422('0xf')](_0x18f374));if(_0x18f374[_0x7422('0x10')]){if(_0x18f374[_0x7422('0x10')][_0x7422('0x11')]===0x1f4){logger[_0x7422('0x10')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x19a388,_0x18f374['error']['message']);return _0x362f41(_0x18f374[_0x7422('0x10')][_0x7422('0x12')]);}logger[_0x7422('0x10')](_0x7422('0xb'),_0x19a388,_0x18f374[_0x7422('0x10')]['message']);return _0x51b8bc(_0x18f374['error'][_0x7422('0x12')]);}else{logger[_0x7422('0xa')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x19a388,_0x7422('0xc'));_0x51b8bc(_0x18f374[_0x7422('0x13')][_0x7422('0x12')]);}})['catch'](function(_0x57f892){logger['error'](_0x7422('0xb'),_0x19a388,_0x57f892);_0x362f41(_0x57f892);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index de2850e..de098a9 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 _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 +var _0x158a=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','isAuthenticated','/:id','show','get','/:id/sessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','create','post','/:id/clone','clone','exports','util','path','connect-timeout','express'];(function(_0x1883d0,_0x1ae4d0){var _0x73de82=function(_0x2a0ed8){while(--_0x2a0ed8){_0x1883d0['push'](_0x1883d0['shift']());}};_0x73de82(++_0x1ae4d0);}(_0x158a,0xf6));var _0xa158=function(_0xc2bd5c,_0x2d8541){_0xc2bd5c=_0xc2bd5c-0x0;var _0x258c8e=_0x158a[_0xc2bd5c];return _0x258c8e;};'use strict';var multer=require('multer');var util=require(_0xa158('0x0'));var path=require(_0xa158('0x1'));var timeout=require(_0xa158('0x2'));var express=require(_0xa158('0x3'));var router=express[_0xa158('0x4')]();var fs_extra=require(_0xa158('0x5'));var auth=require(_0xa158('0x6'));var interaction=require(_0xa158('0x7'));var config=require(_0xa158('0x8'));var controller=require(_0xa158('0x9'));router['get']('/',auth[_0xa158('0xa')](),controller['index']);router['get'](_0xa158('0xb'),auth[_0xa158('0xa')](),controller[_0xa158('0xc')]);router[_0xa158('0xd')](_0xa158('0xe'),auth[_0xa158('0xa')](),controller['getSessions']);router['get'](_0xa158('0xf'),auth[_0xa158('0xa')](),controller[_0xa158('0x10')]);router['get'](_0xa158('0x11'),auth[_0xa158('0xa')](),timeout(_0xa158('0x12')),controller[_0xa158('0x13')]);router['post']('/',auth[_0xa158('0xa')](),controller[_0xa158('0x14')]);router[_0xa158('0x15')](_0xa158('0x16'),auth[_0xa158('0xa')](),controller[_0xa158('0x17')]);router['put'](_0xa158('0xb'),auth[_0xa158('0xa')](),controller['update']);router['delete'](_0xa158('0xb'),auth[_0xa158('0xa')](),controller['destroy']);module[_0xa158('0x18')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 19fc9fc..53ba586 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 _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 +var _0xe0a9=['{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','lodash','util','exports','STRING','name','TEXT','long','formData','stringify','isString','setDataValue'];(function(_0x4d9e01,_0x1b6ea0){var _0x25c95d=function(_0x230426){while(--_0x230426){_0x4d9e01['push'](_0x4d9e01['shift']());}};_0x25c95d(++_0x1b6ea0);}(_0xe0a9,0x103));var _0x9e0a=function(_0x4e204f,_0x4e8a7e){_0x4e204f=_0x4e204f-0x0;var _0xa1a5de=_0xe0a9[_0x4e204f];return _0xa1a5de;};'use strict';var Sequelize=require('sequelize');var _=require(_0x9e0a('0x0'));var util=require(_0x9e0a('0x1'));module[_0x9e0a('0x2')]={'name':{'type':Sequelize[_0x9e0a('0x3')],'unique':_0x9e0a('0x4')},'description':{'type':Sequelize[_0x9e0a('0x3')]},'formData':{'type':Sequelize[_0x9e0a('0x5')](_0x9e0a('0x6')),'set':function(_0x33cec3){if(_['isObjectLike'](_0x33cec3)){this['setDataValue'](_0x9e0a('0x7'),JSON[_0x9e0a('0x8')](_0x33cec3));}else if(_[_0x9e0a('0x9')](_0x33cec3)){this['setDataValue'](_0x9e0a('0x7'),_0x33cec3);}else{this[_0x9e0a('0xa')](_0x9e0a('0x7'),util['format'](_0x9e0a('0xb'),this[_0x9e0a('0xc')]('name')||'',this[_0x9e0a('0xc')](_0x9e0a('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x9e0a('0xe')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 110768d..6594f1e 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 _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 +var _0x63c6=['stack','name','send','JscriptyProject','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','type','VIRTUAL','filter','merge','include','findAll','show','params','includeAll','options','find','catch','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','getSessions','findOne','rawAttributes','pick','ProjectId','JscriptyAnswerReport','rows','number','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptySessionReport','JscriptyQuestionReport','-createdAt','questionId','question','format','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','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','Projects','UserProfileResource','error'];(function(_0x1d5c73,_0x12211c){var _0x5dc06d=function(_0x42bc3d){while(--_0x42bc3d){_0x1d5c73['push'](_0x1d5c73['shift']());}};_0x5dc06d(++_0x12211c);}(_0x63c6,0xbb));var _0x663c=function(_0x2336d5,_0x31aeb2){_0x2336d5=_0x2336d5-0x0;var _0x4ae1b1=_0x63c6[_0x2336d5];return _0x4ae1b1;};'use strict';var emlformat=require(_0x663c('0x0'));var rimraf=require(_0x663c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x663c('0x2'));var moment=require(_0x663c('0x3'));var BPromise=require(_0x663c('0x4'));var Mustache=require(_0x663c('0x5'));var util=require(_0x663c('0x6'));var path=require(_0x663c('0x7'));var sox=require(_0x663c('0x8'));var csv=require(_0x663c('0x9'));var ejs=require(_0x663c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x663c('0xb'));var squel=require(_0x663c('0xc'));var crypto=require(_0x663c('0xd'));var jsforce=require(_0x663c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x663c('0x9'));var querystring=require('querystring');var Papa=require(_0x663c('0xf'));var Redis=require('ioredis');var authService=require(_0x663c('0x10'));var qs=require(_0x663c('0x11'));var as=require(_0x663c('0x12'));var hardwareService=require(_0x663c('0x13'));var logger=require(_0x663c('0x14'))(_0x663c('0x15'));var utils=require(_0x663c('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x663c('0x17'))['db'];function respondWithStatusCode(_0xe80d02,_0x588da1){_0x588da1=_0x588da1||0xcc;return function(_0x20038d){if(_0x20038d){return _0xe80d02[_0x663c('0x18')](_0x588da1);}return _0xe80d02[_0x663c('0x19')](_0x588da1)[_0x663c('0x1a')]();};}function respondWithResult(_0x5ef6af,_0xa119a1){_0xa119a1=_0xa119a1||0xc8;return function(_0x165454){if(_0x165454){return _0x5ef6af['status'](_0xa119a1)[_0x663c('0x1b')](_0x165454);}};}function respondWithFilteredResult(_0x523322,_0x44ffaa){return function(_0xb1e1bf){if(_0xb1e1bf){var _0x2a7b0d=typeof _0x44ffaa[_0x663c('0x1c')]===_0x663c('0x1d')&&typeof _0x44ffaa[_0x663c('0x1e')]===_0x663c('0x1d');var _0x41cc9d=_0xb1e1bf[_0x663c('0x1f')];var _0x3c87fe=_0x2a7b0d?0x0:_0x44ffaa['offset'];var _0x2fd707=_0x2a7b0d?_0xb1e1bf[_0x663c('0x1f')]:_0x44ffaa[_0x663c('0x1c')]+_0x44ffaa['limit'];var _0x137670;if(_0x2fd707>=_0x41cc9d){_0x2fd707=_0x41cc9d;_0x137670=0xc8;}else{_0x137670=0xce;}_0x523322[_0x663c('0x19')](_0x137670);return _0x523322[_0x663c('0x20')](_0x663c('0x21'),_0x3c87fe+'-'+_0x2fd707+'/'+_0x41cc9d)[_0x663c('0x1b')](_0xb1e1bf);}return null;};}function patchUpdates(_0x54fa2f){return function(_0xcf6ced){try{jsonpatch[_0x663c('0x22')](_0xcf6ced,_0x54fa2f,!![]);}catch(_0x319224){return BPromise[_0x663c('0x23')](_0x319224);}return _0xcf6ced['save']();};}function saveUpdates(_0x5a9e96,_0x2ac148){return function(_0x34135d){if(_0x34135d){return _0x34135d[_0x663c('0x24')](_0x5a9e96)[_0x663c('0x25')](function(_0x352a21){return _0x352a21;});}return null;};}function removeEntity(_0x53986f,_0x4984dc){return function(_0x4b7213){if(_0x4b7213){return _0x4b7213[_0x663c('0x26')]()[_0x663c('0x25')](function(){var _0x35842e=_0x4b7213[_0x663c('0x27')]({'plain':!![]});var _0x5e6b45=_0x663c('0x28');return db[_0x663c('0x29')][_0x663c('0x26')]({'where':{'type':_0x5e6b45,'resourceId':_0x35842e['id']}})[_0x663c('0x25')](function(){return _0x4b7213;});})[_0x663c('0x25')](function(){_0x53986f['status'](0xcc)[_0x663c('0x1a')]();});}};}function handleEntityNotFound(_0x594a49,_0x5ae88d){return function(_0x5ead23){if(!_0x5ead23){_0x594a49['sendStatus'](0x194);}return _0x5ead23;};}function handleError(_0x34cd8c,_0x502921){_0x502921=_0x502921||0x1f4;return function(_0x16f30b){logger[_0x663c('0x2a')](_0x16f30b[_0x663c('0x2b')]);if(_0x16f30b[_0x663c('0x2c')]){delete _0x16f30b[_0x663c('0x2c')];}_0x34cd8c[_0x663c('0x19')](_0x502921)[_0x663c('0x2d')](_0x16f30b);};}exports['index']=function(_0x61ebd3,_0x29f074){var _0x43ad67={},_0x248345={},_0x3b3d39={'count':0x0,'rows':[]};var _0x242ba7=_['map'](db[_0x663c('0x2e')]['rawAttributes'],function(_0x1cacb6){return{'name':_0x1cacb6['fieldName'],'type':_0x1cacb6['type']['key']};});_0x248345[_0x663c('0x2f')]=_[_0x663c('0x30')](_0x242ba7,'name');_0x248345[_0x663c('0x31')]=_[_0x663c('0x32')](_0x61ebd3['query']);_0x248345[_0x663c('0x33')]=_[_0x663c('0x34')](_0x248345[_0x663c('0x2f')],_0x248345[_0x663c('0x31')]);_0x43ad67[_0x663c('0x35')]=_['intersection'](_0x248345[_0x663c('0x2f')],qs[_0x663c('0x36')](_0x61ebd3[_0x663c('0x31')]['fields']));_0x43ad67[_0x663c('0x35')]=_0x43ad67[_0x663c('0x35')][_0x663c('0x37')]?_0x43ad67[_0x663c('0x35')]:_0x248345['model'];if(!_0x61ebd3[_0x663c('0x31')][_0x663c('0x38')](_0x663c('0x39'))){_0x43ad67[_0x663c('0x1e')]=qs['limit'](_0x61ebd3['query'][_0x663c('0x1e')]);_0x43ad67[_0x663c('0x1c')]=qs['offset'](_0x61ebd3[_0x663c('0x31')][_0x663c('0x1c')]);}_0x43ad67[_0x663c('0x3a')]=qs[_0x663c('0x3b')](_0x61ebd3['query'][_0x663c('0x3b')]);_0x43ad67[_0x663c('0x3c')]=qs['filters'](_['pick'](_0x61ebd3[_0x663c('0x31')],_0x248345[_0x663c('0x33')]),_0x242ba7);if(_0x61ebd3[_0x663c('0x31')]['filter']){_0x43ad67[_0x663c('0x3c')]=_['merge'](_0x43ad67[_0x663c('0x3c')],{'$or':_['map'](_0x242ba7,function(_0x130354){if(_0x130354[_0x663c('0x3d')]!==_0x663c('0x3e')){var _0x52ab93={};_0x52ab93[_0x130354[_0x663c('0x2c')]]={'$like':'%'+_0x61ebd3[_0x663c('0x31')][_0x663c('0x3f')]+'%'};return _0x52ab93;}})});}_0x43ad67=_[_0x663c('0x40')]({},_0x43ad67,_0x61ebd3['options']);var _0x1ff218={'where':_0x43ad67[_0x663c('0x3c')]};return db[_0x663c('0x2e')][_0x663c('0x1f')](_0x1ff218)['then'](function(_0x1ce911){_0x3b3d39[_0x663c('0x1f')]=_0x1ce911;if(_0x61ebd3[_0x663c('0x31')]['includeAll']){_0x43ad67[_0x663c('0x41')]=[{'all':!![]}];}return db[_0x663c('0x2e')][_0x663c('0x42')](_0x43ad67);})['then'](function(_0x14f55f){_0x3b3d39['rows']=_0x14f55f;return _0x3b3d39;})[_0x663c('0x25')](respondWithFilteredResult(_0x29f074,_0x43ad67))['catch'](handleError(_0x29f074,null));};exports[_0x663c('0x43')]=function(_0x443842,_0x188e12){var _0x53e821={'raw':![],'where':{'id':_0x443842[_0x663c('0x44')]['id']}},_0x31f0a5={};_0x31f0a5[_0x663c('0x2f')]=_['keys'](db[_0x663c('0x2e')]['rawAttributes']);_0x31f0a5[_0x663c('0x31')]=_[_0x663c('0x32')](_0x443842[_0x663c('0x31')]);_0x31f0a5['filters']=_[_0x663c('0x34')](_0x31f0a5[_0x663c('0x2f')],_0x31f0a5[_0x663c('0x31')]);_0x53e821[_0x663c('0x35')]=_[_0x663c('0x34')](_0x31f0a5[_0x663c('0x2f')],qs[_0x663c('0x36')](_0x443842[_0x663c('0x31')][_0x663c('0x36')]));_0x53e821['attributes']=_0x53e821[_0x663c('0x35')][_0x663c('0x37')]?_0x53e821[_0x663c('0x35')]:_0x31f0a5[_0x663c('0x2f')];if(_0x443842[_0x663c('0x31')][_0x663c('0x45')]){_0x53e821[_0x663c('0x41')]=[{'all':!![]}];}_0x53e821=_['merge']({},_0x53e821,_0x443842[_0x663c('0x46')]);return db[_0x663c('0x2e')][_0x663c('0x47')](_0x53e821)[_0x663c('0x25')](handleEntityNotFound(_0x188e12,null))[_0x663c('0x25')](respondWithResult(_0x188e12,null))[_0x663c('0x48')](handleError(_0x188e12,null));};exports['create']=function(_0x3396b1,_0x685df3){return db[_0x663c('0x2e')]['create'](_0x3396b1[_0x663c('0x49')],{})['then'](function(_0x4320cc){var _0x3330c0=_0x3396b1[_0x663c('0x4a')][_0x663c('0x27')]({'plain':!![]});if(!_0x3330c0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3330c0['role']===_0x663c('0x4a')){var _0x1d4619=_0x4320cc[_0x663c('0x27')]({'plain':!![]});var _0x3d8c62=_0x663c('0x28');return db[_0x663c('0x4b')][_0x663c('0x47')]({'where':{'name':_0x3d8c62,'userProfileId':_0x3330c0[_0x663c('0x4c')]},'raw':!![]})[_0x663c('0x25')](function(_0x1754d8){if(_0x1754d8&&_0x1754d8[_0x663c('0x4d')]===0x0){return db[_0x663c('0x29')]['create']({'name':_0x1d4619['name'],'resourceId':_0x1d4619['id'],'type':_0x1754d8[_0x663c('0x2c')],'sectionId':_0x1754d8['id']},{})[_0x663c('0x25')](function(){return _0x4320cc;});}else{return _0x4320cc;}})['catch'](function(_0x44794d){logger[_0x663c('0x2a')](_0x663c('0x4e'),_0x44794d);throw _0x44794d;});}return _0x4320cc;})['then'](respondWithResult(_0x685df3,0xc9))['catch'](handleError(_0x685df3,null));};exports['clone']=function(_0x4d26e5,_0x2511e5){var _0x47b37a={'where':{'id':_0x4d26e5[_0x663c('0x44')]['id']}},_0x154f11={};_0x154f11['model']=_[_0x663c('0x32')](db[_0x663c('0x2e')]['rawAttributes']);_0x47b37a['attributes']=_[_0x663c('0x34')](_0x154f11['model'],qs[_0x663c('0x36')](_0x4d26e5[_0x663c('0x31')]['fields']));_0x47b37a[_0x663c('0x35')]=_0x47b37a[_0x663c('0x35')][_0x663c('0x37')]?_0x47b37a[_0x663c('0x35')]:_0x154f11[_0x663c('0x2f')];if(_0x4d26e5[_0x663c('0x31')][_0x663c('0x45')]){_0x47b37a[_0x663c('0x41')]=[{'all':!![]}];}_0x47b37a=_[_0x663c('0x40')]({},_0x47b37a,_0x4d26e5[_0x663c('0x46')]);return db[_0x663c('0x2e')][_0x663c('0x47')](_0x47b37a)[_0x663c('0x25')](handleEntityNotFound(_0x2511e5,null))[_0x663c('0x25')](function(_0x5a1e34){if(_0x5a1e34){var _0x4df741=_0x5a1e34[_0x663c('0x27')]({'plain':!![]});_0x4df741=qs[_0x663c('0x4f')](_0x4df741,['id','createdAt',_0x663c('0x50')]);_0x4d26e5[_0x663c('0x49')]=_[_0x663c('0x4f')](_0x4d26e5[_0x663c('0x49')],['id','createdAt',_0x663c('0x50')]);return db['JscriptyProject']['create'](_[_0x663c('0x40')](_0x4df741,_0x4d26e5[_0x663c('0x49')]),{'include':_0x4d26e5[_0x663c('0x31')]['includeAll']?[{'all':!![]}]:undefined})[_0x663c('0x25')](function(_0x4050c5){var _0x2eee6c=_0x4d26e5[_0x663c('0x4a')][_0x663c('0x27')]({'plain':!![]});if(!_0x2eee6c)throw new Error(_0x663c('0x51'));if(_0x2eee6c[_0x663c('0x52')]===_0x663c('0x4a')){var _0x392887=_0x4050c5[_0x663c('0x27')]({'plain':!![]});var _0x13ef62='Projects';return db[_0x663c('0x4b')][_0x663c('0x47')]({'where':{'name':_0x13ef62,'userProfileId':_0x2eee6c[_0x663c('0x4c')]},'raw':!![]})[_0x663c('0x25')](function(_0x1b8208){if(_0x1b8208&&_0x1b8208['autoAssociation']===0x0){return db[_0x663c('0x29')]['create']({'name':_0x392887['name'],'resourceId':_0x392887['id'],'type':_0x1b8208[_0x663c('0x2c')],'sectionId':_0x1b8208['id']},{})['then'](function(){return _0x4050c5;});}else{return _0x4050c5;}})['catch'](function(_0x3df0ae){logger[_0x663c('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3df0ae);throw _0x3df0ae;});}return _0x4050c5;});}})[_0x663c('0x25')](respondWithResult(_0x2511e5,0xc9))[_0x663c('0x48')](handleError(_0x2511e5,null));};exports['update']=function(_0x5034d7,_0x170fcb){if(_0x5034d7[_0x663c('0x49')]['id']){delete _0x5034d7[_0x663c('0x49')]['id'];}return db[_0x663c('0x2e')][_0x663c('0x47')]({'where':{'id':_0x5034d7[_0x663c('0x44')]['id']}})[_0x663c('0x25')](handleEntityNotFound(_0x170fcb,null))['then'](saveUpdates(_0x5034d7[_0x663c('0x49')],null))['then'](respondWithResult(_0x170fcb,null))[_0x663c('0x48')](handleError(_0x170fcb,null));};exports[_0x663c('0x26')]=function(_0x381f84,_0x562ef5){return db[_0x663c('0x2e')][_0x663c('0x47')]({'where':{'id':_0x381f84[_0x663c('0x44')]['id']}})[_0x663c('0x25')](handleEntityNotFound(_0x562ef5,null))[_0x663c('0x25')](removeEntity(_0x562ef5,null))[_0x663c('0x48')](handleError(_0x562ef5,null));};exports[_0x663c('0x53')]=function(_0x197866,_0x2bea07,_0x3c7a3a){var _0x1b63d1={'raw':!![],'where':{}};var _0x14fc19={};var _0x38efea={'count':0x0,'rows':[]};return db[_0x663c('0x2e')][_0x663c('0x54')]({'where':{'id':_0x197866['params']['id']}})[_0x663c('0x25')](handleEntityNotFound(_0x2bea07,null))[_0x663c('0x25')](function(_0xbb6324){if(_0xbb6324){_0x14fc19['model']=_[_0x663c('0x32')](db['JscriptySessionReport'][_0x663c('0x55')]);_0x14fc19['query']=_[_0x663c('0x32')](_0x197866['query']);_0x14fc19[_0x663c('0x33')]=_[_0x663c('0x34')](_0x14fc19[_0x663c('0x2f')],_0x14fc19[_0x663c('0x31')]);_0x1b63d1[_0x663c('0x35')]=_[_0x663c('0x34')](_0x14fc19[_0x663c('0x2f')],qs[_0x663c('0x36')](_0x197866[_0x663c('0x31')]['fields']));_0x1b63d1[_0x663c('0x35')]=_0x1b63d1['attributes'][_0x663c('0x37')]?_0x1b63d1[_0x663c('0x35')]:_0x14fc19[_0x663c('0x2f')];if(!_0x197866['query'][_0x663c('0x38')](_0x663c('0x39'))){_0x1b63d1['limit']=qs[_0x663c('0x1e')](_0x197866[_0x663c('0x31')]['limit']);_0x1b63d1[_0x663c('0x1c')]=qs[_0x663c('0x1c')](_0x197866[_0x663c('0x31')][_0x663c('0x1c')]);}_0x1b63d1[_0x663c('0x3a')]=qs[_0x663c('0x3b')](_0x197866[_0x663c('0x31')][_0x663c('0x3b')]);_0x1b63d1[_0x663c('0x3c')]=qs['filters'](_[_0x663c('0x56')](_0x197866[_0x663c('0x31')],_0x14fc19['filters']));_0x1b63d1[_0x663c('0x3c')][_0x663c('0x57')]=_0xbb6324['id'];if(_0x197866[_0x663c('0x31')][_0x663c('0x3f')]){_0x1b63d1['where']=_[_0x663c('0x40')](_0x1b63d1[_0x663c('0x3c')],{'$or':_[_0x663c('0x30')](_0x1b63d1[_0x663c('0x35')],function(_0x49b88a){var _0x13e40a={};_0x13e40a[_0x49b88a]={'$like':'%'+_0x197866[_0x663c('0x31')]['filter']+'%'};return _0x13e40a;})});}_0x1b63d1=_['merge']({},_0x1b63d1,_0x197866[_0x663c('0x46')]);return db['JscriptySessionReport'][_0x663c('0x1f')]({'where':_0x1b63d1[_0x663c('0x3c')]})[_0x663c('0x25')](function(_0x592c4f){_0x38efea[_0x663c('0x1f')]=_0x592c4f;if(_0x197866[_0x663c('0x31')]['includeAll']){_0x1b63d1[_0x663c('0x41')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x663c('0x42')](_0x1b63d1);})[_0x663c('0x25')](function(_0x2253e6){_0x38efea['rows']=_0x2253e6;return _0x38efea;});}})['then'](respondWithFilteredResult(_0x2bea07,_0x1b63d1))[_0x663c('0x48')](handleError(_0x2bea07,null));};exports['getAnswers']=function(_0x1e8ecc,_0x67c1a0,_0x310839){var _0x582a9e={'raw':!![],'where':{}};var _0x51a63a={};var _0x5cb07b={'count':0x0,'rows':[]};return db[_0x663c('0x2e')]['findOne']({'where':{'id':_0x1e8ecc[_0x663c('0x44')]['id']}})[_0x663c('0x25')](handleEntityNotFound(_0x67c1a0,null))[_0x663c('0x25')](function(_0x166051){if(_0x166051){_0x51a63a[_0x663c('0x2f')]=_[_0x663c('0x32')](db['JscriptyAnswerReport']['rawAttributes']);_0x51a63a[_0x663c('0x31')]=_[_0x663c('0x32')](_0x1e8ecc[_0x663c('0x31')]);_0x51a63a[_0x663c('0x33')]=_['intersection'](_0x51a63a[_0x663c('0x2f')],_0x51a63a['query']);_0x582a9e[_0x663c('0x35')]=_['intersection'](_0x51a63a['model'],qs['fields'](_0x1e8ecc[_0x663c('0x31')][_0x663c('0x36')]));_0x582a9e[_0x663c('0x35')]=_0x582a9e['attributes'][_0x663c('0x37')]?_0x582a9e[_0x663c('0x35')]:_0x51a63a[_0x663c('0x2f')];if(!_0x1e8ecc['query']['hasOwnProperty'](_0x663c('0x39'))){_0x582a9e[_0x663c('0x1e')]=qs[_0x663c('0x1e')](_0x1e8ecc['query'][_0x663c('0x1e')]);_0x582a9e[_0x663c('0x1c')]=qs[_0x663c('0x1c')](_0x1e8ecc[_0x663c('0x31')][_0x663c('0x1c')]);}_0x582a9e[_0x663c('0x3a')]=qs[_0x663c('0x3b')](_0x1e8ecc[_0x663c('0x31')][_0x663c('0x3b')]);_0x582a9e[_0x663c('0x3c')]=qs[_0x663c('0x33')](_[_0x663c('0x56')](_0x1e8ecc[_0x663c('0x31')],_0x51a63a['filters']));_0x582a9e[_0x663c('0x3c')][_0x663c('0x57')]=_0x166051['id'];if(_0x1e8ecc['query']['filter']){_0x582a9e[_0x663c('0x3c')]=_['merge'](_0x582a9e['where'],{'$or':_['map'](_0x582a9e['attributes'],function(_0xf18f13){var _0x1fe5f9={};_0x1fe5f9[_0xf18f13]={'$like':'%'+_0x1e8ecc[_0x663c('0x31')][_0x663c('0x3f')]+'%'};return _0x1fe5f9;})});}_0x582a9e=_['merge']({},_0x582a9e,_0x1e8ecc[_0x663c('0x46')]);return db['JscriptyAnswerReport']['count']({'where':_0x582a9e[_0x663c('0x3c')]})[_0x663c('0x25')](function(_0xc228c8){_0x5cb07b[_0x663c('0x1f')]=_0xc228c8;if(_0x1e8ecc['query'][_0x663c('0x45')]){_0x582a9e['include']=[{'all':!![]}];}return db[_0x663c('0x58')][_0x663c('0x42')](_0x582a9e);})[_0x663c('0x25')](function(_0x50bbab){_0x5cb07b[_0x663c('0x59')]=_0x50bbab;return _0x5cb07b;});}})['then'](respondWithFilteredResult(_0x67c1a0,_0x582a9e))[_0x663c('0x48')](handleError(_0x67c1a0,null));};function char(_0x2f9162){return _0x663c('0x5a')===typeof _0x2f9162?String['fromCharCode'][_0x663c('0x22')](null,arguments):_0x2f9162;}function needsEncapsulation(_0x3c78db){return!!_0x3c78db&&(_0x3c78db[_0x663c('0x5b')]()[_0x663c('0x5c')](char(0xd))>=0x0||_0x3c78db['toString']()[_0x663c('0x5c')](char(0xa))>=0x0||_0x3c78db[_0x663c('0x5b')]()[_0x663c('0x5c')](char(0x2c))>=0x0||_0x3c78db[_0x663c('0x5b')]()[_0x663c('0x5c')](char(0x22))>=0x0);}function encapsulate(_0x68fbfd){var _0xa01edc=char(0x22),_0x4f6d6a='\x5c'+char(0x22),_0xa1481f=_0x68fbfd[_0x663c('0x5b')]()[_0x663c('0x5d')](new RegExp(_0xa01edc,'g'),_0x4f6d6a);return _0xa01edc+_0xa1481f+_0xa01edc;}exports[_0x663c('0x5e')]=function(_0x4feb24,_0x19d2de,_0x3605ef){var _0x1e80ad,_0x44c255;var _0x4a4840={'where':{'ProjectId':_0x4feb24[_0x663c('0x44')]['id']}};if(_0x4feb24[_0x663c('0x31')][_0x663c('0x5f')]){_0x4a4840['where'][_0x663c('0x60')]=JSON[_0x663c('0x61')](_0x4feb24[_0x663c('0x31')][_0x663c('0x5f')]);}return db[_0x663c('0x62')]['findAll'](_0x4a4840)['then'](handleEntityNotFound(_0x19d2de,null))[_0x663c('0x25')](function(_0x46dcc8){if(_0x46dcc8){_0x1e80ad=_0x46dcc8;return db[_0x663c('0x63')]['findAll']({'where':{'SessionId':{'$in':_[_0x663c('0x30')](_0x1e80ad,'id')},'ProjectId':_0x4feb24[_0x663c('0x44')]['id']},'order':_0x663c('0x64')});}})[_0x663c('0x25')](handleEntityNotFound(_0x19d2de,null))[_0x663c('0x25')](function(_0x21b85c){if(_0x21b85c){_0x44c255=_0x21b85c;var _0xa51dfb={};for(var _0xc662d8=0x0,_0x3dce88=_0x44c255[_0x663c('0x37')];_0xc662d8<_0x3dce88;_0xc662d8++){if(!_0xa51dfb[_0x663c('0x38')](_0x44c255[_0xc662d8][_0x663c('0x65')])){_0xa51dfb[_0x44c255[_0xc662d8][_0x663c('0x65')]]=needsEncapsulation(_0x44c255[_0xc662d8][_0x663c('0x66')])?encapsulate(_0x44c255[_0xc662d8][_0x663c('0x66')]):_0x44c255[_0xc662d8][_0x663c('0x66')];}}var _0xd8e286=[],_0x2c51b1={};for(var _0x4c2b73=0x0,_0x477821=_0x1e80ad[_0x663c('0x37')];_0x4c2b73<_0x477821;_0x4c2b73++){_0x2c51b1={'ProjectId':_0x4feb24[_0x663c('0x44')]['id'],'SessionId':_0x1e80ad[_0x4c2b73]['id'],'StartTime':moment(_0x1e80ad[_0x4c2b73][_0x663c('0x60')])[_0x663c('0x67')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x1c2ee7=0x0,_0x474862=_0x44c255[_0x663c('0x37')];_0x1c2ee7<_0x474862;_0x1c2ee7++){if(_0x44c255[_0x1c2ee7]['SessionId']==_0x1e80ad[_0x4c2b73]['id']&&_0xa51dfb[_0x663c('0x38')](_0x44c255[_0x1c2ee7]['questionId'])){_0x2c51b1[_0xa51dfb[_0x44c255[_0x1c2ee7][_0x663c('0x65')]]]=_0x44c255[_0x1c2ee7][_0x663c('0x68')];}}for(var _0x5f26bc in _0xa51dfb){if(!_0x2c51b1[_0x663c('0x38')](_0xa51dfb[_0x5f26bc])){_0x2c51b1[_0xa51dfb[_0x5f26bc]]=null;}}_0xd8e286[_0x663c('0x69')](_0x2c51b1);}return _0xd8e286;}})['then'](function(_0x3dc753){if(!_[_0x663c('0x6a')](_0x3dc753)){var _0x27fca4=toCsv(_0x3dc753);var _0x31e476=Date[_0x663c('0x6b')]();fs['writeFileSync'](util[_0x663c('0x67')](_0x663c('0x6c'),_0x4feb24[_0x663c('0x44')]['id'],_0x31e476),_0x27fca4);_0x19d2de[_0x663c('0x6d')]('Content-disposition',_0x663c('0x6e')+util[_0x663c('0x67')](_0x663c('0x6f'),_0x4feb24[_0x663c('0x44')]['id'],_0x31e476));_0x19d2de[_0x663c('0x6d')](_0x663c('0x70'),_0x663c('0x71'));return _0x19d2de[_0x663c('0x72')](util[_0x663c('0x67')](_0x663c('0x6c'),_0x4feb24[_0x663c('0x44')]['id'],_0x31e476));}else{return _0x19d2de[_0x663c('0x18')](0xcc);}})[_0x663c('0x48')](handleError(_0x19d2de,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 3031674..4d6250a 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 _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 +var _0xe198=['define','JscriptyProject','jscripty_projects','lodash','util','moment','bluebird','request-promise','path','rimraf','./jscriptyProject.attributes','exports'];(function(_0x2a747c,_0x23e7a0){var _0x298e92=function(_0x5daa5c){while(--_0x5daa5c){_0x2a747c['push'](_0x2a747c['shift']());}};_0x298e92(++_0x23e7a0);}(_0xe198,0x6f));var _0x8e19=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xe198[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x8e19('0x0'));var util=require(_0x8e19('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8e19('0x2'));var BPromise=require(_0x8e19('0x3'));var rp=require(_0x8e19('0x4'));var fs=require('fs');var path=require(_0x8e19('0x5'));var rimraf=require(_0x8e19('0x6'));var config=require('../../config/environment');var attributes=require(_0x8e19('0x7'));module[_0x8e19('0x8')]=function(_0x2fb138,_0x188ce0){return _0x2fb138[_0x8e19('0x9')](_0x8e19('0xa'),attributes,{'tableName':_0x8e19('0xb'),'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 6cd91cf..441ae14 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 _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 +var _0xda3f=['rpc','jayson/promise','client','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0x3e85a4,_0x18c3a9){var _0x21e7d1=function(_0x48457d){while(--_0x48457d){_0x3e85a4['push'](_0x3e85a4['shift']());}};_0x21e7d1(++_0x18c3a9);}(_0xda3f,0xec));var _0xfda3=function(_0x310a03,_0x5f5629){_0x310a03=_0x310a03-0x0;var _0x5c6677=_0xda3f[_0x310a03];return _0x5c6677;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('JscriptyProject,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('JscriptyProject,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 7f1a489..b98d208 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 _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 +var _0x1ac7=['index','/describe','describe','/:id','isAuthenticated','show','post','create','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x1cd71f,_0x2a9d19){var _0x33d362=function(_0x2ecb41){while(--_0x2ecb41){_0x1cd71f['push'](_0x1cd71f['shift']());}};_0x33d362(++_0x2a9d19);}(_0x1ac7,0xd3));var _0x71ac=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0x1ac7[_0x556bb1];return _0x45455f;};'use strict';var multer=require('multer');var util=require(_0x71ac('0x0'));var path=require(_0x71ac('0x1'));var timeout=require(_0x71ac('0x2'));var express=require(_0x71ac('0x3'));var router=express[_0x71ac('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x71ac('0x5'));var interaction=require(_0x71ac('0x6'));var config=require(_0x71ac('0x7'));var controller=require('./jscriptyQuestionReport.controller');router[_0x71ac('0x8')]('/',auth['isAuthenticated'](),controller[_0x71ac('0x9')]);router[_0x71ac('0x8')](_0x71ac('0xa'),auth['isAuthenticated'](),controller[_0x71ac('0xb')]);router[_0x71ac('0x8')](_0x71ac('0xc'),auth[_0x71ac('0xd')](),controller[_0x71ac('0xe')]);router[_0x71ac('0xf')]('/',auth[_0x71ac('0xd')](),controller[_0x71ac('0x10')]);router['put']('/:id',auth[_0x71ac('0xd')](),controller[_0x71ac('0x11')]);router['delete'](_0x71ac('0xc'),auth[_0x71ac('0xd')](),controller[_0x71ac('0x12')]);module[_0x71ac('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 4ce85eb..cd35de9 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(_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 +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x7a54,0x106));var _0x47a5=function(_0x5bcca5,_0x186a52){_0x5bcca5=_0x5bcca5-0x0;var _0x355050=_0x7a54[_0x5bcca5];return _0x355050;};'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 011e031..1de59c1 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 _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 +var _0x8e15=['show','params','rawAttributes','find','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','stack','name','map','JscriptyQuestionReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch'];(function(_0x261edf,_0x4189d9){var _0x2f3b6a=function(_0x5ef763){while(--_0x5ef763){_0x261edf['push'](_0x261edf['shift']());}};_0x2f3b6a(++_0x4189d9);}(_0x8e15,0x1ca));var _0x58e1=function(_0x25ad66,_0x46e4dc){_0x25ad66=_0x25ad66-0x0;var _0x141bc4=_0x8e15[_0x25ad66];return _0x141bc4;};'use strict';var emlformat=require(_0x58e1('0x0'));var rimraf=require(_0x58e1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x58e1('0x2'));var rp=require(_0x58e1('0x3'));var moment=require(_0x58e1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x58e1('0x5'));var util=require(_0x58e1('0x6'));var path=require('path');var sox=require(_0x58e1('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(_0x58e1('0x8'));var crypto=require(_0x58e1('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x58e1('0xa'));var toCsv=require(_0x58e1('0xb'));var querystring=require(_0x58e1('0xc'));var Papa=require(_0x58e1('0xd'));var Redis=require(_0x58e1('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x58e1('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x58e1('0x10'));var logger=require(_0x58e1('0x11'))(_0x58e1('0x12'));var utils=require(_0x58e1('0x13'));var config=require(_0x58e1('0x14'));var licenseUtil=require(_0x58e1('0x15'));var db=require(_0x58e1('0x16'))['db'];function respondWithStatusCode(_0xaad22f,_0x49cb0){_0x49cb0=_0x49cb0||0xcc;return function(_0x339555){if(_0x339555){return _0xaad22f['sendStatus'](_0x49cb0);}return _0xaad22f[_0x58e1('0x17')](_0x49cb0)[_0x58e1('0x18')]();};}function respondWithResult(_0x41871b,_0x256d61){_0x256d61=_0x256d61||0xc8;return function(_0x4f2c74){if(_0x4f2c74){return _0x41871b['status'](_0x256d61)[_0x58e1('0x19')](_0x4f2c74);}};}function respondWithFilteredResult(_0x10d3de,_0xa518e9){return function(_0x53c481){if(_0x53c481){var _0x1c075c=typeof _0xa518e9[_0x58e1('0x1a')]===_0x58e1('0x1b')&&typeof _0xa518e9[_0x58e1('0x1c')]===_0x58e1('0x1b');var _0x3402c3=_0x53c481['count'];var _0x135fb2=_0x1c075c?0x0:_0xa518e9[_0x58e1('0x1a')];var _0x4d89bd=_0x1c075c?_0x53c481[_0x58e1('0x1d')]:_0xa518e9[_0x58e1('0x1a')]+_0xa518e9['limit'];var _0x112c62;if(_0x4d89bd>=_0x3402c3){_0x4d89bd=_0x3402c3;_0x112c62=0xc8;}else{_0x112c62=0xce;}_0x10d3de[_0x58e1('0x17')](_0x112c62);return _0x10d3de[_0x58e1('0x1e')](_0x58e1('0x1f'),_0x135fb2+'-'+_0x4d89bd+'/'+_0x3402c3)[_0x58e1('0x19')](_0x53c481);}return null;};}function patchUpdates(_0x2f481f){return function(_0x4f6cdb){try{jsonpatch[_0x58e1('0x20')](_0x4f6cdb,_0x2f481f,!![]);}catch(_0x464663){return BPromise[_0x58e1('0x21')](_0x464663);}return _0x4f6cdb[_0x58e1('0x22')]();};}function saveUpdates(_0x245d2d,_0x3dc8e7){return function(_0x1be88e){if(_0x1be88e){return _0x1be88e[_0x58e1('0x23')](_0x245d2d)[_0x58e1('0x24')](function(_0x4f6b18){return _0x4f6b18;});}return null;};}function removeEntity(_0x1cf07e,_0x204bf2){return function(_0x5cb72b){if(_0x5cb72b){return _0x5cb72b['destroy']()[_0x58e1('0x24')](function(){_0x1cf07e[_0x58e1('0x17')](0xcc)[_0x58e1('0x18')]();});}};}function handleEntityNotFound(_0x3272a0,_0x4a0116){return function(_0x38e25c){if(!_0x38e25c){_0x3272a0[_0x58e1('0x25')](0x194);}return _0x38e25c;};}function handleError(_0x442b2d,_0x1dcdf0){_0x1dcdf0=_0x1dcdf0||0x1f4;return function(_0x189f03){logger['error'](_0x189f03[_0x58e1('0x26')]);if(_0x189f03[_0x58e1('0x27')]){delete _0x189f03[_0x58e1('0x27')];}_0x442b2d[_0x58e1('0x17')](_0x1dcdf0)['send'](_0x189f03);};}exports['index']=function(_0xce219b,_0x3ac811){var _0x56cc77={},_0x25b465={},_0x4adadc={'count':0x0,'rows':[]};var _0x4ee94a=_[_0x58e1('0x28')](db[_0x58e1('0x29')]['rawAttributes'],function(_0x552cf5){return{'name':_0x552cf5[_0x58e1('0x2a')],'type':_0x552cf5[_0x58e1('0x2b')][_0x58e1('0x2c')]};});_0x25b465[_0x58e1('0x2d')]=_[_0x58e1('0x28')](_0x4ee94a,_0x58e1('0x27'));_0x25b465[_0x58e1('0x2e')]=_[_0x58e1('0x2f')](_0xce219b[_0x58e1('0x2e')]);_0x25b465[_0x58e1('0x30')]=_[_0x58e1('0x31')](_0x25b465['model'],_0x25b465['query']);_0x56cc77[_0x58e1('0x32')]=_[_0x58e1('0x31')](_0x25b465[_0x58e1('0x2d')],qs[_0x58e1('0x33')](_0xce219b[_0x58e1('0x2e')][_0x58e1('0x33')]));_0x56cc77[_0x58e1('0x32')]=_0x56cc77['attributes'][_0x58e1('0x34')]?_0x56cc77[_0x58e1('0x32')]:_0x25b465[_0x58e1('0x2d')];if(!_0xce219b[_0x58e1('0x2e')][_0x58e1('0x35')](_0x58e1('0x36'))){_0x56cc77[_0x58e1('0x1c')]=qs[_0x58e1('0x1c')](_0xce219b[_0x58e1('0x2e')][_0x58e1('0x1c')]);_0x56cc77[_0x58e1('0x1a')]=qs[_0x58e1('0x1a')](_0xce219b[_0x58e1('0x2e')][_0x58e1('0x1a')]);}_0x56cc77[_0x58e1('0x37')]=qs[_0x58e1('0x38')](_0xce219b['query'][_0x58e1('0x38')]);_0x56cc77[_0x58e1('0x39')]=qs[_0x58e1('0x30')](_['pick'](_0xce219b[_0x58e1('0x2e')],_0x25b465[_0x58e1('0x30')]),_0x4ee94a);if(_0xce219b[_0x58e1('0x2e')][_0x58e1('0x3a')]){_0x56cc77['where']=_['merge'](_0x56cc77[_0x58e1('0x39')],{'$or':_[_0x58e1('0x28')](_0x4ee94a,function(_0x415462){if(_0x415462['type']!==_0x58e1('0x3b')){var _0x330fa1={};_0x330fa1[_0x415462['name']]={'$like':'%'+_0xce219b[_0x58e1('0x2e')][_0x58e1('0x3a')]+'%'};return _0x330fa1;}})});}_0x56cc77=_[_0x58e1('0x3c')]({},_0x56cc77,_0xce219b[_0x58e1('0x3d')]);var _0x3f7031={'where':_0x56cc77[_0x58e1('0x39')]};return db[_0x58e1('0x29')][_0x58e1('0x1d')](_0x3f7031)['then'](function(_0x7e2642){_0x4adadc[_0x58e1('0x1d')]=_0x7e2642;if(_0xce219b[_0x58e1('0x2e')][_0x58e1('0x3e')]){_0x56cc77[_0x58e1('0x3f')]=[{'all':!![]}];}return db[_0x58e1('0x29')][_0x58e1('0x40')](_0x56cc77);})['then'](function(_0x322444){_0x4adadc[_0x58e1('0x41')]=_0x322444;return _0x4adadc;})[_0x58e1('0x24')](respondWithFilteredResult(_0x3ac811,_0x56cc77))[_0x58e1('0x42')](handleError(_0x3ac811,null));};exports[_0x58e1('0x43')]=function(_0x4cb73e,_0x44561b){var _0x18c648={'raw':!![],'where':{'id':_0x4cb73e[_0x58e1('0x44')]['id']}},_0x394a8b={};_0x394a8b[_0x58e1('0x2d')]=_[_0x58e1('0x2f')](db['JscriptyQuestionReport'][_0x58e1('0x45')]);_0x394a8b[_0x58e1('0x2e')]=_[_0x58e1('0x2f')](_0x4cb73e[_0x58e1('0x2e')]);_0x394a8b[_0x58e1('0x30')]=_[_0x58e1('0x31')](_0x394a8b['model'],_0x394a8b['query']);_0x18c648['attributes']=_[_0x58e1('0x31')](_0x394a8b[_0x58e1('0x2d')],qs[_0x58e1('0x33')](_0x4cb73e[_0x58e1('0x2e')][_0x58e1('0x33')]));_0x18c648[_0x58e1('0x32')]=_0x18c648[_0x58e1('0x32')]['length']?_0x18c648[_0x58e1('0x32')]:_0x394a8b[_0x58e1('0x2d')];if(_0x4cb73e[_0x58e1('0x2e')][_0x58e1('0x3e')]){_0x18c648[_0x58e1('0x3f')]=[{'all':!![]}];}_0x18c648=_[_0x58e1('0x3c')]({},_0x18c648,_0x4cb73e['options']);return db['JscriptyQuestionReport'][_0x58e1('0x46')](_0x18c648)['then'](handleEntityNotFound(_0x44561b,null))[_0x58e1('0x24')](respondWithResult(_0x44561b,null))[_0x58e1('0x42')](handleError(_0x44561b,null));};exports[_0x58e1('0x47')]=function(_0x43b5a9,_0xec981e){return db['JscriptyQuestionReport']['create'](_0x43b5a9['body'],{})['then'](respondWithResult(_0xec981e,0xc9))['catch'](handleError(_0xec981e,null));};exports['update']=function(_0x58c0f4,_0x3bdf93){if(_0x58c0f4[_0x58e1('0x48')]['id']){delete _0x58c0f4[_0x58e1('0x48')]['id'];}return db[_0x58e1('0x29')][_0x58e1('0x46')]({'where':{'id':_0x58c0f4[_0x58e1('0x44')]['id']}})[_0x58e1('0x24')](handleEntityNotFound(_0x3bdf93,null))['then'](saveUpdates(_0x58c0f4[_0x58e1('0x48')],null))[_0x58e1('0x24')](respondWithResult(_0x3bdf93,null))[_0x58e1('0x42')](handleError(_0x3bdf93,null));};exports[_0x58e1('0x49')]=function(_0x120092,_0x4d467d){return db[_0x58e1('0x29')][_0x58e1('0x46')]({'where':{'id':_0x120092[_0x58e1('0x44')]['id']}})[_0x58e1('0x24')](handleEntityNotFound(_0x4d467d,null))['then'](removeEntity(_0x4d467d,null))[_0x58e1('0x42')](handleError(_0x4d467d,null));};exports[_0x58e1('0x4a')]=function(_0x560355,_0x21ecc6){return db[_0x58e1('0x29')][_0x58e1('0x4a')]()[_0x58e1('0x24')](respondWithResult(_0x21ecc6,null))[_0x58e1('0x42')](handleError(_0x21ecc6,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index b22c47a..0ea9cc7 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 _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 +var _0x19c6=['bluebird','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','util','../../config/logger','moment'];(function(_0x309d80,_0x5b32dc){var _0x43f5fa=function(_0x36fece){while(--_0x36fece){_0x309d80['push'](_0x309d80['shift']());}};_0x43f5fa(++_0x5b32dc);}(_0x19c6,0x129));var _0x619c=function(_0x2948d7,_0x1a9438){_0x2948d7=_0x2948d7-0x0;var _0x476117=_0x19c6[_0x2948d7];return _0x476117;};'use strict';var _=require('lodash');var util=require(_0x619c('0x0'));var logger=require(_0x619c('0x1'))('api');var moment=require(_0x619c('0x2'));var BPromise=require(_0x619c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x619c('0x4'));var rimraf=require(_0x619c('0x5'));var config=require(_0x619c('0x6'));var attributes=require(_0x619c('0x7'));module[_0x619c('0x8')]=function(_0xa4ec3,_0x3cb4c1){return _0xa4ec3[_0x619c('0x9')](_0x619c('0xa'),attributes,{'tableName':_0x619c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 88520e3..f4a749f 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 _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 +var _0x1853=['info','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyQuestionReport,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1853,0x67));var _0x3185=function(_0x182454,_0x4c25dd){_0x182454=_0x182454-0x0;var _0x262191=_0x1853[_0x182454];return _0x262191;};'use strict';var _=require(_0x3185('0x0'));var util=require('util');var moment=require(_0x3185('0x1'));var BPromise=require('bluebird');var rs=require(_0x3185('0x2'));var fs=require('fs');var Redis=require(_0x3185('0x3'));var db=require(_0x3185('0x4'))['db'];var utils=require(_0x3185('0x5'));var logger=require(_0x3185('0x6'))(_0x3185('0x7'));var config=require(_0x3185('0x8'));var jayson=require(_0x3185('0x9'));var client=jayson[_0x3185('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3aaa37,_0x5e64da,_0x528653){return new BPromise(function(_0x121380,_0x2a989e){return client[_0x3185('0xb')](_0x3aaa37,_0x528653)['then'](function(_0x45555b){logger[_0x3185('0xc')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x5e64da,_0x3185('0xd'));logger[_0x3185('0xe')](_0x3185('0xf'),_0x5e64da,_0x3185('0xd'),JSON[_0x3185('0x10')](_0x45555b));if(_0x45555b[_0x3185('0x11')]){if(_0x45555b[_0x3185('0x11')][_0x3185('0x12')]===0x1f4){logger[_0x3185('0x11')](_0x3185('0x13'),_0x5e64da,_0x45555b[_0x3185('0x11')][_0x3185('0x14')]);return _0x2a989e(_0x45555b[_0x3185('0x11')][_0x3185('0x14')]);}logger[_0x3185('0x11')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x5e64da,_0x45555b[_0x3185('0x11')][_0x3185('0x14')]);return _0x121380(_0x45555b[_0x3185('0x11')]['message']);}else{logger[_0x3185('0xc')](_0x3185('0x13'),_0x5e64da,_0x3185('0xd'));_0x121380(_0x45555b[_0x3185('0x15')]['message']);}})[_0x3185('0x16')](function(_0x2e3057){logger[_0x3185('0x11')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x5e64da,_0x2e3057);_0x2a989e(_0x2e3057);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index ab18614..89cc0c0 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 _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 +var _0x8abd=['get','isAuthenticated','index','describe','/:id','show','getQuestions','post','create','put','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x8abd,0xfc));var _0xd8ab=function(_0x58290d,_0x5f1688){_0x58290d=_0x58290d-0x0;var _0x12a14d=_0x8abd[_0x58290d];return _0x12a14d;};'use strict';var multer=require(_0xd8ab('0x0'));var util=require(_0xd8ab('0x1'));var path=require(_0xd8ab('0x2'));var timeout=require(_0xd8ab('0x3'));var express=require(_0xd8ab('0x4'));var router=express[_0xd8ab('0x5')]();var fs_extra=require(_0xd8ab('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd8ab('0x7'));var controller=require('./jscriptySessionReport.controller');router[_0xd8ab('0x8')]('/',auth[_0xd8ab('0x9')](),controller[_0xd8ab('0xa')]);router['get']('/describe',auth[_0xd8ab('0x9')](),controller[_0xd8ab('0xb')]);router[_0xd8ab('0x8')](_0xd8ab('0xc'),auth[_0xd8ab('0x9')](),controller[_0xd8ab('0xd')]);router['get']('/:id/questions',auth[_0xd8ab('0x9')](),controller[_0xd8ab('0xe')]);router[_0xd8ab('0xf')]('/',auth['isAuthenticated'](),controller[_0xd8ab('0x10')]);router[_0xd8ab('0x11')](_0xd8ab('0xc'),auth[_0xd8ab('0x9')](),controller['update']);router[_0xd8ab('0x12')](_0xd8ab('0xc'),auth['isAuthenticated'](),controller[_0xd8ab('0x13')]);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 f3c051e..abc4401 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 _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 +var _0x2624=['setDataValue','endtime','format','STRING','BOOLEAN','moment','sequelize','DATE','starttime'];(function(_0x4387ae,_0x1b12f1){var _0x2dda0a=function(_0x458e8a){while(--_0x458e8a){_0x4387ae['push'](_0x4387ae['shift']());}};_0x2dda0a(++_0x1b12f1);}(_0x2624,0x191));var _0x4262=function(_0x10e039,_0x56ef51){_0x10e039=_0x10e039-0x0;var _0x562800=_0x2624[_0x10e039];return _0x562800;};'use strict';var moment=require(_0x4262('0x0'));var Sequelize=require(_0x4262('0x1'));module['exports']={'starttime':{'type':Sequelize[_0x4262('0x2')],'set':function(_0x3c9fe8){this['setDataValue'](_0x4262('0x3'),_0x3c9fe8);this[_0x4262('0x4')](_0x4262('0x5'),moment()[_0x4262('0x6')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x4262('0x2')]},'membername':{'type':Sequelize[_0x4262('0x7')]},'projectname':{'type':Sequelize[_0x4262('0x7')]},'queue':{'type':Sequelize[_0x4262('0x7')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x4262('0x7')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x4262('0x8')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index bf0b143..d89fe2c 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 _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 +var _0x7d98=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','status','error','stack','name','index','map','JscriptySessionReport','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','find','create','update','body','destroy','describe','getQuestions','findOne','nolimit','sort','SessionId','JscriptyQuestionReport','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x4f5150,_0x524744){var _0x4d0aa2=function(_0xd21bdc){while(--_0xd21bdc){_0x4f5150['push'](_0x4f5150['shift']());}};_0x4d0aa2(++_0x524744);}(_0x7d98,0xd8));var _0x87d9=function(_0x3b7b8a,_0x52c3b0){_0x3b7b8a=_0x3b7b8a-0x0;var _0x441206=_0x7d98[_0x3b7b8a];return _0x441206;};'use strict';var emlformat=require(_0x87d9('0x0'));var rimraf=require(_0x87d9('0x1'));var zipdir=require(_0x87d9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x87d9('0x3'));var moment=require('moment');var BPromise=require(_0x87d9('0x4'));var Mustache=require(_0x87d9('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x87d9('0x6'));var ejs=require(_0x87d9('0x7'));var fs=require('fs');var fs_extra=require(_0x87d9('0x8'));var _=require(_0x87d9('0x9'));var squel=require('squel');var crypto=require(_0x87d9('0xa'));var jsforce=require(_0x87d9('0xb'));var deskjs=require(_0x87d9('0xc'));var toCsv=require(_0x87d9('0x6'));var querystring=require(_0x87d9('0xd'));var Papa=require(_0x87d9('0xe'));var Redis=require('ioredis');var authService=require(_0x87d9('0xf'));var qs=require(_0x87d9('0x10'));var as=require(_0x87d9('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x87d9('0x12'));var utils=require(_0x87d9('0x13'));var config=require(_0x87d9('0x14'));var licenseUtil=require(_0x87d9('0x15'));var db=require(_0x87d9('0x16'))['db'];function respondWithStatusCode(_0xee02cb,_0xa0266c){_0xa0266c=_0xa0266c||0xcc;return function(_0x1f41b0){if(_0x1f41b0){return _0xee02cb[_0x87d9('0x17')](_0xa0266c);}return _0xee02cb['status'](_0xa0266c)[_0x87d9('0x18')]();};}function respondWithResult(_0x51856d,_0x95ae5b){_0x95ae5b=_0x95ae5b||0xc8;return function(_0x5ecf27){if(_0x5ecf27){return _0x51856d['status'](_0x95ae5b)['json'](_0x5ecf27);}};}function respondWithFilteredResult(_0x2f3629,_0x4d6c12){return function(_0x31310f){if(_0x31310f){var _0x6e38c9=typeof _0x4d6c12[_0x87d9('0x19')]===_0x87d9('0x1a')&&typeof _0x4d6c12[_0x87d9('0x1b')]==='undefined';var _0x3ee5bd=_0x31310f['count'];var _0x25e1f8=_0x6e38c9?0x0:_0x4d6c12[_0x87d9('0x19')];var _0x40c3c8=_0x6e38c9?_0x31310f[_0x87d9('0x1c')]:_0x4d6c12['offset']+_0x4d6c12[_0x87d9('0x1b')];var _0xab126c;if(_0x40c3c8>=_0x3ee5bd){_0x40c3c8=_0x3ee5bd;_0xab126c=0xc8;}else{_0xab126c=0xce;}_0x2f3629['status'](_0xab126c);return _0x2f3629[_0x87d9('0x1d')](_0x87d9('0x1e'),_0x25e1f8+'-'+_0x40c3c8+'/'+_0x3ee5bd)[_0x87d9('0x1f')](_0x31310f);}return null;};}function patchUpdates(_0x3361c4){return function(_0x36854b){try{jsonpatch[_0x87d9('0x20')](_0x36854b,_0x3361c4,!![]);}catch(_0x537a89){return BPromise[_0x87d9('0x21')](_0x537a89);}return _0x36854b[_0x87d9('0x22')]();};}function saveUpdates(_0xfeaea4,_0xb0e892){return function(_0x48aad7){if(_0x48aad7){return _0x48aad7['update'](_0xfeaea4)[_0x87d9('0x23')](function(_0xf00b2f){return _0xf00b2f;});}return null;};}function removeEntity(_0x1b5b85,_0x48b8ff){return function(_0x39e389){if(_0x39e389){return _0x39e389['destroy']()[_0x87d9('0x23')](function(){_0x1b5b85[_0x87d9('0x24')](0xcc)[_0x87d9('0x18')]();});}};}function handleEntityNotFound(_0x4beee0,_0x253c93){return function(_0x379d63){if(!_0x379d63){_0x4beee0['sendStatus'](0x194);}return _0x379d63;};}function handleError(_0x2925f7,_0x49baa0){_0x49baa0=_0x49baa0||0x1f4;return function(_0x39bbbd){logger[_0x87d9('0x25')](_0x39bbbd[_0x87d9('0x26')]);if(_0x39bbbd[_0x87d9('0x27')]){delete _0x39bbbd[_0x87d9('0x27')];}_0x2925f7[_0x87d9('0x24')](_0x49baa0)['send'](_0x39bbbd);};}exports[_0x87d9('0x28')]=function(_0x280921,_0x23c9ab){var _0xb88bd2={},_0x102d17={},_0xd9c03c={'count':0x0,'rows':[]};var _0x47e258=_[_0x87d9('0x29')](db[_0x87d9('0x2a')][_0x87d9('0x2b')],function(_0x2f9051){return{'name':_0x2f9051['fieldName'],'type':_0x2f9051['type'][_0x87d9('0x2c')]};});_0x102d17[_0x87d9('0x2d')]=_['map'](_0x47e258,_0x87d9('0x27'));_0x102d17[_0x87d9('0x2e')]=_[_0x87d9('0x2f')](_0x280921[_0x87d9('0x2e')]);_0x102d17[_0x87d9('0x30')]=_[_0x87d9('0x31')](_0x102d17[_0x87d9('0x2d')],_0x102d17[_0x87d9('0x2e')]);_0xb88bd2[_0x87d9('0x32')]=_[_0x87d9('0x31')](_0x102d17[_0x87d9('0x2d')],qs[_0x87d9('0x33')](_0x280921['query'][_0x87d9('0x33')]));_0xb88bd2[_0x87d9('0x32')]=_0xb88bd2[_0x87d9('0x32')][_0x87d9('0x34')]?_0xb88bd2[_0x87d9('0x32')]:_0x102d17[_0x87d9('0x2d')];if(!_0x280921[_0x87d9('0x2e')][_0x87d9('0x35')]('nolimit')){_0xb88bd2[_0x87d9('0x1b')]=qs['limit'](_0x280921[_0x87d9('0x2e')][_0x87d9('0x1b')]);_0xb88bd2[_0x87d9('0x19')]=qs[_0x87d9('0x19')](_0x280921[_0x87d9('0x2e')][_0x87d9('0x19')]);}_0xb88bd2[_0x87d9('0x36')]=qs['sort'](_0x280921[_0x87d9('0x2e')]['sort']);_0xb88bd2[_0x87d9('0x37')]=qs[_0x87d9('0x30')](_['pick'](_0x280921[_0x87d9('0x2e')],_0x102d17[_0x87d9('0x30')]),_0x47e258);if(_0x280921['query'][_0x87d9('0x38')]){_0xb88bd2[_0x87d9('0x37')]=_[_0x87d9('0x39')](_0xb88bd2['where'],{'$or':_[_0x87d9('0x29')](_0x47e258,function(_0x441613){if(_0x441613['type']!==_0x87d9('0x3a')){var _0x1425c0={};_0x1425c0[_0x441613[_0x87d9('0x27')]]={'$like':'%'+_0x280921['query'][_0x87d9('0x38')]+'%'};return _0x1425c0;}})});}_0xb88bd2=_['merge']({},_0xb88bd2,_0x280921[_0x87d9('0x3b')]);var _0x37fff9={'where':_0xb88bd2[_0x87d9('0x37')]};return db[_0x87d9('0x2a')][_0x87d9('0x1c')](_0x37fff9)['then'](function(_0x19eccf){_0xd9c03c[_0x87d9('0x1c')]=_0x19eccf;if(_0x280921[_0x87d9('0x2e')]['includeAll']){_0xb88bd2[_0x87d9('0x3c')]=[{'all':!![]}];}return db[_0x87d9('0x2a')][_0x87d9('0x3d')](_0xb88bd2);})['then'](function(_0x51b926){_0xd9c03c[_0x87d9('0x3e')]=_0x51b926;return _0xd9c03c;})[_0x87d9('0x23')](respondWithFilteredResult(_0x23c9ab,_0xb88bd2))[_0x87d9('0x3f')](handleError(_0x23c9ab,null));};exports['show']=function(_0x339888,_0x10f3d8){var _0x215549={'raw':!![],'where':{'id':_0x339888[_0x87d9('0x40')]['id']}},_0x116f85={};_0x116f85[_0x87d9('0x2d')]=_[_0x87d9('0x2f')](db[_0x87d9('0x2a')][_0x87d9('0x2b')]);_0x116f85[_0x87d9('0x2e')]=_[_0x87d9('0x2f')](_0x339888[_0x87d9('0x2e')]);_0x116f85[_0x87d9('0x30')]=_[_0x87d9('0x31')](_0x116f85[_0x87d9('0x2d')],_0x116f85['query']);_0x215549[_0x87d9('0x32')]=_[_0x87d9('0x31')](_0x116f85['model'],qs[_0x87d9('0x33')](_0x339888['query']['fields']));_0x215549[_0x87d9('0x32')]=_0x215549[_0x87d9('0x32')][_0x87d9('0x34')]?_0x215549['attributes']:_0x116f85['model'];if(_0x339888['query'][_0x87d9('0x41')]){_0x215549[_0x87d9('0x3c')]=[{'all':!![]}];}_0x215549=_['merge']({},_0x215549,_0x339888['options']);return db[_0x87d9('0x2a')][_0x87d9('0x42')](_0x215549)[_0x87d9('0x23')](handleEntityNotFound(_0x10f3d8,null))[_0x87d9('0x23')](respondWithResult(_0x10f3d8,null))[_0x87d9('0x3f')](handleError(_0x10f3d8,null));};exports['create']=function(_0x19897b,_0x992f6e){return db[_0x87d9('0x2a')][_0x87d9('0x43')](_0x19897b['body'],{})[_0x87d9('0x23')](respondWithResult(_0x992f6e,0xc9))[_0x87d9('0x3f')](handleError(_0x992f6e,null));};exports[_0x87d9('0x44')]=function(_0x45b178,_0x32af95){if(_0x45b178[_0x87d9('0x45')]['id']){delete _0x45b178[_0x87d9('0x45')]['id'];}return db[_0x87d9('0x2a')][_0x87d9('0x42')]({'where':{'id':_0x45b178[_0x87d9('0x40')]['id']}})[_0x87d9('0x23')](handleEntityNotFound(_0x32af95,null))['then'](saveUpdates(_0x45b178[_0x87d9('0x45')],null))[_0x87d9('0x23')](respondWithResult(_0x32af95,null))['catch'](handleError(_0x32af95,null));};exports[_0x87d9('0x46')]=function(_0x5a059e,_0x2b5239){return db[_0x87d9('0x2a')][_0x87d9('0x42')]({'where':{'id':_0x5a059e['params']['id']}})[_0x87d9('0x23')](handleEntityNotFound(_0x2b5239,null))['then'](removeEntity(_0x2b5239,null))[_0x87d9('0x3f')](handleError(_0x2b5239,null));};exports[_0x87d9('0x47')]=function(_0xc2af58,_0xf01d6f){return db[_0x87d9('0x2a')][_0x87d9('0x47')]()[_0x87d9('0x23')](respondWithResult(_0xf01d6f,null))[_0x87d9('0x3f')](handleError(_0xf01d6f,null));};exports[_0x87d9('0x48')]=function(_0x4e3977,_0x2c83e8,_0x183512){var _0x56f25a={'raw':!![],'where':{}};var _0x74b0fa={};var _0x4f4942={'count':0x0,'rows':[]};return db[_0x87d9('0x2a')][_0x87d9('0x49')]({'where':{'id':_0x4e3977[_0x87d9('0x40')]['id']}})[_0x87d9('0x23')](handleEntityNotFound(_0x2c83e8,null))[_0x87d9('0x23')](function(_0x5ae95c){if(_0x5ae95c){_0x74b0fa[_0x87d9('0x2d')]=_['keys'](db['JscriptyQuestionReport'][_0x87d9('0x2b')]);_0x74b0fa[_0x87d9('0x2e')]=_[_0x87d9('0x2f')](_0x4e3977[_0x87d9('0x2e')]);_0x74b0fa[_0x87d9('0x30')]=_[_0x87d9('0x31')](_0x74b0fa[_0x87d9('0x2d')],_0x74b0fa['query']);_0x56f25a[_0x87d9('0x32')]=_[_0x87d9('0x31')](_0x74b0fa[_0x87d9('0x2d')],qs[_0x87d9('0x33')](_0x4e3977[_0x87d9('0x2e')][_0x87d9('0x33')]));_0x56f25a[_0x87d9('0x32')]=_0x56f25a[_0x87d9('0x32')]['length']?_0x56f25a[_0x87d9('0x32')]:_0x74b0fa['model'];if(!_0x4e3977[_0x87d9('0x2e')][_0x87d9('0x35')](_0x87d9('0x4a'))){_0x56f25a[_0x87d9('0x1b')]=qs[_0x87d9('0x1b')](_0x4e3977[_0x87d9('0x2e')][_0x87d9('0x1b')]);_0x56f25a[_0x87d9('0x19')]=qs[_0x87d9('0x19')](_0x4e3977['query'][_0x87d9('0x19')]);}_0x56f25a['order']=qs['sort'](_0x4e3977['query'][_0x87d9('0x4b')]);_0x56f25a[_0x87d9('0x37')]=qs[_0x87d9('0x30')](_['pick'](_0x4e3977[_0x87d9('0x2e')],_0x74b0fa[_0x87d9('0x30')]));_0x56f25a[_0x87d9('0x37')][_0x87d9('0x4c')]=_0x5ae95c['id'];if(_0x4e3977[_0x87d9('0x2e')][_0x87d9('0x38')]){_0x56f25a[_0x87d9('0x37')]=_[_0x87d9('0x39')](_0x56f25a[_0x87d9('0x37')],{'$or':_[_0x87d9('0x29')](_0x56f25a[_0x87d9('0x32')],function(_0x485a46){var _0xa7b827={};_0xa7b827[_0x485a46]={'$like':'%'+_0x4e3977['query'][_0x87d9('0x38')]+'%'};return _0xa7b827;})});}_0x56f25a=_[_0x87d9('0x39')]({},_0x56f25a,_0x4e3977[_0x87d9('0x3b')]);return db[_0x87d9('0x4d')][_0x87d9('0x1c')]({'where':_0x56f25a[_0x87d9('0x37')]})[_0x87d9('0x23')](function(_0x18cf7a){_0x4f4942[_0x87d9('0x1c')]=_0x18cf7a;if(_0x4e3977[_0x87d9('0x2e')][_0x87d9('0x41')]){_0x56f25a[_0x87d9('0x3c')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x87d9('0x3d')](_0x56f25a);})[_0x87d9('0x23')](function(_0xde6304){_0x4f4942[_0x87d9('0x3e')]=_0xde6304;return _0x4f4942;});}})['then'](respondWithFilteredResult(_0x2c83e8,_0x56f25a))[_0x87d9('0x3f')](handleError(_0x2c83e8,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 6153750..9f1c747 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 _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 +var _0xd8fb=['lodash','util','../../config/logger','api','path','rimraf','./jscriptySessionReport.attributes','exports','JscriptySessionReport'];(function(_0x889837,_0x726755){var _0x21f6dc=function(_0xc9967b){while(--_0xc9967b){_0x889837['push'](_0x889837['shift']());}};_0x21f6dc(++_0x726755);}(_0xd8fb,0x99));var _0xbd8f=function(_0x4f9a72,_0x5d3ec9){_0x4f9a72=_0x4f9a72-0x0;var _0x395f6f=_0xd8fb[_0x4f9a72];return _0x395f6f;};'use strict';var _=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var logger=require(_0xbd8f('0x2'))(_0xbd8f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd8f('0x4'));var rimraf=require(_0xbd8f('0x5'));var config=require('../../config/environment');var attributes=require(_0xbd8f('0x6'));module[_0xbd8f('0x7')]=function(_0x5543b2,_0x33d541){return _0x5543b2['define'](_0xbd8f('0x8'),attributes,{'tableName':'report_jscripty_sessions','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 9ced126..ffb0e10 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 _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 +var _0x4325=['http','request','then','JscriptySessionReport,\x20%s,\x20%s','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client'];(function(_0x13485d,_0x394d5b){var _0x2ba28d=function(_0x135023){while(--_0x135023){_0x13485d['push'](_0x13485d['shift']());}};_0x2ba28d(++_0x394d5b);}(_0x4325,0x1da));var _0x5432=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x4325[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x5432('0x0'));var util=require(_0x5432('0x1'));var moment=require('moment');var BPromise=require(_0x5432('0x2'));var rs=require(_0x5432('0x3'));var fs=require('fs');var Redis=require(_0x5432('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5432('0x5'))(_0x5432('0x6'));var config=require(_0x5432('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5432('0x8')][_0x5432('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a6e76,_0x106ec9,_0x50394d){return new BPromise(function(_0xc8252e,_0x1c9762){return client[_0x5432('0xa')](_0x4a6e76,_0x50394d)[_0x5432('0xb')](function(_0x263a0c){logger['info'](_0x5432('0xc'),_0x106ec9,'request\x20sent');logger[_0x5432('0xd')](_0x5432('0xe'),_0x106ec9,_0x5432('0xf'),JSON[_0x5432('0x10')](_0x263a0c));if(_0x263a0c['error']){if(_0x263a0c['error'][_0x5432('0x11')]===0x1f4){logger[_0x5432('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x106ec9,_0x263a0c[_0x5432('0x12')][_0x5432('0x13')]);return _0x1c9762(_0x263a0c[_0x5432('0x12')][_0x5432('0x13')]);}logger[_0x5432('0x12')](_0x5432('0xc'),_0x106ec9,_0x263a0c['error']['message']);return _0xc8252e(_0x263a0c[_0x5432('0x12')][_0x5432('0x13')]);}else{logger[_0x5432('0x14')](_0x5432('0xc'),_0x106ec9,_0x5432('0xf'));_0xc8252e(_0x263a0c[_0x5432('0x15')]['message']);}})[_0x5432('0x16')](function(_0x49e8fd){logger[_0x5432('0x12')](_0x5432('0xc'),_0x106ec9,_0x49e8fd);_0x1c9762(_0x49e8fd);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 5ec6ddc..d7fbe7c 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 _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 +var _0x63fe=['path','connect-timeout','express','fs-extra','../../components/auth/service','./license.controller','get','index','isAuthenticated','update','/download_log_file','downloadLogFile','exports'];(function(_0x4bb107,_0x1c2551){var _0xe7cdef=function(_0x3f5dfe){while(--_0x3f5dfe){_0x4bb107['push'](_0x4bb107['shift']());}};_0xe7cdef(++_0x1c2551);}(_0x63fe,0xea));var _0xe63f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x63fe[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe63f('0x0'));var timeout=require(_0xe63f('0x1'));var express=require(_0xe63f('0x2'));var router=express['Router']();var fs_extra=require(_0xe63f('0x3'));var auth=require(_0xe63f('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe63f('0x5'));router[_0xe63f('0x6')]('/',controller[_0xe63f('0x7')]);router['put']('/:id',auth[_0xe63f('0x8')](),controller[_0xe63f('0x9')]);router[_0xe63f('0x6')](_0xe63f('0xa'),auth[_0xe63f('0x8')](),controller[_0xe63f('0xb')]);module[_0xe63f('0xc')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index d54b5f5..918b3eb 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 _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 +var _0x5263=['sequelize','exports','STRING','INTEGER'];(function(_0x446f1b,_0x2cf9c2){var _0x2409a9=function(_0x29c0ca){while(--_0x29c0ca){_0x446f1b['push'](_0x446f1b['shift']());}};_0x2409a9(++_0x2cf9c2);}(_0x5263,0xe8));var _0x3526=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x5263[_0x160c73];return _0xd9302;};'use strict';var Sequelize=require(_0x3526('0x0'));module[_0x3526('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0x3526('0x2')]},'data2':{'type':Sequelize[_0x3526('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x3526('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index eb10211..79cd709 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 _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 +var _0x0349=['undefined','limit','count','set','Content-Range','apply','then','sendStatus','error','stack','name','send','index','model','keys','License','rawAttributes','query','filters','intersection','attributes','length','merge','options','getLicense','catch','update','body','find','params','get','checkLicense','key','demo','downloadLogFile','/var','log','xcally','setHeader','Content-disposition','Content-Type','text/plain','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset'];(function(_0x441161,_0x19821b){var _0x2be3be=function(_0x224582){while(--_0x224582){_0x441161['push'](_0x441161['shift']());}};_0x2be3be(++_0x19821b);}(_0x0349,0x1e7));var _0x9034=function(_0x58ae8a,_0x3c619e){_0x58ae8a=_0x58ae8a-0x0;var _0x2f0b6b=_0x0349[_0x58ae8a];return _0x2f0b6b;};'use strict';var emlformat=require(_0x9034('0x0'));var rimraf=require(_0x9034('0x1'));var zipdir=require(_0x9034('0x2'));var jsonpatch=require(_0x9034('0x3'));var rp=require(_0x9034('0x4'));var moment=require(_0x9034('0x5'));var BPromise=require(_0x9034('0x6'));var Mustache=require(_0x9034('0x7'));var util=require(_0x9034('0x8'));var path=require(_0x9034('0x9'));var sox=require('sox');var csv=require(_0x9034('0xa'));var ejs=require(_0x9034('0xb'));var fs=require('fs');var fs_extra=require(_0x9034('0xc'));var _=require(_0x9034('0xd'));var squel=require(_0x9034('0xe'));var crypto=require(_0x9034('0xf'));var jsforce=require(_0x9034('0x10'));var deskjs=require(_0x9034('0x11'));var toCsv=require(_0x9034('0xa'));var querystring=require(_0x9034('0x12'));var Papa=require('papaparse');var Redis=require(_0x9034('0x13'));var authService=require(_0x9034('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x9034('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9034('0x16'))(_0x9034('0x17'));var utils=require(_0x9034('0x18'));var config=require(_0x9034('0x19'));var licenseUtil=require(_0x9034('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xcd3283,_0x4e2f64){_0x4e2f64=_0x4e2f64||0xcc;return function(_0x515d31){if(_0x515d31){return _0xcd3283['sendStatus'](_0x4e2f64);}return _0xcd3283[_0x9034('0x1b')](_0x4e2f64)[_0x9034('0x1c')]();};}function respondWithResult(_0x472acc,_0x1dd874){_0x1dd874=_0x1dd874||0xc8;return function(_0x6cffa5){if(_0x6cffa5){return _0x472acc[_0x9034('0x1b')](_0x1dd874)[_0x9034('0x1d')](_0x6cffa5);}};}function respondWithFilteredResult(_0x2eb177,_0x405ace){return function(_0x3b38f4){if(_0x3b38f4){var _0x21021e=typeof _0x405ace[_0x9034('0x1e')]===_0x9034('0x1f')&&typeof _0x405ace[_0x9034('0x20')]==='undefined';var _0x4987a8=_0x3b38f4[_0x9034('0x21')];var _0x1cad34=_0x21021e?0x0:_0x405ace[_0x9034('0x1e')];var _0x44d8c0=_0x21021e?_0x3b38f4[_0x9034('0x21')]:_0x405ace[_0x9034('0x1e')]+_0x405ace[_0x9034('0x20')];var _0x52b5d0;if(_0x44d8c0>=_0x4987a8){_0x44d8c0=_0x4987a8;_0x52b5d0=0xc8;}else{_0x52b5d0=0xce;}_0x2eb177[_0x9034('0x1b')](_0x52b5d0);return _0x2eb177[_0x9034('0x22')](_0x9034('0x23'),_0x1cad34+'-'+_0x44d8c0+'/'+_0x4987a8)[_0x9034('0x1d')](_0x3b38f4);}return null;};}function patchUpdates(_0x165db7){return function(_0x370ace){try{jsonpatch[_0x9034('0x24')](_0x370ace,_0x165db7,!![]);}catch(_0x4c2429){return BPromise['reject'](_0x4c2429);}return _0x370ace['save']();};}function saveUpdates(_0x21805b,_0x3fa3d3){return function(_0x51c9ce){if(_0x51c9ce){return _0x51c9ce['update'](_0x21805b)[_0x9034('0x25')](function(_0x3f0a53){return _0x3f0a53;});}return null;};}function removeEntity(_0x2f236a,_0x1e093c){return function(_0x4e82de){if(_0x4e82de){return _0x4e82de['destroy']()[_0x9034('0x25')](function(){_0x2f236a['status'](0xcc)[_0x9034('0x1c')]();});}};}function handleEntityNotFound(_0x1c3213,_0x314a4a){return function(_0xab0bf5){if(!_0xab0bf5){_0x1c3213[_0x9034('0x26')](0x194);}return _0xab0bf5;};}function handleError(_0x3b86af,_0x7a18e0){_0x7a18e0=_0x7a18e0||0x1f4;return function(_0x1f4c0d){logger[_0x9034('0x27')](_0x1f4c0d[_0x9034('0x28')]);if(_0x1f4c0d['name']){delete _0x1f4c0d[_0x9034('0x29')];}_0x3b86af[_0x9034('0x1b')](_0x7a18e0)[_0x9034('0x2a')](_0x1f4c0d);};}var utilLicense=require(_0x9034('0x1a'));exports[_0x9034('0x2b')]=function(_0xb40fab,_0x53dc39){var _0x1af6de={'raw':!![],'where':{'id':0x1}},_0xf09c8a={};_0xf09c8a[_0x9034('0x2c')]=_[_0x9034('0x2d')](db[_0x9034('0x2e')][_0x9034('0x2f')]);_0xf09c8a['query']=_[_0x9034('0x2d')](_0xb40fab[_0x9034('0x30')]);_0xf09c8a[_0x9034('0x31')]=_[_0x9034('0x32')](_0xf09c8a[_0x9034('0x2c')],_0xf09c8a[_0x9034('0x30')]);_0x1af6de[_0x9034('0x33')]=_[_0x9034('0x32')](_0xf09c8a[_0x9034('0x2c')],qs['fields'](_0xb40fab[_0x9034('0x30')]['fields']));_0x1af6de[_0x9034('0x33')]=_0x1af6de['attributes'][_0x9034('0x34')]?_0x1af6de[_0x9034('0x33')]:_0xf09c8a[_0x9034('0x2c')];_0x1af6de=_[_0x9034('0x35')]({},_0x1af6de,_0xb40fab[_0x9034('0x36')]);return utilLicense[_0x9034('0x37')](_0x1af6de)[_0x9034('0x25')](respondWithResult(_0x53dc39,null))[_0x9034('0x38')](handleError(_0x53dc39,null));};exports[_0x9034('0x39')]=function(_0x10748b,_0x5d7427){if(_0x10748b[_0x9034('0x3a')]['id']){delete _0x10748b[_0x9034('0x3a')]['id'];}return db[_0x9034('0x2e')][_0x9034('0x3b')]({'where':{'id':_0x10748b[_0x9034('0x3c')]['id']}})['then'](handleEntityNotFound(_0x5d7427,null))[_0x9034('0x25')](function(_0x5edd79){var _0x232eb2=_0x5edd79[_0x9034('0x3d')]({'plain':!![]});return utilLicense[_0x9034('0x3e')](_0x232eb2,_0x10748b[_0x9034('0x3a')][_0x9034('0x3f')]);})[_0x9034('0x25')](function(_0x82d049){if(!_0x82d049[_0x9034('0x40')]){return saveUpdates(_0x10748b[_0x9034('0x3a')],null);}return _0x82d049;})[_0x9034('0x25')](respondWithResult(_0x5d7427,null))['catch'](handleError(_0x5d7427,null));};exports[_0x9034('0x41')]=function(_0x5e0bc7,_0x336af4){var _0x3c8bea='license-info.log';var _0x196b14=path['join'](_0x9034('0x42'),_0x9034('0x43'),_0x9034('0x44'),_0x3c8bea);_0x336af4[_0x9034('0x45')](_0x9034('0x46'),'attachment;\x20filename='+_0x3c8bea);_0x336af4['set'](_0x9034('0x47'),_0x9034('0x48'));_0x336af4[_0x9034('0x49')](_0x196b14);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 1ec13e2..b4b39f7 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 _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 +var _0xc6c2=['api','moment','bluebird','request-promise','path','rimraf','./license.attributes','exports','define','License','license','lodash','util'];(function(_0x11dc39,_0x491115){var _0x457277=function(_0x1d77cd){while(--_0x1d77cd){_0x11dc39['push'](_0x11dc39['shift']());}};_0x457277(++_0x491115);}(_0xc6c2,0x9a));var _0x2c6c=function(_0x3430aa,_0x57cd92){_0x3430aa=_0x3430aa-0x0;var _0x2ac5c=_0xc6c2[_0x3430aa];return _0x2ac5c;};'use strict';var _=require(_0x2c6c('0x0'));var util=require(_0x2c6c('0x1'));var logger=require('../../config/logger')(_0x2c6c('0x2'));var moment=require(_0x2c6c('0x3'));var BPromise=require(_0x2c6c('0x4'));var rp=require(_0x2c6c('0x5'));var fs=require('fs');var path=require(_0x2c6c('0x6'));var rimraf=require(_0x2c6c('0x7'));var config=require('../../config/environment');var attributes=require(_0x2c6c('0x8'));module[_0x2c6c('0x9')]=function(_0x319233,_0x5e1dfb){return _0x319233[_0x2c6c('0xa')](_0x2c6c('0xb'),attributes,{'tableName':_0x2c6c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 5def824..556cf8d 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 _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 +var _0x436c=['rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','License,\x20%s,\x20%s,\x20%s','stringify','error','code','License,\x20%s,\x20%s','message','catch','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x4a439c,_0x3716c3){var _0x2bbaa6=function(_0x289569){while(--_0x289569){_0x4a439c['push'](_0x4a439c['shift']());}};_0x2bbaa6(++_0x3716c3);}(_0x436c,0xaf));var _0xc436=function(_0x303ff3,_0x1a4449){_0x303ff3=_0x303ff3-0x0;var _0x449fe6=_0x436c[_0x303ff3];return _0x449fe6;};'use strict';var _=require('lodash');var util=require(_0xc436('0x0'));var moment=require(_0xc436('0x1'));var BPromise=require('bluebird');var rs=require(_0xc436('0x2'));var fs=require('fs');var Redis=require(_0xc436('0x3'));var db=require(_0xc436('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc436('0x5'));var config=require(_0xc436('0x6'));var jayson=require(_0xc436('0x7'));var client=jayson[_0xc436('0x8')][_0xc436('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x283e2d,_0x5d56ca,_0x10ef20){return new BPromise(function(_0x5a0300,_0x43bf58){return client[_0xc436('0xa')](_0x283e2d,_0x10ef20)['then'](function(_0x52ab44){logger[_0xc436('0xb')]('License,\x20%s,\x20%s',_0x5d56ca,_0xc436('0xc'));logger['debug'](_0xc436('0xd'),_0x5d56ca,_0xc436('0xc'),JSON[_0xc436('0xe')](_0x52ab44));if(_0x52ab44[_0xc436('0xf')]){if(_0x52ab44[_0xc436('0xf')][_0xc436('0x10')]===0x1f4){logger[_0xc436('0xf')](_0xc436('0x11'),_0x5d56ca,_0x52ab44[_0xc436('0xf')][_0xc436('0x12')]);return _0x43bf58(_0x52ab44[_0xc436('0xf')][_0xc436('0x12')]);}logger['error'](_0xc436('0x11'),_0x5d56ca,_0x52ab44[_0xc436('0xf')][_0xc436('0x12')]);return _0x5a0300(_0x52ab44[_0xc436('0xf')][_0xc436('0x12')]);}else{logger[_0xc436('0xb')](_0xc436('0x11'),_0x5d56ca,_0xc436('0xc'));_0x5a0300(_0x52ab44['result'][_0xc436('0x12')]);}})[_0xc436('0x13')](function(_0x4bf223){logger[_0xc436('0xf')](_0xc436('0x11'),_0x5d56ca,_0x4bf223);_0x43bf58(_0x4bf223);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 77506f3..3c7ca8f 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 _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 +var _0xb390=['./mailAccount.controller','get','isAuthenticated','index','/describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','/:id/out_servers','/:id/interactions','getInteractions','/:id/applications','/:id/verify','verifySmtp','/:id/users','addDisposition','post','create','addImap','addSmtp','addInteraction','addApplications','/:id/send','send','addAgents','put','update','delete','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5b3e82,_0x29b5f3){var _0x47535e=function(_0x4ed3e1){while(--_0x4ed3e1){_0x5b3e82['push'](_0x5b3e82['shift']());}};_0x47535e(++_0x29b5f3);}(_0xb390,0xd4));var _0x0b39=function(_0x2d5196,_0x4ab5aa){_0x2d5196=_0x2d5196-0x0;var _0x51c652=_0xb390[_0x2d5196];return _0x51c652;};'use strict';var multer=require(_0x0b39('0x0'));var util=require(_0x0b39('0x1'));var path=require(_0x0b39('0x2'));var timeout=require(_0x0b39('0x3'));var express=require(_0x0b39('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0b39('0x5'));var interaction=require(_0x0b39('0x6'));var config=require(_0x0b39('0x7'));var controller=require(_0x0b39('0x8'));router[_0x0b39('0x9')]('/',auth[_0x0b39('0xa')](),controller[_0x0b39('0xb')]);router[_0x0b39('0x9')](_0x0b39('0xc'),auth[_0x0b39('0xa')](),controller['describe']);router[_0x0b39('0x9')](_0x0b39('0xd'),auth[_0x0b39('0xa')](),controller['show']);router[_0x0b39('0x9')](_0x0b39('0xe'),auth['isAuthenticated'](),controller[_0x0b39('0xf')]);router['get'](_0x0b39('0x10'),auth[_0x0b39('0xa')](),controller[_0x0b39('0x11')]);router[_0x0b39('0x9')](_0x0b39('0x12'),auth[_0x0b39('0xa')](),controller['getImap']);router[_0x0b39('0x9')](_0x0b39('0x13'),auth['isAuthenticated'](),controller['getSmtp']);router[_0x0b39('0x9')](_0x0b39('0x14'),auth['isAuthenticated'](),controller[_0x0b39('0x15')]);router['get'](_0x0b39('0x16'),auth[_0x0b39('0xa')](),controller['getApplications']);router[_0x0b39('0x9')]('/:id/messages',auth[_0x0b39('0xa')](),controller['getMessages']);router[_0x0b39('0x9')](_0x0b39('0x17'),auth[_0x0b39('0xa')](),controller[_0x0b39('0x18')]);router[_0x0b39('0x9')](_0x0b39('0x19'),auth[_0x0b39('0xa')](),controller['getAgents']);router['post'](_0x0b39('0xe'),auth[_0x0b39('0xa')](),controller[_0x0b39('0x1a')]);router[_0x0b39('0x1b')](_0x0b39('0x10'),auth[_0x0b39('0xa')](),controller['addAnswer']);router['post']('/',auth[_0x0b39('0xa')](),controller[_0x0b39('0x1c')]);router[_0x0b39('0x1b')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0x0b39('0x1d')]);router[_0x0b39('0x1b')](_0x0b39('0x13'),auth['isAuthenticated'](),controller[_0x0b39('0x1e')]);router[_0x0b39('0x1b')](_0x0b39('0x14'),auth['isAuthenticated'](),controller[_0x0b39('0x1f')]);router[_0x0b39('0x1b')](_0x0b39('0x16'),auth['isAuthenticated'](),controller[_0x0b39('0x20')]);router['post'](_0x0b39('0x21'),auth[_0x0b39('0xa')](),controller[_0x0b39('0x22')]);router[_0x0b39('0x1b')](_0x0b39('0x19'),auth['isAuthenticated'](),controller[_0x0b39('0x23')]);router[_0x0b39('0x24')](_0x0b39('0xd'),auth[_0x0b39('0xa')](),controller[_0x0b39('0x25')]);router[_0x0b39('0x26')]('/:id/dispositions',auth['isAuthenticated'](),controller['removeDispositions']);router[_0x0b39('0x26')](_0x0b39('0x10'),auth['isAuthenticated'](),controller[_0x0b39('0x27')]);router[_0x0b39('0x26')](_0x0b39('0x12'),auth[_0x0b39('0xa')](),controller[_0x0b39('0x28')]);router[_0x0b39('0x26')](_0x0b39('0x13'),auth[_0x0b39('0xa')](),controller[_0x0b39('0x29')]);router[_0x0b39('0x26')]('/:id',auth[_0x0b39('0xa')](),controller[_0x0b39('0x2a')]);router[_0x0b39('0x26')](_0x0b39('0x19'),auth[_0x0b39('0xa')](),controller[_0x0b39('0x2b')]);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 ce69ae3..75b119e 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 _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 +var _0xef3d=['TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','gmail','yahoo','provider','custom','exports','STRING','BOOLEAN','Arial,Helvetica,sans-serif','INTEGER'];(function(_0xe206ed,_0x179821){var _0x4423ab=function(_0x2668d2){while(--_0x2668d2){_0xe206ed['push'](_0xe206ed['shift']());}};_0x4423ab(++_0x179821);}(_0xef3d,0x16b));var _0xdef3=function(_0x2ac9a5,_0x3ea000){_0x2ac9a5=_0x2ac9a5-0x0;var _0x1b1c64=_0xef3d[_0x2ac9a5];return _0x1b1c64;};'use strict';var Sequelize=require('sequelize');module[_0xdef3('0x0')]={'description':{'type':Sequelize[_0xdef3('0x1')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0xdef3('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xdef3('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xdef3('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0xdef3('0x1')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0xdef3('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xdef3('0x3')},'fontSize':{'type':Sequelize[_0xdef3('0x4')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xdef3('0x5')],'defaultValue':function(){return _0xdef3('0x6');}},'notificationSound':{'type':Sequelize[_0xdef3('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xdef3('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xdef3('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xdef3('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xdef3('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xdef3('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xdef3('0x4')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xdef3('0x2')],'defaultValue':![],'comment':_0xdef3('0x7'),'set':function(_0x533bdb){if(!_0x533bdb)this[_0xdef3('0x8')](_0xdef3('0x9'),null);this[_0xdef3('0x8')](_0xdef3('0xa'),_0x533bdb);}},'provider':{'type':Sequelize[_0xdef3('0xb')](_0xdef3('0xc'),'hotmail',_0xdef3('0xd'),'outlook365'),'defaultValue':null,'get':function(){var _0x1b4b7a=this['getDataValue'](_0xdef3('0xe'));return _0x1b4b7a||_0xdef3('0xf');},'set':function(_0x24ca28){if(_0x24ca28==='custom'){_0x24ca28=null;}return this[_0xdef3('0x8')](_0xdef3('0xe'),_0x24ca28);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index a43bcce..ce93baa 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 _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 +var _0x0d70=['from','attachments','join','server/files/attachments','basename','getSmtpOptions','List\x20not\x20found','attach','out','messageId','Messages','verifySmtp','Sequelize','ValidationError','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','moment','bluebird','util','path','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','jayson/promise','http','request','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','MailAccount,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','update','then','MailAccounts','destroy','stack','name','gmail','yahoo','imap.mail.yahoo.com','imap-mail.outlook.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','hotmail','smtp-mail.outlook.com','outlook365','smtp.office365.com','user','username','password','pass','modernAuthentication','CloudProviderId','port','secure','service','authentication','host','Imap','index','MailServerIn','MailServerOut','Smtp','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','find','body','provider','custom','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','pick','removeDispositions','ids','addAnswer','CannedAnswer','nolimit','removeAnswers','email','ListId','active','description','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Owner','fullname','Tag','Tags','tag','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','finally','send','getApplications','getMessages','MailMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','split','CmList','List','Contacts','updatedAt','CloudProvider'];(function(_0x43bed9,_0x26adca){var _0x27b03d=function(_0x5c47c9){while(--_0x5c47c9){_0x43bed9['push'](_0x43bed9['shift']());}};_0x27b03d(++_0x26adca);}(_0x0d70,0xda));var _0x00d7=function(_0x17407f,_0x407371){_0x17407f=_0x17407f-0x0;var _0x4f26af=_0x0d70[_0x17407f];return _0x4f26af;};'use strict';var moment=require(_0x00d7('0x0'));var BPromise=require(_0x00d7('0x1'));var util=require(_0x00d7('0x2'));var path=require(_0x00d7('0x3'));var _=require(_0x00d7('0x4'));var juice=require('juice');var Redis=require(_0x00d7('0x5'));var qs=require(_0x00d7('0x6'));var logger=require(_0x00d7('0x7'))(_0x00d7('0x8'));var config=require(_0x00d7('0x9'));var db=require('../../mysqldb')['db'];config[_0x00d7('0xa')]=_[_0x00d7('0xb')](config['redis'],{'host':_0x00d7('0xc'),'port':0x18eb});var socket=require(_0x00d7('0xd'))(new Redis(config[_0x00d7('0xa')]));require(_0x00d7('0xe'))['register'](socket);var jayson=require(_0x00d7('0xf'));var client=jayson['client'][_0x00d7('0x10')]({'port':0x232b});function respondWithRpcPromise(_0x3d3953,_0xdac935,_0x2ecc1a,_0x84c5e){return new BPromise(function(_0x290829,_0x435ee5){var _0xaefc56=_0x84c5e||client;return _0xaefc56[_0x00d7('0x11')](_0x3d3953,_0x2ecc1a)['then'](function(_0x4b2c46){logger['info']('MailAccount,\x20%s,\x20%s',_0xdac935,_0x00d7('0x12'));logger[_0x00d7('0x13')](_0x00d7('0x14'),_0xdac935,'request\x20sent',JSON[_0x00d7('0x15')](_0x4b2c46));if(_0x4b2c46[_0x00d7('0x16')]){if(_0x4b2c46['error'][_0x00d7('0x17')]===0x1f4){logger[_0x00d7('0x16')](_0x00d7('0x18'),_0xdac935,_0x4b2c46['error'][_0x00d7('0x19')]);return _0x435ee5(_0x4b2c46['error'][_0x00d7('0x19')]);}logger[_0x00d7('0x16')]('MailAccount,\x20%s,\x20%s',_0xdac935,_0x4b2c46[_0x00d7('0x16')][_0x00d7('0x19')]);return _0x290829(_0x4b2c46['error'][_0x00d7('0x19')]);}else{logger[_0x00d7('0x1a')](_0x00d7('0x18'),_0xdac935,_0x00d7('0x12'));_0x290829(_0x4b2c46[_0x00d7('0x1b')]['message']);}})[_0x00d7('0x1c')](function(_0x5a246c){logger['error'](_0x00d7('0x18'),_0xdac935,_0x5a246c);_0x435ee5(_0x5a246c);});});}function respondWithStatusCode(_0x3719b9,_0x2fe385){_0x2fe385=_0x2fe385||0xcc;return function(_0x41d451){if(_0x41d451){return _0x3719b9[_0x00d7('0x1d')](_0x2fe385);}return _0x3719b9[_0x00d7('0x1e')](_0x2fe385)[_0x00d7('0x1f')]();};}function respondWithResult(_0x3248de,_0x24beb6){_0x24beb6=_0x24beb6||0xc8;return function(_0x4f8756){if(_0x4f8756){return _0x3248de['status'](_0x24beb6)[_0x00d7('0x20')](_0x4f8756);}};}function respondWithFilteredResult(_0x2fbe85,_0x390bdc){return function(_0x5831e6){if(_0x5831e6){var _0x13f483=typeof _0x390bdc['offset']===_0x00d7('0x21')&&typeof _0x390bdc[_0x00d7('0x22')]==='undefined';var _0x3bcf55=_0x5831e6[_0x00d7('0x23')];var _0x3ff766=_0x13f483?0x0:_0x390bdc[_0x00d7('0x24')];var _0x451b7f=_0x13f483?_0x5831e6[_0x00d7('0x23')]:_0x390bdc[_0x00d7('0x24')]+_0x390bdc['limit'];var _0x374cdd;if(_0x451b7f>=_0x3bcf55){_0x451b7f=_0x3bcf55;_0x374cdd=0xc8;}else{_0x374cdd=0xce;}_0x2fbe85[_0x00d7('0x1e')](_0x374cdd);return _0x2fbe85[_0x00d7('0x25')]('Content-Range',_0x3ff766+'-'+_0x451b7f+'/'+_0x3bcf55)[_0x00d7('0x20')](_0x5831e6);}return null;};}function saveUpdates(_0x292b66){return function(_0x3e0a90){if(_0x3e0a90){return _0x3e0a90[_0x00d7('0x26')](_0x292b66)[_0x00d7('0x27')](function(_0x2264f0){return _0x2264f0;});}return null;};}function removeEntity(_0x26a4e4){return function(_0xb4b64b){if(_0xb4b64b){return _0xb4b64b['destroy']()[_0x00d7('0x27')](function(){var _0x573196=_0xb4b64b['get']({'plain':!![]});var _0x4d784c=_0x00d7('0x28');return db['UserProfileResource'][_0x00d7('0x29')]({'where':{'type':_0x4d784c,'resourceId':_0x573196['id']}})[_0x00d7('0x27')](function(){return _0xb4b64b;});})['then'](function(){_0x26a4e4[_0x00d7('0x1e')](0xcc)[_0x00d7('0x1f')]();});}};}function handleEntityNotFound(_0x488800){return function(_0x2524a2){if(!_0x2524a2){_0x488800['sendStatus'](0x194);}return _0x2524a2;};}function handleError(_0x60e230,_0x14f3f8){_0x14f3f8=_0x14f3f8||0x1f4;return function(_0x39ef86){logger[_0x00d7('0x16')](_0x39ef86[_0x00d7('0x2a')]);if(_0x39ef86['name']){delete _0x39ef86[_0x00d7('0x2b')];}_0x60e230[_0x00d7('0x1e')](_0x14f3f8)['send'](_0x39ef86);};}function getImapHost(_0x43687e){switch(_0x43687e){case _0x00d7('0x2c'):return'imap.gmail.com';case _0x00d7('0x2d'):return _0x00d7('0x2e');case'hotmail':return _0x00d7('0x2f');case'outlook365':return'outlook.office365.com';}throw new Error(_0x00d7('0x30'),_0x43687e);}function getSmtpHost(_0x2f9bb1){switch(_0x2f9bb1){case _0x00d7('0x2c'):return _0x00d7('0x31');case _0x00d7('0x2d'):return _0x00d7('0x32');case _0x00d7('0x33'):return _0x00d7('0x34');case _0x00d7('0x35'):return _0x00d7('0x36');}throw new Error('Unknown\x20email\x20service\x20provider',_0x2f9bb1);}function getAuthenticationOptions(_0x5d56d2,_0x5e9f33){var _0x21adc2={};var _0x534980={};if(_0x5d56d2){_0x21adc2[_0x00d7('0x37')]=_0x534980['user']=_0x5e9f33[_0x00d7('0x38')];_0x21adc2[_0x00d7('0x39')]=_0x534980[_0x00d7('0x3a')]=_0x5e9f33['password'];if(_0x5e9f33['modernAuthentication']){_0x21adc2[_0x00d7('0x3b')]=_0x534980[_0x00d7('0x3b')]=!![];_0x21adc2['CloudProviderId']=_0x534980[_0x00d7('0x3c')]=_0x5e9f33['CloudProviderId'];_0x21adc2[_0x00d7('0x39')]=_0x534980[_0x00d7('0x3a')]=null;}else{_0x21adc2[_0x00d7('0x3c')]=_0x534980[_0x00d7('0x3c')]=null;}_0x21adc2['host']=getImapHost(_0x5d56d2);_0x21adc2[_0x00d7('0x3d')]=0x3e1;_0x534980['host']=getSmtpHost(_0x5d56d2);_0x534980['port']=0x24b;_0x534980[_0x00d7('0x3e')]=![];_0x21adc2[_0x00d7('0x3f')]=_0x534980['service']=null;}else{if(_0x5e9f33['authentication']){_0x21adc2[_0x00d7('0x37')]=_0x534980[_0x00d7('0x37')]=_0x5e9f33['username'];_0x21adc2['password']=_0x534980['pass']=_0x5e9f33[_0x00d7('0x39')];}else{_0x21adc2[_0x00d7('0x40')]=_0x534980[_0x00d7('0x40')]=![];_0x21adc2[_0x00d7('0x37')]=_0x534980['user']=null;_0x21adc2[_0x00d7('0x39')]=_0x534980[_0x00d7('0x3a')]=null;}_0x21adc2[_0x00d7('0x41')]=_0x5e9f33[_0x00d7('0x42')][_0x00d7('0x41')];_0x21adc2['port']=_0x5e9f33[_0x00d7('0x42')][_0x00d7('0x3d')];_0x534980[_0x00d7('0x41')]=_0x5e9f33['Smtp'][_0x00d7('0x41')];_0x534980[_0x00d7('0x3d')]=_0x5e9f33['Smtp']['port'];}return{'Imap':_0x21adc2,'Smtp':_0x534980};}exports[_0x00d7('0x43')]=function(_0x1052d1,_0x55b485){var _0x21da92={'include':[{'model':db[_0x00d7('0x44')],'as':_0x00d7('0x42')},{'model':db[_0x00d7('0x45')],'as':_0x00d7('0x46')},{'model':db[_0x00d7('0x47')],'as':_0x00d7('0x48')}]},_0x3d6322={},_0xfde668={'count':0x0,'rows':[]};var _0x1ed72f=_[_0x00d7('0x49')](db[_0x00d7('0x4a')][_0x00d7('0x4b')],function(_0x1540eb){return{'name':_0x1540eb[_0x00d7('0x4c')],'type':_0x1540eb[_0x00d7('0x4d')][_0x00d7('0x4e')]};});_0x3d6322[_0x00d7('0x4f')]=_['map'](_0x1ed72f,'name');_0x3d6322['query']=_[_0x00d7('0x50')](_0x1052d1[_0x00d7('0x51')]);_0x3d6322[_0x00d7('0x52')]=_['intersection'](_0x3d6322['model'],_0x3d6322[_0x00d7('0x51')]);_0x21da92[_0x00d7('0x53')]=_[_0x00d7('0x54')](_0x3d6322['model'],qs[_0x00d7('0x55')](_0x1052d1[_0x00d7('0x51')]['fields']));_0x21da92[_0x00d7('0x53')]=_0x21da92['attributes']['length']?_0x21da92[_0x00d7('0x53')]:_0x3d6322[_0x00d7('0x4f')];if(!_0x1052d1[_0x00d7('0x51')][_0x00d7('0x56')]('nolimit')){_0x21da92['limit']=qs['limit'](_0x1052d1[_0x00d7('0x51')][_0x00d7('0x22')]);_0x21da92['offset']=qs['offset'](_0x1052d1[_0x00d7('0x51')][_0x00d7('0x24')]);}_0x21da92[_0x00d7('0x57')]=qs[_0x00d7('0x58')](_0x1052d1[_0x00d7('0x51')][_0x00d7('0x58')]);_0x21da92[_0x00d7('0x59')]=qs[_0x00d7('0x52')](_['pick'](_0x1052d1[_0x00d7('0x51')],_0x3d6322['filters']),_0x1ed72f);if(_0x1052d1[_0x00d7('0x51')][_0x00d7('0x5a')]){_0x21da92[_0x00d7('0x59')]=_[_0x00d7('0x5b')](_0x21da92[_0x00d7('0x59')],{'$or':_[_0x00d7('0x49')](_0x1ed72f,function(_0x445e58){if(_0x445e58[_0x00d7('0x4d')]!==_0x00d7('0x5c')){var _0x3e6af2={};_0x3e6af2[_0x445e58[_0x00d7('0x2b')]]={'$like':'%'+_0x1052d1[_0x00d7('0x51')][_0x00d7('0x5a')]+'%'};return _0x3e6af2;}})});}_0x21da92=_[_0x00d7('0x5b')]({},_0x21da92,_0x1052d1[_0x00d7('0x5d')]);var _0x2ea797={'where':_0x21da92[_0x00d7('0x59')]};return db[_0x00d7('0x4a')]['count'](_0x2ea797)[_0x00d7('0x27')](function(_0x89d431){_0xfde668[_0x00d7('0x23')]=_0x89d431;if(_0x1052d1[_0x00d7('0x51')][_0x00d7('0x5e')]){_0x21da92[_0x00d7('0x5f')]=[{'all':!![]}];}return db['MailAccount'][_0x00d7('0x60')](_0x21da92);})[_0x00d7('0x27')](function(_0x452547){_0xfde668[_0x00d7('0x61')]=_0x452547;return _0xfde668;})[_0x00d7('0x27')](respondWithFilteredResult(_0x55b485,_0x21da92))[_0x00d7('0x1c')](handleError(_0x55b485,null));};exports[_0x00d7('0x62')]=function(_0x1e9084,_0x3fdf79){var _0x948988={'raw':![],'where':{'id':_0x1e9084[_0x00d7('0x63')]['id']},'include':[{'model':db[_0x00d7('0x44')],'as':_0x00d7('0x42')},{'model':db[_0x00d7('0x45')],'as':'Smtp'},{'model':db[_0x00d7('0x47')],'as':_0x00d7('0x48')}]},_0x4ee098={};_0x4ee098['model']=_[_0x00d7('0x50')](db[_0x00d7('0x4a')][_0x00d7('0x4b')]);_0x4ee098[_0x00d7('0x51')]=_[_0x00d7('0x50')](_0x1e9084[_0x00d7('0x51')]);_0x4ee098[_0x00d7('0x52')]=_[_0x00d7('0x54')](_0x4ee098['model'],_0x4ee098[_0x00d7('0x51')]);_0x948988[_0x00d7('0x53')]=_[_0x00d7('0x54')](_0x4ee098[_0x00d7('0x4f')],qs[_0x00d7('0x55')](_0x1e9084[_0x00d7('0x51')][_0x00d7('0x55')]));_0x948988[_0x00d7('0x53')]=_0x948988[_0x00d7('0x53')][_0x00d7('0x64')]?_0x948988[_0x00d7('0x53')]:_0x4ee098[_0x00d7('0x4f')];if(_0x1e9084[_0x00d7('0x51')]['includeAll']){_0x948988[_0x00d7('0x5f')]=[{'all':!![]}];}_0x948988=_[_0x00d7('0x5b')]({},_0x948988,_0x1e9084[_0x00d7('0x5d')]);return db[_0x00d7('0x4a')][_0x00d7('0x65')](_0x948988)[_0x00d7('0x27')](handleEntityNotFound(_0x3fdf79,null))[_0x00d7('0x27')](respondWithResult(_0x3fdf79,null))[_0x00d7('0x1c')](handleError(_0x3fdf79,null));};exports[_0x00d7('0x26')]=function(_0x1b387e,_0xa9c71){if(_0x1b387e[_0x00d7('0x66')]['id']){delete _0x1b387e[_0x00d7('0x66')]['id'];}var _0xc73a36=_0x1b387e[_0x00d7('0x66')][_0x00d7('0x67')]===_0x00d7('0x68')?null:_0x1b387e[_0x00d7('0x66')]['provider'];var _0x5b5b0c=_0x1b387e[_0x00d7('0x66')][_0x00d7('0x42')]||{};var _0x446ee1=_0x1b387e['body']['Smtp']||{};if(_0xc73a36){_0x5b5b0c[_0x00d7('0x41')]=getImapHost(_0xc73a36);_0x5b5b0c[_0x00d7('0x3d')]=0x3e1;_0x446ee1['host']=getSmtpHost(_0xc73a36);_0x446ee1['port']=0x24b;_0x446ee1[_0x00d7('0x3e')]=![];}if(_0x446ee1[_0x00d7('0x3b')]){_0x446ee1[_0x00d7('0x3e')]=![];}else{_0x446ee1[_0x00d7('0x3c')]=null;}if(!_0x5b5b0c[_0x00d7('0x3b')])_0x5b5b0c['CloudProviderId']=null;_0x1b387e[_0x00d7('0x66')][_0x00d7('0x42')]=_0x5b5b0c;_0x1b387e['body'][_0x00d7('0x46')]=_0x446ee1;return db[_0x00d7('0x4a')][_0x00d7('0x65')]({'where':{'id':_0x1b387e[_0x00d7('0x63')]['id']},'include':[{'model':db[_0x00d7('0x44')],'as':'Imap'},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0x00d7('0x47')],'as':_0x00d7('0x48')}]})[_0x00d7('0x27')](handleEntityNotFound(_0xa9c71,null))[_0x00d7('0x27')](function(_0x2d8db5){if(!_0x2d8db5)throw new Error(_0x00d7('0x69'));if(_0x2d8db5[_0x00d7('0x3f')])delete _0x1b387e[_0x00d7('0x66')]['Imap'];return _0x2d8db5;})['then'](saveUpdates(_0x1b387e['body'],null))[_0x00d7('0x27')](function(_0x76ec42){if(!_0x1b387e['body']['Imap'])return _0x76ec42;return db['MailServerIn'][_0x00d7('0x26')](_0x1b387e['body']['Imap'],{'where':{'MailAccountId':_0x76ec42['id']}})['then'](function(){return _0x76ec42;});})[_0x00d7('0x27')](function(_0x125a8a){if(!_0x1b387e['body'][_0x00d7('0x46')])return _0x125a8a;return db['MailServerOut'][_0x00d7('0x26')](_0x1b387e[_0x00d7('0x66')][_0x00d7('0x46')],{'where':{'MailAccountId':_0x125a8a['id']}})[_0x00d7('0x27')](function(){return _0x125a8a;});})['then'](respondWithResult(_0xa9c71,null))[_0x00d7('0x1c')](handleError(_0xa9c71,null));};exports[_0x00d7('0x6a')]=function(_0x162d8f,_0x28f633){return db[_0x00d7('0x4a')][_0x00d7('0x6a')]()['then'](respondWithResult(_0x28f633,null))[_0x00d7('0x1c')](handleError(_0x28f633,null));};exports[_0x00d7('0x6b')]=function(_0x41c07c,_0x5a3e19){if(_0x41c07c['body']['id']){delete _0x41c07c[_0x00d7('0x66')]['id'];}return db['MailAccount'][_0x00d7('0x65')]({'where':{'id':_0x41c07c[_0x00d7('0x63')]['id']}})[_0x00d7('0x27')](handleEntityNotFound(_0x5a3e19,null))[_0x00d7('0x27')](function(_0x92e166){if(_0x92e166){_0x41c07c['body'][_0x00d7('0x6c')]=_0x92e166['id'];return db[_0x00d7('0x6d')][_0x00d7('0x6e')](_0x41c07c[_0x00d7('0x66')]);}})['then'](respondWithResult(_0x5a3e19,null))[_0x00d7('0x1c')](handleError(_0x5a3e19,null));};exports[_0x00d7('0x6f')]=function(_0x36fcc5,_0x3ae6b9){var _0x2213af={'raw':![],'where':{}};var _0x48086e={};var _0x181dbe={'count':0x0,'rows':[]};return db[_0x00d7('0x4a')][_0x00d7('0x70')]({'where':{'id':_0x36fcc5[_0x00d7('0x63')]['id']}})[_0x00d7('0x27')](handleEntityNotFound(_0x3ae6b9,null))[_0x00d7('0x27')](function(_0x214202){if(_0x214202){_0x48086e[_0x00d7('0x4f')]=_[_0x00d7('0x50')](db[_0x00d7('0x6d')]['rawAttributes']);_0x48086e[_0x00d7('0x51')]=_[_0x00d7('0x50')](_0x36fcc5['query']);_0x48086e['filters']=_[_0x00d7('0x54')](_0x48086e[_0x00d7('0x4f')],_0x48086e[_0x00d7('0x51')]);_0x2213af['attributes']=_['intersection'](_0x48086e[_0x00d7('0x4f')],qs[_0x00d7('0x55')](_0x36fcc5['query'][_0x00d7('0x55')]));_0x2213af[_0x00d7('0x53')]=_0x2213af['attributes']['length']?_0x2213af['attributes']:_0x48086e['model'];if(!_0x36fcc5['query']['hasOwnProperty']('nolimit')){_0x2213af[_0x00d7('0x22')]=qs[_0x00d7('0x22')](_0x36fcc5['query'][_0x00d7('0x22')]);_0x2213af[_0x00d7('0x24')]=qs['offset'](_0x36fcc5[_0x00d7('0x51')][_0x00d7('0x24')]);}_0x2213af[_0x00d7('0x57')]=qs[_0x00d7('0x58')](_0x36fcc5['query'][_0x00d7('0x58')]);_0x2213af[_0x00d7('0x59')]=qs['filters'](_[_0x00d7('0x71')](_0x36fcc5[_0x00d7('0x51')],_0x48086e[_0x00d7('0x52')]));_0x2213af['where'][_0x00d7('0x6c')]=_0x214202['id'];if(_0x36fcc5[_0x00d7('0x51')][_0x00d7('0x5a')]){_0x2213af[_0x00d7('0x59')]=_[_0x00d7('0x5b')](_0x2213af[_0x00d7('0x59')],{'$or':_['map'](_0x2213af[_0x00d7('0x53')],function(_0x177726){var _0x4f1041={};_0x4f1041[_0x177726]={'$like':'%'+_0x36fcc5[_0x00d7('0x51')][_0x00d7('0x5a')]+'%'};return _0x4f1041;})});}_0x2213af=_[_0x00d7('0x5b')]({},_0x2213af,_0x36fcc5[_0x00d7('0x5d')]);return db[_0x00d7('0x6d')][_0x00d7('0x23')]({'where':_0x2213af[_0x00d7('0x59')]})['then'](function(_0x231b3b){_0x181dbe['count']=_0x231b3b;if(_0x36fcc5[_0x00d7('0x51')]['includeAll']){_0x2213af['include']=[{'all':!![]}];}return db['Disposition'][_0x00d7('0x60')](_0x2213af);})[_0x00d7('0x27')](function(_0x47746a){_0x181dbe[_0x00d7('0x61')]=_0x47746a;return _0x181dbe;});}})[_0x00d7('0x27')](respondWithFilteredResult(_0x3ae6b9,_0x2213af))['catch'](handleError(_0x3ae6b9,null));};exports[_0x00d7('0x72')]=function(_0x2be64d,_0x2bb5be){return db[_0x00d7('0x4a')]['find']({'where':{'id':_0x2be64d[_0x00d7('0x63')]['id']}})[_0x00d7('0x27')](handleEntityNotFound(_0x2bb5be,null))['then'](function(_0x4e8ea6){if(_0x4e8ea6){return _0x4e8ea6['removeDispositions'](_0x2be64d[_0x00d7('0x51')][_0x00d7('0x73')]);}})['then'](respondWithStatusCode(_0x2bb5be,null))['catch'](handleError(_0x2bb5be,null));};exports[_0x00d7('0x74')]=function(_0x45bb6d,_0x351446){if(_0x45bb6d[_0x00d7('0x66')]['id']){delete _0x45bb6d['body']['id'];}return db[_0x00d7('0x4a')][_0x00d7('0x65')]({'where':{'id':_0x45bb6d[_0x00d7('0x63')]['id']}})['then'](handleEntityNotFound(_0x351446,null))[_0x00d7('0x27')](function(_0x544442){if(_0x544442){_0x45bb6d[_0x00d7('0x66')]['MailAccountId']=_0x544442['id'];return db[_0x00d7('0x75')][_0x00d7('0x6e')](_0x45bb6d[_0x00d7('0x66')]);}})[_0x00d7('0x27')](respondWithResult(_0x351446,null))[_0x00d7('0x1c')](handleError(_0x351446,null));};exports['getAnswers']=function(_0x2df2ec,_0x5c7d1b){var _0x36eeed={'raw':![],'where':{}};var _0x1b0d65={};var _0x142c6a={'count':0x0,'rows':[]};return db['MailAccount'][_0x00d7('0x70')]({'where':{'id':_0x2df2ec[_0x00d7('0x63')]['id']}})[_0x00d7('0x27')](handleEntityNotFound(_0x5c7d1b,null))[_0x00d7('0x27')](function(_0x1488b2){if(_0x1488b2){_0x1b0d65['model']=_[_0x00d7('0x50')](db[_0x00d7('0x75')][_0x00d7('0x4b')]);_0x1b0d65['query']=_[_0x00d7('0x50')](_0x2df2ec['query']);_0x1b0d65['filters']=_[_0x00d7('0x54')](_0x1b0d65[_0x00d7('0x4f')],_0x1b0d65[_0x00d7('0x51')]);_0x36eeed[_0x00d7('0x53')]=_[_0x00d7('0x54')](_0x1b0d65[_0x00d7('0x4f')],qs[_0x00d7('0x55')](_0x2df2ec['query'][_0x00d7('0x55')]));_0x36eeed['attributes']=_0x36eeed[_0x00d7('0x53')][_0x00d7('0x64')]?_0x36eeed[_0x00d7('0x53')]:_0x1b0d65[_0x00d7('0x4f')];if(!_0x2df2ec['query'][_0x00d7('0x56')](_0x00d7('0x76'))){_0x36eeed[_0x00d7('0x22')]=qs[_0x00d7('0x22')](_0x2df2ec[_0x00d7('0x51')][_0x00d7('0x22')]);_0x36eeed[_0x00d7('0x24')]=qs[_0x00d7('0x24')](_0x2df2ec['query'][_0x00d7('0x24')]);}_0x36eeed[_0x00d7('0x57')]=qs[_0x00d7('0x58')](_0x2df2ec[_0x00d7('0x51')]['sort']);_0x36eeed['where']=qs[_0x00d7('0x52')](_['pick'](_0x2df2ec[_0x00d7('0x51')],_0x1b0d65['filters']));_0x36eeed[_0x00d7('0x59')]['MailAccountId']=_0x1488b2['id'];if(_0x2df2ec[_0x00d7('0x51')][_0x00d7('0x5a')]){_0x36eeed[_0x00d7('0x59')]=_[_0x00d7('0x5b')](_0x36eeed[_0x00d7('0x59')],{'$or':_[_0x00d7('0x49')](_0x36eeed[_0x00d7('0x53')],function(_0x5ef7b7){var _0x4bde53={};_0x4bde53[_0x5ef7b7]={'$like':'%'+_0x2df2ec[_0x00d7('0x51')]['filter']+'%'};return _0x4bde53;})});}_0x36eeed=_[_0x00d7('0x5b')]({},_0x36eeed,_0x2df2ec[_0x00d7('0x5d')]);return db['CannedAnswer']['count']({'where':_0x36eeed[_0x00d7('0x59')]})[_0x00d7('0x27')](function(_0x10d919){_0x142c6a[_0x00d7('0x23')]=_0x10d919;if(_0x2df2ec[_0x00d7('0x51')][_0x00d7('0x5e')]){_0x36eeed['include']=[{'all':!![]}];}return db[_0x00d7('0x75')]['findAll'](_0x36eeed);})[_0x00d7('0x27')](function(_0x39b3cd){_0x142c6a['rows']=_0x39b3cd;return _0x142c6a;});}})[_0x00d7('0x27')](respondWithFilteredResult(_0x5c7d1b,_0x36eeed))['catch'](handleError(_0x5c7d1b,null));};exports[_0x00d7('0x77')]=function(_0x396155,_0x17d325){return db[_0x00d7('0x4a')]['find']({'where':{'id':_0x396155[_0x00d7('0x63')]['id']}})['then'](handleEntityNotFound(_0x17d325,null))['then'](function(_0x5d4215){if(_0x5d4215){return _0x5d4215[_0x00d7('0x77')](_0x396155[_0x00d7('0x51')][_0x00d7('0x73')]);}})['then'](respondWithStatusCode(_0x17d325,null))[_0x00d7('0x1c')](handleError(_0x17d325,null));};exports[_0x00d7('0x6e')]=function(_0x553dab,_0x50f911){var _0x11be3d={'name':_0x553dab[_0x00d7('0x66')]['name'],'key':_0x553dab[_0x00d7('0x66')][_0x00d7('0x4e')],'provider':_0x553dab['body'][_0x00d7('0x67')]==='custom'?null:_0x553dab[_0x00d7('0x66')][_0x00d7('0x67')],'email':_0x553dab[_0x00d7('0x66')][_0x00d7('0x78')],'ListId':_0x553dab[_0x00d7('0x66')][_0x00d7('0x79')],'active':!_['isNil'](_0x553dab[_0x00d7('0x66')]['active'])?_0x553dab[_0x00d7('0x66')][_0x00d7('0x7a')]:!![],'description':_0x553dab['body'][_0x00d7('0x7b')]||null};var _0x48f444=getAuthenticationOptions(_0x11be3d[_0x00d7('0x67')],_0x553dab['body']);_0x11be3d[_0x00d7('0x42')]=_0x48f444[_0x00d7('0x42')];_0x11be3d[_0x00d7('0x46')]=_0x48f444[_0x00d7('0x46')];return db['MailAccount'][_0x00d7('0x6e')](_0x11be3d,{'include':[{'model':db[_0x00d7('0x45')],'as':_0x00d7('0x46')},{'model':db[_0x00d7('0x44')],'as':_0x00d7('0x42')}]})[_0x00d7('0x27')](function(_0x2cab70){var _0xd8545d=_0x553dab[_0x00d7('0x37')][_0x00d7('0x7c')]({'plain':!![]});if(!_0xd8545d)throw new Error(_0x00d7('0x7d'));if(_0xd8545d[_0x00d7('0x7e')]===_0x00d7('0x37')){var _0x4761cf=_0x2cab70['get']({'plain':!![]});return db[_0x00d7('0x7f')][_0x00d7('0x65')]({'where':{'name':_0x00d7('0x28'),'userProfileId':_0xd8545d[_0x00d7('0x80')]},'raw':!![]})[_0x00d7('0x27')](function(_0x1ddb31){if(_0x1ddb31&&_0x1ddb31[_0x00d7('0x81')]===0x0){return db[_0x00d7('0x82')][_0x00d7('0x6e')]({'name':_0x4761cf[_0x00d7('0x2b')],'resourceId':_0x4761cf['id'],'type':_0x1ddb31[_0x00d7('0x2b')],'sectionId':_0x1ddb31['id']},{})[_0x00d7('0x27')](function(){return _0x2cab70;});}else{return _0x2cab70;}})[_0x00d7('0x1c')](function(_0x15b8c9){logger[_0x00d7('0x16')](_0x00d7('0x83'),_0x15b8c9);throw _0x15b8c9;});}return _0x2cab70;})[_0x00d7('0x27')](respondWithResult(_0x50f911,0xc9))[_0x00d7('0x1c')](handleError(_0x50f911,null));};exports[_0x00d7('0x84')]=function(_0x24e691,_0x5f3323){return db['MailAccount']['findOne']({'where':{'id':_0x24e691[_0x00d7('0x63')]['id']}})[_0x00d7('0x27')](handleEntityNotFound(_0x5f3323,null))[_0x00d7('0x27')](function(_0x5e4534){if(_0x5e4534){return _0x5e4534[_0x00d7('0x84')]();}return null;})[_0x00d7('0x27')](respondWithResult(_0x5f3323,null))['catch'](handleError(_0x5f3323,null));};exports[_0x00d7('0x85')]=function(_0x5311bc,_0xaf5f17){if(_0x5311bc[_0x00d7('0x66')]['id']){delete _0x5311bc['body']['id'];}return db[_0x00d7('0x4a')][_0x00d7('0x65')]({'where':{'id':_0x5311bc[_0x00d7('0x63')]['id']}})[_0x00d7('0x27')](handleEntityNotFound(_0xaf5f17,null))[_0x00d7('0x27')](function(_0x1524ff){if(_0x1524ff){_0x5311bc['body']['MailAccountId']=_0x1524ff['id'];return db[_0x00d7('0x44')][_0x00d7('0x6e')](_0x5311bc[_0x00d7('0x66')]);}})[_0x00d7('0x27')](respondWithResult(_0xaf5f17,null))[_0x00d7('0x1c')](handleError(_0xaf5f17,null));};exports[_0x00d7('0x86')]=function(_0x188e49,_0xeb5389){return db[_0x00d7('0x4a')]['findOne']({'where':{'id':_0x188e49[_0x00d7('0x63')]['id']}})[_0x00d7('0x27')](handleEntityNotFound(_0xeb5389,null))[_0x00d7('0x27')](function(_0x261678){if(_0x261678){return _0x261678[_0x00d7('0x87')](null);}return null;})[_0x00d7('0x27')](respondWithStatusCode(_0xeb5389,null))[_0x00d7('0x1c')](handleError(_0xeb5389,null));};exports[_0x00d7('0x88')]=function(_0x1aafc4,_0x5ce400){return db[_0x00d7('0x4a')][_0x00d7('0x70')]({'where':{'id':_0x1aafc4['params']['id']}})[_0x00d7('0x27')](handleEntityNotFound(_0x5ce400,null))[_0x00d7('0x27')](function(_0x1a48a9){if(_0x1a48a9){return _0x1a48a9[_0x00d7('0x88')]();}return null;})[_0x00d7('0x27')](respondWithResult(_0x5ce400,null))[_0x00d7('0x1c')](handleError(_0x5ce400,null));};exports[_0x00d7('0x89')]=function(_0x742860,_0x8aa285){if(_0x742860[_0x00d7('0x66')]['id']){delete _0x742860[_0x00d7('0x66')]['id'];}return db['MailAccount'][_0x00d7('0x65')]({'where':{'id':_0x742860['params']['id']}})[_0x00d7('0x27')](handleEntityNotFound(_0x8aa285,null))[_0x00d7('0x27')](function(_0x48a4e5){if(_0x48a4e5){_0x742860[_0x00d7('0x66')][_0x00d7('0x6c')]=_0x48a4e5['id'];return db['MailServerOut']['create'](_0x742860[_0x00d7('0x66')]);}})[_0x00d7('0x27')](respondWithResult(_0x8aa285,null))[_0x00d7('0x1c')](handleError(_0x8aa285,null));};exports[_0x00d7('0x8a')]=function(_0x13bf54,_0xa464fe){return db['MailAccount'][_0x00d7('0x70')]({'where':{'id':_0x13bf54[_0x00d7('0x63')]['id']}})[_0x00d7('0x27')](handleEntityNotFound(_0xa464fe,null))[_0x00d7('0x27')](function(_0x3a45ec){if(_0x3a45ec){return _0x3a45ec[_0x00d7('0x8b')](null);}return null;})[_0x00d7('0x27')](respondWithStatusCode(_0xa464fe,null))[_0x00d7('0x1c')](handleError(_0xa464fe,null));};exports[_0x00d7('0x8c')]=function(_0x1a5be6,_0x58f15f){return db[_0x00d7('0x8d')][_0x00d7('0x65')]({'where':{'id':_0x1a5be6[_0x00d7('0x63')]['id']}})[_0x00d7('0x27')](handleEntityNotFound(_0x58f15f,null))[_0x00d7('0x27')](function(_0x2a98bf){if(_0x2a98bf){return _0x2a98bf[_0x00d7('0x8c')](_0x1a5be6[_0x00d7('0x66')][_0x00d7('0x73')],_[_0x00d7('0x8e')](_0x1a5be6[_0x00d7('0x66')],[_0x00d7('0x73'),'id'])||{});}})[_0x00d7('0x27')](respondWithResult(_0x58f15f,null))[_0x00d7('0x1c')](handleError(_0x58f15f,null));};exports[_0x00d7('0x8f')]=function(_0x30aa0a,_0x3696d7){var _0x4bc868={'raw':![],'where':{}};var _0x2bd10a={};var _0x1ebf89={'count':0x0,'rows':[]};return db[_0x00d7('0x4a')][_0x00d7('0x70')]({'where':{'id':_0x30aa0a[_0x00d7('0x63')]['id']}})[_0x00d7('0x27')](handleEntityNotFound(_0x3696d7,null))['then'](function(_0x3960a1){if(_0x3960a1){_0x2bd10a[_0x00d7('0x4f')]=_['keys'](db[_0x00d7('0x8d')][_0x00d7('0x4b')]);_0x2bd10a[_0x00d7('0x51')]=_['keys'](_0x30aa0a['query']);_0x2bd10a['filters']=_[_0x00d7('0x54')](_0x2bd10a[_0x00d7('0x4f')],_0x2bd10a['query']);_0x4bc868[_0x00d7('0x53')]=_['intersection'](_0x2bd10a[_0x00d7('0x4f')],qs['fields'](_0x30aa0a[_0x00d7('0x51')][_0x00d7('0x55')]));_0x4bc868[_0x00d7('0x53')]=_0x4bc868[_0x00d7('0x53')][_0x00d7('0x64')]?_0x4bc868['attributes']:_0x2bd10a[_0x00d7('0x4f')];if(!_0x30aa0a[_0x00d7('0x51')][_0x00d7('0x56')](_0x00d7('0x76'))){_0x4bc868[_0x00d7('0x22')]=qs[_0x00d7('0x22')](_0x30aa0a[_0x00d7('0x51')]['limit']);_0x4bc868[_0x00d7('0x24')]=qs[_0x00d7('0x24')](_0x30aa0a['query'][_0x00d7('0x24')]);}_0x4bc868['order']=qs[_0x00d7('0x58')](_0x30aa0a[_0x00d7('0x51')]['sort']);_0x4bc868[_0x00d7('0x59')]=qs[_0x00d7('0x52')](_['pick'](_0x30aa0a[_0x00d7('0x51')],_0x2bd10a[_0x00d7('0x52')]));_0x4bc868[_0x00d7('0x59')][_0x00d7('0x6c')]=_0x3960a1['id'];if(_0x30aa0a[_0x00d7('0x51')][_0x00d7('0x5a')]){_0x4bc868[_0x00d7('0x59')]=_[_0x00d7('0x5b')](_0x4bc868[_0x00d7('0x59')],{'$or':_[_0x00d7('0x49')](_0x4bc868['attributes'],function(_0x5bafa5){var _0x40daf4={};_0x40daf4[_0x5bafa5]={'$like':'%'+_0x30aa0a['query'][_0x00d7('0x5a')]+'%'};return _0x40daf4;})});}_0x4bc868=_[_0x00d7('0x5b')]({},_0x4bc868,_0x30aa0a['options']);return db[_0x00d7('0x8d')][_0x00d7('0x23')]({'where':_0x4bc868[_0x00d7('0x59')]})[_0x00d7('0x27')](function(_0x3bedee){_0x1ebf89[_0x00d7('0x23')]=_0x3bedee;if(_0x30aa0a['query'][_0x00d7('0x5e')]){_0x4bc868[_0x00d7('0x5f')]=[{'model':db[_0x00d7('0x90')],'as':'Contact','required':![]},{'model':db['User'],'as':_0x00d7('0x91'),'attributes':[_0x00d7('0x2b'),_0x00d7('0x92'),'internal'],'required':![]},{'model':db[_0x00d7('0x93')],'as':_0x00d7('0x94'),'attributes':['id',_0x00d7('0x2b'),'color'],'where':_0x30aa0a['query'][_0x00d7('0x95')]?{'id':_0x30aa0a['query']['tag']}:undefined,'required':_0x30aa0a[_0x00d7('0x51')][_0x00d7('0x95')]?!![]:![]}];}return db[_0x00d7('0x8d')]['findAll'](_0x4bc868);})[_0x00d7('0x27')](function(_0xbdf321){_0x1ebf89[_0x00d7('0x61')]=_0xbdf321;return _0x1ebf89;});}})[_0x00d7('0x27')](respondWithFilteredResult(_0x3696d7,_0x4bc868))['catch'](handleError(_0x3696d7,null));};exports['addApplications']=function addApplications(_0xba5569,_0x4e9ac5){var _0x5b199c=_0xba5569[_0x00d7('0x63')]['id'];var _0x5662ff=_0xba5569['body'];var _0x3ff53f=0xc8;var _0x3777fb=null;return db[_0x00d7('0x96')]['transaction']({'isolationLevel':db['sequelize'][_0x00d7('0x97')][_0x00d7('0x98')][_0x00d7('0x99')]},function(_0x3ff612){return db[_0x00d7('0x4a')]['findOne']({'where':{'id':_0x5b199c},'transaction':_0x3ff612})['then'](function(_0x154221){if(_0x154221){return db[_0x00d7('0x9a')][_0x00d7('0x29')]({'where':{'MailAccountId':_0x5b199c},'transaction':_0x3ff612})[_0x00d7('0x27')](function(){var _0x3c749e=_[_0x00d7('0x49')](_0x5662ff,function(_0x44d0fb){_0x44d0fb['MailAccountId']=_0x5b199c;return _0x44d0fb;});return db['MailApplication'][_0x00d7('0x9b')](_0x3c749e,{'transaction':_0x3ff612});});}else{_0x3ff53f=0x194;_0x3777fb=[];}});})[_0x00d7('0x27')](function(){if(_0x3ff53f!==0x194){return db['MailApplication'][_0x00d7('0x9c')]({'where':{'MailAccountId':_0x5b199c},'order':_0x00d7('0x9d')})['then'](function(_0x2d2a87){_0x3777fb=_0x2d2a87;});}})[_0x00d7('0x1c')](function(_0x3899ec){_0x3ff53f=0x1f4;logger[_0x00d7('0x16')](_0x3899ec[_0x00d7('0x2a')]);if(_0x3899ec['name']){delete _0x3899ec[_0x00d7('0x2b')];}_0x3777fb=_0x3899ec;})[_0x00d7('0x9e')](function(){if(_0x3777fb===null){_0x4e9ac5['sendStatus'](_0x3ff53f);}else{if(_0x3ff53f===0x1f4){_0x4e9ac5[_0x00d7('0x1e')](_0x3ff53f)[_0x00d7('0x9f')](_0x3777fb);}else{_0x4e9ac5['status'](_0x3ff53f)[_0x00d7('0x20')](_0x3777fb);}}});};exports['getApplications']=function(_0x21ecfd,_0x53dc62){var _0xd3f681={};var _0x236275={};var _0x210cf4;var _0x4d75b8;return db[_0x00d7('0x4a')]['findOne']({'where':{'id':_0x21ecfd[_0x00d7('0x63')]['id']}})[_0x00d7('0x27')](handleEntityNotFound(_0x53dc62,null))['then'](function(_0x26ba89){if(_0x26ba89){_0x210cf4=_0x26ba89;_0x236275[_0x00d7('0x4f')]=_[_0x00d7('0x50')](db[_0x00d7('0x9a')][_0x00d7('0x4b')]);_0x236275[_0x00d7('0x51')]=_['keys'](_0x21ecfd['query']);_0x236275[_0x00d7('0x52')]=_[_0x00d7('0x54')](_0x236275[_0x00d7('0x4f')],_0x236275[_0x00d7('0x51')]);_0xd3f681[_0x00d7('0x53')]=_[_0x00d7('0x54')](_0x236275[_0x00d7('0x4f')],qs[_0x00d7('0x55')](_0x21ecfd['query'][_0x00d7('0x55')]));_0xd3f681[_0x00d7('0x53')]=_0xd3f681['attributes'][_0x00d7('0x64')]?_0xd3f681[_0x00d7('0x53')]:_0x236275[_0x00d7('0x4f')];_0xd3f681[_0x00d7('0x57')]=qs[_0x00d7('0x58')](_0x21ecfd['query']['sort']);_0xd3f681[_0x00d7('0x59')]=qs[_0x00d7('0x52')](_[_0x00d7('0x71')](_0x21ecfd['query'],_0x236275[_0x00d7('0x52')]));if(_0x21ecfd[_0x00d7('0x51')]['filter']){_0xd3f681[_0x00d7('0x59')]=_[_0x00d7('0x5b')](_0xd3f681['where'],{'$or':_['map'](_0xd3f681[_0x00d7('0x53')],function(_0x58c7b2){var _0x139c4f={};_0x139c4f[_0x58c7b2]={'$like':'%'+_0x21ecfd[_0x00d7('0x51')]['filter']+'%'};return _0x139c4f;})});}_0xd3f681=_[_0x00d7('0x5b')]({},_0xd3f681,_0x21ecfd[_0x00d7('0x5d')]);return _0x210cf4[_0x00d7('0xa0')](_0xd3f681);}})['then'](function(_0x5a82b9){if(_0x5a82b9){_0x4d75b8=_0x5a82b9[_0x00d7('0x64')];if(!_0x21ecfd['query'][_0x00d7('0x56')]('nolimit')){_0xd3f681[_0x00d7('0x22')]=qs['limit'](_0x21ecfd['query'][_0x00d7('0x22')]);_0xd3f681[_0x00d7('0x24')]=qs[_0x00d7('0x24')](_0x21ecfd[_0x00d7('0x51')][_0x00d7('0x24')]);}return _0x210cf4[_0x00d7('0xa0')](_0xd3f681);}})['then'](function(_0x31a285){if(_0x31a285){return _0x31a285?{'count':_0x4d75b8,'rows':_0x31a285}:null;}})[_0x00d7('0x27')](respondWithResult(_0x53dc62,null))[_0x00d7('0x1c')](handleError(_0x53dc62,null));};exports[_0x00d7('0xa1')]=function(_0x282b9d,_0x314b7e){var _0x576396={'raw':!![],'where':{}};var _0x42da92={};var _0x25ef79={'count':0x0,'rows':[]};return db[_0x00d7('0x4a')][_0x00d7('0x70')]({'where':{'id':_0x282b9d['params']['id']}})['then'](handleEntityNotFound(_0x314b7e,null))['then'](function(_0x53fd71){if(_0x53fd71){_0x42da92[_0x00d7('0x4f')]=_['keys'](db[_0x00d7('0xa2')][_0x00d7('0x4b')]);_0x42da92['query']=_['keys'](_0x282b9d['query']);_0x42da92[_0x00d7('0x52')]=_['intersection'](_0x42da92[_0x00d7('0x4f')],_0x42da92[_0x00d7('0x51')]);_0x576396['attributes']=_[_0x00d7('0x54')](_0x42da92[_0x00d7('0x4f')],qs[_0x00d7('0x55')](_0x282b9d[_0x00d7('0x51')][_0x00d7('0x55')]));_0x576396['attributes']=_0x576396[_0x00d7('0x53')][_0x00d7('0x64')]?_0x576396['attributes']:_0x42da92[_0x00d7('0x4f')];if(!_0x282b9d[_0x00d7('0x51')][_0x00d7('0x56')](_0x00d7('0x76'))){_0x576396[_0x00d7('0x22')]=qs[_0x00d7('0x22')](_0x282b9d['query'][_0x00d7('0x22')]);_0x576396['offset']=qs[_0x00d7('0x24')](_0x282b9d['query'][_0x00d7('0x24')]);}_0x576396[_0x00d7('0x57')]=qs[_0x00d7('0x58')](_0x282b9d[_0x00d7('0x51')][_0x00d7('0x58')]);_0x576396['where']=qs[_0x00d7('0x52')](_[_0x00d7('0x71')](_0x282b9d[_0x00d7('0x51')],_0x42da92[_0x00d7('0x52')]));_0x576396[_0x00d7('0x59')][_0x00d7('0x6c')]=_0x53fd71['id'];if(_0x282b9d[_0x00d7('0x51')][_0x00d7('0x5a')]){_0x576396[_0x00d7('0x59')]=_[_0x00d7('0x5b')](_0x576396[_0x00d7('0x59')],{'$or':_[_0x00d7('0x49')](_0x576396[_0x00d7('0x53')],function(_0x59d656){var _0xc7aba1={};_0xc7aba1[_0x59d656]={'$like':'%'+_0x282b9d[_0x00d7('0x51')]['filter']+'%'};return _0xc7aba1;})});}if(_0x282b9d[_0x00d7('0x51')]['$gte']){var _0x2585e5=_0x282b9d[_0x00d7('0x51')][_0x00d7('0xa3')]['split'](',');var _0x29cbf2={};_0x29cbf2[_0x2585e5[0x0]]={'$gte':moment(_0x2585e5[0x1])[_0x00d7('0xa4')](_0x00d7('0xa5'))};_0x576396[_0x00d7('0x59')]=_[_0x00d7('0x5b')](_0x576396['where'],_0x29cbf2);}_0x576396=_[_0x00d7('0x5b')]({},_0x576396,_0x282b9d[_0x00d7('0x5d')]);return db['MailMessage'][_0x00d7('0x23')]({'where':_0x576396[_0x00d7('0x59')]})[_0x00d7('0x27')](function(_0x4c7f3e){_0x25ef79[_0x00d7('0x23')]=_0x4c7f3e;if(_0x282b9d[_0x00d7('0x51')]['includeAll']){_0x576396['include']=[{'all':!![]}];}return db[_0x00d7('0xa2')][_0x00d7('0x60')](_0x576396);})['then'](function(_0x278b94){if(_0x282b9d[_0x00d7('0x51')][_0x00d7('0xa6')]===_0x00d7('0xa7')){for(var _0x4e1ed1=0x0;_0x4e1ed1<_0x278b94[_0x00d7('0x64')];_0x4e1ed1++){_0x278b94[_0x4e1ed1][_0x00d7('0x66')]=juice(_0x278b94[_0x4e1ed1][_0x00d7('0x66')]);}}_0x25ef79['rows']=_0x278b94;return _0x25ef79;});}})[_0x00d7('0x27')](respondWithFilteredResult(_0x314b7e,_0x576396))['catch'](handleError(_0x314b7e,null));};exports[_0x00d7('0x9f')]=function(_0x262b27,_0xeb16f5){var _0x47113c,_0x30400a={},_0x12deba;if(_0x262b27[_0x00d7('0x66')]['to']){_0x12deba=_0x262b27[_0x00d7('0x66')]['to'][_0x00d7('0xa8')](',')[0x0];}return db[_0x00d7('0x4a')]['find']({'where':{'id':_0x262b27['params']['id']},'include':[{'model':db[_0x00d7('0xa9')],'as':_0x00d7('0xaa'),'include':[{'model':db[_0x00d7('0x90')],'as':_0x00d7('0xab'),'where':{'email':_0x12deba},'limit':0x1,'order':[[_0x00d7('0xac'),'DESC']]}]},{'model':db['MailServerOut'],'as':_0x00d7('0x46'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x00d7('0xad'),'raw':!![]}]}]})[_0x00d7('0x27')](handleEntityNotFound(_0xeb16f5,null))[_0x00d7('0x27')](function(_0x56e5eb){if(!_0x56e5eb)return;_0x47113c=_0x56e5eb;if(!_0x56e5eb[_0x00d7('0x46')])throw new Error('Smtp\x20configuration\x20not\x20found');if(_['isNil'](_0x262b27['body'][_0x00d7('0xae')])){_0x262b27[_0x00d7('0x66')][_0x00d7('0xae')]=util[_0x00d7('0xa4')]('%s\x20<%s>',_0x56e5eb['name'],_0x56e5eb[_0x00d7('0x78')]||_0x56e5eb['Smtp']['user']);}if(_0x262b27[_0x00d7('0x66')][_0x00d7('0xaf')]&&_0x262b27[_0x00d7('0x66')]['attachments'][_0x00d7('0x64')]){for(var _0x1f1247=0x0;_0x1f1247<_0x262b27[_0x00d7('0x66')][_0x00d7('0xaf')][_0x00d7('0x64')];_0x1f1247+=0x1){_0x262b27[_0x00d7('0x66')]['attachments'][_0x1f1247]={'filename':_0x262b27[_0x00d7('0x66')][_0x00d7('0xaf')][_0x1f1247][_0x00d7('0x2b')],'path':path[_0x00d7('0xb0')](config['root'],_0x00d7('0xb1'),_0x262b27[_0x00d7('0x66')][_0x00d7('0xaf')][_0x1f1247][_0x00d7('0xb2')])};}}var _0x5f2bab=_0x56e5eb[_0x00d7('0xb3')]();return respondWithRpcPromise('SendMail','sendMail',{'account':_0x5f2bab,'message':_0x262b27[_0x00d7('0x66')]});})[_0x00d7('0x27')](function(_0x471969){if(!_0x471969)return;_0x30400a=_0x471969;if(!_0x47113c['List'])throw new Error(_0x00d7('0xb4'));if(_0x47113c[_0x00d7('0xaa')][_0x00d7('0xab')][_0x00d7('0x64')])return _0x47113c['List'][_0x00d7('0xab')][0x0];return db['CmContact'][_0x00d7('0x6e')](_[_0x00d7('0xb')](_0x262b27['body'],{'firstName':_0x262b27['body']['to'],'email':_0x262b27[_0x00d7('0x66')]['to'],'phone':_0x262b27[_0x00d7('0x66')]['to'],'ListId':_0x47113c[_0x00d7('0x79')]}));})[_0x00d7('0x27')](function(_0x3c83ba){if(!_0x3c83ba)return;var _0x93b4a1={'UserId':_0x262b27['user']['id'],'ContactId':_0x3c83ba['id'],'MailAccountId':_0x47113c['id'],'inReplyTo':_0x30400a['messageId'],'to':_0x262b27[_0x00d7('0x66')]['from'],'cc':_0x262b27[_0x00d7('0x66')]['cc'],'subject':_0x262b27[_0x00d7('0x66')]['subject'],'attach':_0x262b27[_0x00d7('0x66')][_0x00d7('0xb5')],'firstMsgDirection':_0x00d7('0xb6'),'lastMsgAt':moment()[_0x00d7('0xa4')](_0x00d7('0xa5')),'lastMsgDirection':_0x00d7('0xb6'),'Messages':[_['merge'](_0x262b27[_0x00d7('0x66')],{'messageId':_0x30400a[_0x00d7('0xb7')],'sentAt':moment()['format'](_0x00d7('0xa5')),'read':!![],'MailAccountId':_0x47113c['id'],'UserId':_0x262b27[_0x00d7('0x37')]['id'],'ContactId':_0x3c83ba['id']})]};if(_0x262b27[_0x00d7('0x66')]['Interaction']){_0x93b4a1=_['merge'](_0x93b4a1,_0x262b27[_0x00d7('0x66')]['Interaction']);}return db['MailInteraction'][_0x00d7('0x6e')](_0x93b4a1,{'include':[{'model':db[_0x00d7('0xa2')],'as':_0x00d7('0xb8')}]});})[_0x00d7('0x27')](respondWithResult(_0xeb16f5,null))[_0x00d7('0x1c')](handleError(_0xeb16f5,null));};exports[_0x00d7('0xb9')]=function(_0x237645,_0x4a0ccb){return db[_0x00d7('0x4a')][_0x00d7('0x65')]({'where':{'id':_0x237645['params']['id']},'include':[{'model':db[_0x00d7('0x45')],'as':_0x00d7('0x46'),'raw':!![],'include':[{'model':db[_0x00d7('0xad')],'as':_0x00d7('0xad'),'raw':!![]}]}]})[_0x00d7('0x27')](handleEntityNotFound(_0x4a0ccb,null))[_0x00d7('0x27')](function(_0x302336){if(!_0x302336[_0x00d7('0x46')])return;var _0x204e36=_0x302336[_0x00d7('0xb3')]();return respondWithRpcPromise('VerifySmtp','verifySmtp',{'account':_0x204e36});})[_0x00d7('0x27')](respondWithResult(_0x4a0ccb,null))[_0x00d7('0x1c')](handleError(_0x4a0ccb,null));};exports[_0x00d7('0x29')]=function(_0x4b906f,_0x6133bf){return db['MailAccount'][_0x00d7('0x65')]({'where':{'id':_0x4b906f[_0x00d7('0x63')]['id']}})[_0x00d7('0x27')](handleEntityNotFound(_0x6133bf,null))[_0x00d7('0x27')](function(_0x2c83f5){if(_0x2c83f5&&_0x2c83f5[_0x00d7('0x3f')]){throw new db[(_0x00d7('0xba'))][(_0x00d7('0xbb'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x2c83f5;})[_0x00d7('0x27')](removeEntity(_0x6133bf,null))[_0x00d7('0x1c')](handleError(_0x6133bf,null));};exports[_0x00d7('0xbc')]=function(_0x48b677,_0x2a3ba5){return db['MailAccount'][_0x00d7('0x65')]({'where':{'id':_0x48b677[_0x00d7('0x63')]['id']}})[_0x00d7('0x27')](handleEntityNotFound(_0x2a3ba5,null))[_0x00d7('0x27')](function(_0x4ece7a){if(_0x4ece7a){return _0x4ece7a[_0x00d7('0xbc')](_0x48b677[_0x00d7('0x66')]['ids'],_[_0x00d7('0x8e')](_0x48b677[_0x00d7('0x66')],['ids','id'])||{})[_0x00d7('0xbd')](function(_0x33af11){for(var _0x1ca28d=0x0;_0x1ca28d<_0x48b677['body'][_0x00d7('0x73')]['length'];_0x1ca28d+=0x1){socket[_0x00d7('0xbe')](_0x00d7('0xbf'),{'UserId':Number(_0x48b677['body']['ids'][_0x1ca28d]),'MailAccountId':Number(_0x48b677[_0x00d7('0x63')]['id'])});}return _0x33af11;});}})[_0x00d7('0x27')](respondWithResult(_0x2a3ba5,null))['catch'](handleError(_0x2a3ba5,null));};exports[_0x00d7('0xc0')]=function(_0x33ccee,_0x3c9fcc){return db[_0x00d7('0x4a')][_0x00d7('0x65')]({'where':{'id':_0x33ccee[_0x00d7('0x63')]['id']}})['then'](handleEntityNotFound(_0x3c9fcc,null))[_0x00d7('0x27')](function(_0x2e3abc){if(_0x2e3abc){return _0x2e3abc['removeAgents'](_0x33ccee[_0x00d7('0x51')]['ids'])[_0x00d7('0x27')](function(){if(_[_0x00d7('0xc1')](_0x33ccee['query'][_0x00d7('0x73')])){for(var _0x7682fa=0x0;_0x7682fa<_0x33ccee[_0x00d7('0x51')][_0x00d7('0x73')]['length'];_0x7682fa+=0x1){socket[_0x00d7('0xbe')](_0x00d7('0xc2'),{'UserId':Number(_0x33ccee['query'][_0x00d7('0x73')][_0x7682fa]),'MailAccountId':Number(_0x33ccee['params']['id'])});}}else{socket[_0x00d7('0xbe')](_0x00d7('0xc2'),{'UserId':Number(_0x33ccee[_0x00d7('0x51')][_0x00d7('0x73')]),'MailAccountId':Number(_0x33ccee[_0x00d7('0x63')]['id'])});}});}})[_0x00d7('0x27')](respondWithStatusCode(_0x3c9fcc,null))[_0x00d7('0x1c')](handleError(_0x3c9fcc,null));};exports[_0x00d7('0xc3')]=function(_0x83ec78,_0x4ac930){var _0x2b3e02={};var _0x44ee53={};var _0x370f2a;var _0x584d13;return db[_0x00d7('0x4a')][_0x00d7('0x70')]({'where':{'id':_0x83ec78[_0x00d7('0x63')]['id']}})['then'](handleEntityNotFound(_0x4ac930,null))[_0x00d7('0x27')](function(_0x517cec){if(_0x517cec){_0x370f2a=_0x517cec;_0x44ee53[_0x00d7('0x4f')]=_['keys'](db['User'][_0x00d7('0x4b')]);_0x44ee53[_0x00d7('0x51')]=_[_0x00d7('0x50')](_0x83ec78['query']);_0x44ee53[_0x00d7('0x52')]=_[_0x00d7('0x54')](_0x44ee53[_0x00d7('0x4f')],_0x44ee53[_0x00d7('0x51')]);_0x2b3e02[_0x00d7('0x53')]=_[_0x00d7('0x54')](_0x44ee53['model'],qs[_0x00d7('0x55')](_0x83ec78[_0x00d7('0x51')]['fields']));_0x2b3e02[_0x00d7('0x53')]=_0x2b3e02[_0x00d7('0x53')]['length']?_0x2b3e02[_0x00d7('0x53')]:_0x44ee53[_0x00d7('0x4f')];_0x2b3e02[_0x00d7('0x57')]=qs['sort'](_0x83ec78[_0x00d7('0x51')][_0x00d7('0x58')]);_0x2b3e02[_0x00d7('0x59')]=qs[_0x00d7('0x52')](_['pick'](_0x83ec78['query'],_0x44ee53[_0x00d7('0x52')]));if(_0x83ec78[_0x00d7('0x51')]['filter']){_0x2b3e02['where']=_[_0x00d7('0x5b')](_0x2b3e02[_0x00d7('0x59')],{'$or':_['map'](_0x2b3e02['attributes'],function(_0x14b932){var _0x2d23a9={};_0x2d23a9[_0x14b932]={'$like':'%'+_0x83ec78[_0x00d7('0x51')][_0x00d7('0x5a')]+'%'};return _0x2d23a9;})});}_0x2b3e02=_[_0x00d7('0x5b')]({},_0x2b3e02,_0x83ec78[_0x00d7('0x5d')]);return _0x370f2a[_0x00d7('0xc3')](_0x2b3e02);}})['then'](function(_0x2dbb0c){if(_0x2dbb0c){_0x584d13=_0x2dbb0c[_0x00d7('0x64')];if(!_0x83ec78['query'][_0x00d7('0x56')](_0x00d7('0x76'))){_0x2b3e02[_0x00d7('0x22')]=qs[_0x00d7('0x22')](_0x83ec78[_0x00d7('0x51')][_0x00d7('0x22')]);_0x2b3e02[_0x00d7('0x24')]=qs[_0x00d7('0x24')](_0x83ec78[_0x00d7('0x51')]['offset']);}return _0x370f2a['getAgents'](_0x2b3e02);}})[_0x00d7('0x27')](function(_0x3cf2c6){if(_0x3cf2c6){return _0x3cf2c6?{'count':_0x584d13,'rows':_0x3cf2c6}:null;}})['then'](respondWithResult(_0x4ac930,null))[_0x00d7('0x1c')](handleError(_0x4ac930,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index bb11b51..89aa0cf 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 _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 +var _0x0b36=['MailAccount','remove','emit','hasOwnProperty','events','../../mysqldb'];(function(_0x181751,_0xd4b73f){var _0x56befb=function(_0x38a47e){while(--_0x38a47e){_0x181751['push'](_0x181751['shift']());}};_0x56befb(++_0xd4b73f);}(_0x0b36,0x10c));var _0x60b3=function(_0x1ca002,_0x4f0fe5){_0x1ca002=_0x1ca002-0x0;var _0x1371b0=_0x0b36[_0x1ca002];return _0x1371b0;};'use strict';var EventEmitter=require(_0x60b3('0x0'));var MailAccount=require(_0x60b3('0x1'))['db'][_0x60b3('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x60b3('0x3')};function emitEvent(_0x530d5b){return function(_0xa0e029,_0x19dbae,_0x3afbc7){MailAccountEvents[_0x60b3('0x4')](_0x530d5b+':'+_0xa0e029['id'],_0xa0e029);MailAccountEvents[_0x60b3('0x4')](_0x530d5b,_0xa0e029);_0x3afbc7(null);};}for(var e in events){if(events[_0x60b3('0x5')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 3ad048e..54fca52 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 _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 +var _0x2373=['custom','service','host','Smtp','port','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','OAuth2','data5','auth','user','pass','exports','define','mail_accounts','provider'];(function(_0x360f0b,_0x52875f){var _0x579079=function(_0xcfa2f6){while(--_0xcfa2f6){_0x360f0b['push'](_0x360f0b['shift']());}};_0x579079(++_0x52875f);}(_0x2373,0x13f));var _0x3237=function(_0x845609,_0x1c4109){_0x845609=_0x845609-0x0;var _0x349fa7=_0x2373[_0x845609];return _0x349fa7;};'use strict';var attributes=require('./mailAccount.attributes');module[_0x3237('0x0')]=function(_0x359e54){return _0x359e54[_0x3237('0x1')]('MailAccount',attributes,{'tableName':_0x3237('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x29f4b3=this;var _0x41d3b7={'id':_0x29f4b3['id'],'tls':{'rejectUnauthorized':![]}};if(_0x29f4b3[_0x3237('0x3')]!==_0x3237('0x4')){_0x41d3b7[_0x3237('0x5')]=_0x29f4b3[_0x3237('0x3')];}else{_0x41d3b7[_0x3237('0x6')]=_0x29f4b3[_0x3237('0x7')][_0x3237('0x6')];_0x41d3b7[_0x3237('0x8')]=_0x29f4b3[_0x3237('0x7')][_0x3237('0x8')];_0x41d3b7[_0x3237('0x9')]=_0x29f4b3['Smtp'][_0x3237('0x9')];}if(_0x29f4b3[_0x3237('0x7')][_0x3237('0xa')]){if(_0x29f4b3[_0x3237('0x7')][_0x3237('0xb')]){if(!_0x29f4b3['Smtp'][_0x3237('0xc')])throw new Error(_0x3237('0xd'));_0x41d3b7['auth']={'type':_0x3237('0xe'),'user':_0x29f4b3[_0x3237('0x7')]['user'],'accessToken':_0x29f4b3[_0x3237('0x7')][_0x3237('0xc')][_0x3237('0xf')]};}else{_0x41d3b7[_0x3237('0x10')]={'user':_0x29f4b3[_0x3237('0x7')][_0x3237('0x11')],'pass':_0x29f4b3[_0x3237('0x7')][_0x3237('0x12')]};}}return _0x41d3b7;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 1c84dfb..ec76158 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 _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 +var _0x029b=['lodash','moment','randomstring','ioredis','../../config/logger','rpc','client','http','redis','defaults','socket.io-emitter','./mailAccount.socket','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','GetMailAccount','MailAccount','findAll','options','attributes','limit','include','map','model','then','stringify','find','where','setDataValue','smtpOptions','getSmtpOptions','ShowMailAccount','body','mail','difference','CmContact','rawAttributes','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','account','List','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','list','applications','orderBy','priority','autoclose','close','*,*,*,*','length','create','List\x20not\x20found','messageId','generate','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','Messages','inReplyTo','Contact\x20not\x20found','interaction','get','created','contact','attachments','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','User','name','unshift','agent','MailQueue','queue','Start','startRouting'];(function(_0x3bee6e,_0x1bdb8a){var _0x2a34af=function(_0x230129){while(--_0x230129){_0x3bee6e['push'](_0x3bee6e['shift']());}};_0x2a34af(++_0x1bdb8a);}(_0x029b,0x66));var _0xb029=function(_0x32543b,_0x1304a9){_0x32543b=_0x32543b-0x0;var _0x50540f=_0x029b[_0x32543b];return _0x50540f;};'use strict';var _=require(_0xb029('0x0'));var moment=require(_0xb029('0x1'));var BPromise=require('bluebird');var rs=require(_0xb029('0x2'));var Redis=require(_0xb029('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0xb029('0x4'))(_0xb029('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb029('0x6')][_0xb029('0x7')]({'port':0x232c});config[_0xb029('0x8')]=_[_0xb029('0x9')](config[_0xb029('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xb029('0xa'))(new Redis(config['redis']));require(_0xb029('0xb'))['register'](socket);function respondWithRpcPromise(_0x2c3772,_0x5a8bb7,_0x23fee0){return new BPromise(function(_0x4b3036,_0x2696e3){return client[_0xb029('0xc')](_0x2c3772,_0x23fee0)['then'](function(_0x266df5){logger[_0xb029('0xd')](_0xb029('0xe'),_0x5a8bb7,_0xb029('0xf'));logger[_0xb029('0x10')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x5a8bb7,_0xb029('0xf'),JSON['stringify'](_0x266df5));if(_0x266df5[_0xb029('0x11')]){if(_0x266df5[_0xb029('0x11')][_0xb029('0x12')]===0x1f4){logger[_0xb029('0x11')]('MailAccount,\x20%s,\x20%s',_0x5a8bb7,_0x266df5[_0xb029('0x11')][_0xb029('0x13')]);return _0x2696e3(_0x266df5[_0xb029('0x11')]['message']);}logger[_0xb029('0x11')](_0xb029('0xe'),_0x5a8bb7,_0x266df5[_0xb029('0x11')][_0xb029('0x13')]);return _0x4b3036(_0x266df5[_0xb029('0x11')][_0xb029('0x13')]);}else{logger[_0xb029('0xd')](_0xb029('0xe'),_0x5a8bb7,_0xb029('0xf'));_0x4b3036(_0x266df5['result']['message']);}})[_0xb029('0x14')](function(_0x5373cd){logger[_0xb029('0x11')](_0xb029('0xe'),_0x5a8bb7,_0x5373cd);_0x2696e3(_0x5373cd);});});}exports[_0xb029('0x15')]=function(_0x497ca0){var _0x5e1741=this;return new Promise(function(_0x13ff77,_0x8d3e35){return db[_0xb029('0x16')][_0xb029('0x17')]({'raw':_0x497ca0[_0xb029('0x18')]?_0x497ca0[_0xb029('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x497ca0['options']?_0x497ca0['options']['where']||null:null,'attributes':_0x497ca0[_0xb029('0x18')]?_0x497ca0[_0xb029('0x18')][_0xb029('0x19')]||null:null,'limit':_0x497ca0[_0xb029('0x18')]?_0x497ca0['options'][_0xb029('0x1a')]||null:null,'include':_0x497ca0[_0xb029('0x18')]?_0x497ca0[_0xb029('0x18')][_0xb029('0x1b')]?_[_0xb029('0x1c')](_0x497ca0[_0xb029('0x18')][_0xb029('0x1b')],function(_0x3eb5ac){return{'model':db[_0x3eb5ac[_0xb029('0x1d')]],'as':_0x3eb5ac['as'],'attributes':_0x3eb5ac[_0xb029('0x19')],'include':_0x3eb5ac[_0xb029('0x1b')]?_[_0xb029('0x1c')](_0x3eb5ac[_0xb029('0x1b')],function(_0x599a14){return{'model':db[_0x599a14[_0xb029('0x1d')]],'as':_0x599a14['as'],'attributes':_0x599a14[_0xb029('0x19')],'include':_0x599a14['include']?_['map'](_0x599a14[_0xb029('0x1b')],function(_0x3b030a){return{'model':db[_0x3b030a[_0xb029('0x1d')]],'as':_0x3b030a['as'],'attributes':_0x3b030a[_0xb029('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb029('0x1e')](function(_0x4af2ad){logger[_0xb029('0xd')]('GetMailAccount',_0x497ca0);logger[_0xb029('0x10')](_0xb029('0x15'),_0x497ca0,JSON[_0xb029('0x1f')](_0x4af2ad));_0x13ff77(_0x4af2ad);})['catch'](function(_0x1aa94b){logger[_0xb029('0x11')]('GetMailAccount',_0x1aa94b[_0xb029('0x13')],_0x497ca0);_0x8d3e35(_0x5e1741['error'](0x1f4,_0x1aa94b[_0xb029('0x13')]));});});};exports['ShowMailAccount']=function(_0x88a69b){var _0x3b0bfe=this;return new Promise(function(_0x392d0f,_0x2324f3){return db[_0xb029('0x16')][_0xb029('0x20')]({'raw':_0x88a69b[_0xb029('0x18')]?_0x88a69b[_0xb029('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x88a69b[_0xb029('0x18')]?_0x88a69b[_0xb029('0x18')][_0xb029('0x21')]||null:null,'attributes':_0x88a69b['options']?_0x88a69b[_0xb029('0x18')][_0xb029('0x19')]||null:null,'include':_0x88a69b['options']?_0x88a69b[_0xb029('0x18')]['include']?_[_0xb029('0x1c')](_0x88a69b['options'][_0xb029('0x1b')],function(_0x42f980){return{'model':db[_0x42f980[_0xb029('0x1d')]],'as':_0x42f980['as'],'attributes':_0x42f980[_0xb029('0x19')],'include':_0x42f980[_0xb029('0x1b')]?_[_0xb029('0x1c')](_0x42f980[_0xb029('0x1b')],function(_0x5a1d11){return{'model':db[_0x5a1d11[_0xb029('0x1d')]],'as':_0x5a1d11['as'],'attributes':_0x5a1d11[_0xb029('0x19')],'include':_0x5a1d11['include']?_[_0xb029('0x1c')](_0x5a1d11[_0xb029('0x1b')],function(_0x35105c){return{'model':db[_0x35105c[_0xb029('0x1d')]],'as':_0x35105c['as'],'attributes':_0x35105c['attributes']};}):[]};}):[]};}):[]:[]})[_0xb029('0x1e')](function(_0x3a2547){if(_0x88a69b[_0xb029('0x18')]['smtp']===!![])_0x3a2547[_0xb029('0x22')](_0xb029('0x23'),_0x3a2547[_0xb029('0x24')]());logger[_0xb029('0xd')](_0xb029('0x25'),_0x88a69b);logger[_0xb029('0x10')](_0xb029('0x25'),_0x88a69b,JSON[_0xb029('0x1f')](_0x3a2547));_0x392d0f(_0x3a2547);})[_0xb029('0x14')](function(_0x1392af){logger['error'](_0xb029('0x25'),_0x1392af[_0xb029('0x13')],_0x88a69b);_0x2324f3(_0x3b0bfe[_0xb029('0x11')](0x1f4,_0x1392af['message']));});});};exports['NotifyMailAccount']=function(_0x521b20){var _0x31477a=this;return new Promise(function(_0x41a857,_0x5c7082){var _0x1a7285={'body':_0x521b20[_0xb029('0x26')],'channel':_0xb029('0x27')};var _0x3bc456=_[_0xb029('0x28')](_['keys'](db[_0xb029('0x29')][_0xb029('0x2a')]),['createdAt',_0xb029('0x2b'),_0xb029('0x2c'),_0xb029('0x2d')]);var _0x56a470=![];if(_0x521b20[_0xb029('0x26')]['id']){delete _0x521b20[_0xb029('0x26')]['id'];}if(_['isNil'](_0x521b20['body'][_0xb029('0x2e')])){return _0x5c7082(_0x31477a[_0xb029('0x11')](0x1f4,_0xb029('0x2f')));}if(_[_0xb029('0x30')](_0x521b20['body']['body'])||_0x521b20[_0xb029('0x26')]['body']===''){return _0x5c7082(_0x31477a[_0xb029('0x11')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xb029('0x30')](_0x521b20[_0xb029('0x26')][_0xb029('0x31')])){return _0x5c7082(_0x31477a[_0xb029('0x11')](0x1f4,_0xb029('0x32')+_0x3bc456));}if(!_[_0xb029('0x33')](_0x3bc456,_0x521b20['body'][_0xb029('0x31')])){return _0x5c7082(_0x31477a['error'](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3bc456));}var _0x2dde2e={};_0x2dde2e[_0x521b20['body'][_0xb029('0x31')]]=_0x521b20['body'][_0xb029('0x2e')];return db[_0xb029('0x16')][_0xb029('0x20')]({'where':{'id':_0x521b20[_0xb029('0x34')]['id']},'include':[{'model':db['CmList'],'as':_0xb029('0x35'),'include':[{'model':db[_0xb029('0x29')],'as':_0xb029('0x36'),'where':_0x2dde2e,'limit':0x1,'order':[[_0xb029('0x2b'),_0xb029('0x37')]]}]},{'model':db[_0xb029('0x38')],'as':_0xb029('0x39')},{'model':db[_0xb029('0x3a')],'as':_0xb029('0x3b'),'include':[{'model':db[_0xb029('0x3c')],'as':'CloudProvider'}]}]})[_0xb029('0x1e')](function(_0x2345cd){if(_0x2345cd&&_0x2345cd[_0xb029('0x35')]){var _0x3172a2=_0x2345cd['get']({'plain':!![]});_0x1a7285[_0xb029('0x34')]=_['omit'](_0x3172a2,[_0xb029('0x39'),_0xb029('0x35')]);_0x1a7285[_0xb029('0x34')][_0xb029('0x23')]=_0x2345cd[_0xb029('0x24')]();_0x1a7285['applications']=_0x3172a2['Applications'];_0x1a7285[_0xb029('0x3d')]=_0x3172a2[_0xb029('0x35')];_0x1a7285[_0xb029('0x3e')]=_[_0xb029('0x3f')](_0x1a7285[_0xb029('0x3e')],[_0xb029('0x40')],['asc']);if(_0x1a7285[_0xb029('0x34')]&&_0x1a7285[_0xb029('0x34')][_0xb029('0x41')]){_0x1a7285['applications']['push']({'id':0x0,'priority':_0x1a7285[_0xb029('0x3e')]['length']+0x1,'app':_0xb029('0x42'),'appdata':_0xb029('0x41'),'interval':_0xb029('0x43')});}if(_0x1a7285['account'][_0xb029('0x39')]){delete _0x1a7285[_0xb029('0x34')]['Applications'];}if(_0x1a7285[_0xb029('0x34')][_0xb029('0x35')]){delete _0x1a7285[_0xb029('0x34')]['List'];}if(_0x3172a2[_0xb029('0x35')][_0xb029('0x36')][_0xb029('0x44')]){return _0x3172a2[_0xb029('0x35')]['Contacts'][0x0];}var _0x3cbbfe=_[_0xb029('0x9')](_0x521b20[_0xb029('0x26')],{'firstName':_0x521b20['body'][_0xb029('0x2e')],'ListId':_0x3172a2['ListId']});_0x3cbbfe[_0x521b20[_0xb029('0x26')][_0xb029('0x31')]]=_0x521b20[_0xb029('0x26')][_0xb029('0x2e')];return db[_0xb029('0x29')][_0xb029('0x45')](_0x3cbbfe);}else{throw new Error(_0xb029('0x46'));}})['then'](function(_0x4f41ad){_0x1a7285['contact']=_0x4f41ad;if(_0x4f41ad){if(!_0x521b20[_0xb029('0x26')][_0xb029('0x13')][_0xb029('0x47')]){_0x521b20[_0xb029('0x26')][_0xb029('0x13')]['messageId']=rs[_0xb029('0x48')]()+'\x20'+_0x521b20[_0xb029('0x26')][_0xb029('0x13')][_0xb029('0x2e')];}var _0x5b7c6d={'ContactId':_0x4f41ad['id'],'MailAccountId':_0x521b20[_0xb029('0x34')]['id'],'inReplyTo':_0x521b20[_0xb029('0x26')][_0xb029('0x13')][_0xb029('0x47')],'to':_0x521b20[_0xb029('0x26')][_0xb029('0x13')][_0xb029('0x2e')],'cc':_0x521b20[_0xb029('0x26')]['message']['cc'],'subject':_0x521b20[_0xb029('0x26')][_0xb029('0x13')]['subject'],'attach':_0x521b20[_0xb029('0x26')][_0xb029('0x13')][_0xb029('0x49')],'lastMsgAt':moment()[_0xb029('0x4a')](_0xb029('0x4b')),'lastMsgDirection':'in'};return db[_0xb029('0x4c')][_0xb029('0x20')]({'where':{'closed':![],'MailAccountId':_0x521b20[_0xb029('0x34')]['id']},'include':[{'model':db['MailMessage'],'as':_0xb029('0x4d'),'attributes':['messageId'],'where':{'messageId':_0x521b20[_0xb029('0x26')][_0xb029('0x13')][_0xb029('0x4e')]}}]})['then'](function(_0xd82930){if(_0xd82930){return[_0xd82930,![]];}return db[_0xb029('0x4c')]['create'](_0x5b7c6d)['then'](function(_0x5792a1){return[_0x5792a1,!![]];});});}else{throw new Error(_0xb029('0x4f'));}})['spread'](function(_0x3d8ff6,_0x5419d5){if(_0x3d8ff6){_0x56a470=_0x5419d5;if(!_0x5419d5){return _0x3d8ff6['update']({'inReplyTo':_0x521b20[_0xb029('0x26')][_0xb029('0x13')][_0xb029('0x47')],'to':_0x521b20[_0xb029('0x26')][_0xb029('0x13')][_0xb029('0x2e')],'cc':_0x521b20[_0xb029('0x26')]['message']['cc'],'subject':_0x521b20[_0xb029('0x26')][_0xb029('0x13')]['subject'],'attach':_0x3d8ff6[_0xb029('0x49')]?_0x3d8ff6[_0xb029('0x49')]:_0x521b20[_0xb029('0x26')]['message'][_0xb029('0x49')],'substatus':null,'substatusAt':moment()[_0xb029('0x4a')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0xb029('0x4a')](_0xb029('0x4b')),'lastMsgDirection':'in'});}else{return _0x3d8ff6;}}})['then'](function(_0x227bfd){_0x1a7285[_0xb029('0x50')]=_0x227bfd[_0xb029('0x51')]({'plain':!![]});_0x1a7285[_0xb029('0x50')][_0xb029('0x52')]=_0x56a470;return db['MailMessage'][_0xb029('0x45')]({'body':_0x521b20['body']['body'],'MailAccountId':_0x521b20[_0xb029('0x34')]['id'],'MailInteractionId':_0x227bfd['id'],'direction':'in','ContactId':_0x1a7285[_0xb029('0x53')]['id'],'messageId':_0x521b20[_0xb029('0x26')]['message'][_0xb029('0x47')],'from':_0x521b20[_0xb029('0x26')]['message']['from'],'to':_0x521b20[_0xb029('0x26')]['message']['to'],'cc':_0x521b20[_0xb029('0x26')]['message']['cc'],'subject':_0x521b20['body'][_0xb029('0x13')]['subject'],'attach':_0x521b20[_0xb029('0x26')][_0xb029('0x13')][_0xb029('0x49')],'Attachments':_0x521b20[_0xb029('0x26')][_0xb029('0x13')][_0xb029('0x54')],'originTo':_0x521b20[_0xb029('0x26')][_0xb029('0x13')][_0xb029('0x55')],'originCc':_0x521b20['body'][_0xb029('0x13')][_0xb029('0x56')],'bcc':_0x521b20[_0xb029('0x26')][_0xb029('0x13')][_0xb029('0x57')],'ChatWebsiteId':_0x521b20[_0xb029('0x26')][_0xb029('0x13')][_0xb029('0x58')]||null,'originChannel':_0x521b20[_0xb029('0x26')]['message'][_0xb029('0x59')]||_0xb029('0x5a'),'ChatOfflineMessageId':_0x521b20[_0xb029('0x26')]['message'][_0xb029('0x5b')]||null},{'include':[{'model':db[_0xb029('0x5c')],'as':_0xb029('0x5d')}]});})[_0xb029('0x1e')](function(_0x133e8c){_0x1a7285[_0xb029('0x13')]=_0x133e8c;if(!_0x1a7285[_0xb029('0x50')]['UserId']){return;}return db[_0xb029('0x5e')]['find']({'attributes':['id',_0xb029('0x5f')],'where':{'id':_0x1a7285[_0xb029('0x50')]['UserId']}});})[_0xb029('0x1e')](function(_0x493c86){if(_0x493c86){_0x1a7285['applications'][_0xb029('0x60')]({'id':0x0,'priority':0x0,'app':_0xb029('0x61'),'appdata':_0x493c86[_0xb029('0x5f')]+','+(_0x1a7285[_0xb029('0x34')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}if(!_0x1a7285[_0xb029('0x50')]['queueId']){return;}return db[_0xb029('0x62')][_0xb029('0x20')]({'attributes':['id',_0xb029('0x5f')],'where':{'id':_0x1a7285[_0xb029('0x50')]['queueId']}});})[_0xb029('0x1e')](function(_0x5849c9){if(_0x5849c9){_0x1a7285['applications'][_0xb029('0x60')]({'id':0x0,'priority':0x1,'app':_0xb029('0x63'),'appdata':_0x5849c9[_0xb029('0x5f')]+','+(_0x1a7285[_0xb029('0x34')]['waitForTheAssignedQueue']||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xb029('0x64'),_0xb029('0x65'),_0x1a7285);})[_0xb029('0x1e')](function(_0xc0111b){_0x41a857(_0xc0111b);})[_0xb029('0x14')](function(_0x4969af){_0x5c7082(_0x31477a[_0xb029('0x11')](0x1f4,_0x4969af[_0xb029('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 76ce62d..84f3971 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 _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 +var _0xebc0=['save','remove','emit','removeListener','./mailAccount.events'];(function(_0x27089f,_0x52d6a6){var _0x167329=function(_0x4c943f){while(--_0x4c943f){_0x27089f['push'](_0x27089f['shift']());}};_0x167329(++_0x52d6a6);}(_0xebc0,0xe5));var _0x0ebc=function(_0x1c674b,_0x3cb5db){_0x1c674b=_0x1c674b-0x0;var _0x594ef3=_0xebc0[_0x1c674b];return _0x594ef3;};'use strict';var MailAccountEvents=require(_0x0ebc('0x0'));var events=[_0x0ebc('0x1'),_0x0ebc('0x2'),'update'];function createListener(_0x315b4c,_0x3d6f4a){return function(_0x2f5d06){_0x3d6f4a[_0x0ebc('0x3')](_0x315b4c,_0x2f5d06);};}function removeListener(_0x1edd30,_0x2bf991){return function(){MailAccountEvents[_0x0ebc('0x4')](_0x1edd30,_0x2bf991);};}exports['register']=function(_0x5dc144){for(var _0x11b805=0x0,_0x534602=events['length'];_0x11b805<_0x534602;_0x11b805++){var _0x9f4884=events[_0x11b805];var _0x30d60c=createListener('mailAccount:'+_0x9f4884,_0x5dc144);MailAccountEvents['on'](_0x9f4884,_0x30d60c);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index bc49e19..ca0a24a 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 _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 +var _0x7645=['isAuthenticated','update','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','./mailApplication.controller','get','put','/:id'];(function(_0x10a68c,_0x576de9){var _0x28fa99=function(_0x38af15){while(--_0x38af15){_0x10a68c['push'](_0x10a68c['shift']());}};_0x28fa99(++_0x576de9);}(_0x7645,0x1a8));var _0x5764=function(_0x51aa74,_0x5496f9){_0x51aa74=_0x51aa74-0x0;var _0x16380e=_0x7645[_0x51aa74];return _0x16380e;};'use strict';var multer=require(_0x5764('0x0'));var util=require('util');var path=require(_0x5764('0x1'));var timeout=require('connect-timeout');var express=require(_0x5764('0x2'));var router=express[_0x5764('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5764('0x4'));var interaction=require(_0x5764('0x5'));var config=require('../../config/environment');var controller=require(_0x5764('0x6'));router[_0x5764('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x5764('0x8')](_0x5764('0x9'),auth[_0x5764('0xa')](),controller[_0x5764('0xb')]);router['delete'](_0x5764('0x9'),auth[_0x5764('0xa')](),controller[_0x5764('0xc')]);module[_0x5764('0xd')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index e6097cd..30b5482 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 _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 +var _0x07cc=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x2480df,_0x591bfa){var _0x4d895e=function(_0x4c48ad){while(--_0x4c48ad){_0x2480df['push'](_0x2480df['shift']());}};_0x4d895e(++_0x591bfa);}(_0x07cc,0x12f));var _0xc07c=function(_0x55af99,_0x5ced60){_0x55af99=_0x55af99-0x0;var _0x39ff7b=_0x07cc[_0x55af99];return _0x39ff7b;};'use strict';var Sequelize=require(_0xc07c('0x0'));module[_0xc07c('0x1')]={'priority':{'type':Sequelize[_0xc07c('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xc07c('0x3')],'allowNull':![],'defaultValue':_0xc07c('0x4')},'appdata':{'type':Sequelize[_0xc07c('0x5')]()},'description':{'type':Sequelize[_0xc07c('0x3')]},'interval':{'type':Sequelize[_0xc07c('0x3')],'defaultValue':_0xc07c('0x6')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 59f308c..3a2c321 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 _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 +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(_0x26b2be,_0x1bc1a4){var _0x1af969=function(_0x6f896b){while(--_0x6f896b){_0x26b2be['push'](_0x26b2be['shift']());}};_0x1af969(++_0x1bc1a4);}(_0xf4eb,0xec));var _0xbf4e=function(_0x31b7b1,_0x230823){_0x31b7b1=_0x31b7b1-0x0;var _0x2c4095=_0xf4eb[_0x31b7b1];return _0x2c4095;};'use strict';var emlformat=require(_0xbf4e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbf4e('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbf4e('0x2'));var path=require(_0xbf4e('0x3'));var sox=require(_0xbf4e('0x4'));var csv=require(_0xbf4e('0x5'));var ejs=require(_0xbf4e('0x6'));var fs=require('fs');var fs_extra=require(_0xbf4e('0x7'));var _=require(_0xbf4e('0x8'));var squel=require('squel');var crypto=require(_0xbf4e('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbf4e('0x5'));var querystring=require(_0xbf4e('0xa'));var Papa=require(_0xbf4e('0xb'));var Redis=require(_0xbf4e('0xc'));var authService=require(_0xbf4e('0xd'));var qs=require(_0xbf4e('0xe'));var as=require(_0xbf4e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbf4e('0x10'));var utils=require('../../config/utils');var config=require(_0xbf4e('0x11'));var licenseUtil=require(_0xbf4e('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17fd01,_0x5a3035){_0x5a3035=_0x5a3035||0xcc;return function(_0x56d185){if(_0x56d185){return _0x17fd01[_0xbf4e('0x13')](_0x5a3035);}return _0x17fd01[_0xbf4e('0x14')](_0x5a3035)[_0xbf4e('0x15')]();};}function respondWithResult(_0x302841,_0x3b74bd){_0x3b74bd=_0x3b74bd||0xc8;return function(_0x61bd54){if(_0x61bd54){return _0x302841['status'](_0x3b74bd)['json'](_0x61bd54);}};}function respondWithFilteredResult(_0x180432,_0x1735ae){return function(_0x28fc6b){if(_0x28fc6b){var _0x542909=typeof _0x1735ae[_0xbf4e('0x16')]===_0xbf4e('0x17')&&typeof _0x1735ae[_0xbf4e('0x18')]===_0xbf4e('0x17');var _0x5a631e=_0x28fc6b[_0xbf4e('0x19')];var _0x577c27=_0x542909?0x0:_0x1735ae['offset'];var _0x566ec3=_0x542909?_0x28fc6b['count']:_0x1735ae[_0xbf4e('0x16')]+_0x1735ae[_0xbf4e('0x18')];var _0x1fc800;if(_0x566ec3>=_0x5a631e){_0x566ec3=_0x5a631e;_0x1fc800=0xc8;}else{_0x1fc800=0xce;}_0x180432['status'](_0x1fc800);return _0x180432['set'](_0xbf4e('0x1a'),_0x577c27+'-'+_0x566ec3+'/'+_0x5a631e)[_0xbf4e('0x1b')](_0x28fc6b);}return null;};}function patchUpdates(_0x3be138){return function(_0x3a875b){try{jsonpatch[_0xbf4e('0x1c')](_0x3a875b,_0x3be138,!![]);}catch(_0x1e2a68){return BPromise[_0xbf4e('0x1d')](_0x1e2a68);}return _0x3a875b[_0xbf4e('0x1e')]();};}function saveUpdates(_0xd09e12,_0x376832){return function(_0x30539b){if(_0x30539b){return _0x30539b['update'](_0xd09e12)[_0xbf4e('0x1f')](function(_0x2e7673){return _0x2e7673;});}return null;};}function removeEntity(_0x51648c,_0x31e3f5){return function(_0x30994d){if(_0x30994d){return _0x30994d[_0xbf4e('0x20')]()[_0xbf4e('0x1f')](function(){_0x51648c[_0xbf4e('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x90635e,_0x36688a){return function(_0x3d6863){if(!_0x3d6863){_0x90635e['sendStatus'](0x194);}return _0x3d6863;};}function handleError(_0x2fb490,_0x5e08b1){_0x5e08b1=_0x5e08b1||0x1f4;return function(_0x5bcf71){logger[_0xbf4e('0x21')](_0x5bcf71['stack']);if(_0x5bcf71[_0xbf4e('0x22')]){delete _0x5bcf71[_0xbf4e('0x22')];}_0x2fb490[_0xbf4e('0x14')](_0x5e08b1)[_0xbf4e('0x23')](_0x5bcf71);};}exports['show']=function(_0x2d4686,_0x8e0ab5){var _0x43879d={'raw':!![],'where':{'id':_0x2d4686[_0xbf4e('0x24')]['id']}},_0x4cd4a1={};_0x4cd4a1['model']=_[_0xbf4e('0x25')](db[_0xbf4e('0x26')][_0xbf4e('0x27')]);_0x4cd4a1['query']=_[_0xbf4e('0x25')](_0x2d4686[_0xbf4e('0x28')]);_0x4cd4a1[_0xbf4e('0x29')]=_[_0xbf4e('0x2a')](_0x4cd4a1[_0xbf4e('0x2b')],_0x4cd4a1[_0xbf4e('0x28')]);_0x43879d['attributes']=_[_0xbf4e('0x2a')](_0x4cd4a1[_0xbf4e('0x2b')],qs['fields'](_0x2d4686[_0xbf4e('0x28')][_0xbf4e('0x2c')]));_0x43879d['attributes']=_0x43879d[_0xbf4e('0x2d')]['length']?_0x43879d[_0xbf4e('0x2d')]:_0x4cd4a1['model'];if(_0x2d4686[_0xbf4e('0x28')][_0xbf4e('0x2e')]){_0x43879d[_0xbf4e('0x2f')]=[{'all':!![]}];}_0x43879d=_['merge']({},_0x43879d,_0x2d4686[_0xbf4e('0x30')]);return db[_0xbf4e('0x26')][_0xbf4e('0x31')](_0x43879d)[_0xbf4e('0x1f')](handleEntityNotFound(_0x8e0ab5,null))[_0xbf4e('0x1f')](respondWithResult(_0x8e0ab5,null))[_0xbf4e('0x32')](handleError(_0x8e0ab5,null));};exports['update']=function(_0x99b320,_0x3dbb2b){if(_0x99b320[_0xbf4e('0x33')]['id']){delete _0x99b320[_0xbf4e('0x33')]['id'];}return db[_0xbf4e('0x26')]['find']({'where':{'id':_0x99b320['params']['id']}})['then'](handleEntityNotFound(_0x3dbb2b,null))['then'](saveUpdates(_0x99b320[_0xbf4e('0x33')],null))[_0xbf4e('0x1f')](respondWithResult(_0x3dbb2b,null))[_0xbf4e('0x32')](handleError(_0x3dbb2b,null));};exports[_0xbf4e('0x20')]=function(_0x22ddde,_0x257b74){return db[_0xbf4e('0x26')][_0xbf4e('0x31')]({'where':{'id':_0x22ddde[_0xbf4e('0x24')]['id']}})['then'](handleEntityNotFound(_0x257b74,null))['then'](removeEntity(_0x257b74,null))[_0xbf4e('0x32')](handleError(_0x257b74,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 55f028c..a5dd945 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 _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 +var _0x9a9f=['exports','define','MailApplication','mail_applications','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x4838df,_0x1e8c8d){var _0x1a41b3=function(_0x4fdc7c){while(--_0x4fdc7c){_0x4838df['push'](_0x4838df['shift']());}};_0x1a41b3(++_0x1e8c8d);}(_0x9a9f,0x1c8));var _0xf9a9=function(_0x19c776,_0xe6b2fe){_0x19c776=_0x19c776-0x0;var _0x40a680=_0x9a9f[_0x19c776];return _0x40a680;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf9a9('0x0'))(_0xf9a9('0x1'));var moment=require(_0xf9a9('0x2'));var BPromise=require(_0xf9a9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf9a9('0x4'));var config=require(_0xf9a9('0x5'));var attributes=require('./mailApplication.attributes');module[_0xf9a9('0x6')]=function(_0x2f486d,_0x13eab4){return _0x2f486d[_0xf9a9('0x7')](_0xf9a9('0x8'),attributes,{'tableName':_0xf9a9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xf9a9('0xa')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 377372c..12cb0f8 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 _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 +var _0x6546=['../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','request\x20sent','stringify','error','code','MailApplication,\x20%s,\x20%s','message','result','catch','UpdateMailApplication','MailApplication','update','body','options','raw','where','attributes','limit','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0xce8183,_0x567545){var _0x27c555=function(_0x2b1dd5){while(--_0x2b1dd5){_0xce8183['push'](_0xce8183['shift']());}};_0x27c555(++_0x567545);}(_0x6546,0x19a));var _0x6654=function(_0xc5fd81,_0x286a81){_0xc5fd81=_0xc5fd81-0x0;var _0x55d2e4=_0x6546[_0xc5fd81];return _0x55d2e4;};'use strict';var _=require(_0x6654('0x0'));var util=require(_0x6654('0x1'));var moment=require(_0x6654('0x2'));var BPromise=require('bluebird');var rs=require(_0x6654('0x3'));var fs=require('fs');var Redis=require(_0x6654('0x4'));var db=require(_0x6654('0x5'))['db'];var utils=require(_0x6654('0x6'));var logger=require(_0x6654('0x7'))('rpc');var config=require(_0x6654('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6654('0x9')][_0x6654('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1abdd6,_0x2e65f3,_0x4ee828){return new BPromise(function(_0xf7d8cf,_0x2af691){return client[_0x6654('0xb')](_0x1abdd6,_0x4ee828)[_0x6654('0xc')](function(_0x415443){logger[_0x6654('0xd')]('MailApplication,\x20%s,\x20%s',_0x2e65f3,'request\x20sent');logger['debug']('MailApplication,\x20%s,\x20%s,\x20%s',_0x2e65f3,_0x6654('0xe'),JSON[_0x6654('0xf')](_0x415443));if(_0x415443[_0x6654('0x10')]){if(_0x415443[_0x6654('0x10')][_0x6654('0x11')]===0x1f4){logger[_0x6654('0x10')](_0x6654('0x12'),_0x2e65f3,_0x415443['error'][_0x6654('0x13')]);return _0x2af691(_0x415443[_0x6654('0x10')][_0x6654('0x13')]);}logger[_0x6654('0x10')](_0x6654('0x12'),_0x2e65f3,_0x415443[_0x6654('0x10')]['message']);return _0xf7d8cf(_0x415443[_0x6654('0x10')][_0x6654('0x13')]);}else{logger[_0x6654('0xd')](_0x6654('0x12'),_0x2e65f3,'request\x20sent');_0xf7d8cf(_0x415443[_0x6654('0x14')][_0x6654('0x13')]);}})[_0x6654('0x15')](function(_0x3620f7){logger[_0x6654('0x10')](_0x6654('0x12'),_0x2e65f3,_0x3620f7);_0x2af691(_0x3620f7);});});}exports[_0x6654('0x16')]=function(_0x8a5e43){var _0x39dd46=this;return new Promise(function(_0xbb8e66,_0x468149){return db[_0x6654('0x17')][_0x6654('0x18')](_0x8a5e43[_0x6654('0x19')],{'raw':_0x8a5e43[_0x6654('0x1a')]?_0x8a5e43[_0x6654('0x1a')][_0x6654('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8a5e43['options']?_0x8a5e43[_0x6654('0x1a')][_0x6654('0x1c')]||null:null,'attributes':_0x8a5e43[_0x6654('0x1a')]?_0x8a5e43[_0x6654('0x1a')][_0x6654('0x1d')]||null:null,'limit':_0x8a5e43[_0x6654('0x1a')]?_0x8a5e43['options'][_0x6654('0x1e')]||null:null})[_0x6654('0xc')](function(_0x5637f7){logger[_0x6654('0xd')]('UpdateMailApplication',_0x8a5e43);logger[_0x6654('0x1f')]('UpdateMailApplication',_0x8a5e43,JSON['stringify'](_0x5637f7));_0xbb8e66(_0x5637f7);})[_0x6654('0x15')](function(_0x3e7e0d){logger['error'](_0x6654('0x16'),_0x3e7e0d['message'],_0x8a5e43);_0x468149(_0x39dd46['error'](0x1f4,_0x3e7e0d[_0x6654('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 4467922..1778a8a 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 _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 +var _0x6779=['download','post','create','addMessage','tracked','mail','mailinteraction:addtags','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','/:id/tags','exports','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/messages','/:id/download'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x6779,0x1a3));var _0x9677=function(_0x25ba03,_0x71aba1){_0x25ba03=_0x25ba03-0x0;var _0xd79e74=_0x6779[_0x25ba03];return _0xd79e74;};'use strict';var express=require(_0x9677('0x0'));var router=express[_0x9677('0x1')]();var auth=require(_0x9677('0x2'));var interaction=require(_0x9677('0x3'));var controller=require(_0x9677('0x4'));router[_0x9677('0x5')]('/',auth[_0x9677('0x6')](),controller[_0x9677('0x7')]);router[_0x9677('0x5')](_0x9677('0x8'),auth[_0x9677('0x6')](),controller[_0x9677('0x9')]);router[_0x9677('0x5')](_0x9677('0xa'),auth[_0x9677('0x6')](),controller['show']);router[_0x9677('0x5')](_0x9677('0xb'),auth[_0x9677('0x6')](),controller['getMessages']);router[_0x9677('0x5')](_0x9677('0xc'),auth[_0x9677('0x6')](),controller[_0x9677('0xd')]);router[_0x9677('0xe')]('/',auth[_0x9677('0x6')](),controller[_0x9677('0xf')]);router[_0x9677('0xe')](_0x9677('0xb'),auth[_0x9677('0x6')](),controller[_0x9677('0x10')]);router[_0x9677('0xe')]('/:id/tags',auth[_0x9677('0x6')](),interaction[_0x9677('0x11')](_0x9677('0x12'),_0x9677('0x13')),controller['addTags']);router['put'](_0x9677('0xa'),auth['isAuthenticated'](),interaction['tracked'](_0x9677('0x12'),_0x9677('0x14')),controller[_0x9677('0x15')]);router[_0x9677('0x16')](_0x9677('0xa'),auth[_0x9677('0x6')](),interaction['tracked'](_0x9677('0x12'),_0x9677('0x17')),controller[_0x9677('0x18')]);router['delete'](_0x9677('0x19'),auth[_0x9677('0x6')](),controller['removeTags']);module[_0x9677('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index f599d1e..8612bd0 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 _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 +var _0x3a4d=['out','sequelize','iconv','exports','BOOLEAN','DATE','STRING','TEXT','long','ENUM'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x3a4d,0x6f));var _0xd3a4=function(_0x35f7f5,_0x4e2ee1){_0x35f7f5=_0x35f7f5-0x0;var _0x5567a4=_0x3a4d[_0x35f7f5];return _0x5567a4;};'use strict';var Sequelize=require(_0xd3a4('0x0'));var iconv=require(_0xd3a4('0x1'));module[_0xd3a4('0x2')]={'closed':{'type':Sequelize[_0xd3a4('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd3a4('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xd3a4('0x5')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xd3a4('0x6')](_0xd3a4('0x7'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0xd3a4('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xd3a4('0x4')]},'substatus':{'type':Sequelize[_0xd3a4('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0xd3a4('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xd3a4('0x8')]('in',_0xd3a4('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xd3a4('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xd3a4('0x8')]('in',_0xd3a4('0x9')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 661ffdc..5324cc6 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 _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 +var _0xf160=['ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','bcc','headers','Bcc','Attachments','basename','existsSync','readFileSync','build','message%d.eml','download','unlinkSync','sendStatus','rimraf','moment','bluebird','util','path','lodash','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','localhost','socket.io-emitter','./mailInteraction.socket','register','status','end','json','count','offset','limit','set','Content-Range','update','destroy','then','error','stack','name','send','index','map','MailInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','mail','query','catch','show','model','keys','filters','intersection','attributes','fields','length','includeAll','include','options','find','create','body','params','describe','addMessage','MailMessage','ids','omit','getMessages','hasOwnProperty','nolimit','sort','where','pick','MailInteractionId','merge','filter','$gte','split','inlineCss','true','rows','Tag','color','emit','mailInteractionTags:save','removeTags','unix','toString','join','root','server','tmp','attachments','transcript-%d-%s.zip','push','Attachment','Messages','from','subject','createdAt','mkdirSync','each','missing.recipient@your.company.com','decode','format'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xf160,0xf7));var _0x0f16=function(_0x4ce01b,_0x75b57c){_0x4ce01b=_0x4ce01b-0x0;var _0x2a3dad=_0xf160[_0x4ce01b];return _0x2a3dad;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0f16('0x0'));var zipdir=require('zip-dir');var moment=require(_0x0f16('0x1'));var BPromise=require(_0x0f16('0x2'));var util=require(_0x0f16('0x3'));var path=require(_0x0f16('0x4'));var fs=require('fs');var _=require(_0x0f16('0x5'));var juice=require(_0x0f16('0x6'));var Redis=require(_0x0f16('0x7'));var interaction=require(_0x0f16('0x8'));var qs=require(_0x0f16('0x9'));var logger=require(_0x0f16('0xa'))(_0x0f16('0xb'));var config=require(_0x0f16('0xc'));var db=require(_0x0f16('0xd'))['db'];var htmlEntities=require(_0x0f16('0xe'));config['redis']=_['defaults'](config['redis'],{'host':_0x0f16('0xf'),'port':0x18eb});var socket=require(_0x0f16('0x10'))(new Redis(config['redis']));require(_0x0f16('0x11'))[_0x0f16('0x12')](socket);function respondWithStatusCode(_0x48758b,_0x57e2bf){_0x57e2bf=_0x57e2bf||0xcc;return function(_0x5976da){if(_0x5976da){return _0x48758b['sendStatus'](_0x57e2bf);}return _0x48758b[_0x0f16('0x13')](_0x57e2bf)[_0x0f16('0x14')]();};}function respondWithResult(_0x22ce7d,_0x399614){_0x399614=_0x399614||0xc8;return function(_0x595dd3){if(_0x595dd3){return _0x22ce7d[_0x0f16('0x13')](_0x399614)[_0x0f16('0x15')](_0x595dd3);}};}function respondWithFilteredResult(_0x55781f,_0x22a270){return function(_0x54e7ba){if(_0x54e7ba){var _0x41ecfa=typeof _0x22a270['offset']==='undefined'&&typeof _0x22a270['limit']==='undefined';var _0x53fd05=_0x54e7ba[_0x0f16('0x16')];var _0xef5a29=_0x41ecfa?0x0:_0x22a270[_0x0f16('0x17')];var _0x48e8ea=_0x41ecfa?_0x54e7ba[_0x0f16('0x16')]:_0x22a270[_0x0f16('0x17')]+_0x22a270[_0x0f16('0x18')];var _0x49f8e9;if(_0x48e8ea>=_0x53fd05){_0x48e8ea=_0x53fd05;_0x49f8e9=0xc8;}else{_0x49f8e9=0xce;}_0x55781f[_0x0f16('0x13')](_0x49f8e9);return _0x55781f[_0x0f16('0x19')](_0x0f16('0x1a'),_0xef5a29+'-'+_0x48e8ea+'/'+_0x53fd05)[_0x0f16('0x15')](_0x54e7ba);}return null;};}function saveUpdates(_0xe0f9e9){return function(_0x54fed7){if(_0x54fed7){return _0x54fed7[_0x0f16('0x1b')](_0xe0f9e9)['then'](function(_0x49af76){return _0x49af76;});}return null;};}function removeEntity(_0x477ea1){return function(_0x3ab673){if(_0x3ab673){return _0x3ab673[_0x0f16('0x1c')]()[_0x0f16('0x1d')](function(){_0x477ea1[_0x0f16('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1530d2){return function(_0x356c6b){if(!_0x356c6b){_0x1530d2['sendStatus'](0x194);}return _0x356c6b;};}function handleError(_0x5b83c4,_0x5c2597){_0x5c2597=_0x5c2597||0x1f4;return function(_0x44fccc){logger[_0x0f16('0x1e')](_0x44fccc[_0x0f16('0x1f')]);if(_0x44fccc[_0x0f16('0x20')]){delete _0x44fccc[_0x0f16('0x20')];}_0x5b83c4[_0x0f16('0x13')](_0x5c2597)[_0x0f16('0x21')](_0x44fccc);};}exports[_0x0f16('0x22')]=function(_0x11f395,_0x1de74c){var _0x4949c4={};var _0x1f8b10=_[_0x0f16('0x23')](db[_0x0f16('0x24')][_0x0f16('0x25')],function(_0xa9e515){return{'name':_0xa9e515[_0x0f16('0x26')],'type':_0xa9e515[_0x0f16('0x27')][_0x0f16('0x28')]};});_0x4949c4=qs[_0x0f16('0x29')](_0x1f8b10,_0x11f395);return interaction[_0x0f16('0x2a')](_0x0f16('0x2b'),_0x11f395[_0x0f16('0x2c')],_0x11f395['user'],_0x4949c4,_0x1f8b10)[_0x0f16('0x1d')](respondWithFilteredResult(_0x1de74c,_0x4949c4))[_0x0f16('0x2d')](handleError(_0x1de74c,null));};exports[_0x0f16('0x2e')]=function(_0x5b0882,_0x162810){var _0x1918f2={'raw':![],'where':{'id':_0x5b0882['params']['id']}},_0x76c621={};_0x76c621[_0x0f16('0x2f')]=_[_0x0f16('0x30')](db[_0x0f16('0x24')][_0x0f16('0x25')]);_0x76c621[_0x0f16('0x2c')]=_[_0x0f16('0x30')](_0x5b0882[_0x0f16('0x2c')]);_0x76c621[_0x0f16('0x31')]=_[_0x0f16('0x32')](_0x76c621[_0x0f16('0x2f')],_0x76c621[_0x0f16('0x2c')]);_0x1918f2[_0x0f16('0x33')]=_[_0x0f16('0x32')](_0x76c621[_0x0f16('0x2f')],qs[_0x0f16('0x34')](_0x5b0882['query'][_0x0f16('0x34')]));_0x1918f2[_0x0f16('0x33')]=_0x1918f2[_0x0f16('0x33')][_0x0f16('0x35')]?_0x1918f2[_0x0f16('0x33')]:_0x76c621[_0x0f16('0x2f')];if(_0x5b0882['query'][_0x0f16('0x36')]){_0x1918f2[_0x0f16('0x37')]=[{'all':!![]}];}_0x1918f2=_['merge']({},_0x1918f2,_0x5b0882[_0x0f16('0x38')]);return db['MailInteraction'][_0x0f16('0x39')](_0x1918f2)[_0x0f16('0x1d')](handleEntityNotFound(_0x162810,null))[_0x0f16('0x1d')](respondWithResult(_0x162810,null))[_0x0f16('0x2d')](handleError(_0x162810,null));};exports[_0x0f16('0x3a')]=function(_0x3cb923,_0x1dff27){return db['MailInteraction'][_0x0f16('0x3a')](_0x3cb923[_0x0f16('0x3b')],{})[_0x0f16('0x1d')](respondWithResult(_0x1dff27,0xc9))[_0x0f16('0x2d')](handleError(_0x1dff27,null));};exports[_0x0f16('0x1b')]=function(_0x5c9155,_0x301324){if(_0x5c9155[_0x0f16('0x3b')]['id']){delete _0x5c9155[_0x0f16('0x3b')]['id'];}return db[_0x0f16('0x24')][_0x0f16('0x39')]({'where':{'id':_0x5c9155[_0x0f16('0x3c')]['id']}})['then'](handleEntityNotFound(_0x301324,null))['then'](saveUpdates(_0x5c9155[_0x0f16('0x3b')],null))[_0x0f16('0x1d')](respondWithResult(_0x301324,null))[_0x0f16('0x2d')](handleError(_0x301324,null));};exports[_0x0f16('0x1c')]=function(_0x3c8669,_0x43a7ff){return db[_0x0f16('0x24')][_0x0f16('0x39')]({'where':{'id':_0x3c8669[_0x0f16('0x3c')]['id']}})[_0x0f16('0x1d')](handleEntityNotFound(_0x43a7ff,null))['then'](removeEntity(_0x43a7ff,null))[_0x0f16('0x2d')](handleError(_0x43a7ff,null));};exports[_0x0f16('0x3d')]=function(_0x48190e,_0x384313){return db['MailInteraction'][_0x0f16('0x3d')]()[_0x0f16('0x1d')](respondWithResult(_0x384313,null))[_0x0f16('0x2d')](handleError(_0x384313,null));};exports[_0x0f16('0x3e')]=function(_0x2953ae,_0x9ff524){return db[_0x0f16('0x3f')][_0x0f16('0x39')]({'where':{'id':_0x2953ae['params']['id']}})['then'](handleEntityNotFound(_0x9ff524,null))[_0x0f16('0x1d')](function(_0x2953c2){if(_0x2953c2){return _0x2953c2['addMessage'](_0x2953ae[_0x0f16('0x3b')][_0x0f16('0x40')],_[_0x0f16('0x41')](_0x2953ae[_0x0f16('0x3b')],[_0x0f16('0x40'),'id'])||{});}})['then'](respondWithResult(_0x9ff524,null))[_0x0f16('0x2d')](handleError(_0x9ff524,null));};exports[_0x0f16('0x42')]=function(_0x52dce8,_0x560589){var _0x164df5={'raw':![],'where':{}};var _0x3120b8={};var _0xe91eba={'count':0x0,'rows':[]};return db[_0x0f16('0x24')]['findOne']({'where':{'id':_0x52dce8['params']['id']}})[_0x0f16('0x1d')](handleEntityNotFound(_0x560589,null))[_0x0f16('0x1d')](function(_0x206cd4){if(_0x206cd4){_0x3120b8[_0x0f16('0x2f')]=_[_0x0f16('0x30')](db['MailMessage'][_0x0f16('0x25')]);_0x3120b8[_0x0f16('0x2c')]=_['keys'](_0x52dce8[_0x0f16('0x2c')]);_0x3120b8[_0x0f16('0x31')]=_[_0x0f16('0x32')](_0x3120b8['model'],_0x3120b8[_0x0f16('0x2c')]);_0x164df5[_0x0f16('0x33')]=_[_0x0f16('0x32')](_0x3120b8[_0x0f16('0x2f')],qs['fields'](_0x52dce8[_0x0f16('0x2c')][_0x0f16('0x34')]));_0x164df5[_0x0f16('0x33')]=_0x164df5[_0x0f16('0x33')][_0x0f16('0x35')]?_0x164df5[_0x0f16('0x33')]:_0x3120b8[_0x0f16('0x2f')];if(!_0x52dce8[_0x0f16('0x2c')][_0x0f16('0x43')](_0x0f16('0x44'))){_0x164df5[_0x0f16('0x18')]=qs[_0x0f16('0x18')](_0x52dce8['query'][_0x0f16('0x18')]);_0x164df5[_0x0f16('0x17')]=qs[_0x0f16('0x17')](_0x52dce8['query'][_0x0f16('0x17')]);}_0x164df5['order']=qs['sort'](_0x52dce8['query'][_0x0f16('0x45')]);_0x164df5[_0x0f16('0x46')]=qs[_0x0f16('0x31')](_[_0x0f16('0x47')](_0x52dce8['query'],_0x3120b8['filters']));_0x164df5['where'][_0x0f16('0x48')]=_0x206cd4['id'];if(_0x52dce8[_0x0f16('0x2c')]['filter']){_0x164df5[_0x0f16('0x46')]=_[_0x0f16('0x49')](_0x164df5[_0x0f16('0x46')],{'$or':_[_0x0f16('0x23')](_0x164df5[_0x0f16('0x33')],function(_0x49ca8a){var _0x2c7dbd={};_0x2c7dbd[_0x49ca8a]={'$like':'%'+_0x52dce8[_0x0f16('0x2c')][_0x0f16('0x4a')]+'%'};return _0x2c7dbd;})});}if(_0x52dce8[_0x0f16('0x2c')][_0x0f16('0x4b')]){var _0x404d49=_0x52dce8[_0x0f16('0x2c')][_0x0f16('0x4b')][_0x0f16('0x4c')](',');var _0x4f909a={};_0x4f909a[_0x404d49[0x0]]={'$gte':moment(_0x404d49[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x164df5[_0x0f16('0x46')]=_[_0x0f16('0x49')](_0x164df5[_0x0f16('0x46')],_0x4f909a);}_0x164df5=_[_0x0f16('0x49')]({},_0x164df5,_0x52dce8['options']);return db[_0x0f16('0x3f')][_0x0f16('0x16')]({'where':_0x164df5[_0x0f16('0x46')]})[_0x0f16('0x1d')](function(_0x5b525e){_0xe91eba['count']=_0x5b525e;if(_0x52dce8['query'][_0x0f16('0x36')]){_0x164df5['include']=[{'all':!![]}];}return db['MailMessage'][_0x0f16('0x2a')](_0x164df5);})[_0x0f16('0x1d')](function(_0x42e9f8){if(_0x52dce8['query'][_0x0f16('0x4d')]===_0x0f16('0x4e')){for(var _0x11e2e2=0x0;_0x11e2e2<_0x42e9f8[_0x0f16('0x35')];_0x11e2e2++){_0x42e9f8[_0x11e2e2][_0x0f16('0x3b')]=juice(_0x42e9f8[_0x11e2e2][_0x0f16('0x3b')]);}}_0xe91eba[_0x0f16('0x4f')]=_0x42e9f8;return _0xe91eba;});}})['then'](respondWithFilteredResult(_0x560589,_0x164df5))['catch'](handleError(_0x560589,null));};exports['addTags']=function(_0xb3062b,_0x505013){return db[_0x0f16('0x24')][_0x0f16('0x39')]({'where':{'id':_0xb3062b[_0x0f16('0x3c')]['id']}})['then'](handleEntityNotFound(_0x505013,null))[_0x0f16('0x1d')](function(_0xaa9957){if(_0xaa9957){return _0xaa9957['setTags'](_0xb3062b[_0x0f16('0x3b')]['ids'],_[_0x0f16('0x41')](_0xb3062b[_0x0f16('0x3b')],[_0x0f16('0x40'),'id'])||{})['spread'](function(){return db[_0x0f16('0x50')][_0x0f16('0x2a')]({'attributes':['id',_0x0f16('0x20'),_0x0f16('0x51')],'where':{'id':_0xb3062b[_0x0f16('0x3b')]['ids']}});})[_0x0f16('0x1d')](function(_0x4f8ccc){socket[_0x0f16('0x52')](_0x0f16('0x53'),{'id':Number(_0xb3062b[_0x0f16('0x3c')]['id']),'tags':_0x4f8ccc||[]});return{'id':Number(_0xb3062b[_0x0f16('0x3c')]['id']),'tags':_0x4f8ccc||[]};});}})[_0x0f16('0x1d')](respondWithResult(_0x505013,null))['catch'](handleError(_0x505013,null));};exports[_0x0f16('0x54')]=function(_0x2f8fc0,_0x3b8c40){return db[_0x0f16('0x24')][_0x0f16('0x39')]({'where':{'id':_0x2f8fc0[_0x0f16('0x3c')]['id']}})[_0x0f16('0x1d')](handleEntityNotFound(_0x3b8c40,null))[_0x0f16('0x1d')](function(_0x360b5b){if(_0x360b5b){return _0x360b5b[_0x0f16('0x54')](_0x2f8fc0[_0x0f16('0x2c')][_0x0f16('0x40')]);}})[_0x0f16('0x1d')](respondWithStatusCode(_0x3b8c40,null))[_0x0f16('0x2d')](handleError(_0x3b8c40,null));};exports['download']=function(_0x5f1e58,_0x55c586){var _0x2c9ee6=moment()[_0x0f16('0x55')]()[_0x0f16('0x56')]();var _0x214c3d=path[_0x0f16('0x57')](config[_0x0f16('0x58')],_0x0f16('0x59'),'files',_0x0f16('0x5a'));var _0x2d7d12=path[_0x0f16('0x57')](config['root'],_0x0f16('0x59'),'files',_0x0f16('0x5b'));var _0xf360d4=path['join'](_0x214c3d,_0x2c9ee6);var _0x5880dc=util['format'](_0x0f16('0x5c'),_0x5f1e58[_0x0f16('0x3c')]['id'],_0x2c9ee6);var _0x383de8=path[_0x0f16('0x57')](_0x214c3d,_0x5880dc);var _0x18ad1f=[];if(_0x5f1e58['query'][_0x0f16('0x5b')]){_0x18ad1f[_0x0f16('0x5d')]({'model':db[_0x0f16('0x5e')],'as':'Attachments','raw':!![]});}var _0xf3a8c4=[{'model':db[_0x0f16('0x3f')],'as':_0x0f16('0x5f'),'attributes':['id',_0x0f16('0x3b'),_0x0f16('0x60'),'to','cc','bcc',_0x0f16('0x61'),_0x0f16('0x62')],'where':{'secret':![]},'order':qs[_0x0f16('0x45')]('id'),'include':_0x18ad1f}];return db[_0x0f16('0x24')]['find']({'where':{'id':_0x5f1e58[_0x0f16('0x3c')]['id']},'include':_0xf3a8c4})[_0x0f16('0x1d')](handleEntityNotFound(_0x55c586,null))[_0x0f16('0x1d')](function(_0x1045a6){if(_0x1045a6&&_0x1045a6['Messages']){var _0x16a8da=_0x1045a6['get']({'plain':!![]});fs[_0x0f16('0x63')](_0xf360d4);return BPromise[_0x0f16('0x64')](_0x16a8da['Messages'],function(_0x5b532b,_0x50e4c0){var _0x2ef90d={'from':_0x5b532b[_0x0f16('0x60')],'to':_0x5b532b['to']||_0x0f16('0x65'),'subject':_0x5b532b[_0x0f16('0x61')],'html':htmlEntities[_0x0f16('0x66')](_0x5b532b[_0x0f16('0x3b')]),'headers':{'Date':moment(_0x5b532b[_0x0f16('0x62')])[_0x0f16('0x67')](_0x0f16('0x68'))},'attachments':[]};if(_0x5b532b['cc']){_0x2ef90d['headers']['Cc']=_0x5b532b['cc'];}if(_0x5b532b[_0x0f16('0x69')]){_0x2ef90d[_0x0f16('0x6a')][_0x0f16('0x6b')]=_0x5b532b[_0x0f16('0x69')];}return new BPromise(function(_0x15c4cb,_0xd9ef7b){if(_0x5b532b[_0x0f16('0x6c')]){for(var _0xad4064=0x0;_0xad4064<_0x5b532b['Attachments'][_0x0f16('0x35')];_0xad4064++){var _0x76b0e9=_0x5b532b[_0x0f16('0x6c')][_0xad4064];var _0x517836=path[_0x0f16('0x57')](_0x2d7d12,_0x76b0e9[_0x0f16('0x6d')]);if(fs[_0x0f16('0x6e')](_0x517836)){_0x2ef90d['attachments'][_0x0f16('0x5d')]({'name':_0x76b0e9[_0x0f16('0x20')],'contentType':_0x76b0e9[_0x0f16('0x27')],'data':fs[_0x0f16('0x6f')](_0x517836)});}}}emlformat[_0x0f16('0x70')](_0x2ef90d,function(_0x2babe1,_0x1ced02){if(_0x2babe1)return _0xd9ef7b(_0x2babe1);fs['writeFileSync'](path[_0x0f16('0x57')](_0xf360d4,util[_0x0f16('0x67')](_0x0f16('0x71'),_0x50e4c0)),_0x1ced02);return _0x15c4cb(_0x1ced02);});});})[_0x0f16('0x1d')](function(){return new BPromise(function(_0x5e2567,_0x30c95d){zipdir(_0xf360d4,{'saveTo':_0x383de8},function(_0x4b46aa,_0x444f0f){if(_0x4b46aa)return _0x30c95d(_0x4b46aa);return _0x5e2567(_0x444f0f);});})[_0x0f16('0x1d')](function(){return new BPromise(function(_0x9395b0,_0x470c5e){rimraf(_0xf360d4,function(_0x288e8a){if(_0x288e8a)_0x470c5e(_0x288e8a);return _0x9395b0();});});})[_0x0f16('0x1d')](function(){return _0x55c586[_0x0f16('0x72')](_0x383de8,_0x5880dc,function(_0x20cab9){if(!_0x20cab9)fs[_0x0f16('0x73')](_0x383de8);});});});}else{return _0x55c586[_0x0f16('0x74')](0xc8);}})[_0x0f16('0x2d')](handleError(_0x55c586,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index e618ad1..5dba567 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 _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 +var _0x0a9f=['setMaxListeners','save','remove','getUsers','then','setDataValue','Users','map','unreadMessages','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailMessage'];(function(_0x46ec93,_0x510d83){var _0x2e9221=function(_0x263103){while(--_0x263103){_0x46ec93['push'](_0x46ec93['shift']());}};_0x2e9221(++_0x510d83);}(_0x0a9f,0x19d));var _0xf0a9=function(_0x133f81,_0x550e62){_0x133f81=_0x133f81-0x0;var _0x2eef30=_0x0a9f[_0x133f81];return _0x2eef30;};'use strict';var EventEmitter=require(_0xf0a9('0x0'));var MailInteraction=require(_0xf0a9('0x1'))['db']['MailInteraction'];var MailMessage=require(_0xf0a9('0x1'))['db'][_0xf0a9('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xf0a9('0x3')](0x0);var events={'afterCreate':_0xf0a9('0x4'),'afterUpdate':'update','afterDestroy':_0xf0a9('0x5')};function emitEvent(_0x575986){return function(_0x5d23f7,_0x2de36a,_0x450780){_0x5d23f7[_0xf0a9('0x6')]({'attributes':['id'],'raw':!![]})[_0xf0a9('0x7')](function(_0x36396c){_0x5d23f7[_0xf0a9('0x8')](_0xf0a9('0x9'),_0x36396c[_0xf0a9('0xa')](function(_0x3e5760){return{'id':_0x3e5760['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x5d23f7['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf0a9('0x7')](function(_0x18af34){_0x5d23f7[_0xf0a9('0x8')](_0xf0a9('0xb'),_0x18af34['length']);MailInteractionEvents[_0xf0a9('0xc')](_0x575986+':'+_0x5d23f7['id'],_0x5d23f7);MailInteractionEvents[_0xf0a9('0xc')](_0x575986,_0x5d23f7);_0x450780(null);})['catch'](_0x450780(null));};}for(var e in events){if(events[_0xf0a9('0xd')](e)){var event=events[e];MailInteraction[_0xf0a9('0xe')](e,emitEvent(event));}}module[_0xf0a9('0xf')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index a363358..84d4e55 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 _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 +var _0xfeb5=['closed','closedAt','changed','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0xfeb5,0xe9));var _0x5feb=function(_0x371585,_0x43c516){_0x371585=_0x371585-0x0;var _0x59fb00=_0xfeb5[_0x371585];return _0x59fb00;};'use strict';var _=require(_0x5feb('0x0'));var util=require(_0x5feb('0x1'));var logger=require(_0x5feb('0x2'))(_0x5feb('0x3'));var moment=require(_0x5feb('0x4'));var BPromise=require(_0x5feb('0x5'));var rp=require(_0x5feb('0x6'));var fs=require('fs');var path=require(_0x5feb('0x7'));var rimraf=require(_0x5feb('0x8'));var config=require('../../config/environment');var attributes=require('./mailInteraction.attributes');module[_0x5feb('0x9')]=function(_0x47cadf,_0x4fdde4){return _0x47cadf[_0x5feb('0xa')]('MailInteraction',attributes,{'tableName':_0x5feb('0xb'),'paranoid':![],'indexes':[{'name':_0x5feb('0xc'),'fields':[_0x5feb('0xd'),'to'],'type':_0x5feb('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5e1a5c,_0xaf4b1d,_0x3900df){if(_0x5e1a5c[_0x5feb('0xf')]){_0x5e1a5c[_0x5feb('0x10')]=moment()[_0x5feb('0x11')](_0x5feb('0x12'));}if(_0x5e1a5c[_0x5feb('0x13')]){_0x5e1a5c[_0x5feb('0x14')]=moment()['format'](_0x5feb('0x12'));}_0x3900df(null,_0xaf4b1d);},'beforeUpdate':function(_0x26c1a2,_0x43d1b7,_0x3d07da){if(_0x26c1a2[_0x5feb('0x15')](_0x5feb('0xf'))){_0x26c1a2['substatusAt']=_0x26c1a2[_0x5feb('0xf')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x26c1a2[_0x5feb('0x15')](_0x5feb('0x13'))){_0x26c1a2[_0x5feb('0x14')]=moment()[_0x5feb('0x11')](_0x5feb('0x12'));_0x26c1a2[_0x5feb('0xf')]=null;_0x26c1a2[_0x5feb('0x10')]=null;}_0x3d07da(null,_0x26c1a2);},'afterUpdate':function(_0x424b5d,_0x1adc30,_0xe3fd22){var _0x3b7c0a=_0x47cadf['models'];var _0x26cb9d=_0x424b5d['get']({'plain':!![]});if(_0x26cb9d['closed']){return _0x3b7c0a[_0x5feb('0x16')][_0x5feb('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x26cb9d['id']}})[_0x5feb('0x18')](function(){_0xe3fd22();})[_0x5feb('0x19')](function(_0x569a8e){_0xe3fd22(_0x569a8e);});}else{_0xe3fd22();}}},'charset':_0x5feb('0x1a'),'collate':_0x5feb('0x1b')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index c192b24..4f05c0f 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 _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 +var _0xd6c6=['omit','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateMailInteraction','MailInteraction','body','options','raw','where','attributes','limit','debug','AddTagsToMailInteraction','find','addTags','ids'];(function(_0xd58823,_0x15c483){var _0x249c0a=function(_0x4b8b67){while(--_0x4b8b67){_0xd58823['push'](_0xd58823['shift']());}};_0x249c0a(++_0x15c483);}(_0xd6c6,0xcf));var _0x6d6c=function(_0x57d86a,_0x460fc6){_0x57d86a=_0x57d86a-0x0;var _0x3519c4=_0xd6c6[_0x57d86a];return _0x3519c4;};'use strict';var _=require(_0x6d6c('0x0'));var util=require(_0x6d6c('0x1'));var moment=require(_0x6d6c('0x2'));var BPromise=require(_0x6d6c('0x3'));var rs=require(_0x6d6c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6d6c('0x5'))['db'];var utils=require(_0x6d6c('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x6d6c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6d6c('0x8')][_0x6d6c('0x9')]({'port':0x232a});config[_0x6d6c('0xa')]=_[_0x6d6c('0xb')](config[_0x6d6c('0xa')],{'host':_0x6d6c('0xc'),'port':0x18eb});var socket=require(_0x6d6c('0xd'))(new Redis(config['redis']));require('./mailInteraction.socket')[_0x6d6c('0xe')](socket);function respondWithRpcPromise(_0x255535,_0x3d5eb7,_0x161503){return new BPromise(function(_0x1810ca,_0x24de9b){return client[_0x6d6c('0xf')](_0x255535,_0x161503)[_0x6d6c('0x10')](function(_0x3d0e68){logger[_0x6d6c('0x11')](_0x6d6c('0x12'),_0x3d5eb7,_0x6d6c('0x13'));logger['debug']('MailInteraction,\x20%s,\x20%s,\x20%s',_0x3d5eb7,_0x6d6c('0x13'),JSON[_0x6d6c('0x14')](_0x3d0e68));if(_0x3d0e68[_0x6d6c('0x15')]){if(_0x3d0e68[_0x6d6c('0x15')][_0x6d6c('0x16')]===0x1f4){logger['error'](_0x6d6c('0x12'),_0x3d5eb7,_0x3d0e68[_0x6d6c('0x15')]['message']);return _0x24de9b(_0x3d0e68[_0x6d6c('0x15')]['message']);}logger[_0x6d6c('0x15')](_0x6d6c('0x12'),_0x3d5eb7,_0x3d0e68[_0x6d6c('0x15')][_0x6d6c('0x17')]);return _0x1810ca(_0x3d0e68[_0x6d6c('0x15')][_0x6d6c('0x17')]);}else{logger[_0x6d6c('0x11')](_0x6d6c('0x12'),_0x3d5eb7,_0x6d6c('0x13'));_0x1810ca(_0x3d0e68[_0x6d6c('0x18')][_0x6d6c('0x17')]);}})[_0x6d6c('0x19')](function(_0x3c1bd3){logger[_0x6d6c('0x15')](_0x6d6c('0x12'),_0x3d5eb7,_0x3c1bd3);_0x24de9b(_0x3c1bd3);});});}exports[_0x6d6c('0x1a')]=function(_0x2e333e){var _0x1e268d=this;return new Promise(function(_0x2eaf64,_0x319061){return db[_0x6d6c('0x1b')]['update'](_0x2e333e[_0x6d6c('0x1c')],{'raw':_0x2e333e[_0x6d6c('0x1d')]?_0x2e333e[_0x6d6c('0x1d')][_0x6d6c('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e333e[_0x6d6c('0x1d')]?_0x2e333e[_0x6d6c('0x1d')][_0x6d6c('0x1f')]||null:null,'attributes':_0x2e333e['options']?_0x2e333e['options'][_0x6d6c('0x20')]||null:null,'limit':_0x2e333e[_0x6d6c('0x1d')]?_0x2e333e[_0x6d6c('0x1d')][_0x6d6c('0x21')]||null:null})[_0x6d6c('0x10')](function(_0x22c126){logger[_0x6d6c('0x11')](_0x6d6c('0x1a'),_0x2e333e);logger[_0x6d6c('0x22')]('UpdateMailInteraction',_0x2e333e,JSON[_0x6d6c('0x14')](_0x22c126));_0x2eaf64(_0x22c126);})[_0x6d6c('0x19')](function(_0x12170d){logger[_0x6d6c('0x15')](_0x6d6c('0x1a'),_0x12170d['message'],_0x2e333e);_0x319061(_0x1e268d[_0x6d6c('0x15')](0x1f4,_0x12170d[_0x6d6c('0x17')]));});});};exports[_0x6d6c('0x23')]=function(_0x1c51eb){return new Promise(function(_0x1c6abb,_0x1d73e6){return db['MailInteraction'][_0x6d6c('0x24')]({'where':_0x1c51eb[_0x6d6c('0x1d')]?_0x1c51eb[_0x6d6c('0x1d')]['where']||null:null})[_0x6d6c('0x10')](function(_0x50649b){if(_0x50649b){return _0x50649b[_0x6d6c('0x25')](_0x1c51eb[_0x6d6c('0x1c')][_0x6d6c('0x26')],_[_0x6d6c('0x27')](_0x1c51eb[_0x6d6c('0x1c')],[_0x6d6c('0x26'),'id'])||{});}})['spread'](function(_0x5824e9){logger[_0x6d6c('0x11')]('AddTags',_0x1c51eb);logger[_0x6d6c('0x22')](_0x6d6c('0x28'),_0x1c51eb,JSON[_0x6d6c('0x14')](_0x5824e9));_0x1c6abb(_0x5824e9);})['catch'](function(_0x502c03){logger[_0x6d6c('0x15')](_0x6d6c('0x28'),_0x502c03[_0x6d6c('0x17')],_0x1c51eb);_0x1d73e6(_this['error'](0x1f4,_0x502c03[_0x6d6c('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 9e283ca..022a49a 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 _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 +var _0x6379=['removeListener','register','length','mailInteraction:','./mailInteraction.events','save','remove','update','emit'];(function(_0x567a15,_0x5be023){var _0x692e0=function(_0x4fd627){while(--_0x4fd627){_0x567a15['push'](_0x567a15['shift']());}};_0x692e0(++_0x5be023);}(_0x6379,0x163));var _0x9637=function(_0x2badfc,_0x21dec9){_0x2badfc=_0x2badfc-0x0;var _0x29f9cb=_0x6379[_0x2badfc];return _0x29f9cb;};'use strict';var MailInteractionEvents=require(_0x9637('0x0'));var events=[_0x9637('0x1'),_0x9637('0x2'),_0x9637('0x3')];function createListener(_0x27b2e6,_0x169dbf){return function(_0x42fd65){_0x169dbf[_0x9637('0x4')](_0x27b2e6,_0x42fd65);};}function removeListener(_0x25c188,_0x234984){return function(){MailInteractionEvents[_0x9637('0x5')](_0x25c188,_0x234984);};}exports[_0x9637('0x6')]=function(_0xea477e){for(var _0x485452=0x0,_0x5cfe81=events[_0x9637('0x7')];_0x485452<_0x5cfe81;_0x485452++){var _0x1b5118=events[_0x485452];var _0x8229b5=createListener(_0x9637('0x8')+_0x1b5118,_0xea477e);MailInteractionEvents['on'](_0x1b5118,_0x8229b5);}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/index.js b/server/api/mailInteractionHasTag/index.js index 87a28f2..d612df9 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 _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 +var _0x10ad=['/describe','isAuthenticated','describe','exports','./mailInteractionHasTag.controller'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x10ad,0xf4));var _0xd10a=function(_0x164ff0,_0x43b732){_0x164ff0=_0x164ff0-0x0;var _0x29166a=_0x10ad[_0x164ff0];return _0x29166a;};'use strict';var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0xd10a('0x0'));router['get'](_0xd10a('0x1'),auth[_0xd10a('0x2')](),controller[_0xd10a('0x3')]);module[_0xd10a('0x4')]=router; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js index 6c60c65..1d7819b 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(_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 +var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x1ec405,_0x38fec1){var _0x57d3fd=function(_0x294fa8){while(--_0x294fa8){_0x1ec405['push'](_0x1ec405['shift']());}};_0x57d3fd(++_0x38fec1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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 45ee278..01d0068 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 _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 +var _0x6b28=['exports','INTEGER','sequelize'];(function(_0x10a93f,_0x43d92d){var _0x54ca84=function(_0x1e077b){while(--_0x1e077b){_0x10a93f['push'](_0x10a93f['shift']());}};_0x54ca84(++_0x43d92d);}(_0x6b28,0xa7));var _0x86b2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6b28[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x86b2('0x0'));module[_0x86b2('0x1')]={'MailInteractionId':{'type':Sequelize[_0x86b2('0x2')],'primaryKey':!![]},'TagId':{'type':Sequelize['INTEGER'],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js index 8915ca1..9f5f845 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 _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 +var _0xdf81=['define','MailInteractionHasTag','mail_interaction_has_tags','./mailInteractionHasTag','exports'];(function(_0x2d81ac,_0x33fa12){var _0x1f1ddf=function(_0x59b380){while(--_0x59b380){_0x2d81ac['push'](_0x2d81ac['shift']());}};_0x1f1ddf(++_0x33fa12);}(_0xdf81,0x9e));var _0x1df8=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0xdf81[_0x25e7cb];return _0x375d92;};'use strict';var attributes=require(_0x1df8('0x0'));module[_0x1df8('0x1')]=function(_0x93467f){return _0x93467f[_0x1df8('0x2')](_0x1df8('0x3'),attributes,{'tableName':_0x1df8('0x4'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 71f8d49..276bea4 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 _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 +var _0xb74d=['update','/:id/accept','accept','/:id/reject','delete','destroy','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./mailMessage.controller','get','isAuthenticated','/describe','describe','/:id/download','download','post','mailmessage:create','create','put','/:id'];(function(_0x3bd9da,_0x1531f3){var _0x4860fd=function(_0x3b616c){while(--_0x3b616c){_0x3bd9da['push'](_0x3bd9da['shift']());}};_0x4860fd(++_0x1531f3);}(_0xb74d,0x16e));var _0xdb74=function(_0x5f42f1,_0x956be5){_0x5f42f1=_0x5f42f1-0x0;var _0x5534ee=_0xb74d[_0x5f42f1];return _0x5534ee;};'use strict';var multer=require(_0xdb74('0x0'));var util=require('util');var path=require(_0xdb74('0x1'));var timeout=require('connect-timeout');var express=require(_0xdb74('0x2'));var router=express['Router']();var fs_extra=require(_0xdb74('0x3'));var auth=require(_0xdb74('0x4'));var interaction=require(_0xdb74('0x5'));var config=require('../../config/environment');var controller=require(_0xdb74('0x6'));router[_0xdb74('0x7')]('/',auth[_0xdb74('0x8')](),controller['index']);router['get'](_0xdb74('0x9'),auth['isAuthenticated'](),controller[_0xdb74('0xa')]);router[_0xdb74('0x7')]('/:id',auth[_0xdb74('0x8')](),controller['show']);router[_0xdb74('0x7')](_0xdb74('0xb'),auth['isAuthenticated'](),controller[_0xdb74('0xc')]);router[_0xdb74('0xd')]('/',auth[_0xdb74('0x8')](),interaction['tracked']('mail',_0xdb74('0xe')),controller[_0xdb74('0xf')]);router[_0xdb74('0x10')](_0xdb74('0x11'),auth[_0xdb74('0x8')](),controller[_0xdb74('0x12')]);router[_0xdb74('0x10')](_0xdb74('0x13'),auth[_0xdb74('0x8')](),controller[_0xdb74('0x14')]);router[_0xdb74('0x10')](_0xdb74('0x15'),auth[_0xdb74('0x8')](),controller['reject']);router[_0xdb74('0x16')](_0xdb74('0x11'),auth[_0xdb74('0x8')](),controller[_0xdb74('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 898d070..a248287 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 _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 +var _0x566c=['INTEGER','ENUM','Email','Chat','lodash','exports','TEXT','medium','BOOLEAN','out','STRING','long','DATE'];(function(_0x3581ad,_0x2a7a3c){var _0x5a939c=function(_0x3dd4c5){while(--_0x3dd4c5){_0x3581ad['push'](_0x3581ad['shift']());}};_0x5a939c(++_0x2a7a3c);}(_0x566c,0xba));var _0xc566=function(_0x4ab71b,_0xc8f411){_0x4ab71b=_0x4ab71b-0x0;var _0x1805d9=_0x566c[_0x4ab71b];return _0x1805d9;};'use strict';var Sequelize=require('sequelize');var _=require(_0xc566('0x0'));module[_0xc566('0x1')]={'body':{'type':Sequelize['TEXT']('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xc566('0x2')](_0xc566('0x3'))},'read':{'type':Sequelize[_0xc566('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xc566('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xc566('0x6')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xc566('0x2')](_0xc566('0x7'))},'cc':{'type':Sequelize[_0xc566('0x2')]('long')},'bcc':{'type':Sequelize[_0xc566('0x2')](_0xc566('0x7'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0xc566('0x8')]},'attach':{'type':Sequelize[_0xc566('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0xc566('0x8')]},'originTo':{'type':Sequelize['TEXT'](_0xc566('0x7'))},'originCc':{'type':Sequelize['TEXT'](_0xc566('0x7'))},'originChannel':{'type':Sequelize[_0xc566('0xa')](_0xc566('0xb'),_0xc566('0xc')),'defaultValue':_0xc566('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 3f12af8..24765ea 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 _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 +var _0x7a2f=['stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','contact','User','fullname','email','internal','manual','interface','channel','EventManager','acceptmessage','reject','RejectMessage','rejectMessage','ContactId','Sequelize','SIP/%s','motionChannel','fromString','unix','toString','server','files','bcc','subject','createdAt','Attachment','Attachments','from','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','existsSync','push','readFileSync','writeFileSync','download','unlinkSync','eml-format','moment','bluebird','util','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','mail-interactions','../../mysqldb','defaults','redis','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','client','http','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','json','offset','limit','undefined','count','status','set','Content-Range','update','destroy','end','sendStatus','stack','name','send','index','map','MailMessage','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','options','includeAll','include','rows','show','params','keys','find','body','create','out','secret','split','findOne','MailAccountId','List','CmContact','Contacts','updatedAt','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','server/files/attachments','basename','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','UserId','user','agent','get','MailInteraction','MailInteractionId','isNil','read1stAt','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x7a2f,0x170));var _0xf7a2=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x7a2f[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require(_0xf7a2('0x0'));var moment=require(_0xf7a2('0x1'));var BPromise=require(_0xf7a2('0x2'));var util=require(_0xf7a2('0x3'));var path=require(_0xf7a2('0x4'));var fs=require('fs');var _=require(_0xf7a2('0x5'));var Redis=require(_0xf7a2('0x6'));var htmlToText=require(_0xf7a2('0x7'));var qs=require(_0xf7a2('0x8'));var logger=require(_0xf7a2('0x9'))('api');var interaction_log=require(_0xf7a2('0x9'))(_0xf7a2('0xa'));var config=require('../../config/environment');var db=require(_0xf7a2('0xb'))['db'];config['redis']=_[_0xf7a2('0xc')](config[_0xf7a2('0xd')],{'host':_0xf7a2('0xe'),'port':0x18eb});var socket=require(_0xf7a2('0xf'))(new Redis(config['redis']));var htmlEntities=require(_0xf7a2('0x10'));require(_0xf7a2('0x11'))[_0xf7a2('0x12')](socket);var jayson=require(_0xf7a2('0x13'));var client=jayson[_0xf7a2('0x14')][_0xf7a2('0x15')]({'port':0x232c});var client9003=jayson['client'][_0xf7a2('0x15')]({'port':0x232b});var client9002=jayson[_0xf7a2('0x14')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32e647,_0x23c18f,_0x234904,_0x1ae248){return new BPromise(function(_0x4e4aac,_0x103b41){var _0xcc1ea5=_0x1ae248||client;return _0xcc1ea5[_0xf7a2('0x16')](_0x32e647,_0x234904)[_0xf7a2('0x17')](function(_0x57b3a7){logger['info'](_0xf7a2('0x18'),_0x23c18f,_0xf7a2('0x19'));logger['debug']('MailMessage,\x20%s,\x20%s,\x20%s',_0x23c18f,'request\x20sent',JSON['stringify'](_0x57b3a7));if(_0x57b3a7['error']){if(_0x57b3a7[_0xf7a2('0x1a')][_0xf7a2('0x1b')]===0x1f4){logger[_0xf7a2('0x1a')](_0xf7a2('0x18'),_0x23c18f,_0x57b3a7[_0xf7a2('0x1a')][_0xf7a2('0x1c')]);return _0x103b41(_0x57b3a7[_0xf7a2('0x1a')][_0xf7a2('0x1c')]);}logger[_0xf7a2('0x1a')]('MailMessage,\x20%s,\x20%s',_0x23c18f,_0x57b3a7[_0xf7a2('0x1a')][_0xf7a2('0x1c')]);return _0x4e4aac(_0x57b3a7[_0xf7a2('0x1a')]['message']);}else{logger[_0xf7a2('0x1d')](_0xf7a2('0x18'),_0x23c18f,_0xf7a2('0x19'));_0x4e4aac(_0x57b3a7[_0xf7a2('0x1e')][_0xf7a2('0x1c')]);}})[_0xf7a2('0x1f')](function(_0x2706d0){logger[_0xf7a2('0x1a')]('MailMessage,\x20%s,\x20%s',_0x23c18f,_0x2706d0);_0x103b41(_0x2706d0);});});}function respondWithResult(_0x4bc12b,_0x820bf){_0x820bf=_0x820bf||0xc8;return function(_0x36246b){if(_0x36246b){return _0x4bc12b['status'](_0x820bf)[_0xf7a2('0x20')](_0x36246b);}};}function respondWithFilteredResult(_0xd4ef80,_0x478d45){return function(_0x402df0){if(_0x402df0){var _0x5955f1=typeof _0x478d45[_0xf7a2('0x21')]==='undefined'&&typeof _0x478d45[_0xf7a2('0x22')]===_0xf7a2('0x23');var _0x17b5fd=_0x402df0['count'];var _0x1b3957=_0x5955f1?0x0:_0x478d45[_0xf7a2('0x21')];var _0x220d93=_0x5955f1?_0x402df0[_0xf7a2('0x24')]:_0x478d45['offset']+_0x478d45[_0xf7a2('0x22')];var _0x2a563c;if(_0x220d93>=_0x17b5fd){_0x220d93=_0x17b5fd;_0x2a563c=0xc8;}else{_0x2a563c=0xce;}_0xd4ef80[_0xf7a2('0x25')](_0x2a563c);return _0xd4ef80[_0xf7a2('0x26')](_0xf7a2('0x27'),_0x1b3957+'-'+_0x220d93+'/'+_0x17b5fd)[_0xf7a2('0x20')](_0x402df0);}return null;};}function saveUpdates(_0x33c3d9){return function(_0x26c26a){if(_0x26c26a){return _0x26c26a[_0xf7a2('0x28')](_0x33c3d9)[_0xf7a2('0x17')](function(_0x51f6a1){return _0x51f6a1;});}return null;};}function removeEntity(_0xc77255){return function(_0x525866){if(_0x525866){return _0x525866[_0xf7a2('0x29')]()[_0xf7a2('0x17')](function(){_0xc77255[_0xf7a2('0x25')](0xcc)[_0xf7a2('0x2a')]();});}};}function handleEntityNotFound(_0x31464a){return function(_0x5ed456){if(!_0x5ed456){_0x31464a[_0xf7a2('0x2b')](0x194);}return _0x5ed456;};}function handleError(_0x19babb,_0x1b45e6){_0x1b45e6=_0x1b45e6||0x1f4;return function(_0xfc6e6a){logger[_0xf7a2('0x1a')](_0xfc6e6a[_0xf7a2('0x2c')]);if(_0xfc6e6a[_0xf7a2('0x2d')]){delete _0xfc6e6a['name'];}_0x19babb[_0xf7a2('0x25')](_0x1b45e6)[_0xf7a2('0x2e')](_0xfc6e6a);};}exports[_0xf7a2('0x2f')]=function(_0x3f0e1b,_0x41d08b){var _0x4bcc0a={},_0x3d063e={},_0x1f3cd3={'count':0x0,'rows':[]};var _0x2d1fc3=_[_0xf7a2('0x30')](db[_0xf7a2('0x31')][_0xf7a2('0x32')],function(_0x5e324c){return{'name':_0x5e324c[_0xf7a2('0x33')],'type':_0x5e324c[_0xf7a2('0x34')]['key']};});_0x3d063e[_0xf7a2('0x35')]=_[_0xf7a2('0x30')](_0x2d1fc3,'name');_0x3d063e[_0xf7a2('0x36')]=_['keys'](_0x3f0e1b['query']);_0x3d063e[_0xf7a2('0x37')]=_[_0xf7a2('0x38')](_0x3d063e['model'],_0x3d063e[_0xf7a2('0x36')]);_0x4bcc0a[_0xf7a2('0x39')]=_['intersection'](_0x3d063e['model'],qs[_0xf7a2('0x3a')](_0x3f0e1b['query'][_0xf7a2('0x3a')]));_0x4bcc0a['attributes']=_0x4bcc0a[_0xf7a2('0x39')][_0xf7a2('0x3b')]?_0x4bcc0a[_0xf7a2('0x39')]:_0x3d063e[_0xf7a2('0x35')];if(!_0x3f0e1b[_0xf7a2('0x36')][_0xf7a2('0x3c')](_0xf7a2('0x3d'))){_0x4bcc0a[_0xf7a2('0x22')]=qs[_0xf7a2('0x22')](_0x3f0e1b[_0xf7a2('0x36')]['limit']);_0x4bcc0a[_0xf7a2('0x21')]=qs[_0xf7a2('0x21')](_0x3f0e1b['query'][_0xf7a2('0x21')]);}_0x4bcc0a[_0xf7a2('0x3e')]=qs[_0xf7a2('0x3f')](_0x3f0e1b['query'][_0xf7a2('0x3f')]);_0x4bcc0a[_0xf7a2('0x40')]=qs[_0xf7a2('0x37')](_[_0xf7a2('0x41')](_0x3f0e1b[_0xf7a2('0x36')],_0x3d063e[_0xf7a2('0x37')]),_0x2d1fc3);if(_0x3f0e1b['query']['filter']){_0x4bcc0a[_0xf7a2('0x40')]=_['merge'](_0x4bcc0a['where'],{'$or':_[_0xf7a2('0x30')](_0x2d1fc3,function(_0x10d79e){if(_0x10d79e[_0xf7a2('0x34')]!==_0xf7a2('0x42')){var _0x4f9bba={};_0x4f9bba[_0x10d79e['name']]={'$like':'%'+_0x3f0e1b[_0xf7a2('0x36')]['filter']+'%'};return _0x4f9bba;}})});}_0x4bcc0a=_[_0xf7a2('0x43')]({},_0x4bcc0a,_0x3f0e1b[_0xf7a2('0x44')]);var _0x55c93e={'where':_0x4bcc0a['where']};return db[_0xf7a2('0x31')][_0xf7a2('0x24')](_0x55c93e)['then'](function(_0x58d49a){_0x1f3cd3['count']=_0x58d49a;if(_0x3f0e1b['query'][_0xf7a2('0x45')]){_0x4bcc0a[_0xf7a2('0x46')]=[{'all':!![]}];}return db[_0xf7a2('0x31')]['findAll'](_0x4bcc0a);})[_0xf7a2('0x17')](function(_0x52ca48){_0x1f3cd3[_0xf7a2('0x47')]=_0x52ca48;return _0x1f3cd3;})[_0xf7a2('0x17')](respondWithFilteredResult(_0x41d08b,_0x4bcc0a))['catch'](handleError(_0x41d08b,null));};exports[_0xf7a2('0x48')]=function(_0x5d7057,_0x4e7ccf){var _0x12af30={'raw':!![],'where':{'id':_0x5d7057[_0xf7a2('0x49')]['id']}},_0x17e5c2={};_0x17e5c2[_0xf7a2('0x35')]=_[_0xf7a2('0x4a')](db[_0xf7a2('0x31')][_0xf7a2('0x32')]);_0x17e5c2[_0xf7a2('0x36')]=_['keys'](_0x5d7057['query']);_0x17e5c2[_0xf7a2('0x37')]=_['intersection'](_0x17e5c2[_0xf7a2('0x35')],_0x17e5c2[_0xf7a2('0x36')]);_0x12af30['attributes']=_[_0xf7a2('0x38')](_0x17e5c2[_0xf7a2('0x35')],qs['fields'](_0x5d7057[_0xf7a2('0x36')][_0xf7a2('0x3a')]));_0x12af30[_0xf7a2('0x39')]=_0x12af30[_0xf7a2('0x39')]['length']?_0x12af30[_0xf7a2('0x39')]:_0x17e5c2['model'];if(_0x5d7057[_0xf7a2('0x36')][_0xf7a2('0x45')]){_0x12af30[_0xf7a2('0x46')]=[{'all':!![]}];}_0x12af30=_[_0xf7a2('0x43')]({},_0x12af30,_0x5d7057[_0xf7a2('0x44')]);return db['MailMessage'][_0xf7a2('0x4b')](_0x12af30)['then'](handleEntityNotFound(_0x4e7ccf,null))[_0xf7a2('0x17')](respondWithResult(_0x4e7ccf,null))['catch'](handleError(_0x4e7ccf,null));};exports['update']=function(_0x9fc3fd,_0x2433fd){if(_0x9fc3fd[_0xf7a2('0x4c')]['id']){delete _0x9fc3fd[_0xf7a2('0x4c')]['id'];}return db['MailMessage'][_0xf7a2('0x4b')]({'where':{'id':_0x9fc3fd['params']['id']}})[_0xf7a2('0x17')](handleEntityNotFound(_0x2433fd,null))['then'](saveUpdates(_0x9fc3fd['body'],null))[_0xf7a2('0x17')](respondWithResult(_0x2433fd,null))[_0xf7a2('0x1f')](handleError(_0x2433fd,null));};exports[_0xf7a2('0x29')]=function(_0x4c328f,_0x4e8582){return db[_0xf7a2('0x31')][_0xf7a2('0x4b')]({'where':{'id':_0x4c328f[_0xf7a2('0x49')]['id']}})[_0xf7a2('0x17')](handleEntityNotFound(_0x4e8582,null))['then'](removeEntity(_0x4e8582,null))[_0xf7a2('0x1f')](handleError(_0x4e8582,null));};exports['describe']=function(_0x12c0f4,_0x1c3caf){return db[_0xf7a2('0x31')]['describe']()[_0xf7a2('0x17')](respondWithResult(_0x1c3caf,null))[_0xf7a2('0x1f')](handleError(_0x1c3caf,null));};exports[_0xf7a2('0x4d')]=function(_0x9a7984,_0x1f1564){return db[_0xf7a2('0x31')][_0xf7a2('0x4d')](_0x9a7984[_0xf7a2('0x4c')])['then'](function(_0x112392){if(_0x112392){if(_0x112392['direction']===_0xf7a2('0x4e')&&!_0x112392[_0xf7a2('0x4f')]){var _0x3932fd,_0x473c25,_0x231abf;if(_0x9a7984['body']['to']){_0x473c25=_0x9a7984[_0xf7a2('0x4c')]['to'][_0xf7a2('0x50')](',')[0x0];}return db['MailAccount'][_0xf7a2('0x51')]({'where':{'id':_0x112392[_0xf7a2('0x52')]},'include':[{'model':db['CmList'],'as':_0xf7a2('0x53'),'include':[{'model':db[_0xf7a2('0x54')],'as':_0xf7a2('0x55'),'where':{'email':_0x473c25},'limit':0x1,'order':[[_0xf7a2('0x56'),'DESC']]}]},{'model':db[_0xf7a2('0x57')],'as':_0xf7a2('0x58'),'raw':!![],'include':[{'model':db[_0xf7a2('0x59')],'as':'CloudProvider','raw':!![]}]}]})['then'](function(_0x1e6de9){_0x3932fd=_0x1e6de9;if(!_0x3932fd||!_0x3932fd[_0xf7a2('0x58')])return;var _0x37c5f0=_0x3932fd[_0xf7a2('0x5a')]();if(_0x9a7984[_0xf7a2('0x4c')][_0xf7a2('0x5b')]&&_0x9a7984[_0xf7a2('0x4c')]['attachments'][_0xf7a2('0x3b')]){for(var _0x4f8feb=0x0;_0x4f8feb<_0x9a7984[_0xf7a2('0x4c')]['attachments'][_0xf7a2('0x3b')];_0x4f8feb+=0x1){_0x9a7984[_0xf7a2('0x4c')][_0xf7a2('0x5b')][_0x4f8feb]={'filename':_0x9a7984[_0xf7a2('0x4c')][_0xf7a2('0x5b')][_0x4f8feb][_0xf7a2('0x2d')],'path':path[_0xf7a2('0x5c')](config[_0xf7a2('0x5d')],_0xf7a2('0x5e'),_0x9a7984[_0xf7a2('0x4c')]['attachments'][_0x4f8feb][_0xf7a2('0x5f')])};}}_0x231abf={'account':_0x37c5f0,'message':_0x9a7984[_0xf7a2('0x4c')]};return;})[_0xf7a2('0x17')](function(){if(_0x3932fd[_0xf7a2('0x53')]){if(_0x3932fd[_0xf7a2('0x53')]['Contacts'][_0xf7a2('0x3b')]){return _0x3932fd[_0xf7a2('0x53')][_0xf7a2('0x55')][0x0];}else{return db[_0xf7a2('0x54')]['create'](_['defaults'](_0x9a7984[_0xf7a2('0x4c')],{'firstName':_0x9a7984['body']['to'],'email':_0x9a7984[_0xf7a2('0x4c')]['to'],'phone':_0x9a7984[_0xf7a2('0x4c')]['to'],'ListId':_0x3932fd[_0xf7a2('0x60')]}));}}else{throw new Error(_0xf7a2('0x61'));}})['then'](function(){if(_0x231abf){return respondWithRpcPromise(_0xf7a2('0x62'),_0xf7a2('0x63'),_0x231abf,client9003)[_0xf7a2('0x17')](function(_0x4a22d7){return _0x112392['update']({'read':!![],'messageId':_0x4a22d7[_0xf7a2('0x64')],'sentAt':moment()[_0xf7a2('0x65')](_0xf7a2('0x66'))});})['catch'](function(_0x203613){logger[_0xf7a2('0x1a')]('%s',JSON['stringify'](_0x203613));return _0x112392;});}return _0x112392;});}return _0x112392;}})[_0xf7a2('0x17')](respondWithResult(_0x1f1564,0xc9))[_0xf7a2('0x1f')](handleError(_0x1f1564,null));};exports[_0xf7a2('0x67')]=function(_0x41c1c5,_0x4aaa6c){var _0x1abc8a={'agent':{},'channel':_0xf7a2('0x68')};if(_0x41c1c5['body']['id']){delete _0x41c1c5[_0xf7a2('0x4c')]['id'];}_0x41c1c5['body'][_0xf7a2('0x69')]=!![];_0x41c1c5[_0xf7a2('0x4c')][_0xf7a2('0x6a')]=moment()['format'](_0xf7a2('0x66'));_0x41c1c5[_0xf7a2('0x4c')][_0xf7a2('0x6b')]=_0x41c1c5[_0xf7a2('0x4c')][_0xf7a2('0x6b')]||_0x41c1c5[_0xf7a2('0x6c')]['id'];_0x1abc8a[_0xf7a2('0x6d')]['id']=_0x41c1c5[_0xf7a2('0x4c')][_0xf7a2('0x6b')];return db[_0xf7a2('0x31')][_0xf7a2('0x4b')]({'where':{'id':_0x41c1c5[_0xf7a2('0x49')]['id'],'UserId':null}})[_0xf7a2('0x17')](handleEntityNotFound(_0x4aaa6c,null))['then'](saveUpdates(_0x41c1c5[_0xf7a2('0x4c')],null))[_0xf7a2('0x17')](function(_0x1e087f){if(_0x1e087f){_0x1abc8a[_0xf7a2('0x1c')]=_0x1e087f[_0xf7a2('0x6e')]({'plain':!![]});return db[_0xf7a2('0x6f')][_0xf7a2('0x4b')]({'where':{'id':_0x1e087f[_0xf7a2('0x70')]}});}return null;})[_0xf7a2('0x17')](handleEntityNotFound(_0x4aaa6c,null))[_0xf7a2('0x17')](function(_0x3a1d5b){if(_0x3a1d5b){return _0x3a1d5b[_0xf7a2('0x28')]({'UserId':_0x41c1c5[_0xf7a2('0x4c')][_0xf7a2('0x6b')],'read1stAt':_[_0xf7a2('0x71')](_0x3a1d5b[_0xf7a2('0x72')])?moment()[_0xf7a2('0x65')](_0xf7a2('0x66')):undefined});}return null;})[_0xf7a2('0x17')](function(_0x4d0ec0){if(_0x4d0ec0){_0x1abc8a['interaction']=_0x4d0ec0[_0xf7a2('0x6e')]({'plain':!![]});interaction_log['info'](_0xf7a2('0x73'),_0x41c1c5[_0xf7a2('0x6c')]['id'],_0x41c1c5[_0xf7a2('0x6c')][_0xf7a2('0x2d')],_0x41c1c5['user'][_0xf7a2('0x74')],_0x1abc8a[_0xf7a2('0x75')]['id'],_0x41c1c5[_0xf7a2('0x4c')]?JSON[_0xf7a2('0x76')](_0x41c1c5[_0xf7a2('0x4c')]):_0xf7a2('0x77'));return respondWithRpcPromise(_0xf7a2('0x78'),_0xf7a2('0x79'),_0x1abc8a);}return null;})[_0xf7a2('0x17')](function(_0x3737c7){var _0x158e59=_0xf7a2('0x7a')+_0x3737c7['message']['ContactId'];return db[_0xf7a2('0x7b')][_0xf7a2('0x36')](_0x158e59,{'type':db['Sequelize'][_0xf7a2('0x7c')]['SELECT'],'raw':!![]})[_0xf7a2('0x17')](function(_0x4a26ee){return _0x4a26ee;});})[_0xf7a2('0x17')](function(_0x196a39){if(_0x196a39){_0x1abc8a['message'][_0xf7a2('0x7d')]=_0x196a39[0x0];if(!_0x41c1c5[_0xf7a2('0x4c')][_0xf7a2('0x6b')])return;return db[_0xf7a2('0x7e')][_0xf7a2('0x4b')]({'where':{'id':_0x41c1c5[_0xf7a2('0x4c')][_0xf7a2('0x6b')],'role':_0xf7a2('0x6d')},'attributes':['id',_0xf7a2('0x2d'),_0xf7a2('0x7f'),_0xf7a2('0x80'),_0xf7a2('0x81')],'raw':!![]});}return null;})['then'](function(_0x3bec8f){if(!_0x3bec8f)return null;_0x1abc8a[_0xf7a2('0x1c')][_0xf7a2('0x6d')]=_0x3bec8f;return _0x1abc8a;})[_0xf7a2('0x17')](function(_0x124eb8){if(_0x124eb8){if(_0x41c1c5[_0xf7a2('0x4c')][_0xf7a2('0x82')]){_0x1abc8a['message'][_0xf7a2('0x83')]=util[_0xf7a2('0x65')]('SIP/%s',_0x41c1c5[_0xf7a2('0x6c')]['name']);_0x1abc8a[_0xf7a2('0x1c')]['channel']=_0x1abc8a['channel'];_0x1abc8a['message']['motionChannel']=_0x1abc8a[_0xf7a2('0x84')];_0x1abc8a['message']['event']=_0xf7a2('0x67');_0x1abc8a[_0xf7a2('0x1c')]['body']=htmlToText['fromString'](_0x1abc8a[_0xf7a2('0x1c')][_0xf7a2('0x4c')]);return respondWithRpcPromise(_0xf7a2('0x85'),'EventManager',{'event':_0xf7a2('0x86'),'message':_0x1abc8a[_0xf7a2('0x1c')]},client9002)['then'](function(){return _0x1abc8a;});}return _0x1abc8a;}return null;})[_0xf7a2('0x17')](respondWithResult(_0x4aaa6c,null))['catch'](handleError(_0x4aaa6c,null));};exports[_0xf7a2('0x87')]=function(_0x2b2fad,_0x28f81e){var _0x3616b2={'agent':{},'channel':_0xf7a2('0x68')};if(_0x2b2fad[_0xf7a2('0x4c')]['id']){delete _0x2b2fad['body']['id'];}_0x2b2fad[_0xf7a2('0x4c')]['UserId']=_0x2b2fad[_0xf7a2('0x4c')][_0xf7a2('0x6b')]||_0x2b2fad['user']['id'];_0x3616b2[_0xf7a2('0x6d')]['id']=_0x2b2fad['body']['UserId'];return db[_0xf7a2('0x31')]['find']({'where':{'id':_0x2b2fad['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x28f81e,null))[_0xf7a2('0x17')](function(_0x1f8cc6){if(_0x1f8cc6){_0x3616b2[_0xf7a2('0x1c')]=_0x1f8cc6[_0xf7a2('0x6e')]({'plain':!![]});return db[_0xf7a2('0x6f')][_0xf7a2('0x4b')]({'where':{'id':_0x1f8cc6[_0xf7a2('0x70')]}});}return null;})[_0xf7a2('0x17')](handleEntityNotFound(_0x28f81e,null))[_0xf7a2('0x17')](function(_0x2f5e89){if(_0x2f5e89){_0x3616b2[_0xf7a2('0x75')]=_0x2f5e89[_0xf7a2('0x6e')]({'plain':!![]});interaction_log['info']('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2b2fad[_0xf7a2('0x6c')]['id'],_0x2b2fad[_0xf7a2('0x6c')][_0xf7a2('0x2d')],_0x2b2fad['user'][_0xf7a2('0x74')],_0x3616b2[_0xf7a2('0x75')]['id'],_0x2b2fad[_0xf7a2('0x4c')]?JSON[_0xf7a2('0x76')](_0x2b2fad[_0xf7a2('0x4c')]):_0xf7a2('0x77'));return respondWithRpcPromise(_0xf7a2('0x88'),_0xf7a2('0x89'),_0x3616b2);}return null;})['then'](function(_0x2965cb){var _0x6e33f0=_0xf7a2('0x7a')+_0x2965cb[_0xf7a2('0x1c')][_0xf7a2('0x8a')];return db['sequelize'][_0xf7a2('0x36')](_0x6e33f0,{'type':db[_0xf7a2('0x8b')][_0xf7a2('0x7c')]['SELECT'],'raw':!![]})[_0xf7a2('0x17')](function(_0x55a74c){return _0x55a74c;});})[_0xf7a2('0x17')](function(_0x57bd10){if(_0x57bd10){_0x3616b2[_0xf7a2('0x1c')][_0xf7a2('0x7d')]=_0x57bd10[0x0];if(!_0x2b2fad[_0xf7a2('0x4c')]['UserId'])return;return db[_0xf7a2('0x7e')][_0xf7a2('0x4b')]({'where':{'id':_0x2b2fad['body']['UserId'],'role':_0xf7a2('0x6d')},'attributes':['id',_0xf7a2('0x2d'),_0xf7a2('0x7f'),_0xf7a2('0x80'),_0xf7a2('0x81')],'raw':!![]});}return null;})[_0xf7a2('0x17')](function(_0x175fd0){if(!_0x175fd0)return null;_0x3616b2[_0xf7a2('0x1c')][_0xf7a2('0x6d')]=_0x175fd0;return _0x3616b2;})['then'](function(_0x962412){if(_0x962412){_0x962412[_0xf7a2('0x1c')][_0xf7a2('0x83')]=util[_0xf7a2('0x65')](_0xf7a2('0x8c'),_0x2b2fad['user'][_0xf7a2('0x2d')]);_0x962412['message']['channel']=_0x3616b2[_0xf7a2('0x84')];_0x962412['message'][_0xf7a2('0x8d')]=_0x3616b2[_0xf7a2('0x84')];_0x962412[_0xf7a2('0x1c')]['event']=_0xf7a2('0x87');_0x962412[_0xf7a2('0x1c')][_0xf7a2('0x4c')]=htmlToText[_0xf7a2('0x8e')](_0x3616b2[_0xf7a2('0x1c')]['body']);respondWithRpcPromise('EventManager',_0xf7a2('0x85'),{'event':'rejectmessage','message':_0x962412[_0xf7a2('0x1c')]},client9002);return _0x3616b2;}return null;})[_0xf7a2('0x17')](respondWithResult(_0x28f81e,null))[_0xf7a2('0x1f')](handleError(_0x28f81e,null));};exports['download']=function(_0x1154c1,_0x402ab7){var _0x18f447=moment()[_0xf7a2('0x8f')]()[_0xf7a2('0x90')]();var _0x44afca=path[_0xf7a2('0x5c')](config[_0xf7a2('0x5d')],_0xf7a2('0x91'),_0xf7a2('0x92'),'tmp');var _0x2446c4=path[_0xf7a2('0x5c')](config[_0xf7a2('0x5d')],_0xf7a2('0x91'),_0xf7a2('0x92'),_0xf7a2('0x5b'));var _0x4e986f=util[_0xf7a2('0x65')]('message-%s.eml',_0x18f447);return db[_0xf7a2('0x31')][_0xf7a2('0x4b')]({'where':{'id':_0x1154c1[_0xf7a2('0x49')]['id']},'attributes':['id',_0xf7a2('0x4c'),'from','to','cc',_0xf7a2('0x93'),_0xf7a2('0x94'),_0xf7a2('0x95')],'include':_0x1154c1[_0xf7a2('0x36')][_0xf7a2('0x5b')]?[{'model':db[_0xf7a2('0x96')],'as':_0xf7a2('0x97')}]:undefined})[_0xf7a2('0x17')](handleEntityNotFound(_0x402ab7,null))[_0xf7a2('0x17')](function(_0x113cda){if(_0x113cda){var _0x1448d0=_0x113cda;var _0x4ba236={'from':_0x1448d0[_0xf7a2('0x98')],'to':_0x1448d0['to'],'subject':_0x1448d0[_0xf7a2('0x94')],'html':htmlEntities[_0xf7a2('0x99')](_0x1448d0[_0xf7a2('0x4c')]),'headers':{'Date':moment(_0x1448d0[_0xf7a2('0x95')])[_0xf7a2('0x65')](_0xf7a2('0x9a'))},'attachments':[]};if(_0x113cda['cc']){_0x4ba236[_0xf7a2('0x9b')]['Cc']=_0x113cda['cc'];}if(_0x113cda[_0xf7a2('0x93')]){_0x4ba236[_0xf7a2('0x9b')]['Bcc']=_0x113cda[_0xf7a2('0x93')];}return new BPromise(function(_0x2fe1e6,_0x322465){if(_0x113cda[_0xf7a2('0x97')]){for(var _0x3f2f32=0x0;_0x3f2f32<_0x113cda['Attachments'][_0xf7a2('0x3b')];_0x3f2f32++){var _0x20d742=_0x113cda[_0xf7a2('0x97')][_0x3f2f32];var _0x8678eb=path['join'](_0x2446c4,_0x20d742[_0xf7a2('0x5f')]);if(fs[_0xf7a2('0x9c')](_0x8678eb)){_0x4ba236['attachments'][_0xf7a2('0x9d')]({'name':_0x20d742[_0xf7a2('0x2d')],'contentType':_0x20d742['type'],'data':fs[_0xf7a2('0x9e')](_0x8678eb)});}}}emlformat['build'](_0x4ba236,function(_0x298f83,_0x397d22){if(_0x298f83)return _0x322465(_0x298f83);fs[_0xf7a2('0x9f')](path['join'](_0x44afca,_0x4e986f),_0x397d22);return _0x2fe1e6(_0x397d22);});});}})[_0xf7a2('0x17')](function(_0x5a7e18){if(_0x5a7e18){return _0x402ab7[_0xf7a2('0xa0')](path['join'](_0x44afca,_0x4e986f),_0x4e986f,function(_0x264a2b){if(!_0x264a2b)fs[_0xf7a2('0xa1')](path[_0xf7a2('0x5c')](_0x44afca,_0x4e986f));});}})[_0xf7a2('0x1f')](handleError(_0x402ab7,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 6a3d795..b7d7ac9 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 _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 +var _0x3a82=['save','update','emit','exports','MailMessage','setMaxListeners'];(function(_0x1cb488,_0x24bdda){var _0x41ccbc=function(_0x4f6143){while(--_0x4f6143){_0x1cb488['push'](_0x1cb488['shift']());}};_0x41ccbc(++_0x24bdda);}(_0x3a82,0x172));var _0x23a8=function(_0xd04b40,_0x346cc0){_0xd04b40=_0xd04b40-0x0;var _0x5a8c25=_0x3a82[_0xd04b40];return _0x5a8c25;};'use strict';var EventEmitter=require('events');var MailMessage=require('../../mysqldb')['db'][_0x23a8('0x0')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x23a8('0x1')](0x0);var events={'afterCreate':_0x23a8('0x2'),'afterUpdate':_0x23a8('0x3'),'afterDestroy':'remove'};function emitEvent(_0x51b5c7){return function(_0x3a45b4,_0x220498,_0x1d5d77){MailMessageEvents[_0x23a8('0x4')](_0x51b5c7+':'+_0x3a45b4['id'],_0x3a45b4);MailMessageEvents[_0x23a8('0x4')](_0x51b5c7,_0x3a45b4);_0x1d5d77(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0x23a8('0x5')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index c5ed6b1..828e737 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 _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 +var _0x834f=['html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','fromString','body','models','toLowerCase','direction','isNil','UserId','MailInteraction','findOne','update','catch','error','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x52848c,_0x3a0345){var _0x55621a=function(_0x1698a0){while(--_0x1698a0){_0x52848c['push'](_0x52848c['shift']());}};_0x55621a(++_0x3a0345);}(_0x834f,0x11b));var _0xf834=function(_0x46224a,_0x27e41a){_0x46224a=_0x46224a-0x0;var _0x29605b=_0x834f[_0x46224a];return _0x29605b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf834('0x0'))(_0xf834('0x1'));var moment=require(_0xf834('0x2'));var BPromise=require(_0xf834('0x3'));var rp=require(_0xf834('0x4'));var htmlToText=require(_0xf834('0x5'));var fs=require('fs');var path=require(_0xf834('0x6'));var rimraf=require(_0xf834('0x7'));var config=require(_0xf834('0x8'));var attributes=require(_0xf834('0x9'));module[_0xf834('0xa')]=function(_0x367cd2,_0x1b3844){return _0x367cd2[_0xf834('0xb')](_0xf834('0xc'),attributes,{'tableName':_0xf834('0xd'),'paranoid':![],'indexes':[{'name':_0xf834('0xe'),'fields':[_0xf834('0xe')]},{'name':_0xf834('0xf'),'fields':[_0xf834('0x10'),_0xf834('0x11')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0xa7ecb7,_0x2c2551,_0x41afaf){if(_0xa7ecb7['body']){_0xa7ecb7[_0xf834('0x10')]=htmlToText[_0xf834('0x12')](_0xa7ecb7[_0xf834('0x13')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x41afaf(null,_0x2c2551);},'afterCreate':function(_0x14d637,_0x3ee67e,_0x2ea3ab){var _0x131549=_0x367cd2[_0xf834('0x14')];var _0x43b52b=_0x14d637['get']({'plain':!![]});if(_0x43b52b['direction'][_0xf834('0x15')]()==='in'||_0x43b52b[_0xf834('0x16')][_0xf834('0x15')]()==='out'&&!_0x43b52b['secret']&&!_[_0xf834('0x17')](_0x43b52b[_0xf834('0x18')])){_0x131549[_0xf834('0x19')][_0xf834('0x1a')]({'where':{'id':_0x43b52b['MailInteractionId']}})['then'](function(_0x157da8){if(_0x157da8){_0x157da8[_0xf834('0x1b')]({'lastMsgAt':_0x43b52b['createdAt'],'lastMsgDirection':_0x43b52b[_0xf834('0x16')][_0xf834('0x15')]()});}})[_0xf834('0x1c')](function(_0x5cf5fa){console[_0xf834('0x1d')](_0x5cf5fa);});}_0x2ea3ab();}},'charset':_0xf834('0x1e'),'collate':_0xf834('0x1f')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index c96f713..ff843d1 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 _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 +var _0x5c3c=['../../config/environment','jayson/promise','client','http','localhost','socket.io-emitter','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','CreateMailMessage','MailMessage','create','options','raw','stringify','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x37573b,_0x2aab7d){var _0x5edb1=function(_0x80d170){while(--_0x80d170){_0x37573b['push'](_0x37573b['shift']());}};_0x5edb1(++_0x2aab7d);}(_0x5c3c,0x132));var _0xc5c3=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x5c3c[_0x5d4607];return _0x5e4a86;};'use strict';var _=require(_0xc5c3('0x0'));var util=require(_0xc5c3('0x1'));var moment=require(_0xc5c3('0x2'));var BPromise=require(_0xc5c3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc5c3('0x4'));var db=require(_0xc5c3('0x5'))['db'];var utils=require(_0xc5c3('0x6'));var logger=require(_0xc5c3('0x7'))(_0xc5c3('0x8'));var config=require(_0xc5c3('0x9'));var jayson=require(_0xc5c3('0xa'));var client=jayson[_0xc5c3('0xb')][_0xc5c3('0xc')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xc5c3('0xd'),'port':0x18eb});var socket=require(_0xc5c3('0xe'))(new Redis(config['redis']));require(_0xc5c3('0xf'))[_0xc5c3('0x10')](socket);function respondWithRpcPromise(_0x52f3eb,_0x14140f,_0x2a1d19){return new BPromise(function(_0x4e329f,_0x1f2e34){return client[_0xc5c3('0x11')](_0x52f3eb,_0x2a1d19)[_0xc5c3('0x12')](function(_0x59fb60){logger[_0xc5c3('0x13')](_0xc5c3('0x14'),_0x14140f,'request\x20sent');logger[_0xc5c3('0x15')](_0xc5c3('0x16'),_0x14140f,_0xc5c3('0x17'),JSON['stringify'](_0x59fb60));if(_0x59fb60[_0xc5c3('0x18')]){if(_0x59fb60[_0xc5c3('0x18')][_0xc5c3('0x19')]===0x1f4){logger[_0xc5c3('0x18')](_0xc5c3('0x14'),_0x14140f,_0x59fb60['error']['message']);return _0x1f2e34(_0x59fb60[_0xc5c3('0x18')][_0xc5c3('0x1a')]);}logger[_0xc5c3('0x18')](_0xc5c3('0x14'),_0x14140f,_0x59fb60['error']['message']);return _0x4e329f(_0x59fb60[_0xc5c3('0x18')]['message']);}else{logger[_0xc5c3('0x13')](_0xc5c3('0x14'),_0x14140f,_0xc5c3('0x17'));_0x4e329f(_0x59fb60[_0xc5c3('0x1b')][_0xc5c3('0x1a')]);}})['catch'](function(_0x364f42){logger[_0xc5c3('0x18')](_0xc5c3('0x14'),_0x14140f,_0x364f42);_0x1f2e34(_0x364f42);});});}exports[_0xc5c3('0x1c')]=function(_0x4e570f){var _0x25ef16=this;return new Promise(function(_0x41578a,_0x3cc612){return db[_0xc5c3('0x1d')][_0xc5c3('0x1e')](_0x4e570f['body'],{'raw':_0x4e570f[_0xc5c3('0x1f')]?_0x4e570f[_0xc5c3('0x1f')][_0xc5c3('0x20')]===undefined?!![]:![]:!![]})[_0xc5c3('0x12')](function(_0x1c5793){logger[_0xc5c3('0x13')](_0xc5c3('0x1c'),_0x4e570f);logger['debug']('CreateMailMessage',_0x4e570f,JSON[_0xc5c3('0x21')](_0x1c5793));_0x41578a(_0x1c5793);})[_0xc5c3('0x22')](function(_0x53ab72){logger['error'](_0xc5c3('0x1c'),_0x53ab72[_0xc5c3('0x1a')],_0x4e570f);_0x3cc612(_0x25ef16[_0xc5c3('0x18')](0x1f4,_0x53ab72['message']));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 096e1b2..f5ae63b 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 _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 +var _0x88b4=['./mailMessage.events','save','remove','emit','removeListener','register','length'];(function(_0x3d352d,_0x4b3167){var _0x156c82=function(_0x1a7bf6){while(--_0x1a7bf6){_0x3d352d['push'](_0x3d352d['shift']());}};_0x156c82(++_0x4b3167);}(_0x88b4,0xa8));var _0x488b=function(_0x15d18f,_0x126b0e){_0x15d18f=_0x15d18f-0x0;var _0xd12bf7=_0x88b4[_0x15d18f];return _0xd12bf7;};'use strict';var MailMessageEvents=require(_0x488b('0x0'));var events=[_0x488b('0x1'),_0x488b('0x2'),'update'];function createListener(_0x8074d6,_0x4e56da){return function(_0x55a2db){_0x4e56da[_0x488b('0x3')](_0x8074d6,_0x55a2db);};}function removeListener(_0x3c89d1,_0x1ee51d){return function(){MailMessageEvents[_0x488b('0x4')](_0x3c89d1,_0x1ee51d);};}exports[_0x488b('0x5')]=function(_0x1f2ee4){for(var _0x414bc9=0x0,_0xe855a8=events[_0x488b('0x6')];_0x414bc9<_0xe855a8;_0x414bc9++){var _0x4007a2=events[_0x414bc9];var _0x4062c2=createListener('mailMessage:'+_0x4007a2,_0x1f2ee4);MailMessageEvents['on'](_0x4007a2,_0x4062c2);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index a9843e9..382ccfc 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 _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 +var _0x800d=['delete','destroy','removeTeams','removeAgents','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update'];(function(_0x235f58,_0x474e5d){var _0x1c1097=function(_0x59dbfa){while(--_0x59dbfa){_0x235f58['push'](_0x235f58['shift']());}};_0x1c1097(++_0x474e5d);}(_0x800d,0xbf));var _0xd800=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x800d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd800('0x0'));var util=require(_0xd800('0x1'));var path=require(_0xd800('0x2'));var timeout=require('connect-timeout');var express=require(_0xd800('0x3'));var router=express['Router']();var fs_extra=require(_0xd800('0x4'));var auth=require(_0xd800('0x5'));var interaction=require(_0xd800('0x6'));var config=require(_0xd800('0x7'));var controller=require(_0xd800('0x8'));router[_0xd800('0x9')]('/',auth[_0xd800('0xa')](),controller[_0xd800('0xb')]);router[_0xd800('0x9')](_0xd800('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xd800('0x9')](_0xd800('0xd'),auth[_0xd800('0xa')](),controller[_0xd800('0xe')]);router[_0xd800('0x9')](_0xd800('0xf'),auth['isAuthenticated'](),controller['getMembers']);router['get'](_0xd800('0x10'),auth['isAuthenticated'](),controller[_0xd800('0x11')]);router['get'](_0xd800('0x12'),auth[_0xd800('0xa')](),controller[_0xd800('0x13')]);router[_0xd800('0x14')]('/',auth['isAuthenticated'](),controller[_0xd800('0x15')]);router['post']('/:id/teams',auth['isAuthenticated'](),controller[_0xd800('0x16')]);router[_0xd800('0x14')]('/:id/users',auth[_0xd800('0xa')](),controller[_0xd800('0x17')]);router[_0xd800('0x18')](_0xd800('0xd'),auth['isAuthenticated'](),controller[_0xd800('0x19')]);router[_0xd800('0x1a')](_0xd800('0xd'),auth[_0xd800('0xa')](),controller[_0xd800('0x1b')]);router[_0xd800('0x1a')](_0xd800('0x10'),auth[_0xd800('0xa')](),controller[_0xd800('0x1c')]);router['delete'](_0xd800('0x12'),auth[_0xd800('0xa')](),controller[_0xd800('0x1d')]);module[_0xd800('0x1e')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 121c08f..ff0f714 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 _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 +var _0x6d43=['INTEGER','ENUM','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x3e85a4,_0x18c3a9){var _0x21e7d1=function(_0x48457d){while(--_0x48457d){_0x3e85a4['push'](_0x3e85a4['shift']());}};_0x21e7d1(++_0x18c3a9);}(_0x6d43,0x11c));var _0x36d4=function(_0x2f2606,_0x2bf0ed){_0x2f2606=_0x2f2606-0x0;var _0x561d6c=_0x6d43[_0x2f2606];return _0x561d6c;};'use strict';var Sequelize=require(_0x36d4('0x0'));module[_0x36d4('0x1')]={'name':{'type':Sequelize[_0x36d4('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x36d4('0x2')]},'timeout':{'type':Sequelize[_0x36d4('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x36d4('0x4')]('rrmemory',_0x36d4('0x5'),_0x36d4('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index a80732c..863d859 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 _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 +var _0x12b5=['join','user_has_teams','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','compact','value','isEmpty','removeAgents','emit','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','util','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','json','offset','count','set','Content-Range','update','then','get','UserProfileResource','destroy','end','error','stack','send','index','map','MailQueue','rawAttributes','fieldName','type','key','getOptions','where','include','findAll','rows','show','params','model','keys','query','intersection','attributes','fields','length','includeAll','merge','options','find','catch','create','body','name','describe','getMembers','findOne','UserMailQueue','filters','hasOwnProperty','limit','order','sort','pick','filter','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','mailPause','getTeams','Team','nolimit','addTeams','ids','User','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','userMailQueue:save','removeTeams','select','tq.TeamId','from','team_has_mail_queues'];(function(_0x184bae,_0x3fac12){var _0x26f74b=function(_0x237661){while(--_0x237661){_0x184bae['push'](_0x184bae['shift']());}};_0x26f74b(++_0x3fac12);}(_0x12b5,0x90));var _0x512b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x12b5[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x512b('0x0'));var util=require(_0x512b('0x1'));var _=require(_0x512b('0x2'));var squel=require(_0x512b('0x3'));var Redis=require('ioredis');var qs=require(_0x512b('0x4'));var logger=require(_0x512b('0x5'))(_0x512b('0x6'));var config=require('../../config/environment');var db=require(_0x512b('0x7'))['db'];config[_0x512b('0x8')]=_[_0x512b('0x9')](config['redis'],{'host':_0x512b('0xa'),'port':0x18eb});var socket=require(_0x512b('0xb'))(new Redis(config['redis']));require(_0x512b('0xc'))[_0x512b('0xd')](socket);function respondWithStatusCode(_0xc3e3d3,_0x37a0f8){_0x37a0f8=_0x37a0f8||0xcc;return function(_0x2af361){if(_0x2af361){return _0xc3e3d3[_0x512b('0xe')](_0x37a0f8);}return _0xc3e3d3[_0x512b('0xf')](_0x37a0f8)['end']();};}function respondWithResult(_0x37bc8c,_0x4db82a){_0x4db82a=_0x4db82a||0xc8;return function(_0x2f12b7){if(_0x2f12b7){return _0x37bc8c['status'](_0x4db82a)[_0x512b('0x10')](_0x2f12b7);}};}function respondWithFilteredResult(_0x37cee2,_0x5a4e0d){return function(_0x5adee1){if(_0x5adee1){var _0xfe2d7d=typeof _0x5a4e0d[_0x512b('0x11')]==='undefined'&&typeof _0x5a4e0d['limit']==='undefined';var _0x883b91=_0x5adee1['count'];var _0x56bcce=_0xfe2d7d?0x0:_0x5a4e0d[_0x512b('0x11')];var _0x5c07d9=_0xfe2d7d?_0x5adee1[_0x512b('0x12')]:_0x5a4e0d[_0x512b('0x11')]+_0x5a4e0d['limit'];var _0x785b2b;if(_0x5c07d9>=_0x883b91){_0x5c07d9=_0x883b91;_0x785b2b=0xc8;}else{_0x785b2b=0xce;}_0x37cee2[_0x512b('0xf')](_0x785b2b);return _0x37cee2[_0x512b('0x13')](_0x512b('0x14'),_0x56bcce+'-'+_0x5c07d9+'/'+_0x883b91)[_0x512b('0x10')](_0x5adee1);}return null;};}function saveUpdates(_0x2cae52){return function(_0x5b1768){if(_0x5b1768){return _0x5b1768[_0x512b('0x15')](_0x2cae52)[_0x512b('0x16')](function(_0x50212d){return _0x50212d;});}return null;};}function removeEntity(_0xe7b3e8){return function(_0x4b7e3a){if(_0x4b7e3a){return _0x4b7e3a['destroy']()[_0x512b('0x16')](function(){var _0x1cc89c=_0x4b7e3a[_0x512b('0x17')]({'plain':!![]});var _0x5bfd7b='MailQueues';return db[_0x512b('0x18')][_0x512b('0x19')]({'where':{'type':_0x5bfd7b,'resourceId':_0x1cc89c['id']}})[_0x512b('0x16')](function(){return _0x4b7e3a;});})[_0x512b('0x16')](function(){_0xe7b3e8[_0x512b('0xf')](0xcc)[_0x512b('0x1a')]();});}};}function handleEntityNotFound(_0x1988e5){return function(_0x42e822){if(!_0x42e822){_0x1988e5[_0x512b('0xe')](0x194);}return _0x42e822;};}function handleError(_0x264a55,_0x5e4e8e){_0x5e4e8e=_0x5e4e8e||0x1f4;return function(_0xb67977){logger[_0x512b('0x1b')](_0xb67977[_0x512b('0x1c')]);if(_0xb67977['name']){delete _0xb67977['name'];}_0x264a55['status'](_0x5e4e8e)[_0x512b('0x1d')](_0xb67977);};}exports[_0x512b('0x1e')]=function(_0x36ca4d,_0x4a7e78){var _0x29f6de={};var _0x2d1b5a={'count':0x0,'rows':[]};var _0x5ac33c=_[_0x512b('0x1f')](db[_0x512b('0x20')][_0x512b('0x21')],function(_0xd0dee9){return{'name':_0xd0dee9[_0x512b('0x22')],'type':_0xd0dee9[_0x512b('0x23')][_0x512b('0x24')]};});_0x29f6de=qs[_0x512b('0x25')](_0x5ac33c,_0x36ca4d);var _0x45efc1={'where':_0x29f6de[_0x512b('0x26')]};return db[_0x512b('0x20')][_0x512b('0x12')](_0x45efc1)[_0x512b('0x16')](function(_0xffcbbe){_0x2d1b5a['count']=_0xffcbbe;_0x29f6de[_0x512b('0x27')]=qs[_0x512b('0x27')](_0x36ca4d['query']);return db['MailQueue'][_0x512b('0x28')](_0x29f6de);})['then'](function(_0x308607){_0x2d1b5a[_0x512b('0x29')]=_0x308607;return _0x2d1b5a;})[_0x512b('0x16')](respondWithFilteredResult(_0x4a7e78,_0x29f6de))['catch'](handleError(_0x4a7e78,null));};exports[_0x512b('0x2a')]=function(_0x1c0fc7,_0x5b142a){var _0x1d0b84={'raw':!![],'where':{'id':_0x1c0fc7[_0x512b('0x2b')]['id']}},_0x59d352={};_0x59d352[_0x512b('0x2c')]=_[_0x512b('0x2d')](db[_0x512b('0x20')]['rawAttributes']);_0x59d352[_0x512b('0x2e')]=_[_0x512b('0x2d')](_0x1c0fc7[_0x512b('0x2e')]);_0x59d352['filters']=_[_0x512b('0x2f')](_0x59d352['model'],_0x59d352['query']);_0x1d0b84[_0x512b('0x30')]=_['intersection'](_0x59d352['model'],qs['fields'](_0x1c0fc7[_0x512b('0x2e')][_0x512b('0x31')]));_0x1d0b84['attributes']=_0x1d0b84[_0x512b('0x30')][_0x512b('0x32')]?_0x1d0b84[_0x512b('0x30')]:_0x59d352[_0x512b('0x2c')];if(_0x1c0fc7[_0x512b('0x2e')][_0x512b('0x33')]){_0x1d0b84['include']=[{'all':!![]}];}_0x1d0b84=_[_0x512b('0x34')]({},_0x1d0b84,_0x1c0fc7[_0x512b('0x35')]);return db[_0x512b('0x20')][_0x512b('0x36')](_0x1d0b84)['then'](handleEntityNotFound(_0x5b142a,null))['then'](respondWithResult(_0x5b142a,null))[_0x512b('0x37')](handleError(_0x5b142a,null));};exports[_0x512b('0x38')]=function(_0x4adf57,_0x3de060){return db[_0x512b('0x20')][_0x512b('0x38')](_0x4adf57[_0x512b('0x39')],{})[_0x512b('0x16')](function(_0x28e0fc){var _0x3a98da=_0x4adf57['user'][_0x512b('0x17')]({'plain':!![]});if(!_0x3a98da)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3a98da['role']==='user'){var _0x2d72fb=_0x28e0fc['get']({'plain':!![]});var _0xda0c84='MailQueues';return db['UserProfileSection'][_0x512b('0x36')]({'where':{'name':_0xda0c84,'userProfileId':_0x3a98da['userProfileId']},'raw':!![]})['then'](function(_0x1ce1b6){if(_0x1ce1b6&&_0x1ce1b6['autoAssociation']===0x0){return db['UserProfileResource'][_0x512b('0x38')]({'name':_0x2d72fb[_0x512b('0x3a')],'resourceId':_0x2d72fb['id'],'type':_0x1ce1b6[_0x512b('0x3a')],'sectionId':_0x1ce1b6['id']},{})[_0x512b('0x16')](function(){return _0x28e0fc;});}else{return _0x28e0fc;}})[_0x512b('0x37')](function(_0x28e140){logger[_0x512b('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x28e140);throw _0x28e140;});}return _0x28e0fc;})[_0x512b('0x16')](respondWithResult(_0x3de060,0xc9))[_0x512b('0x37')](handleError(_0x3de060,null));};exports[_0x512b('0x15')]=function(_0x554190,_0x36f134){if(_0x554190['body']['id']){delete _0x554190[_0x512b('0x39')]['id'];}return db[_0x512b('0x20')]['find']({'where':{'id':_0x554190[_0x512b('0x2b')]['id']}})['then'](handleEntityNotFound(_0x36f134,null))['then'](saveUpdates(_0x554190['body'],null))['then'](respondWithResult(_0x36f134,null))[_0x512b('0x37')](handleError(_0x36f134,null));};exports['destroy']=function(_0x25ecf2,_0x1e5bf7){return db[_0x512b('0x20')]['find']({'where':{'id':_0x25ecf2['params']['id']}})[_0x512b('0x16')](handleEntityNotFound(_0x1e5bf7,null))[_0x512b('0x16')](removeEntity(_0x1e5bf7,null))['catch'](handleError(_0x1e5bf7,null));};exports['describe']=function(_0x48cdad,_0x2c2251){return db[_0x512b('0x20')][_0x512b('0x3b')]()[_0x512b('0x16')](respondWithResult(_0x2c2251,null))[_0x512b('0x37')](handleError(_0x2c2251,null));};exports[_0x512b('0x3c')]=function(_0x224445,_0x55ef36){var _0x1ca119={'raw':!![],'where':{}},_0x287505={},_0x4ce33b;return db[_0x512b('0x20')][_0x512b('0x3d')]({'where':{'id':_0x224445[_0x512b('0x2b')]['id']}})['then'](handleEntityNotFound(_0x55ef36,null))[_0x512b('0x16')](function(_0x382b50){if(_0x382b50){_0x4ce33b=_0x382b50[_0x512b('0x17')]({'plain':!![]});_0x287505[_0x512b('0x2c')]=_[_0x512b('0x2d')](db[_0x512b('0x3e')][_0x512b('0x21')]);_0x287505[_0x512b('0x2e')]=_['keys'](_0x224445[_0x512b('0x2e')]);_0x287505[_0x512b('0x3f')]=_[_0x512b('0x2f')](_0x287505[_0x512b('0x2c')],_0x287505[_0x512b('0x2e')]);_0x1ca119[_0x512b('0x30')]=_[_0x512b('0x2f')](_0x287505[_0x512b('0x2c')],qs[_0x512b('0x31')](_0x224445[_0x512b('0x2e')][_0x512b('0x31')]));_0x1ca119[_0x512b('0x30')]=_0x1ca119[_0x512b('0x30')][_0x512b('0x32')]?_0x1ca119[_0x512b('0x30')]:_0x287505[_0x512b('0x2c')];if(!_0x224445[_0x512b('0x2e')][_0x512b('0x40')]('nolimit')){_0x1ca119[_0x512b('0x41')]=qs[_0x512b('0x41')](_0x224445[_0x512b('0x2e')][_0x512b('0x41')]);_0x1ca119[_0x512b('0x11')]=qs['offset'](_0x224445[_0x512b('0x2e')][_0x512b('0x11')]);}_0x1ca119[_0x512b('0x42')]=qs['sort'](_0x224445['query'][_0x512b('0x43')]);_0x1ca119['where']=qs[_0x512b('0x3f')](_[_0x512b('0x44')](_0x224445[_0x512b('0x2e')],_0x287505['filters']));_0x1ca119[_0x512b('0x26')]['MailQueueId']=_0x382b50['id'];if(_0x224445[_0x512b('0x2e')][_0x512b('0x45')]){_0x1ca119[_0x512b('0x26')]=_[_0x512b('0x34')](_0x1ca119[_0x512b('0x26')],{'$or':_[_0x512b('0x1f')](_0x1ca119[_0x512b('0x30')],function(_0x35765e){var _0x7f0b1a={};_0x7f0b1a[_0x35765e]={'$like':'%'+_0x224445[_0x512b('0x2e')][_0x512b('0x45')]+'%'};return _0x7f0b1a;})});}_0x1ca119=_[_0x512b('0x34')]({},_0x1ca119,_0x224445['options']);return db[_0x512b('0x3e')][_0x512b('0x28')](_0x1ca119);}})[_0x512b('0x16')](function(_0x162e5b){if(_0x162e5b){return db['User'][_0x512b('0x46')]({'where':{'id':_[_0x512b('0x1f')](_0x162e5b,_0x512b('0x47')),'role':_0x512b('0x48')},'attributes':['id',_0x512b('0x3a'),'mailPause',_0x512b('0x49'),_0x512b('0x4a')]});}})[_0x512b('0x16')](function(_0x575eab){if(_0x575eab){return{'count':_0x575eab[_0x512b('0x12')],'rows':_['map'](_0x575eab[_0x512b('0x29')],function(_0x3c72a3){return{'membername':_0x3c72a3[_0x512b('0x3a')],'UserId':_0x3c72a3['id'],'queue_name':_0x4ce33b[_0x512b('0x3a')],'MailQueueId':_0x4ce33b['id'],'interface':util[_0x512b('0x4b')](_0x512b('0x4c'),_0x512b('0x4d'),_0x3c72a3[_0x512b('0x3a')]),'penalty':0x0,'paused':_0x3c72a3[_0x512b('0x4e')],'createdAt':_0x3c72a3[_0x512b('0x4a')],'updatedAt':_0x3c72a3[_0x512b('0x49')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x512b('0x16')](respondWithFilteredResult(_0x55ef36,_0x1ca119))[_0x512b('0x37')](handleError(_0x55ef36,null));};exports[_0x512b('0x4f')]=function(_0xccfe93,_0x14ecf6){var _0x394c14={};var _0x1c96c9={};var _0x4ee817;var _0x4601c3;return db['MailQueue']['findOne']({'where':{'id':_0xccfe93['params']['id']}})[_0x512b('0x16')](handleEntityNotFound(_0x14ecf6,null))['then'](function(_0xd20a08){if(_0xd20a08){_0x4ee817=_0xd20a08;_0x1c96c9[_0x512b('0x2c')]=_[_0x512b('0x2d')](db[_0x512b('0x50')][_0x512b('0x21')]);_0x1c96c9[_0x512b('0x2e')]=_[_0x512b('0x2d')](_0xccfe93[_0x512b('0x2e')]);_0x1c96c9['filters']=_[_0x512b('0x2f')](_0x1c96c9[_0x512b('0x2c')],_0x1c96c9[_0x512b('0x2e')]);_0x394c14[_0x512b('0x30')]=_['intersection'](_0x1c96c9['model'],qs[_0x512b('0x31')](_0xccfe93['query'][_0x512b('0x31')]));_0x394c14[_0x512b('0x30')]=_0x394c14[_0x512b('0x30')]['length']?_0x394c14[_0x512b('0x30')]:_0x1c96c9['model'];_0x394c14[_0x512b('0x42')]=qs[_0x512b('0x43')](_0xccfe93[_0x512b('0x2e')]['sort']);_0x394c14['where']=qs[_0x512b('0x3f')](_[_0x512b('0x44')](_0xccfe93['query'],_0x1c96c9[_0x512b('0x3f')]));if(_0xccfe93[_0x512b('0x2e')][_0x512b('0x45')]){_0x394c14[_0x512b('0x26')]=_[_0x512b('0x34')](_0x394c14[_0x512b('0x26')],{'$or':_[_0x512b('0x1f')](_0x394c14[_0x512b('0x30')],function(_0x2ec7fc){var _0x5be99a={};_0x5be99a[_0x2ec7fc]={'$like':'%'+_0xccfe93[_0x512b('0x2e')][_0x512b('0x45')]+'%'};return _0x5be99a;})});}_0x394c14=_[_0x512b('0x34')]({},_0x394c14,_0xccfe93[_0x512b('0x35')]);return _0x4ee817[_0x512b('0x4f')](_0x394c14);}})[_0x512b('0x16')](function(_0x743e2b){if(_0x743e2b){_0x4601c3=_0x743e2b[_0x512b('0x32')];if(!_0xccfe93[_0x512b('0x2e')]['hasOwnProperty'](_0x512b('0x51'))){_0x394c14[_0x512b('0x41')]=qs[_0x512b('0x41')](_0xccfe93[_0x512b('0x2e')]['limit']);_0x394c14[_0x512b('0x11')]=qs[_0x512b('0x11')](_0xccfe93[_0x512b('0x2e')][_0x512b('0x11')]);}return _0x4ee817[_0x512b('0x4f')](_0x394c14);}})[_0x512b('0x16')](function(_0x49ee7b){if(_0x49ee7b){return _0x49ee7b?{'count':_0x4601c3,'rows':_0x49ee7b}:null;}})['then'](respondWithResult(_0x14ecf6,null))['catch'](handleError(_0x14ecf6,null));};exports[_0x512b('0x52')]=function(_0x4035c8,_0x36541c){var _0x1c05cb=_0x4035c8[_0x512b('0x39')][_0x512b('0x53')];return db['Team'][_0x512b('0x28')]({'where':{'id':_0x1c05cb},'attributes':['id'],'include':[{'model':db[_0x512b('0x54')],'as':_0x512b('0x55'),'attributes':['id',_0x512b('0x3a'),_0x512b('0x56'),'voicePause',_0x512b('0x57')],'raw':!![]}]})[_0x512b('0x16')](function(_0x3549f9){if(_0x3549f9){var _0x1c6dc3=_[_0x512b('0x58')](_0x3549f9,function(_0x50c86e){var _0x331ce3=_0x50c86e[_0x512b('0x17')]({'plain':!![]});return _0x331ce3[_0x512b('0x55')];});return db['MailQueue'][_0x512b('0x36')]({'where':{'id':_0x4035c8[_0x512b('0x2b')]['id']}})[_0x512b('0x16')](function(_0x4e1f2f){return db[_0x512b('0x59')][_0x512b('0x5a')](function(_0xd3d2af){return _0x4e1f2f['addTeams'](_0x1c05cb,{'transaction':_0xd3d2af})['then'](function(){return BPromise[_0x512b('0x5b')](_0x1c6dc3,function(_0x504201){return db['UserMailQueue'][_0x512b('0x5c')]({'where':{'UserId':_0x504201['id'],'MailQueueId':_0x4035c8[_0x512b('0x2b')]['id']},'transaction':_0xd3d2af});});})[_0x512b('0x16')](function(){_0x1c6dc3[_0x512b('0x5d')](function(_0x432fc3){socket['emit'](_0x512b('0x5e'),{'UserId':_0x432fc3['id'],'MailQueueId':_0x4e1f2f['id']});});});});});}})[_0x512b('0x16')](respondWithStatusCode(_0x36541c,null))[_0x512b('0x37')](handleError(_0x36541c,null));};exports[_0x512b('0x5f')]=function(_0x4511ed,_0x3b4717){return db[_0x512b('0x50')][_0x512b('0x28')]({'where':{'id':_0x4511ed['query'][_0x512b('0x53')]},'attributes':['id'],'include':[{'model':db[_0x512b('0x54')],'as':_0x512b('0x55'),'attributes':['id'],'raw':!![]}]})[_0x512b('0x16')](handleEntityNotFound(_0x3b4717,null))['then'](function(_0x4b77c6){var _0x10ec92=_[_0x512b('0x1f')](_0x4b77c6,'id');var _0x2eba74=[];var _0x45fe1=[];var _0x31c475=squel[_0x512b('0x60')]();_0x31c475['field'](_0x512b('0x61'))[_0x512b('0x62')](_0x512b('0x63'),'tq')[_0x512b('0x64')](_0x512b('0x65'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x512b('0x26')](_0x512b('0x66'),_0x4511ed['params']['id']);for(var _0x6627e6=0x0;_0x6627e6<_0x4b77c6[_0x512b('0x32')];_0x6627e6+=0x1){let _0x462122=_0x4b77c6[_0x6627e6];for(var _0x54087e=0x0;_0x54087e<_0x462122['Agents'][_0x512b('0x32')];_0x54087e+=0x1){let _0x14b080=_0x462122[_0x512b('0x55')][_0x54087e];var _0x2d3bdd=_0x31c475[_0x512b('0x67')]();_0x2d3bdd['where'](_0x512b('0x68'),_0x14b080['id']);_0x45fe1[_0x512b('0x69')](db[_0x512b('0x59')][_0x512b('0x2e')](_0x2d3bdd[_0x512b('0x6a')](),{'type':db[_0x512b('0x59')][_0x512b('0x6b')][_0x512b('0x6c')]})[_0x512b('0x16')](function(_0x505780){if(_0x505780[_0x512b('0x32')]===0x1){return _0x14b080['id'];}else{var _0x20f94=_['every'](_[_0x512b('0x1f')](_0x505780,_0x512b('0x6d')),function(_0x113fb4){return _[_0x512b('0x6e')](_0x10ec92,_0x113fb4);});if(_0x20f94){return _0x14b080['id'];}}}));}}return BPromise['all'](_0x45fe1)[_0x512b('0x16')](function(_0x4dfb9e){_0x2eba74=_(_0x2eba74)['union'](_0x4dfb9e)[_0x512b('0x6f')]()[_0x512b('0x70')]();return db[_0x512b('0x20')]['find']({'where':{'id':_0x4511ed[_0x512b('0x2b')]['id']}})[_0x512b('0x16')](function(_0x25d1de){return db[_0x512b('0x59')][_0x512b('0x5a')](function(_0x3af890){return _0x25d1de[_0x512b('0x5f')](_0x4511ed['query'][_0x512b('0x53')],{'transaction':_0x3af890})['then'](function(){if(!_[_0x512b('0x71')](_0x2eba74)){return _0x25d1de[_0x512b('0x72')](_0x2eba74,{'transaction':_0x3af890});}})[_0x512b('0x16')](function(){_0x2eba74[_0x512b('0x5d')](function(_0x1e9b68){socket[_0x512b('0x73')](_0x512b('0x74'),{'UserId':_0x1e9b68,'MailQueueId':_0x25d1de['id']});});});});});});})[_0x512b('0x16')](respondWithStatusCode(_0x3b4717,null))[_0x512b('0x37')](handleError(_0x3b4717,null));};exports[_0x512b('0x75')]=function(_0x39bb11,_0x2148d1){return db[_0x512b('0x20')][_0x512b('0x36')]({'where':{'id':_0x39bb11[_0x512b('0x2b')]['id']}})[_0x512b('0x16')](handleEntityNotFound(_0x2148d1,null))[_0x512b('0x16')](function(_0x5a1415){if(_0x5a1415){return _0x5a1415[_0x512b('0x75')](_0x39bb11[_0x512b('0x39')]['ids'],_[_0x512b('0x76')](_0x39bb11['body'],[_0x512b('0x53'),'id'])||{})[_0x512b('0x77')](function(_0x49f430){for(var _0x16f47f=0x0;_0x16f47f<_0x39bb11[_0x512b('0x39')]['ids']['length'];_0x16f47f+=0x1){socket['emit']('userMailQueue:save',{'UserId':Number(_0x39bb11[_0x512b('0x39')]['ids'][_0x16f47f]),'MailQueueId':Number(_0x39bb11[_0x512b('0x2b')]['id'])});}return _0x49f430;});}})[_0x512b('0x16')](respondWithResult(_0x2148d1,null))['catch'](handleError(_0x2148d1,null));};exports[_0x512b('0x72')]=function(_0x57dc2f,_0xedc606){return db[_0x512b('0x20')][_0x512b('0x36')]({'where':{'id':_0x57dc2f[_0x512b('0x2b')]['id']}})[_0x512b('0x16')](handleEntityNotFound(_0xedc606,null))[_0x512b('0x16')](function(_0x3ff5a4){if(_0x3ff5a4){return _0x3ff5a4[_0x512b('0x72')](_0x57dc2f[_0x512b('0x2e')][_0x512b('0x53')])[_0x512b('0x16')](function(){if(_[_0x512b('0x78')](_0x57dc2f[_0x512b('0x2e')][_0x512b('0x53')])){for(var _0x7410eb=0x0;_0x7410eb<_0x57dc2f[_0x512b('0x2e')][_0x512b('0x53')][_0x512b('0x32')];_0x7410eb+=0x1){socket[_0x512b('0x73')]('userMailQueue:remove',{'UserId':Number(_0x57dc2f[_0x512b('0x2e')][_0x512b('0x53')][_0x7410eb]),'MailQueueId':Number(_0x57dc2f[_0x512b('0x2b')]['id'])});}}else{socket[_0x512b('0x73')](_0x512b('0x74'),{'UserId':Number(_0x57dc2f[_0x512b('0x2e')][_0x512b('0x53')]),'MailQueueId':Number(_0x57dc2f['params']['id'])});}});}})[_0x512b('0x16')](respondWithStatusCode(_0xedc606,null))[_0x512b('0x37')](handleError(_0xedc606,null));};exports[_0x512b('0x79')]=function(_0x5ed03e,_0x541dcb){var _0x17fa57={};var _0xeacbed={};var _0xec301d;var _0x37cf24;return db[_0x512b('0x20')][_0x512b('0x3d')]({'where':{'id':_0x5ed03e[_0x512b('0x2b')]['id']}})[_0x512b('0x16')](handleEntityNotFound(_0x541dcb,null))[_0x512b('0x16')](function(_0xa50ed0){if(_0xa50ed0){_0xec301d=_0xa50ed0;_0xeacbed[_0x512b('0x2c')]=_['keys'](db[_0x512b('0x54')]['rawAttributes']);_0xeacbed[_0x512b('0x2e')]=_['keys'](_0x5ed03e['query']);_0xeacbed[_0x512b('0x3f')]=_[_0x512b('0x2f')](_0xeacbed[_0x512b('0x2c')],_0xeacbed['query']);_0x17fa57[_0x512b('0x30')]=_[_0x512b('0x2f')](_0xeacbed[_0x512b('0x2c')],qs[_0x512b('0x31')](_0x5ed03e[_0x512b('0x2e')][_0x512b('0x31')]));_0x17fa57['attributes']=_0x17fa57[_0x512b('0x30')][_0x512b('0x32')]?_0x17fa57[_0x512b('0x30')]:_0xeacbed[_0x512b('0x2c')];_0x17fa57[_0x512b('0x42')]=qs[_0x512b('0x43')](_0x5ed03e['query']['sort']);_0x17fa57[_0x512b('0x26')]=qs['filters'](_[_0x512b('0x44')](_0x5ed03e[_0x512b('0x2e')],_0xeacbed[_0x512b('0x3f')]));if(_0x5ed03e['query'][_0x512b('0x45')]){_0x17fa57['where']=_[_0x512b('0x34')](_0x17fa57['where'],{'$or':_[_0x512b('0x1f')](_0x17fa57[_0x512b('0x30')],function(_0x4be83d){var _0x35ab68={};_0x35ab68[_0x4be83d]={'$like':'%'+_0x5ed03e['query'][_0x512b('0x45')]+'%'};return _0x35ab68;})});}_0x17fa57=_['merge']({},_0x17fa57,_0x5ed03e[_0x512b('0x35')]);return _0xec301d[_0x512b('0x79')](_0x17fa57);}})[_0x512b('0x16')](function(_0x2163a0){if(_0x2163a0){_0x37cf24=_0x2163a0['length'];if(!_0x5ed03e[_0x512b('0x2e')][_0x512b('0x40')](_0x512b('0x51'))){_0x17fa57['limit']=qs[_0x512b('0x41')](_0x5ed03e[_0x512b('0x2e')]['limit']);_0x17fa57['offset']=qs[_0x512b('0x11')](_0x5ed03e[_0x512b('0x2e')][_0x512b('0x11')]);}return _0xec301d[_0x512b('0x79')](_0x17fa57);}})[_0x512b('0x16')](function(_0x54cb31){if(_0x54cb31){return _0x54cb31?{'count':_0x37cf24,'rows':_0x54cb31}:null;}})[_0x512b('0x16')](respondWithResult(_0x541dcb,null))['catch'](handleError(_0x541dcb,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 2ddb3e8..0b98e16 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 _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 +var _0x277d=['emit','hasOwnProperty','exports','events','../../mysqldb','MailQueue','save','update','remove'];(function(_0x534154,_0x210efb){var _0x79cd80=function(_0x76e354){while(--_0x76e354){_0x534154['push'](_0x534154['shift']());}};_0x79cd80(++_0x210efb);}(_0x277d,0x8a));var _0xd277=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x277d[_0x2c91e9];return _0x13f0ff;};'use strict';var EventEmitter=require(_0xd277('0x0'));var MailQueue=require(_0xd277('0x1'))['db'][_0xd277('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd277('0x3'),'afterUpdate':_0xd277('0x4'),'afterDestroy':_0xd277('0x5')};function emitEvent(_0x5996b1){return function(_0x2bece6,_0x367cf8,_0x493f02){MailQueueEvents[_0xd277('0x6')](_0x5996b1+':'+_0x2bece6['id'],_0x2bece6);MailQueueEvents[_0xd277('0x6')](_0x5996b1,_0x2bece6);_0x493f02(null);};}for(var e in events){if(events[_0xd277('0x7')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0xd277('0x8')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index f5547d4..aeb50f3 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 _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 +var _0x1b26=['../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports','MailQueue','mail_queues','lodash','util'];(function(_0x53d29c,_0x16a6e1){var _0x1d0211=function(_0x1debef){while(--_0x1debef){_0x53d29c['push'](_0x53d29c['shift']());}};_0x1d0211(++_0x16a6e1);}(_0x1b26,0x1a0));var _0x61b2=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x1b26[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0x61b2('0x0'));var util=require(_0x61b2('0x1'));var logger=require(_0x61b2('0x2'))('api');var moment=require(_0x61b2('0x3'));var BPromise=require('bluebird');var rp=require(_0x61b2('0x4'));var fs=require('fs');var path=require(_0x61b2('0x5'));var rimraf=require(_0x61b2('0x6'));var config=require(_0x61b2('0x7'));var attributes=require('./mailQueue.attributes');module[_0x61b2('0x8')]=function(_0x23de60,_0x5dd870){return _0x23de60['define'](_0x61b2('0x9'),attributes,{'tableName':_0x61b2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index a27c91d..bc86710 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 _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 +var _0x9863=['MailQueue','where','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','redis','socket.io-emitter','request','then','request\x20sent','debug','stringify','error','code','MailQueue,\x20%s,\x20%s','message','info','result','catch','GetMailQueue','findAll','options','raw','attributes','limit','include','map','model','ShowMailQueue'];(function(_0x1439e1,_0x67292c){var _0x1a9420=function(_0x2bcbbb){while(--_0x2bcbbb){_0x1439e1['push'](_0x1439e1['shift']());}};_0x1a9420(++_0x67292c);}(_0x9863,0x160));var _0x3986=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x9863[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x3986('0x0'));var util=require(_0x3986('0x1'));var moment=require(_0x3986('0x2'));var BPromise=require(_0x3986('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3986('0x4'));var db=require(_0x3986('0x5'))['db'];var utils=require(_0x3986('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x3986('0x7'));var jayson=require(_0x3986('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x3986('0x9')]=_['defaults'](config[_0x3986('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x3986('0xa'))(new Redis(config['redis']));require('./mailQueue.socket')['register'](socket);function respondWithRpcPromise(_0x2519e1,_0x184a6d,_0x4fe6d6){return new BPromise(function(_0x3b459a,_0x4843fa){return client[_0x3986('0xb')](_0x2519e1,_0x4fe6d6)[_0x3986('0xc')](function(_0x2f00d1){logger['info']('MailQueue,\x20%s,\x20%s',_0x184a6d,_0x3986('0xd'));logger[_0x3986('0xe')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x184a6d,_0x3986('0xd'),JSON[_0x3986('0xf')](_0x2f00d1));if(_0x2f00d1[_0x3986('0x10')]){if(_0x2f00d1['error'][_0x3986('0x11')]===0x1f4){logger[_0x3986('0x10')](_0x3986('0x12'),_0x184a6d,_0x2f00d1[_0x3986('0x10')][_0x3986('0x13')]);return _0x4843fa(_0x2f00d1[_0x3986('0x10')]['message']);}logger[_0x3986('0x10')](_0x3986('0x12'),_0x184a6d,_0x2f00d1['error'][_0x3986('0x13')]);return _0x3b459a(_0x2f00d1[_0x3986('0x10')][_0x3986('0x13')]);}else{logger[_0x3986('0x14')]('MailQueue,\x20%s,\x20%s',_0x184a6d,_0x3986('0xd'));_0x3b459a(_0x2f00d1[_0x3986('0x15')][_0x3986('0x13')]);}})[_0x3986('0x16')](function(_0x570244){logger[_0x3986('0x10')](_0x3986('0x12'),_0x184a6d,_0x570244);_0x4843fa(_0x570244);});});}exports[_0x3986('0x17')]=function(_0x473612){var _0x15333a=this;return new Promise(function(_0x4a2030,_0x2bfd49){return db['MailQueue'][_0x3986('0x18')]({'raw':_0x473612[_0x3986('0x19')]?_0x473612[_0x3986('0x19')][_0x3986('0x1a')]===undefined?!![]:![]:!![],'where':_0x473612[_0x3986('0x19')]?_0x473612[_0x3986('0x19')]['where']||null:null,'attributes':_0x473612['options']?_0x473612[_0x3986('0x19')][_0x3986('0x1b')]||null:null,'limit':_0x473612['options']?_0x473612[_0x3986('0x19')][_0x3986('0x1c')]||null:null,'include':_0x473612['options']?_0x473612[_0x3986('0x19')][_0x3986('0x1d')]?_[_0x3986('0x1e')](_0x473612[_0x3986('0x19')][_0x3986('0x1d')],function(_0x220c61){return{'model':db[_0x220c61['model']],'as':_0x220c61['as'],'attributes':_0x220c61[_0x3986('0x1b')],'include':_0x220c61['include']?_[_0x3986('0x1e')](_0x220c61['include'],function(_0x259764){return{'model':db[_0x259764['model']],'as':_0x259764['as'],'attributes':_0x259764[_0x3986('0x1b')],'include':_0x259764[_0x3986('0x1d')]?_[_0x3986('0x1e')](_0x259764[_0x3986('0x1d')],function(_0x11bfa9){return{'model':db[_0x11bfa9[_0x3986('0x1f')]],'as':_0x11bfa9['as'],'attributes':_0x11bfa9['attributes']};}):[]};}):[]};}):[]:[]})[_0x3986('0xc')](function(_0x3ef701){logger[_0x3986('0x14')](_0x3986('0x17'),_0x473612);logger[_0x3986('0xe')]('GetMailQueue',_0x473612,JSON[_0x3986('0xf')](_0x3ef701));_0x4a2030(_0x3ef701);})[_0x3986('0x16')](function(_0x27bc9a){logger[_0x3986('0x10')]('GetMailQueue',_0x27bc9a[_0x3986('0x13')],_0x473612);_0x2bfd49(_0x15333a[_0x3986('0x10')](0x1f4,_0x27bc9a[_0x3986('0x13')]));});});};exports[_0x3986('0x20')]=function(_0x34fe26){var _0x8c3098=this;return new Promise(function(_0x5144ef,_0x31b1f0){return db[_0x3986('0x21')]['find']({'raw':_0x34fe26[_0x3986('0x19')]?_0x34fe26[_0x3986('0x19')][_0x3986('0x1a')]===undefined?!![]:![]:!![],'where':_0x34fe26[_0x3986('0x19')]?_0x34fe26[_0x3986('0x19')][_0x3986('0x22')]||null:null,'attributes':_0x34fe26['options']?_0x34fe26[_0x3986('0x19')][_0x3986('0x1b')]||null:null,'include':_0x34fe26['options']?_0x34fe26['options'][_0x3986('0x1d')]?_[_0x3986('0x1e')](_0x34fe26['options'][_0x3986('0x1d')],function(_0x239b38){return{'model':db[_0x239b38[_0x3986('0x1f')]],'as':_0x239b38['as'],'attributes':_0x239b38['attributes'],'include':_0x239b38['include']?_['map'](_0x239b38[_0x3986('0x1d')],function(_0x3f3f4e){return{'model':db[_0x3f3f4e[_0x3986('0x1f')]],'as':_0x3f3f4e['as'],'attributes':_0x3f3f4e['attributes'],'include':_0x3f3f4e[_0x3986('0x1d')]?_[_0x3986('0x1e')](_0x3f3f4e['include'],function(_0x324b7e){return{'model':db[_0x324b7e['model']],'as':_0x324b7e['as'],'attributes':_0x324b7e[_0x3986('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3986('0xc')](function(_0x309fb0){logger['info']('ShowMailQueue',_0x34fe26);logger[_0x3986('0xe')](_0x3986('0x20'),_0x34fe26,JSON['stringify'](_0x309fb0));_0x5144ef(_0x309fb0);})[_0x3986('0x16')](function(_0x4fa962){logger['error'](_0x3986('0x20'),_0x4fa962[_0x3986('0x13')],_0x34fe26);_0x31b1f0(_0x8c3098[_0x3986('0x10')](0x1f4,_0x4fa962[_0x3986('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 9a60695..881e658 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 _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 +var _0x819d=['mailQueue:','save','remove','emit','register','length'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0x819d,0x10f));var _0xd819=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x819d[_0xdea41a];return _0x15d0d8;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0xd819('0x0'),_0xd819('0x1'),'update'];function createListener(_0x1edf21,_0x505197){return function(_0x5a469f){_0x505197[_0xd819('0x2')](_0x1edf21,_0x5a469f);};}function removeListener(_0x5cd921,_0x406c9f){return function(){MailQueueEvents['removeListener'](_0x5cd921,_0x406c9f);};}exports[_0xd819('0x3')]=function(_0x5422e0){for(var _0x4ca395=0x0,_0x1b7499=events[_0xd819('0x4')];_0x4ca395<_0x1b7499;_0x4ca395++){var _0x138ac3=events[_0x4ca395];var _0x4275c9=createListener(_0xd819('0x5')+_0x138ac3,_0x5422e0);MailQueueEvents['on'](_0x138ac3,_0x4275c9);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index ca05c79..7972a2b 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 _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 +var _0xaad1=['/describe','describe','/:id','show','create','put','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','isAuthenticated','index','get'];(function(_0x4cb81f,_0x4208ba){var _0x5fc77d=function(_0x545519){while(--_0x545519){_0x4cb81f['push'](_0x4cb81f['shift']());}};_0x5fc77d(++_0x4208ba);}(_0xaad1,0x159));var _0x1aad=function(_0x34ec8b,_0x4cc6a7){_0x34ec8b=_0x34ec8b-0x0;var _0x29930b=_0xaad1[_0x34ec8b];return _0x29930b;};'use strict';var multer=require(_0x1aad('0x0'));var util=require(_0x1aad('0x1'));var path=require(_0x1aad('0x2'));var timeout=require('connect-timeout');var express=require(_0x1aad('0x3'));var router=express[_0x1aad('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1aad('0x5'));var interaction=require(_0x1aad('0x6'));var config=require(_0x1aad('0x7'));var controller=require(_0x1aad('0x8'));router['get']('/',auth[_0x1aad('0x9')](),controller[_0x1aad('0xa')]);router[_0x1aad('0xb')](_0x1aad('0xc'),auth['isAuthenticated'](),controller[_0x1aad('0xd')]);router[_0x1aad('0xb')](_0x1aad('0xe'),auth[_0x1aad('0x9')](),controller[_0x1aad('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1aad('0x10')]);router[_0x1aad('0x11')](_0x1aad('0xe'),auth[_0x1aad('0x9')](),controller['update']);router[_0x1aad('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x1aad('0x13')]);module[_0x1aad('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index bca0000..c68bfd0 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 _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 +var _0xf0aa=['STRING','DATE','moment','exports'];(function(_0x501266,_0x2d0582){var _0x5bf6b6=function(_0x16e270){while(--_0x16e270){_0x501266['push'](_0x501266['shift']());}};_0x5bf6b6(++_0x2d0582);}(_0xf0aa,0x16e));var _0xaf0a=function(_0x45e96f,_0x108680){_0x45e96f=_0x45e96f-0x0;var _0x42666a=_0xf0aa[_0x45e96f];return _0x42666a;};'use strict';var moment=require(_0xaf0a('0x0'));var Sequelize=require('sequelize');module[_0xaf0a('0x1')]={'uniqueid':{'type':Sequelize[_0xaf0a('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xaf0a('0x2')]},'joinAt':{'type':Sequelize[_0xaf0a('0x3')]},'leaveAt':{'type':Sequelize[_0xaf0a('0x3')]},'acceptAt':{'type':Sequelize[_0xaf0a('0x3')]},'exitAt':{'type':Sequelize[_0xaf0a('0x3')]},'reason':{'type':Sequelize[_0xaf0a('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index dac9764..c0ee245 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 _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 +var _0x2a07=['index','map','MailQueueReport','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(_0x45d5ef,_0x10c29b){_0x45d5ef=_0x45d5ef-0x0;var _0x474d19=_0x2a07[_0x45d5ef];return _0x474d19;};'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['MailQueueReport'][_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['MailQueueReport']['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/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 6377479..ed55f4e 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 _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 +var _0x8542=['MailQueueReport','report_mail_queue','uniqueid','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports'];(function(_0x4a81be,_0x4630f9){var _0x4ade58=function(_0x81653){while(--_0x81653){_0x4a81be['push'](_0x4a81be['shift']());}};_0x4ade58(++_0x4630f9);}(_0x8542,0x1e4));var _0x2854=function(_0x40510f,_0x685bc9){_0x40510f=_0x40510f-0x0;var _0x3eebfc=_0x8542[_0x40510f];return _0x3eebfc;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2854('0x0'))(_0x2854('0x1'));var moment=require(_0x2854('0x2'));var BPromise=require(_0x2854('0x3'));var rp=require(_0x2854('0x4'));var fs=require('fs');var path=require(_0x2854('0x5'));var rimraf=require(_0x2854('0x6'));var config=require(_0x2854('0x7'));var attributes=require(_0x2854('0x8'));module[_0x2854('0x9')]=function(_0xfb5930,_0x2cf109){return _0xfb5930['define'](_0x2854('0xa'),attributes,{'tableName':_0x2854('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x2854('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index abe182b..dffa34f 100644 --- a/server/api/mailQueueReport/mailQueueReport.rpc.js +++ b/server/api/mailQueueReport/mailQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['MailQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateMailQueueReport','create','options','raw','debug','MailQueueReport','body','attributes','limit','UpdateMailQueueReport','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_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 +var _0x326f=['error','code','message','result','catch','CreateMailQueueReport','MailQueueReport','options','raw','stringify','UpdateMailQueueReport','body','attributes','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x157b5d,_0x47636d){var _0x510524=function(_0x1eac1a){while(--_0x1eac1a){_0x157b5d['push'](_0x157b5d['shift']());}};_0x510524(++_0x47636d);}(_0x326f,0xd1));var _0xf326=function(_0x40361a,_0x1a06f8){_0x40361a=_0x40361a-0x0;var _0x4444c0=_0x326f[_0x40361a];return _0x4444c0;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('MailQueueReport,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});}exports[_0xf326('0x14')]=function(_0x453100){var _0x18bee3=this;return new Promise(function(_0x31ffb9,_0xcef2b5){return db[_0xf326('0x15')]['create'](_0x453100['body'],{'raw':_0x453100['options']?_0x453100[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x4cabce){logger[_0xf326('0xb')]('CreateMailQueueReport',_0x453100);logger['debug'](_0xf326('0x14'),_0x453100,JSON[_0xf326('0x18')](_0x4cabce));_0x31ffb9(_0x4cabce);})['catch'](function(_0x5aa184){logger[_0xf326('0xf')](_0xf326('0x14'),_0x5aa184['message'],_0x453100);_0xcef2b5(_0x18bee3[_0xf326('0xf')](0x1f4,_0x5aa184[_0xf326('0x11')]));});});};exports[_0xf326('0x19')]=function(_0x295752){var _0x17c157=this;return new Promise(function(_0x2049ec,_0x5ce532){return db['MailQueueReport']['update'](_0x295752[_0xf326('0x1a')],{'raw':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')]['where']||null:null,'attributes':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x1b')]||null:null,'limit':_0x295752['options']?_0x295752[_0xf326('0x16')]['limit']||null:null})['then'](function(_0x6a8e89){logger[_0xf326('0xb')](_0xf326('0x19'),_0x295752);logger['debug'](_0xf326('0x19'),_0x295752,JSON[_0xf326('0x18')](_0x6a8e89));_0x2049ec(_0x6a8e89);})['catch'](function(_0x225776){logger[_0xf326('0xf')](_0xf326('0x19'),_0x225776[_0xf326('0x11')],_0x295752);_0x5ce532(_0x17c157[_0xf326('0xf')](0x1f4,_0x225776[_0xf326('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 283ba17..26f6755 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(_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 +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x40ec82,_0x400b6b){var _0x444de0=function(_0x3b4b96){while(--_0x3b4b96){_0x40ec82['push'](_0x40ec82['shift']());}};_0x444de0(++_0x400b6b);}(_0xe706,0xa3));var _0x6e70=function(_0x503bc0,_0x12aeee){_0x503bc0=_0x503bc0-0x0;var _0x383246=_0xe706[_0x503bc0];return _0x383246;};'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/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 7f11f65..d544b51 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 _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 +var _0x911d=['sequelize','exports','STRING','BOOLEAN','INTEGER','INBOX'];(function(_0x3941cf,_0x2423ac){var _0xd814f7=function(_0x4548ce){while(--_0x4548ce){_0x3941cf['push'](_0x3941cf['shift']());}};_0xd814f7(++_0x2423ac);}(_0x911d,0xea));var _0xd911=function(_0x1b6158,_0x1b7c2f){_0x1b6158=_0x1b6158-0x0;var _0x5c6338=_0x911d[_0x1b6158];return _0x5c6338;};'use strict';var Sequelize=require(_0xd911('0x0'));module[_0xd911('0x1')]={'description':{'type':Sequelize[_0xd911('0x2')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xd911('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xd911('0x2')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xd911('0x4')]},'tls':{'type':Sequelize[_0xd911('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xd911('0x2')],'defaultValue':_0xd911('0x5')},'connTimeout':{'type':Sequelize[_0xd911('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xd911('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0xd911('0x2')]},'modernAuthentication':{'type':Sequelize[_0xd911('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 a38c1da..1860f0c 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 _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 +var _0x0179=['./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash','util','api','moment','bluebird','path','rimraf'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x0179,0x1cd));var _0x9017=function(_0x174ef5,_0x256e8e){_0x174ef5=_0x174ef5-0x0;var _0x1cc379=_0x0179[_0x174ef5];return _0x1cc379;};'use strict';var _=require(_0x9017('0x0'));var util=require(_0x9017('0x1'));var logger=require('../../config/logger')(_0x9017('0x2'));var moment=require(_0x9017('0x3'));var BPromise=require(_0x9017('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9017('0x5'));var rimraf=require(_0x9017('0x6'));var config=require('../../config/environment');var attributes=require(_0x9017('0x7'));module[_0x9017('0x8')]=function(_0x20e760,_0x107dd2){return _0x20e760[_0x9017('0x9')](_0x9017('0xa'),attributes,{'tableName':_0x9017('0xb'),'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 44095bb..924b54c 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 _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 +var _0xbacf=['jayson/promise','client','http','request','then','info','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','MailServerIn','options','raw','where','attributes','limit','map','model','include','GetMailServerIn','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment'];(function(_0x7f76fb,_0x2ba234){var _0x289986=function(_0x58862d){while(--_0x58862d){_0x7f76fb['push'](_0x7f76fb['shift']());}};_0x289986(++_0x2ba234);}(_0xbacf,0xf9));var _0xfbac=function(_0xaf25ae,_0x2001c1){_0xaf25ae=_0xaf25ae-0x0;var _0x49732d=_0xbacf[_0xaf25ae];return _0x49732d;};'use strict';var _=require('lodash');var util=require(_0xfbac('0x0'));var moment=require(_0xfbac('0x1'));var BPromise=require(_0xfbac('0x2'));var rs=require(_0xfbac('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfbac('0x4'))(_0xfbac('0x5'));var config=require(_0xfbac('0x6'));var jayson=require(_0xfbac('0x7'));var client=jayson[_0xfbac('0x8')][_0xfbac('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x32a173,_0x31ff42,_0x5880c9){return new BPromise(function(_0x38c928,_0x35d67f){return client[_0xfbac('0xa')](_0x32a173,_0x5880c9)[_0xfbac('0xb')](function(_0x1b91a6){logger[_0xfbac('0xc')](_0xfbac('0xd'),_0x31ff42,'request\x20sent');logger[_0xfbac('0xe')](_0xfbac('0xf'),_0x31ff42,_0xfbac('0x10'),JSON[_0xfbac('0x11')](_0x1b91a6));if(_0x1b91a6[_0xfbac('0x12')]){if(_0x1b91a6[_0xfbac('0x12')]['code']===0x1f4){logger[_0xfbac('0x12')]('MailServerIn,\x20%s,\x20%s',_0x31ff42,_0x1b91a6[_0xfbac('0x12')][_0xfbac('0x13')]);return _0x35d67f(_0x1b91a6['error'][_0xfbac('0x13')]);}logger['error'](_0xfbac('0xd'),_0x31ff42,_0x1b91a6[_0xfbac('0x12')]['message']);return _0x38c928(_0x1b91a6[_0xfbac('0x12')][_0xfbac('0x13')]);}else{logger[_0xfbac('0xc')]('MailServerIn,\x20%s,\x20%s',_0x31ff42,_0xfbac('0x10'));_0x38c928(_0x1b91a6[_0xfbac('0x14')][_0xfbac('0x13')]);}})[_0xfbac('0x15')](function(_0x2b316a){logger[_0xfbac('0x12')]('MailServerIn,\x20%s,\x20%s',_0x31ff42,_0x2b316a);_0x35d67f(_0x2b316a);});});}exports['GetMailServerIn']=function(_0x102efe){var _0x56d710=this;return new Promise(function(_0x204e08,_0x3844e4){return db[_0xfbac('0x16')]['findAll']({'raw':_0x102efe[_0xfbac('0x17')]?_0x102efe[_0xfbac('0x17')][_0xfbac('0x18')]===undefined?!![]:![]:!![],'where':_0x102efe[_0xfbac('0x17')]?_0x102efe[_0xfbac('0x17')][_0xfbac('0x19')]||null:null,'attributes':_0x102efe[_0xfbac('0x17')]?_0x102efe['options'][_0xfbac('0x1a')]||null:null,'limit':_0x102efe['options']?_0x102efe[_0xfbac('0x17')][_0xfbac('0x1b')]||null:null,'include':_0x102efe[_0xfbac('0x17')]?_0x102efe[_0xfbac('0x17')]['include']?_[_0xfbac('0x1c')](_0x102efe[_0xfbac('0x17')]['include'],function(_0x15ac9a){return{'model':db[_0x15ac9a[_0xfbac('0x1d')]],'as':_0x15ac9a['as'],'attributes':_0x15ac9a[_0xfbac('0x1a')],'include':_0x15ac9a[_0xfbac('0x1e')]?_[_0xfbac('0x1c')](_0x15ac9a['include'],function(_0x1fc2fc){return{'model':db[_0x1fc2fc['model']],'as':_0x1fc2fc['as'],'attributes':_0x1fc2fc['attributes'],'include':_0x1fc2fc[_0xfbac('0x1e')]?_['map'](_0x1fc2fc['include'],function(_0x18831c){return{'model':db[_0x18831c['model']],'as':_0x18831c['as'],'attributes':_0x18831c[_0xfbac('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xfbac('0xb')](function(_0x816ce2){logger['info'](_0xfbac('0x1f'),_0x102efe);logger[_0xfbac('0xe')](_0xfbac('0x1f'),_0x102efe,JSON[_0xfbac('0x11')](_0x816ce2));_0x204e08(_0x816ce2);})[_0xfbac('0x15')](function(_0x470bbc){logger[_0xfbac('0x12')](_0xfbac('0x1f'),_0x470bbc[_0xfbac('0x13')],_0x102efe);_0x3844e4(_0x56d710[_0xfbac('0x12')](0x1f4,_0x470bbc[_0xfbac('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 307c9b3..c53c910 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(_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 +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(_0x36dfbd,_0x5bfe2d){var _0x4ecad9=function(_0x5230da){while(--_0x5230da){_0x36dfbd['push'](_0x36dfbd['shift']());}};_0x4ecad9(++_0x5bfe2d);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('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 46af1bb..a60460d 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 _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 +var _0x02ce=['STRING','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x5c0d22,_0x5f0038){var _0x37ea90=function(_0x461a6f){while(--_0x461a6f){_0x5c0d22['push'](_0x5c0d22['shift']());}};_0x37ea90(++_0x5f0038);}(_0x02ce,0x1ac));var _0xe02c=function(_0xc210df,_0x1256be){_0xc210df=_0xc210df-0x0;var _0x2665b6=_0x02ce[_0xc210df];return _0x2665b6;};'use strict';var Sequelize=require(_0xe02c('0x0'));module[_0xe02c('0x1')]={'description':{'type':Sequelize[_0xe02c('0x2')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0xe02c('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xe02c('0x3')]},'secure':{'type':Sequelize[_0xe02c('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0xe02c('0x2')]},'authentication':{'type':Sequelize[_0xe02c('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xe02c('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index e690eec..ed5fc47 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 _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 +var _0x561c=['include','MailServerOut','findAll','rows','catch','show','params','create','body','update','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','includeAll'];(function(_0x29ae7d,_0x45dac8){var _0x5623f7=function(_0x5a6d89){while(--_0x5a6d89){_0x29ae7d['push'](_0x29ae7d['shift']());}};_0x5623f7(++_0x45dac8);}(_0x561c,0xec));var _0xc561=function(_0x375e3b,_0x578ba6){_0x375e3b=_0x375e3b-0x0;var _0x24c442=_0x561c[_0x375e3b];return _0x24c442;};'use strict';var emlformat=require(_0xc561('0x0'));var rimraf=require(_0xc561('0x1'));var zipdir=require(_0xc561('0x2'));var jsonpatch=require(_0xc561('0x3'));var rp=require(_0xc561('0x4'));var moment=require('moment');var BPromise=require(_0xc561('0x5'));var Mustache=require(_0xc561('0x6'));var util=require('util');var path=require(_0xc561('0x7'));var sox=require(_0xc561('0x8'));var csv=require(_0xc561('0x9'));var ejs=require(_0xc561('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc561('0xb'));var squel=require(_0xc561('0xc'));var crypto=require(_0xc561('0xd'));var jsforce=require(_0xc561('0xe'));var deskjs=require(_0xc561('0xf'));var toCsv=require(_0xc561('0x9'));var querystring=require(_0xc561('0x10'));var Papa=require('papaparse');var Redis=require(_0xc561('0x11'));var authService=require(_0xc561('0x12'));var qs=require(_0xc561('0x13'));var as=require(_0xc561('0x14'));var hardwareService=require(_0xc561('0x15'));var logger=require(_0xc561('0x16'))(_0xc561('0x17'));var utils=require('../../config/utils');var config=require(_0xc561('0x18'));var licenseUtil=require(_0xc561('0x19'));var db=require(_0xc561('0x1a'))['db'];function respondWithStatusCode(_0x4e5723,_0x564cd6){_0x564cd6=_0x564cd6||0xcc;return function(_0x2a81fb){if(_0x2a81fb){return _0x4e5723[_0xc561('0x1b')](_0x564cd6);}return _0x4e5723['status'](_0x564cd6)[_0xc561('0x1c')]();};}function respondWithResult(_0x162ba8,_0xf5e040){_0xf5e040=_0xf5e040||0xc8;return function(_0x443e5b){if(_0x443e5b){return _0x162ba8[_0xc561('0x1d')](_0xf5e040)[_0xc561('0x1e')](_0x443e5b);}};}function respondWithFilteredResult(_0x21cebc,_0x367bd3){return function(_0x5eb636){if(_0x5eb636){var _0x3c7222=typeof _0x367bd3[_0xc561('0x1f')]===_0xc561('0x20')&&typeof _0x367bd3[_0xc561('0x21')]===_0xc561('0x20');var _0x5ecf08=_0x5eb636[_0xc561('0x22')];var _0x416e8c=_0x3c7222?0x0:_0x367bd3[_0xc561('0x1f')];var _0x617452=_0x3c7222?_0x5eb636[_0xc561('0x22')]:_0x367bd3[_0xc561('0x1f')]+_0x367bd3[_0xc561('0x21')];var _0x214538;if(_0x617452>=_0x5ecf08){_0x617452=_0x5ecf08;_0x214538=0xc8;}else{_0x214538=0xce;}_0x21cebc[_0xc561('0x1d')](_0x214538);return _0x21cebc[_0xc561('0x23')](_0xc561('0x24'),_0x416e8c+'-'+_0x617452+'/'+_0x5ecf08)[_0xc561('0x1e')](_0x5eb636);}return null;};}function patchUpdates(_0x4a9789){return function(_0x23943c){try{jsonpatch['apply'](_0x23943c,_0x4a9789,!![]);}catch(_0x22cf82){return BPromise['reject'](_0x22cf82);}return _0x23943c['save']();};}function saveUpdates(_0x4bbac9,_0x36d614){return function(_0x414b66){if(_0x414b66){return _0x414b66['update'](_0x4bbac9)[_0xc561('0x25')](function(_0x105637){return _0x105637;});}return null;};}function removeEntity(_0x4d787b,_0x2cb40e){return function(_0x4f7637){if(_0x4f7637){return _0x4f7637[_0xc561('0x26')]()[_0xc561('0x25')](function(){_0x4d787b[_0xc561('0x1d')](0xcc)[_0xc561('0x1c')]();});}};}function handleEntityNotFound(_0x5c478c,_0x1c82af){return function(_0x3e15da){if(!_0x3e15da){_0x5c478c[_0xc561('0x1b')](0x194);}return _0x3e15da;};}function handleError(_0x542790,_0x418f44){_0x418f44=_0x418f44||0x1f4;return function(_0x31d827){logger['error'](_0x31d827[_0xc561('0x27')]);if(_0x31d827['name']){delete _0x31d827[_0xc561('0x28')];}_0x542790[_0xc561('0x1d')](_0x418f44)[_0xc561('0x29')](_0x31d827);};}exports[_0xc561('0x2a')]=function(_0x31e889,_0x5065a5){var _0x55c840={},_0x164ac1={},_0x408146={'count':0x0,'rows':[]};var _0x2885c2=_[_0xc561('0x2b')](db['MailServerOut'][_0xc561('0x2c')],function(_0x5bf721){return{'name':_0x5bf721[_0xc561('0x2d')],'type':_0x5bf721[_0xc561('0x2e')][_0xc561('0x2f')]};});_0x164ac1['model']=_[_0xc561('0x2b')](_0x2885c2,_0xc561('0x28'));_0x164ac1[_0xc561('0x30')]=_[_0xc561('0x31')](_0x31e889[_0xc561('0x30')]);_0x164ac1[_0xc561('0x32')]=_[_0xc561('0x33')](_0x164ac1[_0xc561('0x34')],_0x164ac1[_0xc561('0x30')]);_0x55c840[_0xc561('0x35')]=_[_0xc561('0x33')](_0x164ac1['model'],qs[_0xc561('0x36')](_0x31e889[_0xc561('0x30')][_0xc561('0x36')]));_0x55c840[_0xc561('0x35')]=_0x55c840['attributes'][_0xc561('0x37')]?_0x55c840[_0xc561('0x35')]:_0x164ac1[_0xc561('0x34')];if(!_0x31e889[_0xc561('0x30')][_0xc561('0x38')]('nolimit')){_0x55c840['limit']=qs['limit'](_0x31e889['query'][_0xc561('0x21')]);_0x55c840[_0xc561('0x1f')]=qs[_0xc561('0x1f')](_0x31e889[_0xc561('0x30')][_0xc561('0x1f')]);}_0x55c840[_0xc561('0x39')]=qs[_0xc561('0x3a')](_0x31e889[_0xc561('0x30')]['sort']);_0x55c840[_0xc561('0x3b')]=qs[_0xc561('0x32')](_['pick'](_0x31e889['query'],_0x164ac1[_0xc561('0x32')]),_0x2885c2);if(_0x31e889[_0xc561('0x30')][_0xc561('0x3c')]){_0x55c840[_0xc561('0x3b')]=_[_0xc561('0x3d')](_0x55c840[_0xc561('0x3b')],{'$or':_[_0xc561('0x2b')](_0x2885c2,function(_0x48e5d4){if(_0x48e5d4[_0xc561('0x2e')]!=='VIRTUAL'){var _0x542a17={};_0x542a17[_0x48e5d4[_0xc561('0x28')]]={'$like':'%'+_0x31e889['query'][_0xc561('0x3c')]+'%'};return _0x542a17;}})});}_0x55c840=_[_0xc561('0x3d')]({},_0x55c840,_0x31e889[_0xc561('0x3e')]);var _0x147da3={'where':_0x55c840[_0xc561('0x3b')]};return db['MailServerOut'][_0xc561('0x22')](_0x147da3)[_0xc561('0x25')](function(_0x161fd9){_0x408146[_0xc561('0x22')]=_0x161fd9;if(_0x31e889[_0xc561('0x30')][_0xc561('0x3f')]){_0x55c840[_0xc561('0x40')]=[{'all':!![]}];}return db[_0xc561('0x41')][_0xc561('0x42')](_0x55c840);})[_0xc561('0x25')](function(_0x5e0f78){_0x408146[_0xc561('0x43')]=_0x5e0f78;return _0x408146;})['then'](respondWithFilteredResult(_0x5065a5,_0x55c840))[_0xc561('0x44')](handleError(_0x5065a5,null));};exports[_0xc561('0x45')]=function(_0x4647b1,_0x4beda2){var _0x2a9fc7={'raw':!![],'where':{'id':_0x4647b1[_0xc561('0x46')]['id']}},_0x1477f4={};_0x1477f4['model']=_[_0xc561('0x31')](db[_0xc561('0x41')][_0xc561('0x2c')]);_0x1477f4[_0xc561('0x30')]=_['keys'](_0x4647b1[_0xc561('0x30')]);_0x1477f4[_0xc561('0x32')]=_[_0xc561('0x33')](_0x1477f4[_0xc561('0x34')],_0x1477f4[_0xc561('0x30')]);_0x2a9fc7['attributes']=_['intersection'](_0x1477f4[_0xc561('0x34')],qs[_0xc561('0x36')](_0x4647b1[_0xc561('0x30')]['fields']));_0x2a9fc7[_0xc561('0x35')]=_0x2a9fc7[_0xc561('0x35')][_0xc561('0x37')]?_0x2a9fc7[_0xc561('0x35')]:_0x1477f4['model'];if(_0x4647b1[_0xc561('0x30')][_0xc561('0x3f')]){_0x2a9fc7[_0xc561('0x40')]=[{'all':!![]}];}_0x2a9fc7=_[_0xc561('0x3d')]({},_0x2a9fc7,_0x4647b1[_0xc561('0x3e')]);return db['MailServerOut']['find'](_0x2a9fc7)['then'](handleEntityNotFound(_0x4beda2,null))[_0xc561('0x25')](respondWithResult(_0x4beda2,null))[_0xc561('0x44')](handleError(_0x4beda2,null));};exports[_0xc561('0x47')]=function(_0x5ec702,_0x89c452){return db[_0xc561('0x41')][_0xc561('0x47')](_0x5ec702[_0xc561('0x48')],{})[_0xc561('0x25')](respondWithResult(_0x89c452,0xc9))['catch'](handleError(_0x89c452,null));};exports[_0xc561('0x49')]=function(_0x357309,_0x1e0831){if(_0x357309['body']['id']){delete _0x357309['body']['id'];}return db[_0xc561('0x41')][_0xc561('0x4a')]({'where':{'id':_0x357309[_0xc561('0x46')]['id']}})['then'](handleEntityNotFound(_0x1e0831,null))[_0xc561('0x25')](saveUpdates(_0x357309['body'],null))['then'](respondWithResult(_0x1e0831,null))[_0xc561('0x44')](handleError(_0x1e0831,null));};exports[_0xc561('0x26')]=function(_0x5006fb,_0x190e11){return db[_0xc561('0x41')]['find']({'where':{'id':_0x5006fb[_0xc561('0x46')]['id']}})[_0xc561('0x25')](handleEntityNotFound(_0x190e11,null))[_0xc561('0x25')](removeEntity(_0x190e11,null))[_0xc561('0x44')](handleError(_0x190e11,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index f88308a..7754826 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 _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 +var _0x6e04=['MailServerOut','mail_servers_out','lodash','../../config/logger','api','request-promise','path','../../config/environment','./mailServerOut.attributes','define'];(function(_0x31b31b,_0x5f044e){var _0x2c8fc2=function(_0x5438aa){while(--_0x5438aa){_0x31b31b['push'](_0x31b31b['shift']());}};_0x2c8fc2(++_0x5f044e);}(_0x6e04,0x14c));var _0x46e0=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x6e04[_0x263a74];return _0x2aa86c;};'use strict';var _=require(_0x46e0('0x0'));var util=require('util');var logger=require(_0x46e0('0x1'))(_0x46e0('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x46e0('0x3'));var fs=require('fs');var path=require(_0x46e0('0x4'));var rimraf=require('rimraf');var config=require(_0x46e0('0x5'));var attributes=require(_0x46e0('0x6'));module['exports']=function(_0x2790db,_0xfaddfb){return _0x2790db[_0x46e0('0x7')](_0x46e0('0x8'),attributes,{'tableName':_0x46e0('0x9'),'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 1c9249b..a9caf8d 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_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 +var _0x1261=['then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','MailServerOut,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x4aa77f,_0x46380b){var _0x172429=function(_0x1b9894){while(--_0x1b9894){_0x4aa77f['push'](_0x4aa77f['shift']());}};_0x172429(++_0x46380b);}(_0x1261,0x144));var _0x1126=function(_0x3c3698,_0xa0bf08){_0x3c3698=_0x3c3698-0x0;var _0x4e6637=_0x1261[_0x3c3698];return _0x4e6637;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('MailServerOut,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index aa04da5..c3ea4ac 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 _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 +var _0x52c8=['../../components/auth/service','isAuthenticated','index','get','describe','/:id','show','post','create','put','delete','destroy','exports','multer','express','Router','fs-extra'];(function(_0x5d8e11,_0x1b2574){var _0x25fa53=function(_0x5376ce){while(--_0x5376ce){_0x5d8e11['push'](_0x5d8e11['shift']());}};_0x25fa53(++_0x1b2574);}(_0x52c8,0xea));var _0x852c=function(_0xf73c09,_0x4e424e){_0xf73c09=_0xf73c09-0x0;var _0xa8923c=_0x52c8[_0xf73c09];return _0xa8923c;};'use strict';var multer=require(_0x852c('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x852c('0x1'));var router=express[_0x852c('0x2')]();var fs_extra=require(_0x852c('0x3'));var auth=require(_0x852c('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./mailSubstatus.controller');router['get']('/',auth[_0x852c('0x5')](),controller[_0x852c('0x6')]);router[_0x852c('0x7')]('/describe',auth[_0x852c('0x5')](),controller[_0x852c('0x8')]);router['get'](_0x852c('0x9'),auth[_0x852c('0x5')](),controller[_0x852c('0xa')]);router[_0x852c('0xb')]('/',auth['isAuthenticated'](),controller[_0x852c('0xc')]);router[_0x852c('0xd')](_0x852c('0x9'),auth[_0x852c('0x5')](),controller['update']);router[_0x852c('0xe')](_0x852c('0x9'),auth[_0x852c('0x5')](),controller[_0x852c('0xf')]);module[_0x852c('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 32dfd87..c6baf66 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 _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 +var _0xbd0a=['STRING','sequelize'];(function(_0x5f1655,_0x367317){var _0xc28028=function(_0x2e7f7f){while(--_0x2e7f7f){_0x5f1655['push'](_0x5f1655['shift']());}};_0xc28028(++_0x367317);}(_0xbd0a,0x1b9));var _0xabd0=function(_0x5acdfb,_0x9c7431){_0x5acdfb=_0x5acdfb-0x0;var _0x53514b=_0xbd0a[_0x5acdfb];return _0x53514b;};'use strict';var Sequelize=require(_0xabd0('0x0'));module['exports']={'name':{'type':Sequelize[_0xabd0('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 7774005..5d7e57a 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 _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 +var _0x8af6=['Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','MailSubstatus','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','map','VIRTUAL','filter','options','count','includeAll','findAll','rows','catch','show','params','include','merge','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','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','../../mysqldb','sendStatus','status','end','offset','undefined','limit','set'];(function(_0x46a671,_0x758e9a){var _0x526d75=function(_0xde3640){while(--_0xde3640){_0x46a671['push'](_0x46a671['shift']());}};_0x526d75(++_0x758e9a);}(_0x8af6,0x11e));var _0x68af=function(_0x12f1f6,_0x120246){_0x12f1f6=_0x12f1f6-0x0;var _0xfef78f=_0x8af6[_0x12f1f6];return _0xfef78f;};'use strict';var emlformat=require(_0x68af('0x0'));var rimraf=require(_0x68af('0x1'));var zipdir=require(_0x68af('0x2'));var jsonpatch=require(_0x68af('0x3'));var rp=require(_0x68af('0x4'));var moment=require(_0x68af('0x5'));var BPromise=require(_0x68af('0x6'));var Mustache=require(_0x68af('0x7'));var util=require(_0x68af('0x8'));var path=require('path');var sox=require(_0x68af('0x9'));var csv=require(_0x68af('0xa'));var ejs=require(_0x68af('0xb'));var fs=require('fs');var fs_extra=require(_0x68af('0xc'));var _=require(_0x68af('0xd'));var squel=require(_0x68af('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x68af('0xf'));var toCsv=require(_0x68af('0xa'));var querystring=require(_0x68af('0x10'));var Papa=require(_0x68af('0x11'));var Redis=require(_0x68af('0x12'));var authService=require(_0x68af('0x13'));var qs=require(_0x68af('0x14'));var as=require(_0x68af('0x15'));var hardwareService=require(_0x68af('0x16'));var logger=require(_0x68af('0x17'))('api');var utils=require(_0x68af('0x18'));var config=require(_0x68af('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x68af('0x1a'))['db'];function respondWithStatusCode(_0x12c1da,_0x3d322e){_0x3d322e=_0x3d322e||0xcc;return function(_0x273028){if(_0x273028){return _0x12c1da[_0x68af('0x1b')](_0x3d322e);}return _0x12c1da[_0x68af('0x1c')](_0x3d322e)[_0x68af('0x1d')]();};}function respondWithResult(_0x445fca,_0x5c7208){_0x5c7208=_0x5c7208||0xc8;return function(_0xd5ac52){if(_0xd5ac52){return _0x445fca[_0x68af('0x1c')](_0x5c7208)['json'](_0xd5ac52);}};}function respondWithFilteredResult(_0x141500,_0x6631dd){return function(_0x5e78b5){if(_0x5e78b5){var _0x451c7a=typeof _0x6631dd[_0x68af('0x1e')]===_0x68af('0x1f')&&typeof _0x6631dd[_0x68af('0x20')]===_0x68af('0x1f');var _0x447a38=_0x5e78b5['count'];var _0xe485cb=_0x451c7a?0x0:_0x6631dd[_0x68af('0x1e')];var _0x2ec2f6=_0x451c7a?_0x5e78b5['count']:_0x6631dd['offset']+_0x6631dd[_0x68af('0x20')];var _0x5b435f;if(_0x2ec2f6>=_0x447a38){_0x2ec2f6=_0x447a38;_0x5b435f=0xc8;}else{_0x5b435f=0xce;}_0x141500[_0x68af('0x1c')](_0x5b435f);return _0x141500[_0x68af('0x21')](_0x68af('0x22'),_0xe485cb+'-'+_0x2ec2f6+'/'+_0x447a38)['json'](_0x5e78b5);}return null;};}function patchUpdates(_0x5c6979){return function(_0x3ef142){try{jsonpatch['apply'](_0x3ef142,_0x5c6979,!![]);}catch(_0x5d527c){return BPromise[_0x68af('0x23')](_0x5d527c);}return _0x3ef142[_0x68af('0x24')]();};}function saveUpdates(_0x22647f,_0xccb15c){return function(_0x4fbb54){if(_0x4fbb54){return _0x4fbb54[_0x68af('0x25')](_0x22647f)[_0x68af('0x26')](function(_0x17056e){return _0x17056e;});}return null;};}function removeEntity(_0x15b56c,_0x2d45af){return function(_0x46ca41){if(_0x46ca41){return _0x46ca41[_0x68af('0x27')]()[_0x68af('0x26')](function(){_0x15b56c[_0x68af('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4241f4,_0xa54510){return function(_0x4682f7){if(!_0x4682f7){_0x4241f4[_0x68af('0x1b')](0x194);}return _0x4682f7;};}function handleError(_0x4fba00,_0x51a267){_0x51a267=_0x51a267||0x1f4;return function(_0x4eafb7){logger[_0x68af('0x28')](_0x4eafb7[_0x68af('0x29')]);if(_0x4eafb7[_0x68af('0x2a')]){delete _0x4eafb7[_0x68af('0x2a')];}_0x4fba00[_0x68af('0x1c')](_0x51a267)[_0x68af('0x2b')](_0x4eafb7);};}exports[_0x68af('0x2c')]=function(_0xca1feb,_0x45601d){var _0x38ee50={},_0x271082={},_0x3ef7a5={'count':0x0,'rows':[]};var _0x44bbd9=_['map'](db[_0x68af('0x2d')][_0x68af('0x2e')],function(_0x2268cc){return{'name':_0x2268cc[_0x68af('0x2f')],'type':_0x2268cc[_0x68af('0x30')][_0x68af('0x31')]};});_0x271082[_0x68af('0x32')]=_['map'](_0x44bbd9,_0x68af('0x2a'));_0x271082[_0x68af('0x33')]=_[_0x68af('0x34')](_0xca1feb['query']);_0x271082[_0x68af('0x35')]=_[_0x68af('0x36')](_0x271082[_0x68af('0x32')],_0x271082[_0x68af('0x33')]);_0x38ee50[_0x68af('0x37')]=_[_0x68af('0x36')](_0x271082['model'],qs[_0x68af('0x38')](_0xca1feb[_0x68af('0x33')][_0x68af('0x38')]));_0x38ee50[_0x68af('0x37')]=_0x38ee50[_0x68af('0x37')][_0x68af('0x39')]?_0x38ee50[_0x68af('0x37')]:_0x271082[_0x68af('0x32')];if(!_0xca1feb[_0x68af('0x33')][_0x68af('0x3a')]('nolimit')){_0x38ee50[_0x68af('0x20')]=qs[_0x68af('0x20')](_0xca1feb[_0x68af('0x33')][_0x68af('0x20')]);_0x38ee50['offset']=qs[_0x68af('0x1e')](_0xca1feb[_0x68af('0x33')][_0x68af('0x1e')]);}_0x38ee50[_0x68af('0x3b')]=qs[_0x68af('0x3c')](_0xca1feb[_0x68af('0x33')]['sort']);_0x38ee50[_0x68af('0x3d')]=qs[_0x68af('0x35')](_[_0x68af('0x3e')](_0xca1feb[_0x68af('0x33')],_0x271082[_0x68af('0x35')]),_0x44bbd9);if(_0xca1feb[_0x68af('0x33')]['filter']){_0x38ee50[_0x68af('0x3d')]=_['merge'](_0x38ee50[_0x68af('0x3d')],{'$or':_[_0x68af('0x3f')](_0x44bbd9,function(_0x1963a2){if(_0x1963a2[_0x68af('0x30')]!==_0x68af('0x40')){var _0x2a0f3e={};_0x2a0f3e[_0x1963a2[_0x68af('0x2a')]]={'$like':'%'+_0xca1feb[_0x68af('0x33')][_0x68af('0x41')]+'%'};return _0x2a0f3e;}})});}_0x38ee50=_['merge']({},_0x38ee50,_0xca1feb[_0x68af('0x42')]);var _0x18f83c={'where':_0x38ee50['where']};return db[_0x68af('0x2d')]['count'](_0x18f83c)[_0x68af('0x26')](function(_0x33695b){_0x3ef7a5[_0x68af('0x43')]=_0x33695b;if(_0xca1feb[_0x68af('0x33')][_0x68af('0x44')]){_0x38ee50['include']=[{'all':!![]}];}return db[_0x68af('0x2d')][_0x68af('0x45')](_0x38ee50);})[_0x68af('0x26')](function(_0x2925f4){_0x3ef7a5[_0x68af('0x46')]=_0x2925f4;return _0x3ef7a5;})['then'](respondWithFilteredResult(_0x45601d,_0x38ee50))[_0x68af('0x47')](handleError(_0x45601d,null));};exports[_0x68af('0x48')]=function(_0x4dbf29,_0x2949fe){var _0x3bfebe={'raw':!![],'where':{'id':_0x4dbf29[_0x68af('0x49')]['id']}},_0x278ba6={};_0x278ba6[_0x68af('0x32')]=_[_0x68af('0x34')](db[_0x68af('0x2d')][_0x68af('0x2e')]);_0x278ba6[_0x68af('0x33')]=_['keys'](_0x4dbf29['query']);_0x278ba6[_0x68af('0x35')]=_[_0x68af('0x36')](_0x278ba6[_0x68af('0x32')],_0x278ba6['query']);_0x3bfebe[_0x68af('0x37')]=_[_0x68af('0x36')](_0x278ba6[_0x68af('0x32')],qs[_0x68af('0x38')](_0x4dbf29[_0x68af('0x33')][_0x68af('0x38')]));_0x3bfebe[_0x68af('0x37')]=_0x3bfebe[_0x68af('0x37')][_0x68af('0x39')]?_0x3bfebe['attributes']:_0x278ba6['model'];if(_0x4dbf29[_0x68af('0x33')][_0x68af('0x44')]){_0x3bfebe[_0x68af('0x4a')]=[{'all':!![]}];}_0x3bfebe=_[_0x68af('0x4b')]({},_0x3bfebe,_0x4dbf29[_0x68af('0x42')]);return db['MailSubstatus'][_0x68af('0x4c')](_0x3bfebe)['then'](handleEntityNotFound(_0x2949fe,null))[_0x68af('0x26')](respondWithResult(_0x2949fe,null))[_0x68af('0x47')](handleError(_0x2949fe,null));};exports['create']=function(_0x337b96,_0x27fb47){return db[_0x68af('0x2d')][_0x68af('0x4d')](_0x337b96[_0x68af('0x4e')],{})[_0x68af('0x26')](respondWithResult(_0x27fb47,0xc9))[_0x68af('0x47')](handleError(_0x27fb47,null));};exports[_0x68af('0x25')]=function(_0x4aef2d,_0xd8a9b1){if(_0x4aef2d[_0x68af('0x4e')]['id']){delete _0x4aef2d[_0x68af('0x4e')]['id'];}return db[_0x68af('0x2d')][_0x68af('0x4c')]({'where':{'id':_0x4aef2d[_0x68af('0x49')]['id']}})[_0x68af('0x26')](handleEntityNotFound(_0xd8a9b1,null))[_0x68af('0x26')](saveUpdates(_0x4aef2d[_0x68af('0x4e')],null))[_0x68af('0x26')](respondWithResult(_0xd8a9b1,null))[_0x68af('0x47')](handleError(_0xd8a9b1,null));};exports[_0x68af('0x27')]=function(_0x8d3f20,_0x2847dc){return db['MailSubstatus'][_0x68af('0x4c')]({'where':{'id':_0x8d3f20[_0x68af('0x49')]['id']}})[_0x68af('0x26')](handleEntityNotFound(_0x2847dc,null))[_0x68af('0x26')](removeEntity(_0x2847dc,null))[_0x68af('0x47')](handleError(_0x2847dc,null));};exports[_0x68af('0x4f')]=function(_0xd11d97,_0x332dde){return db[_0x68af('0x2d')][_0x68af('0x4f')]()['then'](respondWithResult(_0x332dde,null))[_0x68af('0x47')](handleError(_0x332dde,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 6d4ec6a..4424623 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 _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 +var _0x8094=['exports','events','MailSubstatus','setMaxListeners','update','emit','hasOwnProperty','hook'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x8094,0x101));var _0x4809=function(_0x229f5e,_0x433f0f){_0x229f5e=_0x229f5e-0x0;var _0x2d62ff=_0x8094[_0x229f5e];return _0x2d62ff;};'use strict';var EventEmitter=require(_0x4809('0x0'));var MailSubstatus=require('../../mysqldb')['db'][_0x4809('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x4809('0x2')](0x0);var events={'afterUpdate':_0x4809('0x3')};function emitEvent(_0xed9f9d){return function(_0x2d7a7c,_0x474eaf,_0x1c263d){MailSubstatusEvents[_0x4809('0x4')](_0xed9f9d+':'+_0x2d7a7c['id'],_0x2d7a7c);MailSubstatusEvents[_0x4809('0x4')](_0xed9f9d,_0x2d7a7c);_0x1c263d(null);};}for(var e in events){if(events[_0x4809('0x5')](e)){var event=events[e];MailSubstatus[_0x4809('0x6')](e,emitEvent(event));}}module[_0x4809('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 c37f413..47f2565 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 _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 +var _0xb06a=['models','define','Condition','update','mailSubstatus','_previousDataValues','name','then','catch','./mailSubstatus.attributes','exports'];(function(_0x29fdfc,_0x340ac4){var _0x5b7217=function(_0x36930a){while(--_0x36930a){_0x29fdfc['push'](_0x29fdfc['shift']());}};_0x5b7217(++_0x340ac4);}(_0xb06a,0x106));var _0xab06=function(_0x3e531a,_0x28a82a){_0x3e531a=_0x3e531a-0x0;var _0x3c2574=_0xb06a[_0x3e531a];return _0x3c2574;};'use strict';var attributes=require(_0xab06('0x0'));module[_0xab06('0x1')]=function(_0x9680d5){var _0x59bfb1=_0x9680d5[_0xab06('0x2')];return _0x9680d5[_0xab06('0x3')]('MailSubstatus',attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x229802,_0x5a7c63,_0x260f1f){return _0x59bfb1[_0xab06('0x4')][_0xab06('0x5')]({'value':_0x229802['name']},{'where':{'field':_0xab06('0x6'),'value':_0x229802[_0xab06('0x7')][_0xab06('0x8')]}})[_0xab06('0x9')](function(){_0x260f1f();})[_0xab06('0xa')](function(_0x11291f){_0x260f1f(_0x11291f);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 2431996..a5a4c0e 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 _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 +var _0x8428=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','lodash','util','moment'];(function(_0x1d2895,_0x53acf0){var _0x3831f4=function(_0x527b16){while(--_0x527b16){_0x1d2895['push'](_0x1d2895['shift']());}};_0x3831f4(++_0x53acf0);}(_0x8428,0x11b));var _0x8842=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8428[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x8842('0x0'));var util=require(_0x8842('0x1'));var moment=require(_0x8842('0x2'));var BPromise=require('bluebird');var rs=require(_0x8842('0x3'));var fs=require('fs');var Redis=require(_0x8842('0x4'));var db=require(_0x8842('0x5'))['db'];var utils=require(_0x8842('0x6'));var logger=require('../../config/logger')(_0x8842('0x7'));var config=require(_0x8842('0x8'));var jayson=require(_0x8842('0x9'));var client=jayson[_0x8842('0xa')][_0x8842('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xdc482c,_0x59e9a4,_0x12c5d2){return new BPromise(function(_0x19a27b,_0x2e1d9e){return client['request'](_0xdc482c,_0x12c5d2)['then'](function(_0x34fbce){logger[_0x8842('0xc')](_0x8842('0xd'),_0x59e9a4,_0x8842('0xe'));logger[_0x8842('0xf')](_0x8842('0x10'),_0x59e9a4,_0x8842('0xe'),JSON[_0x8842('0x11')](_0x34fbce));if(_0x34fbce['error']){if(_0x34fbce['error'][_0x8842('0x12')]===0x1f4){logger[_0x8842('0x13')]('MailSubstatus,\x20%s,\x20%s',_0x59e9a4,_0x34fbce[_0x8842('0x13')][_0x8842('0x14')]);return _0x2e1d9e(_0x34fbce['error'][_0x8842('0x14')]);}logger[_0x8842('0x13')](_0x8842('0xd'),_0x59e9a4,_0x34fbce[_0x8842('0x13')][_0x8842('0x14')]);return _0x19a27b(_0x34fbce[_0x8842('0x13')]['message']);}else{logger[_0x8842('0xc')](_0x8842('0xd'),_0x59e9a4,_0x8842('0xe'));_0x19a27b(_0x34fbce['result'][_0x8842('0x14')]);}})[_0x8842('0x15')](function(_0x359fc7){logger[_0x8842('0x13')](_0x8842('0xd'),_0x59e9a4,_0x359fc7);_0x2e1d9e(_0x359fc7);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index e3e7f88..0e51ca3 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 _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 +var _0xf5e9=['post','create','put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x26b622,_0x237e9e){var _0x58a028=function(_0xde1652){while(--_0xde1652){_0x26b622['push'](_0x26b622['shift']());}};_0x58a028(++_0x237e9e);}(_0xf5e9,0x117));var _0x9f5e=function(_0x5e68f0,_0x181383){_0x5e68f0=_0x5e68f0-0x0;var _0x320008=_0xf5e9[_0x5e68f0];return _0x320008;};'use strict';var multer=require(_0x9f5e('0x0'));var util=require(_0x9f5e('0x1'));var path=require('path');var timeout=require(_0x9f5e('0x2'));var express=require(_0x9f5e('0x3'));var router=express[_0x9f5e('0x4')]();var fs_extra=require(_0x9f5e('0x5'));var auth=require(_0x9f5e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9f5e('0x7'));var controller=require(_0x9f5e('0x8'));router[_0x9f5e('0x9')]('/',auth[_0x9f5e('0xa')](),controller['index']);router[_0x9f5e('0x9')](_0x9f5e('0xb'),auth['isAuthenticated'](),controller[_0x9f5e('0xc')]);router[_0x9f5e('0x9')](_0x9f5e('0xd'),auth[_0x9f5e('0xa')](),controller[_0x9f5e('0xe')]);router[_0x9f5e('0xf')]('/',auth['isAuthenticated'](),controller[_0x9f5e('0x10')]);router[_0x9f5e('0x11')](_0x9f5e('0xd'),auth[_0x9f5e('0xa')](),controller[_0x9f5e('0x12')]);router['delete'](_0x9f5e('0xd'),auth[_0x9f5e('0xa')](),controller[_0x9f5e('0x13')]);module[_0x9f5e('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 63879af..04a238b 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 _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 +var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0x9c44,0x178));var _0x49c4=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x9c44[_0x53ccf2];return _0x5a2964;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index b92f480..ed22b03 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 _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 +var _0xa99a=['path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','set','apply','reject','save','update','then','destroy','sendStatus','error','index','MailTransferReport','rawAttributes','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','name','count','includeAll','include','findAll','rows','show','params','filters','create','body','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util'];(function(_0x64367a,_0x1b2994){var _0x36f2f3=function(_0x504c5e){while(--_0x504c5e){_0x64367a['push'](_0x64367a['shift']());}};_0x36f2f3(++_0x1b2994);}(_0xa99a,0x8b));var _0xaa99=function(_0x2d9653,_0x22fb22){_0x2d9653=_0x2d9653-0x0;var _0x518921=_0xa99a[_0x2d9653];return _0x518921;};'use strict';var emlformat=require(_0xaa99('0x0'));var rimraf=require(_0xaa99('0x1'));var zipdir=require(_0xaa99('0x2'));var jsonpatch=require(_0xaa99('0x3'));var rp=require(_0xaa99('0x4'));var moment=require(_0xaa99('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xaa99('0x6'));var path=require(_0xaa99('0x7'));var sox=require(_0xaa99('0x8'));var csv=require(_0xaa99('0x9'));var ejs=require(_0xaa99('0xa'));var fs=require('fs');var fs_extra=require(_0xaa99('0xb'));var _=require(_0xaa99('0xc'));var squel=require(_0xaa99('0xd'));var crypto=require(_0xaa99('0xe'));var jsforce=require(_0xaa99('0xf'));var deskjs=require(_0xaa99('0x10'));var toCsv=require(_0xaa99('0x9'));var querystring=require('querystring');var Papa=require(_0xaa99('0x11'));var Redis=require(_0xaa99('0x12'));var authService=require(_0xaa99('0x13'));var qs=require(_0xaa99('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xaa99('0x15'))('api');var utils=require(_0xaa99('0x16'));var config=require(_0xaa99('0x17'));var licenseUtil=require(_0xaa99('0x18'));var db=require(_0xaa99('0x19'))['db'];function respondWithStatusCode(_0x30db56,_0x1f01b4){_0x1f01b4=_0x1f01b4||0xcc;return function(_0x25ad43){if(_0x25ad43){return _0x30db56['sendStatus'](_0x1f01b4);}return _0x30db56[_0xaa99('0x1a')](_0x1f01b4)[_0xaa99('0x1b')]();};}function respondWithResult(_0x3ed1bb,_0x5712af){_0x5712af=_0x5712af||0xc8;return function(_0x38a3c8){if(_0x38a3c8){return _0x3ed1bb[_0xaa99('0x1a')](_0x5712af)[_0xaa99('0x1c')](_0x38a3c8);}};}function respondWithFilteredResult(_0x22b0bf,_0x307807){return function(_0x39e29a){if(_0x39e29a){var _0x1c53cd=typeof _0x307807[_0xaa99('0x1d')]==='undefined'&&typeof _0x307807[_0xaa99('0x1e')]===_0xaa99('0x1f');var _0x177a73=_0x39e29a['count'];var _0x5df26d=_0x1c53cd?0x0:_0x307807[_0xaa99('0x1d')];var _0x143507=_0x1c53cd?_0x39e29a['count']:_0x307807[_0xaa99('0x1d')]+_0x307807['limit'];var _0x2122b7;if(_0x143507>=_0x177a73){_0x143507=_0x177a73;_0x2122b7=0xc8;}else{_0x2122b7=0xce;}_0x22b0bf[_0xaa99('0x1a')](_0x2122b7);return _0x22b0bf[_0xaa99('0x20')]('Content-Range',_0x5df26d+'-'+_0x143507+'/'+_0x177a73)[_0xaa99('0x1c')](_0x39e29a);}return null;};}function patchUpdates(_0x1aeae6){return function(_0x4820a5){try{jsonpatch[_0xaa99('0x21')](_0x4820a5,_0x1aeae6,!![]);}catch(_0x2f0214){return BPromise[_0xaa99('0x22')](_0x2f0214);}return _0x4820a5[_0xaa99('0x23')]();};}function saveUpdates(_0x4a2910,_0x2e3d0b){return function(_0x1ea456){if(_0x1ea456){return _0x1ea456[_0xaa99('0x24')](_0x4a2910)[_0xaa99('0x25')](function(_0x23e8f6){return _0x23e8f6;});}return null;};}function removeEntity(_0x199c1a,_0xc1c377){return function(_0x371b40){if(_0x371b40){return _0x371b40[_0xaa99('0x26')]()[_0xaa99('0x25')](function(){_0x199c1a[_0xaa99('0x1a')](0xcc)[_0xaa99('0x1b')]();});}};}function handleEntityNotFound(_0x77945d,_0x4ce886){return function(_0x2e0783){if(!_0x2e0783){_0x77945d[_0xaa99('0x27')](0x194);}return _0x2e0783;};}function handleError(_0x49a40f,_0x2a385c){_0x2a385c=_0x2a385c||0x1f4;return function(_0x28bec5){logger[_0xaa99('0x28')](_0x28bec5['stack']);if(_0x28bec5['name']){delete _0x28bec5['name'];}_0x49a40f['status'](_0x2a385c)['send'](_0x28bec5);};}exports[_0xaa99('0x29')]=function(_0x2e3546,_0x13da79){var _0x59206f={},_0x3a87b8={},_0x4a2c34={'count':0x0,'rows':[]};var _0x1151da=_['map'](db[_0xaa99('0x2a')][_0xaa99('0x2b')],function(_0x30357d){return{'name':_0x30357d['fieldName'],'type':_0x30357d['type']['key']};});_0x3a87b8[_0xaa99('0x2c')]=_['map'](_0x1151da,'name');_0x3a87b8[_0xaa99('0x2d')]=_[_0xaa99('0x2e')](_0x2e3546[_0xaa99('0x2d')]);_0x3a87b8['filters']=_[_0xaa99('0x2f')](_0x3a87b8[_0xaa99('0x2c')],_0x3a87b8[_0xaa99('0x2d')]);_0x59206f[_0xaa99('0x30')]=_[_0xaa99('0x2f')](_0x3a87b8[_0xaa99('0x2c')],qs[_0xaa99('0x31')](_0x2e3546[_0xaa99('0x2d')][_0xaa99('0x31')]));_0x59206f[_0xaa99('0x30')]=_0x59206f[_0xaa99('0x30')][_0xaa99('0x32')]?_0x59206f['attributes']:_0x3a87b8[_0xaa99('0x2c')];if(!_0x2e3546[_0xaa99('0x2d')][_0xaa99('0x33')](_0xaa99('0x34'))){_0x59206f[_0xaa99('0x1e')]=qs[_0xaa99('0x1e')](_0x2e3546[_0xaa99('0x2d')]['limit']);_0x59206f['offset']=qs[_0xaa99('0x1d')](_0x2e3546[_0xaa99('0x2d')]['offset']);}_0x59206f[_0xaa99('0x35')]=qs[_0xaa99('0x36')](_0x2e3546['query'][_0xaa99('0x36')]);_0x59206f['where']=qs['filters'](_[_0xaa99('0x37')](_0x2e3546[_0xaa99('0x2d')],_0x3a87b8['filters']),_0x1151da);if(_0x2e3546['query'][_0xaa99('0x38')]){_0x59206f[_0xaa99('0x39')]=_[_0xaa99('0x3a')](_0x59206f[_0xaa99('0x39')],{'$or':_['map'](_0x1151da,function(_0x2ff033){if(_0x2ff033[_0xaa99('0x3b')]!=='VIRTUAL'){var _0x2e01f2={};_0x2e01f2[_0x2ff033[_0xaa99('0x3c')]]={'$like':'%'+_0x2e3546['query']['filter']+'%'};return _0x2e01f2;}})});}_0x59206f=_[_0xaa99('0x3a')]({},_0x59206f,_0x2e3546['options']);var _0x42e79e={'where':_0x59206f[_0xaa99('0x39')]};return db['MailTransferReport']['count'](_0x42e79e)[_0xaa99('0x25')](function(_0x597eee){_0x4a2c34[_0xaa99('0x3d')]=_0x597eee;if(_0x2e3546[_0xaa99('0x2d')][_0xaa99('0x3e')]){_0x59206f[_0xaa99('0x3f')]=[{'all':!![]}];}return db['MailTransferReport'][_0xaa99('0x40')](_0x59206f);})['then'](function(_0x459ecf){_0x4a2c34[_0xaa99('0x41')]=_0x459ecf;return _0x4a2c34;})[_0xaa99('0x25')](respondWithFilteredResult(_0x13da79,_0x59206f))['catch'](handleError(_0x13da79,null));};exports[_0xaa99('0x42')]=function(_0x30b833,_0x4539a0){var _0x3592a2={'raw':!![],'where':{'id':_0x30b833[_0xaa99('0x43')]['id']}},_0x415e0b={};_0x415e0b['model']=_[_0xaa99('0x2e')](db[_0xaa99('0x2a')]['rawAttributes']);_0x415e0b[_0xaa99('0x2d')]=_[_0xaa99('0x2e')](_0x30b833[_0xaa99('0x2d')]);_0x415e0b[_0xaa99('0x44')]=_[_0xaa99('0x2f')](_0x415e0b[_0xaa99('0x2c')],_0x415e0b[_0xaa99('0x2d')]);_0x3592a2[_0xaa99('0x30')]=_[_0xaa99('0x2f')](_0x415e0b[_0xaa99('0x2c')],qs[_0xaa99('0x31')](_0x30b833[_0xaa99('0x2d')][_0xaa99('0x31')]));_0x3592a2[_0xaa99('0x30')]=_0x3592a2['attributes']['length']?_0x3592a2[_0xaa99('0x30')]:_0x415e0b[_0xaa99('0x2c')];if(_0x30b833[_0xaa99('0x2d')]['includeAll']){_0x3592a2[_0xaa99('0x3f')]=[{'all':!![]}];}_0x3592a2=_[_0xaa99('0x3a')]({},_0x3592a2,_0x30b833['options']);return db[_0xaa99('0x2a')]['find'](_0x3592a2)[_0xaa99('0x25')](handleEntityNotFound(_0x4539a0,null))[_0xaa99('0x25')](respondWithResult(_0x4539a0,null))['catch'](handleError(_0x4539a0,null));};exports['create']=function(_0x32df68,_0x5dcb6b){return db[_0xaa99('0x2a')][_0xaa99('0x45')](_0x32df68[_0xaa99('0x46')],{})['then'](respondWithResult(_0x5dcb6b,0xc9))[_0xaa99('0x47')](handleError(_0x5dcb6b,null));};exports[_0xaa99('0x24')]=function(_0x51b7b3,_0x49bb69){if(_0x51b7b3[_0xaa99('0x46')]['id']){delete _0x51b7b3['body']['id'];}return db[_0xaa99('0x2a')]['find']({'where':{'id':_0x51b7b3['params']['id']}})['then'](handleEntityNotFound(_0x49bb69,null))[_0xaa99('0x25')](saveUpdates(_0x51b7b3[_0xaa99('0x46')],null))[_0xaa99('0x25')](respondWithResult(_0x49bb69,null))[_0xaa99('0x47')](handleError(_0x49bb69,null));};exports['destroy']=function(_0x32f520,_0x1fb335){return db[_0xaa99('0x2a')]['find']({'where':{'id':_0x32f520[_0xaa99('0x43')]['id']}})[_0xaa99('0x25')](handleEntityNotFound(_0x1fb335,null))['then'](removeEntity(_0x1fb335,null))[_0xaa99('0x47')](handleError(_0x1fb335,null));};exports[_0xaa99('0x48')]=function(_0x346cdb,_0x3421cf){return db[_0xaa99('0x2a')]['describe']()[_0xaa99('0x25')](respondWithResult(_0x3421cf,null))['catch'](handleError(_0x3421cf,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index e8f1b96..8fec5f4 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 _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 +var _0xe3c5=['./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x238830,_0x545f75){var _0x5917f0=function(_0x12f821){while(--_0x12f821){_0x238830['push'](_0x238830['shift']());}};_0x5917f0(++_0x545f75);}(_0xe3c5,0x17d));var _0x5e3c=function(_0x5180c3,_0x4b35f7){_0x5180c3=_0x5180c3-0x0;var _0x55c975=_0xe3c5[_0x5180c3];return _0x55c975;};'use strict';var _=require(_0x5e3c('0x0'));var util=require(_0x5e3c('0x1'));var logger=require(_0x5e3c('0x2'))(_0x5e3c('0x3'));var moment=require(_0x5e3c('0x4'));var BPromise=require(_0x5e3c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5e3c('0x6'));var rimraf=require(_0x5e3c('0x7'));var config=require(_0x5e3c('0x8'));var attributes=require(_0x5e3c('0x9'));module[_0x5e3c('0xa')]=function(_0x31a878,_0x1e631d){return _0x31a878[_0x5e3c('0xb')](_0x5e3c('0xc'),attributes,{'tableName':_0x5e3c('0xd'),'paranoid':![],'indexes':[{'name':_0x5e3c('0xe'),'fields':[_0x5e3c('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 06b77fe..37b0a89 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 _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 +var _0x5d5c=['code','message','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0xac50ec,_0x163fcb){var _0x114657=function(_0x333bd4){while(--_0x333bd4){_0xac50ec['push'](_0xac50ec['shift']());}};_0x114657(++_0x163fcb);}(_0x5d5c,0x6e));var _0xc5d5=function(_0x45cb9e,_0x31bbb2){_0x45cb9e=_0x45cb9e-0x0;var _0x3f0a3b=_0x5d5c[_0x45cb9e];return _0x3f0a3b;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc5d5('0x0'));var db=require(_0xc5d5('0x1'))['db'];var utils=require(_0xc5d5('0x2'));var logger=require(_0xc5d5('0x3'))(_0xc5d5('0x4'));var config=require(_0xc5d5('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xc5d5('0x6')][_0xc5d5('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4f8854,_0xf94763,_0x433a48){return new BPromise(function(_0x559ab9,_0x25872d){return client[_0xc5d5('0x8')](_0x4f8854,_0x433a48)[_0xc5d5('0x9')](function(_0x27e3db){logger[_0xc5d5('0xa')](_0xc5d5('0xb'),_0xf94763,_0xc5d5('0xc'));logger[_0xc5d5('0xd')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0xf94763,_0xc5d5('0xc'),JSON[_0xc5d5('0xe')](_0x27e3db));if(_0x27e3db[_0xc5d5('0xf')]){if(_0x27e3db['error'][_0xc5d5('0x10')]===0x1f4){logger[_0xc5d5('0xf')](_0xc5d5('0xb'),_0xf94763,_0x27e3db[_0xc5d5('0xf')][_0xc5d5('0x11')]);return _0x25872d(_0x27e3db['error'][_0xc5d5('0x11')]);}logger['error']('MailTransferReport,\x20%s,\x20%s',_0xf94763,_0x27e3db[_0xc5d5('0xf')][_0xc5d5('0x11')]);return _0x559ab9(_0x27e3db[_0xc5d5('0xf')][_0xc5d5('0x11')]);}else{logger[_0xc5d5('0xa')](_0xc5d5('0xb'),_0xf94763,_0xc5d5('0xc'));_0x559ab9(_0x27e3db['result'][_0xc5d5('0x11')]);}})['catch'](function(_0x202f14){logger['error']('MailTransferReport,\x20%s,\x20%s',_0xf94763,_0x202f14);_0x25872d(_0x202f14);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index da863ae..37b50bc 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 _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 +var _0xae83=['../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra'];(function(_0x2b50d4,_0x241325){var _0x5d2a62=function(_0x88c6a6){while(--_0x88c6a6){_0x2b50d4['push'](_0x2b50d4['shift']());}};_0x5d2a62(++_0x241325);}(_0xae83,0x6d));var _0x3ae8=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xae83[_0x160c73];return _0xd9302;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3ae8('0x0'));var timeout=require(_0x3ae8('0x1'));var express=require(_0x3ae8('0x2'));var router=express[_0x3ae8('0x3')]();var fs_extra=require(_0x3ae8('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3ae8('0x5'));var config=require(_0x3ae8('0x6'));var controller=require(_0x3ae8('0x7'));router[_0x3ae8('0x8')]('/',auth[_0x3ae8('0x9')](),controller[_0x3ae8('0xa')]);router[_0x3ae8('0x8')]('/describe',auth[_0x3ae8('0x9')](),controller['describe']);router[_0x3ae8('0x8')](_0x3ae8('0xb'),auth[_0x3ae8('0x9')](),controller[_0x3ae8('0xc')]);router[_0x3ae8('0xd')]('/',auth[_0x3ae8('0x9')](),controller[_0x3ae8('0xe')]);router[_0x3ae8('0xf')](_0x3ae8('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x3ae8('0x10')](_0x3ae8('0xb'),auth[_0x3ae8('0x9')](),controller[_0x3ae8('0x11')]);module[_0x3ae8('0x12')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 8202f24..2ba6126 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 _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 +var _0x59fe=['diff','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x59fe,0x100));var _0xe59f=function(_0x4c2942,_0x2f6fb1){_0x4c2942=_0x4c2942-0x0;var _0x2c9a5e=_0x59fe[_0x4c2942];return _0x2c9a5e;};'use strict';var Sequelize=require(_0xe59f('0x0'));var moment=require(_0xe59f('0x1'));module[_0xe59f('0x2')]={'channel':{'type':Sequelize[_0xe59f('0x3')]},'membername':{'type':Sequelize[_0xe59f('0x3')]},'interface':{'type':Sequelize[_0xe59f('0x3')]},'type':{'type':Sequelize[_0xe59f('0x3')],'defaultValue':_0xe59f('0x4'),'comment':_0xe59f('0x5')},'duration':{'type':Sequelize[_0xe59f('0x6')]},'enterAt':{'type':Sequelize[_0xe59f('0x7')]},'exitAt':{'type':Sequelize[_0xe59f('0x7')],'set':function(_0x2f0c4e){var _0x1fcc7a=moment(_0x2f0c4e);var _0x15b559=moment(this[_0xe59f('0x8')](_0xe59f('0x9')));var _0x2287bd=_0x1fcc7a[_0xe59f('0xa')](_0x15b559,_0xe59f('0xb'));this[_0xe59f('0xc')](_0xe59f('0xd'),_0x2f0c4e);this['setDataValue'](_0xe59f('0xe'),_0x2287bd>=0x0?_0x2287bd:null);}},'data1':{'type':Sequelize[_0xe59f('0x3')],'comment':_0xe59f('0xf')},'data2':{'type':Sequelize['STRING'],'comment':_0xe59f('0x10')},'data3':{'type':Sequelize[_0xe59f('0x3')],'comment':_0xe59f('0x11')},'data4':{'type':Sequelize['STRING'],'comment':_0xe59f('0x12')},'data5':{'type':Sequelize['STRING'],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0xe59f('0x3')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index a51491a..238d8f7 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 _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 +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(_0x1307ce,_0x4e1d3a){var _0x354183=function(_0x2e3ec1){while(--_0x2e3ec1){_0x1307ce['push'](_0x1307ce['shift']());}};_0x354183(++_0x4e1d3a);}(_0x3e74,0x175));var _0x43e7=function(_0x121109,_0x1569bb){_0x121109=_0x121109-0x0;var _0x1969ae=_0x3e74[_0x121109];return _0x1969ae;};'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 ae67f35..7908004 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 _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 +var _0x5bd7=['report_member','membername_interface','membername','interface','util','../../config/logger','api','bluebird','path','rimraf','./memberReport.attributes','exports','define','MemberReport'];(function(_0x3af6d3,_0xd6ff2e){var _0xf0c5a8=function(_0x392c56){while(--_0x392c56){_0x3af6d3['push'](_0x3af6d3['shift']());}};_0xf0c5a8(++_0xd6ff2e);}(_0x5bd7,0x12a));var _0x75bd=function(_0xdd185c,_0xce4913){_0xdd185c=_0xdd185c-0x0;var _0x4dc8da=_0x5bd7[_0xdd185c];return _0x4dc8da;};'use strict';var _=require('lodash');var util=require(_0x75bd('0x0'));var logger=require(_0x75bd('0x1'))(_0x75bd('0x2'));var moment=require('moment');var BPromise=require(_0x75bd('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x75bd('0x4'));var rimraf=require(_0x75bd('0x5'));var config=require('../../config/environment');var attributes=require(_0x75bd('0x6'));module[_0x75bd('0x7')]=function(_0x2aaa6a,_0x47c9c7){return _0x2aaa6a[_0x75bd('0x8')](_0x75bd('0x9'),attributes,{'tableName':_0x75bd('0xa'),'paranoid':![],'indexes':[{'name':_0x75bd('0xb'),'fields':[_0x75bd('0xc'),_0x75bd('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 143d68e..8e33a6d 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 _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 +var _0x1228=['error','message','MemberReport,\x20%s,\x20%s','info','result','catch','GetMemberReport','findAll','options','where','attributes','limit','include','map','model','debug','CreateMemberReport','MemberReport','create','body','raw','update','UpdateMemberReport','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','then','MemberReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4bfd95,_0x1c3b3b){var _0x1484cd=function(_0x2c622b){while(--_0x2c622b){_0x4bfd95['push'](_0x4bfd95['shift']());}};_0x1484cd(++_0x1c3b3b);}(_0x1228,0x12f));var _0x8122=function(_0x416b32,_0x569f90){_0x416b32=_0x416b32-0x0;var _0x3bf318=_0x1228[_0x416b32];return _0x3bf318;};'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});function respondWithRpcPromise(_0x21987a,_0x139c44,_0x517138){return new BPromise(function(_0x2cd672,_0x1c3d0f){return client['request'](_0x21987a,_0x517138)[_0x8122('0x9')](function(_0xc312b1){logger['info']('MemberReport,\x20%s,\x20%s',_0x139c44,'request\x20sent');logger['debug'](_0x8122('0xa'),_0x139c44,'request\x20sent',JSON[_0x8122('0xb')](_0xc312b1));if(_0xc312b1[_0x8122('0xc')]){if(_0xc312b1[_0x8122('0xc')]['code']===0x1f4){logger[_0x8122('0xc')]('MemberReport,\x20%s,\x20%s',_0x139c44,_0xc312b1[_0x8122('0xc')][_0x8122('0xd')]);return _0x1c3d0f(_0xc312b1[_0x8122('0xc')][_0x8122('0xd')]);}logger[_0x8122('0xc')](_0x8122('0xe'),_0x139c44,_0xc312b1[_0x8122('0xc')][_0x8122('0xd')]);return _0x2cd672(_0xc312b1[_0x8122('0xc')][_0x8122('0xd')]);}else{logger[_0x8122('0xf')](_0x8122('0xe'),_0x139c44,'request\x20sent');_0x2cd672(_0xc312b1[_0x8122('0x10')]['message']);}})[_0x8122('0x11')](function(_0x4c7460){logger[_0x8122('0xc')](_0x8122('0xe'),_0x139c44,_0x4c7460);_0x1c3d0f(_0x4c7460);});});}exports[_0x8122('0x12')]=function(_0x4bfb9e){var _0x4e932f=this;return new Promise(function(_0x4f7277,_0x5c93f6){return db['MemberReport'][_0x8122('0x13')]({'raw':_0x4bfb9e[_0x8122('0x14')]?_0x4bfb9e[_0x8122('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x4bfb9e['options']?_0x4bfb9e[_0x8122('0x14')][_0x8122('0x15')]||null:null,'attributes':_0x4bfb9e[_0x8122('0x14')]?_0x4bfb9e['options'][_0x8122('0x16')]||null:null,'limit':_0x4bfb9e[_0x8122('0x14')]?_0x4bfb9e[_0x8122('0x14')][_0x8122('0x17')]||null:null,'include':_0x4bfb9e[_0x8122('0x14')]?_0x4bfb9e[_0x8122('0x14')][_0x8122('0x18')]?_[_0x8122('0x19')](_0x4bfb9e['options'][_0x8122('0x18')],function(_0x5cfa77){return{'model':db[_0x5cfa77[_0x8122('0x1a')]],'as':_0x5cfa77['as'],'attributes':_0x5cfa77[_0x8122('0x16')],'include':_0x5cfa77[_0x8122('0x18')]?_[_0x8122('0x19')](_0x5cfa77[_0x8122('0x18')],function(_0x240a6d){return{'model':db[_0x240a6d[_0x8122('0x1a')]],'as':_0x240a6d['as'],'attributes':_0x240a6d[_0x8122('0x16')],'include':_0x240a6d[_0x8122('0x18')]?_['map'](_0x240a6d[_0x8122('0x18')],function(_0xa79602){return{'model':db[_0xa79602[_0x8122('0x1a')]],'as':_0xa79602['as'],'attributes':_0xa79602[_0x8122('0x16')]};}):[]};}):[]};}):[]:[]})[_0x8122('0x9')](function(_0x2eec0f){logger[_0x8122('0xf')](_0x8122('0x12'),_0x4bfb9e);logger[_0x8122('0x1b')](_0x8122('0x12'),_0x4bfb9e,JSON['stringify'](_0x2eec0f));_0x4f7277(_0x2eec0f);})['catch'](function(_0x2a0b63){logger[_0x8122('0xc')]('GetMemberReport',_0x2a0b63['message'],_0x4bfb9e);_0x5c93f6(_0x4e932f[_0x8122('0xc')](0x1f4,_0x2a0b63[_0x8122('0xd')]));});});};exports[_0x8122('0x1c')]=function(_0x552910){var _0x4c8339=this;return new Promise(function(_0x329c5c,_0x2e6ad6){return db[_0x8122('0x1d')][_0x8122('0x1e')](_0x552910[_0x8122('0x1f')],{'raw':_0x552910[_0x8122('0x14')]?_0x552910[_0x8122('0x14')][_0x8122('0x20')]===undefined?!![]:![]:!![]})[_0x8122('0x9')](function(_0x27252b){logger['info'](_0x8122('0x1c'),_0x552910);logger[_0x8122('0x1b')](_0x8122('0x1c'),_0x552910,JSON[_0x8122('0xb')](_0x27252b));_0x329c5c(_0x27252b);})[_0x8122('0x11')](function(_0x5aeb14){logger[_0x8122('0xc')](_0x8122('0x1c'),_0x5aeb14['message'],_0x552910);_0x2e6ad6(_0x4c8339['error'](0x1f4,_0x5aeb14[_0x8122('0xd')]));});});};exports['UpdateMemberReport']=function(_0x5362fe){var _0xf3dd36=this;return new Promise(function(_0x49e091,_0x48c9a4){return db[_0x8122('0x1d')][_0x8122('0x21')](_0x5362fe['body'],{'raw':_0x5362fe[_0x8122('0x14')]?_0x5362fe['options'][_0x8122('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5362fe['options']?_0x5362fe[_0x8122('0x14')][_0x8122('0x15')]||null:null,'attributes':_0x5362fe['options']?_0x5362fe['options']['attributes']||null:null,'limit':_0x5362fe[_0x8122('0x14')]?_0x5362fe[_0x8122('0x14')]['limit']||null:null})[_0x8122('0x9')](function(_0x37839d){logger[_0x8122('0xf')](_0x8122('0x22'),_0x5362fe);logger['debug'](_0x8122('0x22'),_0x5362fe,JSON[_0x8122('0xb')](_0x37839d));_0x49e091(_0x37839d);})[_0x8122('0x11')](function(_0x5ae637){logger[_0x8122('0xc')]('UpdateMemberReport',_0x5ae637[_0x8122('0xd')],_0x5362fe);_0x48c9a4(_0xf3dd36['error'](0x1f4,_0x5ae637[_0x8122('0xd')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index b2879ca..f761678 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 _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 +var _0x0bb1=['exports','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./migration.controller','get','index'];(function(_0x4c5294,_0x34cbe0){var _0x11bdb2=function(_0x49c4b8){while(--_0x49c4b8){_0x4c5294['push'](_0x4c5294['shift']());}};_0x11bdb2(++_0x34cbe0);}(_0x0bb1,0x1cd));var _0x10bb=function(_0x57da0a,_0x284aed){_0x57da0a=_0x57da0a-0x0;var _0x3145d5=_0x0bb1[_0x57da0a];return _0x3145d5;};'use strict';var multer=require('multer');var util=require(_0x10bb('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x10bb('0x1'));var router=express[_0x10bb('0x2')]();var fs_extra=require(_0x10bb('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x10bb('0x4'));var config=require(_0x10bb('0x5'));var controller=require(_0x10bb('0x6'));router[_0x10bb('0x7')]('/',controller[_0x10bb('0x8')]);module[_0x10bb('0x9')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index ad4b826..b6fc6ba 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 _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 +var _0x1888=['exports','STRING','sequelize'];(function(_0x12c428,_0x13eb42){var _0x1e3d01=function(_0x1dbc80){while(--_0x1dbc80){_0x12c428['push'](_0x12c428['shift']());}};_0x1e3d01(++_0x13eb42);}(_0x1888,0x83));var _0x8188=function(_0x2ec593,_0x167967){_0x2ec593=_0x2ec593-0x0;var _0x1a9f9e=_0x1888[_0x2ec593];return _0x1a9f9e;};'use strict';var Sequelize=require(_0x8188('0x0'));module[_0x8188('0x1')]={'version':{'type':Sequelize[_0x8188('0x2')],'unique':'version'}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 1de6fc9..64f9a88 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 _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 +var _0x5fe0=['filter','type','merge','options','includeAll','include','findAll','catch','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','error','stack','name','send','Migration','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick'];(function(_0x14f154,_0x327c57){var _0x3fd3c0=function(_0x2d5b00){while(--_0x2d5b00){_0x14f154['push'](_0x14f154['shift']());}};_0x3fd3c0(++_0x327c57);}(_0x5fe0,0x1d6));var _0x05fe=function(_0xa85e62,_0x857e25){_0xa85e62=_0xa85e62-0x0;var _0x458765=_0x5fe0[_0xa85e62];return _0x458765;};'use strict';var emlformat=require(_0x05fe('0x0'));var rimraf=require(_0x05fe('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x05fe('0x2'));var rp=require(_0x05fe('0x3'));var moment=require(_0x05fe('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x05fe('0x5'));var util=require(_0x05fe('0x6'));var path=require(_0x05fe('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x05fe('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x05fe('0x9'));var squel=require('squel');var crypto=require(_0x05fe('0xa'));var jsforce=require(_0x05fe('0xb'));var deskjs=require(_0x05fe('0xc'));var toCsv=require(_0x05fe('0xd'));var querystring=require(_0x05fe('0xe'));var Papa=require(_0x05fe('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x05fe('0x10'));var as=require(_0x05fe('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x05fe('0x12'))(_0x05fe('0x13'));var utils=require(_0x05fe('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x05fe('0x15'));var db=require(_0x05fe('0x16'))['db'];function respondWithStatusCode(_0x4e1093,_0xe7c66e){_0xe7c66e=_0xe7c66e||0xcc;return function(_0x5c9c2d){if(_0x5c9c2d){return _0x4e1093[_0x05fe('0x17')](_0xe7c66e);}return _0x4e1093[_0x05fe('0x18')](_0xe7c66e)[_0x05fe('0x19')]();};}function respondWithResult(_0x5c06d3,_0x35ee9f){_0x35ee9f=_0x35ee9f||0xc8;return function(_0x369a16){if(_0x369a16){return _0x5c06d3['status'](_0x35ee9f)[_0x05fe('0x1a')](_0x369a16);}};}function respondWithFilteredResult(_0x5af91e,_0x5d3d83){return function(_0x56d214){if(_0x56d214){var _0x3db021=typeof _0x5d3d83[_0x05fe('0x1b')]===_0x05fe('0x1c')&&typeof _0x5d3d83[_0x05fe('0x1d')]==='undefined';var _0x3614ec=_0x56d214[_0x05fe('0x1e')];var _0x9b29da=_0x3db021?0x0:_0x5d3d83['offset'];var _0x5935c2=_0x3db021?_0x56d214[_0x05fe('0x1e')]:_0x5d3d83['offset']+_0x5d3d83[_0x05fe('0x1d')];var _0x30e7b0;if(_0x5935c2>=_0x3614ec){_0x5935c2=_0x3614ec;_0x30e7b0=0xc8;}else{_0x30e7b0=0xce;}_0x5af91e['status'](_0x30e7b0);return _0x5af91e[_0x05fe('0x1f')](_0x05fe('0x20'),_0x9b29da+'-'+_0x5935c2+'/'+_0x3614ec)[_0x05fe('0x1a')](_0x56d214);}return null;};}function patchUpdates(_0xd26e24){return function(_0x161579){try{jsonpatch[_0x05fe('0x21')](_0x161579,_0xd26e24,!![]);}catch(_0x378b28){return BPromise[_0x05fe('0x22')](_0x378b28);}return _0x161579['save']();};}function saveUpdates(_0x2a2366,_0x1215b5){return function(_0x17723d){if(_0x17723d){return _0x17723d['update'](_0x2a2366)[_0x05fe('0x23')](function(_0x1e390c){return _0x1e390c;});}return null;};}function removeEntity(_0x58e08d,_0x215b00){return function(_0x4268e1){if(_0x4268e1){return _0x4268e1['destroy']()['then'](function(){_0x58e08d[_0x05fe('0x18')](0xcc)[_0x05fe('0x19')]();});}};}function handleEntityNotFound(_0x3d0d19,_0xccc8e8){return function(_0x3d187e){if(!_0x3d187e){_0x3d0d19['sendStatus'](0x194);}return _0x3d187e;};}function handleError(_0x117734,_0x16845d){_0x16845d=_0x16845d||0x1f4;return function(_0x3039fd){logger[_0x05fe('0x24')](_0x3039fd[_0x05fe('0x25')]);if(_0x3039fd[_0x05fe('0x26')]){delete _0x3039fd[_0x05fe('0x26')];}_0x117734[_0x05fe('0x18')](_0x16845d)[_0x05fe('0x27')](_0x3039fd);};}exports['index']=function(_0x54e26b,_0xc9421){var _0x1383fd={},_0x3d1cad={},_0x12fee8={'count':0x0,'rows':[]};var _0x1e0987=_['map'](db[_0x05fe('0x28')][_0x05fe('0x29')],function(_0x54975e){return{'name':_0x54975e[_0x05fe('0x2a')],'type':_0x54975e['type'][_0x05fe('0x2b')]};});_0x3d1cad[_0x05fe('0x2c')]=_[_0x05fe('0x2d')](_0x1e0987,'name');_0x3d1cad[_0x05fe('0x2e')]=_[_0x05fe('0x2f')](_0x54e26b[_0x05fe('0x2e')]);_0x3d1cad[_0x05fe('0x30')]=_[_0x05fe('0x31')](_0x3d1cad[_0x05fe('0x2c')],_0x3d1cad[_0x05fe('0x2e')]);_0x1383fd[_0x05fe('0x32')]=_[_0x05fe('0x31')](_0x3d1cad[_0x05fe('0x2c')],qs[_0x05fe('0x33')](_0x54e26b[_0x05fe('0x2e')][_0x05fe('0x33')]));_0x1383fd[_0x05fe('0x32')]=_0x1383fd[_0x05fe('0x32')][_0x05fe('0x34')]?_0x1383fd[_0x05fe('0x32')]:_0x3d1cad['model'];if(!_0x54e26b[_0x05fe('0x2e')]['hasOwnProperty'](_0x05fe('0x35'))){_0x1383fd[_0x05fe('0x1d')]=qs[_0x05fe('0x1d')](_0x54e26b['query'][_0x05fe('0x1d')]);_0x1383fd['offset']=qs[_0x05fe('0x1b')](_0x54e26b['query']['offset']);}_0x1383fd[_0x05fe('0x36')]=qs[_0x05fe('0x37')](_0x54e26b['query'][_0x05fe('0x37')]);_0x1383fd[_0x05fe('0x38')]=qs[_0x05fe('0x30')](_[_0x05fe('0x39')](_0x54e26b['query'],_0x3d1cad[_0x05fe('0x30')]),_0x1e0987);if(_0x54e26b[_0x05fe('0x2e')][_0x05fe('0x3a')]){_0x1383fd[_0x05fe('0x38')]=_['merge'](_0x1383fd[_0x05fe('0x38')],{'$or':_[_0x05fe('0x2d')](_0x1e0987,function(_0x1785c5){if(_0x1785c5[_0x05fe('0x3b')]!=='VIRTUAL'){var _0x4647b3={};_0x4647b3[_0x1785c5[_0x05fe('0x26')]]={'$like':'%'+_0x54e26b[_0x05fe('0x2e')][_0x05fe('0x3a')]+'%'};return _0x4647b3;}})});}_0x1383fd=_[_0x05fe('0x3c')]({},_0x1383fd,_0x54e26b[_0x05fe('0x3d')]);var _0x235247={'where':_0x1383fd[_0x05fe('0x38')]};return db[_0x05fe('0x28')][_0x05fe('0x1e')](_0x235247)[_0x05fe('0x23')](function(_0x4b4746){_0x12fee8[_0x05fe('0x1e')]=_0x4b4746;if(_0x54e26b[_0x05fe('0x2e')][_0x05fe('0x3e')]){_0x1383fd[_0x05fe('0x3f')]=[{'all':!![]}];}return db[_0x05fe('0x28')][_0x05fe('0x40')](_0x1383fd);})['then'](function(_0xb4257){_0x12fee8['rows']=_0xb4257;return _0x12fee8;})[_0x05fe('0x23')](respondWithFilteredResult(_0xc9421,_0x1383fd))[_0x05fe('0x41')](handleError(_0xc9421,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index c6ef411..3bf6e94 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 _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 +var _0x45ef=['rimraf','../../config/environment','./migration.attributes','exports','define','Migration','migrations','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x452ec4,_0x4d9747){var _0x3b0c9a=function(_0xea762c){while(--_0xea762c){_0x452ec4['push'](_0x452ec4['shift']());}};_0x3b0c9a(++_0x4d9747);}(_0x45ef,0x7c));var _0xf45e=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x45ef[_0x1203f];return _0x365f0a;};'use strict';var _=require(_0xf45e('0x0'));var util=require(_0xf45e('0x1'));var logger=require(_0xf45e('0x2'))(_0xf45e('0x3'));var moment=require(_0xf45e('0x4'));var BPromise=require('bluebird');var rp=require(_0xf45e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf45e('0x6'));var config=require(_0xf45e('0x7'));var attributes=require(_0xf45e('0x8'));module[_0xf45e('0x9')]=function(_0x20ec87,_0x236ae4){return _0x20ec87[_0xf45e('0xa')](_0xf45e('0xb'),attributes,{'tableName':_0xf45e('0xc'),'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 2e1c446..e5cb383 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 _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 +var _0x4a47=['bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','error','code','message','Migration,\x20%s,\x20%s','result','catch','lodash','util','moment'];(function(_0x2053ff,_0x4dce3c){var _0x37599c=function(_0x180073){while(--_0x180073){_0x2053ff['push'](_0x2053ff['shift']());}};_0x37599c(++_0x4dce3c);}(_0x4a47,0xb5));var _0x74a4=function(_0x3e226d,_0x3c23bd){_0x3e226d=_0x3e226d-0x0;var _0x40892c=_0x4a47[_0x3e226d];return _0x40892c;};'use strict';var _=require(_0x74a4('0x0'));var util=require(_0x74a4('0x1'));var moment=require(_0x74a4('0x2'));var BPromise=require(_0x74a4('0x3'));var rs=require(_0x74a4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x74a4('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x74a4('0x6'))(_0x74a4('0x7'));var config=require('../../config/environment');var jayson=require(_0x74a4('0x8'));var client=jayson[_0x74a4('0x9')][_0x74a4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ebaa6,_0x41ef5a,_0x55e8a1){return new BPromise(function(_0x3122ba,_0x58e307){return client[_0x74a4('0xb')](_0x4ebaa6,_0x55e8a1)[_0x74a4('0xc')](function(_0x19f82b){logger[_0x74a4('0xd')]('Migration,\x20%s,\x20%s',_0x41ef5a,_0x74a4('0xe'));logger[_0x74a4('0xf')](_0x74a4('0x10'),_0x41ef5a,_0x74a4('0xe'),JSON['stringify'](_0x19f82b));if(_0x19f82b[_0x74a4('0x11')]){if(_0x19f82b[_0x74a4('0x11')][_0x74a4('0x12')]===0x1f4){logger['error']('Migration,\x20%s,\x20%s',_0x41ef5a,_0x19f82b[_0x74a4('0x11')][_0x74a4('0x13')]);return _0x58e307(_0x19f82b[_0x74a4('0x11')][_0x74a4('0x13')]);}logger[_0x74a4('0x11')](_0x74a4('0x14'),_0x41ef5a,_0x19f82b[_0x74a4('0x11')][_0x74a4('0x13')]);return _0x3122ba(_0x19f82b[_0x74a4('0x11')][_0x74a4('0x13')]);}else{logger[_0x74a4('0xd')](_0x74a4('0x14'),_0x41ef5a,_0x74a4('0xe'));_0x3122ba(_0x19f82b[_0x74a4('0x15')][_0x74a4('0x13')]);}})[_0x74a4('0x16')](function(_0x5d6dad){logger[_0x74a4('0x11')](_0x74a4('0x14'),_0x41ef5a,_0x5d6dad);_0x58e307(_0x5d6dad);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 639e00e..3372e82 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 _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 +var _0xba29=['show','post','put','update','delete','multer','util','path','connect-timeout','express','Router','../../config/environment','./network.controller','isAuthenticated','index','get','/:id'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xba29,0x9e));var _0x9ba2=function(_0x1b019d,_0xd406ba){_0x1b019d=_0x1b019d-0x0;var _0x1273bd=_0xba29[_0x1b019d];return _0x1273bd;};'use strict';var multer=require(_0x9ba2('0x0'));var util=require(_0x9ba2('0x1'));var path=require(_0x9ba2('0x2'));var timeout=require(_0x9ba2('0x3'));var express=require(_0x9ba2('0x4'));var router=express[_0x9ba2('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9ba2('0x6'));var controller=require(_0x9ba2('0x7'));router['get']('/',auth[_0x9ba2('0x8')](),controller[_0x9ba2('0x9')]);router[_0x9ba2('0xa')](_0x9ba2('0xb'),auth[_0x9ba2('0x8')](),controller[_0x9ba2('0xc')]);router[_0x9ba2('0xd')]('/',auth[_0x9ba2('0x8')](),controller['create']);router[_0x9ba2('0xe')](_0x9ba2('0xb'),auth[_0x9ba2('0x8')](),controller[_0x9ba2('0xf')]);router[_0x9ba2('0x10')]('/:id',auth[_0x9ba2('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index f576891..1f80e83 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 _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 +var _0x12a0=['turn','STRING','sequelize','localnet','externip'];(function(_0xae4a91,_0x19e6af){var _0xdd94ed=function(_0x5b3eee){while(--_0x5b3eee){_0xae4a91['push'](_0xae4a91['shift']());}};_0xdd94ed(++_0x19e6af);}(_0x12a0,0x1a6));var _0x012a=function(_0x391b85,_0x2c5491){_0x391b85=_0x391b85-0x0;var _0x5f8767=_0x12a0[_0x391b85];return _0x5f8767;};'use strict';var Sequelize=require(_0x012a('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x012a('0x1'),_0x012a('0x2'),'stun',_0x012a('0x3'))},'value':{'type':Sequelize[_0x012a('0x4')]},'username':{'type':Sequelize[_0x012a('0x4')]},'password':{'type':Sequelize[_0x012a('0x4')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 159d2f4..e1bf6b7 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 _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 +var _0x16f9=['Network,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','limit','undefined','count','offset','set','Content-Range','json','update','destroy','end','sendStatus','stack','name','index','map','Network','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','include','show','params','includeAll','create','body','toUpperCase','readFileSync','root','utf8','render','/etc/asterisk/stun_xcally.conf','Reload','TURN','server/files/templates/turn_multiple.ejs','writeFileSync','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','join','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','find','findAll','STUN','server/files/templates/stun_multiple.ejs','chan_sip.so','util','ejs','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','client','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent'];(function(_0x37851a,_0x1e457f){var _0x219d24=function(_0x8ace06){while(--_0x8ace06){_0x37851a['push'](_0x37851a['shift']());}};_0x219d24(++_0x1e457f);}(_0x16f9,0xf0));var _0x916f=function(_0x4a7e93,_0x561d34){_0x4a7e93=_0x4a7e93-0x0;var _0x5f303a=_0x16f9[_0x4a7e93];return _0x5f303a;};'use strict';var util=require(_0x916f('0x0'));var path=require('path');var ejs=require(_0x916f('0x1'));var fs=require('fs');var _=require(_0x916f('0x2'));var qs=require(_0x916f('0x3'));var logger=require(_0x916f('0x4'))(_0x916f('0x5'));var config=require(_0x916f('0x6'));var db=require(_0x916f('0x7'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x916f('0x8')][_0x916f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8eaf7b,_0x2ee96d,_0x45fc34,_0x3bf59f){return new Promise(function(_0x460a2f,_0x4bb4c4){var _0x3d8284=_0x3bf59f||client;return _0x3d8284[_0x916f('0xa')](_0x8eaf7b,_0x45fc34)[_0x916f('0xb')](function(_0x3abac5){logger[_0x916f('0xc')](_0x916f('0xd'),_0x2ee96d,_0x916f('0xe'));logger['debug'](_0x916f('0xf'),_0x2ee96d,_0x916f('0xe'),JSON[_0x916f('0x10')](_0x3abac5));if(_0x3abac5[_0x916f('0x11')]){if(_0x3abac5['error']['code']===0x1f4){logger[_0x916f('0x11')](_0x916f('0xd'),_0x2ee96d,_0x3abac5[_0x916f('0x11')][_0x916f('0x12')]);return _0x4bb4c4(_0x3abac5[_0x916f('0x11')][_0x916f('0x12')]);}logger[_0x916f('0x11')](_0x916f('0xd'),_0x2ee96d,_0x3abac5[_0x916f('0x11')]['message']);return _0x460a2f(_0x3abac5[_0x916f('0x11')][_0x916f('0x12')]);}else{logger[_0x916f('0xc')](_0x916f('0xd'),_0x2ee96d,_0x916f('0xe'));_0x460a2f(_0x3abac5[_0x916f('0x13')][_0x916f('0x12')]);}})[_0x916f('0x14')](function(_0x7e15b7){logger[_0x916f('0x11')](_0x916f('0xd'),_0x2ee96d,_0x7e15b7);_0x4bb4c4(_0x7e15b7);});});}function respondWithResult(_0x55561e,_0x2d8340){_0x2d8340=_0x2d8340||0xc8;return function(_0x2350ce){if(_0x2350ce){return _0x55561e[_0x916f('0x15')](_0x2d8340)['json'](_0x2350ce);}};}function respondWithFilteredResult(_0x442a5a,_0xca2e75){return function(_0x200462){if(_0x200462){var _0x4c8ebd=typeof _0xca2e75['offset']==='undefined'&&typeof _0xca2e75[_0x916f('0x16')]===_0x916f('0x17');var _0x16d166=_0x200462[_0x916f('0x18')];var _0x4bbb3f=_0x4c8ebd?0x0:_0xca2e75['offset'];var _0x51ba77=_0x4c8ebd?_0x200462[_0x916f('0x18')]:_0xca2e75[_0x916f('0x19')]+_0xca2e75[_0x916f('0x16')];var _0x3f94a6;if(_0x51ba77>=_0x16d166){_0x51ba77=_0x16d166;_0x3f94a6=0xc8;}else{_0x3f94a6=0xce;}_0x442a5a[_0x916f('0x15')](_0x3f94a6);return _0x442a5a[_0x916f('0x1a')](_0x916f('0x1b'),_0x4bbb3f+'-'+_0x51ba77+'/'+_0x16d166)[_0x916f('0x1c')](_0x200462);}return null;};}function saveUpdates(_0x5cab8d){return function(_0xbdbb9c){if(_0xbdbb9c){return _0xbdbb9c[_0x916f('0x1d')](_0x5cab8d)[_0x916f('0xb')](function(_0x1be4c4){return _0x1be4c4;});}return null;};}function removeEntity(_0x11b49b){return function(_0x1fea89){if(_0x1fea89){return _0x1fea89[_0x916f('0x1e')]()[_0x916f('0xb')](function(){_0x11b49b[_0x916f('0x15')](0xcc)[_0x916f('0x1f')]();});}};}function handleEntityNotFound(_0xd2fc79){return function(_0x52027a){if(!_0x52027a){_0xd2fc79[_0x916f('0x20')](0x194);}return _0x52027a;};}function handleError(_0x1b654a,_0x13ae07){_0x13ae07=_0x13ae07||0x1f4;return function(_0xdb5c33){logger[_0x916f('0x11')](_0xdb5c33[_0x916f('0x21')]);if(_0xdb5c33['name']){delete _0xdb5c33[_0x916f('0x22')];}_0x1b654a[_0x916f('0x15')](_0x13ae07)['send'](_0xdb5c33);};}exports[_0x916f('0x23')]=function(_0x3cb626,_0x5e2c27){var _0x41b722={},_0x3237e2={},_0x489f89={'count':0x0,'rows':[]};var _0x58367c=_[_0x916f('0x24')](db[_0x916f('0x25')][_0x916f('0x26')],function(_0x2cab64){return{'name':_0x2cab64[_0x916f('0x27')],'type':_0x2cab64[_0x916f('0x28')][_0x916f('0x29')]};});_0x3237e2['model']=_[_0x916f('0x24')](_0x58367c,_0x916f('0x22'));_0x3237e2[_0x916f('0x2a')]=_[_0x916f('0x2b')](_0x3cb626[_0x916f('0x2a')]);_0x3237e2[_0x916f('0x2c')]=_[_0x916f('0x2d')](_0x3237e2[_0x916f('0x2e')],_0x3237e2[_0x916f('0x2a')]);_0x41b722[_0x916f('0x2f')]=_[_0x916f('0x2d')](_0x3237e2[_0x916f('0x2e')],qs['fields'](_0x3cb626[_0x916f('0x2a')][_0x916f('0x30')]));_0x41b722['attributes']=_0x41b722[_0x916f('0x2f')][_0x916f('0x31')]?_0x41b722[_0x916f('0x2f')]:_0x3237e2[_0x916f('0x2e')];if(!_0x3cb626[_0x916f('0x2a')][_0x916f('0x32')]('nolimit')){_0x41b722[_0x916f('0x16')]=qs[_0x916f('0x16')](_0x3cb626[_0x916f('0x2a')][_0x916f('0x16')]);_0x41b722[_0x916f('0x19')]=qs[_0x916f('0x19')](_0x3cb626[_0x916f('0x2a')][_0x916f('0x19')]);}_0x41b722[_0x916f('0x33')]=qs[_0x916f('0x34')](_0x3cb626[_0x916f('0x2a')][_0x916f('0x34')]);_0x41b722[_0x916f('0x35')]=qs[_0x916f('0x2c')](_[_0x916f('0x36')](_0x3cb626[_0x916f('0x2a')],_0x3237e2[_0x916f('0x2c')]),_0x58367c);if(_0x3cb626[_0x916f('0x2a')][_0x916f('0x37')]){_0x41b722['where']=_[_0x916f('0x38')](_0x41b722[_0x916f('0x35')],{'$or':_[_0x916f('0x24')](_0x58367c,function(_0x40ce8c){if(_0x40ce8c[_0x916f('0x28')]!==_0x916f('0x39')){var _0x1cf194={};_0x1cf194[_0x40ce8c[_0x916f('0x22')]]={'$like':'%'+_0x3cb626[_0x916f('0x2a')]['filter']+'%'};return _0x1cf194;}})});}_0x41b722=_['merge']({},_0x41b722,_0x3cb626['options']);var _0x32bda9={'where':_0x41b722[_0x916f('0x35')]};return db[_0x916f('0x25')][_0x916f('0x18')](_0x32bda9)[_0x916f('0xb')](function(_0x103027){_0x489f89[_0x916f('0x18')]=_0x103027;if(_0x3cb626[_0x916f('0x2a')]['includeAll']){_0x41b722[_0x916f('0x3a')]=[{'all':!![]}];}return db[_0x916f('0x25')]['findAll'](_0x41b722);})[_0x916f('0xb')](function(_0x3c12d4){_0x489f89['rows']=_0x3c12d4;return _0x489f89;})[_0x916f('0xb')](respondWithFilteredResult(_0x5e2c27,_0x41b722))[_0x916f('0x14')](handleError(_0x5e2c27,null));};exports[_0x916f('0x3b')]=function(_0x1a5b17,_0xbff791){var _0x50b5c8={'raw':!![],'where':{'id':_0x1a5b17[_0x916f('0x3c')]['id']}},_0x5a1ad8={};_0x5a1ad8['model']=_[_0x916f('0x2b')](db[_0x916f('0x25')]['rawAttributes']);_0x5a1ad8[_0x916f('0x2a')]=_[_0x916f('0x2b')](_0x1a5b17['query']);_0x5a1ad8[_0x916f('0x2c')]=_[_0x916f('0x2d')](_0x5a1ad8[_0x916f('0x2e')],_0x5a1ad8[_0x916f('0x2a')]);_0x50b5c8[_0x916f('0x2f')]=_['intersection'](_0x5a1ad8[_0x916f('0x2e')],qs[_0x916f('0x30')](_0x1a5b17[_0x916f('0x2a')][_0x916f('0x30')]));_0x50b5c8[_0x916f('0x2f')]=_0x50b5c8[_0x916f('0x2f')]['length']?_0x50b5c8['attributes']:_0x5a1ad8[_0x916f('0x2e')];if(_0x1a5b17[_0x916f('0x2a')][_0x916f('0x3d')]){_0x50b5c8[_0x916f('0x3a')]=[{'all':!![]}];}_0x50b5c8=_[_0x916f('0x38')]({},_0x50b5c8,_0x1a5b17['options']);return db[_0x916f('0x25')]['find'](_0x50b5c8)['then'](handleEntityNotFound(_0xbff791,null))[_0x916f('0xb')](respondWithResult(_0xbff791,null))[_0x916f('0x14')](handleError(_0xbff791,null));};exports[_0x916f('0x3e')]=function(_0x37bec8,_0x5b4540){var _0x498bec;return db[_0x916f('0x25')][_0x916f('0x3e')](_0x37bec8[_0x916f('0x3f')],{'raw':!![]})[_0x916f('0xb')](function(_0x133c5b){_0x498bec=_0x133c5b;return db[_0x916f('0x25')]['findAll']({'where':{'type':_0x37bec8['body'][_0x916f('0x28')]},'raw':!![]});})[_0x916f('0xb')](function(_0x3e40c8){if(_0x498bec[_0x916f('0x28')][_0x916f('0x40')]()=='STUN'){var _0x2e31a2=fs[_0x916f('0x41')](path['join'](config[_0x916f('0x42')],'server/files/templates/stun_multiple.ejs'),_0x916f('0x43'));var _0x18ebaf=ejs[_0x916f('0x44')](_0x2e31a2,{'networks':_0x3e40c8||[]});fs['writeFileSync'](_0x916f('0x45'),_0x18ebaf);return respondWithRpcPromise(_0x916f('0x46'),'create',{'module':'res_stun_monitor.so'});}else if(_0x498bec[_0x916f('0x28')][_0x916f('0x40')]()==_0x916f('0x47')){var _0x9deedd=fs[_0x916f('0x41')](path['join'](config['root'],_0x916f('0x48')),_0x916f('0x43'));var _0x76aeb3=ejs[_0x916f('0x44')](_0x9deedd,{'networks':_0x3e40c8||[]});fs[_0x916f('0x49')](_0x916f('0x4a'),_0x76aeb3);return respondWithRpcPromise(_0x916f('0x46'),'create',{'module':_0x916f('0x4b')});}else{var _0x28ceb6=fs['readFileSync'](path[_0x916f('0x4c')](config[_0x916f('0x42')],_0x916f('0x4d')),'utf8');var _0x17977e=ejs[_0x916f('0x44')](_0x28ceb6,{'networks':_0x3e40c8||[]});fs['writeFileSync'](util[_0x916f('0x4e')](_0x916f('0x4f'),_0x37bec8[_0x916f('0x3f')]['type']['toLowerCase']()),_0x17977e);return respondWithRpcPromise(_0x916f('0x46'),'create',{'module':'chan_sip.so'});}})['then'](function(){return _0x498bec;})['then'](respondWithResult(_0x5b4540,0xc9))[_0x916f('0x14')](handleError(_0x5b4540,null));};exports['update']=function(_0x53dbfa,_0xd11b20){var _0xbf3fe3;return db['Network'][_0x916f('0x50')]({'where':{'id':_0x53dbfa[_0x916f('0x3c')]['id']}})[_0x916f('0xb')](handleEntityNotFound(_0xd11b20,null))[_0x916f('0xb')](saveUpdates(_0x53dbfa['body'],null))[_0x916f('0xb')](function(_0x1891a2){if(_0x1891a2){_0xbf3fe3=_0x1891a2;return db['Network'][_0x916f('0x51')]({'where':{'type':_0xbf3fe3['type']},'raw':!![]});}return null;})[_0x916f('0xb')](function(_0xce1256){if(_0xbf3fe3['type']['toUpperCase']()==_0x916f('0x52')){var _0xccf187=fs['readFileSync'](path[_0x916f('0x4c')](config[_0x916f('0x42')],_0x916f('0x53')),_0x916f('0x43'));var _0x4a5088=ejs[_0x916f('0x44')](_0xccf187,{'networks':_0xce1256||[]});fs['writeFileSync'](_0x916f('0x45'),_0x4a5088);return respondWithRpcPromise(_0x916f('0x46'),_0x916f('0x1d'),{'module':_0x916f('0x4b')});}else if(_0xbf3fe3[_0x916f('0x28')][_0x916f('0x40')]()==_0x916f('0x47')){var _0x109028=fs['readFileSync'](path[_0x916f('0x4c')](config[_0x916f('0x42')],_0x916f('0x48')),_0x916f('0x43'));var _0x40702a=ejs[_0x916f('0x44')](_0x109028,{'networks':_0xce1256||[]});fs[_0x916f('0x49')]('/etc/asterisk/turn_xcally.conf',_0x40702a);return respondWithRpcPromise(_0x916f('0x46'),_0x916f('0x1d'),{'module':_0x916f('0x4b')});}else{var _0x5be957=fs[_0x916f('0x41')](path[_0x916f('0x4c')](config[_0x916f('0x42')],_0x916f('0x4d')),_0x916f('0x43'));var _0xee9237=ejs[_0x916f('0x44')](_0x5be957,{'networks':_0xce1256||[]});fs[_0x916f('0x49')](util[_0x916f('0x4e')](_0x916f('0x4f'),_0x53dbfa['body'][_0x916f('0x28')]['toLowerCase']()),_0xee9237);return respondWithRpcPromise(_0x916f('0x46'),_0x916f('0x1d'),{'module':_0x916f('0x54')});}})[_0x916f('0xb')](function(_0x261998){if(_0x261998){return _0xbf3fe3;}return null;})[_0x916f('0xb')](respondWithResult(_0xd11b20,null))['catch'](handleError(_0xd11b20,null));};exports[_0x916f('0x1e')]=function(_0x570256,_0xa16018){var _0x49eddb;return db['Network'][_0x916f('0x50')]({'where':{'id':_0x570256[_0x916f('0x3c')]['id']}})['then'](function(_0x4f64cc){_0x49eddb=_0x4f64cc;return _0x4f64cc;})['then'](handleEntityNotFound(_0xa16018,null))[_0x916f('0xb')](removeEntity(_0xa16018,null))[_0x916f('0xb')](function(){if(_0x49eddb){return db[_0x916f('0x25')][_0x916f('0x51')]({'where':{'type':_0x49eddb[_0x916f('0x28')]},'raw':!![]});}})[_0x916f('0xb')](function(_0x5417b5){if(_0x49eddb[_0x916f('0x28')][_0x916f('0x40')]()==_0x916f('0x52')){var _0x30a3b4=fs[_0x916f('0x41')](path['join'](config['root'],_0x916f('0x53')),_0x916f('0x43'));var _0x1ff34a=ejs['render'](_0x30a3b4,{'networks':_0x5417b5||[]});fs[_0x916f('0x49')]('/etc/asterisk/stun_xcally.conf',_0x1ff34a);return respondWithRpcPromise(_0x916f('0x46'),_0x916f('0x1e'),{'module':'res_stun_monitor.so'});}else if(_0x49eddb[_0x916f('0x28')][_0x916f('0x40')]()==_0x916f('0x47')){var _0x30efb3=fs['readFileSync'](path[_0x916f('0x4c')](config[_0x916f('0x42')],_0x916f('0x48')),_0x916f('0x43'));var _0x4d6665=ejs[_0x916f('0x44')](_0x30efb3,{'networks':_0x5417b5||[]});fs[_0x916f('0x49')](_0x916f('0x4a'),_0x4d6665);return respondWithRpcPromise('Reload',_0x916f('0x1e'),{'module':_0x916f('0x4b')});}else{var _0x5c7118=fs[_0x916f('0x41')](path['join'](config[_0x916f('0x42')],_0x916f('0x4d')),_0x916f('0x43'));var _0x311828=ejs['render'](_0x5c7118,{'networks':_0x5417b5||[]});fs[_0x916f('0x49')](util['format'](_0x916f('0x4f'),_0x49eddb[_0x916f('0x28')]['toLowerCase']()),_0x311828);return respondWithRpcPromise(_0x916f('0x46'),'destroy',{'module':_0x916f('0x54')});}})[_0x916f('0x14')](handleError(_0xa16018,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 3206017..695b53f 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 _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 +var _0x1339=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','Network','network','../../config/logger','api'];(function(_0x138077,_0x495deb){var _0x1806fc=function(_0x151500){while(--_0x151500){_0x138077['push'](_0x138077['shift']());}};_0x1806fc(++_0x495deb);}(_0x1339,0x1ed));var _0x9133=function(_0x50085b,_0x5e2bf3){_0x50085b=_0x50085b-0x0;var _0x3ddaec=_0x1339[_0x50085b];return _0x3ddaec;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9133('0x0'))(_0x9133('0x1'));var moment=require(_0x9133('0x2'));var BPromise=require(_0x9133('0x3'));var rp=require(_0x9133('0x4'));var fs=require('fs');var path=require(_0x9133('0x5'));var rimraf=require(_0x9133('0x6'));var config=require(_0x9133('0x7'));var attributes=require('./network.attributes');module[_0x9133('0x8')]=function(_0x855473,_0x379915){return _0x855473['define'](_0x9133('0x9'),attributes,{'tableName':_0x9133('0xa'),'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 39c0f01..391457a 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(_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 +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3685d3,_0x13dcbe){var _0x520c0a=function(_0x4e5727){while(--_0x4e5727){_0x3685d3['push'](_0x3685d3['shift']());}};_0x520c0a(++_0x13dcbe);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index bc3de77..00d6184 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 _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 +var _0xb03e=['addApplications','/:id/users','/:id/send','send','put','update','delete','destroy','removeAnswers','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','getAgents','post','addAnswer','/:id/notify','notify'];(function(_0x15dcfc,_0x9d2060){var _0x57cc5c=function(_0x5b0c56){while(--_0x5b0c56){_0x15dcfc['push'](_0x15dcfc['shift']());}};_0x57cc5c(++_0x9d2060);}(_0xb03e,0x1eb));var _0xeb03=function(_0x4a9a96,_0x56dbc9){_0x4a9a96=_0x4a9a96-0x0;var _0x40cb8d=_0xb03e[_0x4a9a96];return _0x40cb8d;};'use strict';var multer=require('multer');var util=require(_0xeb03('0x0'));var path=require(_0xeb03('0x1'));var timeout=require(_0xeb03('0x2'));var express=require(_0xeb03('0x3'));var router=express[_0xeb03('0x4')]();var fs_extra=require(_0xeb03('0x5'));var auth=require(_0xeb03('0x6'));var interaction=require(_0xeb03('0x7'));var config=require(_0xeb03('0x8'));var controller=require(_0xeb03('0x9'));router[_0xeb03('0xa')]('/',auth[_0xeb03('0xb')](),controller['index']);router[_0xeb03('0xa')](_0xeb03('0xc'),auth[_0xeb03('0xb')](),controller[_0xeb03('0xd')]);router[_0xeb03('0xa')](_0xeb03('0xe'),auth['isAuthenticated'](),controller[_0xeb03('0xf')]);router[_0xeb03('0xa')](_0xeb03('0x10'),auth['isAuthenticated'](),controller[_0xeb03('0x11')]);router['get'](_0xeb03('0x12'),auth[_0xeb03('0xb')](),controller[_0xeb03('0x13')]);router[_0xeb03('0xa')](_0xeb03('0x14'),auth[_0xeb03('0xb')](),controller[_0xeb03('0x15')]);router[_0xeb03('0xa')](_0xeb03('0x16'),auth[_0xeb03('0xb')](),controller[_0xeb03('0x17')]);router[_0xeb03('0xa')]('/:id/users',auth[_0xeb03('0xb')](),controller[_0xeb03('0x18')]);router[_0xeb03('0x19')]('/',auth[_0xeb03('0xb')](),controller['create']);router[_0xeb03('0x19')](_0xeb03('0x10'),auth[_0xeb03('0xb')](),controller['addDisposition']);router[_0xeb03('0x19')](_0xeb03('0x12'),auth[_0xeb03('0xb')](),controller[_0xeb03('0x1a')]);router[_0xeb03('0x19')](_0xeb03('0x1b'),controller[_0xeb03('0x1c')]);router[_0xeb03('0x19')](_0xeb03('0x14'),auth[_0xeb03('0xb')](),controller[_0xeb03('0x1d')]);router[_0xeb03('0x19')](_0xeb03('0x1e'),auth[_0xeb03('0xb')](),controller['addAgents']);router[_0xeb03('0x19')](_0xeb03('0x1f'),auth[_0xeb03('0xb')](),controller[_0xeb03('0x20')]);router[_0xeb03('0x21')](_0xeb03('0xe'),auth[_0xeb03('0xb')](),controller[_0xeb03('0x22')]);router[_0xeb03('0x23')]('/:id',auth[_0xeb03('0xb')](),controller[_0xeb03('0x24')]);router[_0xeb03('0x23')](_0xeb03('0x10'),auth[_0xeb03('0xb')](),controller['removeDispositions']);router[_0xeb03('0x23')](_0xeb03('0x12'),auth[_0xeb03('0xb')](),controller[_0xeb03('0x25')]);router[_0xeb03('0x23')](_0xeb03('0x1e'),auth[_0xeb03('0xb')](),controller[_0xeb03('0x26')]);module[_0xeb03('0x27')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 4fd5467..f5e778a 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 _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 +var _0x8224=['exports','STRING','name','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring'];(function(_0x42d439,_0x2bcb89){var _0x48bbda=function(_0x5650e8){while(--_0x5650e8){_0x42d439['push'](_0x42d439['shift']());}};_0x48bbda(++_0x2bcb89);}(_0x8224,0x6a));var _0x4822=function(_0x45f4bd,_0x4856d2){_0x45f4bd=_0x45f4bd-0x0;var _0x40adab=_0x8224[_0x45f4bd];return _0x40adab;};'use strict';var Sequelize=require(_0x4822('0x0'));var rs=require(_0x4822('0x1'));module[_0x4822('0x2')]={'name':{'type':Sequelize[_0x4822('0x3')],'unique':_0x4822('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0x4822('0x3')]},'token':{'type':Sequelize[_0x4822('0x3')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x4822('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x4822('0x5')],'defaultValue':function(){return _0x4822('0x6');}},'notificationSound':{'type':Sequelize[_0x4822('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4822('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4822('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x4822('0x3')]},'queueTransfer':{'type':Sequelize[_0x4822('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4822('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4822('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x4822('0x7')],'defaultValue':![],'comment':_0x4822('0x9'),'set':function(_0x5253a7){if(!_0x5253a7)this[_0x4822('0xa')]('mandatoryDispositionPauseId',null);this[_0x4822('0xa')](_0x4822('0xb'),_0x5253a7);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index f49a877..1847315 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 _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 +var _0x9a14=['removeAnswers','ids','notify','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','isNil','from','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','List','Contacts','OpenchannelApplication','Applications','account','applications','orderBy','asc','defaults','firstName','lastName','threadId','externalUrl','OpenchannelInteraction','ContactId','spread','contact','messageId','interaction','created','push','close','unmanaged','*,*,*,*','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','queueId','OpenchannelQueue','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','bulkCreate','findAndCountAll','priority','finally','getApplications','order','Contact','fullname','internal','Tag','color','tag','userOpenchannelAccount:save','removeAgents','isArray','emit','userOpenchannelAccount:remove','User','getAgents','DESC','ListId','out','OpenchannelMessage','Messages','dataValues','rimraf','zip-dir','fast-json-patch','moment','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','http','client','request','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','UserProfileResource','name','send','index','Pause','map','OpenchannelAccount','rawAttributes','type','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','filters','where','VIRTUAL','filter','merge','includeAll','include','findAll','rows','show','params','mandatoryDispositionPause','keys','options','find','create','body','user','role','get','OpenchannelAccounts','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','pick','removeDispositions','addAnswer','CannedAnswer'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x9a14,0x1d3));var _0x49a1=function(_0x4748c5,_0x1fdfa9){_0x4748c5=_0x4748c5-0x0;var _0xe8b244=_0x9a14[_0x4748c5];return _0xe8b244;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x49a1('0x0'));var zipdir=require(_0x49a1('0x1'));var jsonpatch=require(_0x49a1('0x2'));var rp=require('request-promise');var moment=require(_0x49a1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x49a1('0x4'));var util=require(_0x49a1('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x49a1('0x6'));var fs=require('fs');var fs_extra=require(_0x49a1('0x7'));var _=require(_0x49a1('0x8'));var squel=require(_0x49a1('0x9'));var crypto=require(_0x49a1('0xa'));var jsforce=require(_0x49a1('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x49a1('0xc'));var Papa=require(_0x49a1('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49a1('0xe'));var as=require(_0x49a1('0xf'));var hardwareService=require(_0x49a1('0x10'));var logger=require(_0x49a1('0x11'))(_0x49a1('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49a1('0x13'));var db=require(_0x49a1('0x14'))['db'];config[_0x49a1('0x15')]=_['defaults'](config[_0x49a1('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x49a1('0x16'))(new Redis(config[_0x49a1('0x15')]));require(_0x49a1('0x17'))[_0x49a1('0x18')](socket);var jayson=require(_0x49a1('0x19'));var client=jayson['client'][_0x49a1('0x1a')]({'port':0x232c});var client9002=jayson[_0x49a1('0x1b')][_0x49a1('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x311057,_0x41809d,_0x1c6196,_0x3eb40f){return new BPromise(function(_0x1226f7,_0x243ec0){var _0x2401c2=_0x3eb40f||client;return _0x2401c2[_0x49a1('0x1c')](_0x311057,_0x1c6196)['then'](function(_0x4b2c6c){logger[_0x49a1('0x1d')](_0x49a1('0x1e'),_0x41809d,'request\x20sent');logger[_0x49a1('0x1f')](_0x49a1('0x20'),_0x41809d,_0x49a1('0x21'),JSON[_0x49a1('0x22')](_0x4b2c6c));if(_0x4b2c6c['error']){if(_0x4b2c6c[_0x49a1('0x23')]['code']===0x1f4){logger['error'](_0x49a1('0x1e'),_0x41809d,_0x4b2c6c[_0x49a1('0x23')]['message']);return _0x243ec0(_0x4b2c6c['error'][_0x49a1('0x24')]);}logger[_0x49a1('0x23')](_0x49a1('0x1e'),_0x41809d,_0x4b2c6c['error'][_0x49a1('0x24')]);return _0x1226f7(_0x4b2c6c[_0x49a1('0x23')][_0x49a1('0x24')]);}else{logger[_0x49a1('0x1d')](_0x49a1('0x1e'),_0x41809d,_0x49a1('0x21'));_0x1226f7(_0x4b2c6c['result']['message']);}})[_0x49a1('0x25')](function(_0x3f325){logger[_0x49a1('0x23')]('OpenchannelAccount,\x20%s,\x20%s',_0x41809d,_0x3f325);_0x243ec0(_0x3f325);});});}function respondWithStatusCode(_0x53c1a1,_0x50023b){_0x50023b=_0x50023b||0xcc;return function(_0x2cf60a){if(_0x2cf60a){return _0x53c1a1[_0x49a1('0x26')](_0x50023b);}return _0x53c1a1[_0x49a1('0x27')](_0x50023b)['end']();};}function respondWithResult(_0x24659b,_0x85e989){_0x85e989=_0x85e989||0xc8;return function(_0x429d7c){if(_0x429d7c){return _0x24659b[_0x49a1('0x27')](_0x85e989)[_0x49a1('0x28')](_0x429d7c);}};}function respondWithFilteredResult(_0x4f4078,_0x2a63e8){return function(_0x18ed58){if(_0x18ed58){var _0x2d1601=typeof _0x2a63e8[_0x49a1('0x29')]==='undefined'&&typeof _0x2a63e8['limit']===_0x49a1('0x2a');var _0x258496=_0x18ed58[_0x49a1('0x2b')];var _0x235c47=_0x2d1601?0x0:_0x2a63e8[_0x49a1('0x29')];var _0x493f26=_0x2d1601?_0x18ed58[_0x49a1('0x2b')]:_0x2a63e8['offset']+_0x2a63e8[_0x49a1('0x2c')];var _0x57d401;if(_0x493f26>=_0x258496){_0x493f26=_0x258496;_0x57d401=0xc8;}else{_0x57d401=0xce;}_0x4f4078[_0x49a1('0x27')](_0x57d401);return _0x4f4078[_0x49a1('0x2d')](_0x49a1('0x2e'),_0x235c47+'-'+_0x493f26+'/'+_0x258496)[_0x49a1('0x28')](_0x18ed58);}return null;};}function patchUpdates(_0x4af585){return function(_0x53d698){try{jsonpatch[_0x49a1('0x2f')](_0x53d698,_0x4af585,!![]);}catch(_0x1b6d3a){return BPromise[_0x49a1('0x30')](_0x1b6d3a);}return _0x53d698[_0x49a1('0x31')]();};}function saveUpdates(_0x3b2061,_0xb9b0be){return function(_0xc88a8){if(_0xc88a8){return _0xc88a8[_0x49a1('0x32')](_0x3b2061)['then'](function(_0x58c840){return _0x58c840;});}return null;};}function removeEntity(_0x2abb43,_0x3f62e3){return function(_0x528903){if(_0x528903){return _0x528903['destroy']()[_0x49a1('0x33')](function(){var _0x11262d=_0x528903['get']({'plain':!![]});var _0x402959='OpenchannelAccounts';return db[_0x49a1('0x34')]['destroy']({'where':{'type':_0x402959,'resourceId':_0x11262d['id']}})[_0x49a1('0x33')](function(){return _0x528903;});})[_0x49a1('0x33')](function(){_0x2abb43[_0x49a1('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a8e7f,_0xbcf2ce){return function(_0x59554d){if(!_0x59554d){_0x5a8e7f[_0x49a1('0x26')](0x194);}return _0x59554d;};}function handleError(_0x2c4999,_0x5d9b4f){_0x5d9b4f=_0x5d9b4f||0x1f4;return function(_0x414d04){logger[_0x49a1('0x23')](_0x414d04['stack']);if(_0x414d04['name']){delete _0x414d04[_0x49a1('0x35')];}_0x2c4999[_0x49a1('0x27')](_0x5d9b4f)[_0x49a1('0x36')](_0x414d04);};}exports[_0x49a1('0x37')]=function(_0x4695eb,_0x342bf8){var _0x2c89a9={'include':[{'model':db[_0x49a1('0x38')],'as':'mandatoryDispositionPause'}]},_0x3b18e4={},_0x35b561={'count':0x0,'rows':[]};var _0x152dfb=_[_0x49a1('0x39')](db[_0x49a1('0x3a')][_0x49a1('0x3b')],function(_0x4ab046){return{'name':_0x4ab046['fieldName'],'type':_0x4ab046[_0x49a1('0x3c')]['key']};});_0x3b18e4[_0x49a1('0x3d')]=_[_0x49a1('0x39')](_0x152dfb,'name');_0x3b18e4[_0x49a1('0x3e')]=_['keys'](_0x4695eb[_0x49a1('0x3e')]);_0x3b18e4['filters']=_[_0x49a1('0x3f')](_0x3b18e4[_0x49a1('0x3d')],_0x3b18e4[_0x49a1('0x3e')]);_0x2c89a9['attributes']=_[_0x49a1('0x3f')](_0x3b18e4['model'],qs['fields'](_0x4695eb['query'][_0x49a1('0x40')]));_0x2c89a9[_0x49a1('0x41')]=_0x2c89a9[_0x49a1('0x41')][_0x49a1('0x42')]?_0x2c89a9[_0x49a1('0x41')]:_0x3b18e4['model'];if(!_0x4695eb['query'][_0x49a1('0x43')](_0x49a1('0x44'))){_0x2c89a9['limit']=qs[_0x49a1('0x2c')](_0x4695eb['query'][_0x49a1('0x2c')]);_0x2c89a9[_0x49a1('0x29')]=qs[_0x49a1('0x29')](_0x4695eb[_0x49a1('0x3e')][_0x49a1('0x29')]);}_0x2c89a9['order']=qs[_0x49a1('0x45')](_0x4695eb['query'][_0x49a1('0x45')]);_0x2c89a9['where']=qs[_0x49a1('0x46')](_['pick'](_0x4695eb[_0x49a1('0x3e')],_0x3b18e4[_0x49a1('0x46')]),_0x152dfb);if(_0x4695eb['query']['filter']){_0x2c89a9['where']=_['merge'](_0x2c89a9[_0x49a1('0x47')],{'$or':_[_0x49a1('0x39')](_0x152dfb,function(_0x222593){if(_0x222593['type']!==_0x49a1('0x48')){var _0x497034={};_0x497034[_0x222593[_0x49a1('0x35')]]={'$like':'%'+_0x4695eb[_0x49a1('0x3e')][_0x49a1('0x49')]+'%'};return _0x497034;}})});}_0x2c89a9=_[_0x49a1('0x4a')]({},_0x2c89a9,_0x4695eb['options']);var _0x2282ca={'where':_0x2c89a9[_0x49a1('0x47')]};return db[_0x49a1('0x3a')][_0x49a1('0x2b')](_0x2282ca)[_0x49a1('0x33')](function(_0x4096f3){_0x35b561[_0x49a1('0x2b')]=_0x4096f3;if(_0x4695eb[_0x49a1('0x3e')][_0x49a1('0x4b')]){_0x2c89a9[_0x49a1('0x4c')]=[{'all':!![]}];}return db[_0x49a1('0x3a')][_0x49a1('0x4d')](_0x2c89a9);})[_0x49a1('0x33')](function(_0x3471a0){_0x35b561[_0x49a1('0x4e')]=_0x3471a0;return _0x35b561;})[_0x49a1('0x33')](respondWithFilteredResult(_0x342bf8,_0x2c89a9))['catch'](handleError(_0x342bf8,null));};exports[_0x49a1('0x4f')]=function(_0x41089b,_0xedeebf){var _0x299dd0={'raw':![],'where':{'id':_0x41089b[_0x49a1('0x50')]['id']},'include':[{'model':db['Pause'],'as':_0x49a1('0x51')}]},_0x27962f={};_0x27962f[_0x49a1('0x3d')]=_[_0x49a1('0x52')](db[_0x49a1('0x3a')]['rawAttributes']);_0x27962f['query']=_[_0x49a1('0x52')](_0x41089b[_0x49a1('0x3e')]);_0x27962f['filters']=_[_0x49a1('0x3f')](_0x27962f[_0x49a1('0x3d')],_0x27962f['query']);_0x299dd0['attributes']=_[_0x49a1('0x3f')](_0x27962f[_0x49a1('0x3d')],qs[_0x49a1('0x40')](_0x41089b[_0x49a1('0x3e')]['fields']));_0x299dd0[_0x49a1('0x41')]=_0x299dd0['attributes'][_0x49a1('0x42')]?_0x299dd0[_0x49a1('0x41')]:_0x27962f[_0x49a1('0x3d')];if(_0x41089b[_0x49a1('0x3e')][_0x49a1('0x4b')]){_0x299dd0[_0x49a1('0x4c')]=[{'all':!![]}];}_0x299dd0=_[_0x49a1('0x4a')]({},_0x299dd0,_0x41089b[_0x49a1('0x53')]);return db['OpenchannelAccount'][_0x49a1('0x54')](_0x299dd0)[_0x49a1('0x33')](handleEntityNotFound(_0xedeebf,null))[_0x49a1('0x33')](respondWithResult(_0xedeebf,null))[_0x49a1('0x25')](handleError(_0xedeebf,null));};exports['create']=function(_0x5337dd,_0x28d478){return db['OpenchannelAccount'][_0x49a1('0x55')](_0x5337dd[_0x49a1('0x56')],{})[_0x49a1('0x33')](function(_0x56bceb){var _0x1c0ad8=_0x5337dd[_0x49a1('0x57')]['get']({'plain':!![]});if(!_0x1c0ad8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1c0ad8[_0x49a1('0x58')]==='user'){var _0x3d9989=_0x56bceb[_0x49a1('0x59')]({'plain':!![]});var _0x25bce5=_0x49a1('0x5a');return db[_0x49a1('0x5b')][_0x49a1('0x54')]({'where':{'name':_0x25bce5,'userProfileId':_0x1c0ad8[_0x49a1('0x5c')]},'raw':!![]})[_0x49a1('0x33')](function(_0x5b7a18){if(_0x5b7a18&&_0x5b7a18[_0x49a1('0x5d')]===0x0){return db[_0x49a1('0x34')][_0x49a1('0x55')]({'name':_0x3d9989['name'],'resourceId':_0x3d9989['id'],'type':_0x5b7a18[_0x49a1('0x35')],'sectionId':_0x5b7a18['id']},{})['then'](function(){return _0x56bceb;});}else{return _0x56bceb;}})['catch'](function(_0x414538){logger[_0x49a1('0x23')](_0x49a1('0x5e'),_0x414538);throw _0x414538;});}return _0x56bceb;})[_0x49a1('0x33')](respondWithResult(_0x28d478,0xc9))[_0x49a1('0x25')](handleError(_0x28d478,null));};exports[_0x49a1('0x32')]=function(_0x23e54b,_0x152154){if(_0x23e54b['body']['id']){delete _0x23e54b[_0x49a1('0x56')]['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x23e54b[_0x49a1('0x50')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x49a1('0x33')](handleEntityNotFound(_0x152154,null))[_0x49a1('0x33')](saveUpdates(_0x23e54b[_0x49a1('0x56')],null))['then'](respondWithResult(_0x152154,null))['catch'](handleError(_0x152154,null));};exports[_0x49a1('0x5f')]=function(_0x2b3cc8,_0x229c07){return db[_0x49a1('0x3a')]['find']({'where':{'id':_0x2b3cc8['params']['id']}})['then'](handleEntityNotFound(_0x229c07,null))[_0x49a1('0x33')](removeEntity(_0x229c07,null))[_0x49a1('0x25')](handleError(_0x229c07,null));};exports[_0x49a1('0x60')]=function(_0x2284f7,_0x30e083){return db[_0x49a1('0x3a')][_0x49a1('0x60')]()[_0x49a1('0x33')](respondWithResult(_0x30e083,null))[_0x49a1('0x25')](handleError(_0x30e083,null));};exports[_0x49a1('0x61')]=function(_0x568372,_0x4e7252,_0x3ed5d0){if(_0x568372['body']['id']){delete _0x568372[_0x49a1('0x56')]['id'];}return db[_0x49a1('0x3a')]['find']({'where':{'id':_0x568372[_0x49a1('0x50')]['id']}})['then'](handleEntityNotFound(_0x4e7252,null))[_0x49a1('0x33')](function(_0x438d17){if(_0x438d17){_0x568372[_0x49a1('0x56')][_0x49a1('0x62')]=_0x438d17['id'];return db[_0x49a1('0x63')][_0x49a1('0x55')](_0x568372[_0x49a1('0x56')]);}})['then'](respondWithResult(_0x4e7252,null))[_0x49a1('0x25')](handleError(_0x4e7252,null));};exports[_0x49a1('0x64')]=function(_0x25433c,_0x1d3798,_0x53c32f){var _0x22a1d4={'raw':![],'where':{}};var _0x19db13={};var _0x416442={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x49a1('0x65')]({'where':{'id':_0x25433c['params']['id']}})[_0x49a1('0x33')](handleEntityNotFound(_0x1d3798,null))[_0x49a1('0x33')](function(_0x4bcdf5){if(_0x4bcdf5){_0x19db13[_0x49a1('0x3d')]=_[_0x49a1('0x52')](db[_0x49a1('0x63')]['rawAttributes']);_0x19db13[_0x49a1('0x3e')]=_[_0x49a1('0x52')](_0x25433c[_0x49a1('0x3e')]);_0x19db13[_0x49a1('0x46')]=_[_0x49a1('0x3f')](_0x19db13[_0x49a1('0x3d')],_0x19db13[_0x49a1('0x3e')]);_0x22a1d4[_0x49a1('0x41')]=_['intersection'](_0x19db13[_0x49a1('0x3d')],qs[_0x49a1('0x40')](_0x25433c[_0x49a1('0x3e')][_0x49a1('0x40')]));_0x22a1d4[_0x49a1('0x41')]=_0x22a1d4[_0x49a1('0x41')]['length']?_0x22a1d4[_0x49a1('0x41')]:_0x19db13[_0x49a1('0x3d')];if(!_0x25433c[_0x49a1('0x3e')]['hasOwnProperty']('nolimit')){_0x22a1d4[_0x49a1('0x2c')]=qs[_0x49a1('0x2c')](_0x25433c[_0x49a1('0x3e')][_0x49a1('0x2c')]);_0x22a1d4[_0x49a1('0x29')]=qs['offset'](_0x25433c['query'][_0x49a1('0x29')]);}_0x22a1d4['order']=qs[_0x49a1('0x45')](_0x25433c[_0x49a1('0x3e')][_0x49a1('0x45')]);_0x22a1d4['where']=qs[_0x49a1('0x46')](_[_0x49a1('0x66')](_0x25433c[_0x49a1('0x3e')],_0x19db13[_0x49a1('0x46')]));_0x22a1d4[_0x49a1('0x47')][_0x49a1('0x62')]=_0x4bcdf5['id'];if(_0x25433c[_0x49a1('0x3e')][_0x49a1('0x49')]){_0x22a1d4[_0x49a1('0x47')]=_[_0x49a1('0x4a')](_0x22a1d4[_0x49a1('0x47')],{'$or':_['map'](_0x22a1d4['attributes'],function(_0x377217){var _0x3ab9ae={};_0x3ab9ae[_0x377217]={'$like':'%'+_0x25433c[_0x49a1('0x3e')][_0x49a1('0x49')]+'%'};return _0x3ab9ae;})});}_0x22a1d4=_[_0x49a1('0x4a')]({},_0x22a1d4,_0x25433c[_0x49a1('0x53')]);return db['Disposition'][_0x49a1('0x2b')]({'where':_0x22a1d4[_0x49a1('0x47')]})[_0x49a1('0x33')](function(_0x4fafbc){_0x416442[_0x49a1('0x2b')]=_0x4fafbc;if(_0x25433c[_0x49a1('0x3e')][_0x49a1('0x4b')]){_0x22a1d4[_0x49a1('0x4c')]=[{'all':!![]}];}return db[_0x49a1('0x63')][_0x49a1('0x4d')](_0x22a1d4);})[_0x49a1('0x33')](function(_0x1874a8){_0x416442[_0x49a1('0x4e')]=_0x1874a8;return _0x416442;});}})[_0x49a1('0x33')](respondWithFilteredResult(_0x1d3798,_0x22a1d4))['catch'](handleError(_0x1d3798,null));};exports[_0x49a1('0x67')]=function(_0x523333,_0x3e8b07,_0x34f736){return db[_0x49a1('0x3a')][_0x49a1('0x54')]({'where':{'id':_0x523333['params']['id']}})[_0x49a1('0x33')](handleEntityNotFound(_0x3e8b07,null))[_0x49a1('0x33')](function(_0x10c7dd){if(_0x10c7dd){return _0x10c7dd[_0x49a1('0x67')](_0x523333[_0x49a1('0x3e')]['ids']);}})[_0x49a1('0x33')](respondWithStatusCode(_0x3e8b07,null))[_0x49a1('0x25')](handleError(_0x3e8b07,null));};exports[_0x49a1('0x68')]=function(_0x4e6ffe,_0x2a273d,_0x2b86c5){if(_0x4e6ffe[_0x49a1('0x56')]['id']){delete _0x4e6ffe['body']['id'];}return db[_0x49a1('0x3a')][_0x49a1('0x54')]({'where':{'id':_0x4e6ffe[_0x49a1('0x50')]['id']}})[_0x49a1('0x33')](handleEntityNotFound(_0x2a273d,null))[_0x49a1('0x33')](function(_0x59f0c5){if(_0x59f0c5){_0x4e6ffe[_0x49a1('0x56')]['OpenchannelAccountId']=_0x59f0c5['id'];return db[_0x49a1('0x69')][_0x49a1('0x55')](_0x4e6ffe[_0x49a1('0x56')]);}})[_0x49a1('0x33')](respondWithResult(_0x2a273d,null))[_0x49a1('0x25')](handleError(_0x2a273d,null));};exports['getAnswers']=function(_0xf16108,_0x44be1b,_0x445e14){var _0x4b88d9={'raw':![],'where':{}};var _0x3d7bc5={};var _0x3a5177={'count':0x0,'rows':[]};return db[_0x49a1('0x3a')][_0x49a1('0x65')]({'where':{'id':_0xf16108[_0x49a1('0x50')]['id']}})['then'](handleEntityNotFound(_0x44be1b,null))[_0x49a1('0x33')](function(_0x1488c0){if(_0x1488c0){_0x3d7bc5[_0x49a1('0x3d')]=_['keys'](db[_0x49a1('0x69')][_0x49a1('0x3b')]);_0x3d7bc5[_0x49a1('0x3e')]=_[_0x49a1('0x52')](_0xf16108['query']);_0x3d7bc5[_0x49a1('0x46')]=_['intersection'](_0x3d7bc5['model'],_0x3d7bc5[_0x49a1('0x3e')]);_0x4b88d9[_0x49a1('0x41')]=_[_0x49a1('0x3f')](_0x3d7bc5[_0x49a1('0x3d')],qs[_0x49a1('0x40')](_0xf16108[_0x49a1('0x3e')]['fields']));_0x4b88d9[_0x49a1('0x41')]=_0x4b88d9[_0x49a1('0x41')][_0x49a1('0x42')]?_0x4b88d9[_0x49a1('0x41')]:_0x3d7bc5['model'];if(!_0xf16108[_0x49a1('0x3e')][_0x49a1('0x43')](_0x49a1('0x44'))){_0x4b88d9[_0x49a1('0x2c')]=qs[_0x49a1('0x2c')](_0xf16108[_0x49a1('0x3e')][_0x49a1('0x2c')]);_0x4b88d9[_0x49a1('0x29')]=qs[_0x49a1('0x29')](_0xf16108[_0x49a1('0x3e')][_0x49a1('0x29')]);}_0x4b88d9['order']=qs[_0x49a1('0x45')](_0xf16108[_0x49a1('0x3e')]['sort']);_0x4b88d9['where']=qs[_0x49a1('0x46')](_['pick'](_0xf16108[_0x49a1('0x3e')],_0x3d7bc5[_0x49a1('0x46')]));_0x4b88d9[_0x49a1('0x47')][_0x49a1('0x62')]=_0x1488c0['id'];if(_0xf16108[_0x49a1('0x3e')]['filter']){_0x4b88d9[_0x49a1('0x47')]=_[_0x49a1('0x4a')](_0x4b88d9['where'],{'$or':_[_0x49a1('0x39')](_0x4b88d9[_0x49a1('0x41')],function(_0x2e09fc){var _0x4bb49f={};_0x4bb49f[_0x2e09fc]={'$like':'%'+_0xf16108[_0x49a1('0x3e')]['filter']+'%'};return _0x4bb49f;})});}_0x4b88d9=_[_0x49a1('0x4a')]({},_0x4b88d9,_0xf16108[_0x49a1('0x53')]);return db[_0x49a1('0x69')][_0x49a1('0x2b')]({'where':_0x4b88d9[_0x49a1('0x47')]})[_0x49a1('0x33')](function(_0x442227){_0x3a5177[_0x49a1('0x2b')]=_0x442227;if(_0xf16108[_0x49a1('0x3e')][_0x49a1('0x4b')]){_0x4b88d9['include']=[{'all':!![]}];}return db[_0x49a1('0x69')][_0x49a1('0x4d')](_0x4b88d9);})['then'](function(_0x2e607c){_0x3a5177[_0x49a1('0x4e')]=_0x2e607c;return _0x3a5177;});}})[_0x49a1('0x33')](respondWithFilteredResult(_0x44be1b,_0x4b88d9))[_0x49a1('0x25')](handleError(_0x44be1b,null));};exports[_0x49a1('0x6a')]=function(_0xdc88bd,_0x59718d,_0x588c83){return db[_0x49a1('0x3a')][_0x49a1('0x54')]({'where':{'id':_0xdc88bd[_0x49a1('0x50')]['id']}})[_0x49a1('0x33')](handleEntityNotFound(_0x59718d,null))[_0x49a1('0x33')](function(_0x5d6035){if(_0x5d6035){return _0x5d6035[_0x49a1('0x6a')](_0xdc88bd[_0x49a1('0x3e')][_0x49a1('0x6b')]);}})[_0x49a1('0x33')](respondWithStatusCode(_0x59718d,null))[_0x49a1('0x25')](handleError(_0x59718d,null));};exports[_0x49a1('0x6c')]=function(_0xea371b,_0x19f57f,_0x308b92){var _0x320af1={'body':_0xea371b[_0x49a1('0x56')],'channel':'openchannel'};var _0x24522d=[];var _0x192b2f=[];var _0x346586={};var _0x3d2e49=![];return db[_0x49a1('0x6d')][_0x49a1('0x60')]()[_0x49a1('0x33')](function(_0x481c27){if(!_0x481c27){throw new db[(_0x49a1('0x6e'))][(_0x49a1('0x6f'))](_0x49a1('0x70'));}_0x24522d=_[_0x49a1('0x71')](_['keys'](_0x481c27),[_0x49a1('0x72'),_0x49a1('0x73')]);_0x192b2f=_[_0x49a1('0x71')](_[_0x49a1('0x52')](_0x481c27),[_0x49a1('0x72'),_0x49a1('0x73'),_0x49a1('0x74'),'ListId']);if(_0xea371b[_0x49a1('0x56')]['id']){delete _0xea371b[_0x49a1('0x56')]['id'];}if(_[_0x49a1('0x75')](_0xea371b[_0x49a1('0x56')][_0x49a1('0x76')])){throw new db[(_0x49a1('0x6e'))][(_0x49a1('0x6f'))](_0x49a1('0x77'));}if(_[_0x49a1('0x75')](_0xea371b[_0x49a1('0x56')][_0x49a1('0x56')])||_0xea371b[_0x49a1('0x56')][_0x49a1('0x56')]===''){throw new db[(_0x49a1('0x6e'))]['ValidationError'](_0x49a1('0x78'));}if(_[_0x49a1('0x75')](_0xea371b['body'][_0x49a1('0x79')])){throw new db[(_0x49a1('0x6e'))]['ValidationError'](_0x49a1('0x7a')+_0x192b2f);}if(!_['includes'](_0x192b2f,_0xea371b[_0x49a1('0x56')]['mapKey'])){throw new db['Sequelize'][(_0x49a1('0x6f'))](_0x49a1('0x7b')+_0x192b2f);}_0x346586[_0xea371b[_0x49a1('0x56')][_0x49a1('0x79')]]=_0xea371b[_0x49a1('0x56')]['from'];})['then'](function(){return db['OpenchannelAccount'][_0x49a1('0x54')]({'where':{'id':_0xea371b[_0x49a1('0x50')]['id']},'include':[{'model':db[_0x49a1('0x7c')],'as':_0x49a1('0x7d'),'include':[{'model':db[_0x49a1('0x6d')],'as':_0x49a1('0x7e'),'where':_0x346586,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x49a1('0x7f')],'as':_0x49a1('0x80')}]});})[_0x49a1('0x33')](handleEntityNotFound(_0x19f57f,null))['then'](function(_0x317ecc){if(_0x317ecc&&_0x317ecc['List']){_0x320af1[_0x49a1('0x81')]=_0x317ecc;_0x320af1[_0x49a1('0x82')]=_0x317ecc['Applications'];_0x320af1['list']=_0x317ecc[_0x49a1('0x7d')];_0x320af1[_0x49a1('0x82')]=_[_0x49a1('0x83')](_0x320af1[_0x49a1('0x82')],['priority'],[_0x49a1('0x84')]);if(_0x320af1['account'][_0x49a1('0x80')]){delete _0x320af1[_0x49a1('0x81')][_0x49a1('0x80')];}if(_0x320af1[_0x49a1('0x81')]['List']&&_0x320af1[_0x49a1('0x81')][_0x49a1('0x7d')][_0x49a1('0x7e')]['length']){return _0x320af1[_0x49a1('0x81')][_0x49a1('0x7d')]['Contacts'][0x0];}var _0x5b3e26=_[_0x49a1('0x85')](_0xea371b[_0x49a1('0x56')],{'firstName':_0xea371b[_0x49a1('0x56')][_0x49a1('0x76')],'ListId':_0x317ecc['ListId']});_0x5b3e26[_0xea371b[_0x49a1('0x56')][_0x49a1('0x79')]]=_0xea371b['body'][_0x49a1('0x76')];return db[_0x49a1('0x6d')][_0x49a1('0x55')](_0x5b3e26,{'fields':_0x24522d,'raw':!![]});}})[_0x49a1('0x33')](handleEntityNotFound(_0x19f57f,null))[_0x49a1('0x33')](function(_0x3f11d5){_0x320af1['contact']=_0x3f11d5;if(_0x3f11d5){var _0x105c52={'ContactId':_0x3f11d5['id'],'OpenchannelAccountId':_0xea371b[_0x49a1('0x50')]['id'],'from':(_0x3f11d5[_0x49a1('0x86')]||'')+'\x20'+(_0x3f11d5[_0x49a1('0x87')]||'')};var _0x258bc9={'OpenchannelAccountId':_0xea371b[_0x49a1('0x50')]['id'],'closed':![]};if(_0xea371b[_0x49a1('0x56')][_0x49a1('0x88')]){_0x258bc9[_0x49a1('0x88')]=_0xea371b[_0x49a1('0x56')][_0x49a1('0x88')];return db['OpenchannelInteraction'][_0x49a1('0x54')]({'where':_0x258bc9})['then'](function(_0x2394ce){if(_0x2394ce){return[_0x2394ce,![]];}_0x105c52[_0x49a1('0x88')]=_0xea371b['body'][_0x49a1('0x88')];_0x105c52['externalUrl']=_0xea371b[_0x49a1('0x56')][_0x49a1('0x89')];return db[_0x49a1('0x8a')]['create'](_0x105c52)[_0x49a1('0x33')](function(_0x336120){return[_0x336120,!![]];});});}else{_0x258bc9[_0x49a1('0x88')]=null;}_0x258bc9[_0x49a1('0x8b')]=_0x3f11d5['id'];return db['OpenchannelInteraction'][_0x49a1('0x54')]({'where':_0x258bc9})[_0x49a1('0x33')](function(_0x5f2c40){if(_0x5f2c40){return[_0x5f2c40,![]];}return db[_0x49a1('0x8a')][_0x49a1('0x55')](_0x105c52)[_0x49a1('0x33')](function(_0x2b3109){return[_0x2b3109,!![]];});});}})[_0x49a1('0x8c')](function(_0x186c4c,_0x6df067){if(_0x186c4c){_0x3d2e49=_0x6df067;if(!_0x6df067){var _0x540545={'from':(_0x320af1[_0x49a1('0x8d')][_0x49a1('0x86')]||'')+'\x20'+(_0x320af1[_0x49a1('0x8d')]['lastName']||'')};if(_0xea371b[_0x49a1('0x56')][_0x49a1('0x88')]&&_0xea371b['body'][_0x49a1('0x8e')]&&_0xea371b['body'][_0x49a1('0x88')]!=_0xea371b[_0x49a1('0x56')]['messageId']){_0x540545['threadId']=_0xea371b[_0x49a1('0x56')]['messageId'];}return _0x186c4c[_0x49a1('0x32')](_0x540545);}else{return _0x186c4c;}}})[_0x49a1('0x33')](function(_0x1c79b7){_0x320af1[_0x49a1('0x8f')]=_0x1c79b7[_0x49a1('0x59')]({'plain':!![]});_0x320af1['interaction'][_0x49a1('0x90')]=_0x3d2e49;if(_0x320af1[_0x49a1('0x8f')][_0x49a1('0x90')]){if(_0x320af1[_0x49a1('0x81')]['autoclose']){_0x320af1[_0x49a1('0x82')][_0x49a1('0x91')]({'id':0x0,'priority':_0x320af1[_0x49a1('0x82')][_0x49a1('0x42')]+0x1,'app':_0x49a1('0x92'),'appdata':_0x49a1('0x93'),'interval':_0x49a1('0x94')});}}return db['OpenchannelMessage'][_0x49a1('0x55')]({'body':_0xea371b[_0x49a1('0x56')]['body'],'OpenchannelAccountId':_0xea371b['params']['id'],'OpenchannelInteractionId':_0x1c79b7['id'],'direction':'in','ContactId':_0x320af1[_0x49a1('0x8d')]['id'],'AttachmentId':_0xea371b['body'][_0x49a1('0x95')]});})[_0x49a1('0x33')](function(_0x2cff19){_0x320af1[_0x49a1('0x24')]=_0x2cff19;if(!_0x320af1[_0x49a1('0x8f')][_0x49a1('0x96')])return;return db['User']['find']({'attributes':['id',_0x49a1('0x35')],'where':{'id':_0x320af1['interaction'][_0x49a1('0x96')]}});})[_0x49a1('0x33')](function(_0x2534f7){if(_0x2534f7){_0x320af1['applications'][_0x49a1('0x97')]({'id':0x0,'priority':0x0,'app':_0x49a1('0x98'),'appdata':_0x2534f7[_0x49a1('0x35')]+','+(_0x320af1[_0x49a1('0x81')][_0x49a1('0x99')]||0xa),'interval':_0x49a1('0x94')});}if(!_0x320af1[_0x49a1('0x8f')][_0x49a1('0x9a')])return;return db[_0x49a1('0x9b')][_0x49a1('0x54')]({'attributes':['id',_0x49a1('0x35')],'where':{'id':_0x320af1[_0x49a1('0x8f')]['queueId']}});})['then'](function(_0x561f8d){if(_0x561f8d){_0x320af1[_0x49a1('0x82')][_0x49a1('0x97')]({'id':0x0,'priority':0x1,'app':_0x49a1('0x9c'),'appdata':_0x561f8d[_0x49a1('0x35')]+','+(_0x320af1[_0x49a1('0x81')][_0x49a1('0x9d')]||0x12c),'interval':_0x49a1('0x94')});}return respondWithRpcPromise(_0x49a1('0x9e'),_0x49a1('0x9f'),_0x320af1);})[_0x49a1('0x33')](function(_0x254b17){respondWithRpcPromise(_0x49a1('0xa0'),_0x49a1('0xa0'),{'event':_0x49a1('0x6c'),'message':_0x254b17},client9002);return _0x254b17;})['then'](respondWithResult(_0x19f57f,null))[_0x49a1('0x25')](handleError(_0x19f57f,null));};exports[_0x49a1('0xa1')]=function(_0x14dfcf,_0x27c75e){var _0x32a72e=_0x14dfcf[_0x49a1('0x50')]['id'];var _0x1f018b=_0x14dfcf[_0x49a1('0x56')];var _0x4de410=0xc8;var _0x3aabc4=null;return db[_0x49a1('0xa2')][_0x49a1('0xa3')]({'isolationLevel':db[_0x49a1('0xa2')][_0x49a1('0xa4')]['ISOLATION_LEVELS'][_0x49a1('0xa5')]},function(_0x3dc550){return db[_0x49a1('0x3a')]['findOne']({'where':{'id':_0x32a72e},'transaction':_0x3dc550})[_0x49a1('0x33')](function(_0xf4936f){if(_0xf4936f){return db[_0x49a1('0x7f')][_0x49a1('0x5f')]({'where':{'OpenchannelAccountId':_0x32a72e},'transaction':_0x3dc550})[_0x49a1('0x33')](function(){var _0x21676b=_[_0x49a1('0x39')](_0x1f018b,function(_0x3faac0){_0x3faac0[_0x49a1('0x62')]=_0x32a72e;return _0x3faac0;});return db[_0x49a1('0x7f')][_0x49a1('0xa6')](_0x21676b,{'transaction':_0x3dc550});});}else{_0x4de410=0x194;_0x3aabc4=[];}});})['then'](function(){if(_0x4de410!==0x194){return db[_0x49a1('0x7f')][_0x49a1('0xa7')]({'where':{'OpenchannelAccountId':_0x32a72e},'order':_0x49a1('0xa8')})[_0x49a1('0x33')](function(_0x336352){_0x3aabc4=_0x336352;});}})[_0x49a1('0x25')](function(_0x29a46d){_0x4de410=0x1f4;logger['error'](_0x29a46d['stack']);if(_0x29a46d[_0x49a1('0x35')]){delete _0x29a46d[_0x49a1('0x35')];}_0x3aabc4=_0x29a46d;})[_0x49a1('0xa9')](function(){if(_0x3aabc4===null){_0x27c75e[_0x49a1('0x26')](_0x4de410);}else{if(_0x4de410===0x1f4){_0x27c75e['status'](_0x4de410)['send'](_0x3aabc4);}else{_0x27c75e[_0x49a1('0x27')](_0x4de410)[_0x49a1('0x28')](_0x3aabc4);}}});};exports[_0x49a1('0xaa')]=function(_0x47d52f,_0x3e7883,_0x1f30a7){var _0x42b5b0={};var _0x3ee84c={};var _0x19da18;var _0x3923eb;return db['OpenchannelAccount'][_0x49a1('0x65')]({'where':{'id':_0x47d52f[_0x49a1('0x50')]['id']}})[_0x49a1('0x33')](handleEntityNotFound(_0x3e7883,null))[_0x49a1('0x33')](function(_0x8849d4){if(_0x8849d4){_0x19da18=_0x8849d4;_0x3ee84c['model']=_[_0x49a1('0x52')](db[_0x49a1('0x7f')][_0x49a1('0x3b')]);_0x3ee84c['query']=_[_0x49a1('0x52')](_0x47d52f[_0x49a1('0x3e')]);_0x3ee84c[_0x49a1('0x46')]=_[_0x49a1('0x3f')](_0x3ee84c['model'],_0x3ee84c[_0x49a1('0x3e')]);_0x42b5b0[_0x49a1('0x41')]=_[_0x49a1('0x3f')](_0x3ee84c[_0x49a1('0x3d')],qs[_0x49a1('0x40')](_0x47d52f[_0x49a1('0x3e')][_0x49a1('0x40')]));_0x42b5b0[_0x49a1('0x41')]=_0x42b5b0[_0x49a1('0x41')]['length']?_0x42b5b0[_0x49a1('0x41')]:_0x3ee84c['model'];_0x42b5b0[_0x49a1('0xab')]=qs['sort'](_0x47d52f[_0x49a1('0x3e')][_0x49a1('0x45')]);_0x42b5b0[_0x49a1('0x47')]=qs['filters'](_['pick'](_0x47d52f[_0x49a1('0x3e')],_0x3ee84c[_0x49a1('0x46')]));if(_0x47d52f[_0x49a1('0x3e')][_0x49a1('0x49')]){_0x42b5b0['where']=_[_0x49a1('0x4a')](_0x42b5b0[_0x49a1('0x47')],{'$or':_[_0x49a1('0x39')](_0x42b5b0[_0x49a1('0x41')],function(_0x3f8512){var _0x499a42={};_0x499a42[_0x3f8512]={'$like':'%'+_0x47d52f[_0x49a1('0x3e')][_0x49a1('0x49')]+'%'};return _0x499a42;})});}_0x42b5b0=_[_0x49a1('0x4a')]({},_0x42b5b0,_0x47d52f['options']);return _0x19da18[_0x49a1('0xaa')](_0x42b5b0);}})[_0x49a1('0x33')](function(_0x3a3a9a){if(_0x3a3a9a){_0x3923eb=_0x3a3a9a[_0x49a1('0x42')];if(!_0x47d52f['query'][_0x49a1('0x43')](_0x49a1('0x44'))){_0x42b5b0['limit']=qs[_0x49a1('0x2c')](_0x47d52f[_0x49a1('0x3e')][_0x49a1('0x2c')]);_0x42b5b0[_0x49a1('0x29')]=qs[_0x49a1('0x29')](_0x47d52f[_0x49a1('0x3e')][_0x49a1('0x29')]);}return _0x19da18['getApplications'](_0x42b5b0);}})[_0x49a1('0x33')](function(_0x5860ad){if(_0x5860ad){return _0x5860ad?{'count':_0x3923eb,'rows':_0x5860ad}:null;}})[_0x49a1('0x33')](respondWithResult(_0x3e7883,null))[_0x49a1('0x25')](handleError(_0x3e7883,null));};exports['getInteractions']=function(_0x40e192,_0x479066,_0x320cf6){var _0x3edfd8={'raw':![],'where':{}};var _0x2d8a3b={};var _0x595e70={'count':0x0,'rows':[]};return db[_0x49a1('0x3a')][_0x49a1('0x65')]({'where':{'id':_0x40e192[_0x49a1('0x50')]['id']}})[_0x49a1('0x33')](handleEntityNotFound(_0x479066,null))[_0x49a1('0x33')](function(_0x3e7c99){if(_0x3e7c99){_0x2d8a3b[_0x49a1('0x3d')]=_['keys'](db['OpenchannelInteraction'][_0x49a1('0x3b')]);_0x2d8a3b[_0x49a1('0x3e')]=_[_0x49a1('0x52')](_0x40e192[_0x49a1('0x3e')]);_0x2d8a3b[_0x49a1('0x46')]=_[_0x49a1('0x3f')](_0x2d8a3b[_0x49a1('0x3d')],_0x2d8a3b['query']);_0x3edfd8['attributes']=_['intersection'](_0x2d8a3b[_0x49a1('0x3d')],qs[_0x49a1('0x40')](_0x40e192[_0x49a1('0x3e')][_0x49a1('0x40')]));_0x3edfd8[_0x49a1('0x41')]=_0x3edfd8[_0x49a1('0x41')][_0x49a1('0x42')]?_0x3edfd8[_0x49a1('0x41')]:_0x2d8a3b[_0x49a1('0x3d')];if(!_0x40e192['query']['hasOwnProperty'](_0x49a1('0x44'))){_0x3edfd8[_0x49a1('0x2c')]=qs[_0x49a1('0x2c')](_0x40e192[_0x49a1('0x3e')]['limit']);_0x3edfd8[_0x49a1('0x29')]=qs[_0x49a1('0x29')](_0x40e192[_0x49a1('0x3e')][_0x49a1('0x29')]);}_0x3edfd8[_0x49a1('0xab')]=qs[_0x49a1('0x45')](_0x40e192[_0x49a1('0x3e')]['sort']);_0x3edfd8[_0x49a1('0x47')]=qs[_0x49a1('0x46')](_['pick'](_0x40e192[_0x49a1('0x3e')],_0x2d8a3b[_0x49a1('0x46')]));_0x3edfd8[_0x49a1('0x47')][_0x49a1('0x62')]=_0x3e7c99['id'];if(_0x40e192[_0x49a1('0x3e')][_0x49a1('0x49')]){_0x3edfd8[_0x49a1('0x47')]=_[_0x49a1('0x4a')](_0x3edfd8[_0x49a1('0x47')],{'$or':_[_0x49a1('0x39')](_0x3edfd8[_0x49a1('0x41')],function(_0x48bf1a){var _0x1c325c={};_0x1c325c[_0x48bf1a]={'$like':'%'+_0x40e192[_0x49a1('0x3e')][_0x49a1('0x49')]+'%'};return _0x1c325c;})});}_0x3edfd8=_[_0x49a1('0x4a')]({},_0x3edfd8,_0x40e192[_0x49a1('0x53')]);return db[_0x49a1('0x8a')]['count']({'where':_0x3edfd8[_0x49a1('0x47')]})[_0x49a1('0x33')](function(_0x3d76f1){_0x595e70[_0x49a1('0x2b')]=_0x3d76f1;if(_0x40e192[_0x49a1('0x3e')][_0x49a1('0x4b')]){_0x3edfd8[_0x49a1('0x4c')]=[{'model':db[_0x49a1('0x6d')],'as':_0x49a1('0xac'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x49a1('0x35'),_0x49a1('0xad'),_0x49a1('0xae')],'required':![]},{'model':db[_0x49a1('0xaf')],'as':'Tags','attributes':['id','name',_0x49a1('0xb0')],'where':_0x40e192['query'][_0x49a1('0xb1')]?{'id':_0x40e192[_0x49a1('0x3e')][_0x49a1('0xb1')]}:undefined,'required':_0x40e192[_0x49a1('0x3e')][_0x49a1('0xb1')]?!![]:![]}];}return db[_0x49a1('0x8a')][_0x49a1('0x4d')](_0x3edfd8);})[_0x49a1('0x33')](function(_0x1cdc0a){_0x595e70['rows']=_0x1cdc0a;return _0x595e70;});}})['then'](respondWithFilteredResult(_0x479066,_0x3edfd8))[_0x49a1('0x25')](handleError(_0x479066,null));};exports['addAgents']=function(_0xcb8a15,_0x133bf9,_0x30d791){return db['OpenchannelAccount'][_0x49a1('0x54')]({'where':{'id':_0xcb8a15[_0x49a1('0x50')]['id']}})[_0x49a1('0x33')](handleEntityNotFound(_0x133bf9,null))[_0x49a1('0x33')](function(_0x3176d3){if(_0x3176d3){return _0x3176d3['addAgents'](_0xcb8a15[_0x49a1('0x56')][_0x49a1('0x6b')],_['omit'](_0xcb8a15[_0x49a1('0x56')],[_0x49a1('0x6b'),'id'])||{})[_0x49a1('0x8c')](function(_0x216901){for(var _0x58a024=0x0;_0x58a024<_0xcb8a15[_0x49a1('0x56')]['ids'][_0x49a1('0x42')];_0x58a024+=0x1){socket['emit'](_0x49a1('0xb2'),{'UserId':Number(_0xcb8a15['body'][_0x49a1('0x6b')][_0x58a024]),'OpenchannelAccountId':Number(_0xcb8a15['params']['id'])});}return _0x216901;});}})[_0x49a1('0x33')](respondWithResult(_0x133bf9,null))['catch'](handleError(_0x133bf9,null));};exports[_0x49a1('0xb3')]=function(_0x32c6d2,_0x1ecd7e,_0x1b8f6e){return db[_0x49a1('0x3a')][_0x49a1('0x54')]({'where':{'id':_0x32c6d2[_0x49a1('0x50')]['id']}})[_0x49a1('0x33')](handleEntityNotFound(_0x1ecd7e,null))[_0x49a1('0x33')](function(_0x4b067f){if(_0x4b067f){return _0x4b067f['removeAgents'](_0x32c6d2[_0x49a1('0x3e')][_0x49a1('0x6b')])['then'](function(){if(_[_0x49a1('0xb4')](_0x32c6d2['query']['ids'])){for(var _0x529130=0x0;_0x529130<_0x32c6d2[_0x49a1('0x3e')][_0x49a1('0x6b')][_0x49a1('0x42')];_0x529130+=0x1){socket[_0x49a1('0xb5')](_0x49a1('0xb6'),{'UserId':Number(_0x32c6d2[_0x49a1('0x3e')]['ids'][_0x529130]),'OpenchannelAccountId':Number(_0x32c6d2[_0x49a1('0x50')]['id'])});}}else{socket[_0x49a1('0xb5')]('userOpenchannelAccount:remove',{'UserId':Number(_0x32c6d2[_0x49a1('0x3e')]['ids']),'OpenchannelAccountId':Number(_0x32c6d2[_0x49a1('0x50')]['id'])});}});}})[_0x49a1('0x33')](respondWithStatusCode(_0x1ecd7e,null))[_0x49a1('0x25')](handleError(_0x1ecd7e,null));};exports['getAgents']=function(_0x16642a,_0x6843e,_0x4f9371){var _0x388874={};var _0xcb272={};var _0x439bd0;var _0x5a3f1e;return db[_0x49a1('0x3a')][_0x49a1('0x65')]({'where':{'id':_0x16642a['params']['id']}})[_0x49a1('0x33')](handleEntityNotFound(_0x6843e,null))[_0x49a1('0x33')](function(_0x57b97c){if(_0x57b97c){_0x439bd0=_0x57b97c;_0xcb272[_0x49a1('0x3d')]=_[_0x49a1('0x52')](db[_0x49a1('0xb7')][_0x49a1('0x3b')]);_0xcb272['query']=_[_0x49a1('0x52')](_0x16642a['query']);_0xcb272[_0x49a1('0x46')]=_[_0x49a1('0x3f')](_0xcb272[_0x49a1('0x3d')],_0xcb272[_0x49a1('0x3e')]);_0x388874[_0x49a1('0x41')]=_['intersection'](_0xcb272['model'],qs[_0x49a1('0x40')](_0x16642a[_0x49a1('0x3e')][_0x49a1('0x40')]));_0x388874[_0x49a1('0x41')]=_0x388874[_0x49a1('0x41')]['length']?_0x388874[_0x49a1('0x41')]:_0xcb272[_0x49a1('0x3d')];_0x388874[_0x49a1('0xab')]=qs['sort'](_0x16642a[_0x49a1('0x3e')][_0x49a1('0x45')]);_0x388874[_0x49a1('0x47')]=qs[_0x49a1('0x46')](_['pick'](_0x16642a[_0x49a1('0x3e')],_0xcb272['filters']));if(_0x16642a[_0x49a1('0x3e')][_0x49a1('0x49')]){_0x388874['where']=_[_0x49a1('0x4a')](_0x388874[_0x49a1('0x47')],{'$or':_['map'](_0x388874['attributes'],function(_0x5801d1){var _0x433296={};_0x433296[_0x5801d1]={'$like':'%'+_0x16642a[_0x49a1('0x3e')]['filter']+'%'};return _0x433296;})});}_0x388874=_[_0x49a1('0x4a')]({},_0x388874,_0x16642a[_0x49a1('0x53')]);return _0x439bd0['getAgents'](_0x388874);}})[_0x49a1('0x33')](function(_0x1e1d6d){if(_0x1e1d6d){_0x5a3f1e=_0x1e1d6d['length'];if(!_0x16642a[_0x49a1('0x3e')][_0x49a1('0x43')](_0x49a1('0x44'))){_0x388874['limit']=qs[_0x49a1('0x2c')](_0x16642a[_0x49a1('0x3e')][_0x49a1('0x2c')]);_0x388874[_0x49a1('0x29')]=qs[_0x49a1('0x29')](_0x16642a[_0x49a1('0x3e')]['offset']);}return _0x439bd0[_0x49a1('0xb8')](_0x388874);}})['then'](function(_0x475b2c){if(_0x475b2c){return _0x475b2c?{'count':_0x5a3f1e,'rows':_0x475b2c}:null;}})[_0x49a1('0x33')](respondWithResult(_0x6843e,null))[_0x49a1('0x25')](handleError(_0x6843e,null));};exports[_0x49a1('0x36')]=function(_0x4789c2,_0x43f4dc,_0x22445f){var _0x4b7748,_0x38f21b,_0xa05cc;if(_['isNil'](_0x4789c2['body'][_0x49a1('0x56')])||_0x4789c2[_0x49a1('0x56')]['body']===''){throw new db[(_0x49a1('0x6e'))]['ValidationError'](_0x49a1('0x78'));}if(_[_0x49a1('0x75')](_0x4789c2[_0x49a1('0x56')]['to'])){}_0x4b7748=_0x4789c2[_0x49a1('0x56')]['to'];return db['OpenchannelAccount']['findOne']({'where':{'id':_0x4789c2[_0x49a1('0x50')]['id']}})[_0x49a1('0x33')](handleEntityNotFound(_0x43f4dc,null))[_0x49a1('0x33')](function(_0x44befc){if(_0x44befc){return db['OpenchannelAccount'][_0x49a1('0x54')]({'where':{'id':_0x44befc['id']},'include':[{'model':db[_0x49a1('0x7c')],'as':_0x49a1('0x7d'),'include':[{'model':db[_0x49a1('0x6d')],'as':_0x49a1('0x7e'),'where':{[_0x44befc[_0x49a1('0x79')]]:_0x4b7748},'limit':0x1,'order':[[_0x49a1('0x73'),_0x49a1('0xb9')]]}]}]})[_0x49a1('0x33')](handleEntityNotFound(_0x43f4dc,null))['then'](function(_0x4cacde){if(_0x4cacde&&_0x4cacde[_0x49a1('0x7d')]){_0x38f21b=_0x4cacde['get']({'plain':!![]});if(_0x38f21b['List']&&_0x38f21b[_0x49a1('0x7d')][_0x49a1('0x7e')]['length']){return _0x38f21b[_0x49a1('0x7d')]['Contacts'][0x0];}return db[_0x49a1('0x6d')]['create'](_[_0x49a1('0x85')](_0x4789c2[_0x49a1('0x56')],{'firstName':_0x4b7748,[_0x4cacde['mapKey']]:_0x4b7748,'phone':_0x4b7748,'ListId':_0x38f21b[_0x49a1('0xba')]}));}})[_0x49a1('0x33')](handleEntityNotFound(_0x43f4dc,null))[_0x49a1('0x33')](function(_0x35ca33){if(_0x35ca33){_0xa05cc=_0x35ca33;return db[_0x49a1('0x8a')][_0x49a1('0x54')]({'where':{'ContactId':_0xa05cc['id'],'closed':![],'OpenchannelAccountId':_0x38f21b['id']}})[_0x49a1('0x33')](function(_0x168391){if(_0x168391){return[_0x168391,![]];}return db[_0x49a1('0x8a')][_0x49a1('0x55')]({'UserId':_0x4789c2[_0x49a1('0x57')]['id'],'ContactId':_0xa05cc['id'],'OpenchannelAccountId':_0x38f21b['id'],'lastMsgDirection':_0x49a1('0xbb'),'firstMsgDirection':_0x49a1('0xbb'),'Messages':[_[_0x49a1('0x4a')](_0x4789c2[_0x49a1('0x56')],{'read':![],'body':_0x4789c2[_0x49a1('0x56')][_0x49a1('0x56')],'OpenchannelAccountId':_0x38f21b['id'],'UserId':_0x4789c2[_0x49a1('0x57')]['id'],'ContactId':_0xa05cc['id']})]},{'include':[{'model':db[_0x49a1('0xbc')],'as':_0x49a1('0xbd')}]})[_0x49a1('0x33')](function(_0x3b2ad4){return[_0x3b2ad4,!![]];});});}})['spread'](function(_0xe9cf41,_0x1f570d){if(_0x1f570d){return _0xe9cf41;}return db[_0x49a1('0xbc')][_0x49a1('0x55')](_[_0x49a1('0x4a')](_0x4789c2[_0x49a1('0x56')],{'read':![],'body':_0x4789c2[_0x49a1('0x56')][_0x49a1('0x56')],'OpenchannelAccountId':_0x38f21b['id'],'OpenchannelInteractionId':_0xe9cf41['id'],'UserId':_0x4789c2[_0x49a1('0x57')]['id'],'ContactId':_0xa05cc['id']}))[_0x49a1('0x33')](function(_0x2e0190){_0xe9cf41[_0x49a1('0xbe')][_0x49a1('0xbd')]=[];_0xe9cf41['dataValues']['Messages'][_0x49a1('0x91')](_0x2e0190[_0x49a1('0xbe')]);return _0xe9cf41;});});}})['then'](respondWithResult(_0x43f4dc,null))[_0x49a1('0x25')](handleError(_0x43f4dc,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index a5c5dc3..e717e8c 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 _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 +var _0x9c44=['save','update','remove','emit','hasOwnProperty','hook','exports','OpenchannelAccount','setMaxListeners'];(function(_0x227748,_0x676867){var _0x298a81=function(_0x5c42c5){while(--_0x5c42c5){_0x227748['push'](_0x227748['shift']());}};_0x298a81(++_0x676867);}(_0x9c44,0x178));var _0x49c4=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x9c44[_0xb0f7c3];return _0x28ea68;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require('../../mysqldb')['db'][_0x49c4('0x0')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x49c4('0x1')](0x0);var events={'afterCreate':_0x49c4('0x2'),'afterUpdate':_0x49c4('0x3'),'afterDestroy':_0x49c4('0x4')};function emitEvent(_0x2ad237){return function(_0x4e0313,_0x4941f1,_0x41a183){OpenchannelAccountEvents['emit'](_0x2ad237+':'+_0x4e0313['id'],_0x4e0313);OpenchannelAccountEvents[_0x49c4('0x5')](_0x2ad237,_0x4e0313);_0x41a183(null);};}for(var e in events){if(events[_0x49c4('0x6')](e)){var event=events[e];OpenchannelAccount[_0x49c4('0x7')](e,emitEvent(event));}}module[_0x49c4('0x8')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index d8d881e..cb01e64 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(_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 +var _0xa9e0=['../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x4a8a1d,_0x43d11a){var _0x167dc4=function(_0x2eb86a){while(--_0x2eb86a){_0x4a8a1d['push'](_0x4a8a1d['shift']());}};_0x167dc4(++_0x43d11a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'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 aafc285..b276950 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 _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 +var _0x131e=['info','request\x20sent','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','./openchannelAccount.socket','request','then'];(function(_0x22139d,_0x1dfd76){var _0x11c7cd=function(_0x240171){while(--_0x240171){_0x22139d['push'](_0x22139d['shift']());}};_0x11c7cd(++_0x1dfd76);}(_0x131e,0x1ec));var _0xe131=function(_0x2071e7,_0x37ce5d){_0x2071e7=_0x2071e7-0x0;var _0x2b4442=_0x131e[_0x2071e7];return _0x2b4442;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xe131('0x0'));var rs=require(_0xe131('0x1'));var fs=require('fs');var Redis=require(_0xe131('0x2'));var db=require(_0xe131('0x3'))['db'];var utils=require(_0xe131('0x4'));var logger=require(_0xe131('0x5'))('rpc');var config=require(_0xe131('0x6'));var jayson=require(_0xe131('0x7'));var client=jayson[_0xe131('0x8')][_0xe131('0x9')]({'port':0x232a});config[_0xe131('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe131('0xa')]));require(_0xe131('0xb'))['register'](socket);function respondWithRpcPromise(_0xfdbf4c,_0x4e126a,_0x149011){return new BPromise(function(_0x18f749,_0x5ae4c1){return client[_0xe131('0xc')](_0xfdbf4c,_0x149011)[_0xe131('0xd')](function(_0x2438af){logger[_0xe131('0xe')]('OpenchannelAccount,\x20%s,\x20%s',_0x4e126a,'request\x20sent');logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x4e126a,_0xe131('0xf'),JSON[_0xe131('0x10')](_0x2438af));if(_0x2438af[_0xe131('0x11')]){if(_0x2438af[_0xe131('0x11')][_0xe131('0x12')]===0x1f4){logger[_0xe131('0x11')](_0xe131('0x13'),_0x4e126a,_0x2438af[_0xe131('0x11')][_0xe131('0x14')]);return _0x5ae4c1(_0x2438af['error']['message']);}logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x4e126a,_0x2438af['error'][_0xe131('0x14')]);return _0x18f749(_0x2438af[_0xe131('0x11')][_0xe131('0x14')]);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x4e126a,_0xe131('0xf'));_0x18f749(_0x2438af[_0xe131('0x15')][_0xe131('0x14')]);}})[_0xe131('0x16')](function(_0x317200){logger[_0xe131('0x11')]('OpenchannelAccount,\x20%s,\x20%s',_0x4e126a,_0x317200);_0x5ae4c1(_0x317200);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index c19b37a..78de248 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 _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 +var _0xa769=['remove','update','removeListener','length','openchannelAccount:','./openchannelAccount.events'];(function(_0x18ba37,_0x451ca4){var _0x4105d8=function(_0x13e7e8){while(--_0x13e7e8){_0x18ba37['push'](_0x18ba37['shift']());}};_0x4105d8(++_0x451ca4);}(_0xa769,0xfb));var _0x9a76=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa769[_0x4cf98e];return _0x1623ac;};'use strict';var OpenchannelAccountEvents=require(_0x9a76('0x0'));var events=['save',_0x9a76('0x1'),_0x9a76('0x2')];function createListener(_0x2d47cb,_0x488ec5){return function(_0x449889){_0x488ec5['emit'](_0x2d47cb,_0x449889);};}function removeListener(_0x578f4a,_0x272ed2){return function(){OpenchannelAccountEvents[_0x9a76('0x3')](_0x578f4a,_0x272ed2);};}exports['register']=function(_0x24761d){for(var _0x29af51=0x0,_0x39b607=events[_0x9a76('0x4')];_0x29af51<_0x39b607;_0x29af51++){var _0x1556d6=events[_0x29af51];var _0xe396ab=createListener(_0x9a76('0x5')+_0x1556d6,_0x24761d);OpenchannelAccountEvents['on'](_0x1556d6,_0xe396ab);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 4c29c80..3cf8c78 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 _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 +var _0x89c8=['delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','index','get','/:id','isAuthenticated','post','create','put','update'];(function(_0xa6fc1e,_0x32ca10){var _0x4965e1=function(_0x41025a){while(--_0x41025a){_0xa6fc1e['push'](_0xa6fc1e['shift']());}};_0x4965e1(++_0x32ca10);}(_0x89c8,0x159));var _0x889c=function(_0x5a84cb,_0x15f0d4){_0x5a84cb=_0x5a84cb-0x0;var _0x4ab94a=_0x89c8[_0x5a84cb];return _0x4ab94a;};'use strict';var multer=require(_0x889c('0x0'));var util=require('util');var path=require(_0x889c('0x1'));var timeout=require(_0x889c('0x2'));var express=require('express');var router=express[_0x889c('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x889c('0x4'));var interaction=require(_0x889c('0x5'));var config=require(_0x889c('0x6'));var controller=require(_0x889c('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x889c('0x8')]);router[_0x889c('0x9')](_0x889c('0xa'),auth[_0x889c('0xb')](),controller['show']);router[_0x889c('0xc')]('/',auth[_0x889c('0xb')](),controller[_0x889c('0xd')]);router[_0x889c('0xe')](_0x889c('0xa'),auth['isAuthenticated'](),controller[_0x889c('0xf')]);router[_0x889c('0x10')](_0x889c('0xa'),auth[_0x889c('0xb')](),controller[_0x889c('0x11')]);module[_0x889c('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 918a5c9..73ca49c 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 _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 +var _0x3a8b=['STRING','noop','TEXT','sequelize','exports'];(function(_0x5d0f58,_0x324fc9){var _0x3a6e83=function(_0x207aa2){while(--_0x207aa2){_0x5d0f58['push'](_0x5d0f58['shift']());}};_0x3a6e83(++_0x324fc9);}(_0x3a8b,0x9e));var _0xb3a8=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x3a8b[_0x4c12ec];return _0x3ae42c;};'use strict';var Sequelize=require(_0xb3a8('0x0'));module[_0xb3a8('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xb3a8('0x2')],'allowNull':![],'defaultValue':_0xb3a8('0x3')},'appdata':{'type':Sequelize[_0xb3a8('0x4')]()},'description':{'type':Sequelize[_0xb3a8('0x2')]},'interval':{'type':Sequelize[_0xb3a8('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 503e324..43e187c 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 _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 +var _0x73e9=['send','index','map','OpenchannelApplication','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','findAll','rows','catch','show','include','options','create','body','find','params','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','stack','name'];(function(_0x459f4f,_0x12f39b){var _0x150c68=function(_0x2cfa5c){while(--_0x2cfa5c){_0x459f4f['push'](_0x459f4f['shift']());}};_0x150c68(++_0x12f39b);}(_0x73e9,0x19f));var _0x973e=function(_0x571f36,_0x58551e){_0x571f36=_0x571f36-0x0;var _0x12724f=_0x73e9[_0x571f36];return _0x12724f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x973e('0x0'));var zipdir=require(_0x973e('0x1'));var jsonpatch=require(_0x973e('0x2'));var rp=require('request-promise');var moment=require(_0x973e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x973e('0x4'));var util=require(_0x973e('0x5'));var path=require(_0x973e('0x6'));var sox=require(_0x973e('0x7'));var csv=require(_0x973e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x973e('0x9'));var _=require('lodash');var squel=require(_0x973e('0xa'));var crypto=require('crypto');var jsforce=require(_0x973e('0xb'));var deskjs=require(_0x973e('0xc'));var toCsv=require(_0x973e('0x8'));var querystring=require(_0x973e('0xd'));var Papa=require(_0x973e('0xe'));var Redis=require(_0x973e('0xf'));var authService=require(_0x973e('0x10'));var qs=require(_0x973e('0x11'));var as=require(_0x973e('0x12'));var hardwareService=require(_0x973e('0x13'));var logger=require(_0x973e('0x14'))(_0x973e('0x15'));var utils=require(_0x973e('0x16'));var config=require(_0x973e('0x17'));var licenseUtil=require(_0x973e('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c4832,_0x7677b3){_0x7677b3=_0x7677b3||0xcc;return function(_0x761426){if(_0x761426){return _0x2c4832['sendStatus'](_0x7677b3);}return _0x2c4832[_0x973e('0x19')](_0x7677b3)[_0x973e('0x1a')]();};}function respondWithResult(_0x21912a,_0x2215ee){_0x2215ee=_0x2215ee||0xc8;return function(_0x339ac0){if(_0x339ac0){return _0x21912a[_0x973e('0x19')](_0x2215ee)[_0x973e('0x1b')](_0x339ac0);}};}function respondWithFilteredResult(_0x8aac92,_0x2138a5){return function(_0x163bc1){if(_0x163bc1){var _0x147f4d=typeof _0x2138a5[_0x973e('0x1c')]==='undefined'&&typeof _0x2138a5[_0x973e('0x1d')]===_0x973e('0x1e');var _0x3fe846=_0x163bc1[_0x973e('0x1f')];var _0x3c6598=_0x147f4d?0x0:_0x2138a5[_0x973e('0x1c')];var _0x1169f3=_0x147f4d?_0x163bc1['count']:_0x2138a5[_0x973e('0x1c')]+_0x2138a5[_0x973e('0x1d')];var _0x3e38db;if(_0x1169f3>=_0x3fe846){_0x1169f3=_0x3fe846;_0x3e38db=0xc8;}else{_0x3e38db=0xce;}_0x8aac92[_0x973e('0x19')](_0x3e38db);return _0x8aac92[_0x973e('0x20')]('Content-Range',_0x3c6598+'-'+_0x1169f3+'/'+_0x3fe846)[_0x973e('0x1b')](_0x163bc1);}return null;};}function patchUpdates(_0x399e75){return function(_0x4df2a){try{jsonpatch[_0x973e('0x21')](_0x4df2a,_0x399e75,!![]);}catch(_0x2404be){return BPromise[_0x973e('0x22')](_0x2404be);}return _0x4df2a[_0x973e('0x23')]();};}function saveUpdates(_0x498ac5,_0x41f441){return function(_0x14ab76){if(_0x14ab76){return _0x14ab76[_0x973e('0x24')](_0x498ac5)[_0x973e('0x25')](function(_0x56e59f){return _0x56e59f;});}return null;};}function removeEntity(_0x1193b1,_0x19c92d){return function(_0x3c455f){if(_0x3c455f){return _0x3c455f[_0x973e('0x26')]()['then'](function(){_0x1193b1[_0x973e('0x19')](0xcc)[_0x973e('0x1a')]();});}};}function handleEntityNotFound(_0x53352d,_0x5dd4f9){return function(_0x39ff74){if(!_0x39ff74){_0x53352d['sendStatus'](0x194);}return _0x39ff74;};}function handleError(_0x476084,_0xe4194f){_0xe4194f=_0xe4194f||0x1f4;return function(_0x1079d0){logger['error'](_0x1079d0[_0x973e('0x27')]);if(_0x1079d0[_0x973e('0x28')]){delete _0x1079d0[_0x973e('0x28')];}_0x476084[_0x973e('0x19')](_0xe4194f)[_0x973e('0x29')](_0x1079d0);};}exports[_0x973e('0x2a')]=function(_0x40c6de,_0x40f95d){var _0x49aa70={},_0x26dc28={},_0x516a12={'count':0x0,'rows':[]};var _0x47d379=_[_0x973e('0x2b')](db[_0x973e('0x2c')][_0x973e('0x2d')],function(_0x3b30e8){return{'name':_0x3b30e8[_0x973e('0x2e')],'type':_0x3b30e8[_0x973e('0x2f')][_0x973e('0x30')]};});_0x26dc28[_0x973e('0x31')]=_[_0x973e('0x2b')](_0x47d379,_0x973e('0x28'));_0x26dc28['query']=_[_0x973e('0x32')](_0x40c6de[_0x973e('0x33')]);_0x26dc28[_0x973e('0x34')]=_[_0x973e('0x35')](_0x26dc28[_0x973e('0x31')],_0x26dc28[_0x973e('0x33')]);_0x49aa70[_0x973e('0x36')]=_[_0x973e('0x35')](_0x26dc28[_0x973e('0x31')],qs[_0x973e('0x37')](_0x40c6de[_0x973e('0x33')][_0x973e('0x37')]));_0x49aa70[_0x973e('0x36')]=_0x49aa70[_0x973e('0x36')][_0x973e('0x38')]?_0x49aa70[_0x973e('0x36')]:_0x26dc28[_0x973e('0x31')];if(!_0x40c6de[_0x973e('0x33')][_0x973e('0x39')](_0x973e('0x3a'))){_0x49aa70[_0x973e('0x1d')]=qs[_0x973e('0x1d')](_0x40c6de[_0x973e('0x33')][_0x973e('0x1d')]);_0x49aa70[_0x973e('0x1c')]=qs[_0x973e('0x1c')](_0x40c6de[_0x973e('0x33')][_0x973e('0x1c')]);}_0x49aa70[_0x973e('0x3b')]=qs[_0x973e('0x3c')](_0x40c6de[_0x973e('0x33')][_0x973e('0x3c')]);_0x49aa70[_0x973e('0x3d')]=qs[_0x973e('0x34')](_[_0x973e('0x3e')](_0x40c6de['query'],_0x26dc28[_0x973e('0x34')]),_0x47d379);if(_0x40c6de[_0x973e('0x33')][_0x973e('0x3f')]){_0x49aa70[_0x973e('0x3d')]=_[_0x973e('0x40')](_0x49aa70[_0x973e('0x3d')],{'$or':_[_0x973e('0x2b')](_0x47d379,function(_0x39767c){if(_0x39767c[_0x973e('0x2f')]!=='VIRTUAL'){var _0x4689ae={};_0x4689ae[_0x39767c['name']]={'$like':'%'+_0x40c6de['query'][_0x973e('0x3f')]+'%'};return _0x4689ae;}})});}_0x49aa70=_[_0x973e('0x40')]({},_0x49aa70,_0x40c6de['options']);var _0x3e7c4a={'where':_0x49aa70[_0x973e('0x3d')]};return db[_0x973e('0x2c')][_0x973e('0x1f')](_0x3e7c4a)['then'](function(_0x3c71f9){_0x516a12['count']=_0x3c71f9;if(_0x40c6de[_0x973e('0x33')][_0x973e('0x41')]){_0x49aa70['include']=[{'all':!![]}];}return db[_0x973e('0x2c')][_0x973e('0x42')](_0x49aa70);})[_0x973e('0x25')](function(_0x22d812){_0x516a12[_0x973e('0x43')]=_0x22d812;return _0x516a12;})[_0x973e('0x25')](respondWithFilteredResult(_0x40f95d,_0x49aa70))[_0x973e('0x44')](handleError(_0x40f95d,null));};exports[_0x973e('0x45')]=function(_0x41711d,_0x5931ca){var _0x1eda0e={'raw':!![],'where':{'id':_0x41711d['params']['id']}},_0x2a1cac={};_0x2a1cac[_0x973e('0x31')]=_[_0x973e('0x32')](db[_0x973e('0x2c')][_0x973e('0x2d')]);_0x2a1cac['query']=_[_0x973e('0x32')](_0x41711d[_0x973e('0x33')]);_0x2a1cac['filters']=_['intersection'](_0x2a1cac['model'],_0x2a1cac['query']);_0x1eda0e['attributes']=_[_0x973e('0x35')](_0x2a1cac['model'],qs[_0x973e('0x37')](_0x41711d['query']['fields']));_0x1eda0e[_0x973e('0x36')]=_0x1eda0e[_0x973e('0x36')][_0x973e('0x38')]?_0x1eda0e[_0x973e('0x36')]:_0x2a1cac[_0x973e('0x31')];if(_0x41711d[_0x973e('0x33')][_0x973e('0x41')]){_0x1eda0e[_0x973e('0x46')]=[{'all':!![]}];}_0x1eda0e=_[_0x973e('0x40')]({},_0x1eda0e,_0x41711d[_0x973e('0x47')]);return db[_0x973e('0x2c')]['find'](_0x1eda0e)[_0x973e('0x25')](handleEntityNotFound(_0x5931ca,null))['then'](respondWithResult(_0x5931ca,null))[_0x973e('0x44')](handleError(_0x5931ca,null));};exports['create']=function(_0x5ccd54,_0x577e18){return db[_0x973e('0x2c')][_0x973e('0x48')](_0x5ccd54[_0x973e('0x49')],{})[_0x973e('0x25')](respondWithResult(_0x577e18,0xc9))[_0x973e('0x44')](handleError(_0x577e18,null));};exports[_0x973e('0x24')]=function(_0x3670bc,_0x405b25){if(_0x3670bc[_0x973e('0x49')]['id']){delete _0x3670bc[_0x973e('0x49')]['id'];}return db[_0x973e('0x2c')][_0x973e('0x4a')]({'where':{'id':_0x3670bc['params']['id']}})[_0x973e('0x25')](handleEntityNotFound(_0x405b25,null))[_0x973e('0x25')](saveUpdates(_0x3670bc['body'],null))[_0x973e('0x25')](respondWithResult(_0x405b25,null))['catch'](handleError(_0x405b25,null));};exports[_0x973e('0x26')]=function(_0x591c51,_0x4f63fd){return db['OpenchannelApplication'][_0x973e('0x4a')]({'where':{'id':_0x591c51[_0x973e('0x4b')]['id']}})[_0x973e('0x25')](handleEntityNotFound(_0x4f63fd,null))['then'](removeEntity(_0x4f63fd,null))[_0x973e('0x44')](handleError(_0x4f63fd,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 2a9c1ad..57a3765 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 _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 +var _0xea99=['api','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','lodash','util','../../config/logger'];(function(_0x1183d8,_0x2bfe32){var _0xe46db9=function(_0x383063){while(--_0x383063){_0x1183d8['push'](_0x1183d8['shift']());}};_0xe46db9(++_0x2bfe32);}(_0xea99,0x105));var _0x9ea9=function(_0x5b1b81,_0x5d8aa5){_0x5b1b81=_0x5b1b81-0x0;var _0x3596c6=_0xea99[_0x5b1b81];return _0x3596c6;};'use strict';var _=require(_0x9ea9('0x0'));var util=require(_0x9ea9('0x1'));var logger=require(_0x9ea9('0x2'))(_0x9ea9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9ea9('0x4'));var attributes=require(_0x9ea9('0x5'));module[_0x9ea9('0x6')]=function(_0x462f84,_0x185cff){return _0x462f84[_0x9ea9('0x7')](_0x9ea9('0x8'),attributes,{'tableName':_0x9ea9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9ea9('0xa'),'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 e12ecaf..eac8e42 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 _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 +var _0x2821=['http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateOpenchannelApplication','OpenchannelApplication','body','options','where','attributes','limit','debug','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2821,0x1f4));var _0x1282=function(_0x116de3,_0x476ef8){_0x116de3=_0x116de3-0x0;var _0xbe4997=_0x2821[_0x116de3];return _0xbe4997;};'use strict';var _=require('lodash');var util=require(_0x1282('0x0'));var moment=require(_0x1282('0x1'));var BPromise=require(_0x1282('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1282('0x3'));var db=require(_0x1282('0x4'))['db'];var utils=require(_0x1282('0x5'));var logger=require(_0x1282('0x6'))(_0x1282('0x7'));var config=require(_0x1282('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1282('0x9')][_0x1282('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10ca2c,_0x349d6d,_0x1e484b){return new BPromise(function(_0x5ab6ed,_0x102022){return client[_0x1282('0xb')](_0x10ca2c,_0x1e484b)[_0x1282('0xc')](function(_0x581191){logger[_0x1282('0xd')](_0x1282('0xe'),_0x349d6d,_0x1282('0xf'));logger['debug'](_0x1282('0x10'),_0x349d6d,'request\x20sent',JSON[_0x1282('0x11')](_0x581191));if(_0x581191['error']){if(_0x581191[_0x1282('0x12')][_0x1282('0x13')]===0x1f4){logger[_0x1282('0x12')](_0x1282('0xe'),_0x349d6d,_0x581191[_0x1282('0x12')]['message']);return _0x102022(_0x581191[_0x1282('0x12')][_0x1282('0x14')]);}logger[_0x1282('0x12')](_0x1282('0xe'),_0x349d6d,_0x581191[_0x1282('0x12')][_0x1282('0x14')]);return _0x5ab6ed(_0x581191[_0x1282('0x12')][_0x1282('0x14')]);}else{logger[_0x1282('0xd')](_0x1282('0xe'),_0x349d6d,_0x1282('0xf'));_0x5ab6ed(_0x581191['result'][_0x1282('0x14')]);}})[_0x1282('0x15')](function(_0x1f90a6){logger['error'](_0x1282('0xe'),_0x349d6d,_0x1f90a6);_0x102022(_0x1f90a6);});});}exports[_0x1282('0x16')]=function(_0x2edc6e){var _0x3f480a=this;return new Promise(function(_0x3f3a3c,_0x127037){return db[_0x1282('0x17')]['update'](_0x2edc6e[_0x1282('0x18')],{'raw':_0x2edc6e[_0x1282('0x19')]?_0x2edc6e[_0x1282('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2edc6e[_0x1282('0x19')]?_0x2edc6e['options'][_0x1282('0x1a')]||null:null,'attributes':_0x2edc6e[_0x1282('0x19')]?_0x2edc6e[_0x1282('0x19')][_0x1282('0x1b')]||null:null,'limit':_0x2edc6e[_0x1282('0x19')]?_0x2edc6e[_0x1282('0x19')][_0x1282('0x1c')]||null:null})[_0x1282('0xc')](function(_0xcd537a){logger['info'](_0x1282('0x16'),_0x2edc6e);logger[_0x1282('0x1d')](_0x1282('0x16'),_0x2edc6e,JSON['stringify'](_0xcd537a));_0x3f3a3c(_0xcd537a);})[_0x1282('0x15')](function(_0xece630){logger[_0x1282('0x12')](_0x1282('0x16'),_0xece630[_0x1282('0x14')],_0x2edc6e);_0x127037(_0x3f480a[_0x1282('0x12')](0x1f4,_0xece630[_0x1282('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index b79bc76..e684d17 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 _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 +var _0x75d5=['delete','/:id','openchannelinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','isAuthenticated','index','get','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','openchannel','addTags','put'];(function(_0x5e4262,_0xf93c1c){var _0x345cfa=function(_0x2ecc47){while(--_0x2ecc47){_0x5e4262['push'](_0x5e4262['shift']());}};_0x345cfa(++_0xf93c1c);}(_0x75d5,0xfb));var _0x575d=function(_0x1966a6,_0x12be5f){_0x1966a6=_0x1966a6-0x0;var _0x351c07=_0x75d5[_0x1966a6];return _0x351c07;};'use strict';var multer=require(_0x575d('0x0'));var util=require(_0x575d('0x1'));var path=require(_0x575d('0x2'));var timeout=require(_0x575d('0x3'));var express=require(_0x575d('0x4'));var router=express[_0x575d('0x5')]();var fs_extra=require(_0x575d('0x6'));var auth=require(_0x575d('0x7'));var interaction=require(_0x575d('0x8'));var config=require(_0x575d('0x9'));var controller=require(_0x575d('0xa'));router['get']('/',auth[_0x575d('0xb')](),controller[_0x575d('0xc')]);router[_0x575d('0xd')](_0x575d('0xe'),auth[_0x575d('0xb')](),controller[_0x575d('0xf')]);router[_0x575d('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x575d('0x10')]);router[_0x575d('0xd')](_0x575d('0x11'),auth['isAuthenticated'](),controller[_0x575d('0x12')]);router['get'](_0x575d('0x13'),auth[_0x575d('0xb')](),controller[_0x575d('0x14')]);router[_0x575d('0x15')]('/',auth[_0x575d('0xb')](),controller[_0x575d('0x16')]);router[_0x575d('0x15')](_0x575d('0x11'),auth[_0x575d('0xb')](),controller[_0x575d('0x17')]);router[_0x575d('0x15')](_0x575d('0x18'),auth['isAuthenticated'](),interaction[_0x575d('0x19')](_0x575d('0x1a'),'openchannelinteraction:addtags'),controller[_0x575d('0x1b')]);router[_0x575d('0x1c')]('/:id',auth[_0x575d('0xb')](),interaction[_0x575d('0x19')](_0x575d('0x1a'),'openchannelinteraction:update'),controller['update']);router[_0x575d('0x1d')](_0x575d('0x1e'),auth[_0x575d('0xb')](),interaction[_0x575d('0x19')](_0x575d('0x1a'),_0x575d('0x1f')),controller[_0x575d('0x20')]);router['delete'](_0x575d('0x18'),auth[_0x575d('0xb')](),controller[_0x575d('0x21')]);module[_0x575d('0x22')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 11e1347..5f4d526 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 _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 +var _0xe896=['INTEGER','sequelize','exports','BOOLEAN','STRING','DATE','ENUM'];(function(_0x2db667,_0x193cf5){var _0x83ff9=function(_0x5da022){while(--_0x5da022){_0x2db667['push'](_0x2db667['shift']());}};_0x83ff9(++_0x193cf5);}(_0xe896,0x15f));var _0x6e89=function(_0x153396,_0x1ecb93){_0x153396=_0x153396-0x0;var _0x50bcb7=_0xe896[_0x153396];return _0x50bcb7;};'use strict';var Sequelize=require(_0x6e89('0x0'));module[_0x6e89('0x1')]={'closed':{'type':Sequelize[_0x6e89('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x6e89('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x6e89('0x3')]},'read1stAt':{'type':Sequelize[_0x6e89('0x4')]},'threadId':{'type':Sequelize[_0x6e89('0x3')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x6e89('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x6e89('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x6e89('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x6e89('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 208a305..df0c362 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 _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 +var _0xa66e=['./openchannelInteraction.socket','register','status','offset','undefined','count','set','Content-Range','update','then','destroy','sendStatus','error','stack','name','index','OpenchannelInteraction','rawAttributes','type','key','getOptions','findAll','openchannel','query','user','catch','show','from','params','keys','filters','intersection','model','attributes','fields','length','includeAll','merge','options','find','create','body','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','nolimit','limit','order','sort','pick','where','filter','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','spread','Tag','color','emit','openchannelInteractionTags:save','removeTags','download','join','root','server','files','attachments','transcript-%d-%s.zip','push','User','CmContact','Contact','firstName','lastName','Attachment','Messages','createdAt','secret','read','OpenchannelAccount','Account','Owner','fullname','get','Openchannel','N.A.','toString','closed','closedAt','threadId','Public','basename','existsSync','createReadStream','pipe','createWriteStream','System','direction','out','value','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','zip-dir','moment','util','path','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','redis','defaults'];(function(_0x43a6f7,_0x560dbc){var _0x4087ba=function(_0x3e24bc){while(--_0x3e24bc){_0x43a6f7['push'](_0x43a6f7['shift']());}};_0x4087ba(++_0x560dbc);}(_0xa66e,0xf4));var _0xea66=function(_0x5a2128,_0x10ff1a){_0x5a2128=_0x5a2128-0x0;var _0xbc41dc=_0xa66e[_0x5a2128];return _0xbc41dc;};'use strict';var rimraf=require(_0xea66('0x0'));var zipdir=require(_0xea66('0x1'));var moment=require(_0xea66('0x2'));var util=require(_0xea66('0x3'));var path=require(_0xea66('0x4'));var ejs=require(_0xea66('0x5'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xea66('0x6'));var interaction=require(_0xea66('0x7'));var qs=require(_0xea66('0x8'));var pdf=require(_0xea66('0x9'));var logger=require('../../config/logger')(_0xea66('0xa'));var config=require(_0xea66('0xb'));var db=require('../../mysqldb')['db'];config[_0xea66('0xc')]=_[_0xea66('0xd')](config[_0xea66('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xea66('0xc')]));require(_0xea66('0xe'))[_0xea66('0xf')](socket);function respondWithStatusCode(_0x2ec80d,_0x4688d5){_0x4688d5=_0x4688d5||0xcc;return function(_0xfdac30){if(_0xfdac30){return _0x2ec80d['sendStatus'](_0x4688d5);}return _0x2ec80d[_0xea66('0x10')](_0x4688d5)['end']();};}function respondWithResult(_0x326382,_0x375db7){_0x375db7=_0x375db7||0xc8;return function(_0x136809){if(_0x136809){return _0x326382[_0xea66('0x10')](_0x375db7)['json'](_0x136809);}};}function respondWithFilteredResult(_0x12bfb6,_0x57d85a){return function(_0x54844e){if(_0x54844e){var _0x1d6d4c=typeof _0x57d85a[_0xea66('0x11')]===_0xea66('0x12')&&typeof _0x57d85a['limit']===_0xea66('0x12');var _0x1b67ef=_0x54844e['count'];var _0x50818a=_0x1d6d4c?0x0:_0x57d85a[_0xea66('0x11')];var _0x583686=_0x1d6d4c?_0x54844e[_0xea66('0x13')]:_0x57d85a[_0xea66('0x11')]+_0x57d85a['limit'];var _0x72c7ec;if(_0x583686>=_0x1b67ef){_0x583686=_0x1b67ef;_0x72c7ec=0xc8;}else{_0x72c7ec=0xce;}_0x12bfb6[_0xea66('0x10')](_0x72c7ec);return _0x12bfb6[_0xea66('0x14')](_0xea66('0x15'),_0x50818a+'-'+_0x583686+'/'+_0x1b67ef)['json'](_0x54844e);}return null;};}function saveUpdates(_0x138fb7){return function(_0x3de60b){if(_0x3de60b){return _0x3de60b[_0xea66('0x16')](_0x138fb7)[_0xea66('0x17')](function(_0x347169){return _0x347169;});}return null;};}function removeEntity(_0x9ab4d5){return function(_0x2c270c){if(_0x2c270c){return _0x2c270c[_0xea66('0x18')]()[_0xea66('0x17')](function(){_0x9ab4d5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d0446){return function(_0x322084){if(!_0x322084){_0x1d0446[_0xea66('0x19')](0x194);}return _0x322084;};}function handleError(_0x143293,_0xabfe69){_0xabfe69=_0xabfe69||0x1f4;return function(_0x3870bf){logger[_0xea66('0x1a')](_0x3870bf[_0xea66('0x1b')]);if(_0x3870bf[_0xea66('0x1c')]){delete _0x3870bf['name'];}_0x143293['status'](_0xabfe69)['send'](_0x3870bf);};}exports[_0xea66('0x1d')]=function(_0x55237a,_0x521746){var _0x2e5d0b={};var _0x2c4a96=_['map'](db[_0xea66('0x1e')][_0xea66('0x1f')],function(_0x4d8f42){return{'name':_0x4d8f42['fieldName'],'type':_0x4d8f42[_0xea66('0x20')][_0xea66('0x21')]};});_0x2e5d0b=qs[_0xea66('0x22')](_0x2c4a96,_0x55237a);return interaction[_0xea66('0x23')](_0xea66('0x24'),_0x55237a[_0xea66('0x25')],_0x55237a[_0xea66('0x26')],_0x2e5d0b,_0x2c4a96)[_0xea66('0x17')](respondWithFilteredResult(_0x521746,_0x2e5d0b))[_0xea66('0x27')](handleError(_0x521746,null));};exports[_0xea66('0x28')]=function(_0x5905d7,_0x1e4072){var _0x295870={};if(_0x5905d7[_0xea66('0x25')]['type']&&_0x5905d7[_0xea66('0x25')]['type']===_0xea66('0x29')){_0x295870['from']=_0x5905d7[_0xea66('0x2a')]['id'];}else{_0x295870['id']=_0x5905d7['params']['id'];}var _0x1a543a={'raw':![],'where':_0x295870},_0x2f24e2={};_0x2f24e2['model']=_[_0xea66('0x2b')](db[_0xea66('0x1e')][_0xea66('0x1f')]);_0x2f24e2[_0xea66('0x25')]=_[_0xea66('0x2b')](_0x5905d7[_0xea66('0x25')]);_0x2f24e2[_0xea66('0x2c')]=_[_0xea66('0x2d')](_0x2f24e2[_0xea66('0x2e')],_0x2f24e2[_0xea66('0x25')]);_0x1a543a[_0xea66('0x2f')]=_[_0xea66('0x2d')](_0x2f24e2[_0xea66('0x2e')],qs[_0xea66('0x30')](_0x5905d7[_0xea66('0x25')][_0xea66('0x30')]));_0x1a543a[_0xea66('0x2f')]=_0x1a543a[_0xea66('0x2f')][_0xea66('0x31')]?_0x1a543a[_0xea66('0x2f')]:_0x2f24e2[_0xea66('0x2e')];if(_0x5905d7[_0xea66('0x25')][_0xea66('0x32')]){_0x1a543a['include']=[{'all':!![]}];}_0x1a543a=_[_0xea66('0x33')]({},_0x1a543a,_0x5905d7[_0xea66('0x34')]);return db['OpenchannelInteraction'][_0xea66('0x35')](_0x1a543a)[_0xea66('0x17')](handleEntityNotFound(_0x1e4072,null))[_0xea66('0x17')](respondWithResult(_0x1e4072,null))[_0xea66('0x27')](handleError(_0x1e4072,null));};exports['create']=function(_0x4ef970,_0x5bc1da){return db[_0xea66('0x1e')][_0xea66('0x36')](_0x4ef970[_0xea66('0x37')],{})[_0xea66('0x17')](respondWithResult(_0x5bc1da,0xc9))['catch'](handleError(_0x5bc1da,null));};exports[_0xea66('0x16')]=function(_0x2650e6,_0x18cb2b){if(_0x2650e6[_0xea66('0x37')]['id']){delete _0x2650e6[_0xea66('0x37')]['id'];}return db[_0xea66('0x1e')][_0xea66('0x35')]({'where':{'id':_0x2650e6['params']['id']}})[_0xea66('0x17')](handleEntityNotFound(_0x18cb2b,null))['then'](saveUpdates(_0x2650e6['body'],null))[_0xea66('0x17')](respondWithResult(_0x18cb2b,null))[_0xea66('0x27')](handleError(_0x18cb2b,null));};exports[_0xea66('0x18')]=function(_0x337714,_0x110314){return db[_0xea66('0x1e')][_0xea66('0x35')]({'where':{'id':_0x337714[_0xea66('0x2a')]['id']}})[_0xea66('0x17')](handleEntityNotFound(_0x110314,null))[_0xea66('0x17')](removeEntity(_0x110314,null))['catch'](handleError(_0x110314,null));};exports[_0xea66('0x38')]=function(_0x260073,_0x2a1b94){return db['OpenchannelInteraction'][_0xea66('0x38')]()[_0xea66('0x17')](respondWithResult(_0x2a1b94,null))[_0xea66('0x27')](handleError(_0x2a1b94,null));};exports[_0xea66('0x39')]=function(_0x55b3d1,_0x392245){return db[_0xea66('0x3a')][_0xea66('0x35')]({'where':{'id':_0x55b3d1[_0xea66('0x2a')]['id']}})[_0xea66('0x17')](handleEntityNotFound(_0x392245,null))[_0xea66('0x17')](function(_0x1ab376){if(_0x1ab376){return _0x1ab376[_0xea66('0x39')](_0x55b3d1['body'][_0xea66('0x3b')],_[_0xea66('0x3c')](_0x55b3d1['body'],[_0xea66('0x3b'),'id'])||{});}})[_0xea66('0x17')](respondWithResult(_0x392245,null))[_0xea66('0x27')](handleError(_0x392245,null));};exports[_0xea66('0x3d')]=function(_0x571ba1,_0x1c412e){var _0x394ad9={'raw':![],'where':{}};var _0x38a76b={};var _0xc40699={'count':0x0,'rows':[]};return db[_0xea66('0x1e')][_0xea66('0x3e')]({'where':{'id':_0x571ba1[_0xea66('0x2a')]['id']}})[_0xea66('0x17')](handleEntityNotFound(_0x1c412e,null))[_0xea66('0x17')](function(_0x1ce577){if(_0x1ce577){_0x38a76b[_0xea66('0x2e')]=_['keys'](db[_0xea66('0x3a')][_0xea66('0x1f')]);_0x38a76b[_0xea66('0x25')]=_[_0xea66('0x2b')](_0x571ba1[_0xea66('0x25')]);_0x38a76b[_0xea66('0x2c')]=_[_0xea66('0x2d')](_0x38a76b[_0xea66('0x2e')],_0x38a76b['query']);_0x394ad9[_0xea66('0x2f')]=_[_0xea66('0x2d')](_0x38a76b[_0xea66('0x2e')],qs[_0xea66('0x30')](_0x571ba1['query'][_0xea66('0x30')]));_0x394ad9['attributes']=_0x394ad9[_0xea66('0x2f')][_0xea66('0x31')]?_0x394ad9['attributes']:_0x38a76b[_0xea66('0x2e')];if(!_0x571ba1[_0xea66('0x25')]['hasOwnProperty'](_0xea66('0x3f'))){_0x394ad9['limit']=qs['limit'](_0x571ba1['query'][_0xea66('0x40')]);_0x394ad9[_0xea66('0x11')]=qs['offset'](_0x571ba1['query'][_0xea66('0x11')]);}_0x394ad9[_0xea66('0x41')]=qs[_0xea66('0x42')](_0x571ba1['query'][_0xea66('0x42')]);_0x394ad9['where']=qs[_0xea66('0x2c')](_[_0xea66('0x43')](_0x571ba1['query'],_0x38a76b[_0xea66('0x2c')]));_0x394ad9[_0xea66('0x44')]['OpenchannelInteractionId']=_0x1ce577['id'];if(_0x571ba1[_0xea66('0x25')][_0xea66('0x45')]){_0x394ad9['where']=_[_0xea66('0x33')](_0x394ad9[_0xea66('0x44')],{'$or':_[_0xea66('0x46')](_0x394ad9[_0xea66('0x2f')],function(_0x38718b){var _0x2282e9={};_0x2282e9[_0x38718b]={'$like':'%'+_0x571ba1['query'][_0xea66('0x45')]+'%'};return _0x2282e9;})});}if(_0x571ba1[_0xea66('0x25')][_0xea66('0x47')]){var _0x51ead1=_0x571ba1['query']['$gte'][_0xea66('0x48')](',');var _0x6324f={};_0x6324f[_0x51ead1[0x0]]={'$gte':moment(_0x51ead1[0x1])[_0xea66('0x49')](_0xea66('0x4a'))};_0x394ad9[_0xea66('0x44')]=_[_0xea66('0x33')](_0x394ad9['where'],_0x6324f);}_0x394ad9=_['merge']({},_0x394ad9,_0x571ba1[_0xea66('0x34')]);return db[_0xea66('0x3a')][_0xea66('0x13')]({'where':_0x394ad9['where']})[_0xea66('0x17')](function(_0x294ac5){_0xc40699[_0xea66('0x13')]=_0x294ac5;if(_0x571ba1[_0xea66('0x25')]['includeAll']){_0x394ad9['include']=[{'all':!![]}];}return db[_0xea66('0x3a')][_0xea66('0x23')](_0x394ad9);})[_0xea66('0x17')](function(_0x234378){_0xc40699[_0xea66('0x4b')]=_0x234378;return _0xc40699;});}})[_0xea66('0x17')](respondWithFilteredResult(_0x1c412e,_0x394ad9))[_0xea66('0x27')](handleError(_0x1c412e,null));};exports[_0xea66('0x4c')]=function(_0x4e4d86,_0x3e6670){return db[_0xea66('0x1e')][_0xea66('0x35')]({'where':{'id':_0x4e4d86['params']['id']}})[_0xea66('0x17')](handleEntityNotFound(_0x3e6670,null))[_0xea66('0x17')](function(_0x5c5dbd){if(_0x5c5dbd){return _0x5c5dbd['setTags'](_0x4e4d86[_0xea66('0x37')][_0xea66('0x3b')],_[_0xea66('0x3c')](_0x4e4d86[_0xea66('0x37')],[_0xea66('0x3b'),'id'])||{})[_0xea66('0x4d')](function(){return db[_0xea66('0x4e')][_0xea66('0x23')]({'attributes':['id','name',_0xea66('0x4f')],'where':{'id':_0x4e4d86[_0xea66('0x37')]['ids']}});})[_0xea66('0x17')](function(_0x5022a6){socket[_0xea66('0x50')](_0xea66('0x51'),{'id':Number(_0x4e4d86[_0xea66('0x2a')]['id']),'tags':_0x5022a6||[]});return{'id':Number(_0x4e4d86[_0xea66('0x2a')]['id']),'tags':_0x5022a6||[]};});}})[_0xea66('0x17')](respondWithResult(_0x3e6670,null))[_0xea66('0x27')](handleError(_0x3e6670,null));};exports['removeTags']=function(_0x2fcfb9,_0x43543d){return db[_0xea66('0x1e')]['find']({'where':{'id':_0x2fcfb9[_0xea66('0x2a')]['id']}})[_0xea66('0x17')](handleEntityNotFound(_0x43543d,null))[_0xea66('0x17')](function(_0xbff7ff){if(_0xbff7ff){return _0xbff7ff[_0xea66('0x52')](_0x2fcfb9[_0xea66('0x25')][_0xea66('0x3b')]);}})[_0xea66('0x17')](respondWithStatusCode(_0x43543d,null))['catch'](handleError(_0x43543d,null));};exports[_0xea66('0x53')]=function(_0x466e75,_0x2e93b1){var _0x76455=moment()['unix']()['toString']();var _0x267293=path[_0xea66('0x54')](config[_0xea66('0x55')],'server','files','tmp');var _0x4f96a2=path[_0xea66('0x54')](config[_0xea66('0x55')],_0xea66('0x56'),_0xea66('0x57'),_0xea66('0x58'));var _0x518704=path[_0xea66('0x54')](_0x267293,_0x76455);var _0x37c170=util[_0xea66('0x49')](_0xea66('0x59'),_0x466e75[_0xea66('0x2a')]['id'],_0x76455);var _0x810b7=path[_0xea66('0x54')](_0x267293,_0x37c170);var _0x195f1f=[];_0x195f1f[_0xea66('0x5a')]({'model':db['User'],'as':_0xea66('0x5b'),'attributes':['id','fullname'],'raw':!![]});_0x195f1f[_0xea66('0x5a')]({'model':db[_0xea66('0x5c')],'as':_0xea66('0x5d'),'attributes':['id',_0xea66('0x5e'),_0xea66('0x5f')],'raw':!![]});if(_0x466e75[_0xea66('0x25')][_0xea66('0x58')]){_0x195f1f[_0xea66('0x5a')]({'model':db[_0xea66('0x60')],'as':_0xea66('0x60'),'raw':!![]});}var _0x2724af=[{'model':db['OpenchannelMessage'],'as':_0xea66('0x61'),'attributes':['id',_0xea66('0x37'),_0xea66('0x62'),'direction',_0xea66('0x63'),_0xea66('0x64')],'include':_0x195f1f}];_0x2724af[_0xea66('0x5a')]({'model':db[_0xea66('0x65')],'as':_0xea66('0x66'),'attributes':['id',_0xea66('0x1c')]});_0x2724af[_0xea66('0x5a')]({'model':db[_0xea66('0x5b')],'as':_0xea66('0x67'),'attributes':['id',_0xea66('0x68')]});return db[_0xea66('0x1e')][_0xea66('0x35')]({'where':{'id':_0x466e75[_0xea66('0x2a')]['id']},'include':_0x2724af})[_0xea66('0x17')](handleEntityNotFound(_0x2e93b1,null))[_0xea66('0x17')](function(_0xa63a6a){if(_0xa63a6a){var _0x16794d=_0xa63a6a[_0xea66('0x69')]({'plain':!![]});fs['mkdirSync'](_0x518704);var _0x552355={'channel':_0xea66('0x6a'),'account':_0x16794d['Account'][_0xea66('0x1c')],'agent':_0x16794d[_0xea66('0x67')]?_0x16794d[_0xea66('0x67')][_0xea66('0x68')]:_0xea66('0x6b'),'createdAt':moment(_0x16794d[_0xea66('0x62')])[_0xea66('0x49')]('YYYY-MM-DD\x20HH:mm:ss')[_0xea66('0x6c')](),'closedAt':_0x16794d[_0xea66('0x6d')]?moment(_0x16794d[_0xea66('0x6e')])[_0xea66('0x49')](_0xea66('0x4a'))['toString']():'','disposition':_0x16794d['disposition'],'visibility':_0x16794d[_0xea66('0x6f')]?_0xea66('0x70'):'Private','messages':_(_0x16794d[_0xea66('0x61')])[_0xea66('0x45')]({'secret':![]})[_0xea66('0x46')](function(_0x268133){if(_0x268133['Attachment']){var _0x3c0c3e=path[_0xea66('0x54')](_0x4f96a2,_0x268133[_0xea66('0x60')][_0xea66('0x71')]);if(fs[_0xea66('0x72')](_0x3c0c3e)){fs[_0xea66('0x73')](_0x3c0c3e)[_0xea66('0x74')](fs[_0xea66('0x75')](path[_0xea66('0x54')](_0x518704,_0x268133[_0xea66('0x60')][_0xea66('0x71')])));}}return{'date':moment(_0x268133[_0xea66('0x62')])[_0xea66('0x49')](_0xea66('0x4a'))['toString'](),'sender':_0x268133['direction']==='out'?_0x268133['User']?_0x268133[_0xea66('0x5b')][_0xea66('0x68')]:_0xea66('0x76'):_0x268133[_0xea66('0x5d')][_0xea66('0x5e')]+(_0x268133['Contact']['lastName']?'\x20'+_0x268133[_0xea66('0x5d')][_0xea66('0x5f')]:''),'body':_0x268133['Attachment']?_0x268133[_0xea66('0x60')][_0xea66('0x71')]:_0x268133[_0xea66('0x37')],'direction':_0x268133[_0xea66('0x77')]===_0xea66('0x78')?'A':'C','secret':_0x268133['secret'],'read':_0x268133[_0xea66('0x64')],'attachment':_0x268133[_0xea66('0x60')]};})[_0xea66('0x79')]()};return ejs['renderFile'](path[_0xea66('0x54')](config[_0xea66('0x55')],_0xea66('0x56'),_0xea66('0x7a'),_0xea66('0x7b')),{'interaction':_0x552355})['then'](function(_0x1f452d){var _0x30c130=path['join'](_0x518704,_0xea66('0x7c')+_0x16794d['id']+'-'+_0x76455+_0xea66('0x7d'));var _0x43d352={'path':_0x30c130,'channel':_0xea66('0x6a'),'interactionId':_0x16794d['id']};return pdf[_0xea66('0x7e')](_0x1f452d,_0x43d352);})[_0xea66('0x17')](function(){return new Promise(function(_0xe57d97,_0x206c88){zipdir(_0x518704,{'saveTo':_0x810b7},function(_0x2e66e7,_0x17070e){if(_0x2e66e7)return _0x206c88(_0x2e66e7);return _0xe57d97(_0x17070e);});})['then'](function(){return new Promise(function(_0x53d69a,_0x14449a){rimraf(_0x518704,function(_0xcc3ec7){if(_0xcc3ec7)_0x14449a(_0xcc3ec7);return _0x53d69a();});});})[_0xea66('0x17')](function(){return _0x2e93b1[_0xea66('0x53')](_0x810b7,_0x37c170,function(_0x54894a){if(_0x54894a){logger['error'](_0xea66('0x7f'),_0x54894a);}else{fs[_0xea66('0x80')](_0x810b7);}});});});}else{return _0x2e93b1['sendStatus'](0xc8);}})['catch'](handleError(_0x2e93b1,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index f948de3..45e98a3 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 _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 +var _0x66fb=['exports','OpenchannelInteraction','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','getUsers','then','Users','findAll','setDataValue','length','emit','catch','hasOwnProperty'];(function(_0x2ccf68,_0x1d41df){var _0x2793f7=function(_0x3351af){while(--_0x3351af){_0x2ccf68['push'](_0x2ccf68['shift']());}};_0x2793f7(++_0x1d41df);}(_0x66fb,0xc1));var _0xb66f=function(_0x1813cd,_0x19d2a8){_0x1813cd=_0x1813cd-0x0;var _0x51a60f=_0x66fb[_0x1813cd];return _0x51a60f;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require('../../mysqldb')['db'][_0xb66f('0x0')];var OpenchannelMessage=require(_0xb66f('0x1'))['db'][_0xb66f('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xb66f('0x3')](0x0);var events={'afterCreate':_0xb66f('0x4'),'afterUpdate':_0xb66f('0x5'),'afterDestroy':'remove'};function emitEvent(_0x137123){return function(_0x4b26ec,_0x4464e5,_0x430685){_0x4b26ec[_0xb66f('0x6')]({'attributes':['id'],'raw':!![]})[_0xb66f('0x7')](function(_0x297f7a){_0x4b26ec['setDataValue'](_0xb66f('0x8'),_0x297f7a['map'](function(_0x45ed39){return{'id':_0x45ed39['id']};}));return OpenchannelMessage[_0xb66f('0x9')]({'where':{'OpenchannelInteractionId':_0x4b26ec['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb66f('0x7')](function(_0x98aac6){_0x4b26ec[_0xb66f('0xa')]('unreadMessages',_0x98aac6[_0xb66f('0xb')]);OpenchannelInteractionEvents['emit'](_0x137123+':'+_0x4b26ec['id'],_0x4b26ec);OpenchannelInteractionEvents[_0xb66f('0xc')](_0x137123,_0x4b26ec);_0x430685(null);})[_0xb66f('0xd')](_0x430685(null));};}for(var e in events){if(events[_0xb66f('0xe')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0xb66f('0xf')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 4394b13..684c45c 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 _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 +var _0xbf9a=['YYYY-MM-DD\x20HH:mm:ss','util','bluebird','request-promise','path','rimraf','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','format'];(function(_0x189198,_0x26d47a){var _0x1e681d=function(_0x50b171){while(--_0x50b171){_0x189198['push'](_0x189198['shift']());}};_0x1e681d(++_0x26d47a);}(_0xbf9a,0x171));var _0xabf9=function(_0x58547b,_0x4b89c2){_0x58547b=_0x58547b-0x0;var _0x1d3fd2=_0xbf9a[_0x58547b];return _0x1d3fd2;};'use strict';var _=require('lodash');var util=require(_0xabf9('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xabf9('0x1'));var rp=require(_0xabf9('0x2'));var fs=require('fs');var path=require(_0xabf9('0x3'));var rimraf=require(_0xabf9('0x4'));var config=require('../../config/environment');var attributes=require('./openchannelInteraction.attributes');module[_0xabf9('0x5')]=function(_0x4fc987,_0x1f190c){return _0x4fc987[_0xabf9('0x6')](_0xabf9('0x7'),attributes,{'tableName':_0xabf9('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xabf9('0x9'),'collate':_0xabf9('0xa'),'hooks':{'beforeUpdate':function(_0x45cbc9,_0xbacabb,_0xdf5dbd){if(_0x45cbc9[_0xabf9('0xb')](_0xabf9('0xc'))){_0x45cbc9[_0xabf9('0xd')]=moment()[_0xabf9('0xe')](_0xabf9('0xf'));}_0xdf5dbd(null,_0x45cbc9);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index d4e70d2..d603a86 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 _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 +var _0x1316=['client','redis','socket.io-emitter','./openchannelInteraction.socket','register','request','info','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','OpenchannelInteraction,\x20%s,\x20%s','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','limit','then','debug','find','addTags','omit','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x476c9e,_0x340dc3){var _0x4bc3af=function(_0x4cf435){while(--_0x4cf435){_0x476c9e['push'](_0x476c9e['shift']());}};_0x4bc3af(++_0x340dc3);}(_0x1316,0x1e1));var _0x6131=function(_0xa96b73,_0x5d4c0c){_0xa96b73=_0xa96b73-0x0;var _0x4aacc7=_0x1316[_0xa96b73];return _0x4aacc7;};'use strict';var _=require(_0x6131('0x0'));var util=require(_0x6131('0x1'));var moment=require(_0x6131('0x2'));var BPromise=require(_0x6131('0x3'));var rs=require(_0x6131('0x4'));var fs=require('fs');var Redis=require(_0x6131('0x5'));var db=require(_0x6131('0x6'))['db'];var utils=require(_0x6131('0x7'));var logger=require(_0x6131('0x8'))(_0x6131('0x9'));var config=require(_0x6131('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x6131('0xb')]['http']({'port':0x232a});config[_0x6131('0xc')]=_['defaults'](config[_0x6131('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x6131('0xd'))(new Redis(config[_0x6131('0xc')]));require(_0x6131('0xe'))[_0x6131('0xf')](socket);function respondWithRpcPromise(_0x24c7a5,_0x5c7956,_0x5051b5){return new BPromise(function(_0x51fc61,_0x5b132f){return client[_0x6131('0x10')](_0x24c7a5,_0x5051b5)['then'](function(_0x1bf315){logger[_0x6131('0x11')]('OpenchannelInteraction,\x20%s,\x20%s',_0x5c7956,'request\x20sent');logger['debug'](_0x6131('0x12'),_0x5c7956,_0x6131('0x13'),JSON[_0x6131('0x14')](_0x1bf315));if(_0x1bf315[_0x6131('0x15')]){if(_0x1bf315[_0x6131('0x15')]['code']===0x1f4){logger[_0x6131('0x15')](_0x6131('0x16'),_0x5c7956,_0x1bf315[_0x6131('0x15')]['message']);return _0x5b132f(_0x1bf315[_0x6131('0x15')][_0x6131('0x17')]);}logger[_0x6131('0x15')](_0x6131('0x16'),_0x5c7956,_0x1bf315['error'][_0x6131('0x17')]);return _0x51fc61(_0x1bf315['error']['message']);}else{logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x5c7956,'request\x20sent');_0x51fc61(_0x1bf315[_0x6131('0x18')][_0x6131('0x17')]);}})[_0x6131('0x19')](function(_0x9f94dc){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x5c7956,_0x9f94dc);_0x5b132f(_0x9f94dc);});});}exports[_0x6131('0x1a')]=function(_0x2d4dc5){var _0x5e292e=this;return new Promise(function(_0x3067d5,_0x3608a1){return db[_0x6131('0x1b')][_0x6131('0x1c')](_0x2d4dc5[_0x6131('0x1d')],{'raw':_0x2d4dc5[_0x6131('0x1e')]?_0x2d4dc5[_0x6131('0x1e')][_0x6131('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d4dc5['options']?_0x2d4dc5['options']['where']||null:null,'attributes':_0x2d4dc5['options']?_0x2d4dc5[_0x6131('0x1e')]['attributes']||null:null,'limit':_0x2d4dc5['options']?_0x2d4dc5['options'][_0x6131('0x20')]||null:null})[_0x6131('0x21')](function(_0x4de831){logger[_0x6131('0x11')](_0x6131('0x1a'),_0x2d4dc5);logger[_0x6131('0x22')](_0x6131('0x1a'),_0x2d4dc5,JSON[_0x6131('0x14')](_0x4de831));_0x3067d5(_0x4de831);})[_0x6131('0x19')](function(_0x4c51b4){logger[_0x6131('0x15')](_0x6131('0x1a'),_0x4c51b4[_0x6131('0x17')],_0x2d4dc5);_0x3608a1(_0x5e292e[_0x6131('0x15')](0x1f4,_0x4c51b4[_0x6131('0x17')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x283bf8){return new Promise(function(_0x3301eb,_0xce5000){return db['OpenchannelInteraction'][_0x6131('0x23')]({'where':_0x283bf8[_0x6131('0x1e')]?_0x283bf8[_0x6131('0x1e')]['where']||null:null})[_0x6131('0x21')](function(_0x1fc8e8){if(_0x1fc8e8){return _0x1fc8e8[_0x6131('0x24')](_0x283bf8[_0x6131('0x1d')]['ids'],_[_0x6131('0x25')](_0x283bf8[_0x6131('0x1d')],[_0x6131('0x26'),'id'])||{});}})[_0x6131('0x27')](function(_0x35d08e){logger['info'](_0x6131('0x28'),_0x283bf8);logger[_0x6131('0x22')](_0x6131('0x28'),_0x283bf8,JSON['stringify'](_0x35d08e));_0x3301eb(_0x35d08e);})['catch'](function(_0x1486b8){logger['error'](_0x6131('0x28'),_0x1486b8[_0x6131('0x17')],_0x283bf8);_0xce5000(_this[_0x6131('0x15')](0x1f4,_0x1486b8[_0x6131('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 2b4316b..8a17f03 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 _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 +var _0x52a3=['openchannelInteraction:','./openchannelInteraction.events','save','register','length'];(function(_0x1f7201,_0x141b79){var _0x289fd2=function(_0x20ce23){while(--_0x20ce23){_0x1f7201['push'](_0x1f7201['shift']());}};_0x289fd2(++_0x141b79);}(_0x52a3,0x65));var _0x352a=function(_0x4674e9,_0xc799ec){_0x4674e9=_0x4674e9-0x0;var _0x197487=_0x52a3[_0x4674e9];return _0x197487;};'use strict';var OpenchannelInteractionEvents=require(_0x352a('0x0'));var events=[_0x352a('0x1'),'remove','update'];function createListener(_0x1601df,_0xd74566){return function(_0x79adbf){_0xd74566['emit'](_0x1601df,_0x79adbf);};}function removeListener(_0x3698cd,_0xdf406e){return function(){OpenchannelInteractionEvents['removeListener'](_0x3698cd,_0xdf406e);};}exports[_0x352a('0x2')]=function(_0x10667f){for(var _0x2eeaf3=0x0,_0x55761b=events[_0x352a('0x3')];_0x2eeaf3<_0x55761b;_0x2eeaf3++){var _0x103aea=events[_0x2eeaf3];var _0x53f712=createListener(_0x352a('0x4')+_0x103aea,_0x10667f);OpenchannelInteractionEvents['on'](_0x103aea,_0x53f712);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 1938c2f..a9fb9fc 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 _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 +var _0x0713=['get','isAuthenticated','index','/describe','describe','/:id','post','tracked','openchannel','openchannelmessage:create','put','update','accept','/:id/reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelMessage.controller'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0x8')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller['show']);router[_0x3071('0xe')]('/',auth[_0x3071('0x9')](),interaction[_0x3071('0xf')](_0x3071('0x10'),_0x3071('0x11')),controller['create']);router[_0x3071('0x12')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller[_0x3071('0x13')]);router[_0x3071('0x12')]('/:id/accept',auth['isAuthenticated'](),controller[_0x3071('0x14')]);router['put'](_0x3071('0x15'),auth[_0x3071('0x9')](),controller['reject']);router[_0x3071('0x16')]('/:id',auth[_0x3071('0x9')](),controller[_0x3071('0x17')]);module[_0x3071('0x18')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 09b82df..acaaafd 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 _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 +var _0x7117=['BOOLEAN','ENUM','out','STRING','sequelize','exports','TEXT','medium'];(function(_0x2d4cf0,_0x447bd2){var _0x1b4ef8=function(_0xd07480){while(--_0xd07480){_0x2d4cf0['push'](_0x2d4cf0['shift']());}};_0x1b4ef8(++_0x447bd2);}(_0x7117,0x1ec));var _0x7711=function(_0x39aa5d,_0x4da2a7){_0x39aa5d=_0x39aa5d-0x0;var _0x1382c1=_0x7117[_0x39aa5d];return _0x1382c1;};'use strict';var Sequelize=require(_0x7711('0x0'));module[_0x7711('0x1')]={'body':{'type':Sequelize[_0x7711('0x2')](_0x7711('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x7711('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7711('0x5')]('in','out'),'defaultValue':_0x7711('0x6'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x7711('0x7')]},'providerResponse':{'type':Sequelize[_0x7711('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index c0a865d..d07c528 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 _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 +var _0x89b8=['role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','SELECT','contact','User','email','internal','manual','SIP/%s','channel','motionChannel','event','EventManager','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','sequelize','fullname','interface','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','register','jayson/promise','http','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','end','status','json','offset','undefined','count','set','apply','reject','save','update','destroy','stack','name','send','index','map','OpenchannelMessage','rawAttributes','type','key','query','filters','model','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','keys','intersection','find','create','body','params','describe','../../config/logger','openchannel-interactions','accept','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt'];(function(_0x4dc3da,_0x532cb6){var _0x55f10c=function(_0x4b4954){while(--_0x4b4954){_0x4dc3da['push'](_0x4dc3da['shift']());}};_0x55f10c(++_0x532cb6);}(_0x89b8,0x19f));var _0x889b=function(_0x5f2ee7,_0x129885){_0x5f2ee7=_0x5f2ee7-0x0;var _0x44af45=_0x89b8[_0x5f2ee7];return _0x44af45;};'use strict';var emlformat=require(_0x889b('0x0'));var rimraf=require(_0x889b('0x1'));var zipdir=require(_0x889b('0x2'));var jsonpatch=require(_0x889b('0x3'));var rp=require(_0x889b('0x4'));var moment=require(_0x889b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x889b('0x6'));var util=require(_0x889b('0x7'));var path=require(_0x889b('0x8'));var sox=require('sox');var csv=require(_0x889b('0x9'));var ejs=require(_0x889b('0xa'));var fs=require('fs');var fs_extra=require(_0x889b('0xb'));var _=require('lodash');var squel=require(_0x889b('0xc'));var crypto=require(_0x889b('0xd'));var jsforce=require(_0x889b('0xe'));var deskjs=require(_0x889b('0xf'));var toCsv=require(_0x889b('0x9'));var querystring=require(_0x889b('0x10'));var Papa=require(_0x889b('0x11'));var Redis=require(_0x889b('0x12'));var authService=require(_0x889b('0x13'));var qs=require(_0x889b('0x14'));var as=require(_0x889b('0x15'));var hardwareService=require(_0x889b('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x889b('0x17'));var config=require(_0x889b('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x889b('0x19'))['db'];config[_0x889b('0x1a')]=_['defaults'](config[_0x889b('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x889b('0x1b'))(new Redis(config[_0x889b('0x1a')]));require('./openchannelMessage.socket')[_0x889b('0x1c')](socket);var jayson=require(_0x889b('0x1d'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson['client'][_0x889b('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0xedb905,_0x3eda0b,_0x20e313,_0x41e548){return new BPromise(function(_0x339556,_0x4d786d){var _0x199425=_0x41e548||client;return _0x199425['request'](_0xedb905,_0x20e313)[_0x889b('0x1f')](function(_0x358ccf){logger[_0x889b('0x20')](_0x889b('0x21'),_0x3eda0b,_0x889b('0x22'));logger['debug'](_0x889b('0x23'),_0x3eda0b,_0x889b('0x22'),JSON[_0x889b('0x24')](_0x358ccf));if(_0x358ccf[_0x889b('0x25')]){if(_0x358ccf[_0x889b('0x25')][_0x889b('0x26')]===0x1f4){logger[_0x889b('0x25')](_0x889b('0x21'),_0x3eda0b,_0x358ccf[_0x889b('0x25')][_0x889b('0x27')]);return _0x4d786d(_0x358ccf[_0x889b('0x25')]['message']);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x3eda0b,_0x358ccf[_0x889b('0x25')]['message']);return _0x339556(_0x358ccf['error'][_0x889b('0x27')]);}else{logger[_0x889b('0x20')]('OpenchannelMessage,\x20%s,\x20%s',_0x3eda0b,_0x889b('0x22'));_0x339556(_0x358ccf['result'][_0x889b('0x27')]);}})[_0x889b('0x28')](function(_0x2f9b13){logger[_0x889b('0x25')]('OpenchannelMessage,\x20%s,\x20%s',_0x3eda0b,_0x2f9b13);_0x4d786d(_0x2f9b13);});});}function respondWithStatusCode(_0x534663,_0x11c41e){_0x11c41e=_0x11c41e||0xcc;return function(_0x585701){if(_0x585701){return _0x534663[_0x889b('0x29')](_0x11c41e);}return _0x534663['status'](_0x11c41e)[_0x889b('0x2a')]();};}function respondWithResult(_0x4a98ff,_0x3c7c92){_0x3c7c92=_0x3c7c92||0xc8;return function(_0x2dc53e){if(_0x2dc53e){return _0x4a98ff[_0x889b('0x2b')](_0x3c7c92)[_0x889b('0x2c')](_0x2dc53e);}};}function respondWithFilteredResult(_0x1ce3bc,_0x4e68da){return function(_0x498a00){if(_0x498a00){var _0x395aab=typeof _0x4e68da[_0x889b('0x2d')]==='undefined'&&typeof _0x4e68da['limit']===_0x889b('0x2e');var _0x37a9a8=_0x498a00[_0x889b('0x2f')];var _0x17408e=_0x395aab?0x0:_0x4e68da[_0x889b('0x2d')];var _0xb6748b=_0x395aab?_0x498a00[_0x889b('0x2f')]:_0x4e68da[_0x889b('0x2d')]+_0x4e68da['limit'];var _0x5a5b7b;if(_0xb6748b>=_0x37a9a8){_0xb6748b=_0x37a9a8;_0x5a5b7b=0xc8;}else{_0x5a5b7b=0xce;}_0x1ce3bc['status'](_0x5a5b7b);return _0x1ce3bc[_0x889b('0x30')]('Content-Range',_0x17408e+'-'+_0xb6748b+'/'+_0x37a9a8)[_0x889b('0x2c')](_0x498a00);}return null;};}function patchUpdates(_0x5bbe74){return function(_0x37a0b6){try{jsonpatch[_0x889b('0x31')](_0x37a0b6,_0x5bbe74,!![]);}catch(_0x1e01d3){return BPromise[_0x889b('0x32')](_0x1e01d3);}return _0x37a0b6[_0x889b('0x33')]();};}function saveUpdates(_0x5d841a,_0x364611){return function(_0x57dee0){if(_0x57dee0){return _0x57dee0[_0x889b('0x34')](_0x5d841a)[_0x889b('0x1f')](function(_0x3b82af){return _0x3b82af;});}return null;};}function removeEntity(_0x5f3f56,_0x82808){return function(_0x43b923){if(_0x43b923){return _0x43b923[_0x889b('0x35')]()[_0x889b('0x1f')](function(){_0x5f3f56['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x50ab71,_0x478580){return function(_0x553541){if(!_0x553541){_0x50ab71[_0x889b('0x29')](0x194);}return _0x553541;};}function handleError(_0x42c920,_0xdd58e1){_0xdd58e1=_0xdd58e1||0x1f4;return function(_0x5e9d2a){logger[_0x889b('0x25')](_0x5e9d2a[_0x889b('0x36')]);if(_0x5e9d2a[_0x889b('0x37')]){delete _0x5e9d2a['name'];}_0x42c920[_0x889b('0x2b')](_0xdd58e1)[_0x889b('0x38')](_0x5e9d2a);};}exports[_0x889b('0x39')]=function(_0x45a1ac,_0x14d27c){var _0x2b3476={},_0x393a8c={},_0x42b888={'count':0x0,'rows':[]};var _0x1f7d5f=_[_0x889b('0x3a')](db[_0x889b('0x3b')][_0x889b('0x3c')],function(_0x4c9688){return{'name':_0x4c9688['fieldName'],'type':_0x4c9688[_0x889b('0x3d')][_0x889b('0x3e')]};});_0x393a8c['model']=_[_0x889b('0x3a')](_0x1f7d5f,_0x889b('0x37'));_0x393a8c['query']=_['keys'](_0x45a1ac[_0x889b('0x3f')]);_0x393a8c[_0x889b('0x40')]=_['intersection'](_0x393a8c[_0x889b('0x41')],_0x393a8c[_0x889b('0x3f')]);_0x2b3476[_0x889b('0x42')]=_['intersection'](_0x393a8c[_0x889b('0x41')],qs[_0x889b('0x43')](_0x45a1ac['query'][_0x889b('0x43')]));_0x2b3476[_0x889b('0x42')]=_0x2b3476[_0x889b('0x42')]['length']?_0x2b3476[_0x889b('0x42')]:_0x393a8c[_0x889b('0x41')];if(!_0x45a1ac[_0x889b('0x3f')][_0x889b('0x44')](_0x889b('0x45'))){_0x2b3476[_0x889b('0x46')]=qs[_0x889b('0x46')](_0x45a1ac['query'][_0x889b('0x46')]);_0x2b3476[_0x889b('0x2d')]=qs[_0x889b('0x2d')](_0x45a1ac[_0x889b('0x3f')][_0x889b('0x2d')]);}_0x2b3476[_0x889b('0x47')]=qs['sort'](_0x45a1ac['query'][_0x889b('0x48')]);_0x2b3476[_0x889b('0x49')]=qs[_0x889b('0x40')](_[_0x889b('0x4a')](_0x45a1ac[_0x889b('0x3f')],_0x393a8c[_0x889b('0x40')]),_0x1f7d5f);if(_0x45a1ac[_0x889b('0x3f')][_0x889b('0x4b')]){_0x2b3476[_0x889b('0x49')]=_[_0x889b('0x4c')](_0x2b3476['where'],{'$or':_[_0x889b('0x3a')](_0x1f7d5f,function(_0x5282b9){if(_0x5282b9[_0x889b('0x3d')]!==_0x889b('0x4d')){var _0x5d67d8={};_0x5d67d8[_0x5282b9[_0x889b('0x37')]]={'$like':'%'+_0x45a1ac[_0x889b('0x3f')][_0x889b('0x4b')]+'%'};return _0x5d67d8;}})});}_0x2b3476=_[_0x889b('0x4c')]({},_0x2b3476,_0x45a1ac[_0x889b('0x4e')]);var _0x4d7403={'where':_0x2b3476[_0x889b('0x49')]};return db[_0x889b('0x3b')][_0x889b('0x2f')](_0x4d7403)['then'](function(_0x70d13e){_0x42b888[_0x889b('0x2f')]=_0x70d13e;if(_0x45a1ac[_0x889b('0x3f')][_0x889b('0x4f')]){_0x2b3476[_0x889b('0x50')]=[{'all':!![]}];}return db[_0x889b('0x3b')][_0x889b('0x51')](_0x2b3476);})[_0x889b('0x1f')](function(_0x5a96ba){_0x42b888[_0x889b('0x52')]=_0x5a96ba;return _0x42b888;})[_0x889b('0x1f')](respondWithFilteredResult(_0x14d27c,_0x2b3476))[_0x889b('0x28')](handleError(_0x14d27c,null));};exports[_0x889b('0x53')]=function(_0x48888a,_0x6b274){var _0x13f8d4={'raw':!![],'where':{'id':_0x48888a['params']['id']}},_0x4c77a1={};_0x4c77a1[_0x889b('0x41')]=_[_0x889b('0x54')](db['OpenchannelMessage'][_0x889b('0x3c')]);_0x4c77a1['query']=_['keys'](_0x48888a[_0x889b('0x3f')]);_0x4c77a1[_0x889b('0x40')]=_[_0x889b('0x55')](_0x4c77a1['model'],_0x4c77a1[_0x889b('0x3f')]);_0x13f8d4[_0x889b('0x42')]=_['intersection'](_0x4c77a1[_0x889b('0x41')],qs['fields'](_0x48888a[_0x889b('0x3f')][_0x889b('0x43')]));_0x13f8d4[_0x889b('0x42')]=_0x13f8d4['attributes']['length']?_0x13f8d4[_0x889b('0x42')]:_0x4c77a1[_0x889b('0x41')];if(_0x48888a[_0x889b('0x3f')][_0x889b('0x4f')]){_0x13f8d4[_0x889b('0x50')]=[{'all':!![]}];}_0x13f8d4=_[_0x889b('0x4c')]({},_0x13f8d4,_0x48888a[_0x889b('0x4e')]);return db['OpenchannelMessage'][_0x889b('0x56')](_0x13f8d4)['then'](handleEntityNotFound(_0x6b274,null))[_0x889b('0x1f')](respondWithResult(_0x6b274,null))['catch'](handleError(_0x6b274,null));};exports[_0x889b('0x57')]=function(_0x404947,_0x4c4439){return db[_0x889b('0x3b')][_0x889b('0x57')](_0x404947[_0x889b('0x58')],{})[_0x889b('0x1f')](respondWithResult(_0x4c4439,0xc9))[_0x889b('0x28')](handleError(_0x4c4439,null));};exports['update']=function(_0x27653e,_0x554501){if(_0x27653e[_0x889b('0x58')]['id']){delete _0x27653e[_0x889b('0x58')]['id'];}return db[_0x889b('0x3b')]['find']({'where':{'id':_0x27653e[_0x889b('0x59')]['id']}})[_0x889b('0x1f')](handleEntityNotFound(_0x554501,null))[_0x889b('0x1f')](saveUpdates(_0x27653e[_0x889b('0x58')],null))[_0x889b('0x1f')](respondWithResult(_0x554501,null))[_0x889b('0x28')](handleError(_0x554501,null));};exports[_0x889b('0x35')]=function(_0x279d03,_0x496524){return db[_0x889b('0x3b')][_0x889b('0x56')]({'where':{'id':_0x279d03[_0x889b('0x59')]['id']}})[_0x889b('0x1f')](handleEntityNotFound(_0x496524,null))[_0x889b('0x1f')](removeEntity(_0x496524,null))[_0x889b('0x28')](handleError(_0x496524,null));};exports[_0x889b('0x5a')]=function(_0x411f8a,_0x5e7800){return db[_0x889b('0x3b')][_0x889b('0x5a')]()[_0x889b('0x1f')](respondWithResult(_0x5e7800,null))['catch'](handleError(_0x5e7800,null));};var interaction_log=require(_0x889b('0x5b'))(_0x889b('0x5c'));exports[_0x889b('0x5d')]=function(_0x3d7db5,_0xb62a5e,_0xc07de9){var _0x37a425={'agent':{},'channel':'openchannel'};if(_0x3d7db5[_0x889b('0x58')]['id']){delete _0x3d7db5[_0x889b('0x58')]['id'];}_0x3d7db5[_0x889b('0x58')]['read']=!![];_0x3d7db5[_0x889b('0x58')][_0x889b('0x5e')]=moment()[_0x889b('0x5f')](_0x889b('0x60'));_0x3d7db5[_0x889b('0x58')][_0x889b('0x61')]=_0x3d7db5[_0x889b('0x58')][_0x889b('0x61')]||_0x3d7db5[_0x889b('0x62')]['id'];_0x37a425[_0x889b('0x63')]['id']=_0x3d7db5[_0x889b('0x58')][_0x889b('0x61')];return db[_0x889b('0x3b')][_0x889b('0x56')]({'where':{'id':_0x3d7db5[_0x889b('0x59')]['id'],'UserId':null}})[_0x889b('0x1f')](handleEntityNotFound(_0xb62a5e,null))['then'](saveUpdates(_0x3d7db5[_0x889b('0x58')],null))['then'](function(_0x60272f){if(_0x60272f){_0x37a425[_0x889b('0x27')]=_0x60272f[_0x889b('0x64')]({'plain':!![]});return db[_0x889b('0x65')]['find']({'where':{'id':_0x60272f[_0x889b('0x66')]}});}return null;})[_0x889b('0x1f')](handleEntityNotFound(_0xb62a5e,null))[_0x889b('0x1f')](function(_0x19e456){if(_0x19e456){return _0x19e456[_0x889b('0x34')]({'UserId':_0x3d7db5['body'][_0x889b('0x61')],'read1stAt':_[_0x889b('0x67')](_0x19e456[_0x889b('0x68')])?moment()['format'](_0x889b('0x60')):undefined});}return null;})[_0x889b('0x1f')](function(_0x169adf){if(_0x169adf){_0x37a425['interaction']=_0x169adf['get']({'plain':!![]});interaction_log[_0x889b('0x20')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3d7db5[_0x889b('0x62')]['id'],_0x3d7db5[_0x889b('0x62')][_0x889b('0x37')],_0x3d7db5[_0x889b('0x62')][_0x889b('0x69')],_0x37a425[_0x889b('0x6a')]['id'],_0x3d7db5[_0x889b('0x58')]?JSON[_0x889b('0x24')](_0x3d7db5[_0x889b('0x58')]):_0x889b('0x6b'));return respondWithRpcPromise(_0x889b('0x6c'),_0x889b('0x6d'),_0x37a425);}return null;})[_0x889b('0x1f')](function(_0x5fd264){var _0x1c565a=_0x889b('0x6e')+_0x5fd264[_0x889b('0x27')]['ContactId'];return db['sequelize'][_0x889b('0x3f')](_0x1c565a,{'type':db[_0x889b('0x6f')][_0x889b('0x70')][_0x889b('0x71')],'raw':!![]})[_0x889b('0x1f')](function(_0x1687e5){return _0x1687e5;});})[_0x889b('0x1f')](function(_0x4eb2ab){if(_0x4eb2ab){_0x37a425[_0x889b('0x27')][_0x889b('0x72')]=_0x4eb2ab[0x0];if(!_0x3d7db5[_0x889b('0x58')][_0x889b('0x61')])return;return db[_0x889b('0x73')][_0x889b('0x56')]({'where':{'id':_0x3d7db5[_0x889b('0x58')]['UserId'],'role':'agent'},'attributes':['id',_0x889b('0x37'),'fullname',_0x889b('0x74'),_0x889b('0x75')],'raw':!![]});}return null;})[_0x889b('0x1f')](function(_0x58b221){if(!_0x58b221)return null;_0x37a425[_0x889b('0x27')]['agent']=_0x58b221;return _0x37a425;})['then'](function(_0x5152ac){if(_0x5152ac){if(_0x3d7db5[_0x889b('0x58')][_0x889b('0x76')]){_0x37a425[_0x889b('0x27')]['interface']=util[_0x889b('0x5f')](_0x889b('0x77'),_0x3d7db5[_0x889b('0x62')][_0x889b('0x37')]);_0x37a425['message'][_0x889b('0x78')]=_0x37a425['channel'];_0x37a425['message'][_0x889b('0x79')]=_0x37a425[_0x889b('0x78')];_0x37a425[_0x889b('0x27')][_0x889b('0x7a')]=_0x889b('0x5d');return respondWithRpcPromise(_0x889b('0x7b'),'EventManager',{'event':'acceptmessage','message':_0x37a425[_0x889b('0x27')]},client9002)['then'](function(){return _0x37a425;});}return _0x37a425;}return null;})[_0x889b('0x1f')](respondWithResult(_0xb62a5e,null))[_0x889b('0x28')](handleError(_0xb62a5e,null));};var interaction_log=require(_0x889b('0x5b'))('openchannel-interactions');exports[_0x889b('0x32')]=function(_0x4ffd75,_0x36aa42,_0x20d40e){var _0x327382={'agent':{},'channel':'openchannel'};if(_0x4ffd75['body']['id']){delete _0x4ffd75[_0x889b('0x58')]['id'];}_0x4ffd75['body'][_0x889b('0x61')]=_0x4ffd75[_0x889b('0x58')][_0x889b('0x61')]||_0x4ffd75['user']['id'];_0x327382[_0x889b('0x63')]['id']=_0x4ffd75[_0x889b('0x58')][_0x889b('0x61')];return db[_0x889b('0x3b')]['find']({'where':{'id':_0x4ffd75[_0x889b('0x59')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x36aa42,null))[_0x889b('0x1f')](function(_0x39ef1e){if(_0x39ef1e){_0x327382[_0x889b('0x27')]=_0x39ef1e[_0x889b('0x64')]({'plain':!![]});return db[_0x889b('0x65')][_0x889b('0x56')]({'where':{'id':_0x39ef1e[_0x889b('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x36aa42,null))[_0x889b('0x1f')](function(_0x49d6f0){if(_0x49d6f0){_0x327382[_0x889b('0x6a')]=_0x49d6f0['get']({'plain':!![]});interaction_log['info'](_0x889b('0x7c'),_0x4ffd75['user']['id'],_0x4ffd75[_0x889b('0x62')]['name'],_0x4ffd75[_0x889b('0x62')]['role'],_0x327382[_0x889b('0x6a')]['id'],_0x4ffd75[_0x889b('0x58')]?JSON[_0x889b('0x24')](_0x4ffd75['body']):'null');return respondWithRpcPromise('RejectMessage',_0x889b('0x7d'),_0x327382);}return null;})[_0x889b('0x1f')](function(_0x5b5eea){var _0x4a34c6=_0x889b('0x6e')+_0x5b5eea[_0x889b('0x27')]['ContactId'];return db[_0x889b('0x7e')][_0x889b('0x3f')](_0x4a34c6,{'type':db[_0x889b('0x6f')][_0x889b('0x70')][_0x889b('0x71')],'raw':!![]})[_0x889b('0x1f')](function(_0x17dd7c){return _0x17dd7c;});})[_0x889b('0x1f')](function(_0x46ba0e){if(_0x46ba0e){_0x327382[_0x889b('0x27')][_0x889b('0x72')]=_0x46ba0e[0x0];if(!_0x4ffd75[_0x889b('0x58')]['UserId'])return;return db[_0x889b('0x73')][_0x889b('0x56')]({'where':{'id':_0x4ffd75[_0x889b('0x58')]['UserId'],'role':_0x889b('0x63')},'attributes':['id','name',_0x889b('0x7f'),'email',_0x889b('0x75')],'raw':!![]});}return null;})[_0x889b('0x1f')](function(_0x54607e){if(!_0x54607e)return null;_0x327382[_0x889b('0x27')]['agent']=_0x54607e;return _0x327382;})[_0x889b('0x1f')](function(_0x767c2a){if(_0x767c2a){_0x767c2a['message'][_0x889b('0x80')]=util['format']('SIP/%s',_0x4ffd75[_0x889b('0x62')][_0x889b('0x37')]);_0x767c2a[_0x889b('0x27')]['channel']=_0x327382['channel'];_0x767c2a[_0x889b('0x27')][_0x889b('0x79')]=_0x327382[_0x889b('0x78')];_0x767c2a['message'][_0x889b('0x7a')]=_0x889b('0x32');respondWithRpcPromise(_0x889b('0x7b'),_0x889b('0x7b'),{'event':_0x889b('0x81'),'message':_0x767c2a['message']},client9002);return _0x327382;}return null;})[_0x889b('0x1f')](respondWithResult(_0x36aa42,null))[_0x889b('0x28')](handleError(_0x36aa42,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 40139bc..580b459 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 _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 +var _0x0805=['hasOwnProperty','exports','events','../../mysqldb','OpenchannelMessage','remove','emit'];(function(_0x3d92fc,_0x4d7fa1){var _0x12720b=function(_0x413893){while(--_0x413893){_0x3d92fc['push'](_0x3d92fc['shift']());}};_0x12720b(++_0x4d7fa1);}(_0x0805,0x16e));var _0x5080=function(_0x1cc319,_0x1283ed){_0x1cc319=_0x1cc319-0x0;var _0x29fc27=_0x0805[_0x1cc319];return _0x29fc27;};'use strict';var EventEmitter=require(_0x5080('0x0'));var OpenchannelMessage=require(_0x5080('0x1'))['db'][_0x5080('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x5080('0x3')};function emitEvent(_0x983625){return function(_0x42e050,_0x3b1532,_0xdd8ebb){OpenchannelMessageEvents[_0x5080('0x4')](_0x983625+':'+_0x42e050['id'],_0x42e050);OpenchannelMessageEvents[_0x5080('0x4')](_0x983625,_0x42e050);_0xdd8ebb(null);};}for(var e in events){if(events[_0x5080('0x5')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0x5080('0x6')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index a3e69c2..612d4e1 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 _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 +var _0x74d4=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','OpenchannelInteractionId','then','update','createdAt','catch','error','describe','find','OpenchannelAccountId','OpenchannelInteraction','Interactions','CmContact','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','POST','method','GET','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','finally','utf8mb4','lodash'];(function(_0x8c0a3,_0x29f312){var _0x175b3a=function(_0x5258f6){while(--_0x5258f6){_0x8c0a3['push'](_0x8c0a3['shift']());}};_0x175b3a(++_0x29f312);}(_0x74d4,0x1bf));var _0x474d=function(_0x55020f,_0x142bfa){_0x55020f=_0x55020f-0x0;var _0x4e09be=_0x74d4[_0x55020f];return _0x4e09be;};'use strict';var _=require(_0x474d('0x0'));var util=require('util');var logger=require(_0x474d('0x1'))(_0x474d('0x2'));var moment=require(_0x474d('0x3'));var BPromise=require(_0x474d('0x4'));var rp=require(_0x474d('0x5'));var fs=require('fs');var path=require(_0x474d('0x6'));var rimraf=require(_0x474d('0x7'));var config=require(_0x474d('0x8'));var attributes=require('./openchannelMessage.attributes');module[_0x474d('0x9')]=function(_0x88ad7d,_0x495533){return _0x88ad7d[_0x474d('0xa')](_0x474d('0xb'),attributes,{'tableName':_0x474d('0xc'),'paranoid':![],'indexes':[{'name':_0x474d('0xd'),'fields':[_0x474d('0xe')],'type':_0x474d('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3053b2,_0x160651,_0x5387f6){var _0x69984=_0x88ad7d[_0x474d('0x10')];var _0x1080d3=_0x3053b2[_0x474d('0x11')]({'plain':!![]});if(_0x1080d3[_0x474d('0x12')]['toLowerCase']()==='in'||_0x1080d3[_0x474d('0x12')][_0x474d('0x13')]()===_0x474d('0x14')&&!_0x1080d3[_0x474d('0x15')]&&!_[_0x474d('0x16')](_0x1080d3[_0x474d('0x17')])){_0x69984['OpenchannelInteraction'][_0x474d('0x18')]({'where':{'id':_0x1080d3[_0x474d('0x19')]}})[_0x474d('0x1a')](function(_0x320c90){if(_0x320c90){_0x320c90[_0x474d('0x1b')]({'lastMsgAt':_0x1080d3[_0x474d('0x1c')],'lastMsgDirection':_0x1080d3[_0x474d('0x12')][_0x474d('0x13')]()});}})[_0x474d('0x1d')](function(_0x46b45a){console[_0x474d('0x1e')](_0x46b45a);});}if(_0x1080d3['direction']===_0x474d('0x14')&&!_0x1080d3['secret']){var _0x50cff4;_0x69984['CmContact'][_0x474d('0x1f')]()[_0x474d('0x1a')](function(_0x2105e3){return _0x69984['OpenchannelAccount'][_0x474d('0x20')]({'where':{'id':_0x1080d3[_0x474d('0x21')]},'include':[{'model':_0x69984[_0x474d('0x22')],'as':_0x474d('0x23'),'where':{'id':_0x1080d3[_0x474d('0x19')]},'limit':0x1,'include':[{'model':_0x69984[_0x474d('0x24')],'as':_0x474d('0x25'),'attributes':_[_0x474d('0x26')](_0x2105e3)}]}]});})[_0x474d('0x1a')](function(_0x2d8519){_0x50cff4=_0x2d8519[_0x474d('0x11')]({'plain':!![]});if(_0x50cff4&&_0x50cff4[_0x474d('0x27')]){logger[_0x474d('0x28')](_0x474d('0x29'),_0x474d('0x2a'),util[_0x474d('0x2b')](_0x474d('0x2c'),_0x1080d3['id'],_0x50cff4[_0x474d('0x27')]));if(_0x50cff4['Interactions']&&_0x50cff4[_0x474d('0x23')][_0x474d('0x2d')]){_0x1080d3[_0x474d('0x2e')]=_[_0x474d('0x2f')](_0x50cff4[_0x474d('0x23')][0x0],_0x474d('0x25'));_0x1080d3[_0x474d('0x25')]=_0x50cff4[_0x474d('0x23')][0x0][_0x474d('0x25')];}var _0x160651={'method':_0x474d('0x30'),'uri':encodeURI(_0x50cff4[_0x474d('0x27')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x160651[_0x474d('0x31')]){case _0x474d('0x32'):_0x160651['qs']=_0x1080d3;break;case _0x474d('0x30'):_0x160651['body']=_0x1080d3;break;}return rp(_0x160651)[_0x474d('0x1a')](function(_0x17ee7b){logger[_0x474d('0x28')](_0x474d('0x29'),'afterCreate',util[_0x474d('0x2b')](_0x474d('0x33'),_0x1080d3['id'],_0x50cff4[_0x474d('0x27')]));if(_0x17ee7b[_0x474d('0xe')][_0x474d('0x34')]&&_0x17ee7b[_0x474d('0xe')]['threadId']!=_0x1080d3['Interaction'][_0x474d('0x34')]){return _0x69984[_0x474d('0x22')]['update']({'threadId':_0x17ee7b[_0x474d('0xe')][_0x474d('0x34')]},{'where':{'id':_0x1080d3[_0x474d('0x2e')]['id']}});}else{return;}})['then'](function(){return _0x3053b2[_0x474d('0x1b')]({'read':!![]});})[_0x474d('0x1d')](function(_0x3a0d14){logger['error'](_0x474d('0x29'),'afterCreate',util[_0x474d('0x35')](_0x3a0d14,{'showHidden':![],'depth':null}));_0x5387f6();});}else{_0x5387f6();}})[_0x474d('0x36')](function(){_0x5387f6();});}else{_0x5387f6();}}},'charset':_0x474d('0x37'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index eee0049..8e5375e 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(_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 +var _0x7a54=['../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body','options','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x19f561,_0x591dcf){var _0x15f4d3=function(_0x584724){while(--_0x584724){_0x19f561['push'](_0x19f561['shift']());}};_0x15f4d3(++_0x591dcf);}(_0x7a54,0x106));var _0x47a5=function(_0x34fee2,_0x657a9d){_0x34fee2=_0x34fee2-0x0;var _0xedc0af=_0x7a54[_0x34fee2];return _0xedc0af;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});config['redis']=_[_0x47a5('0xb')](config[_0x47a5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0xd'))(new Redis(config['redis']));require('./openchannelMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2a0e98,_0x2baee7,_0x5e31dd){return new BPromise(function(_0x2eb0dd,_0x49e844){return client['request'](_0x2a0e98,_0x5e31dd)[_0x47a5('0xe')](function(_0x69e4d4){logger[_0x47a5('0xf')](_0x47a5('0x10'),_0x2baee7,_0x47a5('0x11'));logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x2baee7,'request\x20sent',JSON[_0x47a5('0x14')](_0x69e4d4));if(_0x69e4d4[_0x47a5('0x15')]){if(_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x16')]===0x1f4){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x49e844(_0x69e4d4['error'][_0x47a5('0x17')]);}logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x2eb0dd(_0x69e4d4['error']['message']);}else{logger[_0x47a5('0xf')]('OpenchannelMessage,\x20%s,\x20%s',_0x2baee7,'request\x20sent');_0x2eb0dd(_0x69e4d4[_0x47a5('0x18')][_0x47a5('0x17')]);}})[_0x47a5('0x19')](function(_0x1ef371){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x1ef371);_0x49e844(_0x1ef371);});});}exports[_0x47a5('0x1a')]=function(_0xe3c618){var _0x3aed38=this;return new Promise(function(_0x4a9fcb,_0x1570bc){return db[_0x47a5('0x1b')]['create'](_0xe3c618[_0x47a5('0x1c')],{'raw':_0xe3c618[_0x47a5('0x1d')]?_0xe3c618[_0x47a5('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x47a5('0xe')](function(_0x2f142b){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xe3c618);logger['debug'](_0x47a5('0x1a'),_0xe3c618,JSON[_0x47a5('0x14')](_0x2f142b));_0x4a9fcb(_0x2f142b);})['catch'](function(_0x28747d){logger[_0x47a5('0x15')](_0x47a5('0x1a'),_0x28747d[_0x47a5('0x17')],_0xe3c618);_0x1570bc(_0x3aed38[_0x47a5('0x15')](0x1f4,_0x28747d['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 48b2720..f923fb9 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 _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 +var _0x21dc=['update','emit','removeListener','openchannelMessage:','./openchannelMessage.events','save','remove'];(function(_0x452d4b,_0x501ba8){var _0x3638f6=function(_0x48913c){while(--_0x48913c){_0x452d4b['push'](_0x452d4b['shift']());}};_0x3638f6(++_0x501ba8);}(_0x21dc,0x170));var _0xc21d=function(_0x672abe,_0x2aede4){_0x672abe=_0x672abe-0x0;var _0x413a96=_0x21dc[_0x672abe];return _0x413a96;};'use strict';var OpenchannelMessageEvents=require(_0xc21d('0x0'));var events=[_0xc21d('0x1'),_0xc21d('0x2'),_0xc21d('0x3')];function createListener(_0x9ecbf2,_0x597760){return function(_0x1fd9bd){_0x597760[_0xc21d('0x4')](_0x9ecbf2,_0x1fd9bd);};}function removeListener(_0x57fa4e,_0x57cdaa){return function(){OpenchannelMessageEvents[_0xc21d('0x5')](_0x57fa4e,_0x57cdaa);};}exports['register']=function(_0x4e492b){for(var _0x51637a=0x0,_0x193e3a=events['length'];_0x51637a<_0x193e3a;_0x51637a++){var _0x5d849f=events[_0x51637a];var _0x4be453=createListener(_0xc21d('0x6')+_0x5d849f,_0x4e492b);OpenchannelMessageEvents['on'](_0x5d849f,_0x4be453);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index cd8c25a..2922eca 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 _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 +var _0x98df=['post','create','/:id/teams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','./openchannelQueue.controller','isAuthenticated','index','/describe','describe','/:id','show','get','/:id/members','getMembers','getTeams','/:id/users','getAgents'];(function(_0x13342f,_0x3d6303){var _0x2fc1fc=function(_0x2d991f){while(--_0x2d991f){_0x13342f['push'](_0x13342f['shift']());}};_0x2fc1fc(++_0x3d6303);}(_0x98df,0xa1));var _0xf98d=function(_0x7ebb29,_0x29f0c2){_0x7ebb29=_0x7ebb29-0x0;var _0x2acf01=_0x98df[_0x7ebb29];return _0x2acf01;};'use strict';var multer=require(_0xf98d('0x0'));var util=require(_0xf98d('0x1'));var path=require(_0xf98d('0x2'));var timeout=require(_0xf98d('0x3'));var express=require('express');var router=express[_0xf98d('0x4')]();var fs_extra=require(_0xf98d('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf98d('0x6'));router['get']('/',auth[_0xf98d('0x7')](),controller[_0xf98d('0x8')]);router['get'](_0xf98d('0x9'),auth['isAuthenticated'](),controller[_0xf98d('0xa')]);router['get'](_0xf98d('0xb'),auth['isAuthenticated'](),controller[_0xf98d('0xc')]);router[_0xf98d('0xd')](_0xf98d('0xe'),auth[_0xf98d('0x7')](),controller[_0xf98d('0xf')]);router['get']('/:id/teams',auth[_0xf98d('0x7')](),controller[_0xf98d('0x10')]);router[_0xf98d('0xd')](_0xf98d('0x11'),auth[_0xf98d('0x7')](),controller[_0xf98d('0x12')]);router[_0xf98d('0x13')]('/',auth[_0xf98d('0x7')](),controller[_0xf98d('0x14')]);router[_0xf98d('0x13')](_0xf98d('0x15'),auth[_0xf98d('0x7')](),controller['addTeams']);router[_0xf98d('0x13')]('/:id/users',auth[_0xf98d('0x7')](),controller[_0xf98d('0x16')]);router[_0xf98d('0x17')](_0xf98d('0xb'),auth[_0xf98d('0x7')](),controller[_0xf98d('0x18')]);router[_0xf98d('0x19')]('/:id',auth[_0xf98d('0x7')](),controller[_0xf98d('0x1a')]);router[_0xf98d('0x19')](_0xf98d('0x15'),auth[_0xf98d('0x7')](),controller[_0xf98d('0x1b')]);router['delete'](_0xf98d('0x11'),auth[_0xf98d('0x7')](),controller[_0xf98d('0x1c')]);module[_0xf98d('0x1d')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 2204756..c4abb84 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 _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 +var _0x0d77=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','name','STRING','INTEGER'];(function(_0x385c12,_0x94f58e){var _0x5287b8=function(_0x221952){while(--_0x221952){_0x385c12['push'](_0x385c12['shift']());}};_0x5287b8(++_0x94f58e);}(_0x0d77,0x70));var _0x70d7=function(_0x42e4d7,_0x4bd202){_0x42e4d7=_0x42e4d7-0x0;var _0x346cd8=_0x0d77[_0x42e4d7];return _0x346cd8;};'use strict';var Sequelize=require(_0x70d7('0x0'));module[_0x70d7('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x70d7('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x70d7('0x3')]},'timeout':{'type':Sequelize[_0x70d7('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x70d7('0x5')](_0x70d7('0x6'),_0x70d7('0x7'),_0x70d7('0x8'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index a98f1a2..af00545 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 _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 +var _0xbd8f=['forEach','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','lodash','squel','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','then','destroy','get','OpenchannelQueues','UserProfileResource','stack','name','send','map','OpenchannelQueue','rawAttributes','fieldName','type','key','getOptions','include','query','rows','catch','show','params','model','keys','filters','intersection','attributes','fields','includeAll','merge','options','find','create','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','getMembers','UserOpenchannelQueue','length','nolimit','order','sort','where','filter','User','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','findOne','pick','getTeams','addTeams','ids','Team','findAll','Agents','voicePause','interface','flatMap','sequelize','each','findOrCreate','emit','userOpenchannelQueue:save','removeTeams','select','field','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','value','transaction','isEmpty','removeAgents'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0xbd8f,0x17b));var _0xfbd8=function(_0x520138,_0x28b48e){_0x520138=_0x520138-0x0;var _0x46b0bf=_0xbd8f[_0x520138];return _0x46b0bf;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0xfbd8('0x0'));var squel=require(_0xfbd8('0x1'));var Redis=require(_0xfbd8('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0xfbd8('0x3'))(_0xfbd8('0x4'));var config=require(_0xfbd8('0x5'));var db=require(_0xfbd8('0x6'))['db'];config['redis']=_[_0xfbd8('0x7')](config['redis'],{'host':_0xfbd8('0x8'),'port':0x18eb});var socket=require(_0xfbd8('0x9'))(new Redis(config['redis']));require(_0xfbd8('0xa'))[_0xfbd8('0xb')](socket);function respondWithStatusCode(_0x57b42d,_0x246de7){_0x246de7=_0x246de7||0xcc;return function(_0x469bb4){if(_0x469bb4){return _0x57b42d[_0xfbd8('0xc')](_0x246de7);}return _0x57b42d[_0xfbd8('0xd')](_0x246de7)[_0xfbd8('0xe')]();};}function respondWithResult(_0x1c4cf2,_0x56adf9){_0x56adf9=_0x56adf9||0xc8;return function(_0x45ea0a){if(_0x45ea0a){return _0x1c4cf2['status'](_0x56adf9)['json'](_0x45ea0a);}};}function respondWithFilteredResult(_0x5d7b48,_0x764799){return function(_0x5914da){if(_0x5914da){var _0x46d0d9=typeof _0x764799['offset']===_0xfbd8('0xf')&&typeof _0x764799[_0xfbd8('0x10')]===_0xfbd8('0xf');var _0x457018=_0x5914da[_0xfbd8('0x11')];var _0x1a630b=_0x46d0d9?0x0:_0x764799[_0xfbd8('0x12')];var _0x5ab37e=_0x46d0d9?_0x5914da['count']:_0x764799[_0xfbd8('0x12')]+_0x764799['limit'];var _0x16fbec;if(_0x5ab37e>=_0x457018){_0x5ab37e=_0x457018;_0x16fbec=0xc8;}else{_0x16fbec=0xce;}_0x5d7b48[_0xfbd8('0xd')](_0x16fbec);return _0x5d7b48[_0xfbd8('0x13')](_0xfbd8('0x14'),_0x1a630b+'-'+_0x5ab37e+'/'+_0x457018)[_0xfbd8('0x15')](_0x5914da);}return null;};}function saveUpdates(_0x1f80a4){return function(_0x47e814){if(_0x47e814){return _0x47e814['update'](_0x1f80a4)[_0xfbd8('0x16')](function(_0x17d58a){return _0x17d58a;});}return null;};}function removeEntity(_0x25ec0a){return function(_0x11cc9e){if(_0x11cc9e){return _0x11cc9e[_0xfbd8('0x17')]()[_0xfbd8('0x16')](function(){var _0x4e02e8=_0x11cc9e[_0xfbd8('0x18')]({'plain':!![]});var _0x41d2a9=_0xfbd8('0x19');return db[_0xfbd8('0x1a')][_0xfbd8('0x17')]({'where':{'type':_0x41d2a9,'resourceId':_0x4e02e8['id']}})[_0xfbd8('0x16')](function(){return _0x11cc9e;});})['then'](function(){_0x25ec0a[_0xfbd8('0xd')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ba504){return function(_0x57d5c0){if(!_0x57d5c0){_0x2ba504[_0xfbd8('0xc')](0x194);}return _0x57d5c0;};}function handleError(_0x47cfae,_0x35a666){_0x35a666=_0x35a666||0x1f4;return function(_0x10e501){logger['error'](_0x10e501[_0xfbd8('0x1b')]);if(_0x10e501[_0xfbd8('0x1c')]){delete _0x10e501[_0xfbd8('0x1c')];}_0x47cfae['status'](_0x35a666)[_0xfbd8('0x1d')](_0x10e501);};}exports['index']=function(_0x3b19a2,_0x4c01e2){var _0x372572={};var _0x3cf0a1={'count':0x0,'rows':[]};var _0x54fd12=_[_0xfbd8('0x1e')](db[_0xfbd8('0x1f')][_0xfbd8('0x20')],function(_0x407a2b){return{'name':_0x407a2b[_0xfbd8('0x21')],'type':_0x407a2b[_0xfbd8('0x22')][_0xfbd8('0x23')]};});_0x372572=qs[_0xfbd8('0x24')](_0x54fd12,_0x3b19a2);var _0x3d1011={'where':_0x372572['where']};return db['OpenchannelQueue'][_0xfbd8('0x11')](_0x3d1011)[_0xfbd8('0x16')](function(_0x3105ec){_0x3cf0a1[_0xfbd8('0x11')]=_0x3105ec;_0x372572[_0xfbd8('0x25')]=qs[_0xfbd8('0x25')](_0x3b19a2[_0xfbd8('0x26')]);return db[_0xfbd8('0x1f')]['findAll'](_0x372572);})['then'](function(_0xd84e88){_0x3cf0a1[_0xfbd8('0x27')]=_0xd84e88;return _0x3cf0a1;})[_0xfbd8('0x16')](respondWithFilteredResult(_0x4c01e2,_0x372572))[_0xfbd8('0x28')](handleError(_0x4c01e2,null));};exports[_0xfbd8('0x29')]=function(_0x50ad40,_0x4128e2){var _0x55f15f={'raw':!![],'where':{'id':_0x50ad40[_0xfbd8('0x2a')]['id']}},_0x524e55={};_0x524e55[_0xfbd8('0x2b')]=_[_0xfbd8('0x2c')](db[_0xfbd8('0x1f')][_0xfbd8('0x20')]);_0x524e55['query']=_['keys'](_0x50ad40['query']);_0x524e55[_0xfbd8('0x2d')]=_[_0xfbd8('0x2e')](_0x524e55[_0xfbd8('0x2b')],_0x524e55['query']);_0x55f15f[_0xfbd8('0x2f')]=_[_0xfbd8('0x2e')](_0x524e55[_0xfbd8('0x2b')],qs[_0xfbd8('0x30')](_0x50ad40[_0xfbd8('0x26')][_0xfbd8('0x30')]));_0x55f15f[_0xfbd8('0x2f')]=_0x55f15f[_0xfbd8('0x2f')]['length']?_0x55f15f[_0xfbd8('0x2f')]:_0x524e55[_0xfbd8('0x2b')];if(_0x50ad40[_0xfbd8('0x26')][_0xfbd8('0x31')]){_0x55f15f[_0xfbd8('0x25')]=[{'all':!![]}];}_0x55f15f=_[_0xfbd8('0x32')]({},_0x55f15f,_0x50ad40[_0xfbd8('0x33')]);return db[_0xfbd8('0x1f')][_0xfbd8('0x34')](_0x55f15f)['then'](handleEntityNotFound(_0x4128e2,null))['then'](respondWithResult(_0x4128e2,null))[_0xfbd8('0x28')](handleError(_0x4128e2,null));};exports['create']=function(_0x5422e2,_0x54bf60){return db[_0xfbd8('0x1f')][_0xfbd8('0x35')](_0x5422e2['body'],{})['then'](function(_0x40d48e){var _0x38dba4=_0x5422e2[_0xfbd8('0x36')]['get']({'plain':!![]});if(!_0x38dba4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x38dba4['role']==='user'){var _0x2b9db8=_0x40d48e[_0xfbd8('0x18')]({'plain':!![]});var _0x87df49=_0xfbd8('0x19');return db[_0xfbd8('0x37')][_0xfbd8('0x34')]({'where':{'name':_0x87df49,'userProfileId':_0x38dba4[_0xfbd8('0x38')]},'raw':!![]})['then'](function(_0x133424){if(_0x133424&&_0x133424[_0xfbd8('0x39')]===0x0){return db[_0xfbd8('0x1a')]['create']({'name':_0x2b9db8[_0xfbd8('0x1c')],'resourceId':_0x2b9db8['id'],'type':_0x133424['name'],'sectionId':_0x133424['id']},{})[_0xfbd8('0x16')](function(){return _0x40d48e;});}else{return _0x40d48e;}})[_0xfbd8('0x28')](function(_0x7be4ea){logger[_0xfbd8('0x3a')](_0xfbd8('0x3b'),_0x7be4ea);throw _0x7be4ea;});}return _0x40d48e;})['then'](respondWithResult(_0x54bf60,0xc9))[_0xfbd8('0x28')](handleError(_0x54bf60,null));};exports[_0xfbd8('0x3c')]=function(_0x40059b,_0x219d4e){if(_0x40059b[_0xfbd8('0x3d')]['id']){delete _0x40059b[_0xfbd8('0x3d')]['id'];}return db['OpenchannelQueue'][_0xfbd8('0x34')]({'where':{'id':_0x40059b[_0xfbd8('0x2a')]['id']}})[_0xfbd8('0x16')](handleEntityNotFound(_0x219d4e,null))[_0xfbd8('0x16')](saveUpdates(_0x40059b[_0xfbd8('0x3d')],null))['then'](respondWithResult(_0x219d4e,null))['catch'](handleError(_0x219d4e,null));};exports['destroy']=function(_0x5d857c,_0x5314dd){return db['OpenchannelQueue'][_0xfbd8('0x34')]({'where':{'id':_0x5d857c[_0xfbd8('0x2a')]['id']}})[_0xfbd8('0x16')](handleEntityNotFound(_0x5314dd,null))[_0xfbd8('0x16')](removeEntity(_0x5314dd,null))[_0xfbd8('0x28')](handleError(_0x5314dd,null));};exports[_0xfbd8('0x3e')]=function(_0xbcd887,_0x8cda68){return db[_0xfbd8('0x1f')][_0xfbd8('0x3e')]()['then'](respondWithResult(_0x8cda68,null))[_0xfbd8('0x28')](handleError(_0x8cda68,null));};exports[_0xfbd8('0x3f')]=function(_0x210e84,_0x4f43be){var _0x24be40={'raw':!![],'where':{}},_0x5be65a={},_0xf384ed;return db[_0xfbd8('0x1f')]['findOne']({'where':{'id':_0x210e84['params']['id']}})['then'](handleEntityNotFound(_0x4f43be,null))['then'](function(_0x3b15ec){if(_0x3b15ec){_0xf384ed=_0x3b15ec[_0xfbd8('0x18')]({'plain':!![]});_0x5be65a['model']=_[_0xfbd8('0x2c')](db[_0xfbd8('0x40')]['rawAttributes']);_0x5be65a[_0xfbd8('0x26')]=_[_0xfbd8('0x2c')](_0x210e84[_0xfbd8('0x26')]);_0x5be65a[_0xfbd8('0x2d')]=_[_0xfbd8('0x2e')](_0x5be65a[_0xfbd8('0x2b')],_0x5be65a[_0xfbd8('0x26')]);_0x24be40[_0xfbd8('0x2f')]=_[_0xfbd8('0x2e')](_0x5be65a[_0xfbd8('0x2b')],qs['fields'](_0x210e84[_0xfbd8('0x26')]['fields']));_0x24be40['attributes']=_0x24be40[_0xfbd8('0x2f')][_0xfbd8('0x41')]?_0x24be40[_0xfbd8('0x2f')]:_0x5be65a[_0xfbd8('0x2b')];if(!_0x210e84[_0xfbd8('0x26')]['hasOwnProperty'](_0xfbd8('0x42'))){_0x24be40[_0xfbd8('0x10')]=qs[_0xfbd8('0x10')](_0x210e84[_0xfbd8('0x26')]['limit']);_0x24be40['offset']=qs['offset'](_0x210e84[_0xfbd8('0x26')][_0xfbd8('0x12')]);}_0x24be40[_0xfbd8('0x43')]=qs[_0xfbd8('0x44')](_0x210e84[_0xfbd8('0x26')][_0xfbd8('0x44')]);_0x24be40['where']=qs['filters'](_['pick'](_0x210e84[_0xfbd8('0x26')],_0x5be65a['filters']));_0x24be40[_0xfbd8('0x45')]['OpenchannelQueueId']=_0x3b15ec['id'];if(_0x210e84[_0xfbd8('0x26')][_0xfbd8('0x46')]){_0x24be40[_0xfbd8('0x45')]=_[_0xfbd8('0x32')](_0x24be40[_0xfbd8('0x45')],{'$or':_['map'](_0x24be40['attributes'],function(_0x4ece82){var _0x9b768d={};_0x9b768d[_0x4ece82]={'$like':'%'+_0x210e84[_0xfbd8('0x26')]['filter']+'%'};return _0x9b768d;})});}_0x24be40=_['merge']({},_0x24be40,_0x210e84['options']);return db[_0xfbd8('0x40')]['findAll'](_0x24be40);}})[_0xfbd8('0x16')](function(_0x12308a){if(_0x12308a){return db[_0xfbd8('0x47')]['findAndCountAll']({'where':{'id':_[_0xfbd8('0x1e')](_0x12308a,_0xfbd8('0x48')),'role':_0xfbd8('0x49')},'attributes':['id',_0xfbd8('0x1c'),_0xfbd8('0x4a'),_0xfbd8('0x4b'),_0xfbd8('0x4c')]});}})[_0xfbd8('0x16')](function(_0xdfb2b8){if(_0xdfb2b8){return{'count':_0xdfb2b8['count'],'rows':_['map'](_0xdfb2b8['rows'],function(_0x13cea4){return{'membername':_0x13cea4[_0xfbd8('0x1c')],'UserId':_0x13cea4['id'],'queue_name':_0xf384ed[_0xfbd8('0x1c')],'OpenchannelQueueId':_0xf384ed['id'],'interface':util[_0xfbd8('0x4d')](_0xfbd8('0x4e'),'SIP',_0x13cea4[_0xfbd8('0x1c')]),'penalty':0x0,'paused':_0x13cea4[_0xfbd8('0x4a')],'createdAt':_0x13cea4[_0xfbd8('0x4c')],'updatedAt':_0x13cea4[_0xfbd8('0x4b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xfbd8('0x16')](respondWithFilteredResult(_0x4f43be,_0x24be40))['catch'](handleError(_0x4f43be,null));};exports['getTeams']=function(_0x13a091,_0x2225ee){var _0x21e14d={};var _0x449a6f={};var _0xf0ff04;var _0x297ba4;return db[_0xfbd8('0x1f')][_0xfbd8('0x4f')]({'where':{'id':_0x13a091[_0xfbd8('0x2a')]['id']}})['then'](handleEntityNotFound(_0x2225ee,null))[_0xfbd8('0x16')](function(_0x5c2299){if(_0x5c2299){_0xf0ff04=_0x5c2299;_0x449a6f['model']=_[_0xfbd8('0x2c')](db['Team']['rawAttributes']);_0x449a6f[_0xfbd8('0x26')]=_[_0xfbd8('0x2c')](_0x13a091[_0xfbd8('0x26')]);_0x449a6f[_0xfbd8('0x2d')]=_[_0xfbd8('0x2e')](_0x449a6f['model'],_0x449a6f[_0xfbd8('0x26')]);_0x21e14d[_0xfbd8('0x2f')]=_[_0xfbd8('0x2e')](_0x449a6f['model'],qs[_0xfbd8('0x30')](_0x13a091[_0xfbd8('0x26')][_0xfbd8('0x30')]));_0x21e14d['attributes']=_0x21e14d[_0xfbd8('0x2f')][_0xfbd8('0x41')]?_0x21e14d['attributes']:_0x449a6f[_0xfbd8('0x2b')];_0x21e14d[_0xfbd8('0x43')]=qs['sort'](_0x13a091['query'][_0xfbd8('0x44')]);_0x21e14d[_0xfbd8('0x45')]=qs[_0xfbd8('0x2d')](_[_0xfbd8('0x50')](_0x13a091[_0xfbd8('0x26')],_0x449a6f['filters']));if(_0x13a091[_0xfbd8('0x26')][_0xfbd8('0x46')]){_0x21e14d[_0xfbd8('0x45')]=_['merge'](_0x21e14d['where'],{'$or':_[_0xfbd8('0x1e')](_0x21e14d[_0xfbd8('0x2f')],function(_0x575005){var _0x599949={};_0x599949[_0x575005]={'$like':'%'+_0x13a091[_0xfbd8('0x26')][_0xfbd8('0x46')]+'%'};return _0x599949;})});}_0x21e14d=_['merge']({},_0x21e14d,_0x13a091['options']);return _0xf0ff04[_0xfbd8('0x51')](_0x21e14d);}})[_0xfbd8('0x16')](function(_0x3bad0c){if(_0x3bad0c){_0x297ba4=_0x3bad0c[_0xfbd8('0x41')];if(!_0x13a091[_0xfbd8('0x26')]['hasOwnProperty'](_0xfbd8('0x42'))){_0x21e14d[_0xfbd8('0x10')]=qs['limit'](_0x13a091[_0xfbd8('0x26')][_0xfbd8('0x10')]);_0x21e14d['offset']=qs[_0xfbd8('0x12')](_0x13a091[_0xfbd8('0x26')][_0xfbd8('0x12')]);}return _0xf0ff04[_0xfbd8('0x51')](_0x21e14d);}})[_0xfbd8('0x16')](function(_0x979d04){if(_0x979d04){return _0x979d04?{'count':_0x297ba4,'rows':_0x979d04}:null;}})['then'](respondWithResult(_0x2225ee,null))[_0xfbd8('0x28')](handleError(_0x2225ee,null));};exports[_0xfbd8('0x52')]=function(_0x4368ff,_0x7b1bb1){var _0xd42d32=_0x4368ff[_0xfbd8('0x3d')][_0xfbd8('0x53')];return db[_0xfbd8('0x54')][_0xfbd8('0x55')]({'where':{'id':_0xd42d32},'attributes':['id'],'include':[{'model':db[_0xfbd8('0x47')],'as':_0xfbd8('0x56'),'attributes':['id',_0xfbd8('0x1c'),'online',_0xfbd8('0x57'),_0xfbd8('0x58')],'raw':!![]}]})['then'](function(_0x124e06){if(_0x124e06){var _0x51626e=_[_0xfbd8('0x59')](_0x124e06,function(_0x210cba){var _0x2e67b9=_0x210cba[_0xfbd8('0x18')]({'plain':!![]});return _0x2e67b9[_0xfbd8('0x56')];});return db[_0xfbd8('0x1f')]['find']({'where':{'id':_0x4368ff[_0xfbd8('0x2a')]['id']}})[_0xfbd8('0x16')](function(_0x2c01d4){return db[_0xfbd8('0x5a')]['transaction'](function(_0x63714d){return _0x2c01d4[_0xfbd8('0x52')](_0xd42d32,{'transaction':_0x63714d})[_0xfbd8('0x16')](function(){return BPromise[_0xfbd8('0x5b')](_0x51626e,function(_0x1ac179){return db[_0xfbd8('0x40')][_0xfbd8('0x5c')]({'where':{'UserId':_0x1ac179['id'],'OpenchannelQueueId':_0x4368ff[_0xfbd8('0x2a')]['id']},'transaction':_0x63714d});});})[_0xfbd8('0x16')](function(){_0x51626e['forEach'](function(_0x4241a8){socket[_0xfbd8('0x5d')](_0xfbd8('0x5e'),{'UserId':_0x4241a8['id'],'OpenchannelQueueId':_0x2c01d4['id']});});});});});}})[_0xfbd8('0x16')](respondWithStatusCode(_0x7b1bb1,null))[_0xfbd8('0x28')](handleError(_0x7b1bb1,null));};exports[_0xfbd8('0x5f')]=function(_0x30f7c3,_0x5c190d){return db['Team'][_0xfbd8('0x55')]({'where':{'id':_0x30f7c3['query'][_0xfbd8('0x53')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5c190d,null))[_0xfbd8('0x16')](function(_0x164c86){var _0x418bc7=_['map'](_0x164c86,'id');var _0x36156e=[];var _0x247c5a=[];var _0x11527b=squel[_0xfbd8('0x60')]();_0x11527b[_0xfbd8('0x61')]('tq.TeamId')[_0xfbd8('0x62')](_0xfbd8('0x63'),'tq')[_0xfbd8('0x64')](_0xfbd8('0x65'),'ut',_0xfbd8('0x66'))[_0xfbd8('0x45')]('OpenchannelQueueId\x20=\x20?',_0x30f7c3[_0xfbd8('0x2a')]['id']);for(var _0x5770b6=0x0;_0x5770b6<_0x164c86['length'];_0x5770b6+=0x1){let _0x903524=_0x164c86[_0x5770b6];for(var _0x3dd80e=0x0;_0x3dd80e<_0x903524[_0xfbd8('0x56')][_0xfbd8('0x41')];_0x3dd80e+=0x1){let _0x24986b=_0x903524['Agents'][_0x3dd80e];var _0x57ddcf=_0x11527b['clone']();_0x57ddcf[_0xfbd8('0x45')](_0xfbd8('0x67'),_0x24986b['id']);_0x247c5a[_0xfbd8('0x68')](db[_0xfbd8('0x5a')][_0xfbd8('0x26')](_0x57ddcf[_0xfbd8('0x69')](),{'type':db[_0xfbd8('0x5a')][_0xfbd8('0x6a')][_0xfbd8('0x6b')]})[_0xfbd8('0x16')](function(_0x3a7003){if(_0x3a7003[_0xfbd8('0x41')]===0x1){return _0x24986b['id'];}else{var _0x336d74=_[_0xfbd8('0x6c')](_[_0xfbd8('0x1e')](_0x3a7003,_0xfbd8('0x6d')),function(_0x1328d3){return _[_0xfbd8('0x6e')](_0x418bc7,_0x1328d3);});if(_0x336d74){return _0x24986b['id'];}}}));}}return BPromise[_0xfbd8('0x6f')](_0x247c5a)['then'](function(_0x49228a){_0x36156e=_(_0x36156e)[_0xfbd8('0x70')](_0x49228a)['compact']()[_0xfbd8('0x71')]();return db[_0xfbd8('0x1f')][_0xfbd8('0x34')]({'where':{'id':_0x30f7c3['params']['id']}})['then'](function(_0x525913){return db['sequelize'][_0xfbd8('0x72')](function(_0xda131e){return _0x525913[_0xfbd8('0x5f')](_0x30f7c3[_0xfbd8('0x26')][_0xfbd8('0x53')],{'transaction':_0xda131e})[_0xfbd8('0x16')](function(){if(!_[_0xfbd8('0x73')](_0x36156e)){return _0x525913[_0xfbd8('0x74')](_0x36156e,{'transaction':_0xda131e});}})[_0xfbd8('0x16')](function(){_0x36156e[_0xfbd8('0x75')](function(_0x323da0){socket[_0xfbd8('0x5d')](_0xfbd8('0x76'),{'UserId':_0x323da0,'OpenchannelQueueId':_0x525913['id']});});});});});});})['then'](respondWithStatusCode(_0x5c190d,null))['catch'](handleError(_0x5c190d,null));};exports[_0xfbd8('0x77')]=function(_0x43c51f,_0x5a9236){return db[_0xfbd8('0x1f')]['find']({'where':{'id':_0x43c51f[_0xfbd8('0x2a')]['id']}})['then'](handleEntityNotFound(_0x5a9236,null))[_0xfbd8('0x16')](function(_0x516ae3){if(_0x516ae3){return _0x516ae3[_0xfbd8('0x77')](_0x43c51f[_0xfbd8('0x3d')][_0xfbd8('0x53')],_[_0xfbd8('0x78')](_0x43c51f[_0xfbd8('0x3d')],['ids','id'])||{})[_0xfbd8('0x79')](function(_0x4441c8){for(var _0x55ef48=0x0;_0x55ef48<_0x43c51f[_0xfbd8('0x3d')][_0xfbd8('0x53')]['length'];_0x55ef48+=0x1){socket[_0xfbd8('0x5d')](_0xfbd8('0x5e'),{'UserId':Number(_0x43c51f[_0xfbd8('0x3d')][_0xfbd8('0x53')][_0x55ef48]),'OpenchannelQueueId':Number(_0x43c51f[_0xfbd8('0x2a')]['id'])});}return _0x4441c8;});}})['then'](respondWithResult(_0x5a9236,null))['catch'](handleError(_0x5a9236,null));};exports[_0xfbd8('0x74')]=function(_0x541f54,_0x36323b){return db[_0xfbd8('0x1f')][_0xfbd8('0x34')]({'where':{'id':_0x541f54['params']['id']}})[_0xfbd8('0x16')](handleEntityNotFound(_0x36323b,null))['then'](function(_0x35ebfe){if(_0x35ebfe){return _0x35ebfe['removeAgents'](_0x541f54[_0xfbd8('0x26')][_0xfbd8('0x53')])[_0xfbd8('0x16')](function(){if(_[_0xfbd8('0x7a')](_0x541f54[_0xfbd8('0x26')][_0xfbd8('0x53')])){for(var _0x2d36b3=0x0;_0x2d36b3<_0x541f54[_0xfbd8('0x26')][_0xfbd8('0x53')][_0xfbd8('0x41')];_0x2d36b3+=0x1){socket[_0xfbd8('0x5d')](_0xfbd8('0x76'),{'UserId':Number(_0x541f54[_0xfbd8('0x26')][_0xfbd8('0x53')][_0x2d36b3]),'OpenchannelQueueId':Number(_0x541f54[_0xfbd8('0x2a')]['id'])});}}else{socket[_0xfbd8('0x5d')]('userOpenchannelQueue:remove',{'UserId':Number(_0x541f54[_0xfbd8('0x26')][_0xfbd8('0x53')]),'OpenchannelQueueId':Number(_0x541f54[_0xfbd8('0x2a')]['id'])});}});}})[_0xfbd8('0x16')](respondWithStatusCode(_0x36323b,null))[_0xfbd8('0x28')](handleError(_0x36323b,null));};exports[_0xfbd8('0x7b')]=function(_0x249319,_0x224526){var _0x5f5890={};var _0xf0b0ce={};var _0xfe5810;var _0x488c6f;return db['OpenchannelQueue'][_0xfbd8('0x4f')]({'where':{'id':_0x249319[_0xfbd8('0x2a')]['id']}})[_0xfbd8('0x16')](handleEntityNotFound(_0x224526,null))[_0xfbd8('0x16')](function(_0x379809){if(_0x379809){_0xfe5810=_0x379809;_0xf0b0ce[_0xfbd8('0x2b')]=_['keys'](db[_0xfbd8('0x47')][_0xfbd8('0x20')]);_0xf0b0ce[_0xfbd8('0x26')]=_[_0xfbd8('0x2c')](_0x249319[_0xfbd8('0x26')]);_0xf0b0ce[_0xfbd8('0x2d')]=_[_0xfbd8('0x2e')](_0xf0b0ce[_0xfbd8('0x2b')],_0xf0b0ce[_0xfbd8('0x26')]);_0x5f5890['attributes']=_[_0xfbd8('0x2e')](_0xf0b0ce['model'],qs[_0xfbd8('0x30')](_0x249319[_0xfbd8('0x26')][_0xfbd8('0x30')]));_0x5f5890[_0xfbd8('0x2f')]=_0x5f5890[_0xfbd8('0x2f')][_0xfbd8('0x41')]?_0x5f5890[_0xfbd8('0x2f')]:_0xf0b0ce[_0xfbd8('0x2b')];_0x5f5890['order']=qs[_0xfbd8('0x44')](_0x249319[_0xfbd8('0x26')][_0xfbd8('0x44')]);_0x5f5890[_0xfbd8('0x45')]=qs['filters'](_[_0xfbd8('0x50')](_0x249319['query'],_0xf0b0ce[_0xfbd8('0x2d')]));if(_0x249319[_0xfbd8('0x26')]['filter']){_0x5f5890[_0xfbd8('0x45')]=_[_0xfbd8('0x32')](_0x5f5890[_0xfbd8('0x45')],{'$or':_[_0xfbd8('0x1e')](_0x5f5890[_0xfbd8('0x2f')],function(_0x5ae310){var _0x2b973f={};_0x2b973f[_0x5ae310]={'$like':'%'+_0x249319[_0xfbd8('0x26')][_0xfbd8('0x46')]+'%'};return _0x2b973f;})});}_0x5f5890=_[_0xfbd8('0x32')]({},_0x5f5890,_0x249319[_0xfbd8('0x33')]);return _0xfe5810[_0xfbd8('0x7b')](_0x5f5890);}})['then'](function(_0x45f7aa){if(_0x45f7aa){_0x488c6f=_0x45f7aa[_0xfbd8('0x41')];if(!_0x249319[_0xfbd8('0x26')]['hasOwnProperty'](_0xfbd8('0x42'))){_0x5f5890['limit']=qs[_0xfbd8('0x10')](_0x249319[_0xfbd8('0x26')]['limit']);_0x5f5890[_0xfbd8('0x12')]=qs['offset'](_0x249319['query'][_0xfbd8('0x12')]);}return _0xfe5810['getAgents'](_0x5f5890);}})[_0xfbd8('0x16')](function(_0x560d29){if(_0x560d29){return _0x560d29?{'count':_0x488c6f,'rows':_0x560d29}:null;}})['then'](respondWithResult(_0x224526,null))['catch'](handleError(_0x224526,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 24ca4a1..c890799 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 _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 +var _0x6aa2=['save','update','emit','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelQueue','setMaxListeners'];(function(_0x50d822,_0x1191f7){var _0x4ac4e1=function(_0x31909a){while(--_0x31909a){_0x50d822['push'](_0x50d822['shift']());}};_0x4ac4e1(++_0x1191f7);}(_0x6aa2,0x15c));var _0x26aa=function(_0x4d8dc3,_0x585fd1){_0x4d8dc3=_0x4d8dc3-0x0;var _0x9b03d9=_0x6aa2[_0x4d8dc3];return _0x9b03d9;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0x26aa('0x0'))['db'][_0x26aa('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x26aa('0x2')](0x0);var events={'afterCreate':_0x26aa('0x3'),'afterUpdate':_0x26aa('0x4'),'afterDestroy':'remove'};function emitEvent(_0x6a0d6b){return function(_0x4964c0,_0x18c6f2,_0x40aee5){OpenchannelQueueEvents[_0x26aa('0x5')](_0x6a0d6b+':'+_0x4964c0['id'],_0x4964c0);OpenchannelQueueEvents[_0x26aa('0x5')](_0x6a0d6b,_0x4964c0);_0x40aee5(null);};}for(var e in events){if(events[_0x26aa('0x6')](e)){var event=events[e];OpenchannelQueue[_0x26aa('0x7')](e,emitEvent(event));}}module[_0x26aa('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 a99302c..2f5c753 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 _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 +var _0xee90=['util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelQueue.attributes','exports','lodash'];(function(_0x44c935,_0x3653f0){var _0x465bee=function(_0x211d20){while(--_0x211d20){_0x44c935['push'](_0x44c935['shift']());}};_0x465bee(++_0x3653f0);}(_0xee90,0x149));var _0x0ee9=function(_0x333555,_0x39f547){_0x333555=_0x333555-0x0;var _0x52d811=_0xee90[_0x333555];return _0x52d811;};'use strict';var _=require(_0x0ee9('0x0'));var util=require(_0x0ee9('0x1'));var logger=require('../../config/logger')(_0x0ee9('0x2'));var moment=require(_0x0ee9('0x3'));var BPromise=require(_0x0ee9('0x4'));var rp=require(_0x0ee9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0ee9('0x6'));var config=require(_0x0ee9('0x7'));var attributes=require(_0x0ee9('0x8'));module[_0x0ee9('0x9')]=function(_0xb6282,_0x11bed2){return _0xb6282['define']('OpenchannelQueue',attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index b784b6a..3797dc0 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 _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 +var _0xdd7b=['socket.io-emitter','./openchannelQueue.socket','register','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetOpenchannelQueue','findAll','options','raw','attributes','include','map','model','ShowOpenchannelQueue','OpenchannelQueue','where','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x231b2e,_0x2a33f9){var _0x3feb2a=function(_0x5aa472){while(--_0x5aa472){_0x231b2e['push'](_0x231b2e['shift']());}};_0x3feb2a(++_0x2a33f9);}(_0xdd7b,0xb4));var _0xbdd7=function(_0x44a450,_0xe6e7b0){_0x44a450=_0x44a450-0x0;var _0x42981c=_0xdd7b[_0x44a450];return _0x42981c;};'use strict';var _=require(_0xbdd7('0x0'));var util=require(_0xbdd7('0x1'));var moment=require(_0xbdd7('0x2'));var BPromise=require(_0xbdd7('0x3'));var rs=require(_0xbdd7('0x4'));var fs=require('fs');var Redis=require(_0xbdd7('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xbdd7('0x6'));var logger=require('../../config/logger')(_0xbdd7('0x7'));var config=require(_0xbdd7('0x8'));var jayson=require(_0xbdd7('0x9'));var client=jayson[_0xbdd7('0xa')][_0xbdd7('0xb')]({'port':0x232a});config[_0xbdd7('0xc')]=_[_0xbdd7('0xd')](config[_0xbdd7('0xc')],{'host':_0xbdd7('0xe'),'port':0x18eb});var socket=require(_0xbdd7('0xf'))(new Redis(config[_0xbdd7('0xc')]));require(_0xbdd7('0x10'))[_0xbdd7('0x11')](socket);function respondWithRpcPromise(_0x4ab7f8,_0x1fac46,_0x181473){return new BPromise(function(_0x2b9517,_0x36d2a2){return client['request'](_0x4ab7f8,_0x181473)[_0xbdd7('0x12')](function(_0x639826){logger[_0xbdd7('0x13')](_0xbdd7('0x14'),_0x1fac46,_0xbdd7('0x15'));logger[_0xbdd7('0x16')](_0xbdd7('0x17'),_0x1fac46,'request\x20sent',JSON[_0xbdd7('0x18')](_0x639826));if(_0x639826[_0xbdd7('0x19')]){if(_0x639826[_0xbdd7('0x19')]['code']===0x1f4){logger[_0xbdd7('0x19')]('OpenchannelQueue,\x20%s,\x20%s',_0x1fac46,_0x639826[_0xbdd7('0x19')][_0xbdd7('0x1a')]);return _0x36d2a2(_0x639826[_0xbdd7('0x19')][_0xbdd7('0x1a')]);}logger['error'](_0xbdd7('0x14'),_0x1fac46,_0x639826['error'][_0xbdd7('0x1a')]);return _0x2b9517(_0x639826[_0xbdd7('0x19')]['message']);}else{logger[_0xbdd7('0x13')](_0xbdd7('0x14'),_0x1fac46,'request\x20sent');_0x2b9517(_0x639826['result'][_0xbdd7('0x1a')]);}})[_0xbdd7('0x1b')](function(_0x4ac05a){logger[_0xbdd7('0x19')](_0xbdd7('0x14'),_0x1fac46,_0x4ac05a);_0x36d2a2(_0x4ac05a);});});}exports[_0xbdd7('0x1c')]=function(_0x15caaf){var _0x34e586=this;return new Promise(function(_0x859926,_0x2d069b){return db['OpenchannelQueue'][_0xbdd7('0x1d')]({'raw':_0x15caaf['options']?_0x15caaf[_0xbdd7('0x1e')][_0xbdd7('0x1f')]===undefined?!![]:![]:!![],'where':_0x15caaf[_0xbdd7('0x1e')]?_0x15caaf[_0xbdd7('0x1e')]['where']||null:null,'attributes':_0x15caaf['options']?_0x15caaf[_0xbdd7('0x1e')][_0xbdd7('0x20')]||null:null,'limit':_0x15caaf[_0xbdd7('0x1e')]?_0x15caaf[_0xbdd7('0x1e')]['limit']||null:null,'include':_0x15caaf[_0xbdd7('0x1e')]?_0x15caaf[_0xbdd7('0x1e')][_0xbdd7('0x21')]?_[_0xbdd7('0x22')](_0x15caaf['options'][_0xbdd7('0x21')],function(_0x2783a7){return{'model':db[_0x2783a7[_0xbdd7('0x23')]],'as':_0x2783a7['as'],'attributes':_0x2783a7['attributes'],'include':_0x2783a7[_0xbdd7('0x21')]?_[_0xbdd7('0x22')](_0x2783a7['include'],function(_0x2c9241){return{'model':db[_0x2c9241[_0xbdd7('0x23')]],'as':_0x2c9241['as'],'attributes':_0x2c9241[_0xbdd7('0x20')],'include':_0x2c9241['include']?_[_0xbdd7('0x22')](_0x2c9241[_0xbdd7('0x21')],function(_0x178355){return{'model':db[_0x178355[_0xbdd7('0x23')]],'as':_0x178355['as'],'attributes':_0x178355['attributes']};}):[]};}):[]};}):[]:[]})[_0xbdd7('0x12')](function(_0x4168dd){logger[_0xbdd7('0x13')](_0xbdd7('0x1c'),_0x15caaf);logger[_0xbdd7('0x16')](_0xbdd7('0x1c'),_0x15caaf,JSON[_0xbdd7('0x18')](_0x4168dd));_0x859926(_0x4168dd);})[_0xbdd7('0x1b')](function(_0x5241db){logger[_0xbdd7('0x19')]('GetOpenchannelQueue',_0x5241db[_0xbdd7('0x1a')],_0x15caaf);_0x2d069b(_0x34e586[_0xbdd7('0x19')](0x1f4,_0x5241db[_0xbdd7('0x1a')]));});});};exports[_0xbdd7('0x24')]=function(_0x588fd1){var _0x47e7a3=this;return new Promise(function(_0xaf54bd,_0x46ebf1){return db[_0xbdd7('0x25')]['find']({'raw':_0x588fd1[_0xbdd7('0x1e')]?_0x588fd1[_0xbdd7('0x1e')][_0xbdd7('0x1f')]===undefined?!![]:![]:!![],'where':_0x588fd1['options']?_0x588fd1[_0xbdd7('0x1e')][_0xbdd7('0x26')]||null:null,'attributes':_0x588fd1[_0xbdd7('0x1e')]?_0x588fd1[_0xbdd7('0x1e')][_0xbdd7('0x20')]||null:null,'include':_0x588fd1[_0xbdd7('0x1e')]?_0x588fd1['options'][_0xbdd7('0x21')]?_[_0xbdd7('0x22')](_0x588fd1['options'][_0xbdd7('0x21')],function(_0x3a042f){return{'model':db[_0x3a042f[_0xbdd7('0x23')]],'as':_0x3a042f['as'],'attributes':_0x3a042f[_0xbdd7('0x20')],'include':_0x3a042f[_0xbdd7('0x21')]?_[_0xbdd7('0x22')](_0x3a042f['include'],function(_0x55d370){return{'model':db[_0x55d370[_0xbdd7('0x23')]],'as':_0x55d370['as'],'attributes':_0x55d370[_0xbdd7('0x20')],'include':_0x55d370['include']?_[_0xbdd7('0x22')](_0x55d370[_0xbdd7('0x21')],function(_0x33a61d){return{'model':db[_0x33a61d[_0xbdd7('0x23')]],'as':_0x33a61d['as'],'attributes':_0x33a61d[_0xbdd7('0x20')]};}):[]};}):[]};}):[]:[]})[_0xbdd7('0x12')](function(_0x3a7274){logger[_0xbdd7('0x13')]('ShowOpenchannelQueue',_0x588fd1);logger['debug'](_0xbdd7('0x24'),_0x588fd1,JSON[_0xbdd7('0x18')](_0x3a7274));_0xaf54bd(_0x3a7274);})[_0xbdd7('0x1b')](function(_0x42b192){logger[_0xbdd7('0x19')](_0xbdd7('0x24'),_0x42b192['message'],_0x588fd1);_0x46ebf1(_0x47e7a3[_0xbdd7('0x19')](0x1f4,_0x42b192[_0xbdd7('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 26dbf41..7c1ebdd 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 _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 +var _0xca26=['save','remove','update','removeListener','register','openchannelQueue:','./openchannelQueue.events'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xca26,0x195));var _0x6ca2=function(_0x3ca34b,_0x15ee09){_0x3ca34b=_0x3ca34b-0x0;var _0x581482=_0xca26[_0x3ca34b];return _0x581482;};'use strict';var OpenchannelQueueEvents=require(_0x6ca2('0x0'));var events=[_0x6ca2('0x1'),_0x6ca2('0x2'),_0x6ca2('0x3')];function createListener(_0x507982,_0x1e6f12){return function(_0x5b2869){_0x1e6f12['emit'](_0x507982,_0x5b2869);};}function removeListener(_0x26e9c0,_0xadb89a){return function(){OpenchannelQueueEvents[_0x6ca2('0x4')](_0x26e9c0,_0xadb89a);};}exports[_0x6ca2('0x5')]=function(_0x1ab195){for(var _0x434dad=0x0,_0x8bf811=events['length'];_0x434dad<_0x8bf811;_0x434dad++){var _0x3bd578=events[_0x434dad];var _0x33b8f0=createListener(_0x6ca2('0x6')+_0x3bd578,_0x1ab195);OpenchannelQueueEvents['on'](_0x3bd578,_0x33b8f0);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 253fde5..37d8312 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 _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 +var _0x3c74=['isAuthenticated','create','update','destroy','exports','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','index','/describe','describe','/:id','post'];(function(_0x3f0939,_0xd1cf71){var _0x403017=function(_0x10e806){while(--_0x10e806){_0x3f0939['push'](_0x3f0939['shift']());}};_0x403017(++_0xd1cf71);}(_0x3c74,0xa7));var _0x43c7=function(_0x6e9d83,_0x36225b){_0x6e9d83=_0x6e9d83-0x0;var _0xca3bbe=_0x3c74[_0x6e9d83];return _0xca3bbe;};'use strict';var multer=require(_0x43c7('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x43c7('0x1'));var express=require(_0x43c7('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43c7('0x3'));var interaction=require(_0x43c7('0x4'));var config=require(_0x43c7('0x5'));var controller=require(_0x43c7('0x6'));router[_0x43c7('0x7')]('/',auth['isAuthenticated'](),controller[_0x43c7('0x8')]);router[_0x43c7('0x7')](_0x43c7('0x9'),auth['isAuthenticated'](),controller[_0x43c7('0xa')]);router[_0x43c7('0x7')](_0x43c7('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x43c7('0xc')]('/',auth[_0x43c7('0xd')](),controller[_0x43c7('0xe')]);router['put'](_0x43c7('0xb'),auth['isAuthenticated'](),controller[_0x43c7('0xf')]);router['delete'](_0x43c7('0xb'),auth[_0x43c7('0xd')](),controller[_0x43c7('0x10')]);module[_0x43c7('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index ddb6406..dbd1093 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 _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 +var _0xe97a=['STRING','DATE','moment','sequelize'];(function(_0x397742,_0x145401){var _0x287e25=function(_0x5e882b){while(--_0x5e882b){_0x397742['push'](_0x397742['shift']());}};_0x287e25(++_0x145401);}(_0xe97a,0x9a));var _0xae97=function(_0x2781b0,_0x4ec0d2){_0x2781b0=_0x2781b0-0x0;var _0xb532ba=_0xe97a[_0x2781b0];return _0xb532ba;};'use strict';var moment=require(_0xae97('0x0'));var Sequelize=require(_0xae97('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xae97('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xae97('0x2')]},'joinAt':{'type':Sequelize[_0xae97('0x3')]},'leaveAt':{'type':Sequelize[_0xae97('0x3')]},'acceptAt':{'type':Sequelize[_0xae97('0x3')]},'exitAt':{'type':Sequelize[_0xae97('0x3')]},'reason':{'type':Sequelize[_0xae97('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 6e3f70f..0c06324 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 _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 +var _0xf427=['to-csv','ejs','fs-extra','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','end','json','undefined','limit','count','offset','status','set','apply','reject','update','then','destroy','error','stack','name','map','OpenchannelQueueReport','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','params','find','create','body','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox'];(function(_0x17e9fa,_0x266b4d){var _0x594f93=function(_0x40bcca){while(--_0x40bcca){_0x17e9fa['push'](_0x17e9fa['shift']());}};_0x594f93(++_0x266b4d);}(_0xf427,0x7b));var _0x7f42=function(_0x2c75ad,_0x88fd95){_0x2c75ad=_0x2c75ad-0x0;var _0x43a37e=_0xf427[_0x2c75ad];return _0x43a37e;};'use strict';var emlformat=require(_0x7f42('0x0'));var rimraf=require(_0x7f42('0x1'));var zipdir=require(_0x7f42('0x2'));var jsonpatch=require(_0x7f42('0x3'));var rp=require(_0x7f42('0x4'));var moment=require('moment');var BPromise=require(_0x7f42('0x5'));var Mustache=require(_0x7f42('0x6'));var util=require('util');var path=require(_0x7f42('0x7'));var sox=require(_0x7f42('0x8'));var csv=require(_0x7f42('0x9'));var ejs=require(_0x7f42('0xa'));var fs=require('fs');var fs_extra=require(_0x7f42('0xb'));var _=require(_0x7f42('0xc'));var squel=require('squel');var crypto=require(_0x7f42('0xd'));var jsforce=require(_0x7f42('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7f42('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7f42('0xf'));var authService=require(_0x7f42('0x10'));var qs=require(_0x7f42('0x11'));var as=require(_0x7f42('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x7f42('0x13'));var config=require(_0x7f42('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1aa217,_0x392a40){_0x392a40=_0x392a40||0xcc;return function(_0x24b404){if(_0x24b404){return _0x1aa217['sendStatus'](_0x392a40);}return _0x1aa217['status'](_0x392a40)[_0x7f42('0x15')]();};}function respondWithResult(_0xcbea7e,_0x432001){_0x432001=_0x432001||0xc8;return function(_0xff2463){if(_0xff2463){return _0xcbea7e['status'](_0x432001)[_0x7f42('0x16')](_0xff2463);}};}function respondWithFilteredResult(_0x16365d,_0x4fc58f){return function(_0xa172eb){if(_0xa172eb){var _0xbed035=typeof _0x4fc58f['offset']===_0x7f42('0x17')&&typeof _0x4fc58f[_0x7f42('0x18')]===_0x7f42('0x17');var _0x2515a9=_0xa172eb[_0x7f42('0x19')];var _0x4f9cf8=_0xbed035?0x0:_0x4fc58f[_0x7f42('0x1a')];var _0x3b5a28=_0xbed035?_0xa172eb['count']:_0x4fc58f[_0x7f42('0x1a')]+_0x4fc58f['limit'];var _0x221af6;if(_0x3b5a28>=_0x2515a9){_0x3b5a28=_0x2515a9;_0x221af6=0xc8;}else{_0x221af6=0xce;}_0x16365d[_0x7f42('0x1b')](_0x221af6);return _0x16365d[_0x7f42('0x1c')]('Content-Range',_0x4f9cf8+'-'+_0x3b5a28+'/'+_0x2515a9)[_0x7f42('0x16')](_0xa172eb);}return null;};}function patchUpdates(_0x3cfa08){return function(_0x2ab117){try{jsonpatch[_0x7f42('0x1d')](_0x2ab117,_0x3cfa08,!![]);}catch(_0x3b7d78){return BPromise[_0x7f42('0x1e')](_0x3b7d78);}return _0x2ab117['save']();};}function saveUpdates(_0x475cf2,_0x843ea9){return function(_0x2e11d6){if(_0x2e11d6){return _0x2e11d6[_0x7f42('0x1f')](_0x475cf2)[_0x7f42('0x20')](function(_0x51b15d){return _0x51b15d;});}return null;};}function removeEntity(_0x450651,_0x4445a5){return function(_0x221258){if(_0x221258){return _0x221258[_0x7f42('0x21')]()[_0x7f42('0x20')](function(){_0x450651['status'](0xcc)[_0x7f42('0x15')]();});}};}function handleEntityNotFound(_0x1809f7,_0x3ff5a6){return function(_0x45076d){if(!_0x45076d){_0x1809f7['sendStatus'](0x194);}return _0x45076d;};}function handleError(_0x15d5fb,_0x5c3148){_0x5c3148=_0x5c3148||0x1f4;return function(_0x505509){logger[_0x7f42('0x22')](_0x505509[_0x7f42('0x23')]);if(_0x505509[_0x7f42('0x24')]){delete _0x505509['name'];}_0x15d5fb[_0x7f42('0x1b')](_0x5c3148)['send'](_0x505509);};}exports['index']=function(_0x4f2f87,_0xb053d6){var _0x14a033={},_0x33e223={},_0x3b68b9={'count':0x0,'rows':[]};var _0x5de977=_[_0x7f42('0x25')](db[_0x7f42('0x26')]['rawAttributes'],function(_0x4f4911){return{'name':_0x4f4911['fieldName'],'type':_0x4f4911[_0x7f42('0x27')][_0x7f42('0x28')]};});_0x33e223[_0x7f42('0x29')]=_[_0x7f42('0x25')](_0x5de977,'name');_0x33e223[_0x7f42('0x2a')]=_[_0x7f42('0x2b')](_0x4f2f87['query']);_0x33e223[_0x7f42('0x2c')]=_['intersection'](_0x33e223['model'],_0x33e223[_0x7f42('0x2a')]);_0x14a033[_0x7f42('0x2d')]=_[_0x7f42('0x2e')](_0x33e223['model'],qs[_0x7f42('0x2f')](_0x4f2f87['query'][_0x7f42('0x2f')]));_0x14a033['attributes']=_0x14a033[_0x7f42('0x2d')][_0x7f42('0x30')]?_0x14a033['attributes']:_0x33e223['model'];if(!_0x4f2f87[_0x7f42('0x2a')][_0x7f42('0x31')](_0x7f42('0x32'))){_0x14a033[_0x7f42('0x18')]=qs[_0x7f42('0x18')](_0x4f2f87[_0x7f42('0x2a')][_0x7f42('0x18')]);_0x14a033[_0x7f42('0x1a')]=qs[_0x7f42('0x1a')](_0x4f2f87['query'][_0x7f42('0x1a')]);}_0x14a033['order']=qs[_0x7f42('0x33')](_0x4f2f87['query'][_0x7f42('0x33')]);_0x14a033[_0x7f42('0x34')]=qs['filters'](_[_0x7f42('0x35')](_0x4f2f87['query'],_0x33e223['filters']),_0x5de977);if(_0x4f2f87[_0x7f42('0x2a')][_0x7f42('0x36')]){_0x14a033[_0x7f42('0x34')]=_['merge'](_0x14a033['where'],{'$or':_[_0x7f42('0x25')](_0x5de977,function(_0x5e9ae9){if(_0x5e9ae9['type']!==_0x7f42('0x37')){var _0x51fac9={};_0x51fac9[_0x5e9ae9[_0x7f42('0x24')]]={'$like':'%'+_0x4f2f87[_0x7f42('0x2a')][_0x7f42('0x36')]+'%'};return _0x51fac9;}})});}_0x14a033=_[_0x7f42('0x38')]({},_0x14a033,_0x4f2f87[_0x7f42('0x39')]);var _0x3f7d69={'where':_0x14a033[_0x7f42('0x34')]};return db[_0x7f42('0x26')][_0x7f42('0x19')](_0x3f7d69)[_0x7f42('0x20')](function(_0x5343b6){_0x3b68b9[_0x7f42('0x19')]=_0x5343b6;if(_0x4f2f87[_0x7f42('0x2a')][_0x7f42('0x3a')]){_0x14a033[_0x7f42('0x3b')]=[{'all':!![]}];}return db[_0x7f42('0x26')]['findAll'](_0x14a033);})[_0x7f42('0x20')](function(_0x50bca3){_0x3b68b9['rows']=_0x50bca3;return _0x3b68b9;})[_0x7f42('0x20')](respondWithFilteredResult(_0xb053d6,_0x14a033))['catch'](handleError(_0xb053d6,null));};exports['show']=function(_0x5623a3,_0x5f35d1){var _0x1031dd={'raw':!![],'where':{'id':_0x5623a3[_0x7f42('0x3c')]['id']}},_0x47d403={};_0x47d403['model']=_[_0x7f42('0x2b')](db[_0x7f42('0x26')]['rawAttributes']);_0x47d403[_0x7f42('0x2a')]=_[_0x7f42('0x2b')](_0x5623a3[_0x7f42('0x2a')]);_0x47d403[_0x7f42('0x2c')]=_[_0x7f42('0x2e')](_0x47d403['model'],_0x47d403[_0x7f42('0x2a')]);_0x1031dd[_0x7f42('0x2d')]=_[_0x7f42('0x2e')](_0x47d403['model'],qs[_0x7f42('0x2f')](_0x5623a3['query']['fields']));_0x1031dd[_0x7f42('0x2d')]=_0x1031dd[_0x7f42('0x2d')]['length']?_0x1031dd[_0x7f42('0x2d')]:_0x47d403[_0x7f42('0x29')];if(_0x5623a3[_0x7f42('0x2a')][_0x7f42('0x3a')]){_0x1031dd['include']=[{'all':!![]}];}_0x1031dd=_['merge']({},_0x1031dd,_0x5623a3['options']);return db[_0x7f42('0x26')][_0x7f42('0x3d')](_0x1031dd)[_0x7f42('0x20')](handleEntityNotFound(_0x5f35d1,null))[_0x7f42('0x20')](respondWithResult(_0x5f35d1,null))['catch'](handleError(_0x5f35d1,null));};exports[_0x7f42('0x3e')]=function(_0x2abf34,_0x1baec9){return db[_0x7f42('0x26')][_0x7f42('0x3e')](_0x2abf34[_0x7f42('0x3f')],{})['then'](respondWithResult(_0x1baec9,0xc9))[_0x7f42('0x40')](handleError(_0x1baec9,null));};exports[_0x7f42('0x1f')]=function(_0x226e75,_0x1ab96e){if(_0x226e75[_0x7f42('0x3f')]['id']){delete _0x226e75[_0x7f42('0x3f')]['id'];}return db['OpenchannelQueueReport']['find']({'where':{'id':_0x226e75['params']['id']}})[_0x7f42('0x20')](handleEntityNotFound(_0x1ab96e,null))[_0x7f42('0x20')](saveUpdates(_0x226e75[_0x7f42('0x3f')],null))['then'](respondWithResult(_0x1ab96e,null))[_0x7f42('0x40')](handleError(_0x1ab96e,null));};exports[_0x7f42('0x21')]=function(_0x4374a1,_0x14c1fc){return db[_0x7f42('0x26')][_0x7f42('0x3d')]({'where':{'id':_0x4374a1[_0x7f42('0x3c')]['id']}})['then'](handleEntityNotFound(_0x14c1fc,null))['then'](removeEntity(_0x14c1fc,null))[_0x7f42('0x40')](handleError(_0x14c1fc,null));};exports[_0x7f42('0x41')]=function(_0x4b90d7,_0x5b9eb1){return db[_0x7f42('0x26')][_0x7f42('0x41')]()[_0x7f42('0x20')](respondWithResult(_0x5b9eb1,null))[_0x7f42('0x40')](handleError(_0x5b9eb1,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 3554ec6..9496935 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(_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 +var _0xe14b=['bluebird','path','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','moment'];(function(_0x821dba,_0x569953){var _0x1a4dac=function(_0xf42187){while(--_0xf42187){_0x821dba['push'](_0x821dba['shift']());}};_0x1a4dac(++_0x569953);}(_0xe14b,0x93));var _0xbe14=function(_0x4c38b2,_0x226268){_0x4c38b2=_0x4c38b2-0x0;var _0x598ad5=_0xe14b[_0x4c38b2];return _0x598ad5;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 2a477b3..77ab1f9 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 _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 +var _0x6ac2=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','body','then','debug','UpdateOpenchannelQueueReport','update','raw','options','where','attributes','lodash','moment'];(function(_0xdc68bd,_0x1a1b2b){var _0x493068=function(_0xf2ffd2){while(--_0xf2ffd2){_0xdc68bd['push'](_0xdc68bd['shift']());}};_0x493068(++_0x1a1b2b);}(_0x6ac2,0x184));var _0x26ac=function(_0x44f4d4,_0x22db88){_0x44f4d4=_0x44f4d4-0x0;var _0x410aa6=_0x6ac2[_0x44f4d4];return _0x410aa6;};'use strict';var _=require(_0x26ac('0x0'));var util=require('util');var moment=require(_0x26ac('0x1'));var BPromise=require(_0x26ac('0x2'));var rs=require(_0x26ac('0x3'));var fs=require('fs');var Redis=require(_0x26ac('0x4'));var db=require(_0x26ac('0x5'))['db'];var utils=require(_0x26ac('0x6'));var logger=require('../../config/logger')(_0x26ac('0x7'));var config=require('../../config/environment');var jayson=require(_0x26ac('0x8'));var client=jayson[_0x26ac('0x9')][_0x26ac('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x159ba6,_0x36389c,_0x444ca1){return new BPromise(function(_0x1906d0,_0xd8b1e5){return client['request'](_0x159ba6,_0x444ca1)['then'](function(_0x27ff15){logger[_0x26ac('0xb')](_0x26ac('0xc'),_0x36389c,_0x26ac('0xd'));logger['debug'](_0x26ac('0xe'),_0x36389c,_0x26ac('0xd'),JSON[_0x26ac('0xf')](_0x27ff15));if(_0x27ff15[_0x26ac('0x10')]){if(_0x27ff15['error']['code']===0x1f4){logger[_0x26ac('0x10')](_0x26ac('0xc'),_0x36389c,_0x27ff15[_0x26ac('0x10')][_0x26ac('0x11')]);return _0xd8b1e5(_0x27ff15[_0x26ac('0x10')][_0x26ac('0x11')]);}logger[_0x26ac('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x36389c,_0x27ff15[_0x26ac('0x10')][_0x26ac('0x11')]);return _0x1906d0(_0x27ff15[_0x26ac('0x10')][_0x26ac('0x11')]);}else{logger['info'](_0x26ac('0xc'),_0x36389c,_0x26ac('0xd'));_0x1906d0(_0x27ff15['result'][_0x26ac('0x11')]);}})[_0x26ac('0x12')](function(_0x3b7c5d){logger[_0x26ac('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x36389c,_0x3b7c5d);_0xd8b1e5(_0x3b7c5d);});});}exports[_0x26ac('0x13')]=function(_0xb03bbc){var _0x5cd737=this;return new Promise(function(_0x539eda,_0x111613){return db[_0x26ac('0x14')]['create'](_0xb03bbc[_0x26ac('0x15')],{'raw':_0xb03bbc['options']?_0xb03bbc['options']['raw']===undefined?!![]:![]:!![]})[_0x26ac('0x16')](function(_0x58ee68){logger[_0x26ac('0xb')](_0x26ac('0x13'),_0xb03bbc);logger[_0x26ac('0x17')](_0x26ac('0x13'),_0xb03bbc,JSON[_0x26ac('0xf')](_0x58ee68));_0x539eda(_0x58ee68);})[_0x26ac('0x12')](function(_0x21b6ab){logger[_0x26ac('0x10')](_0x26ac('0x13'),_0x21b6ab['message'],_0xb03bbc);_0x111613(_0x5cd737[_0x26ac('0x10')](0x1f4,_0x21b6ab[_0x26ac('0x11')]));});});};exports[_0x26ac('0x18')]=function(_0x1885f7){var _0x346001=this;return new Promise(function(_0x268200,_0x1074b5){return db[_0x26ac('0x14')][_0x26ac('0x19')](_0x1885f7[_0x26ac('0x15')],{'raw':_0x1885f7['options']?_0x1885f7['options'][_0x26ac('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1885f7['options']?_0x1885f7[_0x26ac('0x1b')][_0x26ac('0x1c')]||null:null,'attributes':_0x1885f7[_0x26ac('0x1b')]?_0x1885f7[_0x26ac('0x1b')][_0x26ac('0x1d')]||null:null,'limit':_0x1885f7[_0x26ac('0x1b')]?_0x1885f7['options']['limit']||null:null})[_0x26ac('0x16')](function(_0x3e2c4d){logger[_0x26ac('0xb')]('UpdateOpenchannelQueueReport',_0x1885f7);logger['debug'](_0x26ac('0x18'),_0x1885f7,JSON[_0x26ac('0xf')](_0x3e2c4d));_0x268200(_0x3e2c4d);})[_0x26ac('0x12')](function(_0x325818){logger['error']('UpdateOpenchannelQueueReport',_0x325818[_0x26ac('0x11')],_0x1885f7);_0x1074b5(_0x346001[_0x26ac('0x10')](0x1f4,_0x325818[_0x26ac('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 5fc7c78..df2e5c7 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 _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 +var _0xef09=['../../components/interaction/service','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','/:id','post','put','exports','util','connect-timeout','express'];(function(_0x52dbcb,_0x344f7e){var _0x10bfe4=function(_0x4685c5){while(--_0x4685c5){_0x52dbcb['push'](_0x52dbcb['shift']());}};_0x10bfe4(++_0x344f7e);}(_0xef09,0x1de));var _0x9ef0=function(_0x370477,_0x2318dc){_0x370477=_0x370477-0x0;var _0x59436b=_0xef09[_0x370477];return _0x59436b;};'use strict';var multer=require('multer');var util=require(_0x9ef0('0x0'));var path=require('path');var timeout=require(_0x9ef0('0x1'));var express=require(_0x9ef0('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9ef0('0x3'));var config=require('../../config/environment');var controller=require(_0x9ef0('0x4'));router[_0x9ef0('0x5')]('/',auth[_0x9ef0('0x6')](),controller[_0x9ef0('0x7')]);router[_0x9ef0('0x5')](_0x9ef0('0x8'),auth[_0x9ef0('0x6')](),controller['describe']);router[_0x9ef0('0x5')](_0x9ef0('0x9'),auth[_0x9ef0('0x6')](),controller['show']);router[_0x9ef0('0xa')]('/',auth[_0x9ef0('0x6')](),controller['create']);router[_0x9ef0('0xb')](_0x9ef0('0x9'),auth[_0x9ef0('0x6')](),controller['update']);router['delete'](_0x9ef0('0x9'),auth[_0x9ef0('0x6')](),controller['destroy']);module[_0x9ef0('0xc')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index cc1ebe6..2ac009f 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 _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 +var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x105ede,_0x6ecf){var _0x4993fb=function(_0x568cba){while(--_0x568cba){_0x105ede['push'](_0x105ede['shift']());}};_0x4993fb(++_0x6ecf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'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/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index a091399..754e80a 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 _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 +var _0xf11d=['find','create','body','params','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','crypto','jsforce','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','limit','count','offset','json','apply','reject','save','update','then','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','findAll','catch','show','length','includeAll'];(function(_0x3600cc,_0x5964fb){var _0x2e0877=function(_0x1a4608){while(--_0x1a4608){_0x3600cc['push'](_0x3600cc['shift']());}};_0x2e0877(++_0x5964fb);}(_0xf11d,0x173));var _0xdf11=function(_0x2071ff,_0xc4c742){_0x2071ff=_0x2071ff-0x0;var _0x45c987=_0xf11d[_0x2071ff];return _0x45c987;};'use strict';var emlformat=require(_0xdf11('0x0'));var rimraf=require(_0xdf11('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdf11('0x2'));var rp=require(_0xdf11('0x3'));var moment=require(_0xdf11('0x4'));var BPromise=require(_0xdf11('0x5'));var Mustache=require(_0xdf11('0x6'));var util=require(_0xdf11('0x7'));var path=require('path');var sox=require(_0xdf11('0x8'));var csv=require(_0xdf11('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdf11('0xa'));var squel=require('squel');var crypto=require(_0xdf11('0xb'));var jsforce=require(_0xdf11('0xc'));var deskjs=require(_0xdf11('0xd'));var toCsv=require(_0xdf11('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xdf11('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xdf11('0xf'));var hardwareService=require(_0xdf11('0x10'));var logger=require(_0xdf11('0x11'))(_0xdf11('0x12'));var utils=require(_0xdf11('0x13'));var config=require(_0xdf11('0x14'));var licenseUtil=require(_0xdf11('0x15'));var db=require(_0xdf11('0x16'))['db'];function respondWithStatusCode(_0x41e6fd,_0x2fdaa8){_0x2fdaa8=_0x2fdaa8||0xcc;return function(_0x3690d9){if(_0x3690d9){return _0x41e6fd[_0xdf11('0x17')](_0x2fdaa8);}return _0x41e6fd['status'](_0x2fdaa8)[_0xdf11('0x18')]();};}function respondWithResult(_0x15226c,_0x1d427b){_0x1d427b=_0x1d427b||0xc8;return function(_0x5321b2){if(_0x5321b2){return _0x15226c[_0xdf11('0x19')](_0x1d427b)['json'](_0x5321b2);}};}function respondWithFilteredResult(_0x2af7bb,_0x993d08){return function(_0x2be23f){if(_0x2be23f){var _0xa1c3ce=typeof _0x993d08['offset']===_0xdf11('0x1a')&&typeof _0x993d08[_0xdf11('0x1b')]==='undefined';var _0x1f047f=_0x2be23f[_0xdf11('0x1c')];var _0x428641=_0xa1c3ce?0x0:_0x993d08[_0xdf11('0x1d')];var _0x4871dd=_0xa1c3ce?_0x2be23f[_0xdf11('0x1c')]:_0x993d08[_0xdf11('0x1d')]+_0x993d08[_0xdf11('0x1b')];var _0x2f4e0a;if(_0x4871dd>=_0x1f047f){_0x4871dd=_0x1f047f;_0x2f4e0a=0xc8;}else{_0x2f4e0a=0xce;}_0x2af7bb[_0xdf11('0x19')](_0x2f4e0a);return _0x2af7bb['set']('Content-Range',_0x428641+'-'+_0x4871dd+'/'+_0x1f047f)[_0xdf11('0x1e')](_0x2be23f);}return null;};}function patchUpdates(_0x2218c6){return function(_0x9fc5d4){try{jsonpatch[_0xdf11('0x1f')](_0x9fc5d4,_0x2218c6,!![]);}catch(_0x29718d){return BPromise[_0xdf11('0x20')](_0x29718d);}return _0x9fc5d4[_0xdf11('0x21')]();};}function saveUpdates(_0x35a12b,_0x48d371){return function(_0x2faff3){if(_0x2faff3){return _0x2faff3[_0xdf11('0x22')](_0x35a12b)[_0xdf11('0x23')](function(_0xb8bb4d){return _0xb8bb4d;});}return null;};}function removeEntity(_0x4bdfce,_0x35122f){return function(_0x2131b8){if(_0x2131b8){return _0x2131b8['destroy']()[_0xdf11('0x23')](function(){_0x4bdfce[_0xdf11('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28b4e1,_0x19d46a){return function(_0xd2461){if(!_0xd2461){_0x28b4e1['sendStatus'](0x194);}return _0xd2461;};}function handleError(_0x51fd63,_0xdad4a6){_0xdad4a6=_0xdad4a6||0x1f4;return function(_0x49b39b){logger[_0xdf11('0x24')](_0x49b39b[_0xdf11('0x25')]);if(_0x49b39b[_0xdf11('0x26')]){delete _0x49b39b[_0xdf11('0x26')];}_0x51fd63['status'](_0xdad4a6)[_0xdf11('0x27')](_0x49b39b);};}exports[_0xdf11('0x28')]=function(_0x87b2f7,_0x29f88d){var _0x555d8f={},_0x488fa8={},_0x1ebb44={'count':0x0,'rows':[]};var _0x1d4b47=_[_0xdf11('0x29')](db[_0xdf11('0x2a')][_0xdf11('0x2b')],function(_0x251554){return{'name':_0x251554[_0xdf11('0x2c')],'type':_0x251554[_0xdf11('0x2d')][_0xdf11('0x2e')]};});_0x488fa8[_0xdf11('0x2f')]=_['map'](_0x1d4b47,_0xdf11('0x26'));_0x488fa8[_0xdf11('0x30')]=_[_0xdf11('0x31')](_0x87b2f7[_0xdf11('0x30')]);_0x488fa8[_0xdf11('0x32')]=_[_0xdf11('0x33')](_0x488fa8[_0xdf11('0x2f')],_0x488fa8['query']);_0x555d8f['attributes']=_[_0xdf11('0x33')](_0x488fa8[_0xdf11('0x2f')],qs[_0xdf11('0x34')](_0x87b2f7[_0xdf11('0x30')][_0xdf11('0x34')]));_0x555d8f[_0xdf11('0x35')]=_0x555d8f[_0xdf11('0x35')]['length']?_0x555d8f['attributes']:_0x488fa8[_0xdf11('0x2f')];if(!_0x87b2f7[_0xdf11('0x30')][_0xdf11('0x36')](_0xdf11('0x37'))){_0x555d8f[_0xdf11('0x1b')]=qs[_0xdf11('0x1b')](_0x87b2f7[_0xdf11('0x30')]['limit']);_0x555d8f[_0xdf11('0x1d')]=qs[_0xdf11('0x1d')](_0x87b2f7[_0xdf11('0x30')][_0xdf11('0x1d')]);}_0x555d8f[_0xdf11('0x38')]=qs[_0xdf11('0x39')](_0x87b2f7[_0xdf11('0x30')][_0xdf11('0x39')]);_0x555d8f[_0xdf11('0x3a')]=qs['filters'](_['pick'](_0x87b2f7[_0xdf11('0x30')],_0x488fa8[_0xdf11('0x32')]),_0x1d4b47);if(_0x87b2f7['query'][_0xdf11('0x3b')]){_0x555d8f[_0xdf11('0x3a')]=_[_0xdf11('0x3c')](_0x555d8f[_0xdf11('0x3a')],{'$or':_['map'](_0x1d4b47,function(_0x2c3232){if(_0x2c3232['type']!==_0xdf11('0x3d')){var _0x184b3f={};_0x184b3f[_0x2c3232['name']]={'$like':'%'+_0x87b2f7['query'][_0xdf11('0x3b')]+'%'};return _0x184b3f;}})});}_0x555d8f=_[_0xdf11('0x3c')]({},_0x555d8f,_0x87b2f7['options']);var _0x3fe173={'where':_0x555d8f['where']};return db['OpenchannelTransferReport']['count'](_0x3fe173)['then'](function(_0x5d26a5){_0x1ebb44[_0xdf11('0x1c')]=_0x5d26a5;if(_0x87b2f7[_0xdf11('0x30')]['includeAll']){_0x555d8f['include']=[{'all':!![]}];}return db[_0xdf11('0x2a')][_0xdf11('0x3e')](_0x555d8f);})[_0xdf11('0x23')](function(_0xc8bc4f){_0x1ebb44['rows']=_0xc8bc4f;return _0x1ebb44;})['then'](respondWithFilteredResult(_0x29f88d,_0x555d8f))[_0xdf11('0x3f')](handleError(_0x29f88d,null));};exports[_0xdf11('0x40')]=function(_0x405178,_0x383a28){var _0x46335d={'raw':!![],'where':{'id':_0x405178['params']['id']}},_0x6d0d48={};_0x6d0d48['model']=_[_0xdf11('0x31')](db['OpenchannelTransferReport'][_0xdf11('0x2b')]);_0x6d0d48[_0xdf11('0x30')]=_[_0xdf11('0x31')](_0x405178[_0xdf11('0x30')]);_0x6d0d48[_0xdf11('0x32')]=_[_0xdf11('0x33')](_0x6d0d48['model'],_0x6d0d48['query']);_0x46335d['attributes']=_[_0xdf11('0x33')](_0x6d0d48[_0xdf11('0x2f')],qs[_0xdf11('0x34')](_0x405178['query'][_0xdf11('0x34')]));_0x46335d['attributes']=_0x46335d['attributes'][_0xdf11('0x41')]?_0x46335d['attributes']:_0x6d0d48[_0xdf11('0x2f')];if(_0x405178['query'][_0xdf11('0x42')]){_0x46335d['include']=[{'all':!![]}];}_0x46335d=_[_0xdf11('0x3c')]({},_0x46335d,_0x405178['options']);return db[_0xdf11('0x2a')][_0xdf11('0x43')](_0x46335d)['then'](handleEntityNotFound(_0x383a28,null))['then'](respondWithResult(_0x383a28,null))[_0xdf11('0x3f')](handleError(_0x383a28,null));};exports[_0xdf11('0x44')]=function(_0xee4393,_0x547464){return db[_0xdf11('0x2a')][_0xdf11('0x44')](_0xee4393[_0xdf11('0x45')],{})['then'](respondWithResult(_0x547464,0xc9))['catch'](handleError(_0x547464,null));};exports[_0xdf11('0x22')]=function(_0x56d0a5,_0x44924e){if(_0x56d0a5[_0xdf11('0x45')]['id']){delete _0x56d0a5[_0xdf11('0x45')]['id'];}return db[_0xdf11('0x2a')][_0xdf11('0x43')]({'where':{'id':_0x56d0a5[_0xdf11('0x46')]['id']}})['then'](handleEntityNotFound(_0x44924e,null))[_0xdf11('0x23')](saveUpdates(_0x56d0a5[_0xdf11('0x45')],null))[_0xdf11('0x23')](respondWithResult(_0x44924e,null))[_0xdf11('0x3f')](handleError(_0x44924e,null));};exports[_0xdf11('0x47')]=function(_0x377386,_0x3b7922){return db[_0xdf11('0x2a')][_0xdf11('0x43')]({'where':{'id':_0x377386[_0xdf11('0x46')]['id']}})['then'](handleEntityNotFound(_0x3b7922,null))[_0xdf11('0x23')](removeEntity(_0x3b7922,null))[_0xdf11('0x3f')](handleError(_0x3b7922,null));};exports[_0xdf11('0x48')]=function(_0x239276,_0x5c80f6){return db[_0xdf11('0x2a')][_0xdf11('0x48')]()['then'](respondWithResult(_0x5c80f6,null))['catch'](handleError(_0x5c80f6,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 1fdcd01..b2f7d5e 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 _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 +var _0xf28f=['rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','util','../../config/logger','api','moment','path'];(function(_0x14ae4c,_0x36a57c){var _0x938094=function(_0x1f5ebf){while(--_0x1f5ebf){_0x14ae4c['push'](_0x14ae4c['shift']());}};_0x938094(++_0x36a57c);}(_0xf28f,0x163));var _0xff28=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xf28f[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0xff28('0x0'));var logger=require(_0xff28('0x1'))(_0xff28('0x2'));var moment=require(_0xff28('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xff28('0x4'));var rimraf=require(_0xff28('0x5'));var config=require(_0xff28('0x6'));var attributes=require(_0xff28('0x7'));module[_0xff28('0x8')]=function(_0x33394a,_0x2fd65f){return _0x33394a['define'](_0xff28('0x9'),attributes,{'tableName':_0xff28('0xa'),'paranoid':![],'indexes':[{'name':_0xff28('0xb'),'fields':[_0xff28('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 93873ca..0a4880c 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 _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 +var _0x9f5a=['client','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise'];(function(_0x5b8d91,_0x4cc890){var _0x4daf58=function(_0x3c64cc){while(--_0x3c64cc){_0x5b8d91['push'](_0x5b8d91['shift']());}};_0x4daf58(++_0x4cc890);}(_0x9f5a,0xbd));var _0xa9f5=function(_0x175308,_0x4a4746){_0x175308=_0x175308-0x0;var _0x541c83=_0x9f5a[_0x175308];return _0x541c83;};'use strict';var _=require(_0xa9f5('0x0'));var util=require(_0xa9f5('0x1'));var moment=require(_0xa9f5('0x2'));var BPromise=require(_0xa9f5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa9f5('0x4'));var db=require(_0xa9f5('0x5'))['db'];var utils=require(_0xa9f5('0x6'));var logger=require('../../config/logger')(_0xa9f5('0x7'));var config=require('../../config/environment');var jayson=require(_0xa9f5('0x8'));var client=jayson[_0xa9f5('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x6c040d,_0x285dad,_0x3f644f){return new BPromise(function(_0x1f6c78,_0x21006b){return client[_0xa9f5('0xa')](_0x6c040d,_0x3f644f)[_0xa9f5('0xb')](function(_0x4cb5a5){logger[_0xa9f5('0xc')](_0xa9f5('0xd'),_0x285dad,'request\x20sent');logger[_0xa9f5('0xe')](_0xa9f5('0xf'),_0x285dad,'request\x20sent',JSON['stringify'](_0x4cb5a5));if(_0x4cb5a5[_0xa9f5('0x10')]){if(_0x4cb5a5[_0xa9f5('0x10')][_0xa9f5('0x11')]===0x1f4){logger[_0xa9f5('0x10')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x285dad,_0x4cb5a5[_0xa9f5('0x10')][_0xa9f5('0x12')]);return _0x21006b(_0x4cb5a5[_0xa9f5('0x10')]['message']);}logger[_0xa9f5('0x10')](_0xa9f5('0xd'),_0x285dad,_0x4cb5a5['error']['message']);return _0x1f6c78(_0x4cb5a5['error'][_0xa9f5('0x12')]);}else{logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x285dad,_0xa9f5('0x13'));_0x1f6c78(_0x4cb5a5[_0xa9f5('0x14')][_0xa9f5('0x12')]);}})[_0xa9f5('0x15')](function(_0x4c70f0){logger[_0xa9f5('0x10')](_0xa9f5('0xd'),_0x285dad,_0x4c70f0);_0x21006b(_0x4c70f0);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index f528156..451235f 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 _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 +var _0x9813=['fs-extra','../../components/auth/service','../../config/environment','./pause.controller','get','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x4f959b,_0x2c0712){var _0x263ddb=function(_0x11de9e){while(--_0x11de9e){_0x4f959b['push'](_0x4f959b['shift']());}};_0x263ddb(++_0x2c0712);}(_0x9813,0x112));var _0x3981=function(_0xb6ef46,_0x44e005){_0xb6ef46=_0xb6ef46-0x0;var _0x45653a=_0x9813[_0xb6ef46];return _0x45653a;};'use strict';var multer=require(_0x3981('0x0'));var util=require(_0x3981('0x1'));var path=require(_0x3981('0x2'));var timeout=require(_0x3981('0x3'));var express=require(_0x3981('0x4'));var router=express[_0x3981('0x5')]();var fs_extra=require(_0x3981('0x6'));var auth=require(_0x3981('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x3981('0x8'));var controller=require(_0x3981('0x9'));router[_0x3981('0xa')]('/',auth[_0x3981('0xb')](),controller['index']);router[_0x3981('0xa')]('/:id',auth[_0x3981('0xb')](),controller[_0x3981('0xc')]);router[_0x3981('0xd')]('/',auth[_0x3981('0xb')](),controller[_0x3981('0xe')]);router[_0x3981('0xf')](_0x3981('0x10'),auth[_0x3981('0xb')](),controller[_0x3981('0x11')]);router[_0x3981('0x12')](_0x3981('0x10'),auth['isAuthenticated'](),controller[_0x3981('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 9c32883..9444b19 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 _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 +var _0xc14a=['STRING','exports'];(function(_0x24ce3f,_0x37d8f8){var _0x4193a2=function(_0x31c09c){while(--_0x31c09c){_0x24ce3f['push'](_0x24ce3f['shift']());}};_0x4193a2(++_0x37d8f8);}(_0xc14a,0x13d));var _0xac14=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xc14a[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require('sequelize');module[_0xac14('0x0')]={'name':{'type':Sequelize[_0xac14('0x1')],'unique':'name','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 f27aaf5..73dafb3 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 _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 +var _0x59ec=['Content-Range','json','reject','update','then','destroy','get','Pauses','error','stack','name','send','map','Pause','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','show','params','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','count','set'];(function(_0x31edb1,_0x4703b2){var _0x58e861=function(_0x5323d8){while(--_0x5323d8){_0x31edb1['push'](_0x31edb1['shift']());}};_0x58e861(++_0x4703b2);}(_0x59ec,0x188));var _0xc59e=function(_0x56eebc,_0x6125f3){_0x56eebc=_0x56eebc-0x0;var _0x2ffcbb=_0x59ec[_0x56eebc];return _0x2ffcbb;};'use strict';var emlformat=require(_0xc59e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc59e('0x1'));var jsonpatch=require(_0xc59e('0x2'));var rp=require(_0xc59e('0x3'));var moment=require('moment');var BPromise=require(_0xc59e('0x4'));var Mustache=require(_0xc59e('0x5'));var util=require('util');var path=require(_0xc59e('0x6'));var sox=require(_0xc59e('0x7'));var csv=require(_0xc59e('0x8'));var ejs=require(_0xc59e('0x9'));var fs=require('fs');var fs_extra=require(_0xc59e('0xa'));var _=require(_0xc59e('0xb'));var squel=require(_0xc59e('0xc'));var crypto=require(_0xc59e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xc59e('0xe'));var toCsv=require(_0xc59e('0x8'));var querystring=require(_0xc59e('0xf'));var Papa=require(_0xc59e('0x10'));var Redis=require(_0xc59e('0x11'));var authService=require(_0xc59e('0x12'));var qs=require(_0xc59e('0x13'));var as=require(_0xc59e('0x14'));var hardwareService=require(_0xc59e('0x15'));var logger=require(_0xc59e('0x16'))(_0xc59e('0x17'));var utils=require(_0xc59e('0x18'));var config=require(_0xc59e('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x7ef46a,_0xadd121){_0xadd121=_0xadd121||0xcc;return function(_0x17a655){if(_0x17a655){return _0x7ef46a[_0xc59e('0x1a')](_0xadd121);}return _0x7ef46a[_0xc59e('0x1b')](_0xadd121)[_0xc59e('0x1c')]();};}function respondWithResult(_0x18f3fd,_0x51a9c8){_0x51a9c8=_0x51a9c8||0xc8;return function(_0x3fff6c){if(_0x3fff6c){return _0x18f3fd[_0xc59e('0x1b')](_0x51a9c8)['json'](_0x3fff6c);}};}function respondWithFilteredResult(_0x582056,_0x38be9a){return function(_0x4c538e){if(_0x4c538e){var _0x59b037=typeof _0x38be9a[_0xc59e('0x1d')]===_0xc59e('0x1e')&&typeof _0x38be9a['limit']===_0xc59e('0x1e');var _0x5aded5=_0x4c538e[_0xc59e('0x1f')];var _0x11ff76=_0x59b037?0x0:_0x38be9a[_0xc59e('0x1d')];var _0x3bdafe=_0x59b037?_0x4c538e['count']:_0x38be9a[_0xc59e('0x1d')]+_0x38be9a['limit'];var _0x412976;if(_0x3bdafe>=_0x5aded5){_0x3bdafe=_0x5aded5;_0x412976=0xc8;}else{_0x412976=0xce;}_0x582056[_0xc59e('0x1b')](_0x412976);return _0x582056[_0xc59e('0x20')](_0xc59e('0x21'),_0x11ff76+'-'+_0x3bdafe+'/'+_0x5aded5)[_0xc59e('0x22')](_0x4c538e);}return null;};}function patchUpdates(_0x5a3836){return function(_0x2430d3){try{jsonpatch['apply'](_0x2430d3,_0x5a3836,!![]);}catch(_0x30ae35){return BPromise[_0xc59e('0x23')](_0x30ae35);}return _0x2430d3['save']();};}function saveUpdates(_0x8c2b38,_0x3b6b98){return function(_0x347a7f){if(_0x347a7f){return _0x347a7f[_0xc59e('0x24')](_0x8c2b38)[_0xc59e('0x25')](function(_0x6ba26d){return _0x6ba26d;});}return null;};}function removeEntity(_0x57316c,_0x50397f){return function(_0x161809){if(_0x161809){return _0x161809[_0xc59e('0x26')]()[_0xc59e('0x25')](function(){var _0x4d108f=_0x161809[_0xc59e('0x27')]({'plain':!![]});var _0x516244=_0xc59e('0x28');return db['UserProfileResource'][_0xc59e('0x26')]({'where':{'type':_0x516244,'resourceId':_0x4d108f['id']}})[_0xc59e('0x25')](function(){return _0x161809;});})[_0xc59e('0x25')](function(){_0x57316c[_0xc59e('0x1b')](0xcc)[_0xc59e('0x1c')]();});}};}function handleEntityNotFound(_0x1d49af,_0x71915b){return function(_0x2f5f52){if(!_0x2f5f52){_0x1d49af[_0xc59e('0x1a')](0x194);}return _0x2f5f52;};}function handleError(_0x18fcb3,_0x566231){_0x566231=_0x566231||0x1f4;return function(_0x225386){logger[_0xc59e('0x29')](_0x225386[_0xc59e('0x2a')]);if(_0x225386[_0xc59e('0x2b')]){delete _0x225386[_0xc59e('0x2b')];}_0x18fcb3[_0xc59e('0x1b')](_0x566231)[_0xc59e('0x2c')](_0x225386);};}exports['index']=function(_0x37f275,_0x4c1f8d){var _0x272aa2={},_0x3b4471={},_0x1ba170={'count':0x0,'rows':[]};var _0xca9225=_[_0xc59e('0x2d')](db[_0xc59e('0x2e')][_0xc59e('0x2f')],function(_0x495ca6){return{'name':_0x495ca6[_0xc59e('0x30')],'type':_0x495ca6[_0xc59e('0x31')][_0xc59e('0x32')]};});_0x3b4471[_0xc59e('0x33')]=_['map'](_0xca9225,_0xc59e('0x2b'));_0x3b4471['query']=_[_0xc59e('0x34')](_0x37f275[_0xc59e('0x35')]);_0x3b4471[_0xc59e('0x36')]=_[_0xc59e('0x37')](_0x3b4471['model'],_0x3b4471['query']);_0x272aa2[_0xc59e('0x38')]=_[_0xc59e('0x37')](_0x3b4471[_0xc59e('0x33')],qs[_0xc59e('0x39')](_0x37f275[_0xc59e('0x35')]['fields']));_0x272aa2[_0xc59e('0x38')]=_0x272aa2['attributes']['length']?_0x272aa2[_0xc59e('0x38')]:_0x3b4471[_0xc59e('0x33')];if(!_0x37f275['query']['hasOwnProperty'](_0xc59e('0x3a'))){_0x272aa2[_0xc59e('0x3b')]=qs[_0xc59e('0x3b')](_0x37f275['query'][_0xc59e('0x3b')]);_0x272aa2[_0xc59e('0x1d')]=qs[_0xc59e('0x1d')](_0x37f275[_0xc59e('0x35')][_0xc59e('0x1d')]);}_0x272aa2[_0xc59e('0x3c')]=qs[_0xc59e('0x3d')](_0x37f275[_0xc59e('0x35')][_0xc59e('0x3d')]);_0x272aa2[_0xc59e('0x3e')]=qs['filters'](_[_0xc59e('0x3f')](_0x37f275['query'],_0x3b4471[_0xc59e('0x36')]),_0xca9225);if(_0x37f275[_0xc59e('0x35')][_0xc59e('0x40')]){_0x272aa2[_0xc59e('0x3e')]=_[_0xc59e('0x41')](_0x272aa2['where'],{'$or':_['map'](_0xca9225,function(_0x3f5908){if(_0x3f5908['type']!==_0xc59e('0x42')){var _0x3c9532={};_0x3c9532[_0x3f5908['name']]={'$like':'%'+_0x37f275[_0xc59e('0x35')][_0xc59e('0x40')]+'%'};return _0x3c9532;}})});}_0x272aa2=_[_0xc59e('0x41')]({},_0x272aa2,_0x37f275[_0xc59e('0x43')]);var _0x3ed440={'where':_0x272aa2[_0xc59e('0x3e')]};return db[_0xc59e('0x2e')][_0xc59e('0x1f')](_0x3ed440)[_0xc59e('0x25')](function(_0x513ec5){_0x1ba170[_0xc59e('0x1f')]=_0x513ec5;if(_0x37f275[_0xc59e('0x35')][_0xc59e('0x44')]){_0x272aa2['include']=[{'all':!![]}];}return db['Pause']['findAll'](_0x272aa2);})['then'](function(_0x14d187){_0x1ba170[_0xc59e('0x45')]=_0x14d187;return _0x1ba170;})[_0xc59e('0x25')](respondWithFilteredResult(_0x4c1f8d,_0x272aa2))['catch'](handleError(_0x4c1f8d,null));};exports[_0xc59e('0x46')]=function(_0x463ae8,_0x3deb6f){var _0x18bd69={'raw':!![],'where':{'id':_0x463ae8[_0xc59e('0x47')]['id']}},_0x53538b={};_0x53538b[_0xc59e('0x33')]=_[_0xc59e('0x34')](db[_0xc59e('0x2e')][_0xc59e('0x2f')]);_0x53538b[_0xc59e('0x35')]=_[_0xc59e('0x34')](_0x463ae8[_0xc59e('0x35')]);_0x53538b['filters']=_['intersection'](_0x53538b[_0xc59e('0x33')],_0x53538b[_0xc59e('0x35')]);_0x18bd69['attributes']=_['intersection'](_0x53538b[_0xc59e('0x33')],qs[_0xc59e('0x39')](_0x463ae8['query'][_0xc59e('0x39')]));_0x18bd69[_0xc59e('0x38')]=_0x18bd69[_0xc59e('0x38')]['length']?_0x18bd69[_0xc59e('0x38')]:_0x53538b['model'];if(_0x463ae8[_0xc59e('0x35')]['includeAll']){_0x18bd69[_0xc59e('0x48')]=[{'all':!![]}];}_0x18bd69=_[_0xc59e('0x41')]({},_0x18bd69,_0x463ae8['options']);return db[_0xc59e('0x2e')][_0xc59e('0x49')](_0x18bd69)[_0xc59e('0x25')](handleEntityNotFound(_0x3deb6f,null))[_0xc59e('0x25')](respondWithResult(_0x3deb6f,null))[_0xc59e('0x4a')](handleError(_0x3deb6f,null));};exports[_0xc59e('0x4b')]=function(_0x3fb8fb,_0xc76c4d){return db['Pause'][_0xc59e('0x4b')](_0x3fb8fb[_0xc59e('0x4c')],{})[_0xc59e('0x25')](function(_0x754dbf){var _0x44d9e0=_0x3fb8fb[_0xc59e('0x4d')]['get']({'plain':!![]});if(!_0x44d9e0)throw new Error(_0xc59e('0x4e'));if(_0x44d9e0[_0xc59e('0x4f')]==='user'){var _0x24d900=_0x754dbf[_0xc59e('0x27')]({'plain':!![]});var _0x28088d='Pauses';return db[_0xc59e('0x50')][_0xc59e('0x49')]({'where':{'name':_0x28088d,'userProfileId':_0x44d9e0[_0xc59e('0x51')]},'raw':!![]})['then'](function(_0x1f504f){if(_0x1f504f&&_0x1f504f[_0xc59e('0x52')]===0x0){return db[_0xc59e('0x53')][_0xc59e('0x4b')]({'name':_0x24d900[_0xc59e('0x2b')],'resourceId':_0x24d900['id'],'type':_0x1f504f['name'],'sectionId':_0x1f504f['id']},{})[_0xc59e('0x25')](function(){return _0x754dbf;});}else{return _0x754dbf;}})['catch'](function(_0x4836f8){logger[_0xc59e('0x29')](_0xc59e('0x54'),_0x4836f8);throw _0x4836f8;});}return _0x754dbf;})['then'](respondWithResult(_0xc76c4d,0xc9))[_0xc59e('0x4a')](handleError(_0xc76c4d,null));};exports[_0xc59e('0x24')]=function(_0x3cc721,_0x4dc95b){if(_0x3cc721[_0xc59e('0x4c')]['id']){delete _0x3cc721[_0xc59e('0x4c')]['id'];}return db['Pause'][_0xc59e('0x49')]({'where':{'id':_0x3cc721[_0xc59e('0x47')]['id']}})[_0xc59e('0x25')](handleEntityNotFound(_0x4dc95b,null))[_0xc59e('0x25')](saveUpdates(_0x3cc721[_0xc59e('0x4c')],null))[_0xc59e('0x25')](respondWithResult(_0x4dc95b,null))[_0xc59e('0x4a')](handleError(_0x4dc95b,null));};exports[_0xc59e('0x26')]=function(_0x221022,_0x447656){return db[_0xc59e('0x2e')][_0xc59e('0x49')]({'where':{'id':_0x221022[_0xc59e('0x47')]['id']}})[_0xc59e('0x25')](handleEntityNotFound(_0x447656,null))[_0xc59e('0x25')](removeEntity(_0x447656,null))[_0xc59e('0x4a')](handleError(_0x447656,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index f3e85d2..97d1359 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 _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 +var _0x7217=['../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3f6e26,_0x811a34){var _0x474345=function(_0x4a0cbe){while(--_0x4a0cbe){_0x3f6e26['push'](_0x3f6e26['shift']());}};_0x474345(++_0x811a34);}(_0x7217,0x19e));var _0x7721=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0x7217[_0x12d033];return _0x3b4e80;};'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 bfc9c38..f49d662 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(_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 +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(_0x434f90,_0xd9e77c){var _0x27c50c=function(_0x5294cd){while(--_0x5294cd){_0x434f90['push'](_0x434f90['shift']());}};_0x27c50c(++_0xd9e77c);}(_0xb10b,0x12a));var _0xbb10=function(_0x39686e,_0x3d83bb){_0x39686e=_0x39686e-0x0;var _0x1b765e=_0xb10b[_0x39686e];return _0x1b765e;};'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 a04b36f..15447cf 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 _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 +var _0x17ba=['single','upload','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','show','download','diskStorage','join','server/files/plugins','originalname','replace','format','basename','extname','post'];(function(_0x2f568e,_0x2dba92){var _0x23322c=function(_0x28a506){while(--_0x28a506){_0x2f568e['push'](_0x2f568e['shift']());}};_0x23322c(++_0x2dba92);}(_0x17ba,0xab));var _0xa17b=function(_0x5b1729,_0x329487){_0x5b1729=_0x5b1729-0x0;var _0x3b140c=_0x17ba[_0x5b1729];return _0x3b140c;};'use strict';var multer=require(_0xa17b('0x0'));var util=require(_0xa17b('0x1'));var path=require('path');var timeout=require(_0xa17b('0x2'));var express=require(_0xa17b('0x3'));var router=express[_0xa17b('0x4')]();var fs_extra=require(_0xa17b('0x5'));var auth=require(_0xa17b('0x6'));var interaction=require(_0xa17b('0x7'));var config=require(_0xa17b('0x8'));var controller=require(_0xa17b('0x9'));router[_0xa17b('0xa')]('/',auth[_0xa17b('0xb')](),controller[_0xa17b('0xc')]);router[_0xa17b('0xa')](_0xa17b('0xd'),controller[_0xa17b('0xe')]);router[_0xa17b('0xa')](_0xa17b('0xf'),auth[_0xa17b('0xb')](),controller[_0xa17b('0x10')]);router[_0xa17b('0xa')]('/:id/download',auth[_0xa17b('0xb')](),controller[_0xa17b('0x11')]);var upload=multer({'storage':multer[_0xa17b('0x12')]({'destination':function(_0x1e799a,_0x140943,_0x4382df){_0x4382df(null,path[_0xa17b('0x13')](config['root'],_0xa17b('0x14')));},'filename':function(_0x3e92e4,_0x3c3a8a,_0x52b7aa){_0x3c3a8a[_0xa17b('0x15')]=_0x3c3a8a[_0xa17b('0x15')][_0xa17b('0x16')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x52b7aa(null,util[_0xa17b('0x17')]('%s-%s%s',path[_0xa17b('0x18')](_0x3c3a8a['originalname'],path[_0xa17b('0x19')](_0x3c3a8a[_0xa17b('0x15')])),Date['now'](),path[_0xa17b('0x19')](_0x3c3a8a[_0xa17b('0x15')])));}})});router[_0xa17b('0x1a')]('/',upload[_0xa17b('0x1b')]('file'),controller[_0xa17b('0x1c')]);router['post']('/webhook',controller['webhookPost']);router[_0xa17b('0x1d')](_0xa17b('0xf'),auth['isAuthenticated'](),controller[_0xa17b('0x1e')]);router[_0xa17b('0x1f')](_0xa17b('0xf'),auth[_0xa17b('0xb')](),controller[_0xa17b('0x1f')]);module[_0xa17b('0x20')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 67abfac..b1fe621 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 _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 +var _0xfd53=['The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','html','script','TEXT'];(function(_0x5b930a,_0x582419){var _0x37a84a=function(_0x3cb673){while(--_0x3cb673){_0x5b930a['push'](_0x5b930a['shift']());}};_0x37a84a(++_0x582419);}(_0xfd53,0x1d9));var _0x3fd5=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0xfd53[_0x62c958];return _0x57ec61;};'use strict';var Sequelize=require(_0x3fd5('0x0'));module[_0x3fd5('0x1')]={'name':{'type':Sequelize[_0x3fd5('0x2')]},'type':{'type':Sequelize[_0x3fd5('0x3')](_0x3fd5('0x4'),_0x3fd5('0x5'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0x3fd5('0x6')]},'path':{'type':Sequelize[_0x3fd5('0x2')],'comment':_0x3fd5('0x7')},'active':{'type':Sequelize[_0x3fd5('0x8')],'defaultValue':0x0,'comment':_0x3fd5('0x9')},'sidebar':{'type':Sequelize['ENUM'](_0x3fd5('0xa'),_0x3fd5('0xb'),_0x3fd5('0xc'),_0x3fd5('0xd')),'defaultValue':'always','comment':_0x3fd5('0xe')},'icon':{'type':Sequelize[_0x3fd5('0x2')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0x3fd5('0x2')]},'scriptName':{'type':Sequelize[_0x3fd5('0x2')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 5e8fd17..13a81bc 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 _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 +var _0x94ba=['set','endsWith','download','statusCode','webhookPost','hostname','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','lodash','crypto','desk.js','querystring','papaparse','extract-zip','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','undefined','count','offset','apply','reject','save','update','then','get','UserProfileResource','error','stack','send','index','map','Plugin','rawAttributes','type','key','model','name','query','keys','intersection','attributes','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','fields','find','join','root','server/files/plugins','%s.zip','basename','createWriteStream','zip','warning','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','node_modules/**/*','finalize','existsSync','Plugin\x20not\x20found','format','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Temporary\x20file\x20removed','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','chmodSync','0777','readdirSync','length','Invalid\x20plugin\x20structure','lstatSync','isFile','some','manifest.json','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20parameters\x20missing','parameters','Invalid\x20manifest:\x20views\x20missing','views','admin','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','scriptPath','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','icon','version','html','Warning:\x20admin\x20view\x20not\x20specified','agent','test','Warning:\x20agent\x20view\x20not\x20specified','script','plugins','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Plugins','autoAssociation','Zip\x20archive\x20removed','destroy','dirname','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','http://localhost:','json','encoding','method','%s%s','headers','content-length','content-type'];(function(_0x2394ae,_0x2f2d8b){var _0x26ed3a=function(_0x5392a2){while(--_0x5392a2){_0x2394ae['push'](_0x2394ae['shift']());}};_0x26ed3a(++_0x2f2d8b);}(_0x94ba,0xaa));var _0xa94b=function(_0x206338,_0x2d800b){_0x206338=_0x206338-0x0;var _0x2b87f2=_0x94ba[_0x206338];return _0x2b87f2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa94b('0x0'));var zipdir=require(_0xa94b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa94b('0x2'));var moment=require(_0xa94b('0x3'));var BPromise=require(_0xa94b('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa94b('0x5'));var sox=require(_0xa94b('0x6'));var csv=require(_0xa94b('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa94b('0x8'));var squel=require('squel');var crypto=require(_0xa94b('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xa94b('0xa'));var toCsv=require(_0xa94b('0x7'));var querystring=require(_0xa94b('0xb'));var Papa=require(_0xa94b('0xc'));var extract=require(_0xa94b('0xd'));var rimraf=require(_0xa94b('0x0'));var archiver=require('archiver');var Redis=require('ioredis');var authService=require(_0xa94b('0xe'));var qs=require(_0xa94b('0xf'));var as=require(_0xa94b('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa94b('0x11'))(_0xa94b('0x12'));var utils=require('../../config/utils');var config=require(_0xa94b('0x13'));var licenseUtil=require(_0xa94b('0x14'));var db=require('../../mysqldb')['db'];config[_0xa94b('0x15')]=_[_0xa94b('0x16')](config['redis'],{'host':_0xa94b('0x17'),'port':0x18eb});var socket=require(_0xa94b('0x18'))(new Redis(config['redis']));require(_0xa94b('0x19'))[_0xa94b('0x1a')](socket);function respondWithStatusCode(_0x3d5150,_0x3af642){_0x3af642=_0x3af642||0xcc;return function(_0x501544){if(_0x501544){return _0x3d5150[_0xa94b('0x1b')](_0x3af642);}return _0x3d5150[_0xa94b('0x1c')](_0x3af642)[_0xa94b('0x1d')]();};}function respondWithResult(_0x3f48e5,_0x2681bc){_0x2681bc=_0x2681bc||0xc8;return function(_0xdd9719){if(_0xdd9719){return _0x3f48e5[_0xa94b('0x1c')](_0x2681bc)['json'](_0xdd9719);}};}function respondWithFilteredResult(_0x21663d,_0x15fe16){return function(_0x19c4b7){if(_0x19c4b7){var _0x55490f=typeof _0x15fe16['offset']===_0xa94b('0x1e')&&typeof _0x15fe16['limit']===_0xa94b('0x1e');var _0x570ca9=_0x19c4b7[_0xa94b('0x1f')];var _0x4c78ec=_0x55490f?0x0:_0x15fe16[_0xa94b('0x20')];var _0x4604cb=_0x55490f?_0x19c4b7[_0xa94b('0x1f')]:_0x15fe16[_0xa94b('0x20')]+_0x15fe16['limit'];var _0x9fe4b5;if(_0x4604cb>=_0x570ca9){_0x4604cb=_0x570ca9;_0x9fe4b5=0xc8;}else{_0x9fe4b5=0xce;}_0x21663d[_0xa94b('0x1c')](_0x9fe4b5);return _0x21663d['set']('Content-Range',_0x4c78ec+'-'+_0x4604cb+'/'+_0x570ca9)['json'](_0x19c4b7);}return null;};}function patchUpdates(_0x5d7bbc){return function(_0x409c2b){try{jsonpatch[_0xa94b('0x21')](_0x409c2b,_0x5d7bbc,!![]);}catch(_0x30acf3){return BPromise[_0xa94b('0x22')](_0x30acf3);}return _0x409c2b[_0xa94b('0x23')]();};}function saveUpdates(_0x4a07d5,_0x312b7a){return function(_0x32bcdd){if(_0x32bcdd){return _0x32bcdd[_0xa94b('0x24')](_0x4a07d5)['then'](function(_0x3332de){return _0x3332de;});}return null;};}function removeEntity(_0x58c0d7,_0x17d0af){return function(_0x3ef8ac){if(_0x3ef8ac){return _0x3ef8ac['destroy']()[_0xa94b('0x25')](function(){var _0x16f7c4=_0x3ef8ac[_0xa94b('0x26')]({'plain':!![]});var _0x5a267f='Plugins';return db[_0xa94b('0x27')]['destroy']({'where':{'type':_0x5a267f,'resourceId':_0x16f7c4['id']}})[_0xa94b('0x25')](function(){return _0x3ef8ac;});})[_0xa94b('0x25')](function(){_0x58c0d7[_0xa94b('0x1c')](0xcc)[_0xa94b('0x1d')]();});}};}function handleEntityNotFound(_0x5aaece,_0x4ca6b1){return function(_0x5210ac){if(!_0x5210ac){_0x5aaece[_0xa94b('0x1b')](0x194);}return _0x5210ac;};}function handleError(_0x2b3917,_0x3ae245){_0x3ae245=_0x3ae245||0x1f4;return function(_0x5ec3ff){logger[_0xa94b('0x28')](_0x5ec3ff[_0xa94b('0x29')]);if(_0x5ec3ff['name']){delete _0x5ec3ff['name'];}_0x2b3917[_0xa94b('0x1c')](_0x3ae245)[_0xa94b('0x2a')](_0x5ec3ff);};}exports[_0xa94b('0x2b')]=function(_0x3ba0f4,_0x3cc769){var _0x5a479b={},_0x3a5748={},_0x1c9d83={'count':0x0,'rows':[]};var _0x1af37f=_[_0xa94b('0x2c')](db[_0xa94b('0x2d')][_0xa94b('0x2e')],function(_0x3b005b){return{'name':_0x3b005b['fieldName'],'type':_0x3b005b[_0xa94b('0x2f')][_0xa94b('0x30')]};});_0x3a5748[_0xa94b('0x31')]=_[_0xa94b('0x2c')](_0x1af37f,_0xa94b('0x32'));_0x3a5748[_0xa94b('0x33')]=_[_0xa94b('0x34')](_0x3ba0f4['query']);_0x3a5748['filters']=_[_0xa94b('0x35')](_0x3a5748[_0xa94b('0x31')],_0x3a5748[_0xa94b('0x33')]);_0x5a479b[_0xa94b('0x36')]=_[_0xa94b('0x35')](_0x3a5748[_0xa94b('0x31')],qs['fields'](_0x3ba0f4['query']['fields']));_0x5a479b['attributes']=_0x5a479b['attributes']['length']?_0x5a479b[_0xa94b('0x36')]:_0x3a5748[_0xa94b('0x31')];if(!_0x3ba0f4[_0xa94b('0x33')][_0xa94b('0x37')](_0xa94b('0x38'))){_0x5a479b[_0xa94b('0x39')]=qs[_0xa94b('0x39')](_0x3ba0f4[_0xa94b('0x33')]['limit']);_0x5a479b[_0xa94b('0x20')]=qs[_0xa94b('0x20')](_0x3ba0f4['query'][_0xa94b('0x20')]);}_0x5a479b[_0xa94b('0x3a')]=qs['sort'](_0x3ba0f4[_0xa94b('0x33')][_0xa94b('0x3b')]);_0x5a479b[_0xa94b('0x3c')]=qs[_0xa94b('0x3d')](_[_0xa94b('0x3e')](_0x3ba0f4[_0xa94b('0x33')],_0x3a5748[_0xa94b('0x3d')]),_0x1af37f);if(_0x3ba0f4[_0xa94b('0x33')][_0xa94b('0x3f')]){_0x5a479b['where']=_[_0xa94b('0x40')](_0x5a479b[_0xa94b('0x3c')],{'$or':_[_0xa94b('0x2c')](_0x1af37f,function(_0x1d0c19){if(_0x1d0c19[_0xa94b('0x2f')]!=='VIRTUAL'){var _0x2277e6={};_0x2277e6[_0x1d0c19['name']]={'$like':'%'+_0x3ba0f4[_0xa94b('0x33')]['filter']+'%'};return _0x2277e6;}})});}_0x5a479b=_['merge']({},_0x5a479b,_0x3ba0f4[_0xa94b('0x41')]);var _0x5bef40={'where':_0x5a479b[_0xa94b('0x3c')]};return db['Plugin'][_0xa94b('0x1f')](_0x5bef40)[_0xa94b('0x25')](function(_0x3d34a7){_0x1c9d83[_0xa94b('0x1f')]=_0x3d34a7;if(_0x3ba0f4[_0xa94b('0x33')][_0xa94b('0x42')]){_0x5a479b[_0xa94b('0x43')]=[{'all':!![]}];}return db[_0xa94b('0x2d')][_0xa94b('0x44')](_0x5a479b);})[_0xa94b('0x25')](function(_0x46d693){_0x1c9d83[_0xa94b('0x45')]=_0x46d693;return _0x1c9d83;})['then'](respondWithFilteredResult(_0x3cc769,_0x5a479b))[_0xa94b('0x46')](handleError(_0x3cc769,null));};exports['show']=function(_0x30e614,_0x2f005c){var _0x362c8b={'raw':!![],'where':{'id':_0x30e614[_0xa94b('0x47')]['id']}},_0x25c9c0={};_0x25c9c0[_0xa94b('0x31')]=_[_0xa94b('0x34')](db[_0xa94b('0x2d')][_0xa94b('0x2e')]);_0x25c9c0[_0xa94b('0x33')]=_[_0xa94b('0x34')](_0x30e614[_0xa94b('0x33')]);_0x25c9c0[_0xa94b('0x3d')]=_[_0xa94b('0x35')](_0x25c9c0[_0xa94b('0x31')],_0x25c9c0[_0xa94b('0x33')]);_0x362c8b[_0xa94b('0x36')]=_[_0xa94b('0x35')](_0x25c9c0[_0xa94b('0x31')],qs['fields'](_0x30e614[_0xa94b('0x33')][_0xa94b('0x48')]));_0x362c8b[_0xa94b('0x36')]=_0x362c8b['attributes']['length']?_0x362c8b['attributes']:_0x25c9c0[_0xa94b('0x31')];if(_0x30e614[_0xa94b('0x33')][_0xa94b('0x42')]){_0x362c8b[_0xa94b('0x43')]=[{'all':!![]}];}_0x362c8b=_['merge']({},_0x362c8b,_0x30e614[_0xa94b('0x41')]);return db[_0xa94b('0x2d')][_0xa94b('0x49')](_0x362c8b)['then'](handleEntityNotFound(_0x2f005c,null))['then'](respondWithResult(_0x2f005c,null))[_0xa94b('0x46')](handleError(_0x2f005c,null));};exports['download']=function(_0x51bb9f,_0x399d01,_0x193d10){return db[_0xa94b('0x2d')][_0xa94b('0x49')]({'where':{'id':_0x51bb9f[_0xa94b('0x47')]['id']},'attributes':[_0xa94b('0x32'),_0xa94b('0x5')],'raw':!![]})[_0xa94b('0x25')](handleEntityNotFound(_0x399d01,null))[_0xa94b('0x25')](function(_0x2e0ba4){if(_0x2e0ba4){var _0x1a87bc=path[_0xa94b('0x4a')](config[_0xa94b('0x4b')],_0xa94b('0x4c'),util['format'](_0xa94b('0x4d'),path[_0xa94b('0x4e')](_0x2e0ba4[_0xa94b('0x5')])));var _0x1339bb=fs[_0xa94b('0x4f')](_0x1a87bc);var _0x2baa61=archiver(_0xa94b('0x50'),{'zlib':{'level':0x9}});_0x2baa61['on'](_0xa94b('0x51'),function(_0x303e0b){if(_0x303e0b['code']===_0xa94b('0x52')){logger['error'](_0x303e0b);}else{throw new db[(_0xa94b('0x53'))][(_0xa94b('0x54'))](_0xa94b('0x55'));}});_0x2baa61['on'](_0xa94b('0x28'),function(_0x3bbe0c){throw new db['Sequelize'][(_0xa94b('0x54'))](_0xa94b('0x55'));});_0x2baa61[_0xa94b('0x56')](_0x1339bb);_0x2baa61[_0xa94b('0x57')](_0xa94b('0x58'),{'cwd':path['join'](config[_0xa94b('0x4b')],_0xa94b('0x4c'),path['dirname'](_0x2e0ba4[_0xa94b('0x5')])),'ignore':[path[_0xa94b('0x4a')](path[_0xa94b('0x4e')](_0x2e0ba4[_0xa94b('0x5')]),_0xa94b('0x59')),path['join'](path[_0xa94b('0x4e')](_0x2e0ba4[_0xa94b('0x5')]),'attachments/**/*')],'nodir':!![]})[_0xa94b('0x5a')]();_0x1339bb['on']('close',function(){if(!fs[_0xa94b('0x5b')](_0x1a87bc)){throw new db[(_0xa94b('0x53'))]['Error'](_0xa94b('0x5c'));}return _0x399d01['download'](_0x1a87bc,util[_0xa94b('0x5d')](_0xa94b('0x4d'),path[_0xa94b('0x4e')](_0x2e0ba4['path'])),function(_0x5044ba){if(_0x5044ba){throw new db[(_0xa94b('0x53'))][(_0xa94b('0x54'))](_0xa94b('0x5e'));}fs[_0xa94b('0x5f')](_0x1a87bc);logger[_0xa94b('0x60')]('Download\x20completed');logger[_0xa94b('0x60')](_0xa94b('0x61'));});});}return null;})[_0xa94b('0x46')](handleError(_0x399d01,null));};exports['upload']=function(_0x387da7,_0x1dd1ea,_0x573354){var _0x33ec8d=path['basename'](_0x387da7[_0xa94b('0x62')][_0xa94b('0x63')],path[_0xa94b('0x64')](_0x387da7[_0xa94b('0x62')][_0xa94b('0x63')]));var _0x84128d=path['join'](config[_0xa94b('0x4b')],_0xa94b('0x4c'),_0x387da7['file'][_0xa94b('0x63')]);var _0x266d30=path[_0xa94b('0x4a')](config['root'],'server/files/plugins',_0x33ec8d);logger['info'](_0xa94b('0x65'),_0x84128d);logger[_0xa94b('0x60')]('Plugin\x20upload\x20destination:\x20%s',_0x266d30);try{fs[_0xa94b('0x66')](_0x84128d,parseInt(_0xa94b('0x67'),0x8));extract(_0x84128d,{'dir':_0x266d30},function(_0x30a4cd){if(_0x30a4cd){logger['error'](_0x30a4cd);handleError(_0x30a4cd,!![]);};var _0x591812=fs[_0xa94b('0x68')](_0x266d30);if(_0x591812[_0xa94b('0x69')]>0x1){removeReferences(_0x84128d,_0x266d30);logger[_0xa94b('0x28')](_0xa94b('0x6a'));return _0x573354(new Error('Invalid\x20plugin\x20structure'));}var _0x1e2cab=fs[_0xa94b('0x6b')](path[_0xa94b('0x4a')](_0x266d30,_0x591812[0x0]));if(_0x1e2cab[_0xa94b('0x6c')]()){removeReferences(_0x84128d,_0x266d30);logger['error'](_0xa94b('0x6a'));return _0x573354(new Error('Invalid\x20plugin\x20structure'));}if(_0x1e2cab['isDirectory']()){var _0x45f85b=fs['readdirSync'](path[_0xa94b('0x4a')](_0x266d30,_0x591812[0x0]));if(_0x45f85b[_0xa94b('0x69')]===0x0){removeReferences(_0x84128d,_0x266d30);logger['error'](_0xa94b('0x6a'));return _0x573354(new Error(_0xa94b('0x6a')));}var _0x47f557=_0x45f85b[_0xa94b('0x6d')](function(_0x43cdb5){return _0x43cdb5===_0xa94b('0x6e');});if(!_0x47f557){return _0x573354(new Error('Plugin\x20manifest\x20missing'));}var _0x362df7=fs['readFileSync'](path[_0xa94b('0x4a')](_0x266d30,_0x591812[0x0],'manifest.json'));var _0x31eda0=JSON['parse'](_0x362df7);if(_0xa94b('0x1e')==typeof _0x31eda0[_0xa94b('0x32')]){return _0x573354(new Error(_0xa94b('0x6f')));}if(_0xa94b('0x1e')==typeof _0x31eda0[_0xa94b('0x2f')]){return _0x573354(new Error(_0xa94b('0x70')));}if('undefined'==typeof _0x31eda0['version']){return _0x573354(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0xa94b('0x1e')==typeof _0x31eda0['parameters']){return _0x573354(new Error(_0xa94b('0x71')));}if(_0x31eda0[_0xa94b('0x2f')]==='html'){if(_0xa94b('0x1e')==typeof _0x31eda0[_0xa94b('0x72')]['views']){return _0x573354(new Error(_0xa94b('0x73')));}if('undefined'==typeof _0x31eda0[_0xa94b('0x72')][_0xa94b('0x74')][_0xa94b('0x75')]&&_0xa94b('0x1e')==typeof _0x31eda0['parameters'][_0xa94b('0x74')]['agent']){return _0x573354(new Error(_0xa94b('0x76')));}}else if(_0x31eda0[_0xa94b('0x2f')]==='script'){if('undefined'==typeof _0x31eda0['parameters'][_0xa94b('0x77')]){return _0x573354(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0xa94b('0x1e')==typeof _0x31eda0[_0xa94b('0x72')][_0xa94b('0x78')]){return _0x573354(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x573354(new Error(_0xa94b('0x79')));}var _0x3c0e5d=_0x31eda0[_0xa94b('0x32')];var _0x3f8aef=_0x31eda0[_0xa94b('0x7a')];var _0x433cc5=_0x31eda0[_0xa94b('0x2f')];var _0x1bbf51=_0x31eda0[_0xa94b('0x7b')]?_0x31eda0[_0xa94b('0x7b')]:'always';var _0x344c49=_0x31eda0[_0xa94b('0x7c')]?_0x31eda0[_0xa94b('0x7c')]:'icon-apps';var _0x532b3d='';var _0x2710ac='';var _0x1fed5b='';var _0x4f160f='';var _0x1f5c12=_0x31eda0[_0xa94b('0x7d')];if(_0x433cc5===_0xa94b('0x7e')){if(_0xa94b('0x1e')!=typeof _0x31eda0[_0xa94b('0x72')]['views']['admin']){var _0x348dc2=_0x31eda0['parameters'][_0xa94b('0x74')]['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x348dc2)){_0x532b3d=path[_0xa94b('0x4a')]('plugins',_0x33ec8d,_0x591812[0x0],_0x348dc2);}else{_0x532b3d=_0x348dc2;}}else{logger[_0xa94b('0x60')](_0xa94b('0x7f'));}if('undefined'!=typeof _0x31eda0[_0xa94b('0x72')][_0xa94b('0x74')][_0xa94b('0x80')]){var _0x2e5856=_0x31eda0[_0xa94b('0x72')][_0xa94b('0x74')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0xa94b('0x81')](_0x2e5856)){_0x2710ac=path[_0xa94b('0x4a')]('plugins',_0x33ec8d,_0x591812[0x0],_0x2e5856);}else{_0x2710ac=_0x2e5856;}}else{logger[_0xa94b('0x60')](_0xa94b('0x82'));}}else if(_0x433cc5===_0xa94b('0x83')){_0x1fed5b=_0x31eda0[_0xa94b('0x72')][_0xa94b('0x77')];_0x4f160f=_0x31eda0[_0xa94b('0x72')][_0xa94b('0x78')];if(_0xa94b('0x1e')!=typeof _0x31eda0[_0xa94b('0x72')][_0xa94b('0x74')]){if(_0xa94b('0x1e')!=typeof _0x31eda0[_0xa94b('0x72')][_0xa94b('0x74')][_0xa94b('0x75')]){var _0x348dc2=_0x31eda0[_0xa94b('0x72')][_0xa94b('0x74')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0xa94b('0x81')](_0x348dc2)){_0x532b3d=path[_0xa94b('0x4a')](_0xa94b('0x84'),_0x33ec8d,_0x591812[0x0],_0x348dc2);}else{_0x532b3d=_0x348dc2;}}if('undefined'!=typeof _0x31eda0[_0xa94b('0x72')][_0xa94b('0x74')][_0xa94b('0x80')]){var _0x2e5856=_0x31eda0[_0xa94b('0x72')][_0xa94b('0x74')][_0xa94b('0x80')];if(!/^(f|ht)tps?:\/\//i[_0xa94b('0x81')](_0x2e5856)){_0x2710ac=path[_0xa94b('0x4a')](_0xa94b('0x84'),_0x33ec8d,_0x591812[0x0],_0x2e5856);}else{_0x2710ac=_0x2e5856;}}}}var _0x5bb13b={'name':_0x3c0e5d,'description':_0x3f8aef,'path':path['join'](_0x33ec8d,_0x591812[0x0]),'type':_0x433cc5,'sidebar':_0x1bbf51,'icon':_0x344c49,'adminUrl':_0x532b3d,'agentUrl':_0x2710ac,'scriptName':_0x1fed5b,'scriptPath':_0x4f160f,'version':_0x1f5c12};removeReferences(_0x84128d,null);return db['Plugin'][_0xa94b('0x85')](_0x5bb13b)[_0xa94b('0x25')](function(_0x1ff355){var _0x29ee05={'role':_0x387da7[_0xa94b('0x86')][_0xa94b('0x87')],'userProfileId':_0x387da7[_0xa94b('0x86')][_0xa94b('0x88')]};if(!_0x29ee05)throw new Error(_0xa94b('0x89'));if(_0x29ee05[_0xa94b('0x87')]===_0xa94b('0x8a')){var _0x15fa3a=_0x1ff355[_0xa94b('0x26')]({'plain':!![]});return db[_0xa94b('0x8b')][_0xa94b('0x49')]({'where':{'name':_0xa94b('0x8c'),'userProfileId':_0x29ee05['userProfileId']},'raw':!![]})['then'](function(_0x18c7cc){if(_0x18c7cc&&_0x18c7cc[_0xa94b('0x8d')]===0x0){return db[_0xa94b('0x27')][_0xa94b('0x85')]({'name':_0x15fa3a[_0xa94b('0x32')],'resourceId':_0x15fa3a['id'],'type':_0x18c7cc[_0xa94b('0x32')],'sectionId':_0x18c7cc['id']},{})['then'](function(){return _0x1ff355;});}else{return _0x1ff355;}})['catch'](function(_0x106a33){logger[_0xa94b('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x106a33);throw _0x106a33;});}return _0x1ff355;})[_0xa94b('0x25')](respondWithResult(_0x1dd1ea,null))[_0xa94b('0x46')](handleError(_0x1dd1ea,null));}});}catch(_0x6623fa){_0x1dd1ea[_0xa94b('0x1c')](0x1f4)['send'](_0x6623fa);}};function removeReferences(_0x253f11,_0x1be35a){try{if(_0x253f11){fs[_0xa94b('0x5f')](_0x253f11);logger['info'](_0xa94b('0x8e'));}if(_0x1be35a){rimraf(_0x1be35a,function(){});logger[_0xa94b('0x60')]('Extracted\x20folder\x20removed');}}catch(_0x2ca3c6){logger[_0xa94b('0x28')](_0x2ca3c6);}}exports[_0xa94b('0x24')]=function(_0x1adc47,_0x397b19,_0x5f3e63){return db[_0xa94b('0x2d')][_0xa94b('0x49')]({'where':{'id':_0x1adc47['params']['id']}})['then'](handleEntityNotFound(_0x397b19,null))['then'](saveUpdates(_0x1adc47[_0xa94b('0x86')],null))[_0xa94b('0x25')](respondWithResult(_0x397b19,null))['catch'](handleError(_0x397b19,null));};exports['delete']=function(_0x10f5de,_0x3bbacb,_0xac4b15){return db[_0xa94b('0x2d')][_0xa94b('0x49')]({'where':{'id':_0x10f5de[_0xa94b('0x47')]['id']}})[_0xa94b('0x25')](function(_0xd253da){if(_0xd253da){return _0xd253da[_0xa94b('0x8f')]();}})[_0xa94b('0x25')](function(_0x39d5e8){rimraf(path['join'](config[_0xa94b('0x4b')],_0xa94b('0x4c'),path[_0xa94b('0x90')](_0x39d5e8[_0xa94b('0x5')])),function(){});return _0x39d5e8;})['then'](handleEntityNotFound(_0x3bbacb,null))[_0xa94b('0x25')](respondWithStatusCode(_0x3bbacb,null))[_0xa94b('0x46')](handleError(_0x3bbacb,null));};exports[_0xa94b('0x91')]=function(_0x4b085a,_0x1e58f8,_0x5c0d){return BPromise[_0xa94b('0x92')]()[_0xa94b('0x25')](function(){if(!_0x4b085a['query'][_0xa94b('0x5')]){throw new Error(_0xa94b('0x93'));}if(!_0x4b085a['query'][_0xa94b('0x94')]){throw new Error(_0xa94b('0x95'));}var _0x23829d=_0x4b085a['query']['hostname']?_0x4b085a[_0xa94b('0x33')]['hostname']+':'+_0x4b085a['query'][_0xa94b('0x94')]:_0xa94b('0x96')+_0x4b085a[_0xa94b('0x33')]['port'];var _0x549882=_0x4b085a[_0xa94b('0x33')][_0xa94b('0x97')]?_0x4b085a['query'][_0xa94b('0x97')]:!![];var _0x5dfe14=_0x4b085a[_0xa94b('0x33')][_0xa94b('0x98')]?_0x4b085a[_0xa94b('0x33')][_0xa94b('0x98')]:null;var _0x3221be={'method':_0x4b085a[_0xa94b('0x99')],'uri':util['format'](_0xa94b('0x9a'),_0x23829d,_0x4b085a[_0xa94b('0x33')][_0xa94b('0x5')]),'json':_0x549882,'resolveWithFullResponse':!![],'encoding':_0x5dfe14,'qs':_0x4b085a['query']};if(_0x4b085a['headers']){_0x3221be[_0xa94b('0x9b')]=_0x4b085a[_0xa94b('0x9b')];if(_0x3221be[_0xa94b('0x9b')][_0xa94b('0x9c')]){delete _0x3221be['headers'][_0xa94b('0x9c')];}}if(_0x3221be['headers'][_0xa94b('0x9d')]){delete _0x3221be[_0xa94b('0x9b')][_0xa94b('0x9d')];}return rp(_0x3221be);})[_0xa94b('0x25')](function(_0xc3dc22){if(_0xc3dc22){_0x1e58f8[_0xa94b('0x9e')](_0xc3dc22[_0xa94b('0x9b')]);logger[_0xa94b('0x60')](_0xc3dc22[_0xa94b('0x86')]);if(_[_0xa94b('0x9f')](_0x4b085a[_0xa94b('0x33')]['path'],_0xa94b('0xa0'))&&_0xc3dc22[_0xa94b('0xa1')]==0x1f4){return _0x1e58f8[_0xa94b('0x1b')](_0xc3dc22[_0xa94b('0xa1')]);}else{return _0x1e58f8['status'](_0xc3dc22['statusCode'])[_0xa94b('0x2a')](_0xc3dc22['body']);}}else{return _0x1e58f8[_0xa94b('0x1b')](0xc8);}})[_0xa94b('0x46')](handleError(_0x1e58f8,null));};exports[_0xa94b('0xa2')]=function(_0x52cd43,_0x13af7f,_0x15a5f5){return BPromise['resolve']()[_0xa94b('0x25')](function(){if(!_0x52cd43[_0xa94b('0x33')][_0xa94b('0x5')]){throw new Error(_0xa94b('0x93'));}if(!_0x52cd43[_0xa94b('0x33')][_0xa94b('0x94')]){throw new Error(_0xa94b('0x95'));}var _0x42f32e=_0x52cd43[_0xa94b('0x33')][_0xa94b('0xa3')]?_0x52cd43[_0xa94b('0x33')]['hostname']+':'+_0x52cd43['query'][_0xa94b('0x94')]:_0xa94b('0x96')+_0x52cd43[_0xa94b('0x33')]['port'];var _0x4e2453=_0x52cd43['query']['json']?_0x52cd43[_0xa94b('0x33')][_0xa94b('0x97')]:!![];var _0x44ae17=_0x52cd43[_0xa94b('0x33')][_0xa94b('0x98')]?_0x52cd43['query'][_0xa94b('0x98')]:null;var _0x41e64d={'method':_0x52cd43[_0xa94b('0x99')],'uri':util['format'](_0xa94b('0x9a'),_0x42f32e,_0x52cd43[_0xa94b('0x33')][_0xa94b('0x5')]),'json':_0x4e2453,'resolveWithFullResponse':!![],'encoding':_0x44ae17,'body':_0x52cd43[_0xa94b('0x86')]};if(_0x52cd43[_0xa94b('0x9b')]){_0x41e64d['headers']=_0x52cd43[_0xa94b('0x9b')];if(_0x41e64d['headers']['content-length']){delete _0x41e64d[_0xa94b('0x9b')]['content-length'];}}if(_0x41e64d[_0xa94b('0x9b')][_0xa94b('0x9d')]){delete _0x41e64d['headers'][_0xa94b('0x9d')];}return rp(_0x41e64d);})[_0xa94b('0x25')](function(_0x5f3d6e){if(_0x5f3d6e){_0x13af7f['set'](_0x5f3d6e[_0xa94b('0x9b')]);logger[_0xa94b('0x60')](_0x5f3d6e[_0xa94b('0x86')]);return _0x13af7f['status'](_0x5f3d6e[_0xa94b('0xa1')])[_0xa94b('0x2a')](_0x5f3d6e[_0xa94b('0x86')]);}else{return _0x13af7f[_0xa94b('0x1b')](0xc8);}})[_0xa94b('0x46')](handleError(_0x13af7f,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index b0c58be..e9a7519 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 _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 +var _0xaa37=['../../mysqldb','Plugin','setMaxListeners','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x1c7d93,_0x3c5644){var _0x2b51aa=function(_0x5c0d10){while(--_0x5c0d10){_0x1c7d93['push'](_0x1c7d93['shift']());}};_0x2b51aa(++_0x3c5644);}(_0xaa37,0x1d3));var _0x7aa3=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0xaa37[_0x24061a];return _0x82054e;};'use strict';var EventEmitter=require(_0x7aa3('0x0'));var Plugin=require(_0x7aa3('0x1'))['db'][_0x7aa3('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x7aa3('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7aa3('0x4'),'afterDestroy':_0x7aa3('0x5')};function emitEvent(_0x27333d){return function(_0x11e64c,_0x334919,_0x2801a2){PluginEvents[_0x7aa3('0x6')](_0x27333d+':'+_0x11e64c['id'],_0x11e64c);PluginEvents['emit'](_0x27333d,_0x11e64c);_0x2801a2(null);};}for(var e in events){if(events[_0x7aa3('0x7')](e)){var event=events[e];Plugin[_0x7aa3('0x8')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index b86bf53..681be76 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 _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 +var _0xfd4c=['Plugin','plugins','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./plugin.attributes','exports','define'];(function(_0x1fe126,_0x4104e3){var _0x5d5ad9=function(_0x4a3028){while(--_0x4a3028){_0x1fe126['push'](_0x1fe126['shift']());}};_0x5d5ad9(++_0x4104e3);}(_0xfd4c,0x17b));var _0xcfd4=function(_0x58977e,_0x1e7a29){_0x58977e=_0x58977e-0x0;var _0x21db58=_0xfd4c[_0x58977e];return _0x21db58;};'use strict';var _=require(_0xcfd4('0x0'));var util=require(_0xcfd4('0x1'));var logger=require('../../config/logger')(_0xcfd4('0x2'));var moment=require(_0xcfd4('0x3'));var BPromise=require(_0xcfd4('0x4'));var rp=require(_0xcfd4('0x5'));var fs=require('fs');var path=require(_0xcfd4('0x6'));var rimraf=require('rimraf');var config=require(_0xcfd4('0x7'));var attributes=require(_0xcfd4('0x8'));module[_0xcfd4('0x9')]=function(_0xd1c181,_0x2fddeb){return _0xd1c181[_0xcfd4('0xa')](_0xcfd4('0xb'),attributes,{'tableName':_0xcfd4('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 820c1be..570e401 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 _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 +var _0xbad9=['http','redis','defaults','localhost','socket.io-emitter','request','then','info','request\x20sent','debug','stringify','error','code','Plugin,\x20%s,\x20%s','message','catch','CreatePlugin','Plugin','options','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0xbad9,0x119));var _0x9bad=function(_0x679d6a,_0x5aa7a4){_0x679d6a=_0x679d6a-0x0;var _0x278b98=_0xbad9[_0x679d6a];return _0x278b98;};'use strict';var _=require('lodash');var util=require(_0x9bad('0x0'));var moment=require(_0x9bad('0x1'));var BPromise=require(_0x9bad('0x2'));var rs=require(_0x9bad('0x3'));var fs=require('fs');var Redis=require(_0x9bad('0x4'));var db=require(_0x9bad('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9bad('0x6'))('rpc');var config=require(_0x9bad('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9bad('0x8')][_0x9bad('0x9')]({'port':0x232a});config[_0x9bad('0xa')]=_[_0x9bad('0xb')](config[_0x9bad('0xa')],{'host':_0x9bad('0xc'),'port':0x18eb});var socket=require(_0x9bad('0xd'))(new Redis(config[_0x9bad('0xa')]));require('./plugin.socket')['register'](socket);function respondWithRpcPromise(_0x100abb,_0x45d36b,_0x25b29f){return new BPromise(function(_0x202b10,_0x5f9a39){return client[_0x9bad('0xe')](_0x100abb,_0x25b29f)[_0x9bad('0xf')](function(_0x7af6eb){logger[_0x9bad('0x10')]('Plugin,\x20%s,\x20%s',_0x45d36b,_0x9bad('0x11'));logger[_0x9bad('0x12')]('Plugin,\x20%s,\x20%s,\x20%s',_0x45d36b,'request\x20sent',JSON[_0x9bad('0x13')](_0x7af6eb));if(_0x7af6eb[_0x9bad('0x14')]){if(_0x7af6eb[_0x9bad('0x14')][_0x9bad('0x15')]===0x1f4){logger[_0x9bad('0x14')](_0x9bad('0x16'),_0x45d36b,_0x7af6eb[_0x9bad('0x14')][_0x9bad('0x17')]);return _0x5f9a39(_0x7af6eb[_0x9bad('0x14')][_0x9bad('0x17')]);}logger[_0x9bad('0x14')]('Plugin,\x20%s,\x20%s',_0x45d36b,_0x7af6eb['error'][_0x9bad('0x17')]);return _0x202b10(_0x7af6eb[_0x9bad('0x14')]['message']);}else{logger[_0x9bad('0x10')](_0x9bad('0x16'),_0x45d36b,'request\x20sent');_0x202b10(_0x7af6eb['result'][_0x9bad('0x17')]);}})[_0x9bad('0x18')](function(_0x54044f){logger[_0x9bad('0x14')](_0x9bad('0x16'),_0x45d36b,_0x54044f);_0x5f9a39(_0x54044f);});});}exports[_0x9bad('0x19')]=function(_0x3f1788){var _0x4cb0d0=this;return new Promise(function(_0x1f3ba3,_0x3fb3b9){return db[_0x9bad('0x1a')]['create'](_0x3f1788['body'],{'raw':_0x3f1788[_0x9bad('0x1b')]?_0x3f1788[_0x9bad('0x1b')][_0x9bad('0x1c')]===undefined?!![]:![]:!![]})[_0x9bad('0xf')](function(_0x179486){logger['info'](_0x9bad('0x19'),_0x3f1788);logger[_0x9bad('0x12')](_0x9bad('0x19'),_0x3f1788,JSON[_0x9bad('0x13')](_0x179486));_0x1f3ba3(_0x179486);})['catch'](function(_0x1d5a8a){logger['error'](_0x9bad('0x19'),_0x1d5a8a[_0x9bad('0x17')],_0x3f1788);_0x3fb3b9(_0x4cb0d0[_0x9bad('0x14')](0x1f4,_0x1d5a8a['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index a119eff..ff7d5bb 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 _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 +var _0x7957=['register','length','plugin:','./plugin.events','save','remove','update'];(function(_0x14b5e3,_0x43e64d){var _0x5c76f2=function(_0x46514b){while(--_0x46514b){_0x14b5e3['push'](_0x14b5e3['shift']());}};_0x5c76f2(++_0x43e64d);}(_0x7957,0x1b5));var _0x7795=function(_0x4dab14,_0x164ea0){_0x4dab14=_0x4dab14-0x0;var _0xf41aa=_0x7957[_0x4dab14];return _0xf41aa;};'use strict';var PluginEvents=require(_0x7795('0x0'));var events=[_0x7795('0x1'),_0x7795('0x2'),_0x7795('0x3')];function createListener(_0x1c2040,_0x4a2431){return function(_0xe00933){_0x4a2431['emit'](_0x1c2040,_0xe00933);};}function removeListener(_0x57dbeb,_0x310926){return function(){PluginEvents['removeListener'](_0x57dbeb,_0x310926);};}exports[_0x7795('0x4')]=function(_0x45b40e){for(var _0x417469=0x0,_0x3a3e67=events[_0x7795('0x5')];_0x417469<_0x3a3e67;_0x417469++){var _0xe8c1ed=events[_0x417469];var _0x5ef4b4=createListener(_0x7795('0x6')+_0xe8c1ed,_0x45b40e);PluginEvents['on'](_0xe8c1ed,_0x5ef4b4);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index b70a397..9f1fa05 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(_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 +var _0xa9e0=['create','put','delete','destroy','exports','express','Router','../../components/auth/service','isAuthenticated','get','/:id','show','post'];(function(_0x18f470,_0x126c62){var _0x1b9963=function(_0x383318){while(--_0x383318){_0x18f470['push'](_0x18f470['shift']());}};_0x1b9963(++_0x126c62);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index 9795cfd..8acdcc3 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 _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 +var _0xd8b0=['info','index','list','then','reject','express','motion2','length','show','describe','params','catch','body','script','join','dirname','chdir','start','update','restart','hasOwnProperty','Unknown\x20status','destroy','dump','Unknown\x20id','lodash','../../config/pm2','child_process','exec','bluebird','json','error','stack','name','status','send','npm\x20install'];(function(_0x414fc0,_0xe1141c){var _0x180564=function(_0x430732){while(--_0x430732){_0x414fc0['push'](_0x414fc0['shift']());}};_0x180564(++_0xe1141c);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var pm2=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var path=require('path');var exec=require(_0x0d8b('0x2'))[_0x0d8b('0x3')];var BPromise=require(_0x0d8b('0x4'));function handleEntityNotFound(_0x364286,_0x8196ed){return function(_0x577834){if(!_0x577834){_0x364286['sendStatus'](0x194);;}return _0x577834;};}function respondWithResult(_0x3f8b6f,_0x227c63){_0x227c63=_0x227c63||0xc8;return function(_0x39f43a){if(_0x39f43a){return _0x3f8b6f['status'](_0x227c63)[_0x0d8b('0x5')](_0x39f43a);}return null;};}function handleError(_0x284169,_0x58e4e2){_0x58e4e2=_0x58e4e2||0x1f4;return function(_0x129310){logger[_0x0d8b('0x6')](_0x129310[_0x0d8b('0x7')]);if(_0x129310[_0x0d8b('0x8')]){delete _0x129310[_0x0d8b('0x8')];}_0x284169[_0x0d8b('0x9')](_0x58e4e2)[_0x0d8b('0xa')](_0x129310);};}function execChildProcess(){return new BPromise(function(_0x28f87c,_0x48fa16){exec(_0x0d8b('0xb'),function(_0x4e0269,_0x4225c4,_0xc574a3){logger[_0x0d8b('0xc')](_0x4225c4);logger[_0x0d8b('0xc')](_0xc574a3);if(_0x4e0269){logger[_0x0d8b('0x6')](_0x4e0269);return _0x48fa16(_0x4e0269);}return _0x28f87c(_0x4225c4);});});}exports[_0x0d8b('0xd')]=function(_0x15dd0f,_0x31a8cc){return pm2[_0x0d8b('0xe')]()[_0x0d8b('0xf')](function(_0x5ad086){if(_0x5ad086){var _0xe65334=_[_0x0d8b('0x10')](_0x5ad086,function(_0x2d4e1c){return _0x2d4e1c['name']===_0x0d8b('0x11')||_0x2d4e1c[_0x0d8b('0x8')]===_0x0d8b('0x12');});return{'rows':_0xe65334,'count':_0xe65334[_0x0d8b('0x13')]};}return null;})[_0x0d8b('0xf')](respondWithResult(_0x31a8cc,null))['catch'](handleError(_0x31a8cc,null));};exports[_0x0d8b('0x14')]=function(_0x4586c2,_0x2fd0fc){return pm2[_0x0d8b('0x15')](_0x4586c2[_0x0d8b('0x16')]['id'])[_0x0d8b('0xf')](respondWithResult(_0x2fd0fc,null))[_0x0d8b('0xf')](handleEntityNotFound(_0x2fd0fc,null))[_0x0d8b('0x17')](handleError(_0x2fd0fc,null));};exports['create']=function(_0x27512e,_0x23d58f){if(_0x27512e[_0x0d8b('0x18')][_0x0d8b('0x8')]&&_0x27512e[_0x0d8b('0x18')][_0x0d8b('0x19')]){var _0x393beb=path[_0x0d8b('0x1a')](__dirname,'../../files/plugins',_0x27512e['body'][_0x0d8b('0x19')]);var _0x54a9a7=process['cwd']();process['chdir'](path[_0x0d8b('0x1b')](_0x393beb));return execChildProcess()[_0x0d8b('0xf')](function(_0x214778){process[_0x0d8b('0x1c')](_0x54a9a7);return pm2[_0x0d8b('0x1d')]({'name':_0x27512e[_0x0d8b('0x18')][_0x0d8b('0x8')],'script':_0x393beb});})[_0x0d8b('0xf')](function(_0x27b695){pm2['dump']();return _0x27b695[0x0];})[_0x0d8b('0xf')](respondWithResult(_0x23d58f,0xc9))[_0x0d8b('0x17')](handleError(_0x23d58f,null));}else{return _0x23d58f['status'](0x1f4)[_0x0d8b('0xa')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x0d8b('0x1e')]=function(_0x234bdd,_0xa2af02){if(_0x234bdd['body']['id']){delete _0x234bdd['body']['id'];}var _0x28f639={'online':_0x0d8b('0x1f'),'stopped':'stop'};if(_0x28f639[_0x0d8b('0x20')](_0x234bdd['body'][_0x0d8b('0x9')])){return pm2[_0x28f639[_0x234bdd['body'][_0x0d8b('0x9')]]](_0x234bdd['params']['id'])[_0x0d8b('0xf')](respondWithResult(_0xa2af02,0xc8))['catch'](handleError(_0xa2af02,null));}else{return _0xa2af02[_0x0d8b('0x9')](0x1f4)['send']({'message':_0x0d8b('0x21')});}};exports[_0x0d8b('0x22')]=function(_0x2c058d,_0x56120a){if(_0x2c058d['body']['id']){delete _0x2c058d['body']['id'];}if(_0x2c058d[_0x0d8b('0x16')]['id']){return pm2['delete'](_0x2c058d[_0x0d8b('0x16')]['id'])['then'](function(_0x5d05fc){pm2[_0x0d8b('0x23')]();return _0x5d05fc[0x0];})[_0x0d8b('0xf')](respondWithResult(_0x56120a,null))[_0x0d8b('0x17')](handleError(_0x56120a,null));}else{return _0x56120a[_0x0d8b('0x9')](0x1f4)[_0x0d8b('0xa')]({'message':_0x0d8b('0x24')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 40f5a1c..c010ff7 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 _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 +var _0x1f71=['isAuthenticated','getAgents','/queues','getQueues','exports','Router','../../components/auth/service','get','/agents'];(function(_0x41b389,_0x495677){var _0x4c0b66=function(_0x4abc75){while(--_0x4abc75){_0x41b389['push'](_0x41b389['shift']());}};_0x4c0b66(++_0x495677);}(_0x1f71,0x1ac));var _0x11f7=function(_0x311ddd,_0x3e6407){_0x311ddd=_0x311ddd-0x0;var _0x40b3ef=_0x1f71[_0x311ddd];return _0x40b3ef;};'use strict';var express=require('express');var router=express[_0x11f7('0x0')]();var auth=require(_0x11f7('0x1'));var controller=require('./realtime.controller');router[_0x11f7('0x2')](_0x11f7('0x3'),auth[_0x11f7('0x4')](),controller[_0x11f7('0x5')]);router['get'](_0x11f7('0x6'),auth[_0x11f7('0x4')](),controller[_0x11f7('0x7')]);module[_0x11f7('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 364cc6c..3ccb1ce 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 _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 +var _0x0af5=['userProfileId','Agents','online','extraQueryConditions','UserProfile','getResources','User','findAndCountAll','map','find','filterAgentAttributes','getAgentStatus','voice','talking','voiceStatus','Status','sortAgentsByStatus','getRealtimeAgentsQueryFields','catch','getQueues','startCase','Queue','type','outbound','dialActive','role','QueueCampaigns','Queues','name','filter','assign','getRealtimeQueues','initializeQueues','lodash','../../components/realtime/agents','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','handleError','offset','undefined','limit','count','status','set','Content-Range','getAgents','getChannels','query','globalQueueFilter','pauseTypeFilter','pause','*pause','resolve','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','getAgentIdsByQueues','rows','getSortedAgentsIdsByStatus','length','fieldName','key','agent','getOptions','raw','push','sequelize','literal','order','forEach','Pause','where','merge','user'];(function(_0x282c6d,_0x3b51c8){var _0x97a529=function(_0x5c4e90){while(--_0x5c4e90){_0x282c6d['push'](_0x282c6d['shift']());}};_0x97a529(++_0x3b51c8);}(_0x0af5,0xcd));var _0x50af=function(_0x13e763,_0x4dcd3c){_0x13e763=_0x13e763-0x0;var _0x25c0e8=_0x0af5[_0x13e763];return _0x25c0e8;};'use strict';var _=require(_0x50af('0x0'));var util=require('util');var rta=require(_0x50af('0x1'));var rtq=require('../../components/realtime/queues');var qs=require(_0x50af('0x2'));var utils=require(_0x50af('0x3'));var db=require(_0x50af('0x4'))['db'];var APIBadRequestError=require(_0x50af('0x5'))['APIBadRequestError'];var APIHandleError=require(_0x50af('0x5'))[_0x50af('0x6')];function respondWithFilteredResult(_0x8e5656,_0x1dff1c){return function(_0xd40f2c){if(_0xd40f2c){var _0x42e368=typeof _0x1dff1c[_0x50af('0x7')]===_0x50af('0x8')&&typeof _0x1dff1c[_0x50af('0x9')]===_0x50af('0x8');var _0x48b1a1=_0xd40f2c['count'];var _0x33543b=_0x42e368?0x0:_0x1dff1c[_0x50af('0x7')];var _0x139e29=_0x42e368?_0xd40f2c[_0x50af('0xa')]:_0x1dff1c['offset']+_0x1dff1c[_0x50af('0x9')];var _0x5bb35b;if(_0x139e29>=_0x48b1a1){_0x139e29=_0x48b1a1;_0x5bb35b=0xc8;}else{_0x5bb35b=0xce;}_0x8e5656[_0x50af('0xb')](_0x5bb35b);return _0x8e5656[_0x50af('0xc')](_0x50af('0xd'),_0x33543b+'-'+_0x139e29+'/'+_0x48b1a1)['json'](_0xd40f2c);}return null;};}exports[_0x50af('0xe')]=function(_0x26a448,_0x3d1ddd){var _0xc29b4e={'count':0x0,'rows':[]};var _0x2b707f={};var _0x2c3f98;var _0xe4bb73=utils[_0x50af('0xf')]();var _0x51669f;var _0x29d7d5;var _0x3919b7=_0x26a448[_0x50af('0x10')][_0x50af('0x11')];var _0x3349d7=_0x26a448[_0x50af('0x10')]['globalStatusFilter'];var _0x150bba=_0x26a448[_0x50af('0x10')][_0x50af('0x12')];var _0x142998=_0x3349d7===_0x50af('0x13')||_0x3349d7===_0x50af('0x14')?!![]:![];var _0xd24e36=[];var _0x721a8b;var _0xfb7f;Promise[_0x50af('0x15')]()[_0x50af('0x16')](function(){if(_0x26a448[_0x50af('0x10')][_0x50af('0x17')]){if(!utils[_0x50af('0x18')](_0x26a448['query'][_0x50af('0x17')])){throw new APIBadRequestError(util[_0x50af('0x19')](_0x50af('0x1a'),_0x26a448['query']['channel']));}_0x2c3f98=_0x26a448[_0x50af('0x10')]['channel'][_0x50af('0x1b')]();}if(!_0x26a448[_0x50af('0x10')][_0x50af('0x1c')]||!_0x26a448[_0x50af('0x10')]['sort'][_0x50af('0x1d')](_0x50af('0x1e'))){_0x26a448[_0x50af('0x10')][_0x50af('0x1c')]=rta[_0x50af('0x1f')](_0x26a448[_0x50af('0x10')]['sort']);return;}var _0x32117c=rta[_0x50af('0x20')](_0x26a448[_0x50af('0x10')]['sort']);_0x26a448[_0x50af('0x10')][_0x50af('0x1c')]=_0x32117c[_0x50af('0x21')][_0x50af('0x22')](',');_0x721a8b=_0x32117c['order'];})['then'](function(){if(!_0x3919b7){return[];}return rta[_0x50af('0x23')](_0x3919b7,_0x2c3f98);})['then'](function(_0x91fd19){_0xd24e36=_0x91fd19;return rta['getRealtimeAgents']();})[_0x50af('0x16')](function(_0x350c96){_0x29d7d5=_0x350c96[_0x50af('0x24')];if((!_0x3349d7||_0x142998)&&!_0x721a8b){return _0xd24e36;}if(_0x721a8b&&!_0x3349d7){return rta[_0x50af('0x25')](_0x29d7d5,_0xd24e36,_0x721a8b);}else{return rta['getAgentIdsByStatus'](_0x29d7d5,_0xd24e36,_0x3349d7);}})[_0x50af('0x16')](function(_0x397128){_0xd24e36=_0x397128;var _0x10008c=![];if(_0xd24e36[_0x50af('0x26')]===0x0){if(_0x3919b7||_0x3349d7){_0x10008c=!![];}if(_0x142998){_0x10008c=![];}}if(_0x10008c){return _0xc29b4e;}var _0x1e3652=_['map'](db['User']['rawAttributes'],function(_0x1f8563){return{'name':_0x1f8563[_0x50af('0x27')],'type':_0x1f8563['type'][_0x50af('0x28')]};});_0x26a448[_0x50af('0x10')]['role']=_0x50af('0x29');_0x2b707f=qs[_0x50af('0x2a')](_0x1e3652,_0x26a448);_0x2b707f[_0x50af('0x2b')]=!![];var _0x31d027=[];if(_0xd24e36[_0x50af('0x26')]>0x0){_0x31d027[_0x50af('0x2c')]({'id':{'$in':_0xd24e36}});if(_0x721a8b&&!_0x3349d7){_0xfb7f=[db[_0x50af('0x2d')][_0x50af('0x2e')]('FIELD(id,'+_0xd24e36+')')];_0x2b707f[_0x50af('0x2f')]=_0xfb7f;}}if(_0x142998){_0xe4bb73[_0x50af('0x30')](function(_0x228e51){var _0x481c21=!![];if(_0x3349d7===_0x50af('0x14')&&_0x2c3f98!==_0x228e51){_0x481c21=![];}_0x31d027[_0x50af('0x2c')]({[_0x228e51+'Pause']:_0x481c21});});if(_0x150bba){_0x31d027[_0x50af('0x2c')]({'pauseType':_0x150bba});}}else if(_0x3349d7){_0xe4bb73[_0x50af('0x30')](function(_0x525a1f){_0x31d027['push']({[_0x525a1f+_0x50af('0x31')]:![]});});}_0x2b707f[_0x50af('0x32')]=_[_0x50af('0x33')](_0x2b707f[_0x50af('0x32')],{'$and':_0x31d027});if(_0x26a448[_0x50af('0x34')]['role']===_0x50af('0x34')){var _0x5c05dd={'params':{'id':_0x26a448['user'][_0x50af('0x35')]},'query':{'section':_0x50af('0x36'),'role':_0x50af('0x29'),'raw':!![],'ids':_0xd24e36,'customSorting':_0xfb7f}};if(_0x26a448[_0x50af('0x10')]['online']){_0x5c05dd[_0x50af('0x10')][_0x50af('0x37')]=!![];}if(_0x142998){_0x5c05dd['query'][_0x50af('0x38')]=_0x31d027;}_0x5c05dd[_0x50af('0x10')]=Object['assign'](_0x5c05dd['query'],_['omit'](_0x26a448['query'],'id'));return db[_0x50af('0x39')][_0x50af('0x3a')](_0x5c05dd);}return db[_0x50af('0x3b')][_0x50af('0x3c')](_0x2b707f);})[_0x50af('0x16')](function(_0x42d6a){_0xc29b4e[_0x50af('0xa')]=_0x42d6a[_0x50af('0xa')];_0x51669f=_0x42d6a[_0x50af('0x24')];return _0x51669f[_0x50af('0x3d')](function(_0x3fde26){var _0x4b8bdb=_[_0x50af('0x3e')](_0x29d7d5,['id',_0x3fde26['id']]);if(_0x4b8bdb){var _0x147d6e=rta[_0x50af('0x3f')](_0x4b8bdb);_['merge'](_0x3fde26,_0x147d6e);}_0x3fde26[_0x50af('0x1e')]=rta[_0x50af('0x40')](_0x3fde26);if(_0x3fde26[_0x50af('0x1e')][_0x50af('0x1d')]('pause')){_0xe4bb73[_0x50af('0x30')](function(_0x2393a6){if(_0x3fde26[_0x2393a6+_0x50af('0x31')]){if(_0x2393a6===_0x50af('0x41')){if(_0x3fde26['voiceStatus']!==_0x50af('0x42')){_0x3fde26[_0x50af('0x43')]=_0x50af('0x13');}}else{_0x3fde26[_0x2393a6+_0x50af('0x44')]=_0x50af('0x13');}}});}return _0x3fde26;});})[_0x50af('0x16')](function(_0x2f32c8){if(!_0x721a8b||_0xfb7f){return _0x2f32c8;}return rta[_0x50af('0x45')](_0x2f32c8,_0x721a8b);})[_0x50af('0x16')](function(_0x360c84){var _0x2d63d5=rta[_0x50af('0x46')]();_0xc29b4e['rows']=_0x360c84[_0x50af('0x3d')](function(_0x477834){return _['pick'](_0x477834,_0x2d63d5);});return _0xc29b4e;})[_0x50af('0x16')](respondWithFilteredResult(_0x3d1ddd,_0x2b707f))[_0x50af('0x47')](APIHandleError(_0x3d1ddd));};exports[_0x50af('0x48')]=function(_0x3eb5ab,_0x38311b){var _0xb21338={'count':0x0,'rows':[]};var _0x42f302={};var _0x374315;var _0x52e9af;var _0x4e2753;Promise[_0x50af('0x15')]()['then'](function(){if(_0x3eb5ab[_0x50af('0x10')]['channel']){if(!utils[_0x50af('0x18')](_0x3eb5ab[_0x50af('0x10')][_0x50af('0x17')])){throw new APIBadRequestError(util[_0x50af('0x19')](_0x50af('0x1a'),_0x3eb5ab[_0x50af('0x10')]['channel']));}_0x374315=_0x3eb5ab[_0x50af('0x10')][_0x50af('0x17')][_0x50af('0x1b')]();}var _0x289ea2=_[_0x50af('0x49')](_0x374315)+_0x50af('0x4a');var _0x138499=_[_0x50af('0x3d')](db[_0x289ea2]['rawAttributes'],function(_0x29d1d8){return{'name':_0x29d1d8['fieldName'],'type':_0x29d1d8['type'][_0x50af('0x28')]};});if(!_0x3eb5ab['query'][_0x50af('0x21')]){var _0x39e319=['id','name'];if(_0x374315===_0x50af('0x41')){_0x39e319['push']('type');if(_0x3eb5ab[_0x50af('0x10')][_0x50af('0x4b')]===_0x50af('0x4c')){_0x39e319[_0x50af('0x2c')]([_0x50af('0x4d'),'dialMethod']);}}_0x3eb5ab['query'][_0x50af('0x21')]=_0x39e319[_0x50af('0x22')](',');}_0x42f302=qs['getOptions'](_0x138499,_0x3eb5ab);if(_0x3eb5ab[_0x50af('0x34')][_0x50af('0x4e')]===_0x50af('0x34')){var _0x108430={'params':{'id':_0x3eb5ab[_0x50af('0x34')]['userProfileId']},'query':{'section':_0x374315==='voice'&&_0x3eb5ab[_0x50af('0x10')][_0x50af('0x4b')]===_0x50af('0x4c')?_0x50af('0x4f'):_[_0x50af('0x49')](_0x374315)+_0x50af('0x50'),'type':_0x3eb5ab[_0x50af('0x10')][_0x50af('0x4b')],'nolimit':!![],'sort':_0x50af('0x51'),'filter':_0x3eb5ab[_0x50af('0x10')][_0x50af('0x52')]}};_0x108430[_0x50af('0x10')]=Object[_0x50af('0x53')](_0x108430[_0x50af('0x10')],_0x3eb5ab['query']);delete _0x108430[_0x50af('0x10')]['id'];return db[_0x50af('0x39')][_0x50af('0x3a')](_0x108430);}return db[_0x289ea2]['findAndCountAll'](_0x42f302);})[_0x50af('0x16')](function(_0x35742d){_0xb21338[_0x50af('0xa')]=_0x35742d[_0x50af('0xa')];_0x52e9af=_0x35742d[_0x50af('0x24')];return rtq[_0x50af('0x54')](_0x3eb5ab,_0x374315);})[_0x50af('0x16')](function(_0x215ebc){_0x4e2753=_0x215ebc['rows'];return rtq[_0x50af('0x55')](_0x52e9af,_0x4e2753,_0x374315,_0x3eb5ab[_0x50af('0x10')][_0x50af('0x4b')]);})[_0x50af('0x16')](function(_0x3ab37f){_0xb21338[_0x50af('0x24')]=_0x3ab37f;return _0xb21338;})['then'](respondWithFilteredResult(_0x38311b,_0x42f302))['catch'](APIHandleError(_0x38311b));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 84d860a..e24225c 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_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 +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x3836a6,_0x265b87){var _0x242bf3=function(_0x3dadad){while(--_0x3dadad){_0x3836a6['push'](_0x3836a6['shift']());}};_0x242bf3(++_0x265b87);}(_0xedd9,0xfc));var _0x9edd=function(_0xf58db,_0x3cb459){_0xf58db=_0xf58db-0x0;var _0x27a9fa=_0xedd9[_0xf58db];return _0x27a9fa;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index e808d96..7d0e6ae 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 _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 +var _0x4491=['INTEGER','DATE','STRING','sequelize'];(function(_0x1cc286,_0x317221){var _0x275523=function(_0x3533ff){while(--_0x3533ff){_0x1cc286['push'](_0x1cc286['shift']());}};_0x275523(++_0x317221);}(_0x4491,0x1bb));var _0x1449=function(_0xd9d22f,_0x27aa8f){_0xd9d22f=_0xd9d22f-0x0;var _0x556540=_0x4491[_0xd9d22f];return _0x556540;};'use strict';var Sequelize=require(_0x1449('0x0'));module['exports']={'state':{'type':Sequelize[_0x1449('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x1449('0x2')]},'uniqueid':{'type':Sequelize[_0x1449('0x3')]},'starttime':{'type':Sequelize[_0x1449('0x2')]},'responsetime':{'type':Sequelize[_0x1449('0x2')]},'ringtime':{'type':Sequelize[_0x1449('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x1449('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x1449('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 05d8fea..04380fb 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 _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 +var _0xd1c3=['request-promise','rimraf','exports','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','api','bluebird'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd1c3,0xd7));var _0x3d1c=function(_0x2c5366,_0x46aa8a){_0x2c5366=_0x2c5366-0x0;var _0x4667b8=_0xd1c3[_0x2c5366];return _0x4667b8;};'use strict';var _=require(_0x3d1c('0x0'));var util=require(_0x3d1c('0x1'));var logger=require(_0x3d1c('0x2'))(_0x3d1c('0x3'));var moment=require('moment');var BPromise=require(_0x3d1c('0x4'));var rp=require(_0x3d1c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3d1c('0x6'));var config=require('../../config/environment');var attributes=require('./reportAgentPreview.attributes');module[_0x3d1c('0x7')]=function(_0x3e1bf1,_0x2bd0f0){return _0x3e1bf1['define'](_0x3d1c('0x8'),attributes,{'tableName':_0x3d1c('0x9'),'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 1aea980..4feb541 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 _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 +var _0xc062=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','ReportAgentPreview,\x20%s,\x20%s','message','result','catch','CreateReportAgentPreview','create','options','raw','debug','lodash','util','moment'];(function(_0x2f124a,_0x36e38a){var _0x54175d=function(_0x53614a){while(--_0x53614a){_0x2f124a['push'](_0x2f124a['shift']());}};_0x54175d(++_0x36e38a);}(_0xc062,0x115));var _0x2c06=function(_0x19bf8f,_0x273b7e){_0x19bf8f=_0x19bf8f-0x0;var _0x4a4c4d=_0xc062[_0x19bf8f];return _0x4a4c4d;};'use strict';var _=require(_0x2c06('0x0'));var util=require(_0x2c06('0x1'));var moment=require(_0x2c06('0x2'));var BPromise=require(_0x2c06('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2c06('0x4'));var db=require(_0x2c06('0x5'))['db'];var utils=require(_0x2c06('0x6'));var logger=require(_0x2c06('0x7'))(_0x2c06('0x8'));var config=require(_0x2c06('0x9'));var jayson=require(_0x2c06('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4f2cbc,_0xe5824f,_0x1f2b40){return new BPromise(function(_0x50066f,_0x5bc07a){return client[_0x2c06('0xb')](_0x4f2cbc,_0x1f2b40)[_0x2c06('0xc')](function(_0x4cf2e0){logger[_0x2c06('0xd')]('ReportAgentPreview,\x20%s,\x20%s',_0xe5824f,_0x2c06('0xe'));logger['debug'](_0x2c06('0xf'),_0xe5824f,_0x2c06('0xe'),JSON[_0x2c06('0x10')](_0x4cf2e0));if(_0x4cf2e0[_0x2c06('0x11')]){if(_0x4cf2e0[_0x2c06('0x11')][_0x2c06('0x12')]===0x1f4){logger[_0x2c06('0x11')](_0x2c06('0x13'),_0xe5824f,_0x4cf2e0['error'][_0x2c06('0x14')]);return _0x5bc07a(_0x4cf2e0[_0x2c06('0x11')][_0x2c06('0x14')]);}logger[_0x2c06('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0xe5824f,_0x4cf2e0[_0x2c06('0x11')][_0x2c06('0x14')]);return _0x50066f(_0x4cf2e0['error']['message']);}else{logger['info'](_0x2c06('0x13'),_0xe5824f,_0x2c06('0xe'));_0x50066f(_0x4cf2e0[_0x2c06('0x15')]['message']);}})[_0x2c06('0x16')](function(_0x959f21){logger[_0x2c06('0x11')](_0x2c06('0x13'),_0xe5824f,_0x959f21);_0x5bc07a(_0x959f21);});});}exports[_0x2c06('0x17')]=function(_0x189eb1){var _0x496c11=this;return new Promise(function(_0x3e22eb,_0x1daa67){return db['ReportAgentPreview'][_0x2c06('0x18')](_0x189eb1['body'],{'raw':_0x189eb1['options']?_0x189eb1[_0x2c06('0x19')][_0x2c06('0x1a')]===undefined?!![]:![]:!![]})[_0x2c06('0xc')](function(_0x16f032){logger['info'](_0x2c06('0x17'),_0x189eb1);logger[_0x2c06('0x1b')](_0x2c06('0x17'),_0x189eb1,JSON[_0x2c06('0x10')](_0x16f032));_0x3e22eb(_0x16f032);})[_0x2c06('0x16')](function(_0x404360){logger[_0x2c06('0x11')](_0x2c06('0x17'),_0x404360[_0x2c06('0x14')],_0x189eb1);_0x1daa67(_0x496c11['error'](0x1f4,_0x404360[_0x2c06('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 8d02c94..715863b 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 _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 +var _0xfcc5=['post','queueNotify','mail','showMailQueues','/chat/queues/:id/notify','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','showWhatsappQueues','exports','util','path','express','Router','./rpc.controller','isAuthenticated','voiceChannels','voiceChannelMixMonitor','get','/voice/channels/:uniqueid/stopmixmonitor','voiceQueues','/chat/queues','chatQueues','/mail/queues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','agents','/agents/:id/capacity','agentCapacity','/telephones','/campaigns','campaigns','/fax/accounts','faxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions'];(function(_0x48d733,_0x15b183){var _0x20239a=function(_0xd960dd){while(--_0xd960dd){_0x48d733['push'](_0x48d733['shift']());}};_0x20239a(++_0x15b183);}(_0xfcc5,0x14a));var _0x5fcc=function(_0xaa5c39,_0x564d72){_0xaa5c39=_0xaa5c39-0x0;var _0x593e89=_0xfcc5[_0xaa5c39];return _0x593e89;};'use strict';var multer=require('multer');var util=require(_0x5fcc('0x0'));var path=require(_0x5fcc('0x1'));var express=require(_0x5fcc('0x2'));var router=express[_0x5fcc('0x3')]();var auth=require('../../components/auth/service');var controller=require(_0x5fcc('0x4'));router['get']('/voice/channels',auth[_0x5fcc('0x5')](),controller[_0x5fcc('0x6')]);router['get']('/voice/channels/:uniqueid/mixmonitor',auth[_0x5fcc('0x5')](),controller[_0x5fcc('0x7')]);router[_0x5fcc('0x8')](_0x5fcc('0x9'),auth[_0x5fcc('0x5')](),controller['voiceChannelStopMixMonitor']);router[_0x5fcc('0x8')]('/voice/queues',auth[_0x5fcc('0x5')](),controller[_0x5fcc('0xa')]);router['get'](_0x5fcc('0xb'),auth[_0x5fcc('0x5')](),controller[_0x5fcc('0xc')]);router[_0x5fcc('0x8')](_0x5fcc('0xd'),auth[_0x5fcc('0x5')](),controller['mailQueues']);router['get'](_0x5fcc('0xe'),auth[_0x5fcc('0x5')](),controller[_0x5fcc('0xf')]);router[_0x5fcc('0x8')](_0x5fcc('0x10'),auth[_0x5fcc('0x5')](),controller[_0x5fcc('0x11')]);router['get'](_0x5fcc('0x12'),auth['isAuthenticated'](),controller[_0x5fcc('0x13')]);router[_0x5fcc('0x8')](_0x5fcc('0x14'),auth[_0x5fcc('0x5')](),controller['whatsappQueues']);router[_0x5fcc('0x8')](_0x5fcc('0x15'),auth[_0x5fcc('0x5')](),controller[_0x5fcc('0x16')]);router[_0x5fcc('0x8')](_0x5fcc('0x17'),auth[_0x5fcc('0x5')](),controller['voiceQueuesPreview']);router[_0x5fcc('0x8')]('/voice/queues/channels',auth[_0x5fcc('0x5')](),controller[_0x5fcc('0x18')]);router[_0x5fcc('0x8')](_0x5fcc('0x19'),auth[_0x5fcc('0x5')](),controller[_0x5fcc('0x1a')]);router[_0x5fcc('0x8')](_0x5fcc('0x1b'),auth[_0x5fcc('0x5')](),controller['voiceQueuesChannelHangup']);router['get']('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0x5fcc('0x5')](),controller[_0x5fcc('0x1c')]);router[_0x5fcc('0x8')](_0x5fcc('0x1d'),auth['isAuthenticated'](),controller[_0x5fcc('0x1e')]);router[_0x5fcc('0x1f')](_0x5fcc('0x1d'),auth[_0x5fcc('0x5')](),controller[_0x5fcc('0x20')]);router[_0x5fcc('0x8')](_0x5fcc('0x21'),auth[_0x5fcc('0x5')](),controller[_0x5fcc('0x22')]);router[_0x5fcc('0x8')](_0x5fcc('0x23'),auth[_0x5fcc('0x5')](),controller[_0x5fcc('0x24')]);router[_0x5fcc('0x8')]('/agents',auth[_0x5fcc('0x5')](),controller[_0x5fcc('0x25')]);router[_0x5fcc('0x1f')](_0x5fcc('0x26'),auth[_0x5fcc('0x5')](),controller[_0x5fcc('0x27')]);router[_0x5fcc('0x8')](_0x5fcc('0x28'),auth['isAuthenticated'](),controller['telephones']);router['get']('/trunks',auth[_0x5fcc('0x5')](),controller['trunks']);router[_0x5fcc('0x8')](_0x5fcc('0x29'),auth[_0x5fcc('0x5')](),controller[_0x5fcc('0x2a')]);router[_0x5fcc('0x8')](_0x5fcc('0x2b'),auth[_0x5fcc('0x5')](),controller[_0x5fcc('0x2c')]);router[_0x5fcc('0x8')]('/chat/queues/waitinginteractions',auth[_0x5fcc('0x5')](),controller[_0x5fcc('0x2d')]);router[_0x5fcc('0x8')]('/mail/queues/waitinginteractions',auth[_0x5fcc('0x5')](),controller[_0x5fcc('0x2e')]);router[_0x5fcc('0x8')](_0x5fcc('0x2f'),auth[_0x5fcc('0x5')](),controller[_0x5fcc('0x30')]);router[_0x5fcc('0x8')]('/openchannel/queues/:id/waitinginteractions',auth[_0x5fcc('0x5')](),controller[_0x5fcc('0x31')]);router[_0x5fcc('0x8')](_0x5fcc('0x32'),auth[_0x5fcc('0x5')](),controller[_0x5fcc('0x33')]);router[_0x5fcc('0x8')](_0x5fcc('0x34'),auth[_0x5fcc('0x5')](),controller[_0x5fcc('0x35')]);router[_0x5fcc('0x8')]('/fax/queues/waitinginteractions',auth[_0x5fcc('0x5')](),controller[_0x5fcc('0x36')]);router[_0x5fcc('0x37')]('/mail/queues/:id/notify',auth[_0x5fcc('0x5')](),controller[_0x5fcc('0x38')](_0x5fcc('0x39')));router[_0x5fcc('0x8')]('/mail/queues/:id',auth[_0x5fcc('0x5')](),controller[_0x5fcc('0x3a')]);router['post'](_0x5fcc('0x3b'),auth[_0x5fcc('0x5')](),controller[_0x5fcc('0x38')]('chat'));router[_0x5fcc('0x8')](_0x5fcc('0x3c'),auth['isAuthenticated'](),controller[_0x5fcc('0x3d')]);router[_0x5fcc('0x37')](_0x5fcc('0x3e'),auth[_0x5fcc('0x5')](),controller[_0x5fcc('0x38')]('fax'));router[_0x5fcc('0x8')](_0x5fcc('0x3f'),auth[_0x5fcc('0x5')](),controller[_0x5fcc('0x40')]);router[_0x5fcc('0x37')](_0x5fcc('0x41'),auth['isAuthenticated'](),controller[_0x5fcc('0x38')](_0x5fcc('0x42')));router[_0x5fcc('0x8')](_0x5fcc('0x43'),auth[_0x5fcc('0x5')](),controller[_0x5fcc('0x44')]);router['post'](_0x5fcc('0x45'),auth['isAuthenticated'](),controller[_0x5fcc('0x38')](_0x5fcc('0x46')));router[_0x5fcc('0x37')](_0x5fcc('0x47'),auth[_0x5fcc('0x5')](),controller['queueNotify'](_0x5fcc('0x48')));router['get'](_0x5fcc('0x49'),auth[_0x5fcc('0x5')](),controller[_0x5fcc('0x4a')]);router[_0x5fcc('0x8')]('/whatsapp/queues/:id',auth[_0x5fcc('0x5')](),controller[_0x5fcc('0x4b')]);router[_0x5fcc('0x37')]('/agents/:id/notify',auth[_0x5fcc('0x5')](),controller['agentNotify']);module[_0x5fcc('0x4c')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 9afa2c7..100a308 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(_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 +var _0xd8b0=['showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','FaxAccounts','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','map','queue_id','uniq','value','filter','indexOf','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','messageId','Interaction','\x20Message\x20not\x20found','update','MessageId','InteractionId','From','QueueId','TransferReport','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','capitalize','chat','agent','Message','create','Start','agentTransferTimeout','bluebird','moment','../../config/logger','api','jayson/promise','client','http','request','then','error','code','result','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','params','VoiceChannelStopMixMonitor','merge','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','findAll','user','length','format','updateAttributes','MemberReport','findOrCreate','INTERACTION','interface','SIP/%s','internal','capacity','campaigns','showChatQueues','ChatQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues'];(function(_0xc0c432,_0x47c20a){var _0x2781f5=function(_0xee68be){while(--_0xee68be){_0xc0c432['push'](_0xc0c432['shift']());}};_0x2781f5(++_0x47c20a);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require(_0x0d8b('0x0'));var moment=require(_0x0d8b('0x1'));var _=require('lodash');var util=require('util');var db=require('../../mysqldb')['db'];var logger=require(_0x0d8b('0x2'))(_0x0d8b('0x3'));var jayson=require(_0x0d8b('0x4'));var amiClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232a});var mailClient=jayson['client']['http']({'port':0x232b});var routingClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){var _0x129310=_0x413284?_0x413284:amiClient;return _0x129310[_0x0d8b('0x7')](_0x39f43a,_0x4a4470)[_0x0d8b('0x8')](function(_0x1f4800){if(_0x1f4800[_0x0d8b('0x9')]){if(_0x1f4800[_0x0d8b('0x9')][_0x0d8b('0xa')]===0x1f4){return _0x58e4e2(_0x1f4800[_0x0d8b('0x9')]['message']);}return _0x284169(_0x1f4800[_0x0d8b('0x9')]['message']);}else{_0x284169(_0x1f4800[_0x0d8b('0xb')]);}})[_0x0d8b('0xc')](function(_0x340cc4){_0x58e4e2(_0x340cc4);});});}function respondWithResult(_0x92cdd8,_0x35a07b){_0x35a07b=_0x35a07b||0xc8;return function(_0x32bb1a){if(_0x32bb1a){return _0x92cdd8[_0x0d8b('0xd')](_0x35a07b)[_0x0d8b('0xe')](_0x32bb1a);}return _0x92cdd8[_0x0d8b('0xf')](0x194);};}function handleError(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0x1f4;return function(_0xe65334){logger[_0x0d8b('0x9')](_0xe65334[_0x0d8b('0x10')]);if(_0xe65334['name']){delete _0xe65334[_0x0d8b('0x11')];}_0x2ce75e[_0x0d8b('0xd')](_0x5ad086)[_0x0d8b('0x12')](_0xe65334);};}function findById(_0xe2e167){return function(_0x2cb03c){if(!_['isNil'](_0xe2e167)&&!_[_0x0d8b('0x13')](_0x2cb03c)&&!_[_0x0d8b('0x13')](_0x2cb03c[_0x0d8b('0x14')])){return _[_0x0d8b('0x15')](_0x2cb03c[_0x0d8b('0x14')],function(_0x18dd2d){return _0x18dd2d['id']==_0xe2e167;});}return null;};}exports[_0x0d8b('0x16')]=function(_0xa3612a,_0x4a15bf){return respondWithRpcPromise(_0x0d8b('0x17'),_0xa3612a[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4a15bf,null))[_0x0d8b('0xc')](handleError(_0x4a15bf,null));};exports[_0x0d8b('0x19')]=function(_0x5b709c,_0x393beb){return respondWithRpcPromise(_0x0d8b('0x1a'),_['merge'](_0x5b709c['query'],_0x5b709c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x393beb,null))['catch'](handleError(_0x393beb,null));};exports['voiceChannelStopMixMonitor']=function(_0x238728,_0x2b924f){return respondWithRpcPromise(_0x0d8b('0x1c'),_[_0x0d8b('0x1d')](_0x238728[_0x0d8b('0x18')],_0x238728[_0x0d8b('0x1b')]))[_0x0d8b('0x8')](respondWithResult(_0x2b924f,null))[_0x0d8b('0xc')](handleError(_0x2b924f,null));};exports[_0x0d8b('0x1e')]=function(_0x5e5bc3,_0xe8bbee){return respondWithRpcPromise(_0x0d8b('0x1f'),_0x5e5bc3['query'])[_0x0d8b('0x8')](respondWithResult(_0xe8bbee,null))['catch'](handleError(_0xe8bbee,null));};exports[_0x0d8b('0x20')]=function(_0x234bdd,_0xa2af02){return respondWithRpcPromise('VoiceQueues',_0x234bdd['query'])[_0x0d8b('0x8')](findById(_0x234bdd[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0xa2af02,null))[_0x0d8b('0xc')](handleError(_0xa2af02,null));};exports['updateVoiceQueue']=function(_0x1b2b59,_0x4b59e5){return respondWithRpcPromise(_0x0d8b('0x21'),_['merge'](_0x1b2b59[_0x0d8b('0x22')],_0x1b2b59['params']))[_0x0d8b('0x8')](respondWithResult(_0x4b59e5,null))['catch'](handleError(_0x4b59e5,null));};exports[_0x0d8b('0x23')]=function(_0x106e4c,_0x2c058d){return respondWithRpcPromise('VoiceQueuesPreview',_['merge'](_0x106e4c['query'],_0x106e4c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x2c058d,null))[_0x0d8b('0xc')](handleError(_0x2c058d,null));};exports['voiceQueuesChannels']=function(_0x5d05fc,_0x36017a){return respondWithRpcPromise(_0x0d8b('0x24'),_0x5d05fc[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x36017a,null))[_0x0d8b('0xc')](handleError(_0x36017a,null));};exports[_0x0d8b('0x25')]=function(_0x4a99d3,_0x6f93c7){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x0d8b('0x1d')](_0x4a99d3[_0x0d8b('0x18')],_0x4a99d3['params']))[_0x0d8b('0x8')](respondWithResult(_0x6f93c7,null))[_0x0d8b('0xc')](handleError(_0x6f93c7,null));};exports[_0x0d8b('0x26')]=function(_0x4f2ed2,_0x113318){return respondWithRpcPromise(_0x0d8b('0x27'),_[_0x0d8b('0x1d')](_0x4f2ed2[_0x0d8b('0x18')],_0x4f2ed2[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x113318,null))[_0x0d8b('0xc')](handleError(_0x113318,null));};exports[_0x0d8b('0x28')]=function(_0x5ad0fe,_0x1180ac){return respondWithRpcPromise(_0x0d8b('0x29'),_[_0x0d8b('0x1d')](_0x5ad0fe[_0x0d8b('0x18')],_0x5ad0fe[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x1180ac,null))['catch'](handleError(_0x1180ac,null));};exports[_0x0d8b('0x2a')]=function(_0x5c2c04,_0x531c55){return respondWithRpcPromise(_0x0d8b('0x2b'),_0x5c2c04[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x531c55,null))[_0x0d8b('0xc')](handleError(_0x531c55,null));};exports[_0x0d8b('0x2c')]=function(_0x24c789,_0x579324){return respondWithRpcPromise(_0x0d8b('0x2d'),_0x24c789[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x579324,null))[_0x0d8b('0xc')](handleError(_0x579324,null));};exports[_0x0d8b('0x2e')]=function(_0x1a39ad,_0xf1680e){var _0x5c980b;return respondWithRpcPromise(_0x0d8b('0x2f'),_0x1a39ad[_0x0d8b('0x18')])[_0x0d8b('0x8')](function(_0x1f196d){_0x5c980b=_0x1f196d;return respondWithRpcPromise('Agents',_0x1a39ad[_0x0d8b('0x18')],routingClient);})['then'](function(_0x37b26c){return _[_0x0d8b('0x1d')]({},_0x37b26c,_0x5c980b);})[_0x0d8b('0x8')](respondWithResult(_0xf1680e,null))[_0x0d8b('0xc')](handleError(_0xf1680e,null));};exports[_0x0d8b('0x30')]=function(_0x3e632e,_0x1ff17d){if(_0x3e632e[_0x0d8b('0x22')]&&_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]&&_0x3e632e['user']&&_0x3e632e['user']['name']){for(var _0x4d0811 in _0x3e632e['body'][_0x0d8b('0x31')]){if(_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]['hasOwnProperty'](_0x4d0811)){db['MemberReport'][_0x0d8b('0x32')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811]&&_0x3e632e['body']['interaction'][_0x4d0811][_0x0d8b('0x34')]?{'$notIn':_0x3e632e['body'][_0x0d8b('0x31')][_0x4d0811]}:{'$ne':null}}})['then'](function(_0x53f643){var _0x30ccee=moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x5ebe8a=0x0,_0x59b8e9=_0x53f643['length'];_0x5ebe8a<_0x59b8e9;_0x5ebe8a+=0x1){_0x53f643[_0x5ebe8a][_0x0d8b('0x36')]({'exitAt':_0x30ccee});}});for(var _0x1e0498=0x0;_0x1e0498<_0x3e632e[_0x0d8b('0x22')]['interaction'][_0x4d0811][_0x0d8b('0x34')];_0x1e0498+=0x1){db[_0x0d8b('0x37')][_0x0d8b('0x38')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':_0x0d8b('0x39'),'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498],'exitAt':null},'defaults':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'interface':_[_0x0d8b('0x13')](_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')])?util[_0x0d8b('0x35')](_0x0d8b('0x3b'),_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')]):_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')],'type':'INTERACTION','enterAt':moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss'),'role':'agent','internal':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3c')],'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x3e632e[_0x0d8b('0x1b')]['id'],'capacity':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x3d')]},routingClient)[_0x0d8b('0x8')](respondWithResult(_0x1ff17d,null))[_0x0d8b('0xc')](handleError(_0x1ff17d,null));};exports['telephones']=function(_0x5c0824,_0x4e4d5f){return respondWithRpcPromise('Telephones',_0x5c0824[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4e4d5f,null))['catch'](handleError(_0x4e4d5f,null));};exports['trunks']=function(_0x44c5c1,_0x3d3cb6){return respondWithRpcPromise('Trunks',_0x44c5c1['query'])[_0x0d8b('0x8')](respondWithResult(_0x3d3cb6,null))[_0x0d8b('0xc')](handleError(_0x3d3cb6,null));};exports[_0x0d8b('0x3e')]=function(_0x346c0d,_0x2d5519){return respondWithRpcPromise('Campaigns',_0x346c0d[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x2d5519,null))['catch'](handleError(_0x2d5519,null));};exports['chatQueues']=function(_0xf6a773,_0x3f2d95){return respondWithRpcPromise('ChatQueues',_0xf6a773['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f2d95,null))[_0x0d8b('0xc')](handleError(_0x3f2d95,null));};exports[_0x0d8b('0x3f')]=function(_0xb58818,_0x4a2989){return respondWithRpcPromise(_0x0d8b('0x40'),_0xb58818['query'],routingClient)['then'](findById(_0xb58818[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x4a2989,null))['catch'](handleError(_0x4a2989,null));};exports['mailQueues']=function(_0x44ed23,_0x3d7161){return respondWithRpcPromise(_0x0d8b('0x41'),_0x44ed23[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3d7161,null))[_0x0d8b('0xc')](handleError(_0x3d7161,null));};exports[_0x0d8b('0x42')]=function(_0x3bead7,_0x5418d8){return respondWithRpcPromise(_0x0d8b('0x41'),_0x3bead7[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x3bead7[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x5418d8,null))[_0x0d8b('0xc')](handleError(_0x5418d8,null));};exports[_0x0d8b('0x43')]=function(_0x1c78b6,_0x375684){return respondWithRpcPromise('MailAccounts',_0x1c78b6[_0x0d8b('0x18')],mailClient)[_0x0d8b('0x8')](respondWithResult(_0x375684,null))[_0x0d8b('0xc')](handleError(_0x375684,null));};exports[_0x0d8b('0x44')]=function(_0x43ad22,_0x577951){return respondWithRpcPromise(_0x0d8b('0x45'),_0x43ad22[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x577951,null))[_0x0d8b('0xc')](handleError(_0x577951,null));};exports[_0x0d8b('0x46')]=function(_0x59ada2,_0x4d0e7c){return respondWithRpcPromise(_0x0d8b('0x45'),_0x59ada2[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x59ada2[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0x4d0e7c,null))[_0x0d8b('0xc')](handleError(_0x4d0e7c,null));};exports[_0x0d8b('0x47')]=function(_0x8c0bbe,_0x5952dd){return respondWithRpcPromise(_0x0d8b('0x48'),_0x8c0bbe['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5952dd,null))[_0x0d8b('0xc')](handleError(_0x5952dd,null));};exports[_0x0d8b('0x49')]=function(_0x26ccf0,_0x2b6eb6){return respondWithRpcPromise(_0x0d8b('0x48'),_0x26ccf0['query'],routingClient)[_0x0d8b('0x8')](findById(_0x26ccf0['params']['id']))[_0x0d8b('0x8')](respondWithResult(_0x2b6eb6,null))[_0x0d8b('0xc')](handleError(_0x2b6eb6,null));};exports[_0x0d8b('0x4a')]=function(_0x33a614,_0x48025e){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x33a614[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x48025e,null))[_0x0d8b('0xc')](handleError(_0x48025e,null));};exports[_0x0d8b('0x4c')]=function(_0x273aef,_0x223fd8){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x273aef[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x273aef['params']['id']))['then'](respondWithResult(_0x223fd8,null))[_0x0d8b('0xc')](handleError(_0x223fd8,null));};exports[_0x0d8b('0x4d')]=function(_0x53e399,_0xb1aa96){return respondWithRpcPromise('FaxQueues',_0x53e399['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0xb1aa96,null))[_0x0d8b('0xc')](handleError(_0xb1aa96,null));};exports['showFaxQueues']=function(_0x587128,_0x1900e3){return respondWithRpcPromise(_0x0d8b('0x4e'),_0x587128[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x587128[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x1900e3,null))[_0x0d8b('0xc')](handleError(_0x1900e3,null));};exports['faxAccounts']=function(_0x1ca60c,_0x5878c2){return respondWithRpcPromise(_0x0d8b('0x4f'),_0x1ca60c[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x5878c2,null))[_0x0d8b('0xc')](handleError(_0x5878c2,null));};exports['chatQueuesWaitingInteractions']=function(_0x3fe47d,_0x4a1c4a){return respondWithRpcPromise(_0x0d8b('0x50'),_0x3fe47d[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x4a1c4a,null))[_0x0d8b('0xc')](handleError(_0x4a1c4a,null));};exports[_0x0d8b('0x51')]=function(_0x2b44e5,_0x3e927c){return respondWithRpcPromise(_0x0d8b('0x52'),_0x2b44e5[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e927c,null))['catch'](handleError(_0x3e927c,null));};exports[_0x0d8b('0x53')]=function(_0x54c28b,_0x3e4121){return respondWithRpcPromise(_0x0d8b('0x54'),_0x54c28b['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e4121,null))['catch'](handleError(_0x3e4121,null));};exports[_0x0d8b('0x55')]=function(_0x445a00,_0x24f75){return respondWithRpcPromise(_0x0d8b('0x54'),_0x445a00[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](function(_0x3a073b){if(_0x445a00[_0x0d8b('0x18')]['type']!==undefined){var _0x10eca6=_(_0x3a073b[_0x0d8b('0x14')])['filter']([_0x445a00[_0x0d8b('0x18')][_0x0d8b('0x56')],_0x445a00[_0x0d8b('0x1b')]['id']])[_0x0d8b('0x57')](_0x0d8b('0x58'))[_0x0d8b('0x59')]()[_0x0d8b('0x5a')]();return _0x3a073b[_0x0d8b('0x14')][_0x0d8b('0x5b')](function(_0x5007c0){return _0x10eca6[_0x0d8b('0x5c')](_0x5007c0[_0x0d8b('0x58')])>-0x1;});}else{return _0x3a073b['rows'][_0x0d8b('0x5b')](function(_0x93fc55){return _0x93fc55[_0x0d8b('0x58')]===parseInt(_0x445a00['params']['id']);});}})['then'](respondWithResult(_0x24f75,null))[_0x0d8b('0xc')](handleError(_0x24f75,null));};exports[_0x0d8b('0x5d')]=function(_0x2c55bc,_0x5b76af){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x2c55bc[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5b76af,null))[_0x0d8b('0xc')](handleError(_0x5b76af,null));};exports[_0x0d8b('0x5e')]=function(_0x2a2b58,_0x3f7895){return respondWithRpcPromise(_0x0d8b('0x5f'),_0x2a2b58[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f7895,null))[_0x0d8b('0xc')](handleError(_0x3f7895,null));};exports[_0x0d8b('0x60')]=function(_0x291336,_0x3b060e){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x291336[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3b060e,null))['catch'](handleError(_0x3b060e,null));};exports['queueNotify']=function(_0x1a1029){return function(_0x1dad9f,_0x3573b4){var _0x14b1b8,_0x23e2e0;var _0x354208=_['capitalize'](_0x1a1029);var _0x502715=_0x1a1029==='chat'?_0x0d8b('0x61'):_0x0d8b('0x62');return db[_0x354208+_0x0d8b('0x63')][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x1dad9f[_0x0d8b('0x1b')]['id']}})[_0x0d8b('0x8')](function(_0x5ef461){if(_[_0x0d8b('0x13')](_0x5ef461)){throw new Error(_0x354208+_0x0d8b('0x65'));}_0x14b1b8=_0x5ef461;return db[_0x354208+'Message'][_0x0d8b('0x64')]({'where':{'id':_0x1dad9f['body'][_0x0d8b('0x66')]},'include':[{'model':db[_0x354208+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x354208+_0x502715],'as':_0x0d8b('0x62')}]});})[_0x0d8b('0x8')](function(_0x8fae7f){if(_[_0x0d8b('0x13')](_0x8fae7f)){throw new Error(_0x354208+_0x0d8b('0x68'));}_0x23e2e0=_0x8fae7f;return _0x8fae7f[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x276558={'uniqueid':_0x1a1029+'.'+_0x23e2e0['id']+'.'+_0x23e2e0[_0x0d8b('0x67')]['id'],'FromUserId':_0x1dad9f['user']['id'],'type':'queue'};_0x276558[_0x354208+_0x0d8b('0x6a')]=_0x23e2e0['id'];_0x276558[_0x354208+_0x0d8b('0x6b')]=_0x23e2e0[_0x0d8b('0x67')]['id'];_0x276558[_0x0d8b('0x6c')+_0x354208+_0x502715+'Id']=_0x23e2e0[_0x0d8b('0x62')]['id'];_0x276558['To'+_0x354208+_0x0d8b('0x6d')]=_0x14b1b8['id'];return db[_0x354208+_0x0d8b('0x6e')]['create'](_0x276558);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise('Start',{'channel':_0x1a1029,'interaction':_0x23e2e0[_0x0d8b('0x67')],'message':_0x23e2e0,'account':_0x23e2e0['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x14b1b8[_0x0d8b('0x11')]+','+(_0x23e2e0[_0x0d8b('0x62')][_0x0d8b('0x6f')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})[_0x0d8b('0x8')](respondWithResult(_0x3573b4,null))[_0x0d8b('0xc')](handleError(_0x3573b4,null));};};exports[_0x0d8b('0x71')]=function(_0x180eda,_0x35267a){var _0x20a8b6,_0x3a6014;if(_[_0x0d8b('0x13')](_0x180eda['body'][_0x0d8b('0x72')])){throw new Error(_0x0d8b('0x73'));}var _0x8be77c=_0x180eda['body']['channel'];var _0x2db144=_[_0x0d8b('0x74')](_0x8be77c);var _0x36d6ca=_0x8be77c===_0x0d8b('0x75')?_0x0d8b('0x61'):_0x0d8b('0x62');return db['User'][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x180eda[_0x0d8b('0x1b')]['id'],'role':_0x0d8b('0x76')}})[_0x0d8b('0x8')](function(_0x4350ee){if(_['isNil'](_0x4350ee)){throw new Error('Agent\x20not\x20found');}_0x20a8b6=_0x4350ee;return db[_0x2db144+_0x0d8b('0x77')][_0x0d8b('0x64')]({'where':{'id':_0x180eda[_0x0d8b('0x22')]['messageId']},'include':[{'model':db[_0x2db144+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x2db144+_0x36d6ca],'as':_0x0d8b('0x62')}]});})['then'](function(_0xb61d4b){if(_[_0x0d8b('0x13')](_0xb61d4b)){throw new Error(_0x2db144+_0x0d8b('0x68'));}_0x3a6014=_0xb61d4b;return _0xb61d4b[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x150e9f={'uniqueid':_0x8be77c+'.'+_0x3a6014['id']+'.'+_0x3a6014[_0x0d8b('0x67')]['id'],'FromUserId':_0x180eda[_0x0d8b('0x33')]['id'],'type':_0x0d8b('0x76'),'ToUserId':_0x20a8b6['id']};_0x150e9f[_0x2db144+'MessageId']=_0x3a6014['id'];_0x150e9f[_0x2db144+_0x0d8b('0x6b')]=_0x3a6014[_0x0d8b('0x67')]['id'];_0x150e9f[_0x0d8b('0x6c')+_0x2db144+_0x36d6ca+'Id']=_0x3a6014[_0x0d8b('0x62')]['id'];return db[_0x2db144+_0x0d8b('0x6e')][_0x0d8b('0x78')](_0x150e9f);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise(_0x0d8b('0x79'),{'channel':_0x8be77c,'interaction':_0x3a6014[_0x0d8b('0x67')],'message':_0x3a6014,'account':_0x3a6014['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x20a8b6[_0x0d8b('0x11')]+','+(_0x3a6014[_0x0d8b('0x62')][_0x0d8b('0x7a')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x35267a,null))[_0x0d8b('0xc')](handleError(_0x35267a,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 4ab9abf..11abb0c 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 _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 +var _0xed8f=['./schedule.controller','get','/:id','isAuthenticated','show','/:id/run','run','create','put','update','exports','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment'];(function(_0x2a885f,_0x51ae76){var _0x33c6d2=function(_0x661763){while(--_0x661763){_0x2a885f['push'](_0x2a885f['shift']());}};_0x33c6d2(++_0x51ae76);}(_0xed8f,0x82));var _0xfed8=function(_0x38447d,_0x5c6b24){_0x38447d=_0x38447d-0x0;var _0x1961c2=_0xed8f[_0x38447d];return _0x1961c2;};'use strict';var multer=require('multer');var util=require(_0xfed8('0x0'));var path=require(_0xfed8('0x1'));var timeout=require(_0xfed8('0x2'));var express=require(_0xfed8('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xfed8('0x4'));var config=require(_0xfed8('0x5'));var controller=require(_0xfed8('0x6'));router[_0xfed8('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xfed8('0x7')](_0xfed8('0x8'),auth[_0xfed8('0x9')](),controller[_0xfed8('0xa')]);router[_0xfed8('0x7')](_0xfed8('0xb'),auth['isAuthenticated'](),controller[_0xfed8('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xfed8('0xd')]);router[_0xfed8('0xe')](_0xfed8('0x8'),auth['isAuthenticated'](),controller[_0xfed8('0xf')]);router['delete']('/:id',auth[_0xfed8('0x9')](),controller['destroy']);module[_0xfed8('0x10')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 26c0284..f08ebca 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 _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 +var _0x2827=['BOOLEAN','0\x200\x20*\x20*\x20*','DATE','ENUM','years','weeks','minutes','days','csv','pdf','xlsx','custom','TEXT','sequelize','exports','STRING'];(function(_0x3e74d4,_0xfeb53){var _0x38adee=function(_0x563c28){while(--_0x563c28){_0x3e74d4['push'](_0x3e74d4['shift']());}};_0x38adee(++_0xfeb53);}(_0x2827,0x13d));var _0x7282=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2827[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x7282('0x0'));module[_0x7282('0x1')]={'name':{'type':Sequelize[_0x7282('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7282('0x2')]},'active':{'type':Sequelize[_0x7282('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x7282('0x2')],'allowNull':![],'defaultValue':_0x7282('0x4')},'startAt':{'type':Sequelize[_0x7282('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0x7282('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x7282('0x6')](_0x7282('0x7'),'quarters','months',_0x7282('0x8'),'days','hours',_0x7282('0x9')),'allowNull':![],'defaultValue':_0x7282('0xa')},'output':{'type':Sequelize[_0x7282('0x6')](_0x7282('0xb'),_0x7282('0xc'),_0x7282('0xd')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize['ENUM']('custom','default'),'allowNull':![],'defaultValue':_0x7282('0xe')},'sendMail':{'type':Sequelize[_0x7282('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x7282('0x2')]},'cc':{'type':Sequelize[_0x7282('0xf')]},'bcc':{'type':Sequelize[_0x7282('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 c2c60d9..e370b67 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 _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 +var _0x2afc=['params','attributes','find','create','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','run','../../config/schedule','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','get','Scheduler','UserProfileResource','end','error','stack','name','send','index','map','Schedule','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','rows','catch'];(function(_0x54ecfa,_0x508b38){var _0x320d72=function(_0x9dfec4){while(--_0x9dfec4){_0x54ecfa['push'](_0x54ecfa['shift']());}};_0x320d72(++_0x508b38);}(_0x2afc,0x1a4));var _0xc2af=function(_0x219e9b,_0x295d91){_0x219e9b=_0x219e9b-0x0;var _0x332e80=_0x2afc[_0x219e9b];return _0x332e80;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc2af('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc2af('0x1'));var rp=require('request-promise');var moment=require(_0xc2af('0x2'));var BPromise=require(_0xc2af('0x3'));var Mustache=require(_0xc2af('0x4'));var util=require(_0xc2af('0x5'));var path=require('path');var sox=require(_0xc2af('0x6'));var csv=require(_0xc2af('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc2af('0x8'));var _=require(_0xc2af('0x9'));var squel=require(_0xc2af('0xa'));var crypto=require('crypto');var jsforce=require(_0xc2af('0xb'));var deskjs=require(_0xc2af('0xc'));var toCsv=require(_0xc2af('0x7'));var querystring=require(_0xc2af('0xd'));var Papa=require(_0xc2af('0xe'));var Redis=require(_0xc2af('0xf'));var authService=require(_0xc2af('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xc2af('0x11'));var hardwareService=require(_0xc2af('0x12'));var logger=require(_0xc2af('0x13'))(_0xc2af('0x14'));var utils=require(_0xc2af('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc2af('0x16'))['db'];function respondWithStatusCode(_0x2202fe,_0x500419){_0x500419=_0x500419||0xcc;return function(_0x2045ae){if(_0x2045ae){return _0x2202fe[_0xc2af('0x17')](_0x500419);}return _0x2202fe[_0xc2af('0x18')](_0x500419)['end']();};}function respondWithResult(_0x21ba12,_0x2464b1){_0x2464b1=_0x2464b1||0xc8;return function(_0x456800){if(_0x456800){return _0x21ba12[_0xc2af('0x18')](_0x2464b1)[_0xc2af('0x19')](_0x456800);}};}function respondWithFilteredResult(_0x3f0cfa,_0x1a1d08){return function(_0x4f43d9){if(_0x4f43d9){var _0x1f98ea=typeof _0x1a1d08[_0xc2af('0x1a')]==='undefined'&&typeof _0x1a1d08[_0xc2af('0x1b')]==='undefined';var _0x32215a=_0x4f43d9[_0xc2af('0x1c')];var _0x54f0e1=_0x1f98ea?0x0:_0x1a1d08[_0xc2af('0x1a')];var _0x363463=_0x1f98ea?_0x4f43d9[_0xc2af('0x1c')]:_0x1a1d08[_0xc2af('0x1a')]+_0x1a1d08['limit'];var _0x153196;if(_0x363463>=_0x32215a){_0x363463=_0x32215a;_0x153196=0xc8;}else{_0x153196=0xce;}_0x3f0cfa[_0xc2af('0x18')](_0x153196);return _0x3f0cfa[_0xc2af('0x1d')](_0xc2af('0x1e'),_0x54f0e1+'-'+_0x363463+'/'+_0x32215a)['json'](_0x4f43d9);}return null;};}function patchUpdates(_0x23be67){return function(_0x1f4bdc){try{jsonpatch[_0xc2af('0x1f')](_0x1f4bdc,_0x23be67,!![]);}catch(_0x1487bd){return BPromise[_0xc2af('0x20')](_0x1487bd);}return _0x1f4bdc[_0xc2af('0x21')]();};}function saveUpdates(_0x135c35,_0x5a9013){return function(_0x2181ca){if(_0x2181ca){return _0x2181ca[_0xc2af('0x22')](_0x135c35)[_0xc2af('0x23')](function(_0x4fd108){return _0x4fd108;});}return null;};}function removeEntity(_0x2bbf28,_0x1cf782){return function(_0x26aa1c){if(_0x26aa1c){return _0x26aa1c['destroy']()[_0xc2af('0x23')](function(){var _0x48736d=_0x26aa1c[_0xc2af('0x24')]({'plain':!![]});var _0x555c06=_0xc2af('0x25');return db[_0xc2af('0x26')]['destroy']({'where':{'type':_0x555c06,'resourceId':_0x48736d['id']}})[_0xc2af('0x23')](function(){return _0x26aa1c;});})[_0xc2af('0x23')](function(){_0x2bbf28[_0xc2af('0x18')](0xcc)[_0xc2af('0x27')]();});}};}function handleEntityNotFound(_0x47fa50,_0x354806){return function(_0x3c7a62){if(!_0x3c7a62){_0x47fa50[_0xc2af('0x17')](0x194);}return _0x3c7a62;};}function handleError(_0x4dc7b3,_0xcac610){_0xcac610=_0xcac610||0x1f4;return function(_0x5342e8){logger[_0xc2af('0x28')](_0x5342e8[_0xc2af('0x29')]);if(_0x5342e8['name']){delete _0x5342e8[_0xc2af('0x2a')];}_0x4dc7b3[_0xc2af('0x18')](_0xcac610)[_0xc2af('0x2b')](_0x5342e8);};}exports[_0xc2af('0x2c')]=function(_0x9424bf,_0x2a3705){var _0x4b6650={},_0xea0e2e={},_0x3667b6={'count':0x0,'rows':[]};var _0x56c71a=_[_0xc2af('0x2d')](db[_0xc2af('0x2e')][_0xc2af('0x2f')],function(_0x365a85){return{'name':_0x365a85[_0xc2af('0x30')],'type':_0x365a85['type'][_0xc2af('0x31')]};});_0xea0e2e[_0xc2af('0x32')]=_[_0xc2af('0x2d')](_0x56c71a,_0xc2af('0x2a'));_0xea0e2e[_0xc2af('0x33')]=_[_0xc2af('0x34')](_0x9424bf[_0xc2af('0x33')]);_0xea0e2e[_0xc2af('0x35')]=_[_0xc2af('0x36')](_0xea0e2e['model'],_0xea0e2e[_0xc2af('0x33')]);_0x4b6650['attributes']=_[_0xc2af('0x36')](_0xea0e2e['model'],qs[_0xc2af('0x37')](_0x9424bf['query'][_0xc2af('0x37')]));_0x4b6650['attributes']=_0x4b6650['attributes'][_0xc2af('0x38')]?_0x4b6650['attributes']:_0xea0e2e['model'];if(!_0x9424bf['query'][_0xc2af('0x39')](_0xc2af('0x3a'))){_0x4b6650[_0xc2af('0x1b')]=qs[_0xc2af('0x1b')](_0x9424bf[_0xc2af('0x33')][_0xc2af('0x1b')]);_0x4b6650['offset']=qs[_0xc2af('0x1a')](_0x9424bf[_0xc2af('0x33')]['offset']);}_0x4b6650[_0xc2af('0x3b')]=qs[_0xc2af('0x3c')](_0x9424bf[_0xc2af('0x33')]['sort']);_0x4b6650['where']=qs[_0xc2af('0x35')](_[_0xc2af('0x3d')](_0x9424bf['query'],_0xea0e2e[_0xc2af('0x35')]),_0x56c71a);if(_0x9424bf['query'][_0xc2af('0x3e')]){_0x4b6650[_0xc2af('0x3f')]=_[_0xc2af('0x40')](_0x4b6650['where'],{'$or':_[_0xc2af('0x2d')](_0x56c71a,function(_0x1139c3){if(_0x1139c3[_0xc2af('0x41')]!==_0xc2af('0x42')){var _0x344565={};_0x344565[_0x1139c3[_0xc2af('0x2a')]]={'$like':'%'+_0x9424bf[_0xc2af('0x33')][_0xc2af('0x3e')]+'%'};return _0x344565;}})});}_0x4b6650=_[_0xc2af('0x40')]({},_0x4b6650,_0x9424bf[_0xc2af('0x43')]);var _0x2e1c86={'where':_0x4b6650[_0xc2af('0x3f')]};return db['Schedule'][_0xc2af('0x1c')](_0x2e1c86)['then'](function(_0x2c0ac8){_0x3667b6[_0xc2af('0x1c')]=_0x2c0ac8;if(_0x9424bf['query'][_0xc2af('0x44')]){_0x4b6650[_0xc2af('0x45')]=[{'all':!![]}];}return db[_0xc2af('0x2e')]['findAll'](_0x4b6650);})[_0xc2af('0x23')](function(_0x3c7943){_0x3667b6[_0xc2af('0x46')]=_0x3c7943;return _0x3667b6;})['then'](respondWithFilteredResult(_0x2a3705,_0x4b6650))[_0xc2af('0x47')](handleError(_0x2a3705,null));};exports['show']=function(_0x50b646,_0x2de86b){var _0xc836fe={'raw':![],'where':{'id':_0x50b646[_0xc2af('0x48')]['id']}},_0x30b8cc={};_0x30b8cc[_0xc2af('0x32')]=_[_0xc2af('0x34')](db['Schedule'][_0xc2af('0x2f')]);_0x30b8cc[_0xc2af('0x33')]=_[_0xc2af('0x34')](_0x50b646[_0xc2af('0x33')]);_0x30b8cc[_0xc2af('0x35')]=_[_0xc2af('0x36')](_0x30b8cc[_0xc2af('0x32')],_0x30b8cc[_0xc2af('0x33')]);_0xc836fe[_0xc2af('0x49')]=_[_0xc2af('0x36')](_0x30b8cc[_0xc2af('0x32')],qs[_0xc2af('0x37')](_0x50b646[_0xc2af('0x33')][_0xc2af('0x37')]));_0xc836fe[_0xc2af('0x49')]=_0xc836fe[_0xc2af('0x49')][_0xc2af('0x38')]?_0xc836fe[_0xc2af('0x49')]:_0x30b8cc[_0xc2af('0x32')];if(_0x50b646[_0xc2af('0x33')][_0xc2af('0x44')]){_0xc836fe[_0xc2af('0x45')]=[{'all':!![]}];}_0xc836fe=_[_0xc2af('0x40')]({},_0xc836fe,_0x50b646['options']);return db[_0xc2af('0x2e')][_0xc2af('0x4a')](_0xc836fe)[_0xc2af('0x23')](handleEntityNotFound(_0x2de86b,null))['then'](respondWithResult(_0x2de86b,null))[_0xc2af('0x47')](handleError(_0x2de86b,null));};exports[_0xc2af('0x4b')]=function(_0x2f7fdd,_0x160188){return db[_0xc2af('0x2e')][_0xc2af('0x4b')](_0x2f7fdd['body'],{})['then'](function(_0x475929){var _0x37f527=_0x2f7fdd['user'][_0xc2af('0x24')]({'plain':!![]});if(!_0x37f527)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x37f527[_0xc2af('0x4c')]==='user'){var _0x27111d=_0x475929[_0xc2af('0x24')]({'plain':!![]});var _0x2ebbe8=_0xc2af('0x25');return db[_0xc2af('0x4d')][_0xc2af('0x4a')]({'where':{'name':_0x2ebbe8,'userProfileId':_0x37f527['userProfileId']},'raw':!![]})[_0xc2af('0x23')](function(_0x243fcd){if(_0x243fcd&&_0x243fcd['autoAssociation']===0x0){return db[_0xc2af('0x26')][_0xc2af('0x4b')]({'name':_0x27111d['name'],'resourceId':_0x27111d['id'],'type':_0x243fcd[_0xc2af('0x2a')],'sectionId':_0x243fcd['id']},{})['then'](function(){return _0x475929;});}else{return _0x475929;}})[_0xc2af('0x47')](function(_0x4b2eee){logger[_0xc2af('0x28')](_0xc2af('0x4e'),_0x4b2eee);throw _0x4b2eee;});}return _0x475929;})[_0xc2af('0x23')](respondWithResult(_0x160188,0xc9))[_0xc2af('0x47')](handleError(_0x160188,null));};exports[_0xc2af('0x22')]=function(_0x170244,_0x48a9e6){if(_0x170244['body']['id']){delete _0x170244['body']['id'];}return db[_0xc2af('0x2e')]['find']({'where':{'id':_0x170244['params']['id']}})['then'](handleEntityNotFound(_0x48a9e6,null))['then'](saveUpdates(_0x170244[_0xc2af('0x4f')],null))['then'](respondWithResult(_0x48a9e6,null))[_0xc2af('0x47')](handleError(_0x48a9e6,null));};exports['destroy']=function(_0x57c76b,_0xd87bbb){return db['Schedule']['find']({'where':{'id':_0x57c76b['params']['id']}})[_0xc2af('0x23')](handleEntityNotFound(_0xd87bbb,null))[_0xc2af('0x23')](removeEntity(_0xd87bbb,null))['catch'](handleError(_0xd87bbb,null));};exports[_0xc2af('0x50')]=function(_0x1911e0,_0x535af2,_0x315187){var _0x249645=require(_0xc2af('0x51'));return db['Schedule'][_0xc2af('0x4a')]({'where':{'id':_0x1911e0[_0xc2af('0x48')]['id']},'raw':!![]})[_0xc2af('0x23')](handleEntityNotFound(_0x535af2,null))[_0xc2af('0x23')](function(){_0x249645[_0xc2af('0x50')](_0x1911e0[_0xc2af('0x48')]['id']);})[_0xc2af('0x23')](respondWithStatusCode(_0x535af2,null))['catch'](handleError(_0x535af2,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index a2de3e3..2e62d62 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 _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 +var _0x46e5=['define','tools_schedules','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./schedule.attributes'];(function(_0x308ba0,_0x4d73bf){var _0x5bdc1b=function(_0x448134){while(--_0x448134){_0x308ba0['push'](_0x308ba0['shift']());}};_0x5bdc1b(++_0x4d73bf);}(_0x46e5,0x1e2));var _0x546e=function(_0x5c66df,_0x872bad){_0x5c66df=_0x5c66df-0x0;var _0x3317fe=_0x46e5[_0x5c66df];return _0x3317fe;};'use strict';var _=require(_0x546e('0x0'));var util=require(_0x546e('0x1'));var logger=require(_0x546e('0x2'))(_0x546e('0x3'));var moment=require(_0x546e('0x4'));var BPromise=require(_0x546e('0x5'));var rp=require(_0x546e('0x6'));var fs=require('fs');var path=require(_0x546e('0x7'));var rimraf=require(_0x546e('0x8'));var config=require('../../config/environment');var attributes=require(_0x546e('0x9'));module['exports']=function(_0x125602,_0x3dc6fd){return _0x125602[_0x546e('0xa')]('Schedule',attributes,{'tableName':_0x546e('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 045f9f2..cbb7d58 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 _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 +var _0xb58b=['catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x48c1cc,_0x11ebf9){var _0x52072a=function(_0x4efea5){while(--_0x4efea5){_0x48c1cc['push'](_0x48c1cc['shift']());}};_0x52072a(++_0x11ebf9);}(_0xb58b,0x6a));var _0xbb58=function(_0x2de2a3,_0x31d605){_0x2de2a3=_0x2de2a3-0x0;var _0x28c038=_0xb58b[_0x2de2a3];return _0x28c038;};'use strict';var _=require(_0xbb58('0x0'));var util=require(_0xbb58('0x1'));var moment=require(_0xbb58('0x2'));var BPromise=require('bluebird');var rs=require(_0xbb58('0x3'));var fs=require('fs');var Redis=require(_0xbb58('0x4'));var db=require(_0xbb58('0x5'))['db'];var utils=require(_0xbb58('0x6'));var logger=require('../../config/logger')(_0xbb58('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbb58('0x8')][_0xbb58('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b0263,_0x41c57f,_0x1f8a93){return new BPromise(function(_0x25d65c,_0x22b2ce){return client[_0xbb58('0xa')](_0x2b0263,_0x1f8a93)[_0xbb58('0xb')](function(_0x45a06f){logger[_0xbb58('0xc')](_0xbb58('0xd'),_0x41c57f,_0xbb58('0xe'));logger['debug'](_0xbb58('0xf'),_0x41c57f,'request\x20sent',JSON[_0xbb58('0x10')](_0x45a06f));if(_0x45a06f['error']){if(_0x45a06f[_0xbb58('0x11')][_0xbb58('0x12')]===0x1f4){logger[_0xbb58('0x11')](_0xbb58('0xd'),_0x41c57f,_0x45a06f[_0xbb58('0x11')][_0xbb58('0x13')]);return _0x22b2ce(_0x45a06f['error'][_0xbb58('0x13')]);}logger['error']('Schedule,\x20%s,\x20%s',_0x41c57f,_0x45a06f[_0xbb58('0x11')][_0xbb58('0x13')]);return _0x25d65c(_0x45a06f['error'][_0xbb58('0x13')]);}else{logger[_0xbb58('0xc')](_0xbb58('0xd'),_0x41c57f,'request\x20sent');_0x25d65c(_0x45a06f['result'][_0xbb58('0x13')]);}})[_0xbb58('0x14')](function(_0x50e977){logger[_0xbb58('0x11')]('Schedule,\x20%s,\x20%s',_0x41c57f,_0x50e977);_0x22b2ce(_0x50e977);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 32af1a1..570d7eb 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 _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 +var _0x9916=['exports','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./screenRecording.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/download','download','post','create','put','delete','destroy'];(function(_0x159fd1,_0x73b713){var _0x5c85b1=function(_0x378e6c){while(--_0x378e6c){_0x159fd1['push'](_0x159fd1['shift']());}};_0x5c85b1(++_0x73b713);}(_0x9916,0x1a5));var _0x6991=function(_0x78612f,_0x760307){_0x78612f=_0x78612f-0x0;var _0x48b55a=_0x9916[_0x78612f];return _0x48b55a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6991('0x0'));var timeout=require(_0x6991('0x1'));var express=require('express');var router=express[_0x6991('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6991('0x3'));var config=require(_0x6991('0x4'));var controller=require(_0x6991('0x5'));router['get']('/',auth[_0x6991('0x6')](),controller['index']);router[_0x6991('0x7')](_0x6991('0x8'),auth[_0x6991('0x6')](),controller[_0x6991('0x9')]);router['get'](_0x6991('0xa'),auth['isAuthenticated'](),controller[_0x6991('0xb')]);router[_0x6991('0x7')](_0x6991('0xc'),auth[_0x6991('0x6')](),controller[_0x6991('0xd')]);router[_0x6991('0xe')]('/',auth[_0x6991('0x6')](),controller[_0x6991('0xf')]);router[_0x6991('0x10')]('/:id',auth[_0x6991('0x6')](),controller['update']);router[_0x6991('0x11')](_0x6991('0xa'),auth[_0x6991('0x6')](),controller[_0x6991('0x12')]);module[_0x6991('0x13')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 1450285..675ed44 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 _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 +var _0x5453=['VIRTUAL','getDataValue','value','STRING','setDataValue','INTEGER','startedAt','subtract','closedAt','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','DATE','updatedAt','sequelize','moment','path','../../config/environment','exports'];(function(_0x9d35c6,_0x4b06d5){var _0x3ed114=function(_0x2b8100){while(--_0x2b8100){_0x9d35c6['push'](_0x9d35c6['shift']());}};_0x3ed114(++_0x4b06d5);}(_0x5453,0x18b));var _0x3545=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5453[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x3545('0x0'));var moment=require(_0x3545('0x1'));var path=require(_0x3545('0x2'));var config=require(_0x3545('0x3'));module[_0x3545('0x4')]={'format':{'type':Sequelize[_0x3545('0x5')],'get':function(){return this[_0x3545('0x6')]('value')?path['extname'](this[_0x3545('0x6')](_0x3545('0x7'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x3545('0x8')]},'value':{'type':Sequelize['STRING'],'set':function(_0x290aa5){var _0x496d6b=_0x290aa5['replace'](/\\/g,'/');this[_0x3545('0x9')](_0x3545('0x7'),_0x496d6b);}},'rating':{'type':Sequelize[_0x3545('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x21dc51){this[_0x3545('0x9')](_0x3545('0xb'),moment()[_0x3545('0xc')](_0x21dc51,'ms'));this[_0x3545('0x9')](_0x3545('0xd'),moment());this[_0x3545('0x9')]('duration',_0x21dc51);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x3545('0x6')](_0x3545('0xb')))[_0x3545('0xe')](_0x3545('0xf'))['toString']();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x3545('0xd')))[_0x3545('0xe')]('MM-DD-YYYY\x20HH:mm')[_0x3545('0x10')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x3545('0x11')))[_0x3545('0xe')]('MM-DD-YYYY\x20HH:mm')[_0x3545('0x10')]();}},'updatedAt':{'type':Sequelize[_0x3545('0x12')],'get':function(){return moment(this['getDataValue'](_0x3545('0x13')))['format'](_0x3545('0xf'))[_0x3545('0x10')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 55c6982..93dc241 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 _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 +var _0xdbf5=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/license/util','sendStatus','status','json','offset','undefined','count','set','Content-Range','save','update','then','destroy','end','error','stack','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','format','query','keys','intersection','fields','attributes','length','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','duration','createdAt','closedAt','value','describe','download','uniqueid','join','root','server/files/screen_recordings','decryptFile','secrets','recording','existsSync','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x31676c,_0x5b0c9d){_0x31676c=_0x31676c-0x0;var _0x5a3362=_0xdbf5[_0x31676c];return _0x5a3362;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5dbf('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5dbf('0x1'));var moment=require(_0x5dbf('0x2'));var BPromise=require(_0x5dbf('0x3'));var Mustache=require(_0x5dbf('0x4'));var util=require(_0x5dbf('0x5'));var path=require(_0x5dbf('0x6'));var sox=require(_0x5dbf('0x7'));var csv=require(_0x5dbf('0x8'));var ejs=require(_0x5dbf('0x9'));var fs=require('fs');var fs_extra=require(_0x5dbf('0xa'));var _=require(_0x5dbf('0xb'));var squel=require(_0x5dbf('0xc'));var crypto=require(_0x5dbf('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5dbf('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5dbf('0xf'));var Papa=require(_0x5dbf('0x10'));var Redis=require(_0x5dbf('0x11'));var authService=require(_0x5dbf('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5dbf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5dbf('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5dbf('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x182cec,_0x2bb7ed){_0x2bb7ed=_0x2bb7ed||0xcc;return function(_0x1453a9){if(_0x1453a9){return _0x182cec[_0x5dbf('0x16')](_0x2bb7ed);}return _0x182cec[_0x5dbf('0x17')](_0x2bb7ed)['end']();};}function respondWithResult(_0x4803ca,_0x2b4e1c){_0x2b4e1c=_0x2b4e1c||0xc8;return function(_0x3480c8){if(_0x3480c8){return _0x4803ca['status'](_0x2b4e1c)[_0x5dbf('0x18')](_0x3480c8);}};}function respondWithFilteredResult(_0x248e3c,_0x23f763){return function(_0x2dfa44){if(_0x2dfa44){var _0x181816=typeof _0x23f763[_0x5dbf('0x19')]===_0x5dbf('0x1a')&&typeof _0x23f763['limit']==='undefined';var _0x16dc82=_0x2dfa44[_0x5dbf('0x1b')];var _0x39c7aa=_0x181816?0x0:_0x23f763[_0x5dbf('0x19')];var _0x20c2b0=_0x181816?_0x2dfa44['count']:_0x23f763[_0x5dbf('0x19')]+_0x23f763['limit'];var _0x565efa;if(_0x20c2b0>=_0x16dc82){_0x20c2b0=_0x16dc82;_0x565efa=0xc8;}else{_0x565efa=0xce;}_0x248e3c['status'](_0x565efa);return _0x248e3c[_0x5dbf('0x1c')](_0x5dbf('0x1d'),_0x39c7aa+'-'+_0x20c2b0+'/'+_0x16dc82)[_0x5dbf('0x18')](_0x2dfa44);}return null;};}function patchUpdates(_0x2ab57c){return function(_0x1e3cce){try{jsonpatch['apply'](_0x1e3cce,_0x2ab57c,!![]);}catch(_0x2764ea){return BPromise['reject'](_0x2764ea);}return _0x1e3cce[_0x5dbf('0x1e')]();};}function saveUpdates(_0x11cc67,_0x14d133){return function(_0x43a612){if(_0x43a612){return _0x43a612[_0x5dbf('0x1f')](_0x11cc67)[_0x5dbf('0x20')](function(_0x58085e){return _0x58085e;});}return null;};}function removeEntity(_0x4027c3,_0x3e3a2d){return function(_0x2d3e1b){if(_0x2d3e1b){return _0x2d3e1b[_0x5dbf('0x21')]()[_0x5dbf('0x20')](function(){_0x4027c3[_0x5dbf('0x17')](0xcc)[_0x5dbf('0x22')]();});}};}function handleEntityNotFound(_0x20ab1b,_0x42f13b){return function(_0x15a790){if(!_0x15a790){_0x20ab1b[_0x5dbf('0x16')](0x194);}return _0x15a790;};}function handleError(_0x232c77,_0x3f9e60){_0x3f9e60=_0x3f9e60||0x1f4;return function(_0x407741){logger[_0x5dbf('0x23')](_0x407741[_0x5dbf('0x24')]);if(_0x407741[_0x5dbf('0x25')]){delete _0x407741[_0x5dbf('0x25')];}_0x232c77[_0x5dbf('0x17')](_0x3f9e60)[_0x5dbf('0x26')](_0x407741);};}exports[_0x5dbf('0x27')]=function(_0x471027,_0x21cd00){var _0x5768b7={},_0x2f71eb={},_0x24dc99={'count':0x0,'rows':[]};var _0xc4748=_[_0x5dbf('0x28')](db[_0x5dbf('0x29')][_0x5dbf('0x2a')],function(_0x2a65c5){return{'name':_0x2a65c5[_0x5dbf('0x2b')],'type':_0x2a65c5[_0x5dbf('0x2c')][_0x5dbf('0x2d')]};});_0x2f71eb[_0x5dbf('0x2e')]=_['differenceBy'](_['map'](_0xc4748,_0x5dbf('0x25')),[_0x5dbf('0x2f')]);_0x2f71eb[_0x5dbf('0x30')]=_[_0x5dbf('0x31')](_0x471027[_0x5dbf('0x30')]);_0x2f71eb['filters']=_['intersection'](_0x2f71eb[_0x5dbf('0x2e')],_0x2f71eb[_0x5dbf('0x30')]);_0x5768b7['attributes']=_[_0x5dbf('0x32')](_0x2f71eb[_0x5dbf('0x2e')],qs[_0x5dbf('0x33')](_0x471027[_0x5dbf('0x30')][_0x5dbf('0x33')]));_0x5768b7['attributes']=_0x5768b7[_0x5dbf('0x34')][_0x5dbf('0x35')]?_0x5768b7[_0x5dbf('0x34')]:_0x2f71eb[_0x5dbf('0x2e')];if(!_0x471027[_0x5dbf('0x30')]['hasOwnProperty'](_0x5dbf('0x36'))){_0x5768b7[_0x5dbf('0x37')]=qs[_0x5dbf('0x37')](_0x471027[_0x5dbf('0x30')]['limit']);_0x5768b7[_0x5dbf('0x19')]=qs[_0x5dbf('0x19')](_0x471027[_0x5dbf('0x30')][_0x5dbf('0x19')]);}_0x5768b7[_0x5dbf('0x38')]=qs[_0x5dbf('0x39')](_0x471027[_0x5dbf('0x30')][_0x5dbf('0x39')]);_0x5768b7[_0x5dbf('0x3a')]=qs[_0x5dbf('0x3b')](_[_0x5dbf('0x3c')](_0x471027['query'],_0x2f71eb[_0x5dbf('0x3b')]),_0xc4748);if(_0x471027[_0x5dbf('0x30')][_0x5dbf('0x3d')]){_0x5768b7['where']=_[_0x5dbf('0x3e')](_0x5768b7[_0x5dbf('0x3a')],{'$or':_[_0x5dbf('0x28')](_0xc4748,function(_0x5b3738){if(_0x5b3738[_0x5dbf('0x2c')]!==_0x5dbf('0x3f')){var _0x9bd4c0={};_0x9bd4c0[_0x5b3738['name']]={'$like':'%'+_0x471027[_0x5dbf('0x30')][_0x5dbf('0x3d')]+'%'};return _0x9bd4c0;}})});}_0x5768b7=_[_0x5dbf('0x3e')]({},_0x5768b7,_0x471027[_0x5dbf('0x40')]);var _0x10537d={'where':_0x5768b7[_0x5dbf('0x3a')]};return db[_0x5dbf('0x29')][_0x5dbf('0x1b')](_0x10537d)['then'](function(_0x5be96b){_0x24dc99['count']=_0x5be96b;if(_0x471027['query'][_0x5dbf('0x41')]){_0x5768b7[_0x5dbf('0x42')]=[{'all':!![]}];}return db['ScreenRecording'][_0x5dbf('0x43')](_0x5768b7);})[_0x5dbf('0x20')](function(_0x5a60e8){_0x24dc99[_0x5dbf('0x44')]=_0x5a60e8;return _0x24dc99;})[_0x5dbf('0x20')](respondWithFilteredResult(_0x21cd00,_0x5768b7))[_0x5dbf('0x45')](handleError(_0x21cd00,null));};exports[_0x5dbf('0x46')]=function(_0x21ae10,_0x7c390d){var _0x2745df={'raw':![],'where':{'id':_0x21ae10[_0x5dbf('0x47')]['id']}},_0x1c020a={};_0x1c020a[_0x5dbf('0x2e')]=_['keys'](db[_0x5dbf('0x29')][_0x5dbf('0x2a')]);_0x1c020a[_0x5dbf('0x30')]=_['keys'](_0x21ae10[_0x5dbf('0x30')]);_0x1c020a[_0x5dbf('0x3b')]=_[_0x5dbf('0x32')](_0x1c020a[_0x5dbf('0x2e')],_0x1c020a['query']);_0x2745df[_0x5dbf('0x34')]=_['intersection'](_0x1c020a[_0x5dbf('0x2e')],qs[_0x5dbf('0x33')](_0x21ae10[_0x5dbf('0x30')][_0x5dbf('0x33')]));_0x2745df['attributes']=_0x2745df['attributes'][_0x5dbf('0x35')]?_0x2745df[_0x5dbf('0x34')]:_0x1c020a[_0x5dbf('0x2e')];if(_0x21ae10['query'][_0x5dbf('0x41')]){_0x2745df['include']=[{'all':!![]}];}_0x2745df=_['merge']({},_0x2745df,_0x21ae10['options']);return db['ScreenRecording'][_0x5dbf('0x48')](_0x2745df)[_0x5dbf('0x20')](handleEntityNotFound(_0x7c390d,null))['then'](respondWithResult(_0x7c390d,null))[_0x5dbf('0x45')](handleError(_0x7c390d,null));};exports[_0x5dbf('0x49')]=function(_0x4b6f30,_0x366102){return db[_0x5dbf('0x29')]['create'](_0x4b6f30[_0x5dbf('0x4a')],{})['then'](respondWithResult(_0x366102,0xc9))['catch'](handleError(_0x366102,null));};exports[_0x5dbf('0x1f')]=function(_0x2a3d30,_0x17a1c0){if(_0x2a3d30['body']['id']){delete _0x2a3d30['body']['id'];}delete _0x2a3d30[_0x5dbf('0x4a')][_0x5dbf('0x4b')];delete _0x2a3d30[_0x5dbf('0x4a')][_0x5dbf('0x4c')];delete _0x2a3d30[_0x5dbf('0x4a')][_0x5dbf('0x4d')];delete _0x2a3d30[_0x5dbf('0x4a')][_0x5dbf('0x4e')];return db['ScreenRecording'][_0x5dbf('0x48')]({'where':{'id':_0x2a3d30[_0x5dbf('0x47')]['id']}})[_0x5dbf('0x20')](handleEntityNotFound(_0x17a1c0,null))[_0x5dbf('0x20')](saveUpdates(_0x2a3d30[_0x5dbf('0x4a')],null))[_0x5dbf('0x20')](respondWithResult(_0x17a1c0,null))[_0x5dbf('0x45')](handleError(_0x17a1c0,null));};exports['describe']=function(_0x1b0b13,_0x54f401){return db[_0x5dbf('0x29')][_0x5dbf('0x4f')]()[_0x5dbf('0x20')](respondWithResult(_0x54f401,null))[_0x5dbf('0x45')](handleError(_0x54f401,null));};exports[_0x5dbf('0x50')]=function(_0x1f165d,_0x353d0f,_0x48403a){var _0x5c3c0d=require('../../components/encryptor');var _0x1e1876=![];var _0xfdacc7={};if(_0x1f165d[_0x5dbf('0x30')]['type']&&_0x1f165d['query'][_0x5dbf('0x2c')]===_0x5dbf('0x51')){_0xfdacc7[_0x5dbf('0x51')]=_0x1f165d['params']['id'];}else{_0xfdacc7['id']=_0x1f165d[_0x5dbf('0x47')]['id'];}return db['ScreenRecording'][_0x5dbf('0x48')]({'where':_0xfdacc7,'attributes':['id',_0x5dbf('0x4e')],'raw':!![]})[_0x5dbf('0x20')](handleEntityNotFound(_0x353d0f,null))['then'](function(_0x55fd51){if(_0x55fd51){var _0x1b316d=path[_0x5dbf('0x52')](config[_0x5dbf('0x53')],_0x5dbf('0x54'),_0x55fd51['value']);var _0xfcc43c=util[_0x5dbf('0x2f')]('%s.cypher',_0x1b316d);if(fs['existsSync'](_0xfcc43c)){_0x1e1876=!![];return _0x5c3c0d[_0x5dbf('0x55')](_0xfcc43c,_0x1b316d,config[_0x5dbf('0x56')][_0x5dbf('0x57')])[_0x5dbf('0x20')](function(){return _0x55fd51;});}return _0x55fd51;}})[_0x5dbf('0x20')](function(_0x4711d5){if(_0x4711d5){var _0x50a029=path[_0x5dbf('0x52')](config['root'],'server/files/screen_recordings',_0x4711d5['value']);if(!fs[_0x5dbf('0x58')](_0x50a029)){throw new db['Sequelize'][(_0x5dbf('0x59'))](_0x5dbf('0x5a'));}if(_0x4711d5[_0x5dbf('0x5b')]){return _0x353d0f[_0x5dbf('0x50')](_0x50a029,_0x4711d5[_0x5dbf('0x5b')]+path[_0x5dbf('0x5c')](_0x50a029),function(){if(_0x1e1876){fs[_0x5dbf('0x5d')](_0x50a029);}});}else{return _0x353d0f[_0x5dbf('0x50')](_0x50a029,function(_0x2c84d6){if(_0x1e1876){fs[_0x5dbf('0x5d')](_0x50a029);}});}}})[_0x5dbf('0x45')](function(_0x2ca889){if(_0x2ca889[_0x5dbf('0x5e')]===_0x5dbf('0x5a')){_0x353d0f[_0x5dbf('0x17')](0x194)['send'](_0x5dbf('0x5f'));}else{return handleError(_0x353d0f,null);}});};exports['destroy']=function(_0xb0a9bf,_0xfc5817){return db[_0x5dbf('0x29')][_0x5dbf('0x48')]({'where':{'id':_0xb0a9bf['params']['id']}})[_0x5dbf('0x20')](function(_0x1ade34){if(_[_0x5dbf('0x60')](_0x1ade34)){throw new ReferenceError(_0x5dbf('0x61'));}return _0x1ade34;})[_0x5dbf('0x20')](function(_0x40982f){var _0x52efd7=path[_0x5dbf('0x52')](config[_0x5dbf('0x53')],_0x5dbf('0x54'),_0x40982f[_0x5dbf('0x4e')]);logger[_0x5dbf('0x62')](_0x5dbf('0x63'),_0x52efd7);if(!_[_0x5dbf('0x60')](_0x40982f[_0x5dbf('0x4e')])&&fs[_0x5dbf('0x58')](_0x52efd7)){logger[_0x5dbf('0x62')](_0x5dbf('0x64')+_0x52efd7+_0x5dbf('0x65'));fs['unlinkSync'](_0x52efd7);}_0x52efd7=_0x52efd7+'.cypher';if(!_[_0x5dbf('0x60')](_0x40982f[_0x5dbf('0x4e')])&&fs[_0x5dbf('0x58')](_0x52efd7)){logger[_0x5dbf('0x62')](_0x5dbf('0x64')+_0x52efd7+_0x5dbf('0x65'));fs[_0x5dbf('0x66')](_0x52efd7);}return _0x40982f;})[_0x5dbf('0x20')](function(_0x3a4001){if(!_0x3a4001)throw new InternalError();return _0x3a4001['destroy']();})['then'](function(){_0xfc5817['status'](0xcc)['end']();})[_0x5dbf('0x45')](handleError(_0xfc5817,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 6b60a58..845fc86 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 _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 +var _0x8e99=['rimraf','../../config/environment','./screenRecording.attributes','exports','define','screen_recordings','interactionid','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x5cb508,_0x2cb3bd){var _0x44d4f5=function(_0x51502f){while(--_0x51502f){_0x5cb508['push'](_0x5cb508['shift']());}};_0x44d4f5(++_0x2cb3bd);}(_0x8e99,0x18f));var _0x98e9=function(_0x2a1753,_0x10bfd6){_0x2a1753=_0x2a1753-0x0;var _0x10b1fa=_0x8e99[_0x2a1753];return _0x10b1fa;};'use strict';var _=require(_0x98e9('0x0'));var util=require('util');var logger=require(_0x98e9('0x1'))(_0x98e9('0x2'));var moment=require(_0x98e9('0x3'));var BPromise=require(_0x98e9('0x4'));var rp=require(_0x98e9('0x5'));var fs=require('fs');var path=require(_0x98e9('0x6'));var rimraf=require(_0x98e9('0x7'));var config=require(_0x98e9('0x8'));var attributes=require(_0x98e9('0x9'));module[_0x98e9('0xa')]=function(_0x39fabe,_0x176a4f){return _0x39fabe[_0x98e9('0xb')]('ScreenRecording',attributes,{'tableName':_0x98e9('0xc'),'paranoid':![],'indexes':[{'name':_0x98e9('0xd'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index a33d80e..3a2b77f 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 _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 +var _0xa316=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util'];(function(_0x264ca3,_0x65b645){var _0x156d1e=function(_0x3c2990){while(--_0x3c2990){_0x264ca3['push'](_0x264ca3['shift']());}};_0x156d1e(++_0x65b645);}(_0xa316,0xf0));var _0x6a31=function(_0x29eb66,_0x3aecf4){_0x29eb66=_0x29eb66-0x0;var _0x534052=_0xa316[_0x29eb66];return _0x534052;};'use strict';var _=require(_0x6a31('0x0'));var util=require(_0x6a31('0x1'));var moment=require(_0x6a31('0x2'));var BPromise=require(_0x6a31('0x3'));var rs=require(_0x6a31('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6a31('0x5'))['db'];var utils=require(_0x6a31('0x6'));var logger=require(_0x6a31('0x7'))(_0x6a31('0x8'));var config=require(_0x6a31('0x9'));var jayson=require(_0x6a31('0xa'));var client=jayson[_0x6a31('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x48d0bf,_0x36659c,_0x8a7e8c){return new BPromise(function(_0x28213f,_0x2cb8dc){return client[_0x6a31('0xc')](_0x48d0bf,_0x8a7e8c)['then'](function(_0x455331){logger['info'](_0x6a31('0xd'),_0x36659c,_0x6a31('0xe'));logger[_0x6a31('0xf')](_0x6a31('0x10'),_0x36659c,'request\x20sent',JSON[_0x6a31('0x11')](_0x455331));if(_0x455331[_0x6a31('0x12')]){if(_0x455331[_0x6a31('0x12')][_0x6a31('0x13')]===0x1f4){logger[_0x6a31('0x12')](_0x6a31('0xd'),_0x36659c,_0x455331[_0x6a31('0x12')]['message']);return _0x2cb8dc(_0x455331['error']['message']);}logger[_0x6a31('0x12')](_0x6a31('0xd'),_0x36659c,_0x455331[_0x6a31('0x12')][_0x6a31('0x14')]);return _0x28213f(_0x455331[_0x6a31('0x12')]['message']);}else{logger['info'](_0x6a31('0xd'),_0x36659c,'request\x20sent');_0x28213f(_0x455331['result'][_0x6a31('0x14')]);}})[_0x6a31('0x15')](function(_0x2b12b3){logger[_0x6a31('0x12')]('ScreenRecording,\x20%s,\x20%s',_0x36659c,_0x2b12b3);_0x2cb8dc(_0x2b12b3);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 295733c..41b60ef 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 _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 +var _0xd870=['getLogo','/:id/logo_login','/:id/gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','/:id/logo','single','file','addLogoLogin','root','addPreferred','favicon','put','update','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/now','getDate','show'];(function(_0x175c96,_0x40c024){var _0x2b09cc=function(_0x502b84){while(--_0x502b84){_0x175c96['push'](_0x175c96['shift']());}};_0x2b09cc(++_0x40c024);}(_0xd870,0x94));var _0x0d87=function(_0x3fa48d,_0x36dcb8){_0x3fa48d=_0x3fa48d-0x0;var _0x40a7a2=_0xd870[_0x3fa48d];return _0x40a7a2;};'use strict';var multer=require('multer');var util=require(_0x0d87('0x0'));var path=require(_0x0d87('0x1'));var timeout=require(_0x0d87('0x2'));var express=require(_0x0d87('0x3'));var router=express[_0x0d87('0x4')]();var fs_extra=require(_0x0d87('0x5'));var auth=require(_0x0d87('0x6'));var interaction=require(_0x0d87('0x7'));var config=require(_0x0d87('0x8'));var controller=require(_0x0d87('0x9'));router[_0x0d87('0xa')]('/',auth[_0x0d87('0xb')](),controller[_0x0d87('0xc')]);router[_0x0d87('0xa')](_0x0d87('0xd'),controller[_0x0d87('0xe')]);router[_0x0d87('0xa')]('/:id',controller[_0x0d87('0xf')]);router['get']('/:id/logo',controller[_0x0d87('0x10')]);router[_0x0d87('0xa')](_0x0d87('0x11'),controller['getLogoLogin']);router[_0x0d87('0xa')](_0x0d87('0x12'),controller['gdpr']);router[_0x0d87('0xa')](_0x0d87('0x13'),controller[_0x0d87('0x14')]);router['get'](_0x0d87('0x15'),controller[_0x0d87('0x16')]);var upload=multer({'storage':multer[_0x0d87('0x17')]({'destination':function(_0xd16c94,_0xf968d9,_0x2bd0ff){_0x2bd0ff(null,path[_0x0d87('0x18')](config['root'],_0x0d87('0x19')));},'filename':function(_0x3d3558,_0x27051f,_0xbf6f53){_0xbf6f53(null,util[_0x0d87('0x1a')](_0x0d87('0x1b'),_0x0d87('0x1c'),path[_0x0d87('0x1d')](_0x27051f[_0x0d87('0x1e')])));}})});router[_0x0d87('0x1f')](_0x0d87('0x20'),upload[_0x0d87('0x21')](_0x0d87('0x22')),controller['addLogo']);var upload=multer({'storage':multer[_0x0d87('0x17')]({'destination':function(_0x490daf,_0x562ab1,_0x52a336){_0x52a336(null,path[_0x0d87('0x18')](config['root'],_0x0d87('0x19')));},'filename':function(_0x305414,_0x417722,_0x4221d7){_0x4221d7(null,util[_0x0d87('0x1a')](_0x0d87('0x1b'),'logologin',path[_0x0d87('0x1d')](_0x417722[_0x0d87('0x1e')])));}})});router[_0x0d87('0x1f')]('/:id/logo_login',upload['single'](_0x0d87('0x22')),controller[_0x0d87('0x23')]);var upload=multer({'storage':multer[_0x0d87('0x17')]({'destination':function(_0x3e7e0d,_0x379efc,_0x33e886){_0x33e886(null,path[_0x0d87('0x18')](config[_0x0d87('0x24')],_0x0d87('0x19')));},'filename':function(_0x4d728c,_0x327385,_0x396fe9){_0x396fe9(null,util['format']('%s%s','preferred',path[_0x0d87('0x1d')](_0x327385[_0x0d87('0x1e')])));}})});router[_0x0d87('0x1f')](_0x0d87('0x13'),upload['single']('file'),controller[_0x0d87('0x25')]);var upload=multer({'storage':multer[_0x0d87('0x17')]({'destination':function(_0x1e2d24,_0x255187,_0x3379b7){_0x3379b7(null,path[_0x0d87('0x18')](config['root'],_0x0d87('0x19')));},'filename':function(_0x2fa2d1,_0x218e1d,_0x2c0c0d){_0x2c0c0d(null,util[_0x0d87('0x1a')](_0x0d87('0x1b'),_0x0d87('0x26'),path[_0x0d87('0x1d')](_0x218e1d[_0x0d87('0x1e')])));}})});router[_0x0d87('0x1f')](_0x0d87('0x15'),upload[_0x0d87('0x21')]('file'),controller['addFavicon']);router[_0x0d87('0x27')]('/:id',auth['isAuthenticated'](),controller[_0x0d87('0x28')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index e44e3eb..00f76c7 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 _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 +var _0x0765=['STRING','BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_internal','min_mailbox','/var/opt/motion2/server/files/sounds/converted'];(function(_0x38854e,_0x23cbc9){var _0x3f8415=function(_0x4e493e){while(--_0x4e493e){_0x38854e['push'](_0x38854e['shift']());}};_0x3f8415(++_0x23cbc9);}(_0x0765,0xf4));var _0x5076=function(_0x2b8bdc,_0x1880eb){_0x2b8bdc=_0x2b8bdc-0x0;var _0x4de4cc=_0x0765[_0x2b8bdc];return _0x4de4cc;};'use strict';var Sequelize=require(_0x5076('0x0'));module[_0x5076('0x1')]={'min_internal':{'type':Sequelize[_0x5076('0x2')](0xb),'unique':_0x5076('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x5076('0x2')](0xb),'unique':_0x5076('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':_0x5076('0x5')},'logo':{'type':Sequelize[_0x5076('0x6')]},'defaultLogo':{'type':Sequelize[_0x5076('0x7')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x5076('0x6')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x5076('0x6')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x5076('0x7')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x5076('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x5076('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x5076('0x6')]},'turnaddr':{'type':Sequelize[_0x5076('0x6')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize[_0x5076('0x6')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x5076('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x5076('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x5076('0x7')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x5076('0x6')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0x5076('0x7')],'defaultValue':![]},'split':{'type':Sequelize[_0x5076('0x7')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x5076('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x5076('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x5076('0x8')},'chatTimeout':{'type':Sequelize[_0x5076('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x5076('0x6')]},'defaultPreferred':{'type':Sequelize[_0x5076('0x7')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x5076('0x7')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x5076('0x6')]},'allowedLoginAttempts':{'type':Sequelize[_0x5076('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0x5076('0x7')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x5076('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x5076('0x7')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x5076('0x7')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x5076('0x6')]},'sentiment':{'type':Sequelize[_0x5076('0x7')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x5076('0x7')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x5076('0x2')]},'sentimentRegion':{'type':Sequelize[_0x5076('0x6')]},'language':{'type':Sequelize[_0x5076('0x6')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0x5076('0x7')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x5076('0x7')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x5076('0x7')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x5076('0x2')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x5076('0x2')](0x2)[_0x5076('0x9')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x5076('0x2')](0x2)[_0x5076('0x9')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x5076('0x2')](0x2)[_0x5076('0x9')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x5076('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x5076('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x5076('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x5076('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x5076('0x7')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x5076('0x7')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x5076('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x5076('0x2')],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0x5076('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index b266217..a9ab9f7 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 _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 +var _0x1d5c=['to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','info','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','end','json','undefined','limit','count','offset','status','set','Content-Range','apply','update','then','sendStatus','stack','name','map','Setting','rawAttributes','fieldName','type','key','model','query','keys','fields','attributes','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','show','intersection','include','find','body','file','filename','params','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','logo','preferred','favicon','defaultLogo','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','custom','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','defaultLoginLogo','default_loginLogo.svg','gdpr','securePassword','default_preferred.png','addFavicon','getFavicon','defaultPreferred','default_favicon.ico','getDate','utcOffset','now','format','send','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','sox'];(function(_0x2426d7,_0x515f06){var _0x236709=function(_0x10a8f2){while(--_0x10a8f2){_0x2426d7['push'](_0x2426d7['shift']());}};_0x236709(++_0x515f06);}(_0x1d5c,0xeb));var _0xc1d5=function(_0x440fde,_0x445ce0){_0x440fde=_0x440fde-0x0;var _0x11052c=_0x1d5c[_0x440fde];return _0x11052c;};'use strict';var emlformat=require(_0xc1d5('0x0'));var rimraf=require(_0xc1d5('0x1'));var zipdir=require(_0xc1d5('0x2'));var jsonpatch=require(_0xc1d5('0x3'));var rp=require(_0xc1d5('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc1d5('0x5'));var path=require('path');var sox=require(_0xc1d5('0x6'));var csv=require(_0xc1d5('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc1d5('0x8'));var _=require(_0xc1d5('0x9'));var squel=require(_0xc1d5('0xa'));var crypto=require(_0xc1d5('0xb'));var jsforce=require(_0xc1d5('0xc'));var deskjs=require(_0xc1d5('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc1d5('0xe'));var Papa=require(_0xc1d5('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc1d5('0x10'));var as=require(_0xc1d5('0x11'));var hardwareService=require(_0xc1d5('0x12'));var logger=require(_0xc1d5('0x13'))(_0xc1d5('0x14'));var utils=require(_0xc1d5('0x15'));var config=require(_0xc1d5('0x16'));var licenseUtil=require(_0xc1d5('0x17'));var db=require(_0xc1d5('0x18'))['db'];var jayson=require(_0xc1d5('0x19'));var client=jayson['client'][_0xc1d5('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x2d20e7,_0x5b6b63,_0x5d70fc,_0x4a2281){return new BPromise(function(_0x51d0ae,_0x8f9117){var _0x4dcb1d=_0x4a2281||client;return _0x4dcb1d['request'](_0x2d20e7,_0x5d70fc)['then'](function(_0x425eeb){logger[_0xc1d5('0x1b')](_0xc1d5('0x1c'),_0x5b6b63,_0xc1d5('0x1d'));logger[_0xc1d5('0x1e')]('Setting,\x20%s,\x20%s,\x20%s',_0x5b6b63,'request\x20sent',JSON[_0xc1d5('0x1f')](_0x425eeb));if(_0x425eeb[_0xc1d5('0x20')]){if(_0x425eeb[_0xc1d5('0x20')][_0xc1d5('0x21')]===0x1f4){logger['error'](_0xc1d5('0x1c'),_0x5b6b63,_0x425eeb['error'][_0xc1d5('0x22')]);return _0x8f9117(_0x425eeb['error'][_0xc1d5('0x22')]);}logger[_0xc1d5('0x20')](_0xc1d5('0x1c'),_0x5b6b63,_0x425eeb[_0xc1d5('0x20')]['message']);return _0x51d0ae(_0x425eeb['error'][_0xc1d5('0x22')]);}else{logger[_0xc1d5('0x1b')](_0xc1d5('0x1c'),_0x5b6b63,_0xc1d5('0x1d'));_0x51d0ae(_0x425eeb[_0xc1d5('0x23')]['message']);}})[_0xc1d5('0x24')](function(_0x644502){logger[_0xc1d5('0x20')]('Setting,\x20%s,\x20%s',_0x5b6b63,_0x644502);_0x8f9117(_0x644502);});});}function respondWithStatusCode(_0x495121,_0x216b26){_0x216b26=_0x216b26||0xcc;return function(_0x836a41){if(_0x836a41){return _0x495121['sendStatus'](_0x216b26);}return _0x495121['status'](_0x216b26)[_0xc1d5('0x25')]();};}function respondWithResult(_0x566957,_0x58d65a){_0x58d65a=_0x58d65a||0xc8;return function(_0x13cc2e){if(_0x13cc2e){return _0x566957['status'](_0x58d65a)[_0xc1d5('0x26')](_0x13cc2e);}};}function respondWithFilteredResult(_0x3183e4,_0x179e32){return function(_0x98fe96){if(_0x98fe96){var _0x2418b4=typeof _0x179e32['offset']===_0xc1d5('0x27')&&typeof _0x179e32[_0xc1d5('0x28')]===_0xc1d5('0x27');var _0x522d56=_0x98fe96[_0xc1d5('0x29')];var _0x272113=_0x2418b4?0x0:_0x179e32[_0xc1d5('0x2a')];var _0xb31830=_0x2418b4?_0x98fe96['count']:_0x179e32[_0xc1d5('0x2a')]+_0x179e32[_0xc1d5('0x28')];var _0xcdb1b1;if(_0xb31830>=_0x522d56){_0xb31830=_0x522d56;_0xcdb1b1=0xc8;}else{_0xcdb1b1=0xce;}_0x3183e4[_0xc1d5('0x2b')](_0xcdb1b1);return _0x3183e4[_0xc1d5('0x2c')](_0xc1d5('0x2d'),_0x272113+'-'+_0xb31830+'/'+_0x522d56)[_0xc1d5('0x26')](_0x98fe96);}return null;};}function patchUpdates(_0x3aaa45){return function(_0x4ee244){try{jsonpatch[_0xc1d5('0x2e')](_0x4ee244,_0x3aaa45,!![]);}catch(_0x5c159a){return BPromise['reject'](_0x5c159a);}return _0x4ee244['save']();};}function saveUpdates(_0x4ac338,_0xd22a28){return function(_0x546a1c){if(_0x546a1c){return _0x546a1c[_0xc1d5('0x2f')](_0x4ac338)[_0xc1d5('0x30')](function(_0x5f2375){return _0x5f2375;});}return null;};}function removeEntity(_0x26aec6,_0x180970){return function(_0x2db4c5){if(_0x2db4c5){return _0x2db4c5['destroy']()['then'](function(){_0x26aec6[_0xc1d5('0x2b')](0xcc)[_0xc1d5('0x25')]();});}};}function handleEntityNotFound(_0x506e18,_0x375b78){return function(_0x40194e){if(!_0x40194e){_0x506e18[_0xc1d5('0x31')](0x194);}return _0x40194e;};}function handleError(_0x208cce,_0x3b17e0){_0x3b17e0=_0x3b17e0||0x1f4;return function(_0x3eee2e){logger[_0xc1d5('0x20')](_0x3eee2e[_0xc1d5('0x32')]);if(_0x3eee2e[_0xc1d5('0x33')]){delete _0x3eee2e['name'];}_0x208cce[_0xc1d5('0x2b')](_0x3b17e0)['send'](_0x3eee2e);};}exports['index']=function(_0x40d3f3,_0x380e2c){var _0x1da3a1={},_0x517b1d={},_0x112f5c={'count':0x0,'rows':[]};var _0xf9988d=_[_0xc1d5('0x34')](db[_0xc1d5('0x35')][_0xc1d5('0x36')],function(_0x574282){return{'name':_0x574282[_0xc1d5('0x37')],'type':_0x574282[_0xc1d5('0x38')][_0xc1d5('0x39')]};});_0x517b1d[_0xc1d5('0x3a')]=_['map'](_0xf9988d,'name');_0x517b1d[_0xc1d5('0x3b')]=_[_0xc1d5('0x3c')](_0x40d3f3[_0xc1d5('0x3b')]);_0x517b1d['filters']=_['intersection'](_0x517b1d[_0xc1d5('0x3a')],_0x517b1d['query']);_0x1da3a1['attributes']=_['intersection'](_0x517b1d[_0xc1d5('0x3a')],qs[_0xc1d5('0x3d')](_0x40d3f3[_0xc1d5('0x3b')][_0xc1d5('0x3d')]));_0x1da3a1[_0xc1d5('0x3e')]=_0x1da3a1[_0xc1d5('0x3e')][_0xc1d5('0x3f')]?_0x1da3a1[_0xc1d5('0x3e')]:_0x517b1d[_0xc1d5('0x3a')];if(!_0x40d3f3[_0xc1d5('0x3b')]['hasOwnProperty'](_0xc1d5('0x40'))){_0x1da3a1[_0xc1d5('0x28')]=qs['limit'](_0x40d3f3['query'][_0xc1d5('0x28')]);_0x1da3a1[_0xc1d5('0x2a')]=qs[_0xc1d5('0x2a')](_0x40d3f3[_0xc1d5('0x3b')]['offset']);}_0x1da3a1[_0xc1d5('0x41')]=qs['sort'](_0x40d3f3[_0xc1d5('0x3b')][_0xc1d5('0x42')]);_0x1da3a1['where']=qs[_0xc1d5('0x43')](_['pick'](_0x40d3f3[_0xc1d5('0x3b')],_0x517b1d[_0xc1d5('0x43')]),_0xf9988d);if(_0x40d3f3[_0xc1d5('0x3b')][_0xc1d5('0x44')]){_0x1da3a1[_0xc1d5('0x45')]=_['merge'](_0x1da3a1[_0xc1d5('0x45')],{'$or':_[_0xc1d5('0x34')](_0xf9988d,function(_0x5ef2a7){if(_0x5ef2a7[_0xc1d5('0x38')]!==_0xc1d5('0x46')){var _0x14f909={};_0x14f909[_0x5ef2a7[_0xc1d5('0x33')]]={'$like':'%'+_0x40d3f3['query']['filter']+'%'};return _0x14f909;}})});}_0x1da3a1=_[_0xc1d5('0x47')]({},_0x1da3a1,_0x40d3f3[_0xc1d5('0x48')]);var _0x4aaf95={'where':_0x1da3a1[_0xc1d5('0x45')]};return db[_0xc1d5('0x35')][_0xc1d5('0x29')](_0x4aaf95)[_0xc1d5('0x30')](function(_0x4c3d4c){_0x112f5c[_0xc1d5('0x29')]=_0x4c3d4c;if(_0x40d3f3['query'][_0xc1d5('0x49')]){_0x1da3a1['include']=[{'all':!![]}];}return db[_0xc1d5('0x35')][_0xc1d5('0x4a')](_0x1da3a1);})[_0xc1d5('0x30')](function(_0x3e470b){_0x112f5c[_0xc1d5('0x4b')]=_0x3e470b;return _0x112f5c;})[_0xc1d5('0x30')](respondWithFilteredResult(_0x380e2c,_0x1da3a1))[_0xc1d5('0x24')](handleError(_0x380e2c,null));};exports[_0xc1d5('0x4c')]=function(_0x1155d8,_0x145169){var _0x37b0f0={'raw':![],'where':{'id':_0x1155d8['params']['id']}},_0x519bc2={};_0x519bc2[_0xc1d5('0x3a')]=_[_0xc1d5('0x3c')](db['Setting'][_0xc1d5('0x36')]);_0x519bc2[_0xc1d5('0x3b')]=_[_0xc1d5('0x3c')](_0x1155d8[_0xc1d5('0x3b')]);_0x519bc2[_0xc1d5('0x43')]=_[_0xc1d5('0x4d')](_0x519bc2[_0xc1d5('0x3a')],_0x519bc2[_0xc1d5('0x3b')]);_0x37b0f0['attributes']=_[_0xc1d5('0x4d')](_0x519bc2['model'],qs[_0xc1d5('0x3d')](_0x1155d8[_0xc1d5('0x3b')][_0xc1d5('0x3d')]));_0x37b0f0[_0xc1d5('0x3e')]=_0x37b0f0[_0xc1d5('0x3e')]['length']?_0x37b0f0[_0xc1d5('0x3e')]:_0x519bc2[_0xc1d5('0x3a')];if(_0x1155d8[_0xc1d5('0x3b')][_0xc1d5('0x49')]){_0x37b0f0[_0xc1d5('0x4e')]=[{'all':!![]}];}_0x37b0f0=_[_0xc1d5('0x47')]({},_0x37b0f0,_0x1155d8[_0xc1d5('0x48')]);return db[_0xc1d5('0x35')][_0xc1d5('0x4f')](_0x37b0f0)[_0xc1d5('0x30')](handleEntityNotFound(_0x145169,null))[_0xc1d5('0x30')](respondWithResult(_0x145169,null))[_0xc1d5('0x24')](handleError(_0x145169,null));};exports[_0xc1d5('0x2f')]=function(_0xcdaac5,_0x398c78){if(_0xcdaac5[_0xc1d5('0x50')]['id']){delete _0xcdaac5[_0xc1d5('0x50')]['id'];}return db['Setting'][_0xc1d5('0x4f')]({'where':{'id':_0xcdaac5['params']['id']}})[_0xc1d5('0x30')](handleEntityNotFound(_0x398c78,null))[_0xc1d5('0x30')](saveUpdates(_0xcdaac5[_0xc1d5('0x50')],null))[_0xc1d5('0x30')](respondWithResult(_0x398c78,null))[_0xc1d5('0x24')](handleError(_0x398c78,null));};exports['addLogo']=function(_0x31f98b,_0x325b28,_0x552b69){if(_0x31f98b[_0xc1d5('0x51')]&&_0x31f98b[_0xc1d5('0x51')][_0xc1d5('0x52')]){_0x31f98b['body']['logo']=_0x31f98b['file'][_0xc1d5('0x52')];}return db[_0xc1d5('0x35')][_0xc1d5('0x4f')]({'where':{'id':_0x31f98b[_0xc1d5('0x53')]['id']}})[_0xc1d5('0x30')](handleEntityNotFound(_0x325b28,null))[_0xc1d5('0x30')](saveUpdates(_0x31f98b[_0xc1d5('0x50')],null))[_0xc1d5('0x30')](respondWithResult(_0x325b28,null))['catch'](handleError(_0x325b28,null));};exports[_0xc1d5('0x54')]=function(_0xb33851,_0x456096,_0x1d06a2){if(_0xb33851['file']&&_0xb33851['file'][_0xc1d5('0x52')]){_0xb33851[_0xc1d5('0x50')][_0xc1d5('0x55')]=_0xb33851[_0xc1d5('0x51')][_0xc1d5('0x52')];}return db[_0xc1d5('0x35')][_0xc1d5('0x4f')]({'where':{'id':_0xb33851['params']['id']}})[_0xc1d5('0x30')](handleEntityNotFound(_0x456096,null))[_0xc1d5('0x30')](saveUpdates(_0xb33851[_0xc1d5('0x50')],null))[_0xc1d5('0x30')](respondWithResult(_0x456096,null))[_0xc1d5('0x24')](handleError(_0x456096,null));};var utilLicense=require(_0xc1d5('0x17'));exports[_0xc1d5('0x56')]=function(_0x553cc2,_0x381a99,_0x3ddb38){var _0x2d65d3=_0xc1d5('0x57');var _0x233c50={'custom':![]};return utilLicense[_0xc1d5('0x58')]()[_0xc1d5('0x30')](function(_0x3f810a){if(_0x3f810a){_0x233c50=_0x3f810a;}return db[_0xc1d5('0x35')]['find']({'where':{'id':_0x553cc2[_0xc1d5('0x53')]['id']},'attributes':[_0xc1d5('0x59'),'loginLogo',_0xc1d5('0x5a'),_0xc1d5('0x5b'),_0xc1d5('0x5c'),'defaultLoginLogo','defaultPreferred',_0xc1d5('0x5d')],'raw':!![]});})[_0xc1d5('0x30')](handleEntityNotFound(_0x381a99,null))['then'](function(_0x429224){if(_0x429224){var _0x1c9661=_0x429224[_0xc1d5('0x59')]&&fs[_0xc1d5('0x5e')](path[_0xc1d5('0x5f')](config[_0xc1d5('0x60')],_0x2d65d3,_[_0xc1d5('0x61')](_0x429224[_0xc1d5('0x59')])))?path['join'](config[_0xc1d5('0x60')],_0x2d65d3,_[_0xc1d5('0x61')](_0x429224['logo'])):path[_0xc1d5('0x5f')](config[_0xc1d5('0x60')],_0x2d65d3,_['toLower'](_0xc1d5('0x62')));var _0x563bd7=_0xc1d5('0x63')+_[_0xc1d5('0x64')]('logo');if(_0x429224[_0x563bd7]||!_0x233c50[_0xc1d5('0x65')]){_0x1c9661=path[_0xc1d5('0x5f')](config[_0xc1d5('0x60')],_0x2d65d3,_[_0xc1d5('0x61')](_0xc1d5('0x62')));}if(!fs['existsSync'](_0x1c9661)){throw new db[(_0xc1d5('0x66'))][(_0xc1d5('0x67'))](_[_0xc1d5('0x64')]('logo')+_0xc1d5('0x68'));}return _0x381a99[_0xc1d5('0x69')](_0x1c9661);}})[_0xc1d5('0x24')](handleError(_0x381a99,null));};var utilLicense=require(_0xc1d5('0x17'));exports[_0xc1d5('0x6a')]=function(_0x3ead8a,_0x6c3af,_0x33a478){var _0x28ca00=_0xc1d5('0x57');var _0x5cf5fc={'custom':![]};return utilLicense['getLicense']()[_0xc1d5('0x30')](function(_0x3f4f45){if(_0x3f4f45){_0x5cf5fc=_0x3f4f45;}return db[_0xc1d5('0x35')][_0xc1d5('0x4f')]({'where':{'id':_0x3ead8a[_0xc1d5('0x53')]['id']},'attributes':[_0xc1d5('0x59'),_0xc1d5('0x55'),_0xc1d5('0x5a'),_0xc1d5('0x5b'),_0xc1d5('0x5c'),_0xc1d5('0x6b'),'defaultPreferred',_0xc1d5('0x5d')],'raw':!![]});})[_0xc1d5('0x30')](handleEntityNotFound(_0x6c3af,null))[_0xc1d5('0x30')](function(_0x24ed66){if(_0x24ed66){var _0x249230=_0x24ed66[_0xc1d5('0x55')]&&fs[_0xc1d5('0x5e')](path['join'](config[_0xc1d5('0x60')],_0x28ca00,_[_0xc1d5('0x61')](_0x24ed66[_0xc1d5('0x55')])))?path[_0xc1d5('0x5f')](config[_0xc1d5('0x60')],_0x28ca00,_[_0xc1d5('0x61')](_0x24ed66[_0xc1d5('0x55')])):path[_0xc1d5('0x5f')](config[_0xc1d5('0x60')],_0x28ca00,_['toLower'](_0xc1d5('0x6c')));var _0x179e09='default'+_[_0xc1d5('0x64')](_0xc1d5('0x55'));if(_0x24ed66[_0x179e09]||!_0x5cf5fc[_0xc1d5('0x65')]){_0x249230=path['join'](config['root'],_0x28ca00,_[_0xc1d5('0x61')]('default_loginLogo.svg'));}if(!fs[_0xc1d5('0x5e')](_0x249230)){throw new db[(_0xc1d5('0x66'))][(_0xc1d5('0x67'))](_[_0xc1d5('0x64')]('loginLogo')+_0xc1d5('0x68'));}return _0x6c3af[_0xc1d5('0x69')](_0x249230);}})[_0xc1d5('0x24')](handleError(_0x6c3af,null));};exports[_0xc1d5('0x6d')]=function(_0x3fcf4c,_0x2c619f){return db[_0xc1d5('0x35')]['find']({'where':{'id':_0x3fcf4c['params']['id']},'attributes':[_0xc1d5('0x6e')]})[_0xc1d5('0x30')](respondWithResult(_0x2c619f,null))[_0xc1d5('0x24')](handleError(_0x2c619f,null));};exports['addPreferred']=function(_0x19aaac,_0x4478cf,_0x312334){if(_0x19aaac[_0xc1d5('0x51')]&&_0x19aaac[_0xc1d5('0x51')][_0xc1d5('0x52')]){_0x19aaac[_0xc1d5('0x50')][_0xc1d5('0x5a')]=_0x19aaac['file'][_0xc1d5('0x52')];}return db[_0xc1d5('0x35')][_0xc1d5('0x4f')]({'where':{'id':_0x19aaac[_0xc1d5('0x53')]['id']}})[_0xc1d5('0x30')](handleEntityNotFound(_0x4478cf,null))[_0xc1d5('0x30')](saveUpdates(_0x19aaac['body'],null))[_0xc1d5('0x30')](respondWithResult(_0x4478cf,null))[_0xc1d5('0x24')](handleError(_0x4478cf,null));};var utilLicense=require(_0xc1d5('0x17'));exports['getPreferred']=function(_0x58a235,_0x3faf89,_0x28f51f){var _0x6ed88d=_0xc1d5('0x57');var _0x23f650={'custom':![]};return utilLicense[_0xc1d5('0x58')]()[_0xc1d5('0x30')](function(_0x4b118f){if(_0x4b118f){_0x23f650=_0x4b118f;}return db['Setting'][_0xc1d5('0x4f')]({'where':{'id':_0x58a235[_0xc1d5('0x53')]['id']},'attributes':['logo',_0xc1d5('0x55'),_0xc1d5('0x5a'),'favicon',_0xc1d5('0x5c'),'defaultLoginLogo','defaultPreferred','defaultFavicon'],'raw':!![]});})[_0xc1d5('0x30')](handleEntityNotFound(_0x3faf89,null))['then'](function(_0xa5a878){if(_0xa5a878){var _0x4dac79=_0xa5a878[_0xc1d5('0x5a')]&&fs[_0xc1d5('0x5e')](path['join'](config[_0xc1d5('0x60')],_0x6ed88d,_[_0xc1d5('0x61')](_0xa5a878[_0xc1d5('0x5a')])))?path[_0xc1d5('0x5f')](config[_0xc1d5('0x60')],_0x6ed88d,_[_0xc1d5('0x61')](_0xa5a878[_0xc1d5('0x5a')])):path[_0xc1d5('0x5f')](config[_0xc1d5('0x60')],_0x6ed88d,_[_0xc1d5('0x61')](_0xc1d5('0x6f')));var _0x4ac416=_0xc1d5('0x63')+_[_0xc1d5('0x64')](_0xc1d5('0x5a'));if(_0xa5a878[_0x4ac416]||!_0x23f650[_0xc1d5('0x65')]||!_0x23f650[_0xc1d5('0x5a')]){_0x4dac79=path[_0xc1d5('0x5f')](config[_0xc1d5('0x60')],_0x6ed88d,_['toLower']('default_preferred.png'));}if(!fs['existsSync'](_0x4dac79)){throw new db[(_0xc1d5('0x66'))][(_0xc1d5('0x67'))](_[_0xc1d5('0x64')](_0xc1d5('0x5a'))+_0xc1d5('0x68'));}return _0x3faf89['download'](_0x4dac79);}})[_0xc1d5('0x24')](handleError(_0x3faf89,null));};exports[_0xc1d5('0x70')]=function(_0x3f0bc8,_0xe7570b,_0x52be17){if(_0x3f0bc8[_0xc1d5('0x51')]&&_0x3f0bc8[_0xc1d5('0x51')][_0xc1d5('0x52')]){_0x3f0bc8[_0xc1d5('0x50')][_0xc1d5('0x5b')]=_0x3f0bc8[_0xc1d5('0x51')][_0xc1d5('0x52')];}return db[_0xc1d5('0x35')][_0xc1d5('0x4f')]({'where':{'id':_0x3f0bc8[_0xc1d5('0x53')]['id']}})[_0xc1d5('0x30')](handleEntityNotFound(_0xe7570b,null))[_0xc1d5('0x30')](saveUpdates(_0x3f0bc8[_0xc1d5('0x50')],null))[_0xc1d5('0x30')](respondWithResult(_0xe7570b,null))['catch'](handleError(_0xe7570b,null));};var utilLicense=require(_0xc1d5('0x17'));exports[_0xc1d5('0x71')]=function(_0x203288,_0xc7d7d0,_0x5936cc){var _0x101fcd=_0xc1d5('0x57');var _0x2dd8c5={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x3b7e38){if(_0x3b7e38){_0x2dd8c5=_0x3b7e38;}return db[_0xc1d5('0x35')]['find']({'where':{'id':_0x203288[_0xc1d5('0x53')]['id']},'attributes':['logo',_0xc1d5('0x55'),_0xc1d5('0x5a'),_0xc1d5('0x5b'),_0xc1d5('0x5c'),_0xc1d5('0x6b'),_0xc1d5('0x72'),_0xc1d5('0x5d')],'raw':!![]});})[_0xc1d5('0x30')](handleEntityNotFound(_0xc7d7d0,null))[_0xc1d5('0x30')](function(_0xc151d6){if(_0xc151d6){var _0xfc5b1=_0xc151d6[_0xc1d5('0x5b')]&&fs['existsSync'](path[_0xc1d5('0x5f')](config[_0xc1d5('0x60')],_0x101fcd,_[_0xc1d5('0x61')](_0xc151d6[_0xc1d5('0x5b')])))?path[_0xc1d5('0x5f')](config[_0xc1d5('0x60')],_0x101fcd,_['toLower'](_0xc151d6[_0xc1d5('0x5b')])):path[_0xc1d5('0x5f')](config['root'],_0x101fcd,_[_0xc1d5('0x61')](_0xc1d5('0x73')));var _0x40b8f3=_0xc1d5('0x63')+_[_0xc1d5('0x64')](_0xc1d5('0x5b'));if(_0xc151d6[_0x40b8f3]||!_0x2dd8c5['custom']){_0xfc5b1=path[_0xc1d5('0x5f')](config[_0xc1d5('0x60')],_0x101fcd,_[_0xc1d5('0x61')](_0xc1d5('0x73')));}if(!fs['existsSync'](_0xfc5b1)){throw new db[(_0xc1d5('0x66'))][(_0xc1d5('0x67'))](_[_0xc1d5('0x64')](_0xc1d5('0x5b'))+_0xc1d5('0x68'));}return _0xc7d7d0[_0xc1d5('0x69')](_0xfc5b1);}})['catch'](handleError(_0xc7d7d0,null));};exports[_0xc1d5('0x74')]=function(_0x3b5e5f,_0xbd0340){var _0x11018f={'offset':moment()[_0xc1d5('0x75')]()};_0x11018f[_0xc1d5('0x76')]=moment()[_0xc1d5('0x75')](_0x11018f['offset'])[_0xc1d5('0x77')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0xbd0340[_0xc1d5('0x2b')](0xc8)[_0xc1d5('0x78')](_0x11018f);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index c62c1da..9982b80 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 _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 +var _0x55ca=['./setting.attributes','exports','define','settings','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x4d1ee9,_0x394a78){var _0x9a5456=function(_0x224f3b){while(--_0x224f3b){_0x4d1ee9['push'](_0x4d1ee9['shift']());}};_0x9a5456(++_0x394a78);}(_0x55ca,0x126));var _0xa55c=function(_0x3fa1c7,_0x13d816){_0x3fa1c7=_0x3fa1c7-0x0;var _0x21e45d=_0x55ca[_0x3fa1c7];return _0x21e45d;};'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 b168b3c..5cc86d5 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 _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 +var _0x893a=['request','then','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','result','catch','ShowSetting','Setting','find','options','raw','attributes','include','map','model','lodash','util','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x41dfac,_0x278319){var _0x12900b=function(_0x3324cd){while(--_0x3324cd){_0x41dfac['push'](_0x41dfac['shift']());}};_0x12900b(++_0x278319);}(_0x893a,0x141));var _0xa893=function(_0x553f7c,_0x3850e5){_0x553f7c=_0x553f7c-0x0;var _0x3b33d6=_0x893a[_0x553f7c];return _0x3b33d6;};'use strict';var _=require(_0xa893('0x0'));var util=require(_0xa893('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa893('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa893('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa893('0x4'))(_0xa893('0x5'));var config=require(_0xa893('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xa893('0x7')][_0xa893('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5290db,_0x4325fe,_0x154fa5){return new BPromise(function(_0x58f040,_0x58b9b0){return client[_0xa893('0x9')](_0x5290db,_0x154fa5)[_0xa893('0xa')](function(_0x1cf16b){logger['info'](_0xa893('0xb'),_0x4325fe,'request\x20sent');logger[_0xa893('0xc')](_0xa893('0xd'),_0x4325fe,'request\x20sent',JSON[_0xa893('0xe')](_0x1cf16b));if(_0x1cf16b['error']){if(_0x1cf16b[_0xa893('0xf')]['code']===0x1f4){logger[_0xa893('0xf')](_0xa893('0xb'),_0x4325fe,_0x1cf16b['error'][_0xa893('0x10')]);return _0x58b9b0(_0x1cf16b['error']['message']);}logger['error'](_0xa893('0xb'),_0x4325fe,_0x1cf16b['error']['message']);return _0x58f040(_0x1cf16b[_0xa893('0xf')][_0xa893('0x10')]);}else{logger[_0xa893('0x11')](_0xa893('0xb'),_0x4325fe,_0xa893('0x12'));_0x58f040(_0x1cf16b[_0xa893('0x13')][_0xa893('0x10')]);}})[_0xa893('0x14')](function(_0x229030){logger[_0xa893('0xf')](_0xa893('0xb'),_0x4325fe,_0x229030);_0x58b9b0(_0x229030);});});}exports[_0xa893('0x15')]=function(_0x464562){var _0x4a99dc=this;return new Promise(function(_0x15619b,_0x5b9cfe){return db[_0xa893('0x16')][_0xa893('0x17')]({'raw':_0x464562[_0xa893('0x18')]?_0x464562['options'][_0xa893('0x19')]===undefined?!![]:![]:!![],'where':_0x464562[_0xa893('0x18')]?_0x464562[_0xa893('0x18')]['where']||null:null,'attributes':_0x464562[_0xa893('0x18')]?_0x464562[_0xa893('0x18')][_0xa893('0x1a')]||null:null,'include':_0x464562[_0xa893('0x18')]?_0x464562[_0xa893('0x18')][_0xa893('0x1b')]?_[_0xa893('0x1c')](_0x464562['options'][_0xa893('0x1b')],function(_0x23a04e){return{'model':db[_0x23a04e['model']],'as':_0x23a04e['as'],'attributes':_0x23a04e[_0xa893('0x1a')],'include':_0x23a04e[_0xa893('0x1b')]?_[_0xa893('0x1c')](_0x23a04e[_0xa893('0x1b')],function(_0x53e146){return{'model':db[_0x53e146[_0xa893('0x1d')]],'as':_0x53e146['as'],'attributes':_0x53e146[_0xa893('0x1a')],'include':_0x53e146[_0xa893('0x1b')]?_[_0xa893('0x1c')](_0x53e146[_0xa893('0x1b')],function(_0x2b4d2a){return{'model':db[_0x2b4d2a[_0xa893('0x1d')]],'as':_0x2b4d2a['as'],'attributes':_0x2b4d2a[_0xa893('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa893('0xa')](function(_0x473acf){logger[_0xa893('0x11')](_0xa893('0x15'),_0x464562);logger['debug'](_0xa893('0x15'),_0x464562,JSON[_0xa893('0xe')](_0x473acf));_0x15619b(_0x473acf);})[_0xa893('0x14')](function(_0x513fd2){logger[_0xa893('0xf')]('ShowSetting',_0x513fd2[_0xa893('0x10')],_0x464562);_0x5b9cfe(_0x4a99dc[_0xa893('0xf')](0x1f4,_0x513fd2[_0xa893('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 6391074..f3b7228 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(_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 +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(_0x1d4b04,_0x24d309){var _0x67d764=function(_0x11d40a){while(--_0x11d40a){_0x1d4b04['push'](_0x1d4b04['shift']());}};_0x67d764(++_0x24d309);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',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 0ada41b..4ba361b 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 _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 +var _0x56be=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','exports','name','STRING','generate','ENUM','twilio','skebby','connectel','clicksend','plivo','clickatell','csc','TEXT','BOOLEAN','INTEGER'];(function(_0x2e9863,_0x46b17b){var _0x54a798=function(_0xbf2db6){while(--_0xbf2db6){_0x2e9863['push'](_0x2e9863['shift']());}};_0x54a798(++_0x46b17b);}(_0x56be,0x193));var _0xe56b=function(_0x1fba1e,_0xb02ef7){_0x1fba1e=_0x1fba1e-0x0;var _0x5d939c=_0x56be[_0x1fba1e];return _0x5d939c;};'use strict';var Sequelize=require(_0xe56b('0x0'));var rs=require(_0xe56b('0x1'));module[_0xe56b('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0xe56b('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xe56b('0x4')],'allowNull':![]},'remote':{'type':Sequelize[_0xe56b('0x4')],'allowNull':![]},'token':{'type':Sequelize[_0xe56b('0x4')],'defaultValue':function(){return rs[_0xe56b('0x5')]();}},'phone':{'type':Sequelize[_0xe56b('0x4')]},'type':{'type':Sequelize[_0xe56b('0x6')](_0xe56b('0x7'),_0xe56b('0x8'),_0xe56b('0x9'),_0xe56b('0xa'),_0xe56b('0xb'),_0xe56b('0xc'),'bandwidth',_0xe56b('0xd'),'infobip','intelepeer')},'accountSid':{'type':Sequelize[_0xe56b('0x4')]},'authId':{'type':Sequelize[_0xe56b('0x4')]},'authToken':{'type':Sequelize[_0xe56b('0x4')]},'smsMethod':{'type':Sequelize[_0xe56b('0x6')]('SI','TI','GP')},'username':{'type':Sequelize[_0xe56b('0x4')]},'password':{'type':Sequelize[_0xe56b('0x4')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0xe56b('0x4')]},'accountId':{'type':Sequelize[_0xe56b('0x4')]},'senderString':{'type':Sequelize[_0xe56b('0x4')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xe56b('0x4')]},'notificationTemplate':{'type':Sequelize[_0xe56b('0xe')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe56b('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe56b('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xe56b('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xe56b('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe56b('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe56b('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xe56b('0x4')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe56b('0x10')],'comment':_0xe56b('0x11')},'mandatoryDisposition':{'type':Sequelize[_0xe56b('0xf')],'defaultValue':![],'comment':_0xe56b('0x12'),'set':function(_0x501b54){if(!_0x501b54)this[_0xe56b('0x13')](_0xe56b('0x14'),null);this[_0xe56b('0x13')]('mandatoryDisposition',_0x501b54);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 788fc9c..cf288f5 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 _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 +var _0x7edc=['unshift','agent','waitForTheAssignedAgent','SmsQueue','queueId','queue','Start','startRouting','SmsAccount,\x20%s,\x20%s,\x20%s','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','\x0a','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','priority','getApplications','getInteractions','Contact','User','Owner','fullname','Tag','Tags','color','tag','to\x20is\x20mandatory','List','out','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','bandwidth','redif','error_code','DELIVERED_TO_GATEWAY','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','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/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./smsAccount.socket','jayson/promise','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','destroy','get','SmsAccounts','UserProfileResource','stack','name','send','index','Pause','map','SmsAccount','fieldName','key','model','keys','query','intersection','attributes','fields','length','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','params','rawAttributes','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','mandatoryDispositionPause','describe','addDisposition','Disposition','getDispositions','findOne','nolimit','order','SmsAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','hasOwnProperty','removeAnswers','notify','sms','SmsApplication','account','applications','orderBy','Applications','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','mobile','type','twilio','from','From','Body','messageId','MessageSid','sender','text','connectel','clicksend','message_id','Text','MessageUUID','infobip','results','csc','segmentedMessage','clickatell','fromNumber','replyMessageId','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','ListId','DESC','list','omit','Contacts','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','UserId'];(function(_0x42caf9,_0x9408f1){var _0x29b26e=function(_0x4daf0f){while(--_0x4daf0f){_0x42caf9['push'](_0x42caf9['shift']());}};_0x29b26e(++_0x9408f1);}(_0x7edc,0x12e));var _0xc7ed=function(_0x47623f,_0x148f3a){_0x47623f=_0x47623f-0x0;var _0x282ce8=_0x7edc[_0x47623f];return _0x282ce8;};'use strict';var emlformat=require(_0xc7ed('0x0'));var rimraf=require(_0xc7ed('0x1'));var zipdir=require(_0xc7ed('0x2'));var jsonpatch=require(_0xc7ed('0x3'));var rp=require(_0xc7ed('0x4'));var moment=require('moment');var BPromise=require(_0xc7ed('0x5'));var Mustache=require(_0xc7ed('0x6'));var util=require(_0xc7ed('0x7'));var path=require('path');var sox=require(_0xc7ed('0x8'));var csv=require(_0xc7ed('0x9'));var ejs=require(_0xc7ed('0xa'));var fs=require('fs');var fs_extra=require(_0xc7ed('0xb'));var _=require(_0xc7ed('0xc'));var squel=require(_0xc7ed('0xd'));var crypto=require(_0xc7ed('0xe'));var jsforce=require(_0xc7ed('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xc7ed('0x9'));var querystring=require(_0xc7ed('0x10'));var Papa=require(_0xc7ed('0x11'));var Redis=require(_0xc7ed('0x12'));var authService=require(_0xc7ed('0x13'));var qs=require(_0xc7ed('0x14'));var as=require(_0xc7ed('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xc7ed('0x16'));var config=require(_0xc7ed('0x17'));var licenseUtil=require(_0xc7ed('0x18'));var db=require('../../mysqldb')['db'];config[_0xc7ed('0x19')]=_[_0xc7ed('0x1a')](config[_0xc7ed('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xc7ed('0x1b'))(new Redis(config[_0xc7ed('0x19')]));require(_0xc7ed('0x1c'))['register'](socket);var jayson=require(_0xc7ed('0x1d'));var client=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x2e633b,_0x56ae62,_0x270ca8,_0x913926){return new BPromise(function(_0x41fccd,_0x2a2f99){var _0x58f684=_0x913926||client;return _0x58f684[_0xc7ed('0x1e')](_0x2e633b,_0x270ca8)[_0xc7ed('0x1f')](function(_0x140611){logger['info'](_0xc7ed('0x20'),_0x56ae62,_0xc7ed('0x21'));logger[_0xc7ed('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x56ae62,_0xc7ed('0x21'),JSON['stringify'](_0x140611));if(_0x140611[_0xc7ed('0x23')]){if(_0x140611[_0xc7ed('0x23')][_0xc7ed('0x24')]===0x1f4){logger[_0xc7ed('0x23')](_0xc7ed('0x20'),_0x56ae62,_0x140611[_0xc7ed('0x23')]['message']);return _0x2a2f99(_0x140611[_0xc7ed('0x23')][_0xc7ed('0x25')]);}logger[_0xc7ed('0x23')](_0xc7ed('0x20'),_0x56ae62,_0x140611[_0xc7ed('0x23')][_0xc7ed('0x25')]);return _0x41fccd(_0x140611[_0xc7ed('0x23')]['message']);}else{logger[_0xc7ed('0x26')](_0xc7ed('0x20'),_0x56ae62,_0xc7ed('0x21'));_0x41fccd(_0x140611[_0xc7ed('0x27')][_0xc7ed('0x25')]);}})[_0xc7ed('0x28')](function(_0x174049){logger['error'](_0xc7ed('0x20'),_0x56ae62,_0x174049);_0x2a2f99(_0x174049);});});}function respondWithStatusCode(_0x476656,_0x13168c){_0x13168c=_0x13168c||0xcc;return function(_0x28c0ad){if(_0x28c0ad){return _0x476656[_0xc7ed('0x29')](_0x13168c);}return _0x476656['status'](_0x13168c)[_0xc7ed('0x2a')]();};}function respondWithResult(_0x3429e0,_0xce12a8){_0xce12a8=_0xce12a8||0xc8;return function(_0x1d81fc){if(_0x1d81fc){return _0x3429e0[_0xc7ed('0x2b')](_0xce12a8)[_0xc7ed('0x2c')](_0x1d81fc);}};}function respondWithFilteredResult(_0x33794e,_0x3cf88e){return function(_0x319a39){if(_0x319a39){var _0x53e68d=typeof _0x3cf88e[_0xc7ed('0x2d')]==='undefined'&&typeof _0x3cf88e[_0xc7ed('0x2e')]===_0xc7ed('0x2f');var _0x430cfd=_0x319a39[_0xc7ed('0x30')];var _0x56596f=_0x53e68d?0x0:_0x3cf88e[_0xc7ed('0x2d')];var _0x2d2983=_0x53e68d?_0x319a39[_0xc7ed('0x30')]:_0x3cf88e[_0xc7ed('0x2d')]+_0x3cf88e[_0xc7ed('0x2e')];var _0x4b8044;if(_0x2d2983>=_0x430cfd){_0x2d2983=_0x430cfd;_0x4b8044=0xc8;}else{_0x4b8044=0xce;}_0x33794e[_0xc7ed('0x2b')](_0x4b8044);return _0x33794e[_0xc7ed('0x31')](_0xc7ed('0x32'),_0x56596f+'-'+_0x2d2983+'/'+_0x430cfd)['json'](_0x319a39);}return null;};}function patchUpdates(_0x73235f){return function(_0x55c99a){try{jsonpatch[_0xc7ed('0x33')](_0x55c99a,_0x73235f,!![]);}catch(_0x46922a){return BPromise['reject'](_0x46922a);}return _0x55c99a[_0xc7ed('0x34')]();};}function saveUpdates(_0x40fea3,_0x4537f3){return function(_0x338a3f){if(_0x338a3f){return _0x338a3f[_0xc7ed('0x35')](_0x40fea3)['then'](function(_0x5b2df9){return _0x5b2df9;});}return null;};}function removeEntity(_0xd1bb03,_0x16f527){return function(_0xb89796){if(_0xb89796){return _0xb89796[_0xc7ed('0x36')]()[_0xc7ed('0x1f')](function(){var _0x27957f=_0xb89796[_0xc7ed('0x37')]({'plain':!![]});var _0x33d66d=_0xc7ed('0x38');return db[_0xc7ed('0x39')]['destroy']({'where':{'type':_0x33d66d,'resourceId':_0x27957f['id']}})[_0xc7ed('0x1f')](function(){return _0xb89796;});})['then'](function(){_0xd1bb03[_0xc7ed('0x2b')](0xcc)[_0xc7ed('0x2a')]();});}};}function handleEntityNotFound(_0x495c03,_0x23a096){return function(_0x424547){if(!_0x424547){_0x495c03[_0xc7ed('0x29')](0x194);}return _0x424547;};}function handleError(_0x3985ee,_0x443acf){_0x443acf=_0x443acf||0x1f4;return function(_0x32c9d2){logger[_0xc7ed('0x23')](_0x32c9d2[_0xc7ed('0x3a')]);if(_0x32c9d2[_0xc7ed('0x3b')]){delete _0x32c9d2['name'];}_0x3985ee[_0xc7ed('0x2b')](_0x443acf)[_0xc7ed('0x3c')](_0x32c9d2);};}exports[_0xc7ed('0x3d')]=function(_0x411eb2,_0x3713a0){var _0x352eb2={'include':[{'model':db[_0xc7ed('0x3e')],'as':'mandatoryDispositionPause'}]},_0x5b4dfa={},_0x30b5d2={'count':0x0,'rows':[]};var _0x140471=_[_0xc7ed('0x3f')](db[_0xc7ed('0x40')]['rawAttributes'],function(_0x596039){return{'name':_0x596039[_0xc7ed('0x41')],'type':_0x596039['type'][_0xc7ed('0x42')]};});_0x5b4dfa[_0xc7ed('0x43')]=_[_0xc7ed('0x3f')](_0x140471,_0xc7ed('0x3b'));_0x5b4dfa['query']=_[_0xc7ed('0x44')](_0x411eb2[_0xc7ed('0x45')]);_0x5b4dfa['filters']=_[_0xc7ed('0x46')](_0x5b4dfa['model'],_0x5b4dfa[_0xc7ed('0x45')]);_0x352eb2[_0xc7ed('0x47')]=_[_0xc7ed('0x46')](_0x5b4dfa[_0xc7ed('0x43')],qs[_0xc7ed('0x48')](_0x411eb2['query'][_0xc7ed('0x48')]));_0x352eb2[_0xc7ed('0x47')]=_0x352eb2[_0xc7ed('0x47')][_0xc7ed('0x49')]?_0x352eb2['attributes']:_0x5b4dfa[_0xc7ed('0x43')];if(!_0x411eb2[_0xc7ed('0x45')]['hasOwnProperty']('nolimit')){_0x352eb2[_0xc7ed('0x2e')]=qs['limit'](_0x411eb2[_0xc7ed('0x45')][_0xc7ed('0x2e')]);_0x352eb2['offset']=qs[_0xc7ed('0x2d')](_0x411eb2['query'][_0xc7ed('0x2d')]);}_0x352eb2['order']=qs[_0xc7ed('0x4a')](_0x411eb2[_0xc7ed('0x45')][_0xc7ed('0x4a')]);_0x352eb2[_0xc7ed('0x4b')]=qs[_0xc7ed('0x4c')](_[_0xc7ed('0x4d')](_0x411eb2['query'],_0x5b4dfa[_0xc7ed('0x4c')]),_0x140471);if(_0x411eb2['query'][_0xc7ed('0x4e')]){_0x352eb2['where']=_[_0xc7ed('0x4f')](_0x352eb2[_0xc7ed('0x4b')],{'$or':_[_0xc7ed('0x3f')](_0x140471,function(_0x2fa028){if(_0x2fa028['type']!==_0xc7ed('0x50')){var _0x317802={};_0x317802[_0x2fa028['name']]={'$like':'%'+_0x411eb2[_0xc7ed('0x45')][_0xc7ed('0x4e')]+'%'};return _0x317802;}})});}_0x352eb2=_[_0xc7ed('0x4f')]({},_0x352eb2,_0x411eb2['options']);var _0x92edb={'where':_0x352eb2['where']};return db[_0xc7ed('0x40')][_0xc7ed('0x30')](_0x92edb)[_0xc7ed('0x1f')](function(_0x12f7b6){_0x30b5d2['count']=_0x12f7b6;if(_0x411eb2['query'][_0xc7ed('0x51')]){_0x352eb2[_0xc7ed('0x52')]=[{'all':!![]}];}return db[_0xc7ed('0x40')][_0xc7ed('0x53')](_0x352eb2);})[_0xc7ed('0x1f')](function(_0x48786f){_0x30b5d2[_0xc7ed('0x54')]=_0x48786f;return _0x30b5d2;})['then'](respondWithFilteredResult(_0x3713a0,_0x352eb2))[_0xc7ed('0x28')](handleError(_0x3713a0,null));};exports['show']=function(_0x53f48a,_0x27c4c9){var _0x548081={'raw':![],'where':{'id':_0x53f48a[_0xc7ed('0x55')]['id']},'include':[{'model':db[_0xc7ed('0x3e')],'as':'mandatoryDispositionPause'}]},_0x5ead7a={};_0x5ead7a[_0xc7ed('0x43')]=_[_0xc7ed('0x44')](db[_0xc7ed('0x40')][_0xc7ed('0x56')]);_0x5ead7a[_0xc7ed('0x45')]=_[_0xc7ed('0x44')](_0x53f48a[_0xc7ed('0x45')]);_0x5ead7a[_0xc7ed('0x4c')]=_[_0xc7ed('0x46')](_0x5ead7a['model'],_0x5ead7a[_0xc7ed('0x45')]);_0x548081[_0xc7ed('0x47')]=_[_0xc7ed('0x46')](_0x5ead7a[_0xc7ed('0x43')],qs[_0xc7ed('0x48')](_0x53f48a[_0xc7ed('0x45')][_0xc7ed('0x48')]));_0x548081[_0xc7ed('0x47')]=_0x548081[_0xc7ed('0x47')][_0xc7ed('0x49')]?_0x548081['attributes']:_0x5ead7a[_0xc7ed('0x43')];if(_0x53f48a[_0xc7ed('0x45')]['includeAll']){_0x548081[_0xc7ed('0x52')]=[{'all':!![]}];}_0x548081=_[_0xc7ed('0x4f')]({},_0x548081,_0x53f48a[_0xc7ed('0x57')]);return db[_0xc7ed('0x40')][_0xc7ed('0x58')](_0x548081)[_0xc7ed('0x1f')](handleEntityNotFound(_0x27c4c9,null))[_0xc7ed('0x1f')](respondWithResult(_0x27c4c9,null))[_0xc7ed('0x28')](handleError(_0x27c4c9,null));};exports[_0xc7ed('0x59')]=function(_0x5464db,_0x5f0bc2){return db[_0xc7ed('0x40')][_0xc7ed('0x59')](_0x5464db[_0xc7ed('0x5a')],{})[_0xc7ed('0x1f')](function(_0x217486){var _0x2cd2e5=_0x5464db['user'][_0xc7ed('0x37')]({'plain':!![]});if(!_0x2cd2e5)throw new Error(_0xc7ed('0x5b'));if(_0x2cd2e5[_0xc7ed('0x5c')]===_0xc7ed('0x5d')){var _0x49663c=_0x217486[_0xc7ed('0x37')]({'plain':!![]});var _0x5f38e9=_0xc7ed('0x38');return db[_0xc7ed('0x5e')][_0xc7ed('0x58')]({'where':{'name':_0x5f38e9,'userProfileId':_0x2cd2e5[_0xc7ed('0x5f')]},'raw':!![]})['then'](function(_0x6bc936){if(_0x6bc936&&_0x6bc936[_0xc7ed('0x60')]===0x0){return db[_0xc7ed('0x39')][_0xc7ed('0x59')]({'name':_0x49663c['name'],'resourceId':_0x49663c['id'],'type':_0x6bc936[_0xc7ed('0x3b')],'sectionId':_0x6bc936['id']},{})[_0xc7ed('0x1f')](function(){return _0x217486;});}else{return _0x217486;}})['catch'](function(_0x33f04f){logger[_0xc7ed('0x23')](_0xc7ed('0x61'),_0x33f04f);throw _0x33f04f;});}return _0x217486;})[_0xc7ed('0x1f')](respondWithResult(_0x5f0bc2,0xc9))[_0xc7ed('0x28')](handleError(_0x5f0bc2,null));};exports['update']=function(_0x3b96df,_0x4d3a58){if(_0x3b96df['body']['id']){delete _0x3b96df[_0xc7ed('0x5a')]['id'];}return db[_0xc7ed('0x40')][_0xc7ed('0x58')]({'where':{'id':_0x3b96df[_0xc7ed('0x55')]['id']},'include':[{'model':db[_0xc7ed('0x3e')],'as':_0xc7ed('0x62')}]})[_0xc7ed('0x1f')](handleEntityNotFound(_0x4d3a58,null))[_0xc7ed('0x1f')](saveUpdates(_0x3b96df[_0xc7ed('0x5a')],null))[_0xc7ed('0x1f')](respondWithResult(_0x4d3a58,null))[_0xc7ed('0x28')](handleError(_0x4d3a58,null));};exports['destroy']=function(_0x177937,_0x2b639a){return db['SmsAccount'][_0xc7ed('0x58')]({'where':{'id':_0x177937[_0xc7ed('0x55')]['id']}})[_0xc7ed('0x1f')](handleEntityNotFound(_0x2b639a,null))[_0xc7ed('0x1f')](removeEntity(_0x2b639a,null))['catch'](handleError(_0x2b639a,null));};exports['describe']=function(_0x22d280,_0x402a7f){return db[_0xc7ed('0x40')][_0xc7ed('0x63')]()[_0xc7ed('0x1f')](respondWithResult(_0x402a7f,null))[_0xc7ed('0x28')](handleError(_0x402a7f,null));};exports[_0xc7ed('0x64')]=function(_0x4d8f13,_0x49b9c4,_0x541088){if(_0x4d8f13[_0xc7ed('0x5a')]['id']){delete _0x4d8f13[_0xc7ed('0x5a')]['id'];}return db[_0xc7ed('0x40')][_0xc7ed('0x58')]({'where':{'id':_0x4d8f13[_0xc7ed('0x55')]['id']}})[_0xc7ed('0x1f')](handleEntityNotFound(_0x49b9c4,null))[_0xc7ed('0x1f')](function(_0x322672){if(_0x322672){_0x4d8f13[_0xc7ed('0x5a')]['SmsAccountId']=_0x322672['id'];return db[_0xc7ed('0x65')][_0xc7ed('0x59')](_0x4d8f13[_0xc7ed('0x5a')]);}})['then'](respondWithResult(_0x49b9c4,null))['catch'](handleError(_0x49b9c4,null));};exports[_0xc7ed('0x66')]=function(_0x2c6a73,_0xac9656,_0x1832bb){var _0x461193={'raw':![],'where':{}};var _0x1e80db={};var _0x2038cb={'count':0x0,'rows':[]};return db[_0xc7ed('0x40')][_0xc7ed('0x67')]({'where':{'id':_0x2c6a73[_0xc7ed('0x55')]['id']}})[_0xc7ed('0x1f')](handleEntityNotFound(_0xac9656,null))[_0xc7ed('0x1f')](function(_0x5d5177){if(_0x5d5177){_0x1e80db[_0xc7ed('0x43')]=_[_0xc7ed('0x44')](db[_0xc7ed('0x65')][_0xc7ed('0x56')]);_0x1e80db[_0xc7ed('0x45')]=_[_0xc7ed('0x44')](_0x2c6a73[_0xc7ed('0x45')]);_0x1e80db[_0xc7ed('0x4c')]=_[_0xc7ed('0x46')](_0x1e80db['model'],_0x1e80db['query']);_0x461193[_0xc7ed('0x47')]=_[_0xc7ed('0x46')](_0x1e80db['model'],qs[_0xc7ed('0x48')](_0x2c6a73[_0xc7ed('0x45')][_0xc7ed('0x48')]));_0x461193['attributes']=_0x461193[_0xc7ed('0x47')]['length']?_0x461193['attributes']:_0x1e80db[_0xc7ed('0x43')];if(!_0x2c6a73[_0xc7ed('0x45')]['hasOwnProperty'](_0xc7ed('0x68'))){_0x461193['limit']=qs[_0xc7ed('0x2e')](_0x2c6a73[_0xc7ed('0x45')]['limit']);_0x461193[_0xc7ed('0x2d')]=qs[_0xc7ed('0x2d')](_0x2c6a73[_0xc7ed('0x45')][_0xc7ed('0x2d')]);}_0x461193[_0xc7ed('0x69')]=qs[_0xc7ed('0x4a')](_0x2c6a73[_0xc7ed('0x45')][_0xc7ed('0x4a')]);_0x461193[_0xc7ed('0x4b')]=qs[_0xc7ed('0x4c')](_[_0xc7ed('0x4d')](_0x2c6a73['query'],_0x1e80db[_0xc7ed('0x4c')]));_0x461193['where'][_0xc7ed('0x6a')]=_0x5d5177['id'];if(_0x2c6a73['query'][_0xc7ed('0x4e')]){_0x461193['where']=_[_0xc7ed('0x4f')](_0x461193[_0xc7ed('0x4b')],{'$or':_[_0xc7ed('0x3f')](_0x461193[_0xc7ed('0x47')],function(_0x5b9c74){var _0x21ef69={};_0x21ef69[_0x5b9c74]={'$like':'%'+_0x2c6a73['query']['filter']+'%'};return _0x21ef69;})});}_0x461193=_['merge']({},_0x461193,_0x2c6a73[_0xc7ed('0x57')]);return db[_0xc7ed('0x65')]['count']({'where':_0x461193['where']})[_0xc7ed('0x1f')](function(_0xb8e81b){_0x2038cb[_0xc7ed('0x30')]=_0xb8e81b;if(_0x2c6a73[_0xc7ed('0x45')][_0xc7ed('0x51')]){_0x461193[_0xc7ed('0x52')]=[{'all':!![]}];}return db[_0xc7ed('0x65')][_0xc7ed('0x53')](_0x461193);})[_0xc7ed('0x1f')](function(_0x43c785){_0x2038cb[_0xc7ed('0x54')]=_0x43c785;return _0x2038cb;});}})[_0xc7ed('0x1f')](respondWithFilteredResult(_0xac9656,_0x461193))[_0xc7ed('0x28')](handleError(_0xac9656,null));};exports[_0xc7ed('0x6b')]=function(_0x1d30a8,_0x362e9e,_0x2f462d){return db[_0xc7ed('0x40')][_0xc7ed('0x58')]({'where':{'id':_0x1d30a8[_0xc7ed('0x55')]['id']}})['then'](handleEntityNotFound(_0x362e9e,null))['then'](function(_0x2767e9){if(_0x2767e9){return _0x2767e9[_0xc7ed('0x6b')](_0x1d30a8[_0xc7ed('0x45')][_0xc7ed('0x6c')]);}})[_0xc7ed('0x1f')](respondWithStatusCode(_0x362e9e,null))[_0xc7ed('0x28')](handleError(_0x362e9e,null));};exports[_0xc7ed('0x6d')]=function(_0x2e146e,_0x5a5ed2,_0x30302b){if(_0x2e146e[_0xc7ed('0x5a')]['id']){delete _0x2e146e[_0xc7ed('0x5a')]['id'];}return db[_0xc7ed('0x40')]['find']({'where':{'id':_0x2e146e[_0xc7ed('0x55')]['id']}})[_0xc7ed('0x1f')](handleEntityNotFound(_0x5a5ed2,null))[_0xc7ed('0x1f')](function(_0x4bc773){if(_0x4bc773){_0x2e146e[_0xc7ed('0x5a')][_0xc7ed('0x6a')]=_0x4bc773['id'];return db[_0xc7ed('0x6e')][_0xc7ed('0x59')](_0x2e146e[_0xc7ed('0x5a')]);}})['then'](respondWithResult(_0x5a5ed2,null))[_0xc7ed('0x28')](handleError(_0x5a5ed2,null));};exports[_0xc7ed('0x6f')]=function(_0x333f11,_0x276fce,_0x1a2e3b){var _0x3fb9a0={'raw':![],'where':{}};var _0x2fd174={};var _0x40fd7b={'count':0x0,'rows':[]};return db[_0xc7ed('0x40')][_0xc7ed('0x67')]({'where':{'id':_0x333f11[_0xc7ed('0x55')]['id']}})[_0xc7ed('0x1f')](handleEntityNotFound(_0x276fce,null))[_0xc7ed('0x1f')](function(_0x406fd6){if(_0x406fd6){_0x2fd174[_0xc7ed('0x43')]=_['keys'](db[_0xc7ed('0x6e')][_0xc7ed('0x56')]);_0x2fd174[_0xc7ed('0x45')]=_[_0xc7ed('0x44')](_0x333f11['query']);_0x2fd174['filters']=_['intersection'](_0x2fd174[_0xc7ed('0x43')],_0x2fd174['query']);_0x3fb9a0[_0xc7ed('0x47')]=_[_0xc7ed('0x46')](_0x2fd174[_0xc7ed('0x43')],qs['fields'](_0x333f11[_0xc7ed('0x45')][_0xc7ed('0x48')]));_0x3fb9a0[_0xc7ed('0x47')]=_0x3fb9a0['attributes'][_0xc7ed('0x49')]?_0x3fb9a0[_0xc7ed('0x47')]:_0x2fd174[_0xc7ed('0x43')];if(!_0x333f11[_0xc7ed('0x45')][_0xc7ed('0x70')]('nolimit')){_0x3fb9a0[_0xc7ed('0x2e')]=qs[_0xc7ed('0x2e')](_0x333f11[_0xc7ed('0x45')][_0xc7ed('0x2e')]);_0x3fb9a0[_0xc7ed('0x2d')]=qs[_0xc7ed('0x2d')](_0x333f11[_0xc7ed('0x45')]['offset']);}_0x3fb9a0[_0xc7ed('0x69')]=qs['sort'](_0x333f11[_0xc7ed('0x45')][_0xc7ed('0x4a')]);_0x3fb9a0['where']=qs[_0xc7ed('0x4c')](_[_0xc7ed('0x4d')](_0x333f11[_0xc7ed('0x45')],_0x2fd174[_0xc7ed('0x4c')]));_0x3fb9a0[_0xc7ed('0x4b')][_0xc7ed('0x6a')]=_0x406fd6['id'];if(_0x333f11['query']['filter']){_0x3fb9a0[_0xc7ed('0x4b')]=_[_0xc7ed('0x4f')](_0x3fb9a0[_0xc7ed('0x4b')],{'$or':_['map'](_0x3fb9a0[_0xc7ed('0x47')],function(_0x145577){var _0x24db86={};_0x24db86[_0x145577]={'$like':'%'+_0x333f11[_0xc7ed('0x45')][_0xc7ed('0x4e')]+'%'};return _0x24db86;})});}_0x3fb9a0=_['merge']({},_0x3fb9a0,_0x333f11[_0xc7ed('0x57')]);return db[_0xc7ed('0x6e')][_0xc7ed('0x30')]({'where':_0x3fb9a0[_0xc7ed('0x4b')]})[_0xc7ed('0x1f')](function(_0xbfd2ef){_0x40fd7b[_0xc7ed('0x30')]=_0xbfd2ef;if(_0x333f11['query'][_0xc7ed('0x51')]){_0x3fb9a0[_0xc7ed('0x52')]=[{'all':!![]}];}return db[_0xc7ed('0x6e')]['findAll'](_0x3fb9a0);})[_0xc7ed('0x1f')](function(_0x1e6a53){_0x40fd7b[_0xc7ed('0x54')]=_0x1e6a53;return _0x40fd7b;});}})['then'](respondWithFilteredResult(_0x276fce,_0x3fb9a0))[_0xc7ed('0x28')](handleError(_0x276fce,null));};exports[_0xc7ed('0x71')]=function(_0x4851a2,_0x2333c8,_0x137561){return db['SmsAccount'][_0xc7ed('0x58')]({'where':{'id':_0x4851a2[_0xc7ed('0x55')]['id']}})[_0xc7ed('0x1f')](handleEntityNotFound(_0x2333c8,null))[_0xc7ed('0x1f')](function(_0x360041){if(_0x360041){return _0x360041[_0xc7ed('0x71')](_0x4851a2[_0xc7ed('0x45')][_0xc7ed('0x6c')]);}})[_0xc7ed('0x1f')](respondWithStatusCode(_0x2333c8,null))[_0xc7ed('0x28')](handleError(_0x2333c8,null));};exports[_0xc7ed('0x72')]=function(_0x52684b,_0xae5ff8,_0x1c6ebd){var _0x2a3eb2={'channel':_0xc7ed('0x73')};var _0x52f4ff=[];var _0x78dd5=[];var _0x51d236={};return db['SmsAccount'][_0xc7ed('0x58')]({'where':{'id':_0x52684b[_0xc7ed('0x55')]['id']},'include':[{'model':db[_0xc7ed('0x74')],'as':'Applications'}]})['then'](handleEntityNotFound(_0xae5ff8,null))['then'](function(_0x38935c){_0x2a3eb2[_0xc7ed('0x75')]=_0x38935c;_0x2a3eb2[_0xc7ed('0x76')]=_[_0xc7ed('0x77')](_0x38935c[_0xc7ed('0x78')],['priority'],[_0xc7ed('0x79')]);if(_0x2a3eb2[_0xc7ed('0x75')][_0xc7ed('0x78')]){delete _0x2a3eb2['account']['Applications'];}return db[_0xc7ed('0x7a')]['describe']();})[_0xc7ed('0x1f')](function(_0x469e03){if(!_0x469e03){throw new db[(_0xc7ed('0x7b'))][(_0xc7ed('0x7c'))](_0xc7ed('0x7d'));}_0x52f4ff=_[_0xc7ed('0x7e')](_[_0xc7ed('0x44')](_0x469e03),['createdAt','updatedAt']);_0x78dd5=_[_0xc7ed('0x7e')](_['keys'](_0x469e03),[_0xc7ed('0x7f'),_0xc7ed('0x80'),_0xc7ed('0x81'),'ListId']);_0x2a3eb2[_0xc7ed('0x5a')]={'mapKey':_0xc7ed('0x82')};if(_0x2a3eb2['account']['type']){switch(_0x2a3eb2[_0xc7ed('0x75')][_0xc7ed('0x83')]){case _0xc7ed('0x84'):_0x2a3eb2[_0xc7ed('0x5a')][_0xc7ed('0x85')]=_0x52684b[_0xc7ed('0x5a')][_0xc7ed('0x86')];_0x2a3eb2[_0xc7ed('0x5a')][_0xc7ed('0x5a')]=_0x52684b[_0xc7ed('0x5a')][_0xc7ed('0x87')];_0x2a3eb2[_0xc7ed('0x5a')][_0xc7ed('0x88')]=_0x52684b[_0xc7ed('0x5a')][_0xc7ed('0x89')];break;case'skebby':_0x2a3eb2[_0xc7ed('0x5a')][_0xc7ed('0x85')]='+'+_0x52684b[_0xc7ed('0x5a')][_0xc7ed('0x8a')];_0x2a3eb2[_0xc7ed('0x5a')][_0xc7ed('0x5a')]=_0x52684b[_0xc7ed('0x5a')][_0xc7ed('0x8b')];break;case _0xc7ed('0x8c'):_0x2a3eb2['body'][_0xc7ed('0x85')]=_0x52684b[_0xc7ed('0x5a')][_0xc7ed('0x85')];_0x2a3eb2['body'][_0xc7ed('0x5a')]=_0x52684b[_0xc7ed('0x5a')][_0xc7ed('0x25')];break;case _0xc7ed('0x8d'):_0x2a3eb2['body'][_0xc7ed('0x85')]=_0x52684b[_0xc7ed('0x5a')][_0xc7ed('0x85')];_0x2a3eb2[_0xc7ed('0x5a')][_0xc7ed('0x5a')]=_0x52684b[_0xc7ed('0x5a')][_0xc7ed('0x5a')];_0x2a3eb2[_0xc7ed('0x5a')][_0xc7ed('0x88')]=_0x52684b['body'][_0xc7ed('0x8e')];break;case'plivo':_0x2a3eb2[_0xc7ed('0x5a')][_0xc7ed('0x85')]=_0x52684b[_0xc7ed('0x5a')][_0xc7ed('0x86')];_0x2a3eb2['body'][_0xc7ed('0x5a')]=_0x52684b[_0xc7ed('0x5a')][_0xc7ed('0x8f')];_0x2a3eb2['body'][_0xc7ed('0x88')]=_0x52684b[_0xc7ed('0x5a')][_0xc7ed('0x90')];break;case _0xc7ed('0x91'):_0x2a3eb2[_0xc7ed('0x5a')][_0xc7ed('0x85')]='+'+_0x52684b[_0xc7ed('0x5a')][_0xc7ed('0x92')][0x0][_0xc7ed('0x85')];_0x2a3eb2['body'][_0xc7ed('0x5a')]=_0x52684b[_0xc7ed('0x5a')]['results'][0x0][_0xc7ed('0x8b')];_0x2a3eb2['body'][_0xc7ed('0x88')]=_0x52684b[_0xc7ed('0x5a')][_0xc7ed('0x92')][0x0][_0xc7ed('0x88')];break;case _0xc7ed('0x93'):_0x2a3eb2[_0xc7ed('0x5a')]['from']=_0x52684b[_0xc7ed('0x5a')]['originatingAddress'];_0x2a3eb2[_0xc7ed('0x5a')][_0xc7ed('0x5a')]=_0x52684b[_0xc7ed('0x5a')][_0xc7ed('0x94')][_0xc7ed('0x25')];break;case _0xc7ed('0x95'):_0x2a3eb2['body'][_0xc7ed('0x85')]=_0x52684b['body'][_0xc7ed('0x96')];_0x2a3eb2['body']['body']=_0x52684b[_0xc7ed('0x5a')]['text'];_0x2a3eb2[_0xc7ed('0x5a')][_0xc7ed('0x88')]=_0x52684b['body'][_0xc7ed('0x97')];break;case'bandwidth':_0x2a3eb2['body']['messageId']=_0x52684b[_0xc7ed('0x5a')][0x0][_0xc7ed('0x25')]['id'];_0x2a3eb2['body']['from']=_0x52684b[_0xc7ed('0x5a')][0x0][_0xc7ed('0x25')][_0xc7ed('0x85')];_0x2a3eb2[_0xc7ed('0x5a')][_0xc7ed('0x5a')]=_0x52684b['body'][0x0][_0xc7ed('0x25')]['text'];break;case _0xc7ed('0x98'):_0x2a3eb2[_0xc7ed('0x5a')][_0xc7ed('0x85')]=_0x52684b[_0xc7ed('0x5a')][_0xc7ed('0x85')];_0x2a3eb2[_0xc7ed('0x5a')]['body']=_0x52684b[_0xc7ed('0x5a')][_0xc7ed('0x25')];_0x2a3eb2[_0xc7ed('0x5a')][_0xc7ed('0x88')]=_0x52684b[_0xc7ed('0x5a')][_0xc7ed('0x99')];break;}}if(_0x2a3eb2[_0xc7ed('0x5a')]['id']){delete _0x2a3eb2[_0xc7ed('0x5a')]['id'];}if(_[_0xc7ed('0x9a')](_0x2a3eb2[_0xc7ed('0x5a')][_0xc7ed('0x85')])){throw new db[(_0xc7ed('0x7b'))][(_0xc7ed('0x7c'))](_0xc7ed('0x9b'));}if(_['isNil'](_0x2a3eb2['body'][_0xc7ed('0x5a')])||_0x2a3eb2[_0xc7ed('0x5a')][_0xc7ed('0x5a')]===''){throw new db[(_0xc7ed('0x7b'))][(_0xc7ed('0x7c'))](_0xc7ed('0x9c'));}if(_['isNil'](_0x2a3eb2[_0xc7ed('0x5a')][_0xc7ed('0x9d')])){throw new db[(_0xc7ed('0x7b'))][(_0xc7ed('0x7c'))](_0xc7ed('0x9e')+_0x78dd5);}if(!_['includes'](_0x78dd5,_0x2a3eb2[_0xc7ed('0x5a')][_0xc7ed('0x9d')])){throw new db['Sequelize'][(_0xc7ed('0x7c'))](_0xc7ed('0x9f')+_0x78dd5);}_0x51d236[_0x2a3eb2[_0xc7ed('0x5a')][_0xc7ed('0x9d')]]=_0x2a3eb2[_0xc7ed('0x5a')][_0xc7ed('0x85')];return db[_0xc7ed('0xa0')][_0xc7ed('0x58')]({'where':{'id':_0x2a3eb2[_0xc7ed('0x75')][_0xc7ed('0xa1')]},'include':[{'model':db[_0xc7ed('0x7a')],'as':'Contacts','where':_0x51d236,'limit':0x1,'order':[[_0xc7ed('0x80'),_0xc7ed('0xa2')]]}]});})['then'](handleEntityNotFound(_0xae5ff8,null))[_0xc7ed('0x1f')](function(_0x4b7382){if(_0x4b7382){_0x2a3eb2[_0xc7ed('0xa3')]=_[_0xc7ed('0xa4')](_0x4b7382,[_0xc7ed('0xa5')]);if(_0x4b7382[_0xc7ed('0xa5')][_0xc7ed('0x49')]){return _0x4b7382[_0xc7ed('0xa5')][0x0];}var _0x31d836=_[_0xc7ed('0x1a')](_0x2a3eb2[_0xc7ed('0x5a')],{'firstName':_0x2a3eb2[_0xc7ed('0x5a')]['from'],'ListId':_0x4b7382['id']});_0x31d836[_0x2a3eb2[_0xc7ed('0x5a')][_0xc7ed('0x9d')]]=_0x2a3eb2[_0xc7ed('0x5a')][_0xc7ed('0x85')];return db[_0xc7ed('0x7a')][_0xc7ed('0x59')](_0x31d836,{'fields':_0x52f4ff,'raw':!![]});}})['then'](handleEntityNotFound(_0xae5ff8,null))[_0xc7ed('0x1f')](function(_0x197686){if(_0x197686){_0x2a3eb2['contact']=_0x197686;var _0x5b8c22={'ContactId':_0x197686['id'],'phone':_0x2a3eb2[_0xc7ed('0x5a')][_0xc7ed('0x85')],'SmsAccountId':_0x52684b[_0xc7ed('0x55')]['id']};var _0x3baee2={'ContactId':_0x197686['id'],'SmsAccountId':_0x52684b[_0xc7ed('0x55')]['id'],'closed':![]};return db['SmsInteraction'][_0xc7ed('0x58')]({'where':_0x3baee2})[_0xc7ed('0x1f')](function(_0xffafd8){if(_0xffafd8){return[_0xffafd8,![]];}return db[_0xc7ed('0xa6')][_0xc7ed('0x59')](_0x5b8c22)['then'](function(_0x621c0d){return[_0x621c0d,!![]];});});}})[_0xc7ed('0xa7')](function(_0x2052c8,_0x214558){_0x2a3eb2[_0xc7ed('0xa8')]=_0x2052c8['get']({'plain':!![]});_0x2a3eb2[_0xc7ed('0xa8')][_0xc7ed('0xa9')]=![];if(_0x214558){if(_0x2a3eb2['account'][_0xc7ed('0xaa')]){_0x2a3eb2['applications'][_0xc7ed('0xab')]({'id':0x0,'priority':_0x2a3eb2[_0xc7ed('0x76')][_0xc7ed('0x49')]+0x1,'app':_0xc7ed('0xac'),'appdata':_0xc7ed('0xad'),'interval':_0xc7ed('0xae')});}_0x2a3eb2[_0xc7ed('0xa8')][_0xc7ed('0xa9')]=!![];}return db[_0xc7ed('0xaf')][_0xc7ed('0x59')]({'phone':_0x2a3eb2['body']['from'],'messageId':_0x2a3eb2[_0xc7ed('0x5a')][_0xc7ed('0x88')],'body':_0x2a3eb2[_0xc7ed('0x5a')]['body'],'SmsAccountId':_0x52684b[_0xc7ed('0x55')]['id'],'SmsInteractionId':_0x2052c8['id'],'direction':'in','ContactId':_0x2052c8[_0xc7ed('0xb0')],'AttachmentId':_0x2a3eb2['body']['AttachmentId']});})['then'](function(_0x5d690c){_0x2a3eb2[_0xc7ed('0x25')]=_0x5d690c;if(!_0x2a3eb2['interaction'][_0xc7ed('0xb1')])return;return db['User']['find']({'attributes':['id',_0xc7ed('0x3b')],'where':{'id':_0x2a3eb2[_0xc7ed('0xa8')]['UserId']}});})[_0xc7ed('0x1f')](function(_0x2a137f){if(_0x2a137f){_0x2a3eb2['applications'][_0xc7ed('0xb2')]({'id':0x0,'priority':0x0,'app':_0xc7ed('0xb3'),'appdata':_0x2a137f[_0xc7ed('0x3b')]+','+(_0x2a3eb2[_0xc7ed('0x75')][_0xc7ed('0xb4')]||0xa),'interval':_0xc7ed('0xae')});}if(!_0x2a3eb2[_0xc7ed('0xa8')]['queueId'])return;return db[_0xc7ed('0xb5')][_0xc7ed('0x58')]({'attributes':['id',_0xc7ed('0x3b')],'where':{'id':_0x2a3eb2[_0xc7ed('0xa8')][_0xc7ed('0xb6')]}});})[_0xc7ed('0x1f')](function(_0x269254){if(_0x269254){_0x2a3eb2[_0xc7ed('0x76')][_0xc7ed('0xb2')]({'id':0x0,'priority':0x1,'app':_0xc7ed('0xb7'),'appdata':_0x269254['name']+','+(_0x2a3eb2[_0xc7ed('0x75')]['waitForTheAssignedQueue']||0x12c),'interval':_0xc7ed('0xae')});}return respondWithRpcPromise(_0xc7ed('0xb8'),_0xc7ed('0xb9'),_0x2a3eb2);})[_0xc7ed('0x1f')](function(_0x2fd4d1){if(_0x2fd4d1){var _0x1fff0b=0xc8;var _0x16dbd5='receiveMessage';logger['info'](_0xc7ed('0xba'),_0x16dbd5,_0x1fff0b,'entity\x20found');logger[_0xc7ed('0x22')](_0xc7ed('0xbb'),_0x16dbd5,_0x1fff0b,'entity\x20found',JSON[_0xc7ed('0xbc')](_0x2fd4d1));if(_0x2a3eb2['account']['type']===_0xc7ed('0x84')){return _0xae5ff8[_0xc7ed('0x2b')](_0x1fff0b)['set'](_0xc7ed('0xbd'),'text/xml')[_0xc7ed('0x3c')](_0xc7ed('0xbe'));}else{return _0xae5ff8['status'](_0x1fff0b)[_0xc7ed('0x2c')](_0x2fd4d1);}}})[_0xc7ed('0x28')](handleError(_0xae5ff8,null));};exports[_0xc7ed('0xbf')]=function(_0x11872c,_0x5987a3){var _0x428f37=_0x11872c[_0xc7ed('0x55')]['id'];var _0x3c5979=_0x11872c[_0xc7ed('0x5a')];var _0x695ceb=0xc8;var _0x5ccfd5=null;return db[_0xc7ed('0xc0')]['transaction']({'isolationLevel':db[_0xc7ed('0xc0')][_0xc7ed('0xc1')][_0xc7ed('0xc2')][_0xc7ed('0xc3')]},function(_0x107d0f){return db[_0xc7ed('0x40')]['findOne']({'where':{'id':_0x428f37},'transaction':_0x107d0f})['then'](function(_0x2ea4fb){if(_0x2ea4fb){return db[_0xc7ed('0x74')]['destroy']({'where':{'SmsAccountId':_0x428f37},'transaction':_0x107d0f})[_0xc7ed('0x1f')](function(){var _0x420892=_[_0xc7ed('0x3f')](_0x3c5979,function(_0x4488dd){_0x4488dd[_0xc7ed('0x6a')]=_0x428f37;return _0x4488dd;});return db[_0xc7ed('0x74')][_0xc7ed('0xc4')](_0x420892,{'transaction':_0x107d0f});});}else{_0x695ceb=0x194;_0x5ccfd5=[];}});})[_0xc7ed('0x1f')](function(){if(_0x695ceb!==0x194){return db['SmsApplication'][_0xc7ed('0xc5')]({'where':{'SmsAccountId':_0x428f37},'order':_0xc7ed('0xc6')})['then'](function(_0x12e83b){_0x5ccfd5=_0x12e83b;});}})[_0xc7ed('0x28')](function(_0x4a6524){_0x695ceb=0x1f4;logger['error'](_0x4a6524['stack']);if(_0x4a6524[_0xc7ed('0x3b')]){delete _0x4a6524[_0xc7ed('0x3b')];}_0x5ccfd5=_0x4a6524;})['finally'](function(){if(_0x5ccfd5===null){_0x5987a3['sendStatus'](_0x695ceb);}else{if(_0x695ceb===0x1f4){_0x5987a3['status'](_0x695ceb)['send'](_0x5ccfd5);}else{_0x5987a3[_0xc7ed('0x2b')](_0x695ceb)['json'](_0x5ccfd5);}}});};exports[_0xc7ed('0xc7')]=function(_0x59312d,_0x4f2c69,_0x378991){var _0x10251b={};var _0x49097b={};var _0x7806f1;var _0x66b408;return db[_0xc7ed('0x40')][_0xc7ed('0x67')]({'where':{'id':_0x59312d[_0xc7ed('0x55')]['id']}})['then'](handleEntityNotFound(_0x4f2c69,null))[_0xc7ed('0x1f')](function(_0x2b3e44){if(_0x2b3e44){_0x7806f1=_0x2b3e44;_0x49097b[_0xc7ed('0x43')]=_[_0xc7ed('0x44')](db[_0xc7ed('0x74')]['rawAttributes']);_0x49097b[_0xc7ed('0x45')]=_['keys'](_0x59312d[_0xc7ed('0x45')]);_0x49097b[_0xc7ed('0x4c')]=_[_0xc7ed('0x46')](_0x49097b[_0xc7ed('0x43')],_0x49097b['query']);_0x10251b[_0xc7ed('0x47')]=_[_0xc7ed('0x46')](_0x49097b['model'],qs[_0xc7ed('0x48')](_0x59312d[_0xc7ed('0x45')][_0xc7ed('0x48')]));_0x10251b[_0xc7ed('0x47')]=_0x10251b[_0xc7ed('0x47')]['length']?_0x10251b['attributes']:_0x49097b['model'];_0x10251b['order']=qs[_0xc7ed('0x4a')](_0x59312d[_0xc7ed('0x45')]['sort']);_0x10251b[_0xc7ed('0x4b')]=qs[_0xc7ed('0x4c')](_[_0xc7ed('0x4d')](_0x59312d['query'],_0x49097b['filters']));if(_0x59312d['query'][_0xc7ed('0x4e')]){_0x10251b[_0xc7ed('0x4b')]=_['merge'](_0x10251b[_0xc7ed('0x4b')],{'$or':_['map'](_0x10251b[_0xc7ed('0x47')],function(_0x4bb18b){var _0x196d05={};_0x196d05[_0x4bb18b]={'$like':'%'+_0x59312d[_0xc7ed('0x45')][_0xc7ed('0x4e')]+'%'};return _0x196d05;})});}_0x10251b=_['merge']({},_0x10251b,_0x59312d[_0xc7ed('0x57')]);return _0x7806f1[_0xc7ed('0xc7')](_0x10251b);}})[_0xc7ed('0x1f')](function(_0x2ad68d){if(_0x2ad68d){_0x66b408=_0x2ad68d[_0xc7ed('0x49')];if(!_0x59312d[_0xc7ed('0x45')][_0xc7ed('0x70')](_0xc7ed('0x68'))){_0x10251b[_0xc7ed('0x2e')]=qs['limit'](_0x59312d[_0xc7ed('0x45')]['limit']);_0x10251b[_0xc7ed('0x2d')]=qs['offset'](_0x59312d[_0xc7ed('0x45')][_0xc7ed('0x2d')]);}return _0x7806f1[_0xc7ed('0xc7')](_0x10251b);}})[_0xc7ed('0x1f')](function(_0x34ad66){if(_0x34ad66){return _0x34ad66?{'count':_0x66b408,'rows':_0x34ad66}:null;}})[_0xc7ed('0x1f')](respondWithResult(_0x4f2c69,null))['catch'](handleError(_0x4f2c69,null));};exports[_0xc7ed('0xc8')]=function(_0xf93621,_0x10d25d,_0x1ddbf3){var _0x120c51={'raw':![],'where':{}};var _0x460e2d={};var _0x4263d8={'count':0x0,'rows':[]};return db['SmsAccount'][_0xc7ed('0x67')]({'where':{'id':_0xf93621[_0xc7ed('0x55')]['id']}})[_0xc7ed('0x1f')](handleEntityNotFound(_0x10d25d,null))[_0xc7ed('0x1f')](function(_0x26a03f){if(_0x26a03f){_0x460e2d[_0xc7ed('0x43')]=_['keys'](db[_0xc7ed('0xa6')][_0xc7ed('0x56')]);_0x460e2d[_0xc7ed('0x45')]=_['keys'](_0xf93621[_0xc7ed('0x45')]);_0x460e2d[_0xc7ed('0x4c')]=_[_0xc7ed('0x46')](_0x460e2d['model'],_0x460e2d[_0xc7ed('0x45')]);_0x120c51[_0xc7ed('0x47')]=_[_0xc7ed('0x46')](_0x460e2d['model'],qs['fields'](_0xf93621['query']['fields']));_0x120c51[_0xc7ed('0x47')]=_0x120c51[_0xc7ed('0x47')][_0xc7ed('0x49')]?_0x120c51[_0xc7ed('0x47')]:_0x460e2d[_0xc7ed('0x43')];if(!_0xf93621['query'][_0xc7ed('0x70')](_0xc7ed('0x68'))){_0x120c51[_0xc7ed('0x2e')]=qs[_0xc7ed('0x2e')](_0xf93621[_0xc7ed('0x45')][_0xc7ed('0x2e')]);_0x120c51[_0xc7ed('0x2d')]=qs['offset'](_0xf93621[_0xc7ed('0x45')]['offset']);}_0x120c51[_0xc7ed('0x69')]=qs[_0xc7ed('0x4a')](_0xf93621[_0xc7ed('0x45')][_0xc7ed('0x4a')]);_0x120c51[_0xc7ed('0x4b')]=qs[_0xc7ed('0x4c')](_[_0xc7ed('0x4d')](_0xf93621[_0xc7ed('0x45')],_0x460e2d[_0xc7ed('0x4c')]));_0x120c51['where']['SmsAccountId']=_0x26a03f['id'];if(_0xf93621['query'][_0xc7ed('0x4e')]){_0x120c51[_0xc7ed('0x4b')]=_['merge'](_0x120c51[_0xc7ed('0x4b')],{'$or':_[_0xc7ed('0x3f')](_0x120c51['attributes'],function(_0x811aef){var _0xc34a34={};_0xc34a34[_0x811aef]={'$like':'%'+_0xf93621[_0xc7ed('0x45')][_0xc7ed('0x4e')]+'%'};return _0xc34a34;})});}_0x120c51=_['merge']({},_0x120c51,_0xf93621['options']);return db[_0xc7ed('0xa6')][_0xc7ed('0x30')]({'where':_0x120c51[_0xc7ed('0x4b')]})['then'](function(_0x408866){_0x4263d8[_0xc7ed('0x30')]=_0x408866;if(_0xf93621[_0xc7ed('0x45')][_0xc7ed('0x51')]){_0x120c51['include']=[{'model':db[_0xc7ed('0x7a')],'as':_0xc7ed('0xc9'),'required':![]},{'model':db[_0xc7ed('0xca')],'as':_0xc7ed('0xcb'),'attributes':['name',_0xc7ed('0xcc'),'internal'],'required':![]},{'model':db[_0xc7ed('0xcd')],'as':_0xc7ed('0xce'),'attributes':['id',_0xc7ed('0x3b'),_0xc7ed('0xcf')],'where':_0xf93621[_0xc7ed('0x45')][_0xc7ed('0xd0')]?{'id':_0xf93621[_0xc7ed('0x45')][_0xc7ed('0xd0')]}:undefined,'required':_0xf93621[_0xc7ed('0x45')][_0xc7ed('0xd0')]?!![]:![]}];}return db[_0xc7ed('0xa6')][_0xc7ed('0x53')](_0x120c51);})[_0xc7ed('0x1f')](function(_0x48b459){_0x4263d8['rows']=_0x48b459;return _0x4263d8;});}})[_0xc7ed('0x1f')](respondWithFilteredResult(_0x10d25d,_0x120c51))[_0xc7ed('0x28')](handleError(_0x10d25d,null));};exports['send']=function(_0x108c9f,_0x1aba20,_0x9303f9){var _0x4222f6,_0xcbf026,_0x40e037;if(_[_0xc7ed('0x9a')](_0x108c9f[_0xc7ed('0x5a')]['body'])||_0x108c9f[_0xc7ed('0x5a')][_0xc7ed('0x5a')]===''){throw new db[(_0xc7ed('0x7b'))][(_0xc7ed('0x7c'))](_0xc7ed('0x9c'));}if(_['isNil'](_0x108c9f['body']['to'])){throw new db[(_0xc7ed('0x7b'))][(_0xc7ed('0x7c'))](_0xc7ed('0xd1'));}_0x4222f6=_0x108c9f[_0xc7ed('0x5a')]['to'];return db[_0xc7ed('0x40')][_0xc7ed('0x58')]({'where':{'id':_0x108c9f[_0xc7ed('0x55')]['id']},'include':[{'model':db['CmList'],'as':_0xc7ed('0xd2'),'include':[{'model':db[_0xc7ed('0x7a')],'as':_0xc7ed('0xa5'),'where':{'mobile':_0x4222f6},'limit':0x1,'order':[[_0xc7ed('0x80'),_0xc7ed('0xa2')]]}]}]})['then'](handleEntityNotFound(_0x1aba20,null))[_0xc7ed('0x1f')](function(_0x10703a){if(_0x10703a&&_0x10703a['List']){_0xcbf026=_0x10703a[_0xc7ed('0x37')]({'plain':!![]});if(_0xcbf026[_0xc7ed('0xd2')]&&_0xcbf026[_0xc7ed('0xd2')][_0xc7ed('0xa5')]['length']){return _0xcbf026['List'][_0xc7ed('0xa5')][0x0];}return db['CmContact'][_0xc7ed('0x59')](_[_0xc7ed('0x1a')](_0x108c9f[_0xc7ed('0x5a')],{'firstName':_0x4222f6,'mobile':_0x4222f6,'phone':_0x4222f6,'ListId':_0xcbf026[_0xc7ed('0xa1')]}));}})[_0xc7ed('0x1f')](handleEntityNotFound(_0x1aba20,null))[_0xc7ed('0x1f')](function(_0x4a0b8f){if(_0x4a0b8f){_0x40e037=_0x4a0b8f;return db[_0xc7ed('0xa6')][_0xc7ed('0x58')]({'where':{'ContactId':_0x40e037['id'],'closed':![],'SmsAccountId':_0xcbf026['id']}})[_0xc7ed('0x1f')](function(_0x160a28){if(_0x160a28){return[_0x160a28,![]];}return db[_0xc7ed('0xa6')][_0xc7ed('0x59')]({'UserId':_0x108c9f[_0xc7ed('0x5d')]['id'],'ContactId':_0x40e037['id'],'SmsAccountId':_0xcbf026['id'],'phone':_0x4222f6,'firstMsgDirection':_0xc7ed('0xd3'),'Messages':[_[_0xc7ed('0x4f')](_0x108c9f[_0xc7ed('0x5a')],{'read':![],'body':_0x108c9f[_0xc7ed('0x5a')][_0xc7ed('0x5a')],'phone':_0x4222f6,'SmsAccountId':_0xcbf026['id'],'UserId':_0x108c9f[_0xc7ed('0x5d')]['id'],'ContactId':_0x40e037['id']})]},{'include':[{'model':db[_0xc7ed('0xaf')],'as':_0xc7ed('0xd4')}]})[_0xc7ed('0x1f')](function(_0x21310d){return[_0x21310d,!![]];});});}})['spread'](function(_0x1ad379,_0x17e9b4){if(_0x17e9b4){return _0x1ad379;}return db[_0xc7ed('0xaf')]['create'](_[_0xc7ed('0x4f')](_0x108c9f[_0xc7ed('0x5a')],{'read':![],'body':_0x108c9f['body'][_0xc7ed('0x5a')],'phone':_0x4222f6,'SmsAccountId':_0xcbf026['id'],'SmsInteractionId':_0x1ad379['id'],'UserId':_0x108c9f[_0xc7ed('0x5d')]['id'],'ContactId':_0x40e037['id']}))[_0xc7ed('0x1f')](function(_0xe313e2){_0x1ad379[_0xc7ed('0xd5')][_0xc7ed('0xd4')]=[];_0x1ad379[_0xc7ed('0xd5')][_0xc7ed('0xd4')]['push'](_0xe313e2[_0xc7ed('0xd5')]);return _0x1ad379;});})[_0xc7ed('0x1f')](respondWithResult(_0x1aba20,null))['catch'](handleError(_0x1aba20,null));};exports[_0xc7ed('0x2b')]=function(_0x3bf87b,_0x336373,_0x4d876d){if(_0x3bf87b[_0xc7ed('0x5a')]['id']){delete _0x3bf87b[_0xc7ed('0x5a')]['id'];}var _0x4ba58c,_0x42e5ee,_0x49f7a6;return db['SmsAccount'][_0xc7ed('0x58')]({'where':{'id':_0x3bf87b[_0xc7ed('0x55')]['id']}})[_0xc7ed('0x1f')](handleEntityNotFound(_0x336373,null))[_0xc7ed('0x1f')](function(_0x48b5d1){if(_0x48b5d1){_0x49f7a6=_0x48b5d1;logger[_0xc7ed('0x22')](_0xc7ed('0xba'),'status',_0xc7ed('0xd6'),_0x48b5d1[_0xc7ed('0x83')],util[_0xc7ed('0xd7')](_0x3bf87b[_0xc7ed('0x5a')],{'showHidden':![],'depth':null}));switch(_0x48b5d1['type']){case _0xc7ed('0xd8'):if(_0x3bf87b['body']['skebby_dispatch_id']&&_0x3bf87b[_0xc7ed('0x5a')]['status']){_0x42e5ee=_0x3bf87b[_0xc7ed('0x5a')][_0xc7ed('0x2b')];return db[_0xc7ed('0xaf')][_0xc7ed('0x58')]({'where':{'messageId':_0x3bf87b['body'][_0xc7ed('0xd9')]}});}break;case'connectel':if(_0x3bf87b[_0xc7ed('0x5a')][_0xc7ed('0xda')]&&_0x3bf87b[_0xc7ed('0x5a')][_0xc7ed('0xdb')]){_0x42e5ee=_0x3bf87b[_0xc7ed('0x5a')][_0xc7ed('0xdb')];return db[_0xc7ed('0xaf')][_0xc7ed('0x58')]({'where':{'messageId':_0x3bf87b[_0xc7ed('0x5a')][_0xc7ed('0xda')]}});}break;case'clicksend':if(_0x3bf87b[_0xc7ed('0x5a')][_0xc7ed('0x8e')]&&_0x3bf87b[_0xc7ed('0x5a')][_0xc7ed('0xdc')]){_0x42e5ee=_0x3bf87b[_0xc7ed('0x5a')][_0xc7ed('0xdc')];return db[_0xc7ed('0xaf')][_0xc7ed('0x58')]({'where':{'messageId':_0x3bf87b[_0xc7ed('0x5a')][_0xc7ed('0x8e')]}});}break;case _0xc7ed('0x91'):var _0x5ef2b9=_0x3bf87b[_0xc7ed('0x5a')][_0xc7ed('0x92')][0x0];if(_0x5ef2b9[_0xc7ed('0x88')]&&_0x5ef2b9['status'][_0xc7ed('0xdd')]===_0xc7ed('0xde')){_0x42e5ee=_0x5ef2b9['status'][_0xc7ed('0xdd')];return db[_0xc7ed('0xaf')][_0xc7ed('0x58')]({'where':{'messageId':_0x5ef2b9[_0xc7ed('0x88')]}});}break;case _0xc7ed('0x95'):if(_0x3bf87b[_0xc7ed('0x5a')][_0xc7ed('0x88')]&&_0x3bf87b[_0xc7ed('0x5a')]['status']){_0x42e5ee=_0x3bf87b[_0xc7ed('0x5a')][_0xc7ed('0x2b')];return db[_0xc7ed('0xaf')][_0xc7ed('0x58')]({'where':{'messageId':_0x3bf87b[_0xc7ed('0x5a')]['messageId']}});}break;case _0xc7ed('0xdf'):if(_0x3bf87b[_0xc7ed('0x5a')][0x0][_0xc7ed('0x25')]['id']){_0x42e5ee=_0x3bf87b['body'][0x0][_0xc7ed('0x83')];return db['SmsMessage'][_0xc7ed('0x58')]({'where':{'messageId':_0x3bf87b[_0xc7ed('0x5a')][0x0][_0xc7ed('0x25')]['id']}});}break;case _0xc7ed('0x98'):if(_0x3bf87b[_0xc7ed('0x5a')][_0xc7ed('0xe0')]&&_0x3bf87b[_0xc7ed('0x5a')][_0xc7ed('0x2b')]){_0x42e5ee=_0x3bf87b['body'][_0xc7ed('0x2b')];return db['SmsMessage'][_0xc7ed('0x58')]({'where':{'messageId':_0x3bf87b['body'][_0xc7ed('0xe0')]}});}break;}}})['then'](handleEntityNotFound(_0x336373,null))[_0xc7ed('0x1f')](function(_0x16e24d){if(_0x16e24d){_0x4ba58c=_0x16e24d;switch(_0x49f7a6[_0xc7ed('0x83')]){case _0xc7ed('0xd8'):if(_0x42e5ee===_0xc7ed('0xde')){return _0x4ba58c['update']({'read':!![]});}else{logger[_0xc7ed('0x23')](_0xc7ed('0xba'),'status',_0xc7ed('0xd8'),util[_0xc7ed('0xd7')](_0x3bf87b['body'],{'showHidden':![],'depth':null}));}break;case _0xc7ed('0x8c'):if(_0x42e5ee==='1'){return _0x4ba58c['update']({'read':!![]});}else{logger['error'](_0xc7ed('0xba'),_0xc7ed('0x2b'),_0xc7ed('0xd8'),util[_0xc7ed('0xd7')](_0x3bf87b[_0xc7ed('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xc7ed('0x8d'):if(!_0x3bf87b[_0xc7ed('0x5a')][_0xc7ed('0xe1')]&&_0x42e5ee>=0xc8&&_0x42e5ee<=0xce){return _0x4ba58c[_0xc7ed('0x35')]({'read':!![]});}else{logger[_0xc7ed('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xc7ed('0x2b'),'clicksend',util[_0xc7ed('0xd7')](_0x3bf87b[_0xc7ed('0x5a')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x3c12b8=_0x3bf87b[_0xc7ed('0x5a')]['results'][0x0];if(_0x3c12b8[_0xc7ed('0x2b')]['groupName']==='DELIVERED'){return _0x4ba58c['update']({'read':!![]});}else{logger[_0xc7ed('0x23')](_0xc7ed('0xba'),_0xc7ed('0x2b'),_0xc7ed('0x91'),util[_0xc7ed('0xd7')](_0x3bf87b[_0xc7ed('0x5a')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x42e5ee==_0xc7ed('0xe2')||_0x42e5ee=='RECEIVED_BY_RECIPIENT'){return _0x4ba58c['update']({'read':!![]});}else{logger[_0xc7ed('0x23')](_0xc7ed('0xba'),'status',_0xc7ed('0x95'),util[_0xc7ed('0xd7')](_0x3bf87b['body'],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x42e5ee==_0xc7ed('0xe3')){return _0x4ba58c[_0xc7ed('0x35')]({'read':!![]});}else{logger[_0xc7ed('0x23')](_0xc7ed('0xba'),_0xc7ed('0x2b'),_0xc7ed('0xdf'),util[_0xc7ed('0xd7')](_0x3bf87b[_0xc7ed('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xc7ed('0x98'):if(_0x42e5ee===_0xc7ed('0xe4')||_0x42e5ee===_0xc7ed('0xe5')){return _0x4ba58c[_0xc7ed('0x35')]({'read':!![]});}else{logger[_0xc7ed('0x23')](_0xc7ed('0xba'),'status',_0xc7ed('0x98'),util[_0xc7ed('0xd7')](_0x3bf87b[_0xc7ed('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x4ba58c;}})[_0xc7ed('0x1f')](respondWithResult(_0x336373,null))[_0xc7ed('0x28')](handleError(_0x336373,null));};exports[_0xc7ed('0xe6')]=function(_0x1856be,_0x4d7f16,_0x1e2a96){var _0x108991,_0x31b591,_0x46a8ff;return db['SmsAccount'][_0xc7ed('0x58')]({'where':{'id':_0x1856be[_0xc7ed('0x55')]['id']}})[_0xc7ed('0x1f')](handleEntityNotFound(_0x4d7f16,null))[_0xc7ed('0x1f')](function(_0x1421d1){if(_0x1421d1){_0x46a8ff=_0x1421d1;logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xc7ed('0x2b'),'received\x20delivery\x20report\x20from',_0x1421d1[_0xc7ed('0x83')],util['inspect'](_0x1856be[_0xc7ed('0x45')],{'showHidden':![],'depth':null}));switch(_0x1421d1['type']){case _0xc7ed('0x93'):if(_0x1856be[_0xc7ed('0x45')][_0xc7ed('0xe7')]&&_0x1856be['query'][_0xc7ed('0xe8')]){_0x31b591=_0x1856be['query'][_0xc7ed('0xe8')];return db[_0xc7ed('0xaf')][_0xc7ed('0x58')]({'where':{'messageId':_0x1856be[_0xc7ed('0x45')]['message-id']}});}break;}}})[_0xc7ed('0x1f')](handleEntityNotFound(_0x4d7f16,null))['then'](function(_0x3e60b4){if(_0x3e60b4){_0x108991=_0x3e60b4;switch(_0x46a8ff[_0xc7ed('0x83')]){case _0xc7ed('0x93'):if(_0x31b591==='2'||_0x31b591==='6'){return _0x108991[_0xc7ed('0x35')]({'read':!![]});}else{logger[_0xc7ed('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xc7ed('0x2b'),'csc',util[_0xc7ed('0xd7')](_0x1856be[_0xc7ed('0x45')],{'showHidden':![],'depth':null}));};break;}return _0x108991;}})[_0xc7ed('0x1f')](respondWithResult(_0x4d7f16,null))[_0xc7ed('0x28')](handleError(_0x4d7f16,null));};exports[_0xc7ed('0xe9')]=function(_0x3b32cd,_0x2109e0,_0x58f3f2){return db[_0xc7ed('0x40')]['find']({'where':{'id':_0x3b32cd[_0xc7ed('0x55')]['id']}})[_0xc7ed('0x1f')](handleEntityNotFound(_0x2109e0,null))['then'](function(_0xbd0de){if(_0xbd0de){return _0xbd0de['addAgents'](_0x3b32cd['body'][_0xc7ed('0x6c')],_[_0xc7ed('0xa4')](_0x3b32cd[_0xc7ed('0x5a')],[_0xc7ed('0x6c'),'id'])||{})[_0xc7ed('0xa7')](function(_0x400c7e){for(var _0x2ea5a8=0x0;_0x2ea5a8<_0x3b32cd['body'][_0xc7ed('0x6c')]['length'];_0x2ea5a8+=0x1){socket[_0xc7ed('0xea')](_0xc7ed('0xeb'),{'UserId':Number(_0x3b32cd[_0xc7ed('0x5a')][_0xc7ed('0x6c')][_0x2ea5a8]),'SmsAccountId':Number(_0x3b32cd['params']['id'])});}return _0x400c7e;});}})['then'](respondWithResult(_0x2109e0,null))[_0xc7ed('0x28')](handleError(_0x2109e0,null));};exports['removeAgents']=function(_0x202b88,_0x1c35cd,_0x55ac91){return db[_0xc7ed('0x40')][_0xc7ed('0x58')]({'where':{'id':_0x202b88['params']['id']}})['then'](handleEntityNotFound(_0x1c35cd,null))['then'](function(_0x33c9c7){if(_0x33c9c7){return _0x33c9c7[_0xc7ed('0xec')](_0x202b88['query'][_0xc7ed('0x6c')])[_0xc7ed('0x1f')](function(){if(_[_0xc7ed('0xed')](_0x202b88[_0xc7ed('0x45')]['ids'])){for(var _0x53bfc7=0x0;_0x53bfc7<_0x202b88['query']['ids'][_0xc7ed('0x49')];_0x53bfc7+=0x1){socket[_0xc7ed('0xea')](_0xc7ed('0xee'),{'UserId':Number(_0x202b88[_0xc7ed('0x45')][_0xc7ed('0x6c')][_0x53bfc7]),'SmsAccountId':Number(_0x202b88[_0xc7ed('0x55')]['id'])});}}else{socket[_0xc7ed('0xea')]('userSmsAccount:remove',{'UserId':Number(_0x202b88[_0xc7ed('0x45')][_0xc7ed('0x6c')]),'SmsAccountId':Number(_0x202b88['params']['id'])});}});}})['then'](respondWithStatusCode(_0x1c35cd,null))[_0xc7ed('0x28')](handleError(_0x1c35cd,null));};exports[_0xc7ed('0xef')]=function(_0x168009,_0x322f96,_0x1dec34){var _0x3a48e7={};var _0x2ae2cf={};var _0x1a48f9;var _0x56eea2;return db[_0xc7ed('0x40')][_0xc7ed('0x67')]({'where':{'id':_0x168009[_0xc7ed('0x55')]['id']}})[_0xc7ed('0x1f')](handleEntityNotFound(_0x322f96,null))['then'](function(_0x5e89cd){if(_0x5e89cd){_0x1a48f9=_0x5e89cd;_0x2ae2cf[_0xc7ed('0x43')]=_[_0xc7ed('0x44')](db[_0xc7ed('0xca')][_0xc7ed('0x56')]);_0x2ae2cf['query']=_[_0xc7ed('0x44')](_0x168009[_0xc7ed('0x45')]);_0x2ae2cf[_0xc7ed('0x4c')]=_[_0xc7ed('0x46')](_0x2ae2cf[_0xc7ed('0x43')],_0x2ae2cf['query']);_0x3a48e7['attributes']=_['intersection'](_0x2ae2cf['model'],qs[_0xc7ed('0x48')](_0x168009[_0xc7ed('0x45')][_0xc7ed('0x48')]));_0x3a48e7['attributes']=_0x3a48e7['attributes'][_0xc7ed('0x49')]?_0x3a48e7[_0xc7ed('0x47')]:_0x2ae2cf[_0xc7ed('0x43')];_0x3a48e7['order']=qs[_0xc7ed('0x4a')](_0x168009[_0xc7ed('0x45')][_0xc7ed('0x4a')]);_0x3a48e7[_0xc7ed('0x4b')]=qs[_0xc7ed('0x4c')](_[_0xc7ed('0x4d')](_0x168009['query'],_0x2ae2cf[_0xc7ed('0x4c')]));if(_0x168009[_0xc7ed('0x45')][_0xc7ed('0x4e')]){_0x3a48e7[_0xc7ed('0x4b')]=_['merge'](_0x3a48e7['where'],{'$or':_['map'](_0x3a48e7[_0xc7ed('0x47')],function(_0x3e93d3){var _0x183808={};_0x183808[_0x3e93d3]={'$like':'%'+_0x168009[_0xc7ed('0x45')][_0xc7ed('0x4e')]+'%'};return _0x183808;})});}_0x3a48e7=_[_0xc7ed('0x4f')]({},_0x3a48e7,_0x168009['options']);return _0x1a48f9[_0xc7ed('0xef')](_0x3a48e7);}})[_0xc7ed('0x1f')](function(_0x58844a){if(_0x58844a){_0x56eea2=_0x58844a[_0xc7ed('0x49')];if(!_0x168009[_0xc7ed('0x45')][_0xc7ed('0x70')](_0xc7ed('0x68'))){_0x3a48e7[_0xc7ed('0x2e')]=qs[_0xc7ed('0x2e')](_0x168009[_0xc7ed('0x45')][_0xc7ed('0x2e')]);_0x3a48e7[_0xc7ed('0x2d')]=qs['offset'](_0x168009[_0xc7ed('0x45')][_0xc7ed('0x2d')]);}return _0x1a48f9[_0xc7ed('0xef')](_0x3a48e7);}})[_0xc7ed('0x1f')](function(_0xde8575){if(_0xde8575){return _0xde8575?{'count':_0x56eea2,'rows':_0xde8575}:null;}})['then'](respondWithResult(_0x322f96,null))[_0xc7ed('0x28')](handleError(_0x322f96,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index a903e3d..af72f3c 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 _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 +var _0x728a=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsAccount','setMaxListeners','save'];(function(_0x777641,_0x19607d){var _0x54a378=function(_0x501b92){while(--_0x501b92){_0x777641['push'](_0x777641['shift']());}};_0x54a378(++_0x19607d);}(_0x728a,0x187));var _0xa728=function(_0x3b1df0,_0x4d7d15){_0x3b1df0=_0x3b1df0-0x0;var _0x33c6bd=_0x728a[_0x3b1df0];return _0x33c6bd;};'use strict';var EventEmitter=require(_0xa728('0x0'));var SmsAccount=require(_0xa728('0x1'))['db'][_0xa728('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xa728('0x3')](0x0);var events={'afterCreate':_0xa728('0x4'),'afterUpdate':_0xa728('0x5'),'afterDestroy':_0xa728('0x6')};function emitEvent(_0x2bcad1){return function(_0x1b01bb,_0x18ad13,_0x1b62b5){SmsAccountEvents['emit'](_0x2bcad1+':'+_0x1b01bb['id'],_0x1b01bb);SmsAccountEvents[_0xa728('0x7')](_0x2bcad1,_0x1b01bb);_0x1b62b5(null);};}for(var e in events){if(events[_0xa728('0x8')](e)){var event=events[e];SmsAccount[_0xa728('0x9')](e,emitEvent(event));}}module[_0xa728('0xa')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 196f7f7..3f13389 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 _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 +var _0x5d09=['./smsAccount.attributes','define','SmsAccount','sms_accounts','lodash','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x2106e0,_0x57e335){var _0x22e4f0=function(_0x2b8ba8){while(--_0x2b8ba8){_0x2106e0['push'](_0x2106e0['shift']());}};_0x22e4f0(++_0x57e335);}(_0x5d09,0xe0));var _0x95d0=function(_0x2c1841,_0x505204){_0x2c1841=_0x2c1841-0x0;var _0x28d148=_0x5d09[_0x2c1841];return _0x28d148;};'use strict';var _=require(_0x95d0('0x0'));var util=require('util');var logger=require(_0x95d0('0x1'))(_0x95d0('0x2'));var moment=require(_0x95d0('0x3'));var BPromise=require(_0x95d0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x95d0('0x5'));var config=require('../../config/environment');var attributes=require(_0x95d0('0x6'));module['exports']=function(_0x4a6ed3,_0x56d2e0){return _0x4a6ed3[_0x95d0('0x7')](_0x95d0('0x8'),attributes,{'tableName':_0x95d0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 61304c1..9d1a67e 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 _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 +var _0x0d8f=['where','include','map','model','attributes','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','redis','socket.io-emitter','register','request','info','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','ShowSmsAccount','find','options','raw'];(function(_0x28730c,_0x2084fe){var _0x312edc=function(_0x3085c7){while(--_0x3085c7){_0x28730c['push'](_0x28730c['shift']());}};_0x312edc(++_0x2084fe);}(_0x0d8f,0x1e5));var _0xf0d8=function(_0x4fb1b8,_0x32d98d){_0x4fb1b8=_0x4fb1b8-0x0;var _0x146c71=_0x0d8f[_0x4fb1b8];return _0x146c71;};'use strict';var _=require(_0xf0d8('0x0'));var util=require(_0xf0d8('0x1'));var moment=require('moment');var BPromise=require(_0xf0d8('0x2'));var rs=require(_0xf0d8('0x3'));var fs=require('fs');var Redis=require(_0xf0d8('0x4'));var db=require(_0xf0d8('0x5'))['db'];var utils=require(_0xf0d8('0x6'));var logger=require(_0xf0d8('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf0d8('0x8'));var client=jayson[_0xf0d8('0x9')]['http']({'port':0x232a});config[_0xf0d8('0xa')]=_['defaults'](config[_0xf0d8('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xf0d8('0xb'))(new Redis(config['redis']));require('./smsAccount.socket')[_0xf0d8('0xc')](socket);function respondWithRpcPromise(_0xe6e64e,_0x16f713,_0x2dc065){return new BPromise(function(_0x4250e2,_0x1857b3){return client[_0xf0d8('0xd')](_0xe6e64e,_0x2dc065)['then'](function(_0x1177df){logger[_0xf0d8('0xe')](_0xf0d8('0xf'),_0x16f713,'request\x20sent');logger[_0xf0d8('0x10')](_0xf0d8('0x11'),_0x16f713,_0xf0d8('0x12'),JSON[_0xf0d8('0x13')](_0x1177df));if(_0x1177df[_0xf0d8('0x14')]){if(_0x1177df[_0xf0d8('0x14')]['code']===0x1f4){logger['error']('SmsAccount,\x20%s,\x20%s',_0x16f713,_0x1177df[_0xf0d8('0x14')][_0xf0d8('0x15')]);return _0x1857b3(_0x1177df['error']['message']);}logger[_0xf0d8('0x14')]('SmsAccount,\x20%s,\x20%s',_0x16f713,_0x1177df[_0xf0d8('0x14')]['message']);return _0x4250e2(_0x1177df[_0xf0d8('0x14')]['message']);}else{logger[_0xf0d8('0xe')](_0xf0d8('0xf'),_0x16f713,_0xf0d8('0x12'));_0x4250e2(_0x1177df['result'][_0xf0d8('0x15')]);}})[_0xf0d8('0x16')](function(_0x57d341){logger['error'](_0xf0d8('0xf'),_0x16f713,_0x57d341);_0x1857b3(_0x57d341);});});}exports[_0xf0d8('0x17')]=function(_0x4d71d3){var _0x477f0e=this;return new Promise(function(_0xeee3d4,_0xd95d52){return db['SmsAccount'][_0xf0d8('0x18')]({'raw':_0x4d71d3[_0xf0d8('0x19')]?_0x4d71d3['options'][_0xf0d8('0x1a')]===undefined?!![]:![]:!![],'where':_0x4d71d3[_0xf0d8('0x19')]?_0x4d71d3[_0xf0d8('0x19')][_0xf0d8('0x1b')]||null:null,'attributes':_0x4d71d3[_0xf0d8('0x19')]?_0x4d71d3[_0xf0d8('0x19')]['attributes']||null:null,'include':_0x4d71d3[_0xf0d8('0x19')]?_0x4d71d3['options'][_0xf0d8('0x1c')]?_[_0xf0d8('0x1d')](_0x4d71d3['options']['include'],function(_0x2c49fd){return{'model':db[_0x2c49fd[_0xf0d8('0x1e')]],'as':_0x2c49fd['as'],'attributes':_0x2c49fd['attributes'],'include':_0x2c49fd[_0xf0d8('0x1c')]?_['map'](_0x2c49fd['include'],function(_0x2787e3){return{'model':db[_0x2787e3['model']],'as':_0x2787e3['as'],'attributes':_0x2787e3[_0xf0d8('0x1f')],'include':_0x2787e3[_0xf0d8('0x1c')]?_[_0xf0d8('0x1d')](_0x2787e3['include'],function(_0x501480){return{'model':db[_0x501480[_0xf0d8('0x1e')]],'as':_0x501480['as'],'attributes':_0x501480['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xef1fa8){logger[_0xf0d8('0xe')]('ShowSmsAccount',_0x4d71d3);logger[_0xf0d8('0x10')](_0xf0d8('0x17'),_0x4d71d3,JSON[_0xf0d8('0x13')](_0xef1fa8));_0xeee3d4(_0xef1fa8);})[_0xf0d8('0x16')](function(_0x2d0de7){logger[_0xf0d8('0x14')]('ShowSmsAccount',_0x2d0de7[_0xf0d8('0x15')],_0x4d71d3);_0xd95d52(_0x477f0e[_0xf0d8('0x14')](0x1f4,_0x2d0de7[_0xf0d8('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index c80a03e..ed56a73 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(_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 +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'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 817c9f1..f5e57ea 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 _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 +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(_0x36bf7f,_0x56eb54){var _0x4afa06=function(_0x4cc726){while(--_0x4cc726){_0x36bf7f['push'](_0x36bf7f['shift']());}};_0x4afa06(++_0x56eb54);}(_0x55ca,0x126));var _0xa55c=function(_0x1034bb,_0x4e20b3){_0x1034bb=_0x1034bb-0x0;var _0x453fdb=_0x55ca[_0x1034bb];return _0x453fdb;};'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 diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 056359f..98baa2f 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 _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 +var _0x34e2=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x34e2,0x105));var _0x234e=function(_0x429e9a,_0x19c963){_0x429e9a=_0x429e9a-0x0;var _0x427671=_0x34e2[_0x429e9a];return _0x427671;};'use strict';var Sequelize=require(_0x234e('0x0'));module[_0x234e('0x1')]={'priority':{'type':Sequelize[_0x234e('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x234e('0x3')],'allowNull':![],'defaultValue':_0x234e('0x4')},'appdata':{'type':Sequelize[_0x234e('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x234e('0x3')],'defaultValue':_0x234e('0x6')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index cd8d6da..b169c19 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 _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 +var _0x8cfb=['../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','then','stack','name','send','index','map','SmsApplication','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','create','body','destroy','find','rimraf','zip-dir','request-promise','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x4527d8,_0x59e349){var _0x1ec91d=function(_0x1ec598){while(--_0x1ec598){_0x4527d8['push'](_0x4527d8['shift']());}};_0x1ec91d(++_0x59e349);}(_0x8cfb,0x1cf));var _0xb8cf=function(_0x5e745e,_0xde2931){_0x5e745e=_0x5e745e-0x0;var _0x122dab=_0x8cfb[_0x5e745e];return _0x122dab;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb8cf('0x0'));var zipdir=require(_0xb8cf('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb8cf('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb8cf('0x3'));var path=require('path');var sox=require(_0xb8cf('0x4'));var csv=require(_0xb8cf('0x5'));var ejs=require(_0xb8cf('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb8cf('0x7'));var crypto=require(_0xb8cf('0x8'));var jsforce=require(_0xb8cf('0x9'));var deskjs=require(_0xb8cf('0xa'));var toCsv=require(_0xb8cf('0x5'));var querystring=require(_0xb8cf('0xb'));var Papa=require(_0xb8cf('0xc'));var Redis=require('ioredis');var authService=require(_0xb8cf('0xd'));var qs=require(_0xb8cf('0xe'));var as=require(_0xb8cf('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb8cf('0x10'))(_0xb8cf('0x11'));var utils=require(_0xb8cf('0x12'));var config=require(_0xb8cf('0x13'));var licenseUtil=require(_0xb8cf('0x14'));var db=require(_0xb8cf('0x15'))['db'];function respondWithStatusCode(_0x5c43c7,_0x1e4c6b){_0x1e4c6b=_0x1e4c6b||0xcc;return function(_0x13d9b1){if(_0x13d9b1){return _0x5c43c7['sendStatus'](_0x1e4c6b);}return _0x5c43c7[_0xb8cf('0x16')](_0x1e4c6b)[_0xb8cf('0x17')]();};}function respondWithResult(_0x5ab4e6,_0x314cb5){_0x314cb5=_0x314cb5||0xc8;return function(_0xbe6b89){if(_0xbe6b89){return _0x5ab4e6['status'](_0x314cb5)[_0xb8cf('0x18')](_0xbe6b89);}};}function respondWithFilteredResult(_0x1c0afb,_0x51aa89){return function(_0x1f5e92){if(_0x1f5e92){var _0x43f18e=typeof _0x51aa89['offset']===_0xb8cf('0x19')&&typeof _0x51aa89['limit']===_0xb8cf('0x19');var _0x16accd=_0x1f5e92[_0xb8cf('0x1a')];var _0x40c18d=_0x43f18e?0x0:_0x51aa89['offset'];var _0x5eea48=_0x43f18e?_0x1f5e92[_0xb8cf('0x1a')]:_0x51aa89[_0xb8cf('0x1b')]+_0x51aa89[_0xb8cf('0x1c')];var _0xef93c2;if(_0x5eea48>=_0x16accd){_0x5eea48=_0x16accd;_0xef93c2=0xc8;}else{_0xef93c2=0xce;}_0x1c0afb[_0xb8cf('0x16')](_0xef93c2);return _0x1c0afb['set'](_0xb8cf('0x1d'),_0x40c18d+'-'+_0x5eea48+'/'+_0x16accd)[_0xb8cf('0x18')](_0x1f5e92);}return null;};}function patchUpdates(_0x4617b9){return function(_0x3b2fca){try{jsonpatch[_0xb8cf('0x1e')](_0x3b2fca,_0x4617b9,!![]);}catch(_0x2c33cf){return BPromise[_0xb8cf('0x1f')](_0x2c33cf);}return _0x3b2fca[_0xb8cf('0x20')]();};}function saveUpdates(_0x5d7dc2,_0x2e0ffa){return function(_0x1a0b88){if(_0x1a0b88){return _0x1a0b88['update'](_0x5d7dc2)[_0xb8cf('0x21')](function(_0x182707){return _0x182707;});}return null;};}function removeEntity(_0xc42115,_0x2539f5){return function(_0x2cf235){if(_0x2cf235){return _0x2cf235['destroy']()[_0xb8cf('0x21')](function(){_0xc42115[_0xb8cf('0x16')](0xcc)[_0xb8cf('0x17')]();});}};}function handleEntityNotFound(_0x28be83,_0x4d2d2c){return function(_0x1db75a){if(!_0x1db75a){_0x28be83['sendStatus'](0x194);}return _0x1db75a;};}function handleError(_0x5e2910,_0x589de1){_0x589de1=_0x589de1||0x1f4;return function(_0x52f686){logger['error'](_0x52f686[_0xb8cf('0x22')]);if(_0x52f686['name']){delete _0x52f686[_0xb8cf('0x23')];}_0x5e2910[_0xb8cf('0x16')](_0x589de1)[_0xb8cf('0x24')](_0x52f686);};}exports[_0xb8cf('0x25')]=function(_0x9baecf,_0x39cd82){var _0x29cfc0={},_0x23cf35={},_0x275e1b={'count':0x0,'rows':[]};var _0x185dce=_[_0xb8cf('0x26')](db[_0xb8cf('0x27')][_0xb8cf('0x28')],function(_0x3cbda2){return{'name':_0x3cbda2['fieldName'],'type':_0x3cbda2[_0xb8cf('0x29')][_0xb8cf('0x2a')]};});_0x23cf35[_0xb8cf('0x2b')]=_[_0xb8cf('0x26')](_0x185dce,_0xb8cf('0x23'));_0x23cf35['query']=_['keys'](_0x9baecf[_0xb8cf('0x2c')]);_0x23cf35[_0xb8cf('0x2d')]=_[_0xb8cf('0x2e')](_0x23cf35[_0xb8cf('0x2b')],_0x23cf35[_0xb8cf('0x2c')]);_0x29cfc0[_0xb8cf('0x2f')]=_[_0xb8cf('0x2e')](_0x23cf35[_0xb8cf('0x2b')],qs[_0xb8cf('0x30')](_0x9baecf['query'][_0xb8cf('0x30')]));_0x29cfc0['attributes']=_0x29cfc0[_0xb8cf('0x2f')][_0xb8cf('0x31')]?_0x29cfc0[_0xb8cf('0x2f')]:_0x23cf35['model'];if(!_0x9baecf[_0xb8cf('0x2c')][_0xb8cf('0x32')](_0xb8cf('0x33'))){_0x29cfc0[_0xb8cf('0x1c')]=qs[_0xb8cf('0x1c')](_0x9baecf[_0xb8cf('0x2c')][_0xb8cf('0x1c')]);_0x29cfc0[_0xb8cf('0x1b')]=qs[_0xb8cf('0x1b')](_0x9baecf[_0xb8cf('0x2c')][_0xb8cf('0x1b')]);}_0x29cfc0['order']=qs[_0xb8cf('0x34')](_0x9baecf[_0xb8cf('0x2c')]['sort']);_0x29cfc0[_0xb8cf('0x35')]=qs['filters'](_[_0xb8cf('0x36')](_0x9baecf[_0xb8cf('0x2c')],_0x23cf35[_0xb8cf('0x2d')]),_0x185dce);if(_0x9baecf[_0xb8cf('0x2c')][_0xb8cf('0x37')]){_0x29cfc0[_0xb8cf('0x35')]=_[_0xb8cf('0x38')](_0x29cfc0['where'],{'$or':_['map'](_0x185dce,function(_0x19d897){if(_0x19d897[_0xb8cf('0x29')]!==_0xb8cf('0x39')){var _0x12f9da={};_0x12f9da[_0x19d897[_0xb8cf('0x23')]]={'$like':'%'+_0x9baecf['query'][_0xb8cf('0x37')]+'%'};return _0x12f9da;}})});}_0x29cfc0=_['merge']({},_0x29cfc0,_0x9baecf[_0xb8cf('0x3a')]);var _0x511a0e={'where':_0x29cfc0[_0xb8cf('0x35')]};return db[_0xb8cf('0x27')][_0xb8cf('0x1a')](_0x511a0e)[_0xb8cf('0x21')](function(_0x3447a4){_0x275e1b[_0xb8cf('0x1a')]=_0x3447a4;if(_0x9baecf['query'][_0xb8cf('0x3b')]){_0x29cfc0[_0xb8cf('0x3c')]=[{'all':!![]}];}return db[_0xb8cf('0x27')][_0xb8cf('0x3d')](_0x29cfc0);})[_0xb8cf('0x21')](function(_0x150053){_0x275e1b[_0xb8cf('0x3e')]=_0x150053;return _0x275e1b;})[_0xb8cf('0x21')](respondWithFilteredResult(_0x39cd82,_0x29cfc0))[_0xb8cf('0x3f')](handleError(_0x39cd82,null));};exports['show']=function(_0x1ca767,_0x8e7444){var _0x445d98={'raw':!![],'where':{'id':_0x1ca767['params']['id']}},_0xdd5198={};_0xdd5198['model']=_[_0xb8cf('0x40')](db['SmsApplication']['rawAttributes']);_0xdd5198[_0xb8cf('0x2c')]=_[_0xb8cf('0x40')](_0x1ca767[_0xb8cf('0x2c')]);_0xdd5198[_0xb8cf('0x2d')]=_[_0xb8cf('0x2e')](_0xdd5198['model'],_0xdd5198[_0xb8cf('0x2c')]);_0x445d98['attributes']=_[_0xb8cf('0x2e')](_0xdd5198['model'],qs[_0xb8cf('0x30')](_0x1ca767['query'][_0xb8cf('0x30')]));_0x445d98[_0xb8cf('0x2f')]=_0x445d98[_0xb8cf('0x2f')]['length']?_0x445d98['attributes']:_0xdd5198[_0xb8cf('0x2b')];if(_0x1ca767['query'][_0xb8cf('0x3b')]){_0x445d98[_0xb8cf('0x3c')]=[{'all':!![]}];}_0x445d98=_['merge']({},_0x445d98,_0x1ca767[_0xb8cf('0x3a')]);return db[_0xb8cf('0x27')]['find'](_0x445d98)[_0xb8cf('0x21')](handleEntityNotFound(_0x8e7444,null))['then'](respondWithResult(_0x8e7444,null))[_0xb8cf('0x3f')](handleError(_0x8e7444,null));};exports['create']=function(_0x18c507,_0x3ff7f3){return db[_0xb8cf('0x27')][_0xb8cf('0x41')](_0x18c507[_0xb8cf('0x42')],{})[_0xb8cf('0x21')](respondWithResult(_0x3ff7f3,0xc9))['catch'](handleError(_0x3ff7f3,null));};exports['update']=function(_0x160273,_0x38d3ba){if(_0x160273[_0xb8cf('0x42')]['id']){delete _0x160273[_0xb8cf('0x42')]['id'];}return db[_0xb8cf('0x27')]['find']({'where':{'id':_0x160273['params']['id']}})['then'](handleEntityNotFound(_0x38d3ba,null))[_0xb8cf('0x21')](saveUpdates(_0x160273[_0xb8cf('0x42')],null))['then'](respondWithResult(_0x38d3ba,null))[_0xb8cf('0x3f')](handleError(_0x38d3ba,null));};exports[_0xb8cf('0x43')]=function(_0x4be595,_0x263bdd){return db[_0xb8cf('0x27')][_0xb8cf('0x44')]({'where':{'id':_0x4be595['params']['id']}})[_0xb8cf('0x21')](handleEntityNotFound(_0x263bdd,null))[_0xb8cf('0x21')](removeEntity(_0x263bdd,null))[_0xb8cf('0x3f')](handleError(_0x263bdd,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 7888625..4c9d5d5 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 _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 +var _0x6548=['bluebird','../../config/environment','exports','define','SmsApplication','sms_applications','utf8mb4','lodash','api','moment'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x6548,0x133));var _0x8654=function(_0x42fd40,_0x461f03){_0x42fd40=_0x42fd40-0x0;var _0x1f96bc=_0x6548[_0x42fd40];return _0x1f96bc;};'use strict';var _=require(_0x8654('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8654('0x1'));var moment=require(_0x8654('0x2'));var BPromise=require(_0x8654('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8654('0x4'));var attributes=require('./smsApplication.attributes');module[_0x8654('0x5')]=function(_0x1b2d35,_0x3b6266){return _0x1b2d35[_0x8654('0x6')](_0x8654('0x7'),attributes,{'tableName':_0x8654('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8654('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 746b5df..5a53744 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 _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 +var _0x15b8=['request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0xa0ee6d,_0xea67c4){var _0xa401cd=function(_0x4dff26){while(--_0x4dff26){_0xa0ee6d['push'](_0xa0ee6d['shift']());}};_0xa401cd(++_0xea67c4);}(_0x15b8,0xcd));var _0x815b=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x15b8[_0x209941];return _0x1e8729;};'use strict';var _=require('lodash');var util=require(_0x815b('0x0'));var moment=require(_0x815b('0x1'));var BPromise=require(_0x815b('0x2'));var rs=require(_0x815b('0x3'));var fs=require('fs');var Redis=require(_0x815b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x815b('0x5'));var logger=require(_0x815b('0x6'))(_0x815b('0x7'));var config=require(_0x815b('0x8'));var jayson=require(_0x815b('0x9'));var client=jayson[_0x815b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e9fc0,_0xdfdf6,_0x26119a){return new BPromise(function(_0x175053,_0x2170c5){return client[_0x815b('0xb')](_0x1e9fc0,_0x26119a)[_0x815b('0xc')](function(_0x221ce4){logger[_0x815b('0xd')](_0x815b('0xe'),_0xdfdf6,_0x815b('0xf'));logger[_0x815b('0x10')](_0x815b('0x11'),_0xdfdf6,_0x815b('0xf'),JSON[_0x815b('0x12')](_0x221ce4));if(_0x221ce4[_0x815b('0x13')]){if(_0x221ce4[_0x815b('0x13')][_0x815b('0x14')]===0x1f4){logger['error']('SmsApplication,\x20%s,\x20%s',_0xdfdf6,_0x221ce4[_0x815b('0x13')][_0x815b('0x15')]);return _0x2170c5(_0x221ce4['error']['message']);}logger['error'](_0x815b('0xe'),_0xdfdf6,_0x221ce4['error']['message']);return _0x175053(_0x221ce4[_0x815b('0x13')][_0x815b('0x15')]);}else{logger[_0x815b('0xd')]('SmsApplication,\x20%s,\x20%s',_0xdfdf6,'request\x20sent');_0x175053(_0x221ce4[_0x815b('0x16')][_0x815b('0x15')]);}})[_0x815b('0x17')](function(_0x4078db){logger[_0x815b('0x13')](_0x815b('0xe'),_0xdfdf6,_0x4078db);_0x2170c5(_0x4078db);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 8406170..77e5527 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 _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 +var _0x5eb8=['smsinteraction:update','update','delete','smsinteraction:destroy','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put'];(function(_0x5497fb,_0x2339c9){var _0x236116=function(_0x499928){while(--_0x499928){_0x5497fb['push'](_0x5497fb['shift']());}};_0x236116(++_0x2339c9);}(_0x5eb8,0xb0));var _0x85eb=function(_0xf72786,_0x1a0ddd){_0xf72786=_0xf72786-0x0;var _0x113f3e=_0x5eb8[_0xf72786];return _0x113f3e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85eb('0x0'));var timeout=require(_0x85eb('0x1'));var express=require(_0x85eb('0x2'));var router=express[_0x85eb('0x3')]();var fs_extra=require(_0x85eb('0x4'));var auth=require(_0x85eb('0x5'));var interaction=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var controller=require(_0x85eb('0x8'));router[_0x85eb('0x9')]('/',auth[_0x85eb('0xa')](),controller[_0x85eb('0xb')]);router['get'](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xd')]);router['get'](_0x85eb('0xe'),auth['isAuthenticated'](),controller[_0x85eb('0xf')]);router[_0x85eb('0x9')](_0x85eb('0x10'),auth[_0x85eb('0xa')](),controller[_0x85eb('0x11')]);router[_0x85eb('0x9')](_0x85eb('0x12'),auth['isAuthenticated'](),controller[_0x85eb('0x13')]);router[_0x85eb('0x14')]('/',auth['isAuthenticated'](),controller[_0x85eb('0x15')]);router[_0x85eb('0x14')](_0x85eb('0x10'),auth[_0x85eb('0xa')](),controller['addMessage']);router['post'](_0x85eb('0x16'),auth['isAuthenticated'](),interaction[_0x85eb('0x17')](_0x85eb('0x18'),_0x85eb('0x19')),controller[_0x85eb('0x1a')]);router[_0x85eb('0x1b')]('/:id',auth[_0x85eb('0xa')](),interaction['tracked'](_0x85eb('0x18'),_0x85eb('0x1c')),controller[_0x85eb('0x1d')]);router[_0x85eb('0x1e')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x85eb('0x18'),_0x85eb('0x1f')),controller[_0x85eb('0x20')]);router[_0x85eb('0x1e')](_0x85eb('0x16'),auth[_0x85eb('0xa')](),controller['removeTags']);module[_0x85eb('0x21')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 05d0b36..4fcc31b 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 _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 +var _0x2deb=['DATE','ENUM','INTEGER','sequelize','moment','exports','BOOLEAN','STRING','out'];(function(_0x5c69c3,_0x12e8ab){var _0x3a5c6e=function(_0x5ce2f6){while(--_0x5ce2f6){_0x5c69c3['push'](_0x5c69c3['shift']());}};_0x3a5c6e(++_0x12e8ab);}(_0x2deb,0xdb));var _0xb2de=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2deb[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xb2de('0x0'));var moment=require(_0xb2de('0x1'));module[_0xb2de('0x2')]={'closed':{'type':Sequelize[_0xb2de('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xb2de('0x4')]},'thirdDisposition':{'type':Sequelize[_0xb2de('0x4')]},'note':{'type':Sequelize[_0xb2de('0x4')]},'phone':{'type':Sequelize[_0xb2de('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xb2de('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xb2de('0x6')]},'lastMsgDirection':{'type':Sequelize[_0xb2de('0x7')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xb2de('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xb2de('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index a630228..6ad7265 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 _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 +var _0x3db7=['SmsInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','includeAll','addTags','setTags','omit','spread','Tag','color','emit','smsInteractionTags:save','removeTags','unix','toString','server','files','tmp','transcript-%d-%s.zip','join','push','CmContact','Contact','firstName','lastName','Messages','createdAt','direction','SmsAccount','Account','User','Owner','fullname','mkdirSync','Sms','N.A.','closed','format','disposition','out','System','secret','read','value','renderFile','views','.pdf','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','path','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','redis','defaults','./smsInteraction.socket','register','sendStatus','status','json','offset','limit','undefined','count','set','then','destroy','error','stack','name','send','index','map','SmsInteraction','rawAttributes','fieldName','type','getOptions','findAll','params','keys','query','filters','intersection','model','attributes','fields','length','include','merge','options','find','catch','create','body','describe','addMessage','SmsMessage','ids','getMessages','nolimit','order','sort','pick','where'];(function(_0x434c42,_0x4f687b){var _0x272e65=function(_0x5b365c){while(--_0x5b365c){_0x434c42['push'](_0x434c42['shift']());}};_0x272e65(++_0x4f687b);}(_0x3db7,0x11b));var _0x73db=function(_0x2e5b17,_0x48bdf7){_0x2e5b17=_0x2e5b17-0x0;var _0xe93b11=_0x3db7[_0x2e5b17];return _0xe93b11;};'use strict';var rimraf=require(_0x73db('0x0'));var zipdir=require(_0x73db('0x1'));var moment=require(_0x73db('0x2'));var BPromise=require(_0x73db('0x3'));var util=require('util');var path=require(_0x73db('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x73db('0x5'));var Redis=require(_0x73db('0x6'));var interaction=require(_0x73db('0x7'));var qs=require('../../components/parsers/qs');var pdf=require(_0x73db('0x8'));var logger=require(_0x73db('0x9'))('api');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x73db('0xa')]=_[_0x73db('0xb')](config[_0x73db('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x73db('0xa')]));require(_0x73db('0xc'))[_0x73db('0xd')](socket);function respondWithStatusCode(_0x1eb020,_0x1ace48){_0x1ace48=_0x1ace48||0xcc;return function(_0x682513){if(_0x682513){return _0x1eb020[_0x73db('0xe')](_0x1ace48);}return _0x1eb020['status'](_0x1ace48)['end']();};}function respondWithResult(_0x3ef45f,_0x26e968){_0x26e968=_0x26e968||0xc8;return function(_0x444f35){if(_0x444f35){return _0x3ef45f[_0x73db('0xf')](_0x26e968)[_0x73db('0x10')](_0x444f35);}};}function respondWithFilteredResult(_0x11520f,_0x2c73b8){return function(_0x4f44da){if(_0x4f44da){var _0xd850d3=typeof _0x2c73b8[_0x73db('0x11')]==='undefined'&&typeof _0x2c73b8[_0x73db('0x12')]===_0x73db('0x13');var _0x23f03c=_0x4f44da['count'];var _0x155a33=_0xd850d3?0x0:_0x2c73b8[_0x73db('0x11')];var _0x31645d=_0xd850d3?_0x4f44da[_0x73db('0x14')]:_0x2c73b8[_0x73db('0x11')]+_0x2c73b8[_0x73db('0x12')];var _0x1f9872;if(_0x31645d>=_0x23f03c){_0x31645d=_0x23f03c;_0x1f9872=0xc8;}else{_0x1f9872=0xce;}_0x11520f['status'](_0x1f9872);return _0x11520f[_0x73db('0x15')]('Content-Range',_0x155a33+'-'+_0x31645d+'/'+_0x23f03c)[_0x73db('0x10')](_0x4f44da);}return null;};}function saveUpdates(_0x25d24c){return function(_0x3ac43d){if(_0x3ac43d){return _0x3ac43d['update'](_0x25d24c)[_0x73db('0x16')](function(_0x3ba7f0){return _0x3ba7f0;});}return null;};}function removeEntity(_0x3b90fd){return function(_0x5ed022){if(_0x5ed022){return _0x5ed022[_0x73db('0x17')]()['then'](function(){_0x3b90fd[_0x73db('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5aeab0){return function(_0x2c9421){if(!_0x2c9421){_0x5aeab0[_0x73db('0xe')](0x194);}return _0x2c9421;};}function handleError(_0x57bbb6,_0x48b63b){_0x48b63b=_0x48b63b||0x1f4;return function(_0x6e7153){logger[_0x73db('0x18')](_0x6e7153[_0x73db('0x19')]);if(_0x6e7153[_0x73db('0x1a')]){delete _0x6e7153[_0x73db('0x1a')];}_0x57bbb6[_0x73db('0xf')](_0x48b63b)[_0x73db('0x1b')](_0x6e7153);};}exports[_0x73db('0x1c')]=function(_0x4f1d8d,_0x3cfeb5){var _0x5173b1={};var _0x51d6e3=_[_0x73db('0x1d')](db[_0x73db('0x1e')][_0x73db('0x1f')],function(_0x257b06){return{'name':_0x257b06[_0x73db('0x20')],'type':_0x257b06[_0x73db('0x21')]['key']};});_0x5173b1=qs[_0x73db('0x22')](_0x51d6e3,_0x4f1d8d);return interaction[_0x73db('0x23')]('sms',_0x4f1d8d['query'],_0x4f1d8d['user'],_0x5173b1,_0x51d6e3)[_0x73db('0x16')](respondWithFilteredResult(_0x3cfeb5,_0x5173b1))['catch'](handleError(_0x3cfeb5,null));};exports['show']=function(_0xb347b2,_0x11a9d3){var _0x482762={'raw':![],'where':{'id':_0xb347b2[_0x73db('0x24')]['id']}},_0x44e5a8={};_0x44e5a8['model']=_['keys'](db[_0x73db('0x1e')][_0x73db('0x1f')]);_0x44e5a8['query']=_[_0x73db('0x25')](_0xb347b2[_0x73db('0x26')]);_0x44e5a8[_0x73db('0x27')]=_[_0x73db('0x28')](_0x44e5a8[_0x73db('0x29')],_0x44e5a8[_0x73db('0x26')]);_0x482762[_0x73db('0x2a')]=_[_0x73db('0x28')](_0x44e5a8[_0x73db('0x29')],qs[_0x73db('0x2b')](_0xb347b2[_0x73db('0x26')][_0x73db('0x2b')]));_0x482762[_0x73db('0x2a')]=_0x482762[_0x73db('0x2a')][_0x73db('0x2c')]?_0x482762[_0x73db('0x2a')]:_0x44e5a8[_0x73db('0x29')];if(_0xb347b2[_0x73db('0x26')]['includeAll']){_0x482762[_0x73db('0x2d')]=[{'all':!![]}];}_0x482762=_[_0x73db('0x2e')]({},_0x482762,_0xb347b2[_0x73db('0x2f')]);return db[_0x73db('0x1e')][_0x73db('0x30')](_0x482762)['then'](handleEntityNotFound(_0x11a9d3,null))['then'](respondWithResult(_0x11a9d3,null))[_0x73db('0x31')](handleError(_0x11a9d3,null));};exports[_0x73db('0x32')]=function(_0x140a81,_0x569e2c){return db[_0x73db('0x1e')]['create'](_0x140a81[_0x73db('0x33')],{})[_0x73db('0x16')](respondWithResult(_0x569e2c,0xc9))[_0x73db('0x31')](handleError(_0x569e2c,null));};exports['update']=function(_0x4a1a71,_0x419ae3){if(_0x4a1a71[_0x73db('0x33')]['id']){delete _0x4a1a71[_0x73db('0x33')]['id'];}return db['SmsInteraction'][_0x73db('0x30')]({'where':{'id':_0x4a1a71[_0x73db('0x24')]['id']}})[_0x73db('0x16')](handleEntityNotFound(_0x419ae3,null))[_0x73db('0x16')](saveUpdates(_0x4a1a71[_0x73db('0x33')],null))[_0x73db('0x16')](respondWithResult(_0x419ae3,null))[_0x73db('0x31')](handleError(_0x419ae3,null));};exports[_0x73db('0x17')]=function(_0xf11491,_0x1644a0){return db[_0x73db('0x1e')][_0x73db('0x30')]({'where':{'id':_0xf11491[_0x73db('0x24')]['id']}})['then'](handleEntityNotFound(_0x1644a0,null))[_0x73db('0x16')](removeEntity(_0x1644a0,null))[_0x73db('0x31')](handleError(_0x1644a0,null));};exports[_0x73db('0x34')]=function(_0x5b7d44,_0x75c1ea){return db[_0x73db('0x1e')][_0x73db('0x34')]()[_0x73db('0x16')](respondWithResult(_0x75c1ea,null))[_0x73db('0x31')](handleError(_0x75c1ea,null));};exports[_0x73db('0x35')]=function(_0x20a5a9,_0x2c5694){return db[_0x73db('0x36')][_0x73db('0x30')]({'where':{'id':_0x20a5a9[_0x73db('0x24')]['id']}})['then'](handleEntityNotFound(_0x2c5694,null))[_0x73db('0x16')](function(_0x4bb02c){if(_0x4bb02c){return _0x4bb02c['addMessage'](_0x20a5a9[_0x73db('0x33')][_0x73db('0x37')],_['omit'](_0x20a5a9[_0x73db('0x33')],[_0x73db('0x37'),'id'])||{});}})[_0x73db('0x16')](respondWithResult(_0x2c5694,null))[_0x73db('0x31')](handleError(_0x2c5694,null));};exports[_0x73db('0x38')]=function(_0x442ec0,_0xf9b05a){var _0x329ccd={'raw':![],'where':{}};var _0x5024f6={};var _0xd69e8c={'count':0x0,'rows':[]};return db[_0x73db('0x1e')]['findOne']({'where':{'id':_0x442ec0[_0x73db('0x24')]['id']}})['then'](handleEntityNotFound(_0xf9b05a,null))['then'](function(_0x3df55b){if(_0x3df55b){_0x5024f6[_0x73db('0x29')]=_[_0x73db('0x25')](db[_0x73db('0x36')][_0x73db('0x1f')]);_0x5024f6[_0x73db('0x26')]=_[_0x73db('0x25')](_0x442ec0[_0x73db('0x26')]);_0x5024f6[_0x73db('0x27')]=_['intersection'](_0x5024f6['model'],_0x5024f6[_0x73db('0x26')]);_0x329ccd[_0x73db('0x2a')]=_[_0x73db('0x28')](_0x5024f6[_0x73db('0x29')],qs[_0x73db('0x2b')](_0x442ec0['query'][_0x73db('0x2b')]));_0x329ccd[_0x73db('0x2a')]=_0x329ccd[_0x73db('0x2a')]['length']?_0x329ccd[_0x73db('0x2a')]:_0x5024f6[_0x73db('0x29')];if(!_0x442ec0[_0x73db('0x26')]['hasOwnProperty'](_0x73db('0x39'))){_0x329ccd[_0x73db('0x12')]=qs[_0x73db('0x12')](_0x442ec0[_0x73db('0x26')][_0x73db('0x12')]);_0x329ccd[_0x73db('0x11')]=qs[_0x73db('0x11')](_0x442ec0['query'][_0x73db('0x11')]);}_0x329ccd[_0x73db('0x3a')]=qs[_0x73db('0x3b')](_0x442ec0[_0x73db('0x26')][_0x73db('0x3b')]);_0x329ccd['where']=qs[_0x73db('0x27')](_[_0x73db('0x3c')](_0x442ec0['query'],_0x5024f6[_0x73db('0x27')]));_0x329ccd[_0x73db('0x3d')][_0x73db('0x3e')]=_0x3df55b['id'];if(_0x442ec0[_0x73db('0x26')]['filter']){_0x329ccd[_0x73db('0x3d')]=_[_0x73db('0x2e')](_0x329ccd[_0x73db('0x3d')],{'$or':_[_0x73db('0x1d')](_0x329ccd[_0x73db('0x2a')],function(_0x431852){var _0x67d84a={};_0x67d84a[_0x431852]={'$like':'%'+_0x442ec0[_0x73db('0x26')][_0x73db('0x3f')]+'%'};return _0x67d84a;})});}if(_0x442ec0[_0x73db('0x26')][_0x73db('0x40')]){var _0x593084=_0x442ec0['query'][_0x73db('0x40')][_0x73db('0x41')](',');var _0x1280ba={};_0x1280ba[_0x593084[0x0]]={'$gte':moment(_0x593084[0x1])['format'](_0x73db('0x42'))};_0x329ccd[_0x73db('0x3d')]=_['merge'](_0x329ccd[_0x73db('0x3d')],_0x1280ba);}_0x329ccd=_[_0x73db('0x2e')]({},_0x329ccd,_0x442ec0[_0x73db('0x2f')]);return db[_0x73db('0x36')][_0x73db('0x14')]({'where':_0x329ccd[_0x73db('0x3d')]})[_0x73db('0x16')](function(_0x576aff){_0xd69e8c[_0x73db('0x14')]=_0x576aff;if(_0x442ec0[_0x73db('0x26')][_0x73db('0x43')]){_0x329ccd[_0x73db('0x2d')]=[{'all':!![]}];}return db[_0x73db('0x36')][_0x73db('0x23')](_0x329ccd);})['then'](function(_0x2d37f1){_0xd69e8c['rows']=_0x2d37f1;return _0xd69e8c;});}})[_0x73db('0x16')](respondWithFilteredResult(_0xf9b05a,_0x329ccd))[_0x73db('0x31')](handleError(_0xf9b05a,null));};exports[_0x73db('0x44')]=function(_0xae3cb3,_0x5ddea0){return db[_0x73db('0x1e')][_0x73db('0x30')]({'where':{'id':_0xae3cb3[_0x73db('0x24')]['id']}})[_0x73db('0x16')](handleEntityNotFound(_0x5ddea0,null))[_0x73db('0x16')](function(_0x16e2fe){if(_0x16e2fe){return _0x16e2fe[_0x73db('0x45')](_0xae3cb3[_0x73db('0x33')][_0x73db('0x37')],_[_0x73db('0x46')](_0xae3cb3['body'],[_0x73db('0x37'),'id'])||{})[_0x73db('0x47')](function(){return db[_0x73db('0x48')][_0x73db('0x23')]({'attributes':['id','name',_0x73db('0x49')],'where':{'id':_0xae3cb3['body'][_0x73db('0x37')]}});})[_0x73db('0x16')](function(_0x55cf5c){socket[_0x73db('0x4a')](_0x73db('0x4b'),{'id':Number(_0xae3cb3[_0x73db('0x24')]['id']),'tags':_0x55cf5c||[]});return{'id':Number(_0xae3cb3[_0x73db('0x24')]['id']),'tags':_0x55cf5c||[]};});}})[_0x73db('0x16')](respondWithResult(_0x5ddea0,null))['catch'](handleError(_0x5ddea0,null));};exports[_0x73db('0x4c')]=function(_0x296eca,_0x2cd8f1){return db[_0x73db('0x1e')][_0x73db('0x30')]({'where':{'id':_0x296eca['params']['id']}})[_0x73db('0x16')](handleEntityNotFound(_0x2cd8f1,null))[_0x73db('0x16')](function(_0x57b2a1){if(_0x57b2a1){return _0x57b2a1[_0x73db('0x4c')](_0x296eca[_0x73db('0x26')]['ids']);}})[_0x73db('0x16')](respondWithStatusCode(_0x2cd8f1,null))[_0x73db('0x31')](handleError(_0x2cd8f1,null));};exports['download']=function(_0x579991,_0x472c6c){var _0x4fb3c7=moment()[_0x73db('0x4d')]()[_0x73db('0x4e')]();var _0x337714=path['join'](config['root'],_0x73db('0x4f'),_0x73db('0x50'),_0x73db('0x51'));var _0x26993b=path['join'](_0x337714,_0x4fb3c7);var _0x573baa=util['format'](_0x73db('0x52'),_0x579991[_0x73db('0x24')]['id'],_0x4fb3c7);var _0x4fa2cb=path[_0x73db('0x53')](_0x337714,_0x573baa);var _0x598fbb=[];_0x598fbb[_0x73db('0x54')]({'model':db['User'],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x598fbb[_0x73db('0x54')]({'model':db[_0x73db('0x55')],'as':_0x73db('0x56'),'attributes':['id',_0x73db('0x57'),_0x73db('0x58')],'raw':!![]});var _0x48a17f=[{'model':db[_0x73db('0x36')],'as':_0x73db('0x59'),'attributes':['id',_0x73db('0x33'),_0x73db('0x5a'),_0x73db('0x5b'),'secret','read'],'include':_0x598fbb}];_0x48a17f[_0x73db('0x54')]({'model':db[_0x73db('0x5c')],'as':_0x73db('0x5d'),'attributes':['id','name']});_0x48a17f[_0x73db('0x54')]({'model':db[_0x73db('0x5e')],'as':_0x73db('0x5f'),'attributes':['id',_0x73db('0x60')]});return db[_0x73db('0x1e')][_0x73db('0x30')]({'where':{'id':_0x579991[_0x73db('0x24')]['id']},'include':_0x48a17f})[_0x73db('0x16')](handleEntityNotFound(_0x472c6c,null))[_0x73db('0x16')](function(_0x489ed7){if(_0x489ed7){var _0x3ae2f3=_0x489ed7['get']({'plain':!![]});fs[_0x73db('0x61')](_0x26993b);var _0x53d61d={'channel':_0x73db('0x62'),'account':_0x3ae2f3[_0x73db('0x5d')]['name'],'agent':_0x3ae2f3[_0x73db('0x5f')]?_0x3ae2f3[_0x73db('0x5f')][_0x73db('0x60')]:_0x73db('0x63'),'createdAt':moment(_0x3ae2f3[_0x73db('0x5a')])['format'](_0x73db('0x42'))['toString'](),'closedAt':_0x3ae2f3[_0x73db('0x64')]?moment(_0x3ae2f3['closedAt'])[_0x73db('0x65')](_0x73db('0x42'))['toString']():'','disposition':_0x3ae2f3[_0x73db('0x66')],'messages':_(_0x3ae2f3['Messages'])[_0x73db('0x3f')]({'secret':![]})[_0x73db('0x1d')](function(_0x5a2dea){return{'date':moment(_0x5a2dea[_0x73db('0x5a')])[_0x73db('0x65')](_0x73db('0x42'))['toString'](),'sender':_0x5a2dea[_0x73db('0x5b')]===_0x73db('0x67')?_0x5a2dea['User']?_0x5a2dea['User'][_0x73db('0x60')]:_0x73db('0x68'):_0x5a2dea[_0x73db('0x56')]['firstName']+(_0x5a2dea[_0x73db('0x56')]['lastName']?'\x20'+_0x5a2dea['Contact'][_0x73db('0x58')]:''),'body':_0x5a2dea['body'],'direction':_0x5a2dea[_0x73db('0x5b')]===_0x73db('0x67')?'A':'C','secret':_0x5a2dea[_0x73db('0x69')],'read':_0x5a2dea[_0x73db('0x6a')]};})[_0x73db('0x6b')]()};return ejs[_0x73db('0x6c')](path[_0x73db('0x53')](config['root'],_0x73db('0x4f'),_0x73db('0x6d'),'downloadInteraction.ejs'),{'interaction':_0x53d61d})[_0x73db('0x16')](function(_0x4f2a42){var _0x36d3a7=path[_0x73db('0x53')](_0x26993b,'transcript-'+_0x3ae2f3['id']+'-'+_0x4fb3c7+_0x73db('0x6e'));var _0x19645b={'path':_0x36d3a7,'channel':'Sms','interactionId':_0x3ae2f3['id']};return pdf[_0x73db('0x6f')](_0x4f2a42,_0x19645b);})[_0x73db('0x16')](function(){return new BPromise(function(_0x10ef8d,_0x427641){zipdir(_0x26993b,{'saveTo':_0x4fa2cb},function(_0x21581f,_0x3e22fe){if(_0x21581f)return _0x427641(_0x21581f);return _0x10ef8d(_0x3e22fe);});})[_0x73db('0x16')](function(){return new BPromise(function(_0x44edfd,_0x5bd53c){rimraf(_0x26993b,function(_0x275ef){if(_0x275ef)_0x5bd53c(_0x275ef);return _0x44edfd();});});})[_0x73db('0x16')](function(){return _0x472c6c['download'](_0x4fa2cb,_0x573baa,function(_0x2b5d37){if(_0x2b5d37){console[_0x73db('0x70')](_0x73db('0x71'),_0x2b5d37);}else{fs[_0x73db('0x72')](_0x4fa2cb);}});});});}else{return _0x472c6c[_0x73db('0xe')](0xc8);}})[_0x73db('0x31')](handleError(_0x472c6c,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 5e16f93..f38bd68 100644 --- a/server/api/smsInteraction/smsInteraction.events.js +++ b/server/api/smsInteraction/smsInteraction.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['update','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','exports','../../mysqldb','SmsMessage','setMaxListeners','save'];(function(_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 +var _0x6a55=['setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','exports','events','SmsMessage','update','getUsers','then'];(function(_0x1e3649,_0x3f8f9d){var _0xaa4447=function(_0x5a66a4){while(--_0x5a66a4){_0x1e3649['push'](_0x1e3649['shift']());}};_0xaa4447(++_0x3f8f9d);}(_0x6a55,0xdb));var _0x56a5=function(_0x44b0de,_0x213afa){_0x44b0de=_0x44b0de-0x0;var _0x21da2a=_0x6a55[_0x44b0de];return _0x21da2a;};'use strict';var EventEmitter=require(_0x56a5('0x0'));var SmsInteraction=require('../../mysqldb')['db']['SmsInteraction'];var SmsMessage=require('../../mysqldb')['db'][_0x56a5('0x1')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x56a5('0x2'),'afterDestroy':'remove'};function emitEvent(_0x3ff76a){return function(_0x5171fa,_0x28bb2b,_0x380b1b){_0x5171fa[_0x56a5('0x3')]({'attributes':['id'],'raw':!![]})[_0x56a5('0x4')](function(_0x444c65){_0x5171fa[_0x56a5('0x5')](_0x56a5('0x6'),_0x444c65[_0x56a5('0x7')](function(_0x586f7a){return{'id':_0x586f7a['id']};}));return SmsMessage[_0x56a5('0x8')]({'where':{'SmsInteractionId':_0x5171fa['id'],'direction':'in','read':![]},'raw':!![]});})[_0x56a5('0x4')](function(_0x3c8283){_0x5171fa[_0x56a5('0x5')](_0x56a5('0x9'),_0x3c8283[_0x56a5('0xa')]);SmsInteractionEvents[_0x56a5('0xb')](_0x3ff76a+':'+_0x5171fa['id'],_0x5171fa);SmsInteractionEvents[_0x56a5('0xb')](_0x3ff76a,_0x5171fa);_0x380b1b(null);})[_0x56a5('0xc')](_0x380b1b(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x56a5('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 82aa082..572d1d1 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 _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 +var _0xa391=['YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','changed','closedAt','format'];(function(_0x33b0cd,_0x42b288){var _0x43e151=function(_0x5d6c8c){while(--_0x5d6c8c){_0x33b0cd['push'](_0x33b0cd['shift']());}};_0x43e151(++_0x42b288);}(_0xa391,0xf8));var _0x1a39=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0xa391[_0x4792c8];return _0x35edb1;};'use strict';var _=require(_0x1a39('0x0'));var util=require(_0x1a39('0x1'));var logger=require(_0x1a39('0x2'))(_0x1a39('0x3'));var moment=require(_0x1a39('0x4'));var BPromise=require(_0x1a39('0x5'));var rp=require(_0x1a39('0x6'));var fs=require('fs');var path=require(_0x1a39('0x7'));var rimraf=require(_0x1a39('0x8'));var config=require(_0x1a39('0x9'));var attributes=require(_0x1a39('0xa'));module[_0x1a39('0xb')]=function(_0xc94ad8,_0x4d815a){return _0xc94ad8[_0x1a39('0xc')](_0x1a39('0xd'),attributes,{'tableName':_0x1a39('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1a4c45,_0x2b6460,_0x1ffa11){if(_0x1a4c45[_0x1a39('0xf')]('closed')){_0x1a4c45[_0x1a39('0x10')]=moment()[_0x1a39('0x11')](_0x1a39('0x12'));}_0x1ffa11(null,_0x1a4c45);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 6c5f6d7..78ff584 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 _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 +var _0xb305=['./smsInteraction.socket','register','request','then','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','UpdateSmsInteraction','SmsInteraction','update','options','raw','attributes','limit','AddTagsToSmsInteraction','find','where','body','ids','AddTags','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x14c3b0,_0x5679cd){var _0x25c604=function(_0x560169){while(--_0x560169){_0x14c3b0['push'](_0x14c3b0['shift']());}};_0x25c604(++_0x5679cd);}(_0xb305,0xf8));var _0x5b30=function(_0x3e3867,_0x8c7b99){_0x3e3867=_0x3e3867-0x0;var _0x3325d6=_0xb305[_0x3e3867];return _0x3325d6;};'use strict';var _=require(_0x5b30('0x0'));var util=require(_0x5b30('0x1'));var moment=require(_0x5b30('0x2'));var BPromise=require(_0x5b30('0x3'));var rs=require(_0x5b30('0x4'));var fs=require('fs');var Redis=require(_0x5b30('0x5'));var db=require(_0x5b30('0x6'))['db'];var utils=require(_0x5b30('0x7'));var logger=require('../../config/logger')(_0x5b30('0x8'));var config=require(_0x5b30('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5b30('0xa')][_0x5b30('0xb')]({'port':0x232a});config[_0x5b30('0xc')]=_[_0x5b30('0xd')](config['redis'],{'host':_0x5b30('0xe'),'port':0x18eb});var socket=require(_0x5b30('0xf'))(new Redis(config['redis']));require(_0x5b30('0x10'))[_0x5b30('0x11')](socket);function respondWithRpcPromise(_0x1263cc,_0x1b9d29,_0xeeb495){return new BPromise(function(_0x136806,_0x5bc184){return client[_0x5b30('0x12')](_0x1263cc,_0xeeb495)[_0x5b30('0x13')](function(_0x112249){logger['info'](_0x5b30('0x14'),_0x1b9d29,'request\x20sent');logger[_0x5b30('0x15')](_0x5b30('0x16'),_0x1b9d29,_0x5b30('0x17'),JSON['stringify'](_0x112249));if(_0x112249['error']){if(_0x112249[_0x5b30('0x18')][_0x5b30('0x19')]===0x1f4){logger[_0x5b30('0x18')](_0x5b30('0x14'),_0x1b9d29,_0x112249['error'][_0x5b30('0x1a')]);return _0x5bc184(_0x112249[_0x5b30('0x18')][_0x5b30('0x1a')]);}logger['error'](_0x5b30('0x14'),_0x1b9d29,_0x112249[_0x5b30('0x18')][_0x5b30('0x1a')]);return _0x136806(_0x112249['error'][_0x5b30('0x1a')]);}else{logger[_0x5b30('0x1b')](_0x5b30('0x14'),_0x1b9d29,_0x5b30('0x17'));_0x136806(_0x112249[_0x5b30('0x1c')][_0x5b30('0x1a')]);}})[_0x5b30('0x1d')](function(_0x51c121){logger[_0x5b30('0x18')](_0x5b30('0x14'),_0x1b9d29,_0x51c121);_0x5bc184(_0x51c121);});});}exports[_0x5b30('0x1e')]=function(_0x27c800){var _0xb61018=this;return new Promise(function(_0x41d57c,_0x231fbd){return db[_0x5b30('0x1f')][_0x5b30('0x20')](_0x27c800['body'],{'raw':_0x27c800['options']?_0x27c800[_0x5b30('0x21')][_0x5b30('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x27c800[_0x5b30('0x21')]?_0x27c800['options']['where']||null:null,'attributes':_0x27c800[_0x5b30('0x21')]?_0x27c800[_0x5b30('0x21')][_0x5b30('0x23')]||null:null,'limit':_0x27c800[_0x5b30('0x21')]?_0x27c800['options'][_0x5b30('0x24')]||null:null})[_0x5b30('0x13')](function(_0x90dfd6){logger['info'](_0x5b30('0x1e'),_0x27c800);logger[_0x5b30('0x15')](_0x5b30('0x1e'),_0x27c800,JSON['stringify'](_0x90dfd6));_0x41d57c(_0x90dfd6);})[_0x5b30('0x1d')](function(_0x3a5ebe){logger[_0x5b30('0x18')](_0x5b30('0x1e'),_0x3a5ebe[_0x5b30('0x1a')],_0x27c800);_0x231fbd(_0xb61018[_0x5b30('0x18')](0x1f4,_0x3a5ebe[_0x5b30('0x1a')]));});});};exports[_0x5b30('0x25')]=function(_0x282fc9){return new Promise(function(_0xde44c5,_0x4e7e99){return db[_0x5b30('0x1f')][_0x5b30('0x26')]({'where':_0x282fc9[_0x5b30('0x21')]?_0x282fc9[_0x5b30('0x21')][_0x5b30('0x27')]||null:null})[_0x5b30('0x13')](function(_0x53f862){if(_0x53f862){return _0x53f862['addTags'](_0x282fc9[_0x5b30('0x28')][_0x5b30('0x29')],_['omit'](_0x282fc9[_0x5b30('0x28')],['ids','id'])||{});}})['spread'](function(_0xe3f7f6){logger['info'](_0x5b30('0x2a'),_0x282fc9);logger['debug'](_0x5b30('0x2a'),_0x282fc9,JSON[_0x5b30('0x2b')](_0xe3f7f6));_0xde44c5(_0xe3f7f6);})[_0x5b30('0x1d')](function(_0x2a83a7){logger[_0x5b30('0x18')]('AddTags',_0x2a83a7[_0x5b30('0x1a')],_0x282fc9);_0x4e7e99(_this[_0x5b30('0x18')](0x1f4,_0x2a83a7[_0x5b30('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 243e034..f0063c1 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 _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 +var _0x976b=['length','smsInteraction:','./smsInteraction.events','save','remove','update','emit','removeListener'];(function(_0x413c6b,_0xb5e74f){var _0xfe98d=function(_0xb49043){while(--_0xb49043){_0x413c6b['push'](_0x413c6b['shift']());}};_0xfe98d(++_0xb5e74f);}(_0x976b,0x1f2));var _0xb976=function(_0x5c52e6,_0x267012){_0x5c52e6=_0x5c52e6-0x0;var _0x25c3f9=_0x976b[_0x5c52e6];return _0x25c3f9;};'use strict';var SmsInteractionEvents=require(_0xb976('0x0'));var events=[_0xb976('0x1'),_0xb976('0x2'),_0xb976('0x3')];function createListener(_0x4b53b9,_0x1332b1){return function(_0x1b233d){_0x1332b1[_0xb976('0x4')](_0x4b53b9,_0x1b233d);};}function removeListener(_0x2d6d69,_0x5e3367){return function(){SmsInteractionEvents[_0xb976('0x5')](_0x2d6d69,_0x5e3367);};}exports['register']=function(_0x871317){for(var _0x1016d6=0x0,_0x3e7df4=events[_0xb976('0x6')];_0x1016d6<_0x3e7df4;_0x1016d6++){var _0x16954d=events[_0x1016d6];var _0x50c9c7=createListener(_0xb976('0x7')+_0x16954d,_0x871317);SmsInteractionEvents['on'](_0x16954d,_0x50c9c7);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 254fe64..94a71ce 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 _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 +var _0xe12d=['tracked','sms','smsmessage:create','create','/:id/status','status','put','update','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x3337b6,_0x42c7f9){var _0x568270=function(_0x56e5df){while(--_0x56e5df){_0x3337b6['push'](_0x3337b6['shift']());}};_0x568270(++_0x42c7f9);}(_0xe12d,0xc8));var _0xde12=function(_0x535bf4,_0x486a15){_0x535bf4=_0x535bf4-0x0;var _0x2d2885=_0xe12d[_0x535bf4];return _0x2d2885;};'use strict';var multer=require(_0xde12('0x0'));var util=require(_0xde12('0x1'));var path=require(_0xde12('0x2'));var timeout=require(_0xde12('0x3'));var express=require(_0xde12('0x4'));var router=express[_0xde12('0x5')]();var fs_extra=require(_0xde12('0x6'));var auth=require(_0xde12('0x7'));var interaction=require(_0xde12('0x8'));var config=require('../../config/environment');var controller=require('./smsMessage.controller');router[_0xde12('0x9')]('/',auth[_0xde12('0xa')](),controller[_0xde12('0xb')]);router[_0xde12('0x9')](_0xde12('0xc'),auth[_0xde12('0xa')](),controller[_0xde12('0xd')]);router['get'](_0xde12('0xe'),auth['isAuthenticated'](),controller[_0xde12('0xf')]);router[_0xde12('0x10')]('/',auth[_0xde12('0xa')](),interaction[_0xde12('0x11')](_0xde12('0x12'),_0xde12('0x13')),controller[_0xde12('0x14')]);router['post'](_0xde12('0x15'),controller[_0xde12('0x16')]);router[_0xde12('0x17')](_0xde12('0xe'),auth[_0xde12('0xa')](),controller[_0xde12('0x18')]);router[_0xde12('0x17')]('/:id/accept',auth[_0xde12('0xa')](),controller[_0xde12('0x19')]);router[_0xde12('0x17')](_0xde12('0x1a'),auth['isAuthenticated'](),controller[_0xde12('0x1b')]);router[_0xde12('0x1c')](_0xde12('0xe'),auth[_0xde12('0xa')](),controller[_0xde12('0x1d')]);module[_0xde12('0x1e')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 4e1ef54..5b62fda 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 _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 +var _0xa243=['sequelize','exports','medium','BOOLEAN','out','STRING','TEXT'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0xa243,0x19d));var _0x3a24=function(_0x4f3431,_0x2b8f01){_0x4f3431=_0x4f3431-0x0;var _0x19c313=_0xa243[_0x4f3431];return _0x19c313;};'use strict';var Sequelize=require(_0x3a24('0x0'));module[_0x3a24('0x1')]={'body':{'type':Sequelize['TEXT'](_0x3a24('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x3a24('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x3a24('0x4')),'defaultValue':_0x3a24('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x3a24('0x5')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x3a24('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x3a24('0x5')]},'providerResponse':{'type':Sequelize[_0x3a24('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 0d6c409..349fc2a 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 _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 +var _0xc6c0=['interaction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','delivered','Status','plivio','results','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./smsMessage.socket','jayson/promise','client','http','request','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','end','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','VIRTUAL','options','include','findAll','rows','show','params','includeAll','merge','find','create','body','update','describe','sms-interactions','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','SmsInteraction','get','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','contact','User','email','internal','manual','interface','channel','motionChannel','event','EventManager','acceptmessage','SmsInteractionId'];(function(_0x41059a,_0x4df43f){var _0x574108=function(_0x41880a){while(--_0x41880a){_0x41059a['push'](_0x41059a['shift']());}};_0x574108(++_0x4df43f);}(_0xc6c0,0x13e));var _0x0c6c=function(_0x4d1ee9,_0x394a78){_0x4d1ee9=_0x4d1ee9-0x0;var _0x9a5456=_0xc6c0[_0x4d1ee9];return _0x9a5456;};'use strict';var emlformat=require(_0x0c6c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0c6c('0x1'));var jsonpatch=require(_0x0c6c('0x2'));var rp=require(_0x0c6c('0x3'));var moment=require(_0x0c6c('0x4'));var BPromise=require(_0x0c6c('0x5'));var Mustache=require(_0x0c6c('0x6'));var util=require(_0x0c6c('0x7'));var path=require(_0x0c6c('0x8'));var sox=require(_0x0c6c('0x9'));var csv=require(_0x0c6c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0c6c('0xb'));var squel=require(_0x0c6c('0xc'));var crypto=require(_0x0c6c('0xd'));var jsforce=require(_0x0c6c('0xe'));var deskjs=require(_0x0c6c('0xf'));var toCsv=require(_0x0c6c('0xa'));var querystring=require(_0x0c6c('0x10'));var Papa=require(_0x0c6c('0x11'));var Redis=require(_0x0c6c('0x12'));var authService=require(_0x0c6c('0x13'));var qs=require(_0x0c6c('0x14'));var as=require(_0x0c6c('0x15'));var hardwareService=require(_0x0c6c('0x16'));var logger=require(_0x0c6c('0x17'))(_0x0c6c('0x18'));var utils=require('../../config/utils');var config=require(_0x0c6c('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x0c6c('0x1a'))['db'];config[_0x0c6c('0x1b')]=_['defaults'](config[_0x0c6c('0x1b')],{'host':_0x0c6c('0x1c'),'port':0x18eb});var socket=require(_0x0c6c('0x1d'))(new Redis(config[_0x0c6c('0x1b')]));require(_0x0c6c('0x1e'))['register'](socket);var jayson=require(_0x0c6c('0x1f'));var client=jayson[_0x0c6c('0x20')][_0x0c6c('0x21')]({'port':0x232c});var client9002=jayson[_0x0c6c('0x20')][_0x0c6c('0x21')]({'port':0x232a});function respondWithRpcPromise(_0xe9545e,_0x2a8819,_0x576156,_0x2d635c){return new BPromise(function(_0x527ade,_0x5300a7){var _0x502597=_0x2d635c||client;return _0x502597[_0x0c6c('0x22')](_0xe9545e,_0x576156)['then'](function(_0x9463e8){logger['info'](_0x0c6c('0x23'),_0x2a8819,_0x0c6c('0x24'));logger[_0x0c6c('0x25')](_0x0c6c('0x26'),_0x2a8819,'request\x20sent',JSON[_0x0c6c('0x27')](_0x9463e8));if(_0x9463e8[_0x0c6c('0x28')]){if(_0x9463e8[_0x0c6c('0x28')][_0x0c6c('0x29')]===0x1f4){logger[_0x0c6c('0x28')](_0x0c6c('0x23'),_0x2a8819,_0x9463e8[_0x0c6c('0x28')][_0x0c6c('0x2a')]);return _0x5300a7(_0x9463e8[_0x0c6c('0x28')]['message']);}logger[_0x0c6c('0x28')](_0x0c6c('0x23'),_0x2a8819,_0x9463e8[_0x0c6c('0x28')]['message']);return _0x527ade(_0x9463e8[_0x0c6c('0x28')]['message']);}else{logger[_0x0c6c('0x2b')](_0x0c6c('0x23'),_0x2a8819,_0x0c6c('0x24'));_0x527ade(_0x9463e8['result'][_0x0c6c('0x2a')]);}})[_0x0c6c('0x2c')](function(_0x200a47){logger[_0x0c6c('0x28')](_0x0c6c('0x23'),_0x2a8819,_0x200a47);_0x5300a7(_0x200a47);});});}function respondWithStatusCode(_0xe74a25,_0x8c5dcc){_0x8c5dcc=_0x8c5dcc||0xcc;return function(_0x2ebd25){if(_0x2ebd25){return _0xe74a25[_0x0c6c('0x2d')](_0x8c5dcc);}return _0xe74a25[_0x0c6c('0x2e')](_0x8c5dcc)['end']();};}function respondWithResult(_0x194b59,_0x557046){_0x557046=_0x557046||0xc8;return function(_0x29ec5d){if(_0x29ec5d){return _0x194b59['status'](_0x557046)[_0x0c6c('0x2f')](_0x29ec5d);}};}function respondWithFilteredResult(_0x45fcad,_0x184252){return function(_0xba7b3){if(_0xba7b3){var _0x2cbfc7=typeof _0x184252[_0x0c6c('0x30')]===_0x0c6c('0x31')&&typeof _0x184252[_0x0c6c('0x32')]==='undefined';var _0x452d93=_0xba7b3[_0x0c6c('0x33')];var _0x5ec5bc=_0x2cbfc7?0x0:_0x184252[_0x0c6c('0x30')];var _0x556dad=_0x2cbfc7?_0xba7b3[_0x0c6c('0x33')]:_0x184252[_0x0c6c('0x30')]+_0x184252[_0x0c6c('0x32')];var _0xb2a3a2;if(_0x556dad>=_0x452d93){_0x556dad=_0x452d93;_0xb2a3a2=0xc8;}else{_0xb2a3a2=0xce;}_0x45fcad[_0x0c6c('0x2e')](_0xb2a3a2);return _0x45fcad[_0x0c6c('0x34')](_0x0c6c('0x35'),_0x5ec5bc+'-'+_0x556dad+'/'+_0x452d93)[_0x0c6c('0x2f')](_0xba7b3);}return null;};}function patchUpdates(_0x391308){return function(_0x52c1ae){try{jsonpatch['apply'](_0x52c1ae,_0x391308,!![]);}catch(_0x296f23){return BPromise[_0x0c6c('0x36')](_0x296f23);}return _0x52c1ae[_0x0c6c('0x37')]();};}function saveUpdates(_0x3becfb,_0x388363){return function(_0x86c911){if(_0x86c911){return _0x86c911['update'](_0x3becfb)[_0x0c6c('0x38')](function(_0x56a733){return _0x56a733;});}return null;};}function removeEntity(_0x184110,_0x538a34){return function(_0x28bdc6){if(_0x28bdc6){return _0x28bdc6[_0x0c6c('0x39')]()['then'](function(){_0x184110['status'](0xcc)[_0x0c6c('0x3a')]();});}};}function handleEntityNotFound(_0x115d24,_0x1154f6){return function(_0x3cda2b){if(!_0x3cda2b){_0x115d24['sendStatus'](0x194);}return _0x3cda2b;};}function handleError(_0xbce627,_0x1f5099){_0x1f5099=_0x1f5099||0x1f4;return function(_0x49e05d){logger[_0x0c6c('0x28')](_0x49e05d[_0x0c6c('0x3b')]);if(_0x49e05d[_0x0c6c('0x3c')]){delete _0x49e05d['name'];}_0xbce627[_0x0c6c('0x2e')](_0x1f5099)[_0x0c6c('0x3d')](_0x49e05d);};}exports[_0x0c6c('0x3e')]=function(_0x93e98a,_0x417549){var _0x18ede9={},_0x3f675c={},_0x3eb8e6={'count':0x0,'rows':[]};var _0x3b5cc1=_[_0x0c6c('0x3f')](db[_0x0c6c('0x40')][_0x0c6c('0x41')],function(_0x3514a0){return{'name':_0x3514a0[_0x0c6c('0x42')],'type':_0x3514a0[_0x0c6c('0x43')][_0x0c6c('0x44')]};});_0x3f675c[_0x0c6c('0x45')]=_[_0x0c6c('0x3f')](_0x3b5cc1,_0x0c6c('0x3c'));_0x3f675c[_0x0c6c('0x46')]=_[_0x0c6c('0x47')](_0x93e98a[_0x0c6c('0x46')]);_0x3f675c[_0x0c6c('0x48')]=_[_0x0c6c('0x49')](_0x3f675c[_0x0c6c('0x45')],_0x3f675c[_0x0c6c('0x46')]);_0x18ede9['attributes']=_[_0x0c6c('0x49')](_0x3f675c[_0x0c6c('0x45')],qs['fields'](_0x93e98a[_0x0c6c('0x46')][_0x0c6c('0x4a')]));_0x18ede9[_0x0c6c('0x4b')]=_0x18ede9[_0x0c6c('0x4b')][_0x0c6c('0x4c')]?_0x18ede9[_0x0c6c('0x4b')]:_0x3f675c[_0x0c6c('0x45')];if(!_0x93e98a['query']['hasOwnProperty'](_0x0c6c('0x4d'))){_0x18ede9[_0x0c6c('0x32')]=qs[_0x0c6c('0x32')](_0x93e98a[_0x0c6c('0x46')][_0x0c6c('0x32')]);_0x18ede9['offset']=qs[_0x0c6c('0x30')](_0x93e98a[_0x0c6c('0x46')][_0x0c6c('0x30')]);}_0x18ede9[_0x0c6c('0x4e')]=qs[_0x0c6c('0x4f')](_0x93e98a[_0x0c6c('0x46')][_0x0c6c('0x4f')]);_0x18ede9['where']=qs[_0x0c6c('0x48')](_[_0x0c6c('0x50')](_0x93e98a['query'],_0x3f675c[_0x0c6c('0x48')]),_0x3b5cc1);if(_0x93e98a['query'][_0x0c6c('0x51')]){_0x18ede9[_0x0c6c('0x52')]=_['merge'](_0x18ede9[_0x0c6c('0x52')],{'$or':_[_0x0c6c('0x3f')](_0x3b5cc1,function(_0xe19c29){if(_0xe19c29['type']!==_0x0c6c('0x53')){var _0x11c599={};_0x11c599[_0xe19c29[_0x0c6c('0x3c')]]={'$like':'%'+_0x93e98a[_0x0c6c('0x46')]['filter']+'%'};return _0x11c599;}})});}_0x18ede9=_['merge']({},_0x18ede9,_0x93e98a[_0x0c6c('0x54')]);var _0xe6d70e={'where':_0x18ede9[_0x0c6c('0x52')]};return db[_0x0c6c('0x40')][_0x0c6c('0x33')](_0xe6d70e)[_0x0c6c('0x38')](function(_0x325f52){_0x3eb8e6[_0x0c6c('0x33')]=_0x325f52;if(_0x93e98a[_0x0c6c('0x46')]['includeAll']){_0x18ede9[_0x0c6c('0x55')]=[{'all':!![]}];}return db[_0x0c6c('0x40')][_0x0c6c('0x56')](_0x18ede9);})[_0x0c6c('0x38')](function(_0x336c39){_0x3eb8e6[_0x0c6c('0x57')]=_0x336c39;return _0x3eb8e6;})[_0x0c6c('0x38')](respondWithFilteredResult(_0x417549,_0x18ede9))[_0x0c6c('0x2c')](handleError(_0x417549,null));};exports[_0x0c6c('0x58')]=function(_0x17d5f2,_0x5d2435){var _0x8f60fb={'raw':!![],'where':{'id':_0x17d5f2[_0x0c6c('0x59')]['id']}},_0x278c22={};_0x278c22['model']=_[_0x0c6c('0x47')](db[_0x0c6c('0x40')][_0x0c6c('0x41')]);_0x278c22['query']=_[_0x0c6c('0x47')](_0x17d5f2[_0x0c6c('0x46')]);_0x278c22[_0x0c6c('0x48')]=_[_0x0c6c('0x49')](_0x278c22['model'],_0x278c22[_0x0c6c('0x46')]);_0x8f60fb['attributes']=_[_0x0c6c('0x49')](_0x278c22[_0x0c6c('0x45')],qs[_0x0c6c('0x4a')](_0x17d5f2[_0x0c6c('0x46')]['fields']));_0x8f60fb[_0x0c6c('0x4b')]=_0x8f60fb[_0x0c6c('0x4b')][_0x0c6c('0x4c')]?_0x8f60fb['attributes']:_0x278c22[_0x0c6c('0x45')];if(_0x17d5f2[_0x0c6c('0x46')][_0x0c6c('0x5a')]){_0x8f60fb['include']=[{'all':!![]}];}_0x8f60fb=_[_0x0c6c('0x5b')]({},_0x8f60fb,_0x17d5f2[_0x0c6c('0x54')]);return db[_0x0c6c('0x40')][_0x0c6c('0x5c')](_0x8f60fb)[_0x0c6c('0x38')](handleEntityNotFound(_0x5d2435,null))[_0x0c6c('0x38')](respondWithResult(_0x5d2435,null))[_0x0c6c('0x2c')](handleError(_0x5d2435,null));};exports[_0x0c6c('0x5d')]=function(_0x50494f,_0x15ffbc){return db[_0x0c6c('0x40')][_0x0c6c('0x5d')](_0x50494f[_0x0c6c('0x5e')],{})['then'](respondWithResult(_0x15ffbc,0xc9))[_0x0c6c('0x2c')](handleError(_0x15ffbc,null));};exports[_0x0c6c('0x5f')]=function(_0x8ecb5a,_0x2e83c4){if(_0x8ecb5a['body']['id']){delete _0x8ecb5a[_0x0c6c('0x5e')]['id'];}return db[_0x0c6c('0x40')]['find']({'where':{'id':_0x8ecb5a[_0x0c6c('0x59')]['id']}})[_0x0c6c('0x38')](handleEntityNotFound(_0x2e83c4,null))[_0x0c6c('0x38')](saveUpdates(_0x8ecb5a[_0x0c6c('0x5e')],null))[_0x0c6c('0x38')](respondWithResult(_0x2e83c4,null))[_0x0c6c('0x2c')](handleError(_0x2e83c4,null));};exports['destroy']=function(_0x305462,_0x1a02db){return db[_0x0c6c('0x40')][_0x0c6c('0x5c')]({'where':{'id':_0x305462[_0x0c6c('0x59')]['id']}})[_0x0c6c('0x38')](handleEntityNotFound(_0x1a02db,null))[_0x0c6c('0x38')](removeEntity(_0x1a02db,null))[_0x0c6c('0x2c')](handleError(_0x1a02db,null));};exports[_0x0c6c('0x60')]=function(_0x465412,_0x246e9d){return db[_0x0c6c('0x40')][_0x0c6c('0x60')]()[_0x0c6c('0x38')](respondWithResult(_0x246e9d,null))[_0x0c6c('0x2c')](handleError(_0x246e9d,null));};var interaction_log=require('../../config/logger')(_0x0c6c('0x61'));exports['accept']=function(_0x420d8e,_0x45e962,_0x4dfea9){var _0x3ceed1={'agent':{},'channel':'sms'};if(_0x420d8e[_0x0c6c('0x5e')]['id']){delete _0x420d8e[_0x0c6c('0x5e')]['id'];}_0x420d8e[_0x0c6c('0x5e')][_0x0c6c('0x62')]=!![];_0x420d8e[_0x0c6c('0x5e')][_0x0c6c('0x63')]=moment()[_0x0c6c('0x64')](_0x0c6c('0x65'));_0x420d8e[_0x0c6c('0x5e')]['UserId']=_0x420d8e[_0x0c6c('0x5e')][_0x0c6c('0x66')]||_0x420d8e['user']['id'];_0x3ceed1[_0x0c6c('0x67')]['id']=_0x420d8e[_0x0c6c('0x5e')][_0x0c6c('0x66')];return db[_0x0c6c('0x40')][_0x0c6c('0x5c')]({'where':{'id':_0x420d8e['params']['id'],'UserId':null}})[_0x0c6c('0x38')](handleEntityNotFound(_0x45e962,null))['then'](saveUpdates(_0x420d8e[_0x0c6c('0x5e')],null))[_0x0c6c('0x38')](function(_0x4384f9){if(_0x4384f9){_0x3ceed1[_0x0c6c('0x2a')]=_0x4384f9['get']({'plain':!![]});return db[_0x0c6c('0x68')][_0x0c6c('0x5c')]({'where':{'id':_0x4384f9['SmsInteractionId']}});}return null;})[_0x0c6c('0x38')](handleEntityNotFound(_0x45e962,null))[_0x0c6c('0x38')](function(_0x5a4dde){if(_0x5a4dde){return _0x5a4dde[_0x0c6c('0x5f')]({'UserId':_0x420d8e[_0x0c6c('0x5e')][_0x0c6c('0x66')],'read1stAt':_['isNil'](_0x5a4dde['read1stAt'])?moment()[_0x0c6c('0x64')](_0x0c6c('0x65')):undefined});}return null;})[_0x0c6c('0x38')](function(_0x51ab5f){if(_0x51ab5f){_0x3ceed1['interaction']=_0x51ab5f[_0x0c6c('0x69')]({'plain':!![]});interaction_log['info'](_0x0c6c('0x6a'),_0x420d8e[_0x0c6c('0x6b')]['id'],_0x420d8e[_0x0c6c('0x6b')][_0x0c6c('0x3c')],_0x420d8e[_0x0c6c('0x6b')]['role'],_0x3ceed1['interaction']['id'],_0x420d8e[_0x0c6c('0x5e')]?JSON[_0x0c6c('0x27')](_0x420d8e[_0x0c6c('0x5e')]):'null');return respondWithRpcPromise(_0x0c6c('0x6c'),_0x0c6c('0x6d'),_0x3ceed1);}return null;})[_0x0c6c('0x38')](function(_0x5a9a5c){var _0x32213e='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5a9a5c[_0x0c6c('0x2a')][_0x0c6c('0x6e')];return db[_0x0c6c('0x6f')][_0x0c6c('0x46')](_0x32213e,{'type':db[_0x0c6c('0x70')][_0x0c6c('0x71')]['SELECT'],'raw':!![]})['then'](function(_0x3c9e8d){return _0x3c9e8d;});})[_0x0c6c('0x38')](function(_0x14a61f){if(_0x14a61f){_0x3ceed1[_0x0c6c('0x2a')][_0x0c6c('0x72')]=_0x14a61f[0x0];if(!_0x420d8e[_0x0c6c('0x5e')]['UserId'])return;return db[_0x0c6c('0x73')][_0x0c6c('0x5c')]({'where':{'id':_0x420d8e[_0x0c6c('0x5e')][_0x0c6c('0x66')],'role':_0x0c6c('0x67')},'attributes':['id','name','fullname',_0x0c6c('0x74'),_0x0c6c('0x75')],'raw':!![]});}return null;})[_0x0c6c('0x38')](function(_0x4b454c){if(!_0x4b454c)return null;_0x3ceed1[_0x0c6c('0x2a')][_0x0c6c('0x67')]=_0x4b454c;return _0x3ceed1;})[_0x0c6c('0x38')](function(_0x1e7f52){if(_0x1e7f52){if(_0x420d8e[_0x0c6c('0x5e')][_0x0c6c('0x76')]){_0x3ceed1[_0x0c6c('0x2a')][_0x0c6c('0x77')]=util[_0x0c6c('0x64')]('SIP/%s',_0x420d8e[_0x0c6c('0x6b')]['name']);_0x3ceed1['message']['channel']=_0x3ceed1[_0x0c6c('0x78')];_0x3ceed1[_0x0c6c('0x2a')][_0x0c6c('0x79')]=_0x3ceed1['channel'];_0x3ceed1[_0x0c6c('0x2a')][_0x0c6c('0x7a')]='accept';return respondWithRpcPromise('EventManager',_0x0c6c('0x7b'),{'event':_0x0c6c('0x7c'),'message':_0x3ceed1[_0x0c6c('0x2a')]},client9002)['then'](function(){return _0x3ceed1;});}return _0x3ceed1;}return null;})[_0x0c6c('0x38')](respondWithResult(_0x45e962,null))[_0x0c6c('0x2c')](handleError(_0x45e962,null));};var interaction_log=require(_0x0c6c('0x17'))(_0x0c6c('0x61'));exports['reject']=function(_0x5a77e5,_0x601c9e,_0x40b410){var _0x3cfdab={'agent':{},'channel':'sms'};if(_0x5a77e5['body']['id']){delete _0x5a77e5[_0x0c6c('0x5e')]['id'];}_0x5a77e5['body'][_0x0c6c('0x66')]=_0x5a77e5[_0x0c6c('0x5e')][_0x0c6c('0x66')]||_0x5a77e5[_0x0c6c('0x6b')]['id'];_0x3cfdab[_0x0c6c('0x67')]['id']=_0x5a77e5[_0x0c6c('0x5e')][_0x0c6c('0x66')];return db[_0x0c6c('0x40')][_0x0c6c('0x5c')]({'where':{'id':_0x5a77e5['params']['id'],'UserId':null}})[_0x0c6c('0x38')](handleEntityNotFound(_0x601c9e,null))[_0x0c6c('0x38')](function(_0x7ab7f){if(_0x7ab7f){_0x3cfdab[_0x0c6c('0x2a')]=_0x7ab7f[_0x0c6c('0x69')]({'plain':!![]});return db[_0x0c6c('0x68')][_0x0c6c('0x5c')]({'where':{'id':_0x7ab7f[_0x0c6c('0x7d')]}});}return null;})[_0x0c6c('0x38')](handleEntityNotFound(_0x601c9e,null))[_0x0c6c('0x38')](function(_0x467b20){if(_0x467b20){_0x3cfdab[_0x0c6c('0x7e')]=_0x467b20[_0x0c6c('0x69')]({'plain':!![]});interaction_log[_0x0c6c('0x2b')](_0x0c6c('0x7f'),_0x5a77e5[_0x0c6c('0x6b')]['id'],_0x5a77e5['user'][_0x0c6c('0x3c')],_0x5a77e5[_0x0c6c('0x6b')]['role'],_0x3cfdab[_0x0c6c('0x7e')]['id'],_0x5a77e5[_0x0c6c('0x5e')]?JSON[_0x0c6c('0x27')](_0x5a77e5[_0x0c6c('0x5e')]):_0x0c6c('0x80'));return respondWithRpcPromise(_0x0c6c('0x81'),'rejectMessage',_0x3cfdab);}return null;})['then'](function(_0x3492d5){var _0x21413c=_0x0c6c('0x82')+_0x3492d5[_0x0c6c('0x2a')]['ContactId'];return db[_0x0c6c('0x6f')][_0x0c6c('0x46')](_0x21413c,{'type':db[_0x0c6c('0x70')][_0x0c6c('0x71')]['SELECT'],'raw':!![]})[_0x0c6c('0x38')](function(_0x24acdf){return _0x24acdf;});})[_0x0c6c('0x38')](function(_0x527177){if(_0x527177){_0x3cfdab['message'][_0x0c6c('0x72')]=_0x527177[0x0];if(!_0x5a77e5[_0x0c6c('0x5e')][_0x0c6c('0x66')])return;return db[_0x0c6c('0x73')][_0x0c6c('0x5c')]({'where':{'id':_0x5a77e5[_0x0c6c('0x5e')][_0x0c6c('0x66')],'role':'agent'},'attributes':['id',_0x0c6c('0x3c'),'fullname',_0x0c6c('0x74'),_0x0c6c('0x75')],'raw':!![]});}return null;})[_0x0c6c('0x38')](function(_0x45e0ef){if(!_0x45e0ef)return null;_0x3cfdab[_0x0c6c('0x2a')][_0x0c6c('0x67')]=_0x45e0ef;return _0x3cfdab;})[_0x0c6c('0x38')](function(_0x58ce94){if(_0x58ce94){_0x58ce94['message'][_0x0c6c('0x77')]=util[_0x0c6c('0x64')]('SIP/%s',_0x5a77e5[_0x0c6c('0x6b')][_0x0c6c('0x3c')]);_0x58ce94[_0x0c6c('0x2a')][_0x0c6c('0x78')]=_0x3cfdab['channel'];_0x58ce94[_0x0c6c('0x2a')]['motionChannel']=_0x3cfdab[_0x0c6c('0x78')];_0x58ce94[_0x0c6c('0x2a')][_0x0c6c('0x7a')]=_0x0c6c('0x36');respondWithRpcPromise(_0x0c6c('0x7b'),_0x0c6c('0x7b'),{'event':_0x0c6c('0x83'),'message':_0x58ce94[_0x0c6c('0x2a')]},client9002);return _0x3cfdab;}return null;})[_0x0c6c('0x38')](respondWithResult(_0x601c9e,null))[_0x0c6c('0x2c')](handleError(_0x601c9e,null));};exports[_0x0c6c('0x2e')]=function(_0x421ded,_0x376ebe,_0x2fc81b){if(_0x421ded[_0x0c6c('0x5e')]['id']){delete _0x421ded[_0x0c6c('0x5e')]['id'];}var _0x4b4934;return db[_0x0c6c('0x40')]['find']({'where':{'id':_0x421ded['params']['id']}})[_0x0c6c('0x38')](handleEntityNotFound(_0x376ebe,null))['then'](function(_0x3ec39a){if(_0x3ec39a){_0x4b4934=_0x3ec39a;return db[_0x0c6c('0x84')][_0x0c6c('0x5c')]({'where':{'id':_0x3ec39a[_0x0c6c('0x85')]}});}})['then'](handleEntityNotFound(_0x376ebe,null))[_0x0c6c('0x38')](function(_0x1a99aa){if(_0x1a99aa){logger[_0x0c6c('0x25')](_0x0c6c('0x26'),'status',_0x0c6c('0x86'),_0x1a99aa['type'],util[_0x0c6c('0x87')](_0x421ded['body'],{'showHidden':![],'depth':null}));switch(_0x1a99aa[_0x0c6c('0x43')]){case _0x0c6c('0x88'):if(_0x421ded[_0x0c6c('0x5e')][_0x0c6c('0x89')]&&_0x421ded[_0x0c6c('0x5e')][_0x0c6c('0x89')]===_0x4b4934[_0x0c6c('0x8a')]){return _0x4b4934['update']({'read':!![]});}else{logger[_0x0c6c('0x28')](_0x0c6c('0x8b'),_0x0c6c('0x2e'),_0x0c6c('0x88'),util[_0x0c6c('0x87')](_0x421ded['body'],{'showHidden':![],'depth':null}));}break;case _0x0c6c('0x8c'):if(_0x421ded[_0x0c6c('0x5e')]['MessageUUID']&&_0x421ded[_0x0c6c('0x5e')][_0x0c6c('0x8d')]===_0x4b4934[_0x0c6c('0x8a')]&&_[_0x0c6c('0x8e')]([_0x0c6c('0x8f'),_0x0c6c('0x90')],_0x421ded[_0x0c6c('0x5e')][_0x0c6c('0x91')])>=0x0){return _0x4b4934[_0x0c6c('0x5f')]({'read':!![]});}else{logger[_0x0c6c('0x28')](_0x0c6c('0x8b'),'status',_0x0c6c('0x92'),util[_0x0c6c('0x87')](_0x421ded[_0x0c6c('0x5e')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x3f95aa=_0x421ded[_0x0c6c('0x5e')][_0x0c6c('0x93')][0x0];if(_0x3f95aa['status']['groupName']==='DELIVERED'){return _0x4b4934[_0x0c6c('0x5f')]({'read':!![]});}else{logger[_0x0c6c('0x28')](_0x0c6c('0x8b'),_0x0c6c('0x2e'),'infobip',util[_0x0c6c('0x87')](_0x421ded['body'],{'showHidden':![],'depth':null}));}break;}return _0x4b4934;}})[_0x0c6c('0x38')](respondWithResult(_0x376ebe,null))['catch'](handleError(_0x376ebe,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 4b1711f..0f254e8 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 _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 +var _0x947e=['emit','hook','../../mysqldb','SmsMessage','save','update'];(function(_0x14ad26,_0x35b66e){var _0x54b0f7=function(_0x5f8f6b){while(--_0x5f8f6b){_0x14ad26['push'](_0x14ad26['shift']());}};_0x54b0f7(++_0x35b66e);}(_0x947e,0x1b8));var _0xe947=function(_0x58df0d,_0x303d1e){_0x58df0d=_0x58df0d-0x0;var _0x4da579=_0x947e[_0x58df0d];return _0x4da579;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0xe947('0x0'))['db'][_0xe947('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe947('0x2'),'afterUpdate':_0xe947('0x3'),'afterDestroy':'remove'};function emitEvent(_0x15f1d2){return function(_0x3a0b07,_0x4bb156,_0x428f5c){SmsMessageEvents[_0xe947('0x4')](_0x15f1d2+':'+_0x3a0b07['id'],_0x3a0b07);SmsMessageEvents[_0xe947('0x4')](_0x15f1d2,_0x3a0b07);_0x428f5c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0xe947('0x5')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index d9fc9fd..a2e2667 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 _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 +var _0x5948=['apiKey','text','keys','sort','length','createHash','md5','digest','hex','/external/get/send.php?','id_sms','clickatell','uuid','apiMessageId','Missing\x20parameters:\x20apiKey','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','intelepeer','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','direction','toLowerCase','out','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','then','update','createdAt','catch','error','secret','find','SmsAccountId','type','accountSid','authToken','phone','messages','/api/sms/messages/','sid','SmsMessage,\x20%s,\x20%s,\x20%s','twilio','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','username','password','smsMethod','sender','login?username=','&password=','GET','split','sms','POST','user_key','internal_order_id','deliveryReport','read','skebby','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','message_id','clickSend','authId','remote','/status?token=','token','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','Missing\x20parameters:\x20base_url','csc','crypto'];(function(_0x15ecbf,_0x519552){var _0x1d3c0c=function(_0x46c359){while(--_0x46c359){_0x15ecbf['push'](_0x15ecbf['shift']());}};_0x1d3c0c(++_0x519552);}(_0x5948,0x11c));var _0x8594=function(_0x48f8c4,_0x4e3dba){_0x48f8c4=_0x48f8c4-0x0;var _0x118849=_0x5948[_0x48f8c4];return _0x118849;};'use strict';var _=require(_0x8594('0x0'));var util=require(_0x8594('0x1'));var logger=require(_0x8594('0x2'))(_0x8594('0x3'));var moment=require('moment');var BPromise=require(_0x8594('0x4'));var rp=require(_0x8594('0x5'));var fs=require('fs');var path=require(_0x8594('0x6'));var rimraf=require(_0x8594('0x7'));var config=require(_0x8594('0x8'));var attributes=require(_0x8594('0x9'));module[_0x8594('0xa')]=function(_0x10e4ce,_0x28ab6d){return _0x10e4ce['define'](_0x8594('0xb'),attributes,{'tableName':_0x8594('0xc'),'paranoid':![],'indexes':[{'name':_0x8594('0xd'),'fields':['messageId']},{'name':_0x8594('0xe'),'fields':[_0x8594('0xf')],'type':_0x8594('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x64c9c1,_0x4756aa,_0x2047cf){var _0x485839=_0x10e4ce[_0x8594('0x11')];var _0x370a71=_0x64c9c1['get']({'plain':!![]});if(_0x370a71[_0x8594('0x12')][_0x8594('0x13')]()==='in'||_0x370a71[_0x8594('0x12')][_0x8594('0x13')]()===_0x8594('0x14')&&!_0x370a71['secret']&&!_[_0x8594('0x15')](_0x370a71[_0x8594('0x16')])&&!_[_0x8594('0x15')](_0x370a71[_0x8594('0x17')])){_0x485839[_0x8594('0x18')][_0x8594('0x19')]({'where':{'id':_0x370a71[_0x8594('0x17')]}})[_0x8594('0x1a')](function(_0x2ce4e6){if(_0x2ce4e6){_0x2ce4e6[_0x8594('0x1b')]({'lastMsgAt':_0x370a71[_0x8594('0x1c')],'lastMsgDirection':_0x370a71[_0x8594('0x12')][_0x8594('0x13')]()});}})[_0x8594('0x1d')](function(_0x28fb61){console[_0x8594('0x1e')](_0x28fb61);});}if(_0x370a71['direction']==='out'&&!_0x370a71[_0x8594('0x1f')]){var _0x1702a7;_0x485839['SmsAccount'][_0x8594('0x20')]({'where':{'id':_0x370a71[_0x8594('0x21')]},'raw':!![]})[_0x8594('0x1a')](function(_0x4a6562){_0x1702a7=_0x4a6562;if(_0x1702a7&&_0x1702a7[_0x8594('0x22')]){switch(_0x1702a7[_0x8594('0x22')]){case'twilio':var _0x2af807=require('twilio');if(_0x1702a7[_0x8594('0x23')]&&_0x1702a7[_0x8594('0x24')]&&_0x1702a7[_0x8594('0x25')]){var _0x42229e=new _0x2af807(_0x1702a7['accountSid'],_0x1702a7[_0x8594('0x24')]);_0x42229e[_0x8594('0x26')]['create']({'body':_0x370a71[_0x8594('0xf')],'to':_0x370a71['phone'],'from':_0x1702a7[_0x8594('0x25')],'statusCallback':_0x1702a7['remote']+_0x8594('0x27')+_0x370a71['id']+'/status?token='+_0x1702a7['token']})[_0x8594('0x1a')](function(_0x516868){if(_0x516868[_0x8594('0x28')]){return _0x64c9c1['update']({'messageId':_0x516868['sid']});}})[_0x8594('0x1d')](function(_0x3cdfdb){logger[_0x8594('0x1e')](_0x8594('0x29'),'afterCreate',_0x8594('0x2a'),util[_0x8594('0x2b')](_0x3cdfdb,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x8594('0x29'),_0x8594('0x2c'),_0x8594('0x2a'),_0x8594('0x2d'));}break;case'skebby':var _0x239df8='https://api.skebby.it/API/v1.0/REST/';if(_0x1702a7[_0x8594('0x2e')]&&_0x1702a7[_0x8594('0x2f')]){var _0x33da3f={'recipient':[_0x370a71[_0x8594('0x25')]],'message':_0x370a71['body'],'message_type':_0x1702a7['smsMethod']};if(_0x1702a7[_0x8594('0x30')]&&_0x1702a7[_0x8594('0x30')]!=='SI'){_0x33da3f[_0x8594('0x31')]=_0x1702a7['phone'];}var _0x4bf387={'url':_0x239df8+_0x8594('0x32')+_0x1702a7[_0x8594('0x2e')]+_0x8594('0x33')+_0x1702a7[_0x8594('0x2f')],'method':_0x8594('0x34')};rp(_0x4bf387)[_0x8594('0x1a')](function(_0x429e44){var _0x437ccd=_0x429e44[_0x8594('0x35')](';');var _0x21654a={'user_key':_0x437ccd[0x0],'session_key':_0x437ccd[0x1]};_0x4bf387={'url':_0x239df8+_0x8594('0x36'),'method':_0x8594('0x37'),'headers':{'user_key':_0x21654a[_0x8594('0x38')],'Session_key':_0x21654a['session_key']},'json':!![],'body':_0x33da3f};return rp(_0x4bf387);})['then'](function(_0x51eff5){if(_0x51eff5['total_sent']>=0x1){var _0x28dcdb={'messageId':_0x51eff5[_0x8594('0x39')]};if(_0x1702a7['smsMethod']!=='GP'||!_0x1702a7[_0x8594('0x3a')]){_0x28dcdb[_0x8594('0x3b')]=!![];}return _0x64c9c1[_0x8594('0x1b')](_0x28dcdb);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x8594('0x3c'),util[_0x8594('0x2b')](_0x51eff5,{'showHidden':![],'depth':null}));}})['catch'](function(_0x495ab6){return logger[_0x8594('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8594('0x2c'),_0x8594('0x3c'),util[_0x8594('0x2b')](_0x495ab6,{'showHidden':![],'depth':null}));});}else{logger[_0x8594('0x1e')](_0x8594('0x29'),_0x8594('0x2c'),_0x8594('0x3c'),_0x8594('0x3d'));}break;case _0x8594('0x3e'):if(_0x1702a7[_0x8594('0x24')]){var _0x4446f3={'recipient':_0x370a71[_0x8594('0x25')],'message':_0x370a71['body'],'sender':_0x1702a7[_0x8594('0x3f')]||_0x1702a7[_0x8594('0x25')],'authorization':_0x1702a7['authToken']};var _0x4756aa={'method':_0x8594('0x37'),'uri':_0x8594('0x40'),'body':_0x4446f3,'json':!![]};rp(_0x4756aa)[_0x8594('0x1a')](function(_0x20e24b){var _0x48e39f={'messageId':_0x20e24b[_0x8594('0x41')]};if(!_0x1702a7[_0x8594('0x3a')]){_0x48e39f[_0x8594('0x3b')]=!![];}return _0x64c9c1['update'](_0x48e39f);})['catch'](function(_0x3e917c){logger[_0x8594('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','connectel',util[_0x8594('0x2b')](_0x3e917c,{'showHidden':![],'depth':null}));});}else{logger[_0x8594('0x1e')](_0x8594('0x29'),_0x8594('0x2c'),_0x8594('0x3e'),'Missing\x20parameters:\x20authToken');}break;case'clicksend':if(_0x1702a7[_0x8594('0x2e')]&&_0x1702a7[_0x8594('0x2f')]){var _0x4446f3={'messages':[{'source':_0x8594('0x42'),'to':_0x370a71[_0x8594('0x25')],'body':_0x370a71['body'],'from':_0x1702a7[_0x8594('0x3f')]||_0x1702a7[_0x8594('0x25')]}]};var _0xf1f021=util[_0x8594('0x43')](_0x8594('0x44'),_0x1702a7[_0x8594('0x2e')],_0x1702a7[_0x8594('0x2f')]);var _0x4756aa={'method':'POST','uri':_0x8594('0x45'),'body':_0x4446f3,'headers':{'Authorization':util[_0x8594('0x43')](_0x8594('0x46'),new Buffer(_0xf1f021)[_0x8594('0x47')](_0x8594('0x48')))},'json':!![]};rp(_0x4756aa)['then'](function(_0x1406cf){if(_0x1406cf[_0x8594('0x49')]>=0xc8&&_0x1406cf['http_code']<=0xce){if(_0x1406cf[_0x8594('0x4a')]&&_0x1406cf[_0x8594('0x4a')][_0x8594('0x4b')]>0x0){var _0x2824d9=_[_0x8594('0x4c')](_0x1406cf[_0x8594('0x4a')][_0x8594('0x26')]);var _0x1ca65={'messageId':_0x2824d9[_0x8594('0x4d')]};if(!_0x1702a7['deliveryReport']){_0x1ca65[_0x8594('0x3b')]=!![];}return _0x64c9c1['update'](_0x1ca65);}else{logger[_0x8594('0x1e')](_0x8594('0x29'),_0x8594('0x2c'),_0x8594('0x4e'),util[_0x8594('0x2b')](_0x1406cf,{'showHidden':![],'depth':null}));}}else{logger[_0x8594('0x1e')](_0x8594('0x29'),'afterCreate',_0x8594('0x4e'),util[_0x8594('0x2b')](_0x1406cf,{'showHidden':![],'depth':null}));}})[_0x8594('0x1d')](function(_0x4c2a3f){logger[_0x8594('0x1e')](_0x8594('0x29'),'afterCreate','clickSend',util[_0x8594('0x2b')](_0x4c2a3f,{'showHidden':![],'depth':null}));});}else{logger[_0x8594('0x1e')](_0x8594('0x29'),_0x8594('0x2c'),'clickSend',_0x8594('0x3d'));}break;case'plivo':if(_0x1702a7[_0x8594('0x4f')]&&_0x1702a7[_0x8594('0x24')]){var _0x4446f3={'dst':_0x370a71[_0x8594('0x25')],'text':_0x370a71['body'],'src':_0x1702a7[_0x8594('0x3f')]||_0x1702a7[_0x8594('0x25')],'url':_0x1702a7[_0x8594('0x50')]+_0x8594('0x27')+_0x370a71['id']+_0x8594('0x51')+_0x1702a7[_0x8594('0x52')]};var _0xf1f021=util[_0x8594('0x43')](_0x8594('0x44'),_0x1702a7[_0x8594('0x4f')],_0x1702a7[_0x8594('0x24')]);var _0x4756aa={'method':_0x8594('0x37'),'uri':util[_0x8594('0x43')]('https://api.plivo.com/v1/Account/%s/Message/',_0x1702a7['authId']),'body':_0x4446f3,'headers':{'Authorization':util[_0x8594('0x43')]('Basic\x20%s',new Buffer(_0xf1f021)[_0x8594('0x47')](_0x8594('0x48')))},'json':!![]};rp(_0x4756aa)[_0x8594('0x1a')](function(_0x1c8ba4){var _0x1f8a7f={'messageId':_0x1c8ba4[_0x8594('0x53')][0x0]};return _0x64c9c1[_0x8594('0x1b')](_0x1f8a7f);})[_0x8594('0x1d')](function(_0x51b616){logger[_0x8594('0x1e')](_0x8594('0x29'),_0x8594('0x2c'),'plivo',util['inspect'](_0x51b616,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x8594('0x29'),_0x8594('0x2c'),_0x8594('0x54'),_0x8594('0x55'));}break;case _0x8594('0x56'):if(_0x1702a7[_0x8594('0x2e')]&&_0x1702a7[_0x8594('0x2f')]){if(_0x1702a7[_0x8594('0x57')]){var _0xf402a0={'method':_0x8594('0x37'),'uri':_0x1702a7[_0x8594('0x57')]+_0x8594('0x58'),'body':{'username':_0x1702a7[_0x8594('0x2e')],'password':_0x1702a7[_0x8594('0x2f')]},'json':!![]};return rp(_0xf402a0)[_0x8594('0x1a')](function(_0x234e96){var _0x45fc9e={'method':_0x8594('0x37'),'uri':_0x1702a7[_0x8594('0x57')]+_0x8594('0x59'),'body':{'messages':[{'from':_0x1702a7[_0x8594('0x25')],'destinations':[{'to':_0x370a71['phone']}],'text':_0x370a71['body'],'notifyUrl':_0x1702a7[_0x8594('0x50')]+_0x8594('0x27')+_0x370a71['id']+_0x8594('0x51')+_0x1702a7[_0x8594('0x52')],'notifyContentType':_0x8594('0x5a'),'callbackData':_0x1702a7['phone']+';'+_0x370a71[_0x8594('0xf')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x234e96[_0x8594('0x52')]},'json':!![]};return rp(_0x45fc9e)[_0x8594('0x1a')](function(_0x3fc696){if(_0x3fc696[_0x8594('0x26')]){var _0x5a8a1b={'messageId':_0x3fc696[_0x8594('0x26')][0x0]['messageId']};if(!_0x1702a7[_0x8594('0x3a')]){_0x5a8a1b[_0x8594('0x3b')]=!![];}return _0x64c9c1[_0x8594('0x1b')](_0x5a8a1b);}else{return logger[_0x8594('0x1e')](_0x8594('0x29'),_0x8594('0x2c'),_0x8594('0x56'),util['inspect'](_0x3fc696,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x3d76f9){return logger[_0x8594('0x1e')](_0x8594('0x29'),_0x8594('0x2c'),_0x8594('0x56'),util[_0x8594('0x2b')](_0x3d76f9,{'showHidden':![],'depth':null}));});}else{logger[_0x8594('0x1e')](_0x8594('0x29'),_0x8594('0x2c'),'infobip',_0x8594('0x5b'));}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x8594('0x56'),_0x8594('0x3d'));}break;case _0x8594('0x5c'):var _0x1387b9=require(_0x8594('0x5d'));if(_0x1702a7[_0x8594('0x5e')]){var _0x24fd8c={};_0x24fd8c['login']=_0x1702a7['username'];_0x24fd8c['phone']=_0x370a71[_0x8594('0x25')];_0x24fd8c[_0x8594('0x31')]=_0x1702a7[_0x8594('0x25')];_0x24fd8c[_0x8594('0x5f')]=_0x370a71[_0x8594('0xf')];_0x24fd8c['timestamp']=+new Date();var _0x4d9990='';var _0xc8c589='';var _0x4bbb62=Object[_0x8594('0x60')](_0x24fd8c);_0x4bbb62[_0x8594('0x61')]();for(var _0xfe15e1=0x0;_0xfe15e1<_0x4bbb62[_0x8594('0x62')];_0xfe15e1++){if(_0x4d9990!=''){_0x4d9990+='&';}_0x4d9990+=_0x4bbb62[_0xfe15e1]+'='+encodeURIComponent(_0x24fd8c[_0x4bbb62[_0xfe15e1]]);_0xc8c589+=_0x24fd8c[_0x4bbb62[_0xfe15e1]];}_0xc8c589+=_0x1702a7['apiKey'];_0xc8c589=_0x1387b9[_0x8594('0x63')](_0x8594('0x64'))[_0x8594('0x1b')](_0xc8c589)[_0x8594('0x65')](_0x8594('0x66'));if(_0x4d9990!==''){_0x4d9990+='&';}_0x4d9990+='signature='+_0xc8c589;var _0x4bf387={'method':_0x8594('0x34'),'uri':_0x1702a7['baseUrl']+_0x8594('0x67')+_0x4d9990,'json':!![]};return rp(_0x4bf387)[_0x8594('0x1a')](function(_0x3dbe27){var _0xfa392a=Object['keys'](_0x3dbe27);if(_0x3dbe27[_0xfa392a[0x0]][_0x8594('0x1e')]&&parseInt(_0x3dbe27[_0xfa392a[0x0]][_0x8594('0x1e')])===0x0){var _0xc3b72a={'messageId':_0x3dbe27[_0xfa392a[0x0]][_0x8594('0x68')]};if(!_0x1702a7[_0x8594('0x3a')]){_0xc3b72a[_0x8594('0x3b')]=!![];}return _0x64c9c1[_0x8594('0x1b')](_0xc3b72a);}else{return logger[_0x8594('0x1e')](_0x8594('0x29'),_0x8594('0x2c'),'csc',util['inspect'](_0x3dbe27[_0x8594('0x1e')],{'showHidden':![],'depth':null}));}})[_0x8594('0x1d')](function(_0x31a3b7){return logger[_0x8594('0x1e')](_0x8594('0x29'),_0x8594('0x2c'),_0x8594('0x5c'),util[_0x8594('0x2b')](_0x31a3b7,{'showHidden':![],'depth':null}));});}else{logger[_0x8594('0x1e')](_0x8594('0x29'),_0x8594('0x2c'),'csc','Missing\x20parameters:\x20apiKey');}break;case _0x8594('0x69'):if(_0x1702a7[_0x8594('0x5e')]){var _0x3755d1={'method':_0x8594('0x37'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x1702a7[_0x8594('0x5e')]},'body':{'content':_0x370a71[_0x8594('0xf')],'to':[_0x370a71[_0x8594('0x25')]],'from':_0x1702a7[_0x8594('0x25')],'binary':![],'clientMessageId':_0x8594('0x6a'),'charset':'UTF-8'},'json':!![]};rp(_0x3755d1)[_0x8594('0x1a')](function(_0x1e74a0){if(!_0x1e74a0[_0x8594('0x1e')]){var _0x4d06ce={'messageId':_0x1e74a0['messages'][0x0][_0x8594('0x6b')]};if(!_0x1702a7[_0x8594('0x3a')]){_0x4d06ce[_0x8594('0x3b')]=!![];}return _0x64c9c1[_0x8594('0x1b')](_0x4d06ce);}else{return logger[_0x8594('0x1e')](_0x8594('0x29'),'afterCreate',_0x8594('0x69'),util['inspect'](_0x1e74a0[_0x8594('0x1e')],{'showHidden':![],'depth':null}));}})[_0x8594('0x1d')](function(_0x58e2bc){return logger[_0x8594('0x1e')](_0x8594('0x29'),'afterCreate','clickatell',util['inspect'](_0x58e2bc,{'showHidden':![],'depth':null}));});}else{logger[_0x8594('0x1e')](_0x8594('0x29'),_0x8594('0x2c'),_0x8594('0x69'),_0x8594('0x6c'));}break;case _0x8594('0x6d'):if(_0x1702a7[_0x8594('0x2e')]&&_0x1702a7[_0x8594('0x2f')]){var _0xf1f021=util[_0x8594('0x43')]('%s:%s',_0x1702a7[_0x8594('0x2e')],_0x1702a7[_0x8594('0x2f')]);var _0x4756aa={'method':_0x8594('0x37'),'uri':_0x8594('0x6e')+_0x1702a7[_0x8594('0x6f')]+_0x8594('0x70'),'body':{'to':[_0x370a71[_0x8594('0x25')]],'text':_0x370a71['body'],'from':_0x1702a7[_0x8594('0x25')],'applicationId':_0x1702a7[_0x8594('0x71')]},'headers':{'Authorization':util[_0x8594('0x43')](_0x8594('0x46'),new Buffer(_0xf1f021)['toString']('base64'))},'json':!![]};rp(_0x4756aa)[_0x8594('0x1a')](function(_0x38528d){if(_0x38528d['id']){var _0xde83a={'messageId':_0x38528d['id']};return _0x64c9c1[_0x8594('0x1b')](_0xde83a);}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8594('0x2c'),_0x8594('0x6d'),util[_0x8594('0x2b')](_0x38528d,{'showHidden':![],'depth':null}));}})['catch'](function(_0x1e387c){logger[_0x8594('0x1e')](_0x8594('0x29'),_0x8594('0x2c'),_0x8594('0x6d'),util[_0x8594('0x2b')](_0x1e387c,{'showHidden':![],'depth':null}));});}else{logger[_0x8594('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8594('0x2c'),_0x8594('0x6d'),'Missing\x20parameters:\x20username,\x20password');}break;case'intelepeer':if(_0x1702a7[_0x8594('0x5e')]){var _0x8adf28={};var _0x4bf387={'method':'POST','uri':_0x8594('0x72'),'headers':{'Authorization':_0x8594('0x73')+_0x1702a7[_0x8594('0x5e')],'Content-Type':'application/json'},'body':{'from':_0x1702a7[_0x8594('0x25')],'to':_0x370a71['phone'],'text':_0x370a71[_0x8594('0xf')]},'json':!![]};return rp(_0x4bf387)[_0x8594('0x1a')](function(_0x33510a){if(_0x33510a[_0x8594('0x74')]==0xca){_0x8adf28[_0x8594('0x75')]=_0x33510a;var _0x18e808={'method':'POST','uri':_0x8594('0x76'),'headers':{'Authorization':_0x8594('0x73')+_0x1702a7[_0x8594('0x5e')],'Content-Type':'application/json'},'body':{'refid':_0x8adf28[_0x8594('0x75')][_0x8594('0x77')]},'json':!![]};return rp(_0x18e808)[_0x8594('0x1a')](function(_0x280ffa){_0x8adf28[_0x8594('0x78')]=_0x280ffa;var _0x3a6ac8={'messageId':_0x8adf28[_0x8594('0x75')]['refid'],'read':!![]};return _0x64c9c1[_0x8594('0x1b')](_0x3a6ac8);});}else{return logger[_0x8594('0x1e')](_0x8594('0x29'),'afterCreate',_0x8594('0x79'),util[_0x8594('0x2b')](_0x33510a,{'showHidden':![],'depth':null}));}})[_0x8594('0x1d')](function(_0x7ce6ba){return logger[_0x8594('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x8594('0x79'),util[_0x8594('0x2b')](_0x7ce6ba,{'showHidden':![],'depth':null}));});}else{return logger[_0x8594('0x1e')](_0x8594('0x29'),'afterCreate',_0x8594('0x79'),_0x8594('0x7a'));}break;}}})[_0x8594('0x7b')](function(){_0x2047cf();});}else{_0x2047cf();}}},'charset':_0x8594('0x7c'),'collate':_0x8594('0x7d')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 3f86286..4cb91be 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 _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 +var _0x9136=['defaults','localhost','socket.io-emitter','register','request','then','info','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SmsMessage,\x20%s,\x20%s','message','catch','CreateSmsMessage','SmsMessage','body','options','raw','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis'];(function(_0x521f0d,_0x1e670c){var _0x1b1131=function(_0x35d6df){while(--_0x35d6df){_0x521f0d['push'](_0x521f0d['shift']());}};_0x1b1131(++_0x1e670c);}(_0x9136,0x140));var _0x6913=function(_0x328751,_0x59fc72){_0x328751=_0x328751-0x0;var _0x565cce=_0x9136[_0x328751];return _0x565cce;};'use strict';var _=require('lodash');var util=require(_0x6913('0x0'));var moment=require(_0x6913('0x1'));var BPromise=require(_0x6913('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6913('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6913('0x4'));var logger=require(_0x6913('0x5'))(_0x6913('0x6'));var config=require(_0x6913('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6913('0x8')]['http']({'port':0x232a});config[_0x6913('0x9')]=_[_0x6913('0xa')](config[_0x6913('0x9')],{'host':_0x6913('0xb'),'port':0x18eb});var socket=require(_0x6913('0xc'))(new Redis(config[_0x6913('0x9')]));require('./smsMessage.socket')[_0x6913('0xd')](socket);function respondWithRpcPromise(_0x231b89,_0x53147f,_0x1ab29f){return new BPromise(function(_0x258653,_0x1f3fcb){return client[_0x6913('0xe')](_0x231b89,_0x1ab29f)[_0x6913('0xf')](function(_0x282526){logger[_0x6913('0x10')]('SmsMessage,\x20%s,\x20%s',_0x53147f,'request\x20sent');logger[_0x6913('0x11')](_0x6913('0x12'),_0x53147f,_0x6913('0x13'),JSON['stringify'](_0x282526));if(_0x282526[_0x6913('0x14')]){if(_0x282526[_0x6913('0x14')][_0x6913('0x15')]===0x1f4){logger[_0x6913('0x14')](_0x6913('0x16'),_0x53147f,_0x282526[_0x6913('0x14')][_0x6913('0x17')]);return _0x1f3fcb(_0x282526['error'][_0x6913('0x17')]);}logger[_0x6913('0x14')]('SmsMessage,\x20%s,\x20%s',_0x53147f,_0x282526[_0x6913('0x14')]['message']);return _0x258653(_0x282526[_0x6913('0x14')][_0x6913('0x17')]);}else{logger[_0x6913('0x10')](_0x6913('0x16'),_0x53147f,_0x6913('0x13'));_0x258653(_0x282526['result'][_0x6913('0x17')]);}})[_0x6913('0x18')](function(_0xd49bfa){logger[_0x6913('0x14')](_0x6913('0x16'),_0x53147f,_0xd49bfa);_0x1f3fcb(_0xd49bfa);});});}exports[_0x6913('0x19')]=function(_0x3c7db7){var _0x261451=this;return new Promise(function(_0x53ba81,_0x3a1679){return db[_0x6913('0x1a')]['create'](_0x3c7db7[_0x6913('0x1b')],{'raw':_0x3c7db7[_0x6913('0x1c')]?_0x3c7db7[_0x6913('0x1c')][_0x6913('0x1d')]===undefined?!![]:![]:!![]})[_0x6913('0xf')](function(_0x3e0a9f){logger['info'](_0x6913('0x19'),_0x3c7db7);logger[_0x6913('0x11')](_0x6913('0x19'),_0x3c7db7,JSON['stringify'](_0x3e0a9f));_0x53ba81(_0x3e0a9f);})[_0x6913('0x18')](function(_0x2bd54e){logger[_0x6913('0x14')](_0x6913('0x19'),_0x2bd54e[_0x6913('0x17')],_0x3c7db7);_0x3a1679(_0x261451[_0x6913('0x14')](0x1f4,_0x2bd54e[_0x6913('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 030ac5a..83956d6 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 _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 +var _0xa40c=['update','emit','length','./smsMessage.events','save','remove'];(function(_0x309154,_0x13772b){var _0x51e63a=function(_0x88a2df){while(--_0x88a2df){_0x309154['push'](_0x309154['shift']());}};_0x51e63a(++_0x13772b);}(_0xa40c,0x14d));var _0xca40=function(_0x13eb7e,_0x5841c1){_0x13eb7e=_0x13eb7e-0x0;var _0x15c52e=_0xa40c[_0x13eb7e];return _0x15c52e;};'use strict';var SmsMessageEvents=require(_0xca40('0x0'));var events=[_0xca40('0x1'),_0xca40('0x2'),_0xca40('0x3')];function createListener(_0xc2a295,_0x407d74){return function(_0x3ee5c6){_0x407d74[_0xca40('0x4')](_0xc2a295,_0x3ee5c6);};}function removeListener(_0x10f9b8,_0x30b065){return function(){SmsMessageEvents['removeListener'](_0x10f9b8,_0x30b065);};}exports['register']=function(_0x19242a){for(var _0x2a64c7=0x0,_0x40039e=events[_0xca40('0x5')];_0x2a64c7<_0x40039e;_0x2a64c7++){var _0xaba926=events[_0x2a64c7];var _0x5bb262=createListener('smsMessage:'+_0xaba926,_0x19242a);SmsMessageEvents['on'](_0xaba926,_0x5bb262);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index a7d0468..16d0f00 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 _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 +var _0x56e6=['removeAgents','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','index','/describe','isAuthenticated','/:id','getMembers','/:id/teams','getTeams','post','create','addTeams','addAgents','put','update','delete','removeTeams','/:id/users'];(function(_0x337a14,_0x3ec54f){var _0xd6f396=function(_0x1e1a7d){while(--_0x1e1a7d){_0x337a14['push'](_0x337a14['shift']());}};_0xd6f396(++_0x3ec54f);}(_0x56e6,0x12b));var _0x656e=function(_0x447307,_0x17f67e){_0x447307=_0x447307-0x0;var _0x503f4e=_0x56e6[_0x447307];return _0x503f4e;};'use strict';var multer=require(_0x656e('0x0'));var util=require(_0x656e('0x1'));var path=require('path');var timeout=require(_0x656e('0x2'));var express=require(_0x656e('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x656e('0x4'));var interaction=require(_0x656e('0x5'));var config=require(_0x656e('0x6'));var controller=require(_0x656e('0x7'));router[_0x656e('0x8')]('/',auth['isAuthenticated'](),controller[_0x656e('0x9')]);router[_0x656e('0x8')](_0x656e('0xa'),auth[_0x656e('0xb')](),controller['describe']);router[_0x656e('0x8')](_0x656e('0xc'),auth[_0x656e('0xb')](),controller['show']);router[_0x656e('0x8')]('/:id/members',auth[_0x656e('0xb')](),controller[_0x656e('0xd')]);router['get'](_0x656e('0xe'),auth[_0x656e('0xb')](),controller[_0x656e('0xf')]);router[_0x656e('0x8')]('/:id/users',auth[_0x656e('0xb')](),controller['getAgents']);router[_0x656e('0x10')]('/',auth[_0x656e('0xb')](),controller[_0x656e('0x11')]);router[_0x656e('0x10')](_0x656e('0xe'),auth[_0x656e('0xb')](),controller[_0x656e('0x12')]);router[_0x656e('0x10')]('/:id/users',auth[_0x656e('0xb')](),controller[_0x656e('0x13')]);router[_0x656e('0x14')](_0x656e('0xc'),auth[_0x656e('0xb')](),controller[_0x656e('0x15')]);router[_0x656e('0x16')]('/:id',auth[_0x656e('0xb')](),controller['destroy']);router[_0x656e('0x16')](_0x656e('0xe'),auth[_0x656e('0xb')](),controller[_0x656e('0x17')]);router[_0x656e('0x16')](_0x656e('0x18'),auth[_0x656e('0xb')](),controller[_0x656e('0x19')]);module[_0x656e('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 6e309f2..e5e45d6 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 _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 +var _0x0f32=['rrmemory','beepall','sequelize','exports','name','INTEGER','ENUM'];(function(_0x43bf9d,_0x449824){var _0x484bc7=function(_0x42fcad){while(--_0x42fcad){_0x43bf9d['push'](_0x43bf9d['shift']());}};_0x484bc7(++_0x449824);}(_0x0f32,0x6b));var _0x20f3=function(_0xbeaaf,_0x527110){_0xbeaaf=_0xbeaaf-0x0;var _0x326cb0=_0x0f32[_0xbeaaf];return _0x326cb0;};'use strict';var Sequelize=require(_0x20f3('0x0'));module[_0x20f3('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x20f3('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x20f3('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x20f3('0x4')](_0x20f3('0x5'),_0x20f3('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 214e963..307955c 100644 --- a/server/api/smsQueue/smsQueue.controller.js +++ b/server/api/smsQueue/smsQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','SmsQueues','UserProfileResource','error','stack','name','map','SmsQueue','rawAttributes','type','key','getOptions','where','include','findAll','rows','show','params','model','keys','query','filters','intersection','attributes','fields','includeAll','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','field','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','sequelize','transaction','isEmpty','removeAgents','addAgents','omit','spread','isArray','userSmsQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api'];(function(_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 +var _0x2ef3=['intersection','attributes','model','fields','length','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','update','describe','getMembers','findOne','UserSmsQueue','filters','hasOwnProperty','order','sort','pick','SmsQueueId','filter','User','findAndCountAll','agent','updatedAt','createdAt','SIP','getTeams','Team','nolimit','addTeams','ids','online','voicePause','flatMap','each','findOrCreate','removeTeams','Agents','select','field','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','sequelize','toString','QueryTypes','TeamId','union','compact','value','transaction','isEmpty','emit','addAgents','spread','userSmsQueue:save','removeAgents','isArray','userSmsQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','redis','defaults','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','then','destroy','get','SmsQueues','UserProfileResource','name','map','SmsQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','rows','catch','show','params','keys'];(function(_0x2ea714,_0x34cbdb){var _0x480111=function(_0x521051){while(--_0x521051){_0x2ea714['push'](_0x2ea714['shift']());}};_0x480111(++_0x34cbdb);}(_0x2ef3,0xba));var _0x32ef=function(_0x31d954,_0x4406fd){_0x31d954=_0x31d954-0x0;var _0x1e50fb=_0x2ef3[_0x31d954];return _0x1e50fb;};'use strict';var BPromise=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var _=require(_0x32ef('0x2'));var squel=require(_0x32ef('0x3'));var Redis=require(_0x32ef('0x4'));var qs=require(_0x32ef('0x5'));var logger=require('../../config/logger')(_0x32ef('0x6'));var config=require(_0x32ef('0x7'));var db=require('../../mysqldb')['db'];config[_0x32ef('0x8')]=_[_0x32ef('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x32ef('0xa'))(new Redis(config[_0x32ef('0x8')]));require(_0x32ef('0xb'))[_0x32ef('0xc')](socket);function respondWithStatusCode(_0x234863,_0x298066){_0x298066=_0x298066||0xcc;return function(_0x2484a0){if(_0x2484a0){return _0x234863[_0x32ef('0xd')](_0x298066);}return _0x234863[_0x32ef('0xe')](_0x298066)[_0x32ef('0xf')]();};}function respondWithResult(_0x56eb42,_0x5780e9){_0x5780e9=_0x5780e9||0xc8;return function(_0x401d0b){if(_0x401d0b){return _0x56eb42[_0x32ef('0xe')](_0x5780e9)[_0x32ef('0x10')](_0x401d0b);}};}function respondWithFilteredResult(_0x1499c2,_0x5af651){return function(_0x193714){if(_0x193714){var _0x5afcc2=typeof _0x5af651[_0x32ef('0x11')]==='undefined'&&typeof _0x5af651[_0x32ef('0x12')]===_0x32ef('0x13');var _0x5c3eb9=_0x193714['count'];var _0x19ce1=_0x5afcc2?0x0:_0x5af651['offset'];var _0x326fce=_0x5afcc2?_0x193714[_0x32ef('0x14')]:_0x5af651[_0x32ef('0x11')]+_0x5af651[_0x32ef('0x12')];var _0x57aff1;if(_0x326fce>=_0x5c3eb9){_0x326fce=_0x5c3eb9;_0x57aff1=0xc8;}else{_0x57aff1=0xce;}_0x1499c2['status'](_0x57aff1);return _0x1499c2['set'](_0x32ef('0x15'),_0x19ce1+'-'+_0x326fce+'/'+_0x5c3eb9)[_0x32ef('0x10')](_0x193714);}return null;};}function saveUpdates(_0xb5aed2){return function(_0x53a5ca){if(_0x53a5ca){return _0x53a5ca['update'](_0xb5aed2)[_0x32ef('0x16')](function(_0x1a9476){return _0x1a9476;});}return null;};}function removeEntity(_0x286bfb){return function(_0x57863c){if(_0x57863c){return _0x57863c[_0x32ef('0x17')]()[_0x32ef('0x16')](function(){var _0x4f4c98=_0x57863c[_0x32ef('0x18')]({'plain':!![]});var _0x314ef1=_0x32ef('0x19');return db[_0x32ef('0x1a')][_0x32ef('0x17')]({'where':{'type':_0x314ef1,'resourceId':_0x4f4c98['id']}})[_0x32ef('0x16')](function(){return _0x57863c;});})['then'](function(){_0x286bfb[_0x32ef('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x309866){return function(_0x3a20ca){if(!_0x3a20ca){_0x309866['sendStatus'](0x194);}return _0x3a20ca;};}function handleError(_0x1af371,_0x97780){_0x97780=_0x97780||0x1f4;return function(_0x5e8898){logger['error'](_0x5e8898['stack']);if(_0x5e8898[_0x32ef('0x1b')]){delete _0x5e8898[_0x32ef('0x1b')];}_0x1af371[_0x32ef('0xe')](_0x97780)['send'](_0x5e8898);};}exports['index']=function(_0x19ea6,_0x4d584b){var _0x51a412={};var _0x278495={'count':0x0,'rows':[]};var _0x14d4b3=_[_0x32ef('0x1c')](db[_0x32ef('0x1d')][_0x32ef('0x1e')],function(_0x234175){return{'name':_0x234175[_0x32ef('0x1f')],'type':_0x234175[_0x32ef('0x20')][_0x32ef('0x21')]};});_0x51a412=qs[_0x32ef('0x22')](_0x14d4b3,_0x19ea6);var _0x1335e2={'where':_0x51a412[_0x32ef('0x23')]};return db['SmsQueue'][_0x32ef('0x14')](_0x1335e2)[_0x32ef('0x16')](function(_0x5a04cd){_0x278495[_0x32ef('0x14')]=_0x5a04cd;_0x51a412[_0x32ef('0x24')]=qs[_0x32ef('0x24')](_0x19ea6[_0x32ef('0x25')]);return db['SmsQueue'][_0x32ef('0x26')](_0x51a412);})[_0x32ef('0x16')](function(_0x31dbc3){_0x278495[_0x32ef('0x27')]=_0x31dbc3;return _0x278495;})[_0x32ef('0x16')](respondWithFilteredResult(_0x4d584b,_0x51a412))[_0x32ef('0x28')](handleError(_0x4d584b,null));};exports[_0x32ef('0x29')]=function(_0x575f3e,_0x36ac37){var _0x537214={'raw':!![],'where':{'id':_0x575f3e[_0x32ef('0x2a')]['id']}},_0x38bf73={};_0x38bf73['model']=_[_0x32ef('0x2b')](db[_0x32ef('0x1d')][_0x32ef('0x1e')]);_0x38bf73[_0x32ef('0x25')]=_[_0x32ef('0x2b')](_0x575f3e['query']);_0x38bf73['filters']=_[_0x32ef('0x2c')](_0x38bf73['model'],_0x38bf73[_0x32ef('0x25')]);_0x537214[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x38bf73[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x575f3e[_0x32ef('0x25')]['fields']));_0x537214['attributes']=_0x537214['attributes'][_0x32ef('0x30')]?_0x537214[_0x32ef('0x2d')]:_0x38bf73[_0x32ef('0x2e')];if(_0x575f3e['query']['includeAll']){_0x537214[_0x32ef('0x24')]=[{'all':!![]}];}_0x537214=_[_0x32ef('0x31')]({},_0x537214,_0x575f3e[_0x32ef('0x32')]);return db['SmsQueue']['find'](_0x537214)[_0x32ef('0x16')](handleEntityNotFound(_0x36ac37,null))[_0x32ef('0x16')](respondWithResult(_0x36ac37,null))[_0x32ef('0x28')](handleError(_0x36ac37,null));};exports[_0x32ef('0x33')]=function(_0x3a7c49,_0x211c79){return db[_0x32ef('0x1d')][_0x32ef('0x33')](_0x3a7c49[_0x32ef('0x34')],{})['then'](function(_0x3a4a99){var _0x36e374=_0x3a7c49[_0x32ef('0x35')]['get']({'plain':!![]});if(!_0x36e374)throw new Error(_0x32ef('0x36'));if(_0x36e374[_0x32ef('0x37')]===_0x32ef('0x35')){var _0x393a89=_0x3a4a99[_0x32ef('0x18')]({'plain':!![]});var _0x33a0fb=_0x32ef('0x19');return db[_0x32ef('0x38')][_0x32ef('0x39')]({'where':{'name':_0x33a0fb,'userProfileId':_0x36e374[_0x32ef('0x3a')]},'raw':!![]})[_0x32ef('0x16')](function(_0x4615b4){if(_0x4615b4&&_0x4615b4['autoAssociation']===0x0){return db[_0x32ef('0x1a')][_0x32ef('0x33')]({'name':_0x393a89[_0x32ef('0x1b')],'resourceId':_0x393a89['id'],'type':_0x4615b4[_0x32ef('0x1b')],'sectionId':_0x4615b4['id']},{})[_0x32ef('0x16')](function(){return _0x3a4a99;});}else{return _0x3a4a99;}})[_0x32ef('0x28')](function(_0x3c0e44){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c0e44);throw _0x3c0e44;});}return _0x3a4a99;})[_0x32ef('0x16')](respondWithResult(_0x211c79,0xc9))[_0x32ef('0x28')](handleError(_0x211c79,null));};exports[_0x32ef('0x3b')]=function(_0x765c63,_0x5dca14){if(_0x765c63[_0x32ef('0x34')]['id']){delete _0x765c63[_0x32ef('0x34')]['id'];}return db['SmsQueue'][_0x32ef('0x39')]({'where':{'id':_0x765c63['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x5dca14,null))[_0x32ef('0x16')](saveUpdates(_0x765c63[_0x32ef('0x34')],null))[_0x32ef('0x16')](respondWithResult(_0x5dca14,null))[_0x32ef('0x28')](handleError(_0x5dca14,null));};exports[_0x32ef('0x17')]=function(_0x321ef7,_0x3d35a1){return db[_0x32ef('0x1d')][_0x32ef('0x39')]({'where':{'id':_0x321ef7['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x3d35a1,null))['then'](removeEntity(_0x3d35a1,null))[_0x32ef('0x28')](handleError(_0x3d35a1,null));};exports[_0x32ef('0x3c')]=function(_0x2dd94f,_0x4d8393){return db[_0x32ef('0x1d')][_0x32ef('0x3c')]()[_0x32ef('0x16')](respondWithResult(_0x4d8393,null))[_0x32ef('0x28')](handleError(_0x4d8393,null));};exports[_0x32ef('0x3d')]=function(_0x40bf12,_0x12c9e6){var _0x47dbe1={'raw':!![],'where':{}},_0x5cb6fc={},_0x36252c;return db[_0x32ef('0x1d')][_0x32ef('0x3e')]({'where':{'id':_0x40bf12[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x12c9e6,null))[_0x32ef('0x16')](function(_0x44ad11){if(_0x44ad11){_0x36252c=_0x44ad11[_0x32ef('0x18')]({'plain':!![]});_0x5cb6fc[_0x32ef('0x2e')]=_[_0x32ef('0x2b')](db[_0x32ef('0x3f')][_0x32ef('0x1e')]);_0x5cb6fc[_0x32ef('0x25')]=_['keys'](_0x40bf12[_0x32ef('0x25')]);_0x5cb6fc[_0x32ef('0x40')]=_[_0x32ef('0x2c')](_0x5cb6fc[_0x32ef('0x2e')],_0x5cb6fc[_0x32ef('0x25')]);_0x47dbe1[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x5cb6fc[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x2f')]));_0x47dbe1[_0x32ef('0x2d')]=_0x47dbe1[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x47dbe1[_0x32ef('0x2d')]:_0x5cb6fc[_0x32ef('0x2e')];if(!_0x40bf12[_0x32ef('0x25')][_0x32ef('0x41')]('nolimit')){_0x47dbe1['limit']=qs[_0x32ef('0x12')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x12')]);_0x47dbe1[_0x32ef('0x11')]=qs[_0x32ef('0x11')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x11')]);}_0x47dbe1[_0x32ef('0x42')]=qs[_0x32ef('0x43')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x43')]);_0x47dbe1['where']=qs[_0x32ef('0x40')](_[_0x32ef('0x44')](_0x40bf12[_0x32ef('0x25')],_0x5cb6fc[_0x32ef('0x40')]));_0x47dbe1[_0x32ef('0x23')][_0x32ef('0x45')]=_0x44ad11['id'];if(_0x40bf12['query'][_0x32ef('0x46')]){_0x47dbe1[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x47dbe1['where'],{'$or':_[_0x32ef('0x1c')](_0x47dbe1['attributes'],function(_0x2ee3dd){var _0xbe35b={};_0xbe35b[_0x2ee3dd]={'$like':'%'+_0x40bf12['query'][_0x32ef('0x46')]+'%'};return _0xbe35b;})});}_0x47dbe1=_['merge']({},_0x47dbe1,_0x40bf12[_0x32ef('0x32')]);return db[_0x32ef('0x3f')][_0x32ef('0x26')](_0x47dbe1);}})[_0x32ef('0x16')](function(_0x2c7bee){if(_0x2c7bee){return db[_0x32ef('0x47')][_0x32ef('0x48')]({'where':{'id':_['map'](_0x2c7bee,'UserId'),'role':_0x32ef('0x49')},'attributes':['id','name','smsPause',_0x32ef('0x4a'),_0x32ef('0x4b')]});}})[_0x32ef('0x16')](function(_0x6aae59){if(_0x6aae59){return{'count':_0x6aae59[_0x32ef('0x14')],'rows':_[_0x32ef('0x1c')](_0x6aae59[_0x32ef('0x27')],function(_0x4249c3){return{'membername':_0x4249c3[_0x32ef('0x1b')],'UserId':_0x4249c3['id'],'queue_name':_0x36252c[_0x32ef('0x1b')],'SmsQueueId':_0x36252c['id'],'interface':util['format']('%s/%s',_0x32ef('0x4c'),_0x4249c3[_0x32ef('0x1b')]),'penalty':0x0,'paused':_0x4249c3['smsPause'],'createdAt':_0x4249c3[_0x32ef('0x4b')],'updatedAt':_0x4249c3[_0x32ef('0x4a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x32ef('0x16')](respondWithFilteredResult(_0x12c9e6,_0x47dbe1))['catch'](handleError(_0x12c9e6,null));};exports[_0x32ef('0x4d')]=function(_0x3c31d0,_0x20dcc5){var _0x52dfe0={};var _0x5e6030={};var _0x13ea1a;var _0x47d8bf;return db[_0x32ef('0x1d')]['findOne']({'where':{'id':_0x3c31d0['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x20dcc5,null))[_0x32ef('0x16')](function(_0x10cb37){if(_0x10cb37){_0x13ea1a=_0x10cb37;_0x5e6030['model']=_[_0x32ef('0x2b')](db[_0x32ef('0x4e')][_0x32ef('0x1e')]);_0x5e6030['query']=_[_0x32ef('0x2b')](_0x3c31d0[_0x32ef('0x25')]);_0x5e6030['filters']=_['intersection'](_0x5e6030[_0x32ef('0x2e')],_0x5e6030[_0x32ef('0x25')]);_0x52dfe0[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x5e6030[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x3c31d0['query'][_0x32ef('0x2f')]));_0x52dfe0[_0x32ef('0x2d')]=_0x52dfe0[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x52dfe0[_0x32ef('0x2d')]:_0x5e6030[_0x32ef('0x2e')];_0x52dfe0[_0x32ef('0x42')]=qs[_0x32ef('0x43')](_0x3c31d0[_0x32ef('0x25')]['sort']);_0x52dfe0[_0x32ef('0x23')]=qs[_0x32ef('0x40')](_[_0x32ef('0x44')](_0x3c31d0[_0x32ef('0x25')],_0x5e6030[_0x32ef('0x40')]));if(_0x3c31d0['query']['filter']){_0x52dfe0[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x52dfe0[_0x32ef('0x23')],{'$or':_[_0x32ef('0x1c')](_0x52dfe0[_0x32ef('0x2d')],function(_0x526fb1){var _0x3372d9={};_0x3372d9[_0x526fb1]={'$like':'%'+_0x3c31d0['query'][_0x32ef('0x46')]+'%'};return _0x3372d9;})});}_0x52dfe0=_[_0x32ef('0x31')]({},_0x52dfe0,_0x3c31d0['options']);return _0x13ea1a['getTeams'](_0x52dfe0);}})[_0x32ef('0x16')](function(_0x1538d0){if(_0x1538d0){_0x47d8bf=_0x1538d0[_0x32ef('0x30')];if(!_0x3c31d0['query']['hasOwnProperty'](_0x32ef('0x4f'))){_0x52dfe0[_0x32ef('0x12')]=qs[_0x32ef('0x12')](_0x3c31d0[_0x32ef('0x25')]['limit']);_0x52dfe0[_0x32ef('0x11')]=qs[_0x32ef('0x11')](_0x3c31d0[_0x32ef('0x25')][_0x32ef('0x11')]);}return _0x13ea1a[_0x32ef('0x4d')](_0x52dfe0);}})[_0x32ef('0x16')](function(_0x43b176){if(_0x43b176){return _0x43b176?{'count':_0x47d8bf,'rows':_0x43b176}:null;}})[_0x32ef('0x16')](respondWithResult(_0x20dcc5,null))[_0x32ef('0x28')](handleError(_0x20dcc5,null));};exports[_0x32ef('0x50')]=function(_0x132d9f,_0x3978cb){var _0x52b32f=_0x132d9f['body'][_0x32ef('0x51')];return db[_0x32ef('0x4e')]['findAll']({'where':{'id':_0x52b32f},'attributes':['id'],'include':[{'model':db[_0x32ef('0x47')],'as':'Agents','attributes':['id',_0x32ef('0x1b'),_0x32ef('0x52'),_0x32ef('0x53'),'interface'],'raw':!![]}]})[_0x32ef('0x16')](function(_0x4978a6){if(_0x4978a6){var _0x141fec=_[_0x32ef('0x54')](_0x4978a6,function(_0x47e3cc){var _0x4c70e0=_0x47e3cc[_0x32ef('0x18')]({'plain':!![]});return _0x4c70e0['Agents'];});return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x132d9f[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](function(_0x1adcb8){return db['sequelize']['transaction'](function(_0x4f1b94){return _0x1adcb8[_0x32ef('0x50')](_0x52b32f,{'transaction':_0x4f1b94})['then'](function(){return BPromise[_0x32ef('0x55')](_0x141fec,function(_0x13a374){return db[_0x32ef('0x3f')][_0x32ef('0x56')]({'where':{'UserId':_0x13a374['id'],'SmsQueueId':_0x132d9f[_0x32ef('0x2a')]['id']},'transaction':_0x4f1b94});});})[_0x32ef('0x16')](function(){_0x141fec['forEach'](function(_0x3d9245){socket['emit']('userSmsQueue:save',{'UserId':_0x3d9245['id'],'SmsQueueId':_0x1adcb8['id']});});});});});}})[_0x32ef('0x16')](respondWithStatusCode(_0x3978cb,null))['catch'](handleError(_0x3978cb,null));};exports[_0x32ef('0x57')]=function(_0x313798,_0x4d64ec){return db[_0x32ef('0x4e')][_0x32ef('0x26')]({'where':{'id':_0x313798[_0x32ef('0x25')][_0x32ef('0x51')]},'attributes':['id'],'include':[{'model':db[_0x32ef('0x47')],'as':_0x32ef('0x58'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4d64ec,null))['then'](function(_0x35b10d){var _0x5e0b55=_[_0x32ef('0x1c')](_0x35b10d,'id');var _0x266688=[];var _0x114d8e=[];var _0x1782a5=squel[_0x32ef('0x59')]();_0x1782a5[_0x32ef('0x5a')]('tq.TeamId')[_0x32ef('0x5b')](_0x32ef('0x5c'),'tq')[_0x32ef('0x5d')](_0x32ef('0x5e'),'ut',_0x32ef('0x5f'))['where']('SmsQueueId\x20=\x20?',_0x313798[_0x32ef('0x2a')]['id']);for(var _0x904a4f=0x0;_0x904a4f<_0x35b10d['length'];_0x904a4f+=0x1){let _0x211fb1=_0x35b10d[_0x904a4f];for(var _0x2e333d=0x0;_0x2e333d<_0x211fb1[_0x32ef('0x58')][_0x32ef('0x30')];_0x2e333d+=0x1){let _0xc3664d=_0x211fb1[_0x32ef('0x58')][_0x2e333d];var _0xfb4845=_0x1782a5[_0x32ef('0x60')]();_0xfb4845[_0x32ef('0x23')]('ut.UserId\x20=\x20?',_0xc3664d['id']);_0x114d8e[_0x32ef('0x61')](db[_0x32ef('0x62')]['query'](_0xfb4845[_0x32ef('0x63')](),{'type':db['sequelize'][_0x32ef('0x64')]['SELECT']})[_0x32ef('0x16')](function(_0x39300f){if(_0x39300f[_0x32ef('0x30')]===0x1){return _0xc3664d['id'];}else{var _0x3e000c=_['every'](_[_0x32ef('0x1c')](_0x39300f,_0x32ef('0x65')),function(_0x31f99f){return _['includes'](_0x5e0b55,_0x31f99f);});if(_0x3e000c){return _0xc3664d['id'];}}}));}}return BPromise['all'](_0x114d8e)['then'](function(_0x1aff33){_0x266688=_(_0x266688)[_0x32ef('0x66')](_0x1aff33)[_0x32ef('0x67')]()[_0x32ef('0x68')]();return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x313798[_0x32ef('0x2a')]['id']}})['then'](function(_0x471de6){return db[_0x32ef('0x62')][_0x32ef('0x69')](function(_0x4baa7a){return _0x471de6[_0x32ef('0x57')](_0x313798[_0x32ef('0x25')][_0x32ef('0x51')],{'transaction':_0x4baa7a})[_0x32ef('0x16')](function(){if(!_[_0x32ef('0x6a')](_0x266688)){return _0x471de6['removeAgents'](_0x266688,{'transaction':_0x4baa7a});}})[_0x32ef('0x16')](function(){_0x266688['forEach'](function(_0x4f0433){socket[_0x32ef('0x6b')]('userSmsQueue:remove',{'UserId':_0x4f0433,'SmsQueueId':_0x471de6['id']});});});});});});})['then'](respondWithStatusCode(_0x4d64ec,null))[_0x32ef('0x28')](handleError(_0x4d64ec,null));};exports[_0x32ef('0x6c')]=function(_0xf6bc02,_0x3b9896){return db['SmsQueue'][_0x32ef('0x39')]({'where':{'id':_0xf6bc02['params']['id']}})['then'](handleEntityNotFound(_0x3b9896,null))[_0x32ef('0x16')](function(_0x56aede){if(_0x56aede){return _0x56aede[_0x32ef('0x6c')](_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')],_['omit'](_0xf6bc02['body'],[_0x32ef('0x51'),'id'])||{})[_0x32ef('0x6d')](function(_0x2c4a3c){for(var _0x3741f8=0x0;_0x3741f8<_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')][_0x32ef('0x30')];_0x3741f8+=0x1){socket['emit'](_0x32ef('0x6e'),{'UserId':Number(_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')][_0x3741f8]),'SmsQueueId':Number(_0xf6bc02[_0x32ef('0x2a')]['id'])});}return _0x2c4a3c;});}})['then'](respondWithResult(_0x3b9896,null))['catch'](handleError(_0x3b9896,null));};exports[_0x32ef('0x6f')]=function(_0x5eb320,_0x116951){return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x5eb320['params']['id']}})['then'](handleEntityNotFound(_0x116951,null))[_0x32ef('0x16')](function(_0x33f6c3){if(_0x33f6c3){return _0x33f6c3[_0x32ef('0x6f')](_0x5eb320[_0x32ef('0x25')]['ids'])[_0x32ef('0x16')](function(){if(_[_0x32ef('0x70')](_0x5eb320[_0x32ef('0x25')]['ids'])){for(var _0x2895ad=0x0;_0x2895ad<_0x5eb320['query'][_0x32ef('0x51')][_0x32ef('0x30')];_0x2895ad+=0x1){socket['emit']('userSmsQueue:remove',{'UserId':Number(_0x5eb320[_0x32ef('0x25')][_0x32ef('0x51')][_0x2895ad]),'SmsQueueId':Number(_0x5eb320[_0x32ef('0x2a')]['id'])});}}else{socket[_0x32ef('0x6b')](_0x32ef('0x71'),{'UserId':Number(_0x5eb320[_0x32ef('0x25')][_0x32ef('0x51')]),'SmsQueueId':Number(_0x5eb320[_0x32ef('0x2a')]['id'])});}});}})[_0x32ef('0x16')](respondWithStatusCode(_0x116951,null))['catch'](handleError(_0x116951,null));};exports[_0x32ef('0x72')]=function(_0x583290,_0x22d657){var _0x7e47b9={};var _0x1d9d57={};var _0x18cf5d;var _0x102f2f;return db['SmsQueue'][_0x32ef('0x3e')]({'where':{'id':_0x583290[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x22d657,null))[_0x32ef('0x16')](function(_0x1db74d){if(_0x1db74d){_0x18cf5d=_0x1db74d;_0x1d9d57[_0x32ef('0x2e')]=_[_0x32ef('0x2b')](db[_0x32ef('0x47')][_0x32ef('0x1e')]);_0x1d9d57['query']=_['keys'](_0x583290['query']);_0x1d9d57[_0x32ef('0x40')]=_[_0x32ef('0x2c')](_0x1d9d57['model'],_0x1d9d57[_0x32ef('0x25')]);_0x7e47b9['attributes']=_[_0x32ef('0x2c')](_0x1d9d57['model'],qs['fields'](_0x583290[_0x32ef('0x25')][_0x32ef('0x2f')]));_0x7e47b9[_0x32ef('0x2d')]=_0x7e47b9[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x7e47b9['attributes']:_0x1d9d57[_0x32ef('0x2e')];_0x7e47b9['order']=qs[_0x32ef('0x43')](_0x583290['query']['sort']);_0x7e47b9['where']=qs['filters'](_['pick'](_0x583290[_0x32ef('0x25')],_0x1d9d57[_0x32ef('0x40')]));if(_0x583290['query'][_0x32ef('0x46')]){_0x7e47b9[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x7e47b9[_0x32ef('0x23')],{'$or':_[_0x32ef('0x1c')](_0x7e47b9[_0x32ef('0x2d')],function(_0x59f0aa){var _0x2ac861={};_0x2ac861[_0x59f0aa]={'$like':'%'+_0x583290['query'][_0x32ef('0x46')]+'%'};return _0x2ac861;})});}_0x7e47b9=_[_0x32ef('0x31')]({},_0x7e47b9,_0x583290['options']);return _0x18cf5d[_0x32ef('0x72')](_0x7e47b9);}})['then'](function(_0x4557b0){if(_0x4557b0){_0x102f2f=_0x4557b0[_0x32ef('0x30')];if(!_0x583290[_0x32ef('0x25')][_0x32ef('0x41')]('nolimit')){_0x7e47b9[_0x32ef('0x12')]=qs[_0x32ef('0x12')](_0x583290[_0x32ef('0x25')][_0x32ef('0x12')]);_0x7e47b9['offset']=qs[_0x32ef('0x11')](_0x583290['query'][_0x32ef('0x11')]);}return _0x18cf5d[_0x32ef('0x72')](_0x7e47b9);}})[_0x32ef('0x16')](function(_0x28ef17){if(_0x28ef17){return _0x28ef17?{'count':_0x102f2f,'rows':_0x28ef17}:null;}})[_0x32ef('0x16')](respondWithResult(_0x22d657,null))[_0x32ef('0x28')](handleError(_0x22d657,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index fbd544e..01cdca4 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 _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 +var _0xaa15=['events','../../mysqldb','SmsQueue','update','remove','emit','hasOwnProperty','hook'];(function(_0x959361,_0x111612){var _0x26eead=function(_0x36c5f7){while(--_0x36c5f7){_0x959361['push'](_0x959361['shift']());}};_0x26eead(++_0x111612);}(_0xaa15,0xd8));var _0x5aa1=function(_0x43d8ad,_0x57afa7){_0x43d8ad=_0x43d8ad-0x0;var _0x43b715=_0xaa15[_0x43d8ad];return _0x43b715;};'use strict';var EventEmitter=require(_0x5aa1('0x0'));var SmsQueue=require(_0x5aa1('0x1'))['db'][_0x5aa1('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x5aa1('0x3'),'afterDestroy':_0x5aa1('0x4')};function emitEvent(_0x1e9389){return function(_0x2b4427,_0x3550d0,_0x38076b){SmsQueueEvents['emit'](_0x1e9389+':'+_0x2b4427['id'],_0x2b4427);SmsQueueEvents[_0x5aa1('0x5')](_0x1e9389,_0x2b4427);_0x38076b(null);};}for(var e in events){if(events[_0x5aa1('0x6')](e)){var event=events[e];SmsQueue[_0x5aa1('0x7')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 2ca7217..f8b20f2 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 _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 +var _0x2494=['path','rimraf','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','sms_queues','lodash','util','../../config/logger','api'];(function(_0x34ec08,_0x27d58e){var _0xd1df76=function(_0x5547a7){while(--_0x5547a7){_0x34ec08['push'](_0x34ec08['shift']());}};_0xd1df76(++_0x27d58e);}(_0x2494,0xa4));var _0x4249=function(_0x2f6d10,_0x3b9516){_0x2f6d10=_0x2f6d10-0x0;var _0x1e512b=_0x2494[_0x2f6d10];return _0x1e512b;};'use strict';var _=require(_0x4249('0x0'));var util=require(_0x4249('0x1'));var logger=require(_0x4249('0x2'))(_0x4249('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4249('0x4'));var rimraf=require(_0x4249('0x5'));var config=require(_0x4249('0x6'));var attributes=require(_0x4249('0x7'));module[_0x4249('0x8')]=function(_0x322548,_0x1bb0d2){return _0x322548[_0x4249('0x9')](_0x4249('0xa'),attributes,{'tableName':_0x4249('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index cdf90b4..5fc4e6a 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 _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 +var _0x6cfa=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','info','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueue,\x20%s,\x20%s','message','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowSmsQueue','find','lodash','util','moment','bluebird','randomstring'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x6cfa,0x128));var _0xa6cf=function(_0x2af47e,_0x1d2a86){_0x2af47e=_0x2af47e-0x0;var _0x5bca26=_0x6cfa[_0x2af47e];return _0x5bca26;};'use strict';var _=require(_0xa6cf('0x0'));var util=require(_0xa6cf('0x1'));var moment=require(_0xa6cf('0x2'));var BPromise=require(_0xa6cf('0x3'));var rs=require(_0xa6cf('0x4'));var fs=require('fs');var Redis=require(_0xa6cf('0x5'));var db=require(_0xa6cf('0x6'))['db'];var utils=require(_0xa6cf('0x7'));var logger=require(_0xa6cf('0x8'))(_0xa6cf('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa6cf('0xa')][_0xa6cf('0xb')]({'port':0x232a});config[_0xa6cf('0xc')]=_[_0xa6cf('0xd')](config['redis'],{'host':_0xa6cf('0xe'),'port':0x18eb});var socket=require(_0xa6cf('0xf'))(new Redis(config[_0xa6cf('0xc')]));require(_0xa6cf('0x10'))[_0xa6cf('0x11')](socket);function respondWithRpcPromise(_0x7f9ba1,_0x157ffb,_0x24a861){return new BPromise(function(_0xa7669c,_0x4b6c23){return client[_0xa6cf('0x12')](_0x7f9ba1,_0x24a861)[_0xa6cf('0x13')](function(_0x4d9acd){logger[_0xa6cf('0x14')]('SmsQueue,\x20%s,\x20%s',_0x157ffb,_0xa6cf('0x15'));logger[_0xa6cf('0x16')](_0xa6cf('0x17'),_0x157ffb,_0xa6cf('0x15'),JSON[_0xa6cf('0x18')](_0x4d9acd));if(_0x4d9acd[_0xa6cf('0x19')]){if(_0x4d9acd[_0xa6cf('0x19')][_0xa6cf('0x1a')]===0x1f4){logger['error'](_0xa6cf('0x1b'),_0x157ffb,_0x4d9acd[_0xa6cf('0x19')][_0xa6cf('0x1c')]);return _0x4b6c23(_0x4d9acd[_0xa6cf('0x19')][_0xa6cf('0x1c')]);}logger[_0xa6cf('0x19')](_0xa6cf('0x1b'),_0x157ffb,_0x4d9acd[_0xa6cf('0x19')]['message']);return _0xa7669c(_0x4d9acd[_0xa6cf('0x19')][_0xa6cf('0x1c')]);}else{logger[_0xa6cf('0x14')](_0xa6cf('0x1b'),_0x157ffb,_0xa6cf('0x15'));_0xa7669c(_0x4d9acd['result'][_0xa6cf('0x1c')]);}})[_0xa6cf('0x1d')](function(_0x52fd0d){logger['error'](_0xa6cf('0x1b'),_0x157ffb,_0x52fd0d);_0x4b6c23(_0x52fd0d);});});}exports[_0xa6cf('0x1e')]=function(_0xff4fd){var _0x113fee=this;return new Promise(function(_0x26bb9,_0x28167c){return db[_0xa6cf('0x1f')][_0xa6cf('0x20')]({'raw':_0xff4fd[_0xa6cf('0x21')]?_0xff4fd[_0xa6cf('0x21')][_0xa6cf('0x22')]===undefined?!![]:![]:!![],'where':_0xff4fd[_0xa6cf('0x21')]?_0xff4fd[_0xa6cf('0x21')][_0xa6cf('0x23')]||null:null,'attributes':_0xff4fd[_0xa6cf('0x21')]?_0xff4fd[_0xa6cf('0x21')][_0xa6cf('0x24')]||null:null,'limit':_0xff4fd['options']?_0xff4fd[_0xa6cf('0x21')][_0xa6cf('0x25')]||null:null,'include':_0xff4fd['options']?_0xff4fd[_0xa6cf('0x21')][_0xa6cf('0x26')]?_[_0xa6cf('0x27')](_0xff4fd[_0xa6cf('0x21')][_0xa6cf('0x26')],function(_0x8cae32){return{'model':db[_0x8cae32[_0xa6cf('0x28')]],'as':_0x8cae32['as'],'attributes':_0x8cae32[_0xa6cf('0x24')],'include':_0x8cae32[_0xa6cf('0x26')]?_[_0xa6cf('0x27')](_0x8cae32['include'],function(_0x4edfd6){return{'model':db[_0x4edfd6[_0xa6cf('0x28')]],'as':_0x4edfd6['as'],'attributes':_0x4edfd6[_0xa6cf('0x24')],'include':_0x4edfd6[_0xa6cf('0x26')]?_[_0xa6cf('0x27')](_0x4edfd6[_0xa6cf('0x26')],function(_0x140735){return{'model':db[_0x140735[_0xa6cf('0x28')]],'as':_0x140735['as'],'attributes':_0x140735['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2f299f){logger[_0xa6cf('0x14')]('GetSmsQueue',_0xff4fd);logger[_0xa6cf('0x16')](_0xa6cf('0x1e'),_0xff4fd,JSON[_0xa6cf('0x18')](_0x2f299f));_0x26bb9(_0x2f299f);})[_0xa6cf('0x1d')](function(_0x28b2f9){logger[_0xa6cf('0x19')](_0xa6cf('0x1e'),_0x28b2f9['message'],_0xff4fd);_0x28167c(_0x113fee[_0xa6cf('0x19')](0x1f4,_0x28b2f9[_0xa6cf('0x1c')]));});});};exports[_0xa6cf('0x29')]=function(_0xe7e2e5){var _0x4cf0c7=this;return new Promise(function(_0x1ec1c9,_0x1368e8){return db[_0xa6cf('0x1f')][_0xa6cf('0x2a')]({'raw':_0xe7e2e5[_0xa6cf('0x21')]?_0xe7e2e5[_0xa6cf('0x21')][_0xa6cf('0x22')]===undefined?!![]:![]:!![],'where':_0xe7e2e5[_0xa6cf('0x21')]?_0xe7e2e5[_0xa6cf('0x21')]['where']||null:null,'attributes':_0xe7e2e5[_0xa6cf('0x21')]?_0xe7e2e5[_0xa6cf('0x21')][_0xa6cf('0x24')]||null:null,'include':_0xe7e2e5['options']?_0xe7e2e5[_0xa6cf('0x21')][_0xa6cf('0x26')]?_[_0xa6cf('0x27')](_0xe7e2e5[_0xa6cf('0x21')][_0xa6cf('0x26')],function(_0x511798){return{'model':db[_0x511798['model']],'as':_0x511798['as'],'attributes':_0x511798[_0xa6cf('0x24')],'include':_0x511798['include']?_[_0xa6cf('0x27')](_0x511798['include'],function(_0x509397){return{'model':db[_0x509397[_0xa6cf('0x28')]],'as':_0x509397['as'],'attributes':_0x509397[_0xa6cf('0x24')],'include':_0x509397['include']?_['map'](_0x509397[_0xa6cf('0x26')],function(_0x21d2a5){return{'model':db[_0x21d2a5[_0xa6cf('0x28')]],'as':_0x21d2a5['as'],'attributes':_0x21d2a5[_0xa6cf('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3421f4){logger['info'](_0xa6cf('0x29'),_0xe7e2e5);logger['debug'](_0xa6cf('0x29'),_0xe7e2e5,JSON[_0xa6cf('0x18')](_0x3421f4));_0x1ec1c9(_0x3421f4);})['catch'](function(_0x286f86){logger['error'](_0xa6cf('0x29'),_0x286f86['message'],_0xe7e2e5);_0x1368e8(_0x4cf0c7[_0xa6cf('0x19')](0x1f4,_0x286f86[_0xa6cf('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 95d92cb..5fae859 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 _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 +var _0xeabe=['save','remove','update','emit','removeListener','register','length','smsQueue:','./smsQueue.events'];(function(_0x3fb030,_0x12aebe){var _0xd6899b=function(_0x327646){while(--_0x327646){_0x3fb030['push'](_0x3fb030['shift']());}};_0xd6899b(++_0x12aebe);}(_0xeabe,0xd7));var _0xeeab=function(_0x48b057,_0x143f82){_0x48b057=_0x48b057-0x0;var _0xa19f08=_0xeabe[_0x48b057];return _0xa19f08;};'use strict';var SmsQueueEvents=require(_0xeeab('0x0'));var events=[_0xeeab('0x1'),_0xeeab('0x2'),_0xeeab('0x3')];function createListener(_0xd3b0d4,_0x4c5048){return function(_0x4353b9){_0x4c5048[_0xeeab('0x4')](_0xd3b0d4,_0x4353b9);};}function removeListener(_0x58d58a,_0x26dde9){return function(){SmsQueueEvents[_0xeeab('0x5')](_0x58d58a,_0x26dde9);};}exports[_0xeeab('0x6')]=function(_0xa88abe){for(var _0x180208=0x0,_0x1a0539=events[_0xeeab('0x7')];_0x180208<_0x1a0539;_0x180208++){var _0x4a4775=events[_0x180208];var _0x56d7ed=createListener(_0xeeab('0x8')+_0x4a4775,_0xa88abe);SmsQueueEvents['on'](_0x4a4775,_0x56d7ed);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index d482dad..c082218 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 _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 +var _0x47aa=['path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','describe','show','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x237815,_0x1ef2b0){var _0x5498ee=function(_0x5d0f6e){while(--_0x5d0f6e){_0x237815['push'](_0x237815['shift']());}};_0x5498ee(++_0x1ef2b0);}(_0x47aa,0x9e));var _0xa47a=function(_0x565ead,_0x2a35d1){_0x565ead=_0x565ead-0x0;var _0x4c2196=_0x47aa[_0x565ead];return _0x4c2196;};'use strict';var multer=require(_0xa47a('0x0'));var util=require(_0xa47a('0x1'));var path=require(_0xa47a('0x2'));var timeout=require('connect-timeout');var express=require(_0xa47a('0x3'));var router=express['Router']();var fs_extra=require(_0xa47a('0x4'));var auth=require(_0xa47a('0x5'));var interaction=require(_0xa47a('0x6'));var config=require(_0xa47a('0x7'));var controller=require(_0xa47a('0x8'));router[_0xa47a('0x9')]('/',auth[_0xa47a('0xa')](),controller['index']);router[_0xa47a('0x9')]('/describe',auth[_0xa47a('0xa')](),controller[_0xa47a('0xb')]);router[_0xa47a('0x9')]('/:id',auth[_0xa47a('0xa')](),controller[_0xa47a('0xc')]);router[_0xa47a('0xd')]('/',auth[_0xa47a('0xa')](),controller[_0xa47a('0xe')]);router[_0xa47a('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xa47a('0x10')]);router[_0xa47a('0x11')]('/:id',auth[_0xa47a('0xa')](),controller[_0xa47a('0x12')]);module[_0xa47a('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 9080d44..02fd7a0 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 _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 +var _0x102c=['exports','STRING','DATE','moment','sequelize'];(function(_0x491cbe,_0x45c8ba){var _0x59449d=function(_0x21b463){while(--_0x21b463){_0x491cbe['push'](_0x491cbe['shift']());}};_0x59449d(++_0x45c8ba);}(_0x102c,0x16b));var _0xc102=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x102c[_0x2b10c6];return _0x3789d2;};'use strict';var moment=require(_0xc102('0x0'));var Sequelize=require(_0xc102('0x1'));module[_0xc102('0x2')]={'uniqueid':{'type':Sequelize[_0xc102('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xc102('0x3')]},'joinAt':{'type':Sequelize[_0xc102('0x4')]},'leaveAt':{'type':Sequelize[_0xc102('0x4')]},'acceptAt':{'type':Sequelize[_0xc102('0x4')]},'exitAt':{'type':Sequelize[_0xc102('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 7c6ab65..71e87c1 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 _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 +var _0x12fd=['end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','type','key','model','map','query','filters','attributes','fields','length','order','sort','where','filter','merge','name','options','includeAll','include','findAll','rows','catch','show','params','SmsQueueReport','rawAttributes','keys','intersection','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x502369,_0x5caf05){var _0x4fe064=function(_0x409af7){while(--_0x409af7){_0x502369['push'](_0x502369['shift']());}};_0x4fe064(++_0x5caf05);}(_0x12fd,0xb8));var _0xd12f=function(_0x490fff,_0xce1fe5){_0x490fff=_0x490fff-0x0;var _0x376304=_0x12fd[_0x490fff];return _0x376304;};'use strict';var emlformat=require(_0xd12f('0x0'));var rimraf=require(_0xd12f('0x1'));var zipdir=require(_0xd12f('0x2'));var jsonpatch=require(_0xd12f('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd12f('0x4'));var util=require('util');var path=require(_0xd12f('0x5'));var sox=require('sox');var csv=require(_0xd12f('0x6'));var ejs=require(_0xd12f('0x7'));var fs=require('fs');var fs_extra=require(_0xd12f('0x8'));var _=require('lodash');var squel=require(_0xd12f('0x9'));var crypto=require(_0xd12f('0xa'));var jsforce=require(_0xd12f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xd12f('0x6'));var querystring=require(_0xd12f('0xc'));var Papa=require(_0xd12f('0xd'));var Redis=require(_0xd12f('0xe'));var authService=require(_0xd12f('0xf'));var qs=require(_0xd12f('0x10'));var as=require(_0xd12f('0x11'));var hardwareService=require(_0xd12f('0x12'));var logger=require(_0xd12f('0x13'))(_0xd12f('0x14'));var utils=require('../../config/utils');var config=require(_0xd12f('0x15'));var licenseUtil=require(_0xd12f('0x16'));var db=require(_0xd12f('0x17'))['db'];function respondWithStatusCode(_0x147067,_0x3c1add){_0x3c1add=_0x3c1add||0xcc;return function(_0x431a91){if(_0x431a91){return _0x147067[_0xd12f('0x18')](_0x3c1add);}return _0x147067[_0xd12f('0x19')](_0x3c1add)[_0xd12f('0x1a')]();};}function respondWithResult(_0x8eb667,_0x3f321a){_0x3f321a=_0x3f321a||0xc8;return function(_0x1fed94){if(_0x1fed94){return _0x8eb667[_0xd12f('0x19')](_0x3f321a)[_0xd12f('0x1b')](_0x1fed94);}};}function respondWithFilteredResult(_0x12dcdd,_0x38122a){return function(_0xde0ac9){if(_0xde0ac9){var _0x22fb16=typeof _0x38122a[_0xd12f('0x1c')]===_0xd12f('0x1d')&&typeof _0x38122a['limit']===_0xd12f('0x1d');var _0x23830d=_0xde0ac9[_0xd12f('0x1e')];var _0x3fa648=_0x22fb16?0x0:_0x38122a[_0xd12f('0x1c')];var _0x59f21d=_0x22fb16?_0xde0ac9[_0xd12f('0x1e')]:_0x38122a[_0xd12f('0x1c')]+_0x38122a[_0xd12f('0x1f')];var _0x45b725;if(_0x59f21d>=_0x23830d){_0x59f21d=_0x23830d;_0x45b725=0xc8;}else{_0x45b725=0xce;}_0x12dcdd[_0xd12f('0x19')](_0x45b725);return _0x12dcdd[_0xd12f('0x20')](_0xd12f('0x21'),_0x3fa648+'-'+_0x59f21d+'/'+_0x23830d)[_0xd12f('0x1b')](_0xde0ac9);}return null;};}function patchUpdates(_0x3b28d0){return function(_0x4307c5){try{jsonpatch['apply'](_0x4307c5,_0x3b28d0,!![]);}catch(_0x5e1c64){return BPromise[_0xd12f('0x22')](_0x5e1c64);}return _0x4307c5[_0xd12f('0x23')]();};}function saveUpdates(_0x5c81af,_0x32a44e){return function(_0x4bf705){if(_0x4bf705){return _0x4bf705[_0xd12f('0x24')](_0x5c81af)[_0xd12f('0x25')](function(_0x22d850){return _0x22d850;});}return null;};}function removeEntity(_0x35294f,_0x203d1a){return function(_0x2206e1){if(_0x2206e1){return _0x2206e1[_0xd12f('0x26')]()['then'](function(){_0x35294f[_0xd12f('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a0c1a,_0x271408){return function(_0x3d6bab){if(!_0x3d6bab){_0x4a0c1a[_0xd12f('0x18')](0x194);}return _0x3d6bab;};}function handleError(_0x12563b,_0x492f63){_0x492f63=_0x492f63||0x1f4;return function(_0x3c78f9){logger[_0xd12f('0x27')](_0x3c78f9['stack']);if(_0x3c78f9['name']){delete _0x3c78f9['name'];}_0x12563b[_0xd12f('0x19')](_0x492f63)['send'](_0x3c78f9);};}exports['index']=function(_0x6a601f,_0x5aa7e3){var _0x20e1a7={},_0x4ccb3f={},_0x59b3bd={'count':0x0,'rows':[]};var _0x1b4084=_['map'](db['SmsQueueReport']['rawAttributes'],function(_0x5f4753){return{'name':_0x5f4753['fieldName'],'type':_0x5f4753[_0xd12f('0x28')][_0xd12f('0x29')]};});_0x4ccb3f[_0xd12f('0x2a')]=_[_0xd12f('0x2b')](_0x1b4084,'name');_0x4ccb3f[_0xd12f('0x2c')]=_['keys'](_0x6a601f['query']);_0x4ccb3f[_0xd12f('0x2d')]=_['intersection'](_0x4ccb3f[_0xd12f('0x2a')],_0x4ccb3f['query']);_0x20e1a7[_0xd12f('0x2e')]=_['intersection'](_0x4ccb3f[_0xd12f('0x2a')],qs[_0xd12f('0x2f')](_0x6a601f[_0xd12f('0x2c')]['fields']));_0x20e1a7['attributes']=_0x20e1a7[_0xd12f('0x2e')][_0xd12f('0x30')]?_0x20e1a7[_0xd12f('0x2e')]:_0x4ccb3f[_0xd12f('0x2a')];if(!_0x6a601f[_0xd12f('0x2c')]['hasOwnProperty']('nolimit')){_0x20e1a7[_0xd12f('0x1f')]=qs[_0xd12f('0x1f')](_0x6a601f['query']['limit']);_0x20e1a7[_0xd12f('0x1c')]=qs[_0xd12f('0x1c')](_0x6a601f[_0xd12f('0x2c')]['offset']);}_0x20e1a7[_0xd12f('0x31')]=qs[_0xd12f('0x32')](_0x6a601f[_0xd12f('0x2c')][_0xd12f('0x32')]);_0x20e1a7[_0xd12f('0x33')]=qs[_0xd12f('0x2d')](_['pick'](_0x6a601f[_0xd12f('0x2c')],_0x4ccb3f[_0xd12f('0x2d')]),_0x1b4084);if(_0x6a601f['query'][_0xd12f('0x34')]){_0x20e1a7[_0xd12f('0x33')]=_[_0xd12f('0x35')](_0x20e1a7[_0xd12f('0x33')],{'$or':_['map'](_0x1b4084,function(_0x1250df){if(_0x1250df[_0xd12f('0x28')]!=='VIRTUAL'){var _0x28a3e6={};_0x28a3e6[_0x1250df[_0xd12f('0x36')]]={'$like':'%'+_0x6a601f[_0xd12f('0x2c')][_0xd12f('0x34')]+'%'};return _0x28a3e6;}})});}_0x20e1a7=_[_0xd12f('0x35')]({},_0x20e1a7,_0x6a601f[_0xd12f('0x37')]);var _0x201895={'where':_0x20e1a7[_0xd12f('0x33')]};return db['SmsQueueReport'][_0xd12f('0x1e')](_0x201895)[_0xd12f('0x25')](function(_0x565478){_0x59b3bd['count']=_0x565478;if(_0x6a601f[_0xd12f('0x2c')][_0xd12f('0x38')]){_0x20e1a7[_0xd12f('0x39')]=[{'all':!![]}];}return db['SmsQueueReport'][_0xd12f('0x3a')](_0x20e1a7);})[_0xd12f('0x25')](function(_0xa7f200){_0x59b3bd[_0xd12f('0x3b')]=_0xa7f200;return _0x59b3bd;})[_0xd12f('0x25')](respondWithFilteredResult(_0x5aa7e3,_0x20e1a7))[_0xd12f('0x3c')](handleError(_0x5aa7e3,null));};exports[_0xd12f('0x3d')]=function(_0x495c64,_0x4cf08b){var _0x5c69ad={'raw':!![],'where':{'id':_0x495c64[_0xd12f('0x3e')]['id']}},_0x406591={};_0x406591['model']=_['keys'](db[_0xd12f('0x3f')][_0xd12f('0x40')]);_0x406591[_0xd12f('0x2c')]=_[_0xd12f('0x41')](_0x495c64[_0xd12f('0x2c')]);_0x406591[_0xd12f('0x2d')]=_[_0xd12f('0x42')](_0x406591['model'],_0x406591['query']);_0x5c69ad['attributes']=_[_0xd12f('0x42')](_0x406591['model'],qs[_0xd12f('0x2f')](_0x495c64[_0xd12f('0x2c')]['fields']));_0x5c69ad['attributes']=_0x5c69ad['attributes'][_0xd12f('0x30')]?_0x5c69ad['attributes']:_0x406591[_0xd12f('0x2a')];if(_0x495c64[_0xd12f('0x2c')][_0xd12f('0x38')]){_0x5c69ad[_0xd12f('0x39')]=[{'all':!![]}];}_0x5c69ad=_[_0xd12f('0x35')]({},_0x5c69ad,_0x495c64[_0xd12f('0x37')]);return db[_0xd12f('0x3f')][_0xd12f('0x43')](_0x5c69ad)['then'](handleEntityNotFound(_0x4cf08b,null))[_0xd12f('0x25')](respondWithResult(_0x4cf08b,null))[_0xd12f('0x3c')](handleError(_0x4cf08b,null));};exports['create']=function(_0x14ba28,_0x4a41ba){return db['SmsQueueReport']['create'](_0x14ba28[_0xd12f('0x44')],{})[_0xd12f('0x25')](respondWithResult(_0x4a41ba,0xc9))[_0xd12f('0x3c')](handleError(_0x4a41ba,null));};exports[_0xd12f('0x24')]=function(_0x7e0651,_0x5472db){if(_0x7e0651['body']['id']){delete _0x7e0651[_0xd12f('0x44')]['id'];}return db[_0xd12f('0x3f')]['find']({'where':{'id':_0x7e0651[_0xd12f('0x3e')]['id']}})[_0xd12f('0x25')](handleEntityNotFound(_0x5472db,null))[_0xd12f('0x25')](saveUpdates(_0x7e0651[_0xd12f('0x44')],null))[_0xd12f('0x25')](respondWithResult(_0x5472db,null))[_0xd12f('0x3c')](handleError(_0x5472db,null));};exports['destroy']=function(_0x355fdc,_0x55e8b9){return db[_0xd12f('0x3f')][_0xd12f('0x43')]({'where':{'id':_0x355fdc[_0xd12f('0x3e')]['id']}})['then'](handleEntityNotFound(_0x55e8b9,null))[_0xd12f('0x25')](removeEntity(_0x55e8b9,null))[_0xd12f('0x3c')](handleError(_0x55e8b9,null));};exports[_0xd12f('0x45')]=function(_0xfe6884,_0x496c9d){return db[_0xd12f('0x3f')][_0xd12f('0x45')]()[_0xd12f('0x25')](respondWithResult(_0x496c9d,null))[_0xd12f('0x3c')](handleError(_0x496c9d,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 55cefe2..3a8c65b 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 _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 +var _0xcb91=['path','rimraf','./smsQueueReport.attributes','exports','define','report_sms_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x3126aa,_0x26f9ea){var _0x29f110=function(_0x26cccf){while(--_0x26cccf){_0x3126aa['push'](_0x3126aa['shift']());}};_0x29f110(++_0x26f9ea);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3ce2c4,_0x4544c1){_0x3ce2c4=_0x3ce2c4-0x0;var _0x4047c1=_0xcb91[_0x3ce2c4];return _0x4047c1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('SmsQueueReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'name':_0x1cb9('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 310b63f..0abb966 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 _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 +var _0xa82a=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','SmsQueueReport,\x20%s,\x20%s','message','result','CreateSmsQueueReport','create','body','options','raw','catch','UpdateSmsQueueReport','update','where','attributes','limit','lodash'];(function(_0x1599ea,_0x48c1d7){var _0x30fe77=function(_0x444652){while(--_0x444652){_0x1599ea['push'](_0x1599ea['shift']());}};_0x30fe77(++_0x48c1d7);}(_0xa82a,0x117));var _0xaa82=function(_0x5669cd,_0x689334){_0x5669cd=_0x5669cd-0x0;var _0x2f0764=_0xa82a[_0x5669cd];return _0x2f0764;};'use strict';var _=require(_0xaa82('0x0'));var util=require(_0xaa82('0x1'));var moment=require(_0xaa82('0x2'));var BPromise=require(_0xaa82('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaa82('0x4'));var db=require(_0xaa82('0x5'))['db'];var utils=require(_0xaa82('0x6'));var logger=require(_0xaa82('0x7'))(_0xaa82('0x8'));var config=require(_0xaa82('0x9'));var jayson=require(_0xaa82('0xa'));var client=jayson[_0xaa82('0xb')][_0xaa82('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x13de4f,_0x3d1058,_0x160e79){return new BPromise(function(_0xa79cda,_0x4ddc83){return client[_0xaa82('0xd')](_0x13de4f,_0x160e79)[_0xaa82('0xe')](function(_0x1eec2a){logger[_0xaa82('0xf')]('SmsQueueReport,\x20%s,\x20%s',_0x3d1058,_0xaa82('0x10'));logger[_0xaa82('0x11')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x3d1058,_0xaa82('0x10'),JSON[_0xaa82('0x12')](_0x1eec2a));if(_0x1eec2a[_0xaa82('0x13')]){if(_0x1eec2a[_0xaa82('0x13')][_0xaa82('0x14')]===0x1f4){logger[_0xaa82('0x13')](_0xaa82('0x15'),_0x3d1058,_0x1eec2a[_0xaa82('0x13')][_0xaa82('0x16')]);return _0x4ddc83(_0x1eec2a[_0xaa82('0x13')][_0xaa82('0x16')]);}logger[_0xaa82('0x13')]('SmsQueueReport,\x20%s,\x20%s',_0x3d1058,_0x1eec2a[_0xaa82('0x13')][_0xaa82('0x16')]);return _0xa79cda(_0x1eec2a[_0xaa82('0x13')]['message']);}else{logger['info'](_0xaa82('0x15'),_0x3d1058,_0xaa82('0x10'));_0xa79cda(_0x1eec2a[_0xaa82('0x17')][_0xaa82('0x16')]);}})['catch'](function(_0x1f6737){logger[_0xaa82('0x13')](_0xaa82('0x15'),_0x3d1058,_0x1f6737);_0x4ddc83(_0x1f6737);});});}exports[_0xaa82('0x18')]=function(_0xede1b3){var _0x10776b=this;return new Promise(function(_0x14d58e,_0x1318c9){return db['SmsQueueReport'][_0xaa82('0x19')](_0xede1b3[_0xaa82('0x1a')],{'raw':_0xede1b3['options']?_0xede1b3[_0xaa82('0x1b')][_0xaa82('0x1c')]===undefined?!![]:![]:!![]})[_0xaa82('0xe')](function(_0x374eb9){logger[_0xaa82('0xf')](_0xaa82('0x18'),_0xede1b3);logger[_0xaa82('0x11')](_0xaa82('0x18'),_0xede1b3,JSON[_0xaa82('0x12')](_0x374eb9));_0x14d58e(_0x374eb9);})[_0xaa82('0x1d')](function(_0x32d2b1){logger['error']('CreateSmsQueueReport',_0x32d2b1[_0xaa82('0x16')],_0xede1b3);_0x1318c9(_0x10776b[_0xaa82('0x13')](0x1f4,_0x32d2b1['message']));});});};exports[_0xaa82('0x1e')]=function(_0x187440){var _0xcef037=this;return new Promise(function(_0xbdd554,_0x33f069){return db['SmsQueueReport'][_0xaa82('0x1f')](_0x187440[_0xaa82('0x1a')],{'raw':_0x187440['options']?_0x187440[_0xaa82('0x1b')][_0xaa82('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x187440[_0xaa82('0x1b')]?_0x187440[_0xaa82('0x1b')][_0xaa82('0x20')]||null:null,'attributes':_0x187440[_0xaa82('0x1b')]?_0x187440[_0xaa82('0x1b')][_0xaa82('0x21')]||null:null,'limit':_0x187440['options']?_0x187440[_0xaa82('0x1b')][_0xaa82('0x22')]||null:null})[_0xaa82('0xe')](function(_0x44ec5a){logger[_0xaa82('0xf')](_0xaa82('0x1e'),_0x187440);logger['debug'](_0xaa82('0x1e'),_0x187440,JSON[_0xaa82('0x12')](_0x44ec5a));_0xbdd554(_0x44ec5a);})[_0xaa82('0x1d')](function(_0x3b7e0b){logger[_0xaa82('0x13')](_0xaa82('0x1e'),_0x3b7e0b[_0xaa82('0x16')],_0x187440);_0x33f069(_0xcef037['error'](0x1f4,_0x3b7e0b[_0xaa82('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 9cda6b0..09980e2 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 _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 +var _0xe107=['/describe','isAuthenticated','describe','create','put','/:id','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../config/environment','./smsTransferReport.controller','get'];(function(_0x52b8e1,_0x4c27b3){var _0x3813c8=function(_0x534db2){while(--_0x534db2){_0x52b8e1['push'](_0x52b8e1['shift']());}};_0x3813c8(++_0x4c27b3);}(_0xe107,0xb3));var _0x7e10=function(_0x290367,_0x56b8c2){_0x290367=_0x290367-0x0;var _0x3f3142=_0xe107[_0x290367];return _0x3f3142;};'use strict';var multer=require(_0x7e10('0x0'));var util=require('util');var path=require(_0x7e10('0x1'));var timeout=require(_0x7e10('0x2'));var express=require(_0x7e10('0x3'));var router=express['Router']();var fs_extra=require(_0x7e10('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7e10('0x5'));var controller=require(_0x7e10('0x6'));router[_0x7e10('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7e10('0x7')](_0x7e10('0x8'),auth[_0x7e10('0x9')](),controller[_0x7e10('0xa')]);router['get']('/:id',auth[_0x7e10('0x9')](),controller['show']);router['post']('/',auth[_0x7e10('0x9')](),controller[_0x7e10('0xb')]);router[_0x7e10('0xc')](_0x7e10('0xd'),auth[_0x7e10('0x9')](),controller['update']);router[_0x7e10('0xe')]('/:id',auth[_0x7e10('0x9')](),controller[_0x7e10('0xf')]);module[_0x7e10('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 630effb..2c3dc6e 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 _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 +var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x244958,_0x67c713){var _0x3811fa=function(_0x436627){while(--_0x436627){_0x244958['push'](_0x244958['shift']());}};_0x3811fa(++_0x67c713);}(_0x70e0,0x17b));var _0x070e=function(_0x35124b,_0x20ea8d){_0x35124b=_0x35124b-0x0;var _0x4347a3=_0x70e0[_0x35124b];return _0x4347a3;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index d9a9650..c8451b8 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 _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 +var _0x395c=['sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','then','error','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','include','rows','catch','params','length','includeAll','find','body','destroy','describe','eml-format','moment','bluebird','mustache'];(function(_0x4b1c46,_0x386e57){var _0x1978d2=function(_0x536d7d){while(--_0x536d7d){_0x4b1c46['push'](_0x4b1c46['shift']());}};_0x1978d2(++_0x386e57);}(_0x395c,0x114));var _0xc395=function(_0x76a475,_0x5b77fb){_0x76a475=_0x76a475-0x0;var _0x42966e=_0x395c[_0x76a475];return _0x42966e;};'use strict';var emlformat=require(_0xc395('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc395('0x1'));var BPromise=require(_0xc395('0x2'));var Mustache=require(_0xc395('0x3'));var util=require('util');var path=require('path');var sox=require(_0xc395('0x4'));var csv=require('to-csv');var ejs=require(_0xc395('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc395('0x6'));var squel=require(_0xc395('0x7'));var crypto=require(_0xc395('0x8'));var jsforce=require(_0xc395('0x9'));var deskjs=require(_0xc395('0xa'));var toCsv=require(_0xc395('0xb'));var querystring=require('querystring');var Papa=require(_0xc395('0xc'));var Redis=require('ioredis');var authService=require(_0xc395('0xd'));var qs=require(_0xc395('0xe'));var as=require(_0xc395('0xf'));var hardwareService=require(_0xc395('0x10'));var logger=require('../../config/logger')(_0xc395('0x11'));var utils=require(_0xc395('0x12'));var config=require(_0xc395('0x13'));var licenseUtil=require(_0xc395('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1489e5,_0x5c9496){_0x5c9496=_0x5c9496||0xcc;return function(_0xe35a6a){if(_0xe35a6a){return _0x1489e5[_0xc395('0x15')](_0x5c9496);}return _0x1489e5['status'](_0x5c9496)[_0xc395('0x16')]();};}function respondWithResult(_0x63345c,_0x2efd98){_0x2efd98=_0x2efd98||0xc8;return function(_0x1d14b3){if(_0x1d14b3){return _0x63345c[_0xc395('0x17')](_0x2efd98)[_0xc395('0x18')](_0x1d14b3);}};}function respondWithFilteredResult(_0x324128,_0x3276df){return function(_0x22f174){if(_0x22f174){var _0x458cd5=typeof _0x3276df[_0xc395('0x19')]===_0xc395('0x1a')&&typeof _0x3276df[_0xc395('0x1b')]===_0xc395('0x1a');var _0x5c1b12=_0x22f174[_0xc395('0x1c')];var _0x4e58be=_0x458cd5?0x0:_0x3276df[_0xc395('0x19')];var _0x2e2d59=_0x458cd5?_0x22f174['count']:_0x3276df[_0xc395('0x19')]+_0x3276df[_0xc395('0x1b')];var _0x572c03;if(_0x2e2d59>=_0x5c1b12){_0x2e2d59=_0x5c1b12;_0x572c03=0xc8;}else{_0x572c03=0xce;}_0x324128['status'](_0x572c03);return _0x324128[_0xc395('0x1d')]('Content-Range',_0x4e58be+'-'+_0x2e2d59+'/'+_0x5c1b12)[_0xc395('0x18')](_0x22f174);}return null;};}function patchUpdates(_0x357aae){return function(_0x57482b){try{jsonpatch[_0xc395('0x1e')](_0x57482b,_0x357aae,!![]);}catch(_0x27eb4c){return BPromise[_0xc395('0x1f')](_0x27eb4c);}return _0x57482b[_0xc395('0x20')]();};}function saveUpdates(_0x2d0eb0,_0x17360c){return function(_0x5a0101){if(_0x5a0101){return _0x5a0101['update'](_0x2d0eb0)[_0xc395('0x21')](function(_0x3adfee){return _0x3adfee;});}return null;};}function removeEntity(_0x50ce29,_0x4acac5){return function(_0x3c724d){if(_0x3c724d){return _0x3c724d['destroy']()['then'](function(){_0x50ce29['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x57e38f,_0x4ff6de){return function(_0x5b940e){if(!_0x5b940e){_0x57e38f[_0xc395('0x15')](0x194);}return _0x5b940e;};}function handleError(_0x1d06bf,_0x512d25){_0x512d25=_0x512d25||0x1f4;return function(_0x4e1369){logger[_0xc395('0x22')](_0x4e1369['stack']);if(_0x4e1369[_0xc395('0x23')]){delete _0x4e1369[_0xc395('0x23')];}_0x1d06bf[_0xc395('0x17')](_0x512d25)[_0xc395('0x24')](_0x4e1369);};}exports[_0xc395('0x25')]=function(_0x3bf7a7,_0x3c8a3b){var _0x4c36b7={},_0x4c4e96={},_0x58653f={'count':0x0,'rows':[]};var _0x3fdda0=_[_0xc395('0x26')](db[_0xc395('0x27')][_0xc395('0x28')],function(_0x16a8ff){return{'name':_0x16a8ff[_0xc395('0x29')],'type':_0x16a8ff['type'][_0xc395('0x2a')]};});_0x4c4e96[_0xc395('0x2b')]=_['map'](_0x3fdda0,_0xc395('0x23'));_0x4c4e96[_0xc395('0x2c')]=_[_0xc395('0x2d')](_0x3bf7a7[_0xc395('0x2c')]);_0x4c4e96[_0xc395('0x2e')]=_['intersection'](_0x4c4e96[_0xc395('0x2b')],_0x4c4e96[_0xc395('0x2c')]);_0x4c36b7[_0xc395('0x2f')]=_[_0xc395('0x30')](_0x4c4e96['model'],qs[_0xc395('0x31')](_0x3bf7a7[_0xc395('0x2c')][_0xc395('0x31')]));_0x4c36b7[_0xc395('0x2f')]=_0x4c36b7[_0xc395('0x2f')]['length']?_0x4c36b7['attributes']:_0x4c4e96[_0xc395('0x2b')];if(!_0x3bf7a7[_0xc395('0x2c')][_0xc395('0x32')](_0xc395('0x33'))){_0x4c36b7[_0xc395('0x1b')]=qs[_0xc395('0x1b')](_0x3bf7a7[_0xc395('0x2c')][_0xc395('0x1b')]);_0x4c36b7[_0xc395('0x19')]=qs[_0xc395('0x19')](_0x3bf7a7[_0xc395('0x2c')][_0xc395('0x19')]);}_0x4c36b7[_0xc395('0x34')]=qs[_0xc395('0x35')](_0x3bf7a7[_0xc395('0x2c')][_0xc395('0x35')]);_0x4c36b7['where']=qs[_0xc395('0x2e')](_[_0xc395('0x36')](_0x3bf7a7[_0xc395('0x2c')],_0x4c4e96[_0xc395('0x2e')]),_0x3fdda0);if(_0x3bf7a7[_0xc395('0x2c')][_0xc395('0x37')]){_0x4c36b7[_0xc395('0x38')]=_['merge'](_0x4c36b7[_0xc395('0x38')],{'$or':_[_0xc395('0x26')](_0x3fdda0,function(_0x18cbcf){if(_0x18cbcf['type']!==_0xc395('0x39')){var _0x135baa={};_0x135baa[_0x18cbcf['name']]={'$like':'%'+_0x3bf7a7[_0xc395('0x2c')][_0xc395('0x37')]+'%'};return _0x135baa;}})});}_0x4c36b7=_[_0xc395('0x3a')]({},_0x4c36b7,_0x3bf7a7[_0xc395('0x3b')]);var _0x22daa3={'where':_0x4c36b7[_0xc395('0x38')]};return db[_0xc395('0x27')]['count'](_0x22daa3)[_0xc395('0x21')](function(_0x158229){_0x58653f[_0xc395('0x1c')]=_0x158229;if(_0x3bf7a7[_0xc395('0x2c')]['includeAll']){_0x4c36b7[_0xc395('0x3c')]=[{'all':!![]}];}return db[_0xc395('0x27')]['findAll'](_0x4c36b7);})[_0xc395('0x21')](function(_0x57cabd){_0x58653f[_0xc395('0x3d')]=_0x57cabd;return _0x58653f;})['then'](respondWithFilteredResult(_0x3c8a3b,_0x4c36b7))[_0xc395('0x3e')](handleError(_0x3c8a3b,null));};exports['show']=function(_0xf3cf76,_0x2261fa){var _0x43979c={'raw':!![],'where':{'id':_0xf3cf76[_0xc395('0x3f')]['id']}},_0x163c49={};_0x163c49[_0xc395('0x2b')]=_['keys'](db['SmsTransferReport'][_0xc395('0x28')]);_0x163c49['query']=_[_0xc395('0x2d')](_0xf3cf76[_0xc395('0x2c')]);_0x163c49[_0xc395('0x2e')]=_[_0xc395('0x30')](_0x163c49[_0xc395('0x2b')],_0x163c49['query']);_0x43979c[_0xc395('0x2f')]=_[_0xc395('0x30')](_0x163c49[_0xc395('0x2b')],qs['fields'](_0xf3cf76['query'][_0xc395('0x31')]));_0x43979c[_0xc395('0x2f')]=_0x43979c['attributes'][_0xc395('0x40')]?_0x43979c[_0xc395('0x2f')]:_0x163c49['model'];if(_0xf3cf76[_0xc395('0x2c')][_0xc395('0x41')]){_0x43979c[_0xc395('0x3c')]=[{'all':!![]}];}_0x43979c=_[_0xc395('0x3a')]({},_0x43979c,_0xf3cf76[_0xc395('0x3b')]);return db[_0xc395('0x27')][_0xc395('0x42')](_0x43979c)[_0xc395('0x21')](handleEntityNotFound(_0x2261fa,null))[_0xc395('0x21')](respondWithResult(_0x2261fa,null))[_0xc395('0x3e')](handleError(_0x2261fa,null));};exports['create']=function(_0x24b23b,_0x14764d){return db['SmsTransferReport']['create'](_0x24b23b[_0xc395('0x43')],{})[_0xc395('0x21')](respondWithResult(_0x14764d,0xc9))['catch'](handleError(_0x14764d,null));};exports['update']=function(_0x3d8b7c,_0x644d08){if(_0x3d8b7c[_0xc395('0x43')]['id']){delete _0x3d8b7c['body']['id'];}return db[_0xc395('0x27')]['find']({'where':{'id':_0x3d8b7c[_0xc395('0x3f')]['id']}})[_0xc395('0x21')](handleEntityNotFound(_0x644d08,null))['then'](saveUpdates(_0x3d8b7c[_0xc395('0x43')],null))[_0xc395('0x21')](respondWithResult(_0x644d08,null))[_0xc395('0x3e')](handleError(_0x644d08,null));};exports[_0xc395('0x44')]=function(_0x135342,_0x36ebe9){return db[_0xc395('0x27')][_0xc395('0x42')]({'where':{'id':_0x135342[_0xc395('0x3f')]['id']}})[_0xc395('0x21')](handleEntityNotFound(_0x36ebe9,null))[_0xc395('0x21')](removeEntity(_0x36ebe9,null))[_0xc395('0x3e')](handleError(_0x36ebe9,null));};exports[_0xc395('0x45')]=function(_0x2c656b,_0x259418){return db[_0xc395('0x27')][_0xc395('0x45')]()[_0xc395('0x21')](respondWithResult(_0x259418,null))[_0xc395('0x3e')](handleError(_0x259418,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 197571d..eb1cfc8 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 _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 +var _0x48c6=['moment','request-promise','rimraf','../../config/environment','./smsTransferReport.attributes','exports','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','api'];(function(_0x21f412,_0x417c9c){var _0x43d998=function(_0x32e0e6){while(--_0x32e0e6){_0x21f412['push'](_0x21f412['shift']());}};_0x43d998(++_0x417c9c);}(_0x48c6,0x17d));var _0x648c=function(_0x1ce7cf,_0x1706be){_0x1ce7cf=_0x1ce7cf-0x0;var _0x38fe5a=_0x48c6[_0x1ce7cf];return _0x38fe5a;};'use strict';var _=require(_0x648c('0x0'));var util=require(_0x648c('0x1'));var logger=require('../../config/logger')(_0x648c('0x2'));var moment=require(_0x648c('0x3'));var BPromise=require('bluebird');var rp=require(_0x648c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x648c('0x5'));var config=require(_0x648c('0x6'));var attributes=require(_0x648c('0x7'));module[_0x648c('0x8')]=function(_0x5eab0d,_0x5d7b66){return _0x5eab0d['define'](_0x648c('0x9'),attributes,{'tableName':_0x648c('0xa'),'paranoid':![],'indexes':[{'name':_0x648c('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 136bd5d..a9bb696 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 _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 +var _0xd8af=['bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment'];(function(_0x3db745,_0x154d72){var _0x26e855=function(_0x41cba4){while(--_0x41cba4){_0x3db745['push'](_0x3db745['shift']());}};_0x26e855(++_0x154d72);}(_0xd8af,0x18d));var _0xfd8a=function(_0x4f7543,_0xd9c8cb){_0x4f7543=_0x4f7543-0x0;var _0x27868c=_0xd8af[_0x4f7543];return _0x27868c;};'use strict';var _=require(_0xfd8a('0x0'));var util=require(_0xfd8a('0x1'));var moment=require(_0xfd8a('0x2'));var BPromise=require(_0xfd8a('0x3'));var rs=require(_0xfd8a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfd8a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfd8a('0x6'))(_0xfd8a('0x7'));var config=require(_0xfd8a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xfd8a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8b725c,_0xdb72fc,_0x31fdfc){return new BPromise(function(_0x1d1fb4,_0x5d2f8d){return client[_0xfd8a('0xa')](_0x8b725c,_0x31fdfc)[_0xfd8a('0xb')](function(_0x2c7d72){logger[_0xfd8a('0xc')](_0xfd8a('0xd'),_0xdb72fc,_0xfd8a('0xe'));logger['debug']('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0xdb72fc,_0xfd8a('0xe'),JSON[_0xfd8a('0xf')](_0x2c7d72));if(_0x2c7d72[_0xfd8a('0x10')]){if(_0x2c7d72['error']['code']===0x1f4){logger['error'](_0xfd8a('0xd'),_0xdb72fc,_0x2c7d72[_0xfd8a('0x10')]['message']);return _0x5d2f8d(_0x2c7d72['error'][_0xfd8a('0x11')]);}logger[_0xfd8a('0x10')](_0xfd8a('0xd'),_0xdb72fc,_0x2c7d72[_0xfd8a('0x10')][_0xfd8a('0x11')]);return _0x1d1fb4(_0x2c7d72[_0xfd8a('0x10')][_0xfd8a('0x11')]);}else{logger[_0xfd8a('0xc')](_0xfd8a('0xd'),_0xdb72fc,_0xfd8a('0xe'));_0x1d1fb4(_0x2c7d72[_0xfd8a('0x12')][_0xfd8a('0x11')]);}})[_0xfd8a('0x13')](function(_0x25eed2){logger[_0xfd8a('0x10')](_0xfd8a('0xd'),_0xdb72fc,_0x25eed2);_0x5d2f8d(_0x25eed2);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index d39644a..3b7e9a4 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 _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 +var _0x2b17=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','download','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','now','post','file','create','put','delete','multer','util','path','connect-timeout','Router'];(function(_0x216397,_0x1dd930){var _0x5ba724=function(_0x15c265){while(--_0x15c265){_0x216397['push'](_0x216397['shift']());}};_0x5ba724(++_0x1dd930);}(_0x2b17,0xcd));var _0x72b1=function(_0x1300f8,_0x4e50ca){_0x1300f8=_0x1300f8-0x0;var _0x378a01=_0x2b17[_0x1300f8];return _0x378a01;};'use strict';var multer=require(_0x72b1('0x0'));var util=require(_0x72b1('0x1'));var path=require(_0x72b1('0x2'));var timeout=require(_0x72b1('0x3'));var express=require('express');var router=express[_0x72b1('0x4')]();var fs_extra=require(_0x72b1('0x5'));var auth=require(_0x72b1('0x6'));var interaction=require(_0x72b1('0x7'));var config=require(_0x72b1('0x8'));var controller=require('./sound.controller');router[_0x72b1('0x9')]('/',auth[_0x72b1('0xa')](),controller['index']);router[_0x72b1('0x9')](_0x72b1('0xb'),auth['isAuthenticated'](),controller[_0x72b1('0xc')]);router[_0x72b1('0x9')](_0x72b1('0xd'),auth[_0x72b1('0xa')](),controller[_0x72b1('0xe')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x209818,_0x157674,_0x2a8e07){_0x2a8e07(null,path[_0x72b1('0xf')](config[_0x72b1('0x10')],_0x72b1('0x11')));},'filename':function(_0x51c726,_0x3a2df3,_0x218762){_0x3a2df3[_0x72b1('0x12')]=_0x3a2df3[_0x72b1('0x12')][_0x72b1('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x218762(null,util[_0x72b1('0x14')](_0x72b1('0x15'),path[_0x72b1('0x16')](_0x3a2df3[_0x72b1('0x12')],path[_0x72b1('0x17')](_0x3a2df3[_0x72b1('0x12')])),Date[_0x72b1('0x18')](),path[_0x72b1('0x17')](_0x3a2df3['originalname'])));}})});router[_0x72b1('0x19')]('/',upload['single'](_0x72b1('0x1a')),controller[_0x72b1('0x1b')]);router[_0x72b1('0x1c')](_0x72b1('0xb'),auth[_0x72b1('0xa')](),controller['update']);router['delete'](_0x72b1('0xb'),auth['isAuthenticated'](),controller[_0x72b1('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index c6e5ba8..ac5fab5 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 _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 +var _0x3045=['STRING','INTEGER','BIGINT','sequelize','exports'];(function(_0x7c52da,_0x221219){var _0x25173c=function(_0x3afa1b){while(--_0x3afa1b){_0x7c52da['push'](_0x7c52da['shift']());}};_0x25173c(++_0x221219);}(_0x3045,0x134));var _0x5304=function(_0x5bfe53,_0x367d52){_0x5bfe53=_0x5bfe53-0x0;var _0xe0319b=_0x3045[_0x5bfe53];return _0xe0319b;};'use strict';var Sequelize=require(_0x5304('0x0'));module[_0x5304('0x1')]={'name':{'type':Sequelize[_0x5304('0x2')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x5304('0x2')]},'display_name':{'type':Sequelize[_0x5304('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x5304('0x2')]},'original_format':{'type':Sequelize[_0x5304('0x2')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x5304('0x3')]},'converted_format':{'type':Sequelize[_0x5304('0x2')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0x5304('0x4')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0x5304('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x5304('0x3')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 1450b32..51443e5 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 _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 +var _0x7b81=['ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','destroy','then','get','Sounds','UserProfileResource','error','name','send','index','map','Sound','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','keys','find','catch','download','save_name','join','root','converted_format','Sound\x20not\x20found','format','%s.%s','basename','file','originalname','filename','extname','wav','server/files/sounds/original','server/files/sounds/converted','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate','sampleRate','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','pick','description','delete','original_format','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7b81,0x167));var _0x17b8=function(_0x266378,_0x477398){_0x266378=_0x266378-0x0;var _0x5c26e9=_0x7b81[_0x266378];return _0x5c26e9;};'use strict';var emlformat=require(_0x17b8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x17b8('0x1'));var jsonpatch=require(_0x17b8('0x2'));var rp=require(_0x17b8('0x3'));var moment=require(_0x17b8('0x4'));var BPromise=require(_0x17b8('0x5'));var Mustache=require('mustache');var util=require(_0x17b8('0x6'));var path=require(_0x17b8('0x7'));var sox=require(_0x17b8('0x8'));var csv=require(_0x17b8('0x9'));var ejs=require(_0x17b8('0xa'));var fs=require('fs');var fs_extra=require(_0x17b8('0xb'));var _=require(_0x17b8('0xc'));var squel=require(_0x17b8('0xd'));var crypto=require(_0x17b8('0xe'));var jsforce=require(_0x17b8('0xf'));var deskjs=require(_0x17b8('0x10'));var toCsv=require(_0x17b8('0x9'));var querystring=require(_0x17b8('0x11'));var Papa=require(_0x17b8('0x12'));var Redis=require(_0x17b8('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x17b8('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x17b8('0x15'))('api');var utils=require(_0x17b8('0x16'));var config=require(_0x17b8('0x17'));var licenseUtil=require(_0x17b8('0x18'));var db=require(_0x17b8('0x19'))['db'];function respondWithStatusCode(_0x4bc13f,_0xbcdb5d){_0xbcdb5d=_0xbcdb5d||0xcc;return function(_0x35fac4){if(_0x35fac4){return _0x4bc13f[_0x17b8('0x1a')](_0xbcdb5d);}return _0x4bc13f[_0x17b8('0x1b')](_0xbcdb5d)[_0x17b8('0x1c')]();};}function respondWithResult(_0x184202,_0x526322){_0x526322=_0x526322||0xc8;return function(_0x39b2f6){if(_0x39b2f6){return _0x184202[_0x17b8('0x1b')](_0x526322)[_0x17b8('0x1d')](_0x39b2f6);}};}function respondWithFilteredResult(_0x16a515,_0x240d0c){return function(_0x36f8f4){if(_0x36f8f4){var _0x130c61=typeof _0x240d0c[_0x17b8('0x1e')]===_0x17b8('0x1f')&&typeof _0x240d0c[_0x17b8('0x20')]===_0x17b8('0x1f');var _0x59f083=_0x36f8f4['count'];var _0x237fed=_0x130c61?0x0:_0x240d0c[_0x17b8('0x1e')];var _0x42fada=_0x130c61?_0x36f8f4[_0x17b8('0x21')]:_0x240d0c[_0x17b8('0x1e')]+_0x240d0c[_0x17b8('0x20')];var _0x1124cf;if(_0x42fada>=_0x59f083){_0x42fada=_0x59f083;_0x1124cf=0xc8;}else{_0x1124cf=0xce;}_0x16a515[_0x17b8('0x1b')](_0x1124cf);return _0x16a515[_0x17b8('0x22')]('Content-Range',_0x237fed+'-'+_0x42fada+'/'+_0x59f083)[_0x17b8('0x1d')](_0x36f8f4);}return null;};}function patchUpdates(_0x2c46d4){return function(_0x9e5a0e){try{jsonpatch[_0x17b8('0x23')](_0x9e5a0e,_0x2c46d4,!![]);}catch(_0x4f4a36){return BPromise[_0x17b8('0x24')](_0x4f4a36);}return _0x9e5a0e['save']();};}function saveUpdates(_0x17fb50,_0x3e8ee3){return function(_0x30737f){if(_0x30737f){return _0x30737f[_0x17b8('0x25')](_0x17fb50)['then'](function(_0x3aea7e){return _0x3aea7e;});}return null;};}function removeEntity(_0x1d64f3,_0x2e9615){return function(_0x5b0932){if(_0x5b0932){return _0x5b0932[_0x17b8('0x26')]()[_0x17b8('0x27')](function(){var _0x5d47e6=_0x5b0932[_0x17b8('0x28')]({'plain':!![]});var _0x401805=_0x17b8('0x29');return db[_0x17b8('0x2a')]['destroy']({'where':{'type':_0x401805,'resourceId':_0x5d47e6['id']}})['then'](function(){return _0x5b0932;});})['then'](function(){_0x1d64f3['status'](0xcc)[_0x17b8('0x1c')]();});}};}function handleEntityNotFound(_0x264120,_0x43273d){return function(_0x487d73){if(!_0x487d73){_0x264120[_0x17b8('0x1a')](0x194);}return _0x487d73;};}function handleError(_0x368e4f,_0x378502){_0x378502=_0x378502||0x1f4;return function(_0x41e38f){logger[_0x17b8('0x2b')](_0x41e38f['stack']);if(_0x41e38f[_0x17b8('0x2c')]){delete _0x41e38f[_0x17b8('0x2c')];}_0x368e4f[_0x17b8('0x1b')](_0x378502)[_0x17b8('0x2d')](_0x41e38f);};}exports[_0x17b8('0x2e')]=function(_0x596cbf,_0x285b85){var _0x4da139={},_0x44bd1a={},_0x52f18a={'count':0x0,'rows':[]};var _0x2467f8=_[_0x17b8('0x2f')](db[_0x17b8('0x30')][_0x17b8('0x31')],function(_0x8a2f67){return{'name':_0x8a2f67[_0x17b8('0x32')],'type':_0x8a2f67[_0x17b8('0x33')][_0x17b8('0x34')]};});_0x44bd1a[_0x17b8('0x35')]=_['map'](_0x2467f8,_0x17b8('0x2c'));_0x44bd1a[_0x17b8('0x36')]=_['keys'](_0x596cbf[_0x17b8('0x36')]);_0x44bd1a[_0x17b8('0x37')]=_[_0x17b8('0x38')](_0x44bd1a[_0x17b8('0x35')],_0x44bd1a[_0x17b8('0x36')]);_0x4da139[_0x17b8('0x39')]=_[_0x17b8('0x38')](_0x44bd1a[_0x17b8('0x35')],qs[_0x17b8('0x3a')](_0x596cbf[_0x17b8('0x36')]['fields']));_0x4da139[_0x17b8('0x39')]=_0x4da139['attributes'][_0x17b8('0x3b')]?_0x4da139['attributes']:_0x44bd1a[_0x17b8('0x35')];if(!_0x596cbf[_0x17b8('0x36')][_0x17b8('0x3c')](_0x17b8('0x3d'))){_0x4da139[_0x17b8('0x20')]=qs[_0x17b8('0x20')](_0x596cbf[_0x17b8('0x36')][_0x17b8('0x20')]);_0x4da139[_0x17b8('0x1e')]=qs['offset'](_0x596cbf[_0x17b8('0x36')][_0x17b8('0x1e')]);}_0x4da139[_0x17b8('0x3e')]=qs[_0x17b8('0x3f')](_0x596cbf[_0x17b8('0x36')][_0x17b8('0x3f')]);_0x4da139['where']=qs[_0x17b8('0x37')](_['pick'](_0x596cbf['query'],_0x44bd1a[_0x17b8('0x37')]),_0x2467f8);if(_0x596cbf[_0x17b8('0x36')][_0x17b8('0x40')]){_0x4da139[_0x17b8('0x41')]=_[_0x17b8('0x42')](_0x4da139[_0x17b8('0x41')],{'$or':_[_0x17b8('0x2f')](_0x2467f8,function(_0x23a9fb){if(_0x23a9fb[_0x17b8('0x33')]!==_0x17b8('0x43')){var _0x4bd76a={};_0x4bd76a[_0x23a9fb[_0x17b8('0x2c')]]={'$like':'%'+_0x596cbf[_0x17b8('0x36')]['filter']+'%'};return _0x4bd76a;}})});}_0x4da139=_['merge']({},_0x4da139,_0x596cbf[_0x17b8('0x44')]);var _0x57a0eb={'where':_0x4da139[_0x17b8('0x41')]};return db[_0x17b8('0x30')][_0x17b8('0x21')](_0x57a0eb)[_0x17b8('0x27')](function(_0x723a94){_0x52f18a[_0x17b8('0x21')]=_0x723a94;if(_0x596cbf[_0x17b8('0x36')][_0x17b8('0x45')]){_0x4da139[_0x17b8('0x46')]=[{'all':!![]}];}return db[_0x17b8('0x30')][_0x17b8('0x47')](_0x4da139);})[_0x17b8('0x27')](function(_0x5c6e77){_0x52f18a[_0x17b8('0x48')]=_0x5c6e77;return _0x52f18a;})['then'](respondWithFilteredResult(_0x285b85,_0x4da139))['catch'](handleError(_0x285b85,null));};exports['show']=function(_0x51291d,_0x4c4e10){var _0x12ef0d={'raw':!![],'where':{'id':_0x51291d[_0x17b8('0x49')]['id']}},_0x33f9c4={};_0x33f9c4[_0x17b8('0x35')]=_[_0x17b8('0x4a')](db[_0x17b8('0x30')]['rawAttributes']);_0x33f9c4['query']=_[_0x17b8('0x4a')](_0x51291d[_0x17b8('0x36')]);_0x33f9c4[_0x17b8('0x37')]=_['intersection'](_0x33f9c4[_0x17b8('0x35')],_0x33f9c4[_0x17b8('0x36')]);_0x12ef0d[_0x17b8('0x39')]=_[_0x17b8('0x38')](_0x33f9c4['model'],qs[_0x17b8('0x3a')](_0x51291d[_0x17b8('0x36')]['fields']));_0x12ef0d['attributes']=_0x12ef0d['attributes'][_0x17b8('0x3b')]?_0x12ef0d[_0x17b8('0x39')]:_0x33f9c4[_0x17b8('0x35')];if(_0x51291d[_0x17b8('0x36')][_0x17b8('0x45')]){_0x12ef0d[_0x17b8('0x46')]=[{'all':!![]}];}_0x12ef0d=_[_0x17b8('0x42')]({},_0x12ef0d,_0x51291d[_0x17b8('0x44')]);return db[_0x17b8('0x30')][_0x17b8('0x4b')](_0x12ef0d)['then'](handleEntityNotFound(_0x4c4e10,null))[_0x17b8('0x27')](respondWithResult(_0x4c4e10,null))[_0x17b8('0x4c')](handleError(_0x4c4e10,null));};exports[_0x17b8('0x4d')]=function(_0x348bc6,_0x4fe915,_0x269faa){return db['Sound'][_0x17b8('0x4b')]({'where':{'id':_0x348bc6[_0x17b8('0x49')]['id']},'attributes':[_0x17b8('0x2c'),_0x17b8('0x4e'),'converted_format'],'raw':!![]})[_0x17b8('0x27')](handleEntityNotFound(_0x4fe915,null))[_0x17b8('0x27')](function(_0x3b95eb){if(_0x3b95eb){if(!fs['existsSync'](path[_0x17b8('0x4f')](config[_0x17b8('0x50')],'server/files/sounds/converted',_0x3b95eb['save_name']+'.'+_0x3b95eb[_0x17b8('0x51')]))){throw new db['Sequelize']['ValidationError'](_0x17b8('0x52'));}return _0x4fe915[_0x17b8('0x4d')](path['join'](config[_0x17b8('0x50')],'server/files/sounds/converted',util[_0x17b8('0x53')]('%s.%s',_0x3b95eb['save_name'],_0x3b95eb['converted_format'])),util[_0x17b8('0x53')](_0x17b8('0x54'),_0x3b95eb[_0x17b8('0x2c')],_0x3b95eb[_0x17b8('0x51')]));}return null;})['catch'](handleError(_0x4fe915,null));};exports['create']=function(_0x257552,_0xc7aa01,_0x3ae4e8){var _0x27e45b={'name':path[_0x17b8('0x55')](_0x257552[_0x17b8('0x56')][_0x17b8('0x57')],path['extname'](_0x257552[_0x17b8('0x56')]['originalname'])),'save_name':path[_0x17b8('0x55')](_0x257552[_0x17b8('0x56')][_0x17b8('0x58')],path['extname'](_0x257552[_0x17b8('0x56')][_0x17b8('0x58')])),'original_format':path[_0x17b8('0x59')](_0x257552[_0x17b8('0x56')][_0x17b8('0x57')])['substring'](0x1),'converted_format':_0x17b8('0x5a')};var _0x109602=path[_0x17b8('0x4f')](config[_0x17b8('0x50')],_0x17b8('0x5b'),_0x257552[_0x17b8('0x56')]['filename']);var _0x4c2f40=path[_0x17b8('0x4f')](config[_0x17b8('0x50')],_0x17b8('0x5c'),util[_0x17b8('0x53')](_0x17b8('0x54'),path[_0x17b8('0x55')](_0x257552[_0x17b8('0x56')]['filename'],path[_0x17b8('0x59')](_0x257552[_0x17b8('0x56')][_0x17b8('0x58')])),_0x27e45b[_0x17b8('0x51')]));logger[_0x17b8('0x5d')]('Sound\x20upload\x20filepath:\x20%s',_0x109602);logger['info'](_0x17b8('0x5e'),_0x4c2f40);try{fs[_0x17b8('0x5f')](_0x109602,parseInt(_0x17b8('0x60'),0x8));var _0x210329=sox[_0x17b8('0x61')](_0x109602,_0x4c2f40,{'sampleRate':0x1f40,'format':_0x17b8('0x5a'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x210329['on'](_0x17b8('0x2b'),function(_0x32286c){fs[_0x17b8('0x62')](_0x109602);_0xc7aa01['status'](0x1f4)[_0x17b8('0x2d')](_0x32286c);});_0x210329['on'](_0x17b8('0x63'),function(_0x2b6aaf){_0x27e45b[_0x17b8('0x64')]=isNaN(_0x2b6aaf[_0x17b8('0x65')])?null:_0x2b6aaf[_0x17b8('0x65')]*0x3e8;_0x27e45b[_0x17b8('0x66')]=isNaN(_0x2b6aaf[_0x17b8('0x67')])?null:_0x2b6aaf['sampleCount'];_0x27e45b[_0x17b8('0x68')]=isNaN(_0x2b6aaf[_0x17b8('0x69')])?null:_0x2b6aaf['channelCount'];_0x27e45b['original_bitRate']=isNaN(_0x2b6aaf[_0x17b8('0x6a')])?null:_0x2b6aaf[_0x17b8('0x6a')];_0x27e45b['original_sampleRate']=isNaN(_0x2b6aaf[_0x17b8('0x6b')])?null:_0x2b6aaf[_0x17b8('0x6b')];});_0x210329['on']('dest',function(_0x2e9b4e){_0x27e45b[_0x17b8('0x6c')]=isNaN(_0x2e9b4e[_0x17b8('0x65')])?null:_0x2e9b4e[_0x17b8('0x65')]*0x3e8;_0x27e45b[_0x17b8('0x6d')]=isNaN(_0x2e9b4e[_0x17b8('0x67')])?null:_0x2e9b4e[_0x17b8('0x67')];_0x27e45b[_0x17b8('0x6e')]=isNaN(_0x2e9b4e[_0x17b8('0x69')])?null:_0x2e9b4e[_0x17b8('0x69')];_0x27e45b[_0x17b8('0x6f')]=isNaN(_0x2e9b4e[_0x17b8('0x6a')])?null:_0x2e9b4e[_0x17b8('0x6a')];_0x27e45b[_0x17b8('0x70')]=isNaN(_0x2e9b4e['sampleRate'])?null:_0x2e9b4e['sampleRate'];});_0x210329['on'](_0x17b8('0x1c'),function(){fs['chmodSync'](_0x4c2f40,parseInt('0777',0x8));return db['Sound'][_0x17b8('0x71')](_0x27e45b)[_0x17b8('0x27')](function(_0xebb025){var _0x17a6c5={'role':_0x257552[_0x17b8('0x72')][_0x17b8('0x73')],'userProfileId':_0x257552[_0x17b8('0x72')][_0x17b8('0x74')]};if(!_0x17a6c5)throw new Error(_0x17b8('0x75'));if(_0x17a6c5[_0x17b8('0x73')]==='user'){var _0x43d40b=_0xebb025[_0x17b8('0x28')]({'plain':!![]});return db[_0x17b8('0x76')][_0x17b8('0x4b')]({'where':{'name':_0x17b8('0x29'),'userProfileId':_0x17a6c5['userProfileId']},'raw':!![]})[_0x17b8('0x27')](function(_0x1706af){if(_0x1706af&&_0x1706af[_0x17b8('0x77')]===0x0){return db[_0x17b8('0x2a')][_0x17b8('0x71')]({'name':_0x43d40b['name'],'resourceId':_0x43d40b['id'],'type':_0x1706af[_0x17b8('0x2c')],'sectionId':_0x1706af['id']},{})['then'](function(){return _0xebb025;});}else{return _0xebb025;}})[_0x17b8('0x4c')](function(_0x125677){logger[_0x17b8('0x2b')](_0x17b8('0x78'),_0x125677);throw _0x125677;});}return _0xebb025;})[_0x17b8('0x27')](respondWithResult(_0xc7aa01,null))[_0x17b8('0x4c')](handleError(_0xc7aa01,null));});_0x210329[_0x17b8('0x79')]();}catch(_0x18b997){_0xc7aa01[_0x17b8('0x1b')](0x1f4)['send'](_0x18b997);}};exports['update']=function(_0x2a7116,_0x4cf37a,_0x10f780){return db['Sound'][_0x17b8('0x4b')]({'where':{'id':_0x2a7116[_0x17b8('0x49')]['id']}})[_0x17b8('0x27')](handleEntityNotFound(_0x4cf37a,null))[_0x17b8('0x27')](saveUpdates(_[_0x17b8('0x7a')](_0x2a7116[_0x17b8('0x72')],[_0x17b8('0x2c'),_0x17b8('0x7b')]),null))[_0x17b8('0x27')](respondWithResult(_0x4cf37a,null))[_0x17b8('0x4c')](handleError(_0x4cf37a,null));};exports[_0x17b8('0x7c')]=function(_0x1eed84,_0x4bb8a6,_0x29e6f5){return db['Sound']['find']({'where':{'id':_0x1eed84['params']['id']}})[_0x17b8('0x27')](function(_0x1d6bad){if(_0x1d6bad){return _0x1d6bad['destroy']();}})[_0x17b8('0x27')](function(_0xea793){var _0x3cdd7f=path[_0x17b8('0x4f')](config[_0x17b8('0x50')],'server/files/sounds/original',util[_0x17b8('0x53')](_0x17b8('0x54'),_0xea793[_0x17b8('0x4e')],_0xea793[_0x17b8('0x7d')]));var _0x4257d7=path[_0x17b8('0x4f')](config[_0x17b8('0x50')],_0x17b8('0x5c'),util[_0x17b8('0x53')](_0x17b8('0x54'),_0xea793['save_name'],_0xea793[_0x17b8('0x51')]));fs[_0x17b8('0x62')](_0x3cdd7f);fs[_0x17b8('0x62')](_0x4257d7);return _0xea793;})[_0x17b8('0x27')](function(_0x5e69fe){if(_0x5e69fe){return _0x4bb8a6[_0x17b8('0x1b')](0xcc)[_0x17b8('0x1c')]();}})[_0x17b8('0x27')](handleEntityNotFound(_0x4bb8a6,null))[_0x17b8('0x4c')](handleError(_0x4bb8a6,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index e7b1c2b..df58434 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 _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 +var _0x31ec=['bluebird','request-promise','rimraf','./sound.attributes','exports','define','Sound','tools_sounds','lodash','util','../../config/logger','moment'];(function(_0x5be956,_0x33900b){var _0x3de158=function(_0x4780ee){while(--_0x4780ee){_0x5be956['push'](_0x5be956['shift']());}};_0x3de158(++_0x33900b);}(_0x31ec,0x1c4));var _0xc31e=function(_0x49098b,_0x6f7b12){_0x49098b=_0x49098b-0x0;var _0x3d35c6=_0x31ec[_0x49098b];return _0x3d35c6;};'use strict';var _=require(_0xc31e('0x0'));var util=require(_0xc31e('0x1'));var logger=require(_0xc31e('0x2'))('api');var moment=require(_0xc31e('0x3'));var BPromise=require(_0xc31e('0x4'));var rp=require(_0xc31e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc31e('0x6'));var config=require('../../config/environment');var attributes=require(_0xc31e('0x7'));module[_0xc31e('0x8')]=function(_0x38be21,_0x5b98e8){return _0x38be21[_0xc31e('0x9')](_0xc31e('0xa'),attributes,{'tableName':_0xc31e('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 01e1400..f5fc56d 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 _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 +var _0x9430=['model','then','ShowSound','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','options','raw','where','attributes','include','map'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x9430,0x87));var _0x0943=function(_0x1c3f2a,_0x2450b6){_0x1c3f2a=_0x1c3f2a-0x0;var _0x24d231=_0x9430[_0x1c3f2a];return _0x24d231;};'use strict';var _=require(_0x0943('0x0'));var util=require(_0x0943('0x1'));var moment=require('moment');var BPromise=require(_0x0943('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0943('0x3'));var db=require(_0x0943('0x4'))['db'];var utils=require(_0x0943('0x5'));var logger=require(_0x0943('0x6'))(_0x0943('0x7'));var config=require(_0x0943('0x8'));var jayson=require(_0x0943('0x9'));var client=jayson[_0x0943('0xa')][_0x0943('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3675e9,_0x5691b0,_0x5c0b5b){return new BPromise(function(_0x318711,_0x5bdfa8){return client[_0x0943('0xc')](_0x3675e9,_0x5c0b5b)['then'](function(_0x45e4ea){logger[_0x0943('0xd')](_0x0943('0xe'),_0x5691b0,_0x0943('0xf'));logger[_0x0943('0x10')](_0x0943('0x11'),_0x5691b0,_0x0943('0xf'),JSON[_0x0943('0x12')](_0x45e4ea));if(_0x45e4ea[_0x0943('0x13')]){if(_0x45e4ea['error'][_0x0943('0x14')]===0x1f4){logger[_0x0943('0x13')](_0x0943('0xe'),_0x5691b0,_0x45e4ea['error'][_0x0943('0x15')]);return _0x5bdfa8(_0x45e4ea[_0x0943('0x13')][_0x0943('0x15')]);}logger[_0x0943('0x13')]('Sound,\x20%s,\x20%s',_0x5691b0,_0x45e4ea['error'][_0x0943('0x15')]);return _0x318711(_0x45e4ea[_0x0943('0x13')][_0x0943('0x15')]);}else{logger[_0x0943('0xd')](_0x0943('0xe'),_0x5691b0,_0x0943('0xf'));_0x318711(_0x45e4ea[_0x0943('0x16')][_0x0943('0x15')]);}})[_0x0943('0x17')](function(_0x2d9655){logger['error']('Sound,\x20%s,\x20%s',_0x5691b0,_0x2d9655);_0x5bdfa8(_0x2d9655);});});}exports['ShowSound']=function(_0x339b62){var _0x4ea2b7=this;return new Promise(function(_0x4eb8f0,_0x55d176){return db['Sound']['find']({'raw':_0x339b62['options']?_0x339b62[_0x0943('0x18')][_0x0943('0x19')]===undefined?!![]:![]:!![],'where':_0x339b62[_0x0943('0x18')]?_0x339b62['options'][_0x0943('0x1a')]||null:null,'attributes':_0x339b62['options']?_0x339b62[_0x0943('0x18')][_0x0943('0x1b')]||null:null,'include':_0x339b62[_0x0943('0x18')]?_0x339b62[_0x0943('0x18')][_0x0943('0x1c')]?_[_0x0943('0x1d')](_0x339b62[_0x0943('0x18')][_0x0943('0x1c')],function(_0x30c336){return{'model':db[_0x30c336[_0x0943('0x1e')]],'as':_0x30c336['as'],'attributes':_0x30c336[_0x0943('0x1b')],'include':_0x30c336[_0x0943('0x1c')]?_[_0x0943('0x1d')](_0x30c336[_0x0943('0x1c')],function(_0x49776e){return{'model':db[_0x49776e[_0x0943('0x1e')]],'as':_0x49776e['as'],'attributes':_0x49776e[_0x0943('0x1b')],'include':_0x49776e[_0x0943('0x1c')]?_['map'](_0x49776e[_0x0943('0x1c')],function(_0x348b87){return{'model':db[_0x348b87[_0x0943('0x1e')]],'as':_0x348b87['as'],'attributes':_0x348b87[_0x0943('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0943('0x1f')](function(_0x16b0f4){logger['info']('ShowSound',_0x339b62);logger[_0x0943('0x10')]('ShowSound',_0x339b62,JSON[_0x0943('0x12')](_0x16b0f4));_0x4eb8f0(_0x16b0f4);})[_0x0943('0x17')](function(_0x227371){logger['error'](_0x0943('0x20'),_0x227371[_0x0943('0x15')],_0x339b62);_0x55d176(_0x4ea2b7[_0x0943('0x13')](0x1f4,_0x227371[_0x0943('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 7fbcb5a..616d22f 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 _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 +var _0x8603=['../../components/interaction/service','./squareMessage.controller','isAuthenticated','index','get','/:id','create','put','update','exports','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x1073ad,_0x44bf0b){var _0x528474=function(_0x3450f7){while(--_0x3450f7){_0x1073ad['push'](_0x1073ad['shift']());}};_0x528474(++_0x44bf0b);}(_0x8603,0x190));var _0x3860=function(_0x34bcbf,_0x529caf){_0x34bcbf=_0x34bcbf-0x0;var _0x4951ee=_0x8603[_0x34bcbf];return _0x4951ee;};'use strict';var multer=require('multer');var util=require(_0x3860('0x0'));var path=require(_0x3860('0x1'));var timeout=require(_0x3860('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3860('0x3'));var auth=require(_0x3860('0x4'));var interaction=require(_0x3860('0x5'));var config=require('../../config/environment');var controller=require(_0x3860('0x6'));router['get']('/',auth[_0x3860('0x7')](),controller[_0x3860('0x8')]);router[_0x3860('0x9')](_0x3860('0xa'),auth[_0x3860('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x3860('0xb')]);router[_0x3860('0xc')]('/:id',auth[_0x3860('0x7')](),controller[_0x3860('0xd')]);router['delete'](_0x3860('0xa'),auth[_0x3860('0x7')](),controller['destroy']);module[_0x3860('0xe')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 053d78d..3046847 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 _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 +var _0xcaf4=['sequelize','exports','STRING','TEXT','ENUM','out'];(function(_0x1d36ab,_0x56afd7){var _0x15d2f2=function(_0x16f30e){while(--_0x16f30e){_0x1d36ab['push'](_0x1d36ab['shift']());}};_0x15d2f2(++_0x56afd7);}(_0xcaf4,0x168));var _0x4caf=function(_0x3dee51,_0x1befc4){_0x3dee51=_0x3dee51-0x0;var _0x4aae8c=_0xcaf4[_0x3dee51];return _0x4aae8c;};'use strict';var Sequelize=require(_0x4caf('0x0'));module[_0x4caf('0x1')]={'uniqueid':{'type':Sequelize[_0x4caf('0x2')]},'body':{'type':Sequelize[_0x4caf('0x3')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0x4caf('0x4')]('in',_0x4caf('0x5')),'defaultValue':_0x4caf('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x4caf('0x2')]},'providerResponse':{'type':Sequelize[_0x4caf('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index d89e4f5..a30868d 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 _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 +var _0xa413=['include','findAll','show','params','keys','create','catch','body','find','eml-format','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','Content-Range','reject','save','update','then','sendStatus','error','name','index','map','SquareMessage','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','options','includeAll'];(function(_0x557c45,_0x49b75f){var _0xa78a0e=function(_0x1b9a1c){while(--_0x1b9a1c){_0x557c45['push'](_0x557c45['shift']());}};_0xa78a0e(++_0x49b75f);}(_0xa413,0x1e5));var _0x3a41=function(_0x1f5799,_0x2c20ec){_0x1f5799=_0x1f5799-0x0;var _0xca1b5a=_0xa413[_0x1f5799];return _0xca1b5a;};'use strict';var emlformat=require(_0x3a41('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3a41('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3a41('0x2'));var moment=require(_0x3a41('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3a41('0x4'));var path=require(_0x3a41('0x5'));var sox=require(_0x3a41('0x6'));var csv=require(_0x3a41('0x7'));var ejs=require(_0x3a41('0x8'));var fs=require('fs');var fs_extra=require(_0x3a41('0x9'));var _=require(_0x3a41('0xa'));var squel=require(_0x3a41('0xb'));var crypto=require(_0x3a41('0xc'));var jsforce=require(_0x3a41('0xd'));var deskjs=require(_0x3a41('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3a41('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3a41('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3a41('0x11'));var logger=require('../../config/logger')(_0x3a41('0x12'));var utils=require(_0x3a41('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x3a41('0x14'));var db=require(_0x3a41('0x15'))['db'];function respondWithStatusCode(_0xb7e682,_0x12a91d){_0x12a91d=_0x12a91d||0xcc;return function(_0x15f6d5){if(_0x15f6d5){return _0xb7e682['sendStatus'](_0x12a91d);}return _0xb7e682[_0x3a41('0x16')](_0x12a91d)[_0x3a41('0x17')]();};}function respondWithResult(_0x2a6c12,_0x357829){_0x357829=_0x357829||0xc8;return function(_0x35f693){if(_0x35f693){return _0x2a6c12[_0x3a41('0x16')](_0x357829)[_0x3a41('0x18')](_0x35f693);}};}function respondWithFilteredResult(_0xebcca6,_0x463d5b){return function(_0x37697c){if(_0x37697c){var _0xbb7877=typeof _0x463d5b['offset']===_0x3a41('0x19')&&typeof _0x463d5b[_0x3a41('0x1a')]==='undefined';var _0x515a03=_0x37697c[_0x3a41('0x1b')];var _0x3c4267=_0xbb7877?0x0:_0x463d5b[_0x3a41('0x1c')];var _0x30591d=_0xbb7877?_0x37697c[_0x3a41('0x1b')]:_0x463d5b[_0x3a41('0x1c')]+_0x463d5b[_0x3a41('0x1a')];var _0x232b8d;if(_0x30591d>=_0x515a03){_0x30591d=_0x515a03;_0x232b8d=0xc8;}else{_0x232b8d=0xce;}_0xebcca6['status'](_0x232b8d);return _0xebcca6['set'](_0x3a41('0x1d'),_0x3c4267+'-'+_0x30591d+'/'+_0x515a03)[_0x3a41('0x18')](_0x37697c);}return null;};}function patchUpdates(_0x4cd443){return function(_0x5616f3){try{jsonpatch['apply'](_0x5616f3,_0x4cd443,!![]);}catch(_0x8629b5){return BPromise[_0x3a41('0x1e')](_0x8629b5);}return _0x5616f3[_0x3a41('0x1f')]();};}function saveUpdates(_0xc3f7ce,_0x547e43){return function(_0x5caa79){if(_0x5caa79){return _0x5caa79[_0x3a41('0x20')](_0xc3f7ce)[_0x3a41('0x21')](function(_0x4905de){return _0x4905de;});}return null;};}function removeEntity(_0x383788,_0x115b82){return function(_0x17dcf5){if(_0x17dcf5){return _0x17dcf5['destroy']()[_0x3a41('0x21')](function(){_0x383788[_0x3a41('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15e91c,_0x2a1354){return function(_0x4240a8){if(!_0x4240a8){_0x15e91c[_0x3a41('0x22')](0x194);}return _0x4240a8;};}function handleError(_0x4184b6,_0x549390){_0x549390=_0x549390||0x1f4;return function(_0x3d6582){logger[_0x3a41('0x23')](_0x3d6582['stack']);if(_0x3d6582[_0x3a41('0x24')]){delete _0x3d6582['name'];}_0x4184b6[_0x3a41('0x16')](_0x549390)['send'](_0x3d6582);};}exports[_0x3a41('0x25')]=function(_0x5be3cd,_0x39b9ef){var _0x219a12={},_0x185b95={},_0x2209d1={'count':0x0,'rows':[]};var _0x169c22=_[_0x3a41('0x26')](db[_0x3a41('0x27')][_0x3a41('0x28')],function(_0xeb5219){return{'name':_0xeb5219[_0x3a41('0x29')],'type':_0xeb5219[_0x3a41('0x2a')][_0x3a41('0x2b')]};});_0x185b95[_0x3a41('0x2c')]=_[_0x3a41('0x26')](_0x169c22,'name');_0x185b95['query']=_['keys'](_0x5be3cd['query']);_0x185b95[_0x3a41('0x2d')]=_[_0x3a41('0x2e')](_0x185b95[_0x3a41('0x2c')],_0x185b95[_0x3a41('0x2f')]);_0x219a12[_0x3a41('0x30')]=_['intersection'](_0x185b95['model'],qs['fields'](_0x5be3cd[_0x3a41('0x2f')][_0x3a41('0x31')]));_0x219a12['attributes']=_0x219a12[_0x3a41('0x30')][_0x3a41('0x32')]?_0x219a12[_0x3a41('0x30')]:_0x185b95[_0x3a41('0x2c')];if(!_0x5be3cd[_0x3a41('0x2f')][_0x3a41('0x33')](_0x3a41('0x34'))){_0x219a12[_0x3a41('0x1a')]=qs[_0x3a41('0x1a')](_0x5be3cd[_0x3a41('0x2f')][_0x3a41('0x1a')]);_0x219a12[_0x3a41('0x1c')]=qs[_0x3a41('0x1c')](_0x5be3cd[_0x3a41('0x2f')][_0x3a41('0x1c')]);}_0x219a12['order']=qs['sort'](_0x5be3cd[_0x3a41('0x2f')][_0x3a41('0x35')]);_0x219a12['where']=qs[_0x3a41('0x2d')](_['pick'](_0x5be3cd['query'],_0x185b95['filters']),_0x169c22);if(_0x5be3cd[_0x3a41('0x2f')][_0x3a41('0x36')]){_0x219a12['where']=_[_0x3a41('0x37')](_0x219a12[_0x3a41('0x38')],{'$or':_['map'](_0x169c22,function(_0x32ef22){if(_0x32ef22[_0x3a41('0x2a')]!=='VIRTUAL'){var _0x3f635e={};_0x3f635e[_0x32ef22['name']]={'$like':'%'+_0x5be3cd['query']['filter']+'%'};return _0x3f635e;}})});}_0x219a12=_[_0x3a41('0x37')]({},_0x219a12,_0x5be3cd[_0x3a41('0x39')]);var _0x58ce30={'where':_0x219a12[_0x3a41('0x38')]};return db[_0x3a41('0x27')][_0x3a41('0x1b')](_0x58ce30)[_0x3a41('0x21')](function(_0x16dc21){_0x2209d1[_0x3a41('0x1b')]=_0x16dc21;if(_0x5be3cd[_0x3a41('0x2f')][_0x3a41('0x3a')]){_0x219a12[_0x3a41('0x3b')]=[{'all':!![]}];}return db[_0x3a41('0x27')][_0x3a41('0x3c')](_0x219a12);})[_0x3a41('0x21')](function(_0x5115b8){_0x2209d1['rows']=_0x5115b8;return _0x2209d1;})['then'](respondWithFilteredResult(_0x39b9ef,_0x219a12))['catch'](handleError(_0x39b9ef,null));};exports[_0x3a41('0x3d')]=function(_0x28cebb,_0x5a6dd8){var _0x2b21a1={'raw':!![],'where':{'id':_0x28cebb[_0x3a41('0x3e')]['id']}},_0x4c6659={};_0x4c6659[_0x3a41('0x2c')]=_[_0x3a41('0x3f')](db['SquareMessage'][_0x3a41('0x28')]);_0x4c6659[_0x3a41('0x2f')]=_[_0x3a41('0x3f')](_0x28cebb['query']);_0x4c6659[_0x3a41('0x2d')]=_[_0x3a41('0x2e')](_0x4c6659[_0x3a41('0x2c')],_0x4c6659[_0x3a41('0x2f')]);_0x2b21a1[_0x3a41('0x30')]=_[_0x3a41('0x2e')](_0x4c6659[_0x3a41('0x2c')],qs['fields'](_0x28cebb[_0x3a41('0x2f')][_0x3a41('0x31')]));_0x2b21a1[_0x3a41('0x30')]=_0x2b21a1[_0x3a41('0x30')]['length']?_0x2b21a1[_0x3a41('0x30')]:_0x4c6659[_0x3a41('0x2c')];if(_0x28cebb['query'][_0x3a41('0x3a')]){_0x2b21a1[_0x3a41('0x3b')]=[{'all':!![]}];}_0x2b21a1=_[_0x3a41('0x37')]({},_0x2b21a1,_0x28cebb[_0x3a41('0x39')]);return db[_0x3a41('0x27')]['find'](_0x2b21a1)[_0x3a41('0x21')](handleEntityNotFound(_0x5a6dd8,null))['then'](respondWithResult(_0x5a6dd8,null))['catch'](handleError(_0x5a6dd8,null));};exports[_0x3a41('0x40')]=function(_0x1307b3,_0x3f3db2){return db[_0x3a41('0x27')]['create'](_0x1307b3['body'],{})['then'](respondWithResult(_0x3f3db2,0xc9))[_0x3a41('0x41')](handleError(_0x3f3db2,null));};exports[_0x3a41('0x20')]=function(_0xde1297,_0x3069db){if(_0xde1297[_0x3a41('0x42')]['id']){delete _0xde1297[_0x3a41('0x42')]['id'];}return db[_0x3a41('0x27')][_0x3a41('0x43')]({'where':{'id':_0xde1297[_0x3a41('0x3e')]['id']}})[_0x3a41('0x21')](handleEntityNotFound(_0x3069db,null))[_0x3a41('0x21')](saveUpdates(_0xde1297[_0x3a41('0x42')],null))[_0x3a41('0x21')](respondWithResult(_0x3069db,null))[_0x3a41('0x41')](handleError(_0x3069db,null));};exports['destroy']=function(_0x1f9b59,_0x4aa033){return db[_0x3a41('0x27')]['find']({'where':{'id':_0x1f9b59[_0x3a41('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4aa033,null))[_0x3a41('0x21')](removeEntity(_0x4aa033,null))[_0x3a41('0x41')](handleError(_0x4aa033,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 1d0576b..32cccba 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 _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 +var _0xc516=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','define','SquareMessage','square_messages','util','../../config/logger'];(function(_0x5aa6af,_0x173c0a){var _0x73a4bc=function(_0x35fe38){while(--_0x35fe38){_0x5aa6af['push'](_0x5aa6af['shift']());}};_0x73a4bc(++_0x173c0a);}(_0xc516,0x136));var _0x6c51=function(_0x5e2862,_0x4760eb){_0x5e2862=_0x5e2862-0x0;var _0x8dcad4=_0xc516[_0x5e2862];return _0x8dcad4;};'use strict';var _=require('lodash');var util=require(_0x6c51('0x0'));var logger=require(_0x6c51('0x1'))(_0x6c51('0x2'));var moment=require(_0x6c51('0x3'));var BPromise=require(_0x6c51('0x4'));var rp=require(_0x6c51('0x5'));var fs=require('fs');var path=require(_0x6c51('0x6'));var rimraf=require(_0x6c51('0x7'));var config=require(_0x6c51('0x8'));var attributes=require(_0x6c51('0x9'));module['exports']=function(_0x224116,_0xb8d80){return _0x224116[_0x6c51('0xa')](_0x6c51('0xb'),attributes,{'tableName':_0x6c51('0xc'),'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 75cfd90..b6ea4e4 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 _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 +var _0x375d=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SquareMessage,\x20%s,\x20%s','request\x20sent','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateSquareMessage','body','options','raw','then','debug'];(function(_0x3ddb0,_0x2dcb9c){var _0x483437=function(_0xb3239d){while(--_0xb3239d){_0x3ddb0['push'](_0x3ddb0['shift']());}};_0x483437(++_0x2dcb9c);}(_0x375d,0x91));var _0xd375=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x375d[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xd375('0x0'));var moment=require(_0xd375('0x1'));var BPromise=require(_0xd375('0x2'));var rs=require(_0xd375('0x3'));var fs=require('fs');var Redis=require(_0xd375('0x4'));var db=require(_0xd375('0x5'))['db'];var utils=require(_0xd375('0x6'));var logger=require(_0xd375('0x7'))(_0xd375('0x8'));var config=require(_0xd375('0x9'));var jayson=require(_0xd375('0xa'));var client=jayson[_0xd375('0xb')][_0xd375('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x28b56d,_0x18e6c6,_0x4fe0a6){return new BPromise(function(_0x3d0133,_0x133aba){return client[_0xd375('0xd')](_0x28b56d,_0x4fe0a6)['then'](function(_0x29bf57){logger[_0xd375('0xe')](_0xd375('0xf'),_0x18e6c6,_0xd375('0x10'));logger['debug'](_0xd375('0x11'),_0x18e6c6,_0xd375('0x10'),JSON[_0xd375('0x12')](_0x29bf57));if(_0x29bf57['error']){if(_0x29bf57[_0xd375('0x13')][_0xd375('0x14')]===0x1f4){logger[_0xd375('0x13')](_0xd375('0xf'),_0x18e6c6,_0x29bf57[_0xd375('0x13')][_0xd375('0x15')]);return _0x133aba(_0x29bf57[_0xd375('0x13')][_0xd375('0x15')]);}logger[_0xd375('0x13')](_0xd375('0xf'),_0x18e6c6,_0x29bf57[_0xd375('0x13')][_0xd375('0x15')]);return _0x3d0133(_0x29bf57['error'][_0xd375('0x15')]);}else{logger[_0xd375('0xe')](_0xd375('0xf'),_0x18e6c6,_0xd375('0x10'));_0x3d0133(_0x29bf57['result'][_0xd375('0x15')]);}})[_0xd375('0x16')](function(_0x3ee196){logger[_0xd375('0x13')](_0xd375('0xf'),_0x18e6c6,_0x3ee196);_0x133aba(_0x3ee196);});});}exports[_0xd375('0x17')]=function(_0x2be05d){var _0x3bb572=this;return new Promise(function(_0x5251da,_0x196082){return db['SquareMessage']['create'](_0x2be05d[_0xd375('0x18')],{'raw':_0x2be05d[_0xd375('0x19')]?_0x2be05d[_0xd375('0x19')][_0xd375('0x1a')]===undefined?!![]:![]:!![]})[_0xd375('0x1b')](function(_0x75fd3a){logger[_0xd375('0xe')](_0xd375('0x17'),_0x2be05d);logger[_0xd375('0x1c')](_0xd375('0x17'),_0x2be05d,JSON[_0xd375('0x12')](_0x75fd3a));_0x5251da(_0x75fd3a);})['catch'](function(_0x1ec41d){logger[_0xd375('0x13')]('CreateSquareMessage',_0x1ec41d[_0xd375('0x15')],_0x2be05d);_0x196082(_0x3bb572[_0xd375('0x13')](0x1f4,_0x1ec41d[_0xd375('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 786dca2..835a127 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 _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 +var _0x02ac=['connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','show','/:id/test','15s','create','put','delete','destroy','exports','multer','util','path'];(function(_0x4e18dc,_0x30fc09){var _0x128f84=function(_0x163ce9){while(--_0x163ce9){_0x4e18dc['push'](_0x4e18dc['shift']());}};_0x128f84(++_0x30fc09);}(_0x02ac,0x138));var _0xc02a=function(_0x52e67d,_0x727d0){_0x52e67d=_0x52e67d-0x0;var _0x2889e9=_0x02ac[_0x52e67d];return _0x2889e9;};'use strict';var multer=require(_0xc02a('0x0'));var util=require(_0xc02a('0x1'));var path=require(_0xc02a('0x2'));var timeout=require(_0xc02a('0x3'));var express=require('express');var router=express[_0xc02a('0x4')]();var fs_extra=require(_0xc02a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc02a('0x6'));var config=require(_0xc02a('0x7'));var controller=require(_0xc02a('0x8'));router[_0xc02a('0x9')]('/',auth[_0xc02a('0xa')](),controller[_0xc02a('0xb')]);router['get'](_0xc02a('0xc'),auth[_0xc02a('0xa')](),controller[_0xc02a('0xd')]);router[_0xc02a('0x9')](_0xc02a('0xe'),auth[_0xc02a('0xa')](),timeout(_0xc02a('0xf')),controller['test']);router['post']('/',auth[_0xc02a('0xa')](),controller[_0xc02a('0x10')]);router[_0xc02a('0x11')](_0xc02a('0xc'),auth[_0xc02a('0xa')](),controller['update']);router[_0xc02a('0x12')](_0xc02a('0xc'),auth['isAuthenticated'](),controller[_0xc02a('0x13')]);module[_0xc02a('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 6cd58c5..19e84bf 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 _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 +var _0x81fd=['STRING','name','sequelize','exports'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0x81fd,0x18e));var _0xd81f=function(_0x282a1e,_0x54b177){_0x282a1e=_0x282a1e-0x0;var _0x1f1028=_0x81fd[_0x282a1e];return _0x1f1028;};'use strict';var Sequelize=require(_0xd81f('0x0'));module[_0xd81f('0x1')]={'name':{'type':Sequelize[_0xd81f('0x2')],'unique':_0xd81f('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0xd81f('0x2')]},'description':{'type':Sequelize[_0xd81f('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index b4601a7..fc85140 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 _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 +var _0x1e22=['eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','get','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','SquareOdbc','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','create','user','role','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','dsn','odbc','closeSync'];(function(_0x127b1e,_0x3142e6){var _0xda63a5=function(_0x151556){while(--_0x151556){_0x127b1e['push'](_0x127b1e['shift']());}};_0xda63a5(++_0x3142e6);}(_0x1e22,0x1e0));var _0x21e2=function(_0x5e42a7,_0x3eba35){_0x5e42a7=_0x5e42a7-0x0;var _0x36d21b=_0x1e22[_0x5e42a7];return _0x36d21b;};'use strict';var emlformat=require(_0x21e2('0x0'));var rimraf=require(_0x21e2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x21e2('0x2'));var rp=require(_0x21e2('0x3'));var moment=require(_0x21e2('0x4'));var BPromise=require(_0x21e2('0x5'));var Mustache=require('mustache');var util=require(_0x21e2('0x6'));var path=require(_0x21e2('0x7'));var sox=require('sox');var csv=require(_0x21e2('0x8'));var ejs=require(_0x21e2('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x21e2('0xa'));var squel=require('squel');var crypto=require(_0x21e2('0xb'));var jsforce=require(_0x21e2('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x21e2('0x8'));var querystring=require(_0x21e2('0xd'));var Papa=require(_0x21e2('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x21e2('0xf'));var as=require(_0x21e2('0x10'));var hardwareService=require(_0x21e2('0x11'));var logger=require(_0x21e2('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x21e2('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x102377,_0x110154){_0x110154=_0x110154||0xcc;return function(_0x115a5c){if(_0x115a5c){return _0x102377['sendStatus'](_0x110154);}return _0x102377[_0x21e2('0x14')](_0x110154)[_0x21e2('0x15')]();};}function respondWithResult(_0x379af3,_0x5ee2e7){_0x5ee2e7=_0x5ee2e7||0xc8;return function(_0x41a4c6){if(_0x41a4c6){return _0x379af3[_0x21e2('0x14')](_0x5ee2e7)[_0x21e2('0x16')](_0x41a4c6);}};}function respondWithFilteredResult(_0x592147,_0x237439){return function(_0x559f7f){if(_0x559f7f){var _0x1bc420=typeof _0x237439[_0x21e2('0x17')]===_0x21e2('0x18')&&typeof _0x237439[_0x21e2('0x19')]===_0x21e2('0x18');var _0x19eae0=_0x559f7f['count'];var _0x1ebd28=_0x1bc420?0x0:_0x237439['offset'];var _0x8b78c0=_0x1bc420?_0x559f7f[_0x21e2('0x1a')]:_0x237439[_0x21e2('0x17')]+_0x237439[_0x21e2('0x19')];var _0x290dad;if(_0x8b78c0>=_0x19eae0){_0x8b78c0=_0x19eae0;_0x290dad=0xc8;}else{_0x290dad=0xce;}_0x592147[_0x21e2('0x14')](_0x290dad);return _0x592147['set'](_0x21e2('0x1b'),_0x1ebd28+'-'+_0x8b78c0+'/'+_0x19eae0)['json'](_0x559f7f);}return null;};}function patchUpdates(_0x1675ae){return function(_0x2ab8e6){try{jsonpatch[_0x21e2('0x1c')](_0x2ab8e6,_0x1675ae,!![]);}catch(_0x55d1ae){return BPromise['reject'](_0x55d1ae);}return _0x2ab8e6[_0x21e2('0x1d')]();};}function saveUpdates(_0x3eadfe,_0x5766ff){return function(_0x1cdd9b){if(_0x1cdd9b){return _0x1cdd9b[_0x21e2('0x1e')](_0x3eadfe)[_0x21e2('0x1f')](function(_0x989b03){return _0x989b03;});}return null;};}function removeEntity(_0x4b2f21,_0x2dc672){return function(_0x5f14cf){if(_0x5f14cf){return _0x5f14cf['destroy']()['then'](function(){var _0x9e9cdc=_0x5f14cf[_0x21e2('0x20')]({'plain':!![]});var _0x1140af='ODBC';return db[_0x21e2('0x21')][_0x21e2('0x22')]({'where':{'type':_0x1140af,'resourceId':_0x9e9cdc['id']}})[_0x21e2('0x1f')](function(){return _0x5f14cf;});})['then'](function(){_0x4b2f21[_0x21e2('0x14')](0xcc)[_0x21e2('0x15')]();});}};}function handleEntityNotFound(_0x4d0f2e,_0x1ac167){return function(_0x58a5c5){if(!_0x58a5c5){_0x4d0f2e[_0x21e2('0x23')](0x194);}return _0x58a5c5;};}function handleError(_0x491678,_0x191c0c){_0x191c0c=_0x191c0c||0x1f4;return function(_0x17d6d0){logger[_0x21e2('0x24')](_0x17d6d0[_0x21e2('0x25')]);if(_0x17d6d0['name']){delete _0x17d6d0[_0x21e2('0x26')];}_0x491678[_0x21e2('0x14')](_0x191c0c)[_0x21e2('0x27')](_0x17d6d0);};}exports[_0x21e2('0x28')]=function(_0x54dd91,_0x5d344a){var _0x2068e7={},_0x5dafe2={},_0x31c587={'count':0x0,'rows':[]};var _0x1f06fb=_['map'](db[_0x21e2('0x29')][_0x21e2('0x2a')],function(_0x2ad63b){return{'name':_0x2ad63b['fieldName'],'type':_0x2ad63b[_0x21e2('0x2b')][_0x21e2('0x2c')]};});_0x5dafe2[_0x21e2('0x2d')]=_[_0x21e2('0x2e')](_0x1f06fb,_0x21e2('0x26'));_0x5dafe2[_0x21e2('0x2f')]=_[_0x21e2('0x30')](_0x54dd91[_0x21e2('0x2f')]);_0x5dafe2[_0x21e2('0x31')]=_[_0x21e2('0x32')](_0x5dafe2[_0x21e2('0x2d')],_0x5dafe2[_0x21e2('0x2f')]);_0x2068e7[_0x21e2('0x33')]=_[_0x21e2('0x32')](_0x5dafe2[_0x21e2('0x2d')],qs['fields'](_0x54dd91[_0x21e2('0x2f')][_0x21e2('0x34')]));_0x2068e7['attributes']=_0x2068e7[_0x21e2('0x33')][_0x21e2('0x35')]?_0x2068e7['attributes']:_0x5dafe2['model'];if(!_0x54dd91[_0x21e2('0x2f')][_0x21e2('0x36')](_0x21e2('0x37'))){_0x2068e7[_0x21e2('0x19')]=qs[_0x21e2('0x19')](_0x54dd91[_0x21e2('0x2f')]['limit']);_0x2068e7[_0x21e2('0x17')]=qs[_0x21e2('0x17')](_0x54dd91[_0x21e2('0x2f')]['offset']);}_0x2068e7[_0x21e2('0x38')]=qs[_0x21e2('0x39')](_0x54dd91[_0x21e2('0x2f')][_0x21e2('0x39')]);_0x2068e7[_0x21e2('0x3a')]=qs[_0x21e2('0x31')](_[_0x21e2('0x3b')](_0x54dd91['query'],_0x5dafe2['filters']),_0x1f06fb);if(_0x54dd91['query'][_0x21e2('0x3c')]){_0x2068e7[_0x21e2('0x3a')]=_[_0x21e2('0x3d')](_0x2068e7[_0x21e2('0x3a')],{'$or':_['map'](_0x1f06fb,function(_0x4f41fe){if(_0x4f41fe[_0x21e2('0x2b')]!==_0x21e2('0x3e')){var _0x4665c3={};_0x4665c3[_0x4f41fe['name']]={'$like':'%'+_0x54dd91[_0x21e2('0x2f')]['filter']+'%'};return _0x4665c3;}})});}_0x2068e7=_['merge']({},_0x2068e7,_0x54dd91[_0x21e2('0x3f')]);var _0x1f0ec3={'where':_0x2068e7[_0x21e2('0x3a')]};return db['SquareOdbc'][_0x21e2('0x1a')](_0x1f0ec3)['then'](function(_0x2dc88f){_0x31c587[_0x21e2('0x1a')]=_0x2dc88f;if(_0x54dd91[_0x21e2('0x2f')]['includeAll']){_0x2068e7[_0x21e2('0x40')]=[{'all':!![]}];}return db[_0x21e2('0x29')][_0x21e2('0x41')](_0x2068e7);})[_0x21e2('0x1f')](function(_0x3b7bfa){_0x31c587[_0x21e2('0x42')]=_0x3b7bfa;return _0x31c587;})[_0x21e2('0x1f')](respondWithFilteredResult(_0x5d344a,_0x2068e7))[_0x21e2('0x43')](handleError(_0x5d344a,null));};exports[_0x21e2('0x44')]=function(_0x5adb93,_0x329276){var _0x586c50={'raw':!![],'where':{'id':_0x5adb93[_0x21e2('0x45')]['id']}},_0x4d4ca0={};_0x4d4ca0[_0x21e2('0x2d')]=_[_0x21e2('0x30')](db[_0x21e2('0x29')][_0x21e2('0x2a')]);_0x4d4ca0[_0x21e2('0x2f')]=_[_0x21e2('0x30')](_0x5adb93[_0x21e2('0x2f')]);_0x4d4ca0['filters']=_[_0x21e2('0x32')](_0x4d4ca0['model'],_0x4d4ca0['query']);_0x586c50[_0x21e2('0x33')]=_['intersection'](_0x4d4ca0[_0x21e2('0x2d')],qs[_0x21e2('0x34')](_0x5adb93['query'][_0x21e2('0x34')]));_0x586c50[_0x21e2('0x33')]=_0x586c50[_0x21e2('0x33')]['length']?_0x586c50['attributes']:_0x4d4ca0[_0x21e2('0x2d')];if(_0x5adb93[_0x21e2('0x2f')]['includeAll']){_0x586c50['include']=[{'all':!![]}];}_0x586c50=_[_0x21e2('0x3d')]({},_0x586c50,_0x5adb93[_0x21e2('0x3f')]);return db[_0x21e2('0x29')]['find'](_0x586c50)['then'](handleEntityNotFound(_0x329276,null))[_0x21e2('0x1f')](respondWithResult(_0x329276,null))[_0x21e2('0x43')](handleError(_0x329276,null));};exports[_0x21e2('0x46')]=function(_0x1c3cb7,_0x1c449d){return db[_0x21e2('0x29')][_0x21e2('0x46')](_0x1c3cb7['body'],{})[_0x21e2('0x1f')](function(_0x50418e){var _0xedc4a6=_0x1c3cb7[_0x21e2('0x47')][_0x21e2('0x20')]({'plain':!![]});if(!_0xedc4a6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xedc4a6[_0x21e2('0x48')]==='user'){var _0x1a777a=_0x50418e[_0x21e2('0x20')]({'plain':!![]});var _0xda1a87='ODBC';return db['UserProfileSection'][_0x21e2('0x49')]({'where':{'name':_0xda1a87,'userProfileId':_0xedc4a6[_0x21e2('0x4a')]},'raw':!![]})[_0x21e2('0x1f')](function(_0x3ae40f){if(_0x3ae40f&&_0x3ae40f['autoAssociation']===0x0){return db['UserProfileResource'][_0x21e2('0x46')]({'name':_0x1a777a[_0x21e2('0x26')],'resourceId':_0x1a777a['id'],'type':_0x3ae40f[_0x21e2('0x26')],'sectionId':_0x3ae40f['id']},{})[_0x21e2('0x1f')](function(){return _0x50418e;});}else{return _0x50418e;}})[_0x21e2('0x43')](function(_0x353a98){logger['error'](_0x21e2('0x4b'),_0x353a98);throw _0x353a98;});}return _0x50418e;})['then'](respondWithResult(_0x1c449d,0xc9))[_0x21e2('0x43')](handleError(_0x1c449d,null));};exports[_0x21e2('0x1e')]=function(_0x280ec7,_0x4ba1f9){if(_0x280ec7[_0x21e2('0x4c')]['id']){delete _0x280ec7[_0x21e2('0x4c')]['id'];}return db[_0x21e2('0x29')][_0x21e2('0x49')]({'where':{'id':_0x280ec7[_0x21e2('0x45')]['id']}})[_0x21e2('0x1f')](handleEntityNotFound(_0x4ba1f9,null))[_0x21e2('0x1f')](saveUpdates(_0x280ec7[_0x21e2('0x4c')],null))['then'](respondWithResult(_0x4ba1f9,null))[_0x21e2('0x43')](handleError(_0x4ba1f9,null));};exports[_0x21e2('0x22')]=function(_0x2428a4,_0x41acbc){return db[_0x21e2('0x29')][_0x21e2('0x49')]({'where':{'id':_0x2428a4[_0x21e2('0x45')]['id']}})[_0x21e2('0x1f')](handleEntityNotFound(_0x41acbc,null))[_0x21e2('0x1f')](removeEntity(_0x41acbc,null))[_0x21e2('0x43')](handleError(_0x41acbc,null));};exports['test']=function(_0x4e2aac,_0x5ee3f0,_0x53c806){var _0xc6602a;return db[_0x21e2('0x29')][_0x21e2('0x49')]({'where':{'id':_0x4e2aac['params']['id']},'attributes':['id',_0x21e2('0x4d')]})[_0x21e2('0x1f')](handleEntityNotFound(_0x5ee3f0,null))[_0x21e2('0x1f')](function(_0x468018){if(_0x468018){var _0x5a8193=require(_0x21e2('0x4e'))();_0x5a8193['openSync'](_0x468018[_0x21e2('0x4d')]);_0x5a8193[_0x21e2('0x4f')]();return _0x468018;}})[_0x21e2('0x1f')](respondWithResult(_0x5ee3f0,null))['catch'](handleError(_0x5ee3f0,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index e3ed2e1..0dfbeae 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 _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 +var _0xb935=['../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x545e53,_0x24c833){var _0xc299f7=function(_0x1b7c28){while(--_0x1b7c28){_0x545e53['push'](_0x545e53['shift']());}};_0xc299f7(++_0x24c833);}(_0xb935,0x17f));var _0x5b93=function(_0x2e4745,_0x3a39e2){_0x2e4745=_0x2e4745-0x0;var _0x4d3a79=_0xb935[_0x2e4745];return _0x4d3a79;};'use strict';var _=require('lodash');var util=require(_0x5b93('0x0'));var logger=require(_0x5b93('0x1'))(_0x5b93('0x2'));var moment=require(_0x5b93('0x3'));var BPromise=require(_0x5b93('0x4'));var rp=require(_0x5b93('0x5'));var fs=require('fs');var path=require(_0x5b93('0x6'));var rimraf=require('rimraf');var config=require(_0x5b93('0x7'));var attributes=require(_0x5b93('0x8'));module[_0x5b93('0x9')]=function(_0x5b1812,_0x36fc40){return _0x5b1812[_0x5b93('0xa')](_0x5b93('0xb'),attributes,{'tableName':_0x5b93('0xc'),'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 704cb33..e3a7c16 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 _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 +var _0xc1b5=['where','attributes','include','map','model','catch','ShowSquareOdbc','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','SquareOdbc,\x20%s,\x20%s','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','SquareOdbc','find','options'];(function(_0x263b2c,_0x388a18){var _0x1d00f3=function(_0x838382){while(--_0x838382){_0x263b2c['push'](_0x263b2c['shift']());}};_0x1d00f3(++_0x388a18);}(_0xc1b5,0x151));var _0x5c1b=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0xc1b5[_0x279d37];return _0x530173;};'use strict';var _=require(_0x5c1b('0x0'));var util=require(_0x5c1b('0x1'));var moment=require(_0x5c1b('0x2'));var BPromise=require(_0x5c1b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5c1b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5c1b('0x5'));var logger=require(_0x5c1b('0x6'))(_0x5c1b('0x7'));var config=require(_0x5c1b('0x8'));var jayson=require(_0x5c1b('0x9'));var client=jayson['client'][_0x5c1b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f1b4d,_0x5e7aa4,_0x53c636){return new BPromise(function(_0x517dd4,_0x2c5390){return client[_0x5c1b('0xb')](_0x4f1b4d,_0x53c636)[_0x5c1b('0xc')](function(_0x436ea3){logger['info'](_0x5c1b('0xd'),_0x5e7aa4,'request\x20sent');logger[_0x5c1b('0xe')](_0x5c1b('0xf'),_0x5e7aa4,'request\x20sent',JSON[_0x5c1b('0x10')](_0x436ea3));if(_0x436ea3[_0x5c1b('0x11')]){if(_0x436ea3['error'][_0x5c1b('0x12')]===0x1f4){logger['error']('SquareOdbc,\x20%s,\x20%s',_0x5e7aa4,_0x436ea3[_0x5c1b('0x11')][_0x5c1b('0x13')]);return _0x2c5390(_0x436ea3['error']['message']);}logger[_0x5c1b('0x11')](_0x5c1b('0xd'),_0x5e7aa4,_0x436ea3[_0x5c1b('0x11')][_0x5c1b('0x13')]);return _0x517dd4(_0x436ea3[_0x5c1b('0x11')][_0x5c1b('0x13')]);}else{logger[_0x5c1b('0x14')](_0x5c1b('0xd'),_0x5e7aa4,_0x5c1b('0x15'));_0x517dd4(_0x436ea3[_0x5c1b('0x16')][_0x5c1b('0x13')]);}})['catch'](function(_0x508be4){logger['error'](_0x5c1b('0xd'),_0x5e7aa4,_0x508be4);_0x2c5390(_0x508be4);});});}exports['ShowSquareOdbc']=function(_0x38bccc){var _0x54fd88=this;return new Promise(function(_0x30e79c,_0x7fecd){return db[_0x5c1b('0x17')][_0x5c1b('0x18')]({'raw':_0x38bccc['options']?_0x38bccc[_0x5c1b('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x38bccc[_0x5c1b('0x19')]?_0x38bccc[_0x5c1b('0x19')][_0x5c1b('0x1a')]||null:null,'attributes':_0x38bccc['options']?_0x38bccc['options'][_0x5c1b('0x1b')]||null:null,'include':_0x38bccc['options']?_0x38bccc[_0x5c1b('0x19')][_0x5c1b('0x1c')]?_[_0x5c1b('0x1d')](_0x38bccc[_0x5c1b('0x19')][_0x5c1b('0x1c')],function(_0x2eb984){return{'model':db[_0x2eb984[_0x5c1b('0x1e')]],'as':_0x2eb984['as'],'attributes':_0x2eb984[_0x5c1b('0x1b')],'include':_0x2eb984['include']?_[_0x5c1b('0x1d')](_0x2eb984['include'],function(_0x552d95){return{'model':db[_0x552d95[_0x5c1b('0x1e')]],'as':_0x552d95['as'],'attributes':_0x552d95['attributes'],'include':_0x552d95[_0x5c1b('0x1c')]?_[_0x5c1b('0x1d')](_0x552d95[_0x5c1b('0x1c')],function(_0x39f382){return{'model':db[_0x39f382[_0x5c1b('0x1e')]],'as':_0x39f382['as'],'attributes':_0x39f382['attributes']};}):[]};}):[]};}):[]:[]})[_0x5c1b('0xc')](function(_0x5c6943){logger[_0x5c1b('0x14')]('ShowSquareOdbc',_0x38bccc);logger[_0x5c1b('0xe')]('ShowSquareOdbc',_0x38bccc,JSON['stringify'](_0x5c6943));_0x30e79c(_0x5c6943);})[_0x5c1b('0x1f')](function(_0x1a0dd7){logger[_0x5c1b('0x11')](_0x5c1b('0x20'),_0x1a0dd7[_0x5c1b('0x13')],_0x38bccc);_0x7fecd(_0x54fd88[_0x5c1b('0x11')](0x1f4,_0x1a0dd7[_0x5c1b('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index fa905a1..94e1648 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 _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 +var _0x81d8=['connect-timeout','express','Router','./squareProject.controller','get','isAuthenticated','/:id','show','post','put','update','exports','multer','util','path'];(function(_0x87e0dc,_0x577dce){var _0x2cd2d1=function(_0x2d8173){while(--_0x2d8173){_0x87e0dc['push'](_0x87e0dc['shift']());}};_0x2cd2d1(++_0x577dce);}(_0x81d8,0xde));var _0x881d=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x81d8[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x881d('0x0'));var util=require(_0x881d('0x1'));var path=require(_0x881d('0x2'));var timeout=require(_0x881d('0x3'));var express=require(_0x881d('0x4'));var router=express[_0x881d('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x881d('0x6'));router[_0x881d('0x7')]('/',auth[_0x881d('0x8')](),controller['index']);router[_0x881d('0x7')](_0x881d('0x9'),auth[_0x881d('0x8')](),controller[_0x881d('0xa')]);router[_0x881d('0xb')]('/',auth[_0x881d('0x8')](),controller['create']);router[_0x881d('0xc')](_0x881d('0x9'),auth['isAuthenticated'](),controller[_0x881d('0xd')]);router['delete'](_0x881d('0x9'),auth[_0x881d('0x8')](),controller['destroy']);module[_0x881d('0xe')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index f8720dc..ce6ee10 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 _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 +var _0xcd7a=['production','DATE','sequelize','name','STRING','long','getDataValue','preproduction','toString','utf8','BLOB'];(function(_0x1a1389,_0x588d1c){var _0xc0618d=function(_0x3efb69){while(--_0x3efb69){_0x1a1389['push'](_0x1a1389['shift']());}};_0xc0618d(++_0x588d1c);}(_0xcd7a,0x115));var _0xacd7=function(_0x1af1d5,_0x3d653a){_0x1af1d5=_0x1af1d5-0x0;var _0x5a18a9=_0xcd7a[_0x1af1d5];return _0x5a18a9;};'use strict';var Sequelize=require(_0xacd7('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xacd7('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0xacd7('0x2')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize['BLOB'](_0xacd7('0x3')),'get':function(){if(this[_0xacd7('0x4')](_0xacd7('0x5'))){return this[_0xacd7('0x4')](_0xacd7('0x5'))[_0xacd7('0x6')](_0xacd7('0x7'));}}},'production':{'type':Sequelize[_0xacd7('0x8')](_0xacd7('0x3')),'get':function(){if(this[_0xacd7('0x4')](_0xacd7('0x9'))){return this[_0xacd7('0x4')](_0xacd7('0x9'))[_0xacd7('0x6')]('utf8');}}},'savedAt':{'type':Sequelize[_0xacd7('0xa')]},'publishedAt':{'type':Sequelize[_0xacd7('0xa')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index d3e9f5c..f801c2c 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 _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 +var _0xfafb=['production','params','lodash','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','json','offset','limit','count','status','update','then','get','SquareProjects','destroy','publish','end','sendStatus','stack','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','SquareProject','includeAll','rows','show','find','catch','create','body','user','UserProfileSection','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','stringify'];(function(_0x5160a6,_0x5e9b19){var _0x5d1b57=function(_0x1b139f){while(--_0x1b139f){_0x5160a6['push'](_0x5160a6['shift']());}};_0x5d1b57(++_0x5e9b19);}(_0xfafb,0x1c2));var _0xbfaf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfafb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xbfaf('0x0'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xbfaf('0x1'))(_0xbfaf('0x2'));var config=require(_0xbfaf('0x3'));var db=require(_0xbfaf('0x4'))['db'];config[_0xbfaf('0x5')]=_[_0xbfaf('0x6')](config[_0xbfaf('0x5')],{'host':_0xbfaf('0x7'),'port':0x18eb});var socket=require(_0xbfaf('0x8'))(new Redis(config[_0xbfaf('0x5')]));require(_0xbfaf('0x9'))[_0xbfaf('0xa')](socket);function respondWithResult(_0x415953,_0x37b612){_0x37b612=_0x37b612||0xc8;return function(_0x1ca0d6){if(_0x1ca0d6){return _0x415953['status'](_0x37b612)[_0xbfaf('0xb')](_0x1ca0d6);}};}function respondWithFilteredResult(_0x4478ea,_0x3fe050){return function(_0x1b6e56){if(_0x1b6e56){var _0x5f31ca=typeof _0x3fe050[_0xbfaf('0xc')]==='undefined'&&typeof _0x3fe050[_0xbfaf('0xd')]==='undefined';var _0x36306=_0x1b6e56[_0xbfaf('0xe')];var _0x385b85=_0x5f31ca?0x0:_0x3fe050[_0xbfaf('0xc')];var _0x50c672=_0x5f31ca?_0x1b6e56[_0xbfaf('0xe')]:_0x3fe050['offset']+_0x3fe050[_0xbfaf('0xd')];var _0x5b34fa;if(_0x50c672>=_0x36306){_0x50c672=_0x36306;_0x5b34fa=0xc8;}else{_0x5b34fa=0xce;}_0x4478ea[_0xbfaf('0xf')](_0x5b34fa);return _0x4478ea['set']('Content-Range',_0x385b85+'-'+_0x50c672+'/'+_0x36306)['json'](_0x1b6e56);}return null;};}function saveUpdates(_0x1976d6){return function(_0x20c9f1){if(_0x20c9f1){return _0x20c9f1[_0xbfaf('0x10')](_0x1976d6)[_0xbfaf('0x11')](function(_0x2c44c8){return _0x2c44c8;});}return null;};}function removeEntity(_0x51efe9){return function(_0x5027d1){if(_0x5027d1){return _0x5027d1['destroy']()[_0xbfaf('0x11')](function(){var _0x1186d4=_0x5027d1[_0xbfaf('0x12')]({'plain':!![]});var _0x261c88=_0xbfaf('0x13');return db['UserProfileResource'][_0xbfaf('0x14')]({'where':{'type':_0x261c88,'resourceId':_0x1186d4['id']}})[_0xbfaf('0x11')](function(){return _0x5027d1;});})[_0xbfaf('0x11')](function(){var _0xf26518=new Redis(config['redis']);_0xf26518[_0xbfaf('0x15')]('agi',JSON['stringify']({'id':_0x5027d1['id'],'deleted':!![]}));})[_0xbfaf('0x11')](function(){_0x51efe9[_0xbfaf('0xf')](0xcc)[_0xbfaf('0x16')]();});}};}function handleEntityNotFound(_0x5dbf12){return function(_0x241315){if(!_0x241315){_0x5dbf12[_0xbfaf('0x17')](0x194);}return _0x241315;};}function handleError(_0xbcd8c3,_0x1165c4){_0x1165c4=_0x1165c4||0x1f4;return function(_0x3962ce){logger['error'](_0x3962ce[_0xbfaf('0x18')]);if(_0x3962ce['name']){delete _0x3962ce['name'];}_0xbcd8c3[_0xbfaf('0xf')](_0x1165c4)['send'](_0x3962ce);};}exports['index']=function(_0x169956,_0x2913d5){var _0x1f77af={},_0x90cd70={},_0x5b5645={'count':0x0,'rows':[]};var _0x2dde35=_[_0xbfaf('0x19')](db['SquareProject'][_0xbfaf('0x1a')],function(_0x59e3ee){return{'name':_0x59e3ee[_0xbfaf('0x1b')],'type':_0x59e3ee[_0xbfaf('0x1c')][_0xbfaf('0x1d')]};});_0x90cd70[_0xbfaf('0x1e')]=_['map'](_0x2dde35,_0xbfaf('0x1f'));_0x90cd70[_0xbfaf('0x20')]=_[_0xbfaf('0x21')](_0x169956[_0xbfaf('0x20')]);_0x90cd70[_0xbfaf('0x22')]=_[_0xbfaf('0x23')](_0x90cd70[_0xbfaf('0x1e')],_0x90cd70['query']);_0x1f77af[_0xbfaf('0x24')]=_['intersection'](_0x90cd70[_0xbfaf('0x1e')],qs[_0xbfaf('0x25')](_0x169956[_0xbfaf('0x20')]['fields']));_0x1f77af[_0xbfaf('0x24')]=_0x1f77af['attributes'][_0xbfaf('0x26')]?_0x1f77af['attributes']:_0x90cd70[_0xbfaf('0x1e')];if(!_0x169956[_0xbfaf('0x20')]['hasOwnProperty']('nolimit')){_0x1f77af[_0xbfaf('0xd')]=qs[_0xbfaf('0xd')](_0x169956[_0xbfaf('0x20')][_0xbfaf('0xd')]);_0x1f77af['offset']=qs[_0xbfaf('0xc')](_0x169956[_0xbfaf('0x20')][_0xbfaf('0xc')]);}_0x1f77af[_0xbfaf('0x27')]=qs[_0xbfaf('0x28')](_0x169956[_0xbfaf('0x20')][_0xbfaf('0x28')]);_0x1f77af[_0xbfaf('0x29')]=qs[_0xbfaf('0x22')](_[_0xbfaf('0x2a')](_0x169956[_0xbfaf('0x20')],_0x90cd70[_0xbfaf('0x22')]),_0x2dde35);if(_0x169956[_0xbfaf('0x20')][_0xbfaf('0x2b')]){_0x1f77af[_0xbfaf('0x29')]=_[_0xbfaf('0x2c')](_0x1f77af[_0xbfaf('0x29')],{'$or':_[_0xbfaf('0x19')](_0x2dde35,function(_0x5ccfb1){if(_0x5ccfb1[_0xbfaf('0x1c')]!==_0xbfaf('0x2d')){var _0x19d84f={};_0x19d84f[_0x5ccfb1[_0xbfaf('0x1f')]]={'$like':'%'+_0x169956[_0xbfaf('0x20')][_0xbfaf('0x2b')]+'%'};return _0x19d84f;}})});}_0x1f77af=_[_0xbfaf('0x2c')]({},_0x1f77af,_0x169956[_0xbfaf('0x2e')]);var _0x1b0952={'where':_0x1f77af['where']};return db[_0xbfaf('0x2f')][_0xbfaf('0xe')](_0x1b0952)['then'](function(_0x150c54){_0x5b5645['count']=_0x150c54;if(_0x169956['query'][_0xbfaf('0x30')]){_0x1f77af['include']=[{'all':!![]}];}return db[_0xbfaf('0x2f')]['findAll'](_0x1f77af);})[_0xbfaf('0x11')](function(_0x1adeb7){_0x5b5645[_0xbfaf('0x31')]=_0x1adeb7;return _0x5b5645;})[_0xbfaf('0x11')](respondWithFilteredResult(_0x2913d5,_0x1f77af))['catch'](handleError(_0x2913d5,null));};exports[_0xbfaf('0x32')]=function(_0x5e0f60,_0x56b34f){var _0x1b98f2={'raw':![],'where':{'id':_0x5e0f60['params']['id']}},_0x5b7630={};_0x5b7630[_0xbfaf('0x1e')]=_[_0xbfaf('0x21')](db[_0xbfaf('0x2f')][_0xbfaf('0x1a')]);_0x5b7630[_0xbfaf('0x20')]=_['keys'](_0x5e0f60[_0xbfaf('0x20')]);_0x5b7630[_0xbfaf('0x22')]=_[_0xbfaf('0x23')](_0x5b7630[_0xbfaf('0x1e')],_0x5b7630['query']);_0x1b98f2[_0xbfaf('0x24')]=_[_0xbfaf('0x23')](_0x5b7630[_0xbfaf('0x1e')],qs[_0xbfaf('0x25')](_0x5e0f60[_0xbfaf('0x20')][_0xbfaf('0x25')]));_0x1b98f2['attributes']=_0x1b98f2[_0xbfaf('0x24')]['length']?_0x1b98f2[_0xbfaf('0x24')]:_0x5b7630[_0xbfaf('0x1e')];if(_0x5e0f60[_0xbfaf('0x20')]['includeAll']){_0x1b98f2['include']=[{'all':!![]}];}_0x1b98f2=_['merge']({},_0x1b98f2,_0x5e0f60['options']);return db[_0xbfaf('0x2f')][_0xbfaf('0x33')](_0x1b98f2)[_0xbfaf('0x11')](handleEntityNotFound(_0x56b34f,null))[_0xbfaf('0x11')](respondWithResult(_0x56b34f,null))[_0xbfaf('0x34')](handleError(_0x56b34f,null));};exports[_0xbfaf('0x35')]=function(_0x4212bf,_0x35f984){return db[_0xbfaf('0x2f')]['create'](_0x4212bf[_0xbfaf('0x36')],{})['then'](function(_0x4c7fa0){var _0x1d7871=_0x4212bf[_0xbfaf('0x37')][_0xbfaf('0x12')]({'plain':!![]});if(!_0x1d7871)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1d7871['role']===_0xbfaf('0x37')){var _0x5a8414=_0x4c7fa0[_0xbfaf('0x12')]({'plain':!![]});var _0x4abdb1=_0xbfaf('0x13');return db[_0xbfaf('0x38')][_0xbfaf('0x33')]({'where':{'name':_0x4abdb1,'userProfileId':_0x1d7871[_0xbfaf('0x39')]},'raw':!![]})[_0xbfaf('0x11')](function(_0x48557c){if(_0x48557c&&_0x48557c['autoAssociation']===0x0){return db[_0xbfaf('0x3a')]['create']({'name':_0x5a8414[_0xbfaf('0x1f')],'resourceId':_0x5a8414['id'],'type':_0x48557c['name'],'sectionId':_0x48557c['id']},{})['then'](function(){return _0x4c7fa0;});}else{return _0x4c7fa0;}})[_0xbfaf('0x34')](function(_0x490629){logger[_0xbfaf('0x3b')](_0xbfaf('0x3c'),_0x490629);throw _0x490629;});}return _0x4c7fa0;})['then'](respondWithResult(_0x35f984,0xc9))[_0xbfaf('0x34')](handleError(_0x35f984,null));};exports['update']=function(_0x4f4b0a,_0x366213){if(_0x4f4b0a[_0xbfaf('0x36')]['id']){delete _0x4f4b0a[_0xbfaf('0x36')]['id'];}return db[_0xbfaf('0x2f')][_0xbfaf('0x33')]({'where':{'id':_0x4f4b0a['params']['id']}})[_0xbfaf('0x11')](handleEntityNotFound(_0x366213,null))[_0xbfaf('0x11')](saveUpdates(_0x4f4b0a['body'],null))[_0xbfaf('0x11')](function(_0x53d6cd){if(!_0x53d6cd)return;var _0x17693b=_0x53d6cd[_0xbfaf('0x12')]({'plain':!![]});return _0x17693b;})['then'](function(_0x168009){var _0x2dcdd3=new Redis(config['redis']);_0x2dcdd3[_0xbfaf('0x15')]('agi',JSON[_0xbfaf('0x3d')](_[_0xbfaf('0x2a')](_0x168009,['id',_0xbfaf('0x1f'),_0xbfaf('0x3e')])));return _0x168009;})[_0xbfaf('0x11')](respondWithResult(_0x366213,null))[_0xbfaf('0x34')](handleError(_0x366213,null));};exports[_0xbfaf('0x14')]=function(_0xc83910,_0x53db7a){return db['SquareProject'][_0xbfaf('0x33')]({'where':{'id':_0xc83910[_0xbfaf('0x3f')]['id']}})[_0xbfaf('0x11')](handleEntityNotFound(_0x53db7a,null))[_0xbfaf('0x11')](removeEntity(_0x53db7a,null))['catch'](handleError(_0x53db7a,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index b962142..f77bc3f 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 _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 +var _0x6b89=['exports','events','../../mysqldb','SquareProject','setMaxListeners','update','remove','emit','hook'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x6b89,0x160));var _0x96b8=function(_0x4e2576,_0x5a7eb6){_0x4e2576=_0x4e2576-0x0;var _0x3eaf29=_0x6b89[_0x4e2576];return _0x3eaf29;};'use strict';var EventEmitter=require(_0x96b8('0x0'));var SquareProject=require(_0x96b8('0x1'))['db'][_0x96b8('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x96b8('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x96b8('0x4'),'afterDestroy':_0x96b8('0x5')};function emitEvent(_0x6ae78f){return function(_0x45ac2d,_0x409718,_0x5b13f9){SquareProjectEvents[_0x96b8('0x6')](_0x6ae78f+':'+_0x45ac2d['id'],_0x45ac2d);SquareProjectEvents[_0x96b8('0x6')](_0x6ae78f,_0x45ac2d);_0x5b13f9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x96b8('0x7')](e,emitEvent(event));}}module[_0x96b8('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 6cce95a..d05a852 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 _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 +var _0xcbee=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','define','SquareProject','square_projects','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash','../../config/logger'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xcbee,0x1ca));var _0xecbe=function(_0x123e06,_0x33951b){_0x123e06=_0x123e06-0x0;var _0x134834=_0xcbee[_0x123e06];return _0x134834;};'use strict';var _=require(_0xecbe('0x0'));var util=require('util');var logger=require(_0xecbe('0x1'))(_0xecbe('0x2'));var moment=require(_0xecbe('0x3'));var BPromise=require(_0xecbe('0x4'));var rp=require(_0xecbe('0x5'));var fs=require('fs');var path=require(_0xecbe('0x6'));var rimraf=require(_0xecbe('0x7'));var config=require(_0xecbe('0x8'));var attributes=require(_0xecbe('0x9'));module['exports']=function(_0x13090a,_0x5986c2){return _0x13090a[_0xecbe('0xa')](_0xecbe('0xb'),attributes,{'tableName':_0xecbe('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1187a4,_0x2c830d,_0x548a34){if(_0x1187a4[_0xecbe('0xd')](_0xecbe('0xe'))){_0x1187a4[_0xecbe('0xf')]=moment()[_0xecbe('0x10')](_0xecbe('0x11'));}if(_0x1187a4['changed'](_0xecbe('0x12'))){_0x1187a4[_0xecbe('0x13')]=moment()[_0xecbe('0x10')](_0xecbe('0x11'));}_0x548a34(null,_0x1187a4);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index c522813..843575b 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 _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 +var _0x88e1=['rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','GetSquareProjects','SquareProject','options','raw','where','attributes','limit','include','map','model','then','info','debug','stringify','catch','error','message','ShowSquareProject','ioredis','../../mysqldb','../../config/logger'];(function(_0x46320b,_0x3fa26c){var _0x46d61a=function(_0x20c003){while(--_0x20c003){_0x46320b['push'](_0x46320b['shift']());}};_0x46d61a(++_0x3fa26c);}(_0x88e1,0x159));var _0x188e=function(_0x2fba0c,_0x2cf2c0){_0x2fba0c=_0x2fba0c-0x0;var _0x263a96=_0x88e1[_0x2fba0c];return _0x263a96;};'use strict';var _=require('lodash');var Redis=require(_0x188e('0x0'));var db=require(_0x188e('0x1'))['db'];var logger=require(_0x188e('0x2'))(_0x188e('0x3'));var config=require(_0x188e('0x4'));config[_0x188e('0x5')]=_[_0x188e('0x6')](config[_0x188e('0x5')],{'host':_0x188e('0x7'),'port':0x18eb});var socket=require(_0x188e('0x8'))(new Redis(config[_0x188e('0x5')]));require(_0x188e('0x9'))[_0x188e('0xa')](socket);exports[_0x188e('0xb')]=function(_0x14c4f6){var _0x2e7dda=this;return new Promise(function(_0x2b3cde,_0x921ed0){return db[_0x188e('0xc')]['findAll']({'raw':_0x14c4f6[_0x188e('0xd')]?_0x14c4f6[_0x188e('0xd')][_0x188e('0xe')]===undefined?!![]:![]:!![],'where':_0x14c4f6[_0x188e('0xd')]?_0x14c4f6[_0x188e('0xd')][_0x188e('0xf')]||null:null,'attributes':_0x14c4f6[_0x188e('0xd')]?_0x14c4f6[_0x188e('0xd')][_0x188e('0x10')]||null:null,'limit':_0x14c4f6[_0x188e('0xd')]?_0x14c4f6[_0x188e('0xd')][_0x188e('0x11')]||null:null,'include':_0x14c4f6[_0x188e('0xd')]?_0x14c4f6['options'][_0x188e('0x12')]?_[_0x188e('0x13')](_0x14c4f6[_0x188e('0xd')]['include'],function(_0x48a622){return{'model':db[_0x48a622['model']],'as':_0x48a622['as'],'attributes':_0x48a622[_0x188e('0x10')],'include':_0x48a622[_0x188e('0x12')]?_['map'](_0x48a622['include'],function(_0x2edfb6){return{'model':db[_0x2edfb6[_0x188e('0x14')]],'as':_0x2edfb6['as'],'attributes':_0x2edfb6[_0x188e('0x10')],'include':_0x2edfb6[_0x188e('0x12')]?_[_0x188e('0x13')](_0x2edfb6['include'],function(_0x268336){return{'model':db[_0x268336[_0x188e('0x14')]],'as':_0x268336['as'],'attributes':_0x268336[_0x188e('0x10')]};}):[]};}):[]};}):[]:[]})[_0x188e('0x15')](function(_0x2bcec8){logger[_0x188e('0x16')](_0x188e('0xb'),_0x14c4f6);logger[_0x188e('0x17')](_0x188e('0xb'),_0x14c4f6,JSON[_0x188e('0x18')](_0x2bcec8));_0x2b3cde(_0x2bcec8);})[_0x188e('0x19')](function(_0x59529e){logger[_0x188e('0x1a')]('GetSquareProjects',_0x59529e[_0x188e('0x1b')],_0x14c4f6);_0x921ed0(_0x2e7dda['error'](0x1f4,_0x59529e[_0x188e('0x1b')]));});});};exports[_0x188e('0x1c')]=function(_0xd5ac42){var _0x468cc9=this;return new Promise(function(_0x5be496,_0x1b3539){return db['SquareProject']['find']({'raw':_0xd5ac42[_0x188e('0xd')]?_0xd5ac42[_0x188e('0xd')]['raw']===undefined?!![]:![]:!![],'where':_0xd5ac42[_0x188e('0xd')]?_0xd5ac42[_0x188e('0xd')][_0x188e('0xf')]||null:null,'attributes':_0xd5ac42[_0x188e('0xd')]?_0xd5ac42[_0x188e('0xd')][_0x188e('0x10')]||null:null,'include':_0xd5ac42[_0x188e('0xd')]?_0xd5ac42[_0x188e('0xd')][_0x188e('0x12')]?_[_0x188e('0x13')](_0xd5ac42[_0x188e('0xd')]['include'],function(_0x3839e4){return{'model':db[_0x3839e4[_0x188e('0x14')]],'as':_0x3839e4['as'],'attributes':_0x3839e4['attributes'],'include':_0x3839e4['include']?_[_0x188e('0x13')](_0x3839e4['include'],function(_0x3d510d){return{'model':db[_0x3d510d[_0x188e('0x14')]],'as':_0x3d510d['as'],'attributes':_0x3d510d[_0x188e('0x10')],'include':_0x3d510d[_0x188e('0x12')]?_[_0x188e('0x13')](_0x3d510d[_0x188e('0x12')],function(_0x45c0f8){return{'model':db[_0x45c0f8[_0x188e('0x14')]],'as':_0x45c0f8['as'],'attributes':_0x45c0f8[_0x188e('0x10')]};}):[]};}):[]};}):[]:[]})[_0x188e('0x15')](function(_0x386b3a){logger[_0x188e('0x16')](_0x188e('0x1c'),_0xd5ac42);logger[_0x188e('0x17')](_0x188e('0x1c'),_0xd5ac42,JSON[_0x188e('0x18')](_0x386b3a));_0x5be496(_0x386b3a);})[_0x188e('0x19')](function(_0x11a41e){logger['error'](_0x188e('0x1c'),_0x11a41e[_0x188e('0x1b')],_0xd5ac42);_0x1b3539(_0x468cc9[_0x188e('0x1a')](0x1f4,_0x11a41e[_0x188e('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 170c99d..490e1c0 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 _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 +var _0x8480=['length','./squareProject.events','save','update','emit'];(function(_0x5ee013,_0x1d3965){var _0x3a7ff6=function(_0x300791){while(--_0x300791){_0x5ee013['push'](_0x5ee013['shift']());}};_0x3a7ff6(++_0x1d3965);}(_0x8480,0x1e6));var _0x0848=function(_0xf912a,_0x533423){_0xf912a=_0xf912a-0x0;var _0x348f59=_0x8480[_0xf912a];return _0x348f59;};'use strict';var SquareProjectEvents=require(_0x0848('0x0'));var events=[_0x0848('0x1'),'remove',_0x0848('0x2')];function createListener(_0x5d58b,_0xc28aa4){return function(_0x119c0e){_0xc28aa4[_0x0848('0x3')](_0x5d58b,_0x119c0e);};}function removeListener(_0x35de47,_0x5d28aa){return function(){SquareProjectEvents['removeListener'](_0x35de47,_0x5d28aa);};}exports['register']=function(_0x5e0de3){for(var _0x1056c0=0x0,_0x3945d9=events[_0x0848('0x4')];_0x1056c0<_0x3945d9;_0x1056c0++){var _0x40fc24=events[_0x1056c0];var _0x2f3daf=createListener('squareProject:'+_0x40fc24,_0x5e0de3);SquareProjectEvents['on'](_0x40fc24,_0x2f3daf);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 1750eea..ec71bfe 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 _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 +var _0x7fbe=['/:id','show','/:id/download','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','index'];(function(_0x23d3b4,_0x185ed6){var _0x48273c=function(_0x554699){while(--_0x554699){_0x23d3b4['push'](_0x23d3b4['shift']());}};_0x48273c(++_0x185ed6);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x37998b,_0x27ed44){_0x37998b=_0x37998b-0x0;var _0x2bc1ce=_0x7fbe[_0x37998b];return _0x2bc1ce;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7fb('0x0'));var timeout=require(_0xe7fb('0x1'));var express=require(_0xe7fb('0x2'));var router=express[_0xe7fb('0x3')]();var fs_extra=require(_0xe7fb('0x4'));var auth=require(_0xe7fb('0x5'));var interaction=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var controller=require(_0xe7fb('0x8'));router[_0xe7fb('0x9')]('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xb')]);router[_0xe7fb('0x9')](_0xe7fb('0xc'),auth['isAuthenticated'](),controller[_0xe7fb('0xd')]);router[_0xe7fb('0x9')](_0xe7fb('0xe'),auth[_0xe7fb('0xa')](),controller['download']);router['post']('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xf')]);router[_0xe7fb('0x10')](_0xe7fb('0xc'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x11')]);router[_0xe7fb('0x12')](_0xe7fb('0xc'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x13')]);module[_0xe7fb('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 3a6f8c0..81ea8ac 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 _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 +var _0xee14=['VIRTUAL','getDataValue','savePath','substring','STRING'];(function(_0x5e6a2b,_0x1e1fce){var _0x4e5e3b=function(_0x1e7998){while(--_0x1e7998){_0x5e6a2b['push'](_0x5e6a2b['shift']());}};_0x4e5e3b(++_0x1e1fce);}(_0xee14,0x13a));var _0x4ee1=function(_0xa36c80,_0x1d80ef){_0xa36c80=_0xa36c80-0x0;var _0xebc695=_0xee14[_0xa36c80];return _0xebc695;};'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 58772ed..9c4d6d7 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 _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 +var _0xaeb3=['update','find','params','download','../../components/encryptor','uniqueid','savePath','format','existsSync','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','filename','extname','Not\x20found','isNil','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','keys','create','body'];(function(_0x3361ac,_0xb7c55d){var _0x4857d1=function(_0x25b132){while(--_0x25b132){_0x3361ac['push'](_0x3361ac['shift']());}};_0x4857d1(++_0xb7c55d);}(_0xaeb3,0x12e));var _0x3aeb=function(_0x14064a,_0xdc7bf0){_0x14064a=_0x14064a-0x0;var _0x4f993e=_0xaeb3[_0x14064a];return _0x4f993e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3aeb('0x0'));var zipdir=require(_0x3aeb('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3aeb('0x2'));var moment=require(_0x3aeb('0x3'));var BPromise=require(_0x3aeb('0x4'));var Mustache=require(_0x3aeb('0x5'));var util=require(_0x3aeb('0x6'));var path=require('path');var sox=require(_0x3aeb('0x7'));var csv=require(_0x3aeb('0x8'));var ejs=require(_0x3aeb('0x9'));var fs=require('fs');var fs_extra=require(_0x3aeb('0xa'));var _=require(_0x3aeb('0xb'));var squel=require(_0x3aeb('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3aeb('0xd'));var toCsv=require(_0x3aeb('0x8'));var querystring=require(_0x3aeb('0xe'));var Papa=require(_0x3aeb('0xf'));var Redis=require(_0x3aeb('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3aeb('0x11'));var hardwareService=require(_0x3aeb('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x3aeb('0x13'));var config=require(_0x3aeb('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x3aeb('0x15'))['db'];function respondWithStatusCode(_0x2ee4bd,_0x46d055){_0x46d055=_0x46d055||0xcc;return function(_0x14a706){if(_0x14a706){return _0x2ee4bd[_0x3aeb('0x16')](_0x46d055);}return _0x2ee4bd[_0x3aeb('0x17')](_0x46d055)[_0x3aeb('0x18')]();};}function respondWithResult(_0x26af10,_0x25ab4d){_0x25ab4d=_0x25ab4d||0xc8;return function(_0x59a3ee){if(_0x59a3ee){return _0x26af10[_0x3aeb('0x17')](_0x25ab4d)[_0x3aeb('0x19')](_0x59a3ee);}};}function respondWithFilteredResult(_0x512ce9,_0x2095a0){return function(_0x2df411){if(_0x2df411){var _0x49f809=typeof _0x2095a0[_0x3aeb('0x1a')]==='undefined'&&typeof _0x2095a0[_0x3aeb('0x1b')]==='undefined';var _0x8cfd60=_0x2df411['count'];var _0x1a6ebe=_0x49f809?0x0:_0x2095a0[_0x3aeb('0x1a')];var _0x3d2797=_0x49f809?_0x2df411[_0x3aeb('0x1c')]:_0x2095a0['offset']+_0x2095a0[_0x3aeb('0x1b')];var _0x2c5f0b;if(_0x3d2797>=_0x8cfd60){_0x3d2797=_0x8cfd60;_0x2c5f0b=0xc8;}else{_0x2c5f0b=0xce;}_0x512ce9[_0x3aeb('0x17')](_0x2c5f0b);return _0x512ce9[_0x3aeb('0x1d')](_0x3aeb('0x1e'),_0x1a6ebe+'-'+_0x3d2797+'/'+_0x8cfd60)[_0x3aeb('0x19')](_0x2df411);}return null;};}function patchUpdates(_0xaf92ec){return function(_0x5e1b82){try{jsonpatch[_0x3aeb('0x1f')](_0x5e1b82,_0xaf92ec,!![]);}catch(_0x2e6e7e){return BPromise[_0x3aeb('0x20')](_0x2e6e7e);}return _0x5e1b82[_0x3aeb('0x21')]();};}function saveUpdates(_0x41b9da,_0x5ec9c3){return function(_0xa72a60){if(_0xa72a60){return _0xa72a60['update'](_0x41b9da)[_0x3aeb('0x22')](function(_0x1c234c){return _0x1c234c;});}return null;};}function removeEntity(_0x18e3cc,_0x4f73bb){return function(_0x129408){if(_0x129408){return _0x129408[_0x3aeb('0x23')]()[_0x3aeb('0x22')](function(){_0x18e3cc[_0x3aeb('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3db158,_0x519de1){return function(_0x4ae239){if(!_0x4ae239){_0x3db158['sendStatus'](0x194);}return _0x4ae239;};}function handleError(_0x1db833,_0x26711b){_0x26711b=_0x26711b||0x1f4;return function(_0x1440ac){logger['error'](_0x1440ac[_0x3aeb('0x24')]);if(_0x1440ac[_0x3aeb('0x25')]){delete _0x1440ac[_0x3aeb('0x25')];}_0x1db833[_0x3aeb('0x17')](_0x26711b)[_0x3aeb('0x26')](_0x1440ac);};}exports[_0x3aeb('0x27')]=function(_0x3a17c4,_0xd5d5d0){var _0x291207={},_0x450782={},_0x51535f={'count':0x0,'rows':[]};var _0x4807a3=_[_0x3aeb('0x28')](db[_0x3aeb('0x29')][_0x3aeb('0x2a')],function(_0x4475f0){return{'name':_0x4475f0[_0x3aeb('0x2b')],'type':_0x4475f0[_0x3aeb('0x2c')][_0x3aeb('0x2d')]};});_0x450782[_0x3aeb('0x2e')]=_[_0x3aeb('0x28')](_0x4807a3,_0x3aeb('0x25'));_0x450782['query']=_['keys'](_0x3a17c4[_0x3aeb('0x2f')]);_0x450782[_0x3aeb('0x30')]=_[_0x3aeb('0x31')](_0x450782[_0x3aeb('0x2e')],_0x450782[_0x3aeb('0x2f')]);_0x291207[_0x3aeb('0x32')]=_[_0x3aeb('0x31')](_0x450782[_0x3aeb('0x2e')],qs[_0x3aeb('0x33')](_0x3a17c4[_0x3aeb('0x2f')][_0x3aeb('0x33')]));_0x291207['attributes']=_0x291207[_0x3aeb('0x32')][_0x3aeb('0x34')]?_0x291207[_0x3aeb('0x32')]:_0x450782[_0x3aeb('0x2e')];if(!_0x3a17c4[_0x3aeb('0x2f')][_0x3aeb('0x35')](_0x3aeb('0x36'))){_0x291207[_0x3aeb('0x1b')]=qs[_0x3aeb('0x1b')](_0x3a17c4[_0x3aeb('0x2f')][_0x3aeb('0x1b')]);_0x291207[_0x3aeb('0x1a')]=qs[_0x3aeb('0x1a')](_0x3a17c4[_0x3aeb('0x2f')]['offset']);}_0x291207[_0x3aeb('0x37')]=qs['sort'](_0x3a17c4[_0x3aeb('0x2f')][_0x3aeb('0x38')]);_0x291207[_0x3aeb('0x39')]=qs[_0x3aeb('0x30')](_['pick'](_0x3a17c4[_0x3aeb('0x2f')],_0x450782[_0x3aeb('0x30')]),_0x4807a3);if(_0x3a17c4[_0x3aeb('0x2f')][_0x3aeb('0x3a')]){_0x291207[_0x3aeb('0x39')]=_['merge'](_0x291207[_0x3aeb('0x39')],{'$or':_[_0x3aeb('0x28')](_0x4807a3,function(_0x89d4a8){if(_0x89d4a8['type']!==_0x3aeb('0x3b')){var _0x520c04={};_0x520c04[_0x89d4a8[_0x3aeb('0x25')]]={'$like':'%'+_0x3a17c4[_0x3aeb('0x2f')][_0x3aeb('0x3a')]+'%'};return _0x520c04;}})});}_0x291207=_[_0x3aeb('0x3c')]({},_0x291207,_0x3a17c4['options']);var _0x2a54d2={'where':_0x291207[_0x3aeb('0x39')]};return db[_0x3aeb('0x29')][_0x3aeb('0x1c')](_0x2a54d2)['then'](function(_0x47be67){_0x51535f[_0x3aeb('0x1c')]=_0x47be67;if(_0x3a17c4['query'][_0x3aeb('0x3d')]){_0x291207[_0x3aeb('0x3e')]=[{'all':!![]}];}return db[_0x3aeb('0x29')][_0x3aeb('0x3f')](_0x291207);})[_0x3aeb('0x22')](function(_0x2321bf){_0x51535f[_0x3aeb('0x40')]=_0x2321bf;return _0x51535f;})['then'](respondWithFilteredResult(_0xd5d5d0,_0x291207))[_0x3aeb('0x41')](handleError(_0xd5d5d0,null));};exports[_0x3aeb('0x42')]=function(_0x20a12d,_0x2e7374){var _0x1ae9db={'raw':!![],'where':{'id':_0x20a12d['params']['id']}},_0x14f93a={};_0x14f93a[_0x3aeb('0x2e')]=_[_0x3aeb('0x43')](db[_0x3aeb('0x29')][_0x3aeb('0x2a')]);_0x14f93a[_0x3aeb('0x2f')]=_[_0x3aeb('0x43')](_0x20a12d[_0x3aeb('0x2f')]);_0x14f93a['filters']=_[_0x3aeb('0x31')](_0x14f93a[_0x3aeb('0x2e')],_0x14f93a[_0x3aeb('0x2f')]);_0x1ae9db[_0x3aeb('0x32')]=_[_0x3aeb('0x31')](_0x14f93a[_0x3aeb('0x2e')],qs[_0x3aeb('0x33')](_0x20a12d['query'][_0x3aeb('0x33')]));_0x1ae9db['attributes']=_0x1ae9db[_0x3aeb('0x32')][_0x3aeb('0x34')]?_0x1ae9db[_0x3aeb('0x32')]:_0x14f93a[_0x3aeb('0x2e')];if(_0x20a12d['query'][_0x3aeb('0x3d')]){_0x1ae9db[_0x3aeb('0x3e')]=[{'all':!![]}];}_0x1ae9db=_[_0x3aeb('0x3c')]({},_0x1ae9db,_0x20a12d['options']);return db['SquareRecording']['find'](_0x1ae9db)[_0x3aeb('0x22')](handleEntityNotFound(_0x2e7374,null))[_0x3aeb('0x22')](respondWithResult(_0x2e7374,null))['catch'](handleError(_0x2e7374,null));};exports['create']=function(_0xb37199,_0x28722d){return db[_0x3aeb('0x29')][_0x3aeb('0x44')](_0xb37199[_0x3aeb('0x45')],{})[_0x3aeb('0x22')](respondWithResult(_0x28722d,0xc9))[_0x3aeb('0x41')](handleError(_0x28722d,null));};exports[_0x3aeb('0x46')]=function(_0x11efbc,_0x31627f){if(_0x11efbc[_0x3aeb('0x45')]['id']){delete _0x11efbc['body']['id'];}return db['SquareRecording'][_0x3aeb('0x47')]({'where':{'id':_0x11efbc[_0x3aeb('0x48')]['id']}})[_0x3aeb('0x22')](handleEntityNotFound(_0x31627f,null))[_0x3aeb('0x22')](saveUpdates(_0x11efbc[_0x3aeb('0x45')],null))['then'](respondWithResult(_0x31627f,null))['catch'](handleError(_0x31627f,null));};exports[_0x3aeb('0x49')]=function(_0x3a7e5c,_0x41880a,_0x498bbd){var _0x44b3a0=require(_0x3aeb('0x4a'));var _0x5765fe=![];var _0x2b0aff={};if(_0x3a7e5c['query'][_0x3aeb('0x2c')]&&_0x3a7e5c[_0x3aeb('0x2f')]['type']===_0x3aeb('0x4b')){_0x2b0aff['uniqueid']=_0x3a7e5c[_0x3aeb('0x48')]['id'];}else{_0x2b0aff['id']=_0x3a7e5c[_0x3aeb('0x48')]['id'];}return db['SquareRecording'][_0x3aeb('0x47')]({'where':_0x2b0aff,'attributes':['id',_0x3aeb('0x4c'),'filename'],'raw':!![]})[_0x3aeb('0x22')](handleEntityNotFound(_0x41880a,null))['then'](function(_0x13adfb){if(_0x13adfb){var _0x2bc0c9=_0x13adfb['savePath'];var _0x56d0ec=util[_0x3aeb('0x4d')]('%s.cypher',_0x2bc0c9);if(fs[_0x3aeb('0x4e')](_0x56d0ec)){_0x5765fe=!![];return _0x44b3a0['decryptFile'](_0x56d0ec,_0x2bc0c9,config[_0x3aeb('0x4f')][_0x3aeb('0x50')])[_0x3aeb('0x22')](function(){return _0x13adfb;});}return _0x13adfb;}})[_0x3aeb('0x22')](function(_0x197781){if(_0x197781){var _0x4aef49=_0x197781[_0x3aeb('0x4c')];if(!fs[_0x3aeb('0x4e')](_0x4aef49)){throw new db[(_0x3aeb('0x51'))][(_0x3aeb('0x52'))](_0x3aeb('0x53'));}if(_0x197781[_0x3aeb('0x54')]){return _0x41880a[_0x3aeb('0x49')](_0x4aef49,_0x197781[_0x3aeb('0x54')]+path[_0x3aeb('0x55')](_0x4aef49),function(){if(_0x5765fe){fs['unlink'](_0x4aef49);}});}else{return _0x41880a[_0x3aeb('0x49')](_0x4aef49,function(_0x3594f1){if(_0x5765fe){fs['unlink'](_0x4aef49);}});}}})[_0x3aeb('0x41')](function(_0x52298e){if(_0x52298e['message']===_0x3aeb('0x53')){_0x41880a[_0x3aeb('0x17')](0x194)[_0x3aeb('0x26')](_0x3aeb('0x56'));}else{return handleError(_0x41880a,null);}});};exports[_0x3aeb('0x23')]=function(_0x3e2eea,_0xc66d40){return db['SquareRecording'][_0x3aeb('0x47')]({'where':{'id':_0x3e2eea[_0x3aeb('0x48')]['id']}})[_0x3aeb('0x22')](function(_0x24fe38){if(_[_0x3aeb('0x57')](_0x24fe38)){throw new ReferenceError('Entity\x20not\x20found');}return _0x24fe38;})[_0x3aeb('0x22')](function(_0x5c81dd){var _0x563536=_0x5c81dd[_0x3aeb('0x4c')];logger[_0x3aeb('0x58')](_0x3aeb('0x59'),_0x563536);if(!_[_0x3aeb('0x57')](_0x5c81dd['savePath'])&&fs[_0x3aeb('0x4e')](_0x563536)){logger['info']('File:\x20\x22'+_0x563536+_0x3aeb('0x5a'));fs[_0x3aeb('0x5b')](_0x563536);}_0x563536=_0x563536+_0x3aeb('0x5c');if(!_[_0x3aeb('0x57')](_0x5c81dd[_0x3aeb('0x4c')])&&fs[_0x3aeb('0x4e')](_0x563536)){logger[_0x3aeb('0x58')]('File:\x20\x22'+_0x563536+_0x3aeb('0x5a'));fs[_0x3aeb('0x5b')](_0x563536);}return _0x5c81dd;})[_0x3aeb('0x22')](function(_0x2a808b){if(!_0x2a808b)throw new InternalError();return _0x2a808b[_0x3aeb('0x23')]();})[_0x3aeb('0x22')](function(){_0xc66d40[_0x3aeb('0x17')](0xcc)[_0x3aeb('0x18')]();})[_0x3aeb('0x41')](handleError(_0xc66d40,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 91dd146..da65570 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 _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 +var _0x0e4b=['./squareRecording.attributes','define','SquareRecording','square_recordings','lodash','util','../../config/logger','moment','../../config/environment'];(function(_0x1898e1,_0x36df6a){var _0x50d60e=function(_0x7ce68e){while(--_0x7ce68e){_0x1898e1['push'](_0x1898e1['shift']());}};_0x50d60e(++_0x36df6a);}(_0x0e4b,0xdc));var _0xb0e4=function(_0x5b2eba,_0x1c574d){_0x5b2eba=_0x5b2eba-0x0;var _0x5710df=_0x0e4b[_0x5b2eba];return _0x5710df;};'use strict';var _=require(_0xb0e4('0x0'));var util=require(_0xb0e4('0x1'));var logger=require(_0xb0e4('0x2'))('api');var moment=require(_0xb0e4('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb0e4('0x4'));var attributes=require(_0xb0e4('0x5'));module['exports']=function(_0x45bdf2,_0x3b56c3){return _0x45bdf2[_0xb0e4('0x6')](_0xb0e4('0x7'),attributes,{'tableName':_0xb0e4('0x8'),'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 6b25175..00056ae 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 _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 +var _0xc067=['body','options','raw','then','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateSquareRecording','SquareRecording'];(function(_0xfdd835,_0x389e04){var _0x4611b5=function(_0x120218){while(--_0x120218){_0xfdd835['push'](_0xfdd835['shift']());}};_0x4611b5(++_0x389e04);}(_0xc067,0x131));var _0x7c06=function(_0xdf3db6,_0x2a1952){_0xdf3db6=_0xdf3db6-0x0;var _0x4b7a65=_0xc067[_0xdf3db6];return _0x4b7a65;};'use strict';var _=require(_0x7c06('0x0'));var util=require(_0x7c06('0x1'));var moment=require(_0x7c06('0x2'));var BPromise=require('bluebird');var rs=require(_0x7c06('0x3'));var fs=require('fs');var Redis=require(_0x7c06('0x4'));var db=require(_0x7c06('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7c06('0x6'))(_0x7c06('0x7'));var config=require(_0x7c06('0x8'));var jayson=require(_0x7c06('0x9'));var client=jayson[_0x7c06('0xa')][_0x7c06('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x37a8e9,_0x595402,_0xf43523){return new BPromise(function(_0x3080c0,_0x4bad58){return client[_0x7c06('0xc')](_0x37a8e9,_0xf43523)['then'](function(_0x20d4aa){logger[_0x7c06('0xd')](_0x7c06('0xe'),_0x595402,_0x7c06('0xf'));logger[_0x7c06('0x10')](_0x7c06('0x11'),_0x595402,'request\x20sent',JSON[_0x7c06('0x12')](_0x20d4aa));if(_0x20d4aa[_0x7c06('0x13')]){if(_0x20d4aa['error'][_0x7c06('0x14')]===0x1f4){logger[_0x7c06('0x13')](_0x7c06('0xe'),_0x595402,_0x20d4aa['error'][_0x7c06('0x15')]);return _0x4bad58(_0x20d4aa[_0x7c06('0x13')]['message']);}logger[_0x7c06('0x13')](_0x7c06('0xe'),_0x595402,_0x20d4aa[_0x7c06('0x13')][_0x7c06('0x15')]);return _0x3080c0(_0x20d4aa['error'][_0x7c06('0x15')]);}else{logger['info'](_0x7c06('0xe'),_0x595402,_0x7c06('0xf'));_0x3080c0(_0x20d4aa[_0x7c06('0x16')][_0x7c06('0x15')]);}})['catch'](function(_0x48b926){logger[_0x7c06('0x13')](_0x7c06('0xe'),_0x595402,_0x48b926);_0x4bad58(_0x48b926);});});}exports[_0x7c06('0x17')]=function(_0x146b6f){var _0x26eda1=this;return new Promise(function(_0x1609be,_0x1a67fd){return db[_0x7c06('0x18')]['create'](_0x146b6f[_0x7c06('0x19')],{'raw':_0x146b6f[_0x7c06('0x1a')]?_0x146b6f['options'][_0x7c06('0x1b')]===undefined?!![]:![]:!![]})[_0x7c06('0x1c')](function(_0x3255a2){logger['info'](_0x7c06('0x17'),_0x146b6f);logger['debug']('CreateSquareRecording',_0x146b6f,JSON[_0x7c06('0x12')](_0x3255a2));_0x1609be(_0x3255a2);})[_0x7c06('0x1d')](function(_0x1f7a5f){logger[_0x7c06('0x13')](_0x7c06('0x17'),_0x1f7a5f['message'],_0x146b6f);_0x1a67fd(_0x26eda1[_0x7c06('0x13')](0x1f4,_0x1f7a5f['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 715ee86..e2cd477 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_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 +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(_0x5237e8,_0x4fea7f){var _0x3cd4c7=function(_0x2d0a87){while(--_0x2d0a87){_0x5237e8['push'](_0x5237e8['shift']());}};_0x3cd4c7(++_0x4fea7f);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index ce6fb3c..e3b480d 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 _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 +var _0x23af=['DATE','BOOLEAN','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x23af,0xed));var _0xf23a=function(_0x17d905,_0x4f44be){_0x17d905=_0x17d905-0x0;var _0x3dcdf8=_0x23af[_0x17d905];return _0x3dcdf8;};'use strict';var Sequelize=require(_0xf23a('0x0'));module[_0xf23a('0x1')]={'network':{'type':Sequelize[_0xf23a('0x2')]},'network_script':{'type':Sequelize[_0xf23a('0x2')]},'request':{'type':Sequelize[_0xf23a('0x2')]},'channel':{'type':Sequelize[_0xf23a('0x2')]},'language':{'type':Sequelize[_0xf23a('0x2')]},'type':{'type':Sequelize[_0xf23a('0x2')]},'uniqueid':{'type':Sequelize[_0xf23a('0x2')]},'version':{'type':Sequelize[_0xf23a('0x2')]},'callerid':{'type':Sequelize[_0xf23a('0x2')]},'calleridname':{'type':Sequelize[_0xf23a('0x2')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0xf23a('0x2')]},'callington':{'type':Sequelize[_0xf23a('0x2')]},'callingtns':{'type':Sequelize[_0xf23a('0x2')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0xf23a('0x2')]},'context':{'type':Sequelize[_0xf23a('0x2')]},'extension':{'type':Sequelize[_0xf23a('0x2')]},'priority':{'type':Sequelize[_0xf23a('0x2')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xf23a('0x2')]},'threadid':{'type':Sequelize[_0xf23a('0x2')]},'project_name':{'type':Sequelize[_0xf23a('0x2')]},'joinAt':{'type':Sequelize[_0xf23a('0x3')]},'leaveAt':{'type':Sequelize[_0xf23a('0x3')]},'bot':{'type':Sequelize[_0xf23a('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 16853f3..915de6e 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 _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 +var _0xf4d8=['undefined','count','set','json','apply','reject','save','update','then','destroy','error','stack','name','map','SquareReport','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','keys','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset'];(function(_0x241b5b,_0x388051){var _0x28b94b=function(_0x26a80f){while(--_0x26a80f){_0x241b5b['push'](_0x241b5b['shift']());}};_0x28b94b(++_0x388051);}(_0xf4d8,0x1a7));var _0x8f4d=function(_0x15be09,_0x514327){_0x15be09=_0x15be09-0x0;var _0x5228a6=_0xf4d8[_0x15be09];return _0x5228a6;};'use strict';var emlformat=require(_0x8f4d('0x0'));var rimraf=require(_0x8f4d('0x1'));var zipdir=require(_0x8f4d('0x2'));var jsonpatch=require(_0x8f4d('0x3'));var rp=require(_0x8f4d('0x4'));var moment=require(_0x8f4d('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8f4d('0x6'));var path=require(_0x8f4d('0x7'));var sox=require('sox');var csv=require(_0x8f4d('0x8'));var ejs=require(_0x8f4d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8f4d('0xa'));var squel=require(_0x8f4d('0xb'));var crypto=require(_0x8f4d('0xc'));var jsforce=require(_0x8f4d('0xd'));var deskjs=require(_0x8f4d('0xe'));var toCsv=require(_0x8f4d('0x8'));var querystring=require(_0x8f4d('0xf'));var Papa=require(_0x8f4d('0x10'));var Redis=require(_0x8f4d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8f4d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8f4d('0x13'));var logger=require('../../config/logger')(_0x8f4d('0x14'));var utils=require('../../config/utils');var config=require(_0x8f4d('0x15'));var licenseUtil=require(_0x8f4d('0x16'));var db=require(_0x8f4d('0x17'))['db'];function respondWithStatusCode(_0xa4f321,_0x5e0eb3){_0x5e0eb3=_0x5e0eb3||0xcc;return function(_0x1f6083){if(_0x1f6083){return _0xa4f321[_0x8f4d('0x18')](_0x5e0eb3);}return _0xa4f321[_0x8f4d('0x19')](_0x5e0eb3)['end']();};}function respondWithResult(_0x177737,_0x3f8731){_0x3f8731=_0x3f8731||0xc8;return function(_0x1eb27b){if(_0x1eb27b){return _0x177737['status'](_0x3f8731)['json'](_0x1eb27b);}};}function respondWithFilteredResult(_0x3616ba,_0x3e0cd2){return function(_0x59fcbe){if(_0x59fcbe){var _0x43d578=typeof _0x3e0cd2[_0x8f4d('0x1a')]===_0x8f4d('0x1b')&&typeof _0x3e0cd2['limit']===_0x8f4d('0x1b');var _0x405ab0=_0x59fcbe[_0x8f4d('0x1c')];var _0x44e765=_0x43d578?0x0:_0x3e0cd2[_0x8f4d('0x1a')];var _0x222b25=_0x43d578?_0x59fcbe['count']:_0x3e0cd2[_0x8f4d('0x1a')]+_0x3e0cd2['limit'];var _0xb37568;if(_0x222b25>=_0x405ab0){_0x222b25=_0x405ab0;_0xb37568=0xc8;}else{_0xb37568=0xce;}_0x3616ba[_0x8f4d('0x19')](_0xb37568);return _0x3616ba[_0x8f4d('0x1d')]('Content-Range',_0x44e765+'-'+_0x222b25+'/'+_0x405ab0)[_0x8f4d('0x1e')](_0x59fcbe);}return null;};}function patchUpdates(_0x386336){return function(_0x59dede){try{jsonpatch[_0x8f4d('0x1f')](_0x59dede,_0x386336,!![]);}catch(_0x358bf0){return BPromise[_0x8f4d('0x20')](_0x358bf0);}return _0x59dede[_0x8f4d('0x21')]();};}function saveUpdates(_0xa0a415,_0x42c786){return function(_0x4f4c6d){if(_0x4f4c6d){return _0x4f4c6d[_0x8f4d('0x22')](_0xa0a415)[_0x8f4d('0x23')](function(_0x54b073){return _0x54b073;});}return null;};}function removeEntity(_0x248d56,_0x459264){return function(_0x2a8a14){if(_0x2a8a14){return _0x2a8a14[_0x8f4d('0x24')]()[_0x8f4d('0x23')](function(){_0x248d56[_0x8f4d('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ff0e7,_0x123596){return function(_0x18d1dc){if(!_0x18d1dc){_0x1ff0e7['sendStatus'](0x194);}return _0x18d1dc;};}function handleError(_0x3fa9c9,_0x414a14){_0x414a14=_0x414a14||0x1f4;return function(_0x2dcc98){logger[_0x8f4d('0x25')](_0x2dcc98[_0x8f4d('0x26')]);if(_0x2dcc98[_0x8f4d('0x27')]){delete _0x2dcc98[_0x8f4d('0x27')];}_0x3fa9c9[_0x8f4d('0x19')](_0x414a14)['send'](_0x2dcc98);};}exports['index']=function(_0x5e4fe2,_0x5506ca){var _0x46c6fd={},_0x5b77cc={},_0x4bc679={'count':0x0,'rows':[]};var _0x2beb3c=_[_0x8f4d('0x28')](db[_0x8f4d('0x29')][_0x8f4d('0x2a')],function(_0x5685bf){return{'name':_0x5685bf[_0x8f4d('0x2b')],'type':_0x5685bf[_0x8f4d('0x2c')][_0x8f4d('0x2d')]};});_0x5b77cc['model']=_['map'](_0x2beb3c,'name');_0x5b77cc[_0x8f4d('0x2e')]=_['keys'](_0x5e4fe2[_0x8f4d('0x2e')]);_0x5b77cc[_0x8f4d('0x2f')]=_[_0x8f4d('0x30')](_0x5b77cc[_0x8f4d('0x31')],_0x5b77cc[_0x8f4d('0x2e')]);_0x46c6fd['attributes']=_[_0x8f4d('0x30')](_0x5b77cc[_0x8f4d('0x31')],qs[_0x8f4d('0x32')](_0x5e4fe2[_0x8f4d('0x2e')][_0x8f4d('0x32')]));_0x46c6fd[_0x8f4d('0x33')]=_0x46c6fd[_0x8f4d('0x33')][_0x8f4d('0x34')]?_0x46c6fd[_0x8f4d('0x33')]:_0x5b77cc['model'];if(!_0x5e4fe2[_0x8f4d('0x2e')][_0x8f4d('0x35')](_0x8f4d('0x36'))){_0x46c6fd['limit']=qs[_0x8f4d('0x37')](_0x5e4fe2[_0x8f4d('0x2e')][_0x8f4d('0x37')]);_0x46c6fd[_0x8f4d('0x1a')]=qs[_0x8f4d('0x1a')](_0x5e4fe2['query'][_0x8f4d('0x1a')]);}_0x46c6fd[_0x8f4d('0x38')]=qs[_0x8f4d('0x39')](_0x5e4fe2[_0x8f4d('0x2e')][_0x8f4d('0x39')]);_0x46c6fd[_0x8f4d('0x3a')]=qs[_0x8f4d('0x2f')](_[_0x8f4d('0x3b')](_0x5e4fe2[_0x8f4d('0x2e')],_0x5b77cc[_0x8f4d('0x2f')]),_0x2beb3c);if(_0x5e4fe2[_0x8f4d('0x2e')][_0x8f4d('0x3c')]){_0x46c6fd[_0x8f4d('0x3a')]=_[_0x8f4d('0x3d')](_0x46c6fd[_0x8f4d('0x3a')],{'$or':_['map'](_0x2beb3c,function(_0x4e4f6c){if(_0x4e4f6c[_0x8f4d('0x2c')]!==_0x8f4d('0x3e')){var _0x819ddf={};_0x819ddf[_0x4e4f6c[_0x8f4d('0x27')]]={'$like':'%'+_0x5e4fe2[_0x8f4d('0x2e')][_0x8f4d('0x3c')]+'%'};return _0x819ddf;}})});}_0x46c6fd=_[_0x8f4d('0x3d')]({},_0x46c6fd,_0x5e4fe2['options']);var _0x52c761={'where':_0x46c6fd[_0x8f4d('0x3a')]};return db[_0x8f4d('0x29')][_0x8f4d('0x1c')](_0x52c761)[_0x8f4d('0x23')](function(_0x10ccd0){_0x4bc679['count']=_0x10ccd0;if(_0x5e4fe2[_0x8f4d('0x2e')][_0x8f4d('0x3f')]){_0x46c6fd[_0x8f4d('0x40')]=[{'all':!![]}];}return db['SquareReport']['findAll'](_0x46c6fd);})['then'](function(_0x5cd1c7){_0x4bc679[_0x8f4d('0x41')]=_0x5cd1c7;return _0x4bc679;})[_0x8f4d('0x23')](respondWithFilteredResult(_0x5506ca,_0x46c6fd))[_0x8f4d('0x42')](handleError(_0x5506ca,null));};exports[_0x8f4d('0x43')]=function(_0x559e21,_0x4a4f89){var _0x2ff2a1={'raw':!![],'where':{'id':_0x559e21[_0x8f4d('0x44')]['id']}},_0x2949f5={};_0x2949f5[_0x8f4d('0x31')]=_[_0x8f4d('0x45')](db[_0x8f4d('0x29')][_0x8f4d('0x2a')]);_0x2949f5['query']=_[_0x8f4d('0x45')](_0x559e21[_0x8f4d('0x2e')]);_0x2949f5[_0x8f4d('0x2f')]=_[_0x8f4d('0x30')](_0x2949f5[_0x8f4d('0x31')],_0x2949f5[_0x8f4d('0x2e')]);_0x2ff2a1[_0x8f4d('0x33')]=_[_0x8f4d('0x30')](_0x2949f5[_0x8f4d('0x31')],qs[_0x8f4d('0x32')](_0x559e21[_0x8f4d('0x2e')][_0x8f4d('0x32')]));_0x2ff2a1[_0x8f4d('0x33')]=_0x2ff2a1[_0x8f4d('0x33')]['length']?_0x2ff2a1[_0x8f4d('0x33')]:_0x2949f5[_0x8f4d('0x31')];if(_0x559e21[_0x8f4d('0x2e')][_0x8f4d('0x3f')]){_0x2ff2a1[_0x8f4d('0x40')]=[{'all':!![]}];}_0x2ff2a1=_[_0x8f4d('0x3d')]({},_0x2ff2a1,_0x559e21[_0x8f4d('0x46')]);return db[_0x8f4d('0x29')][_0x8f4d('0x47')](_0x2ff2a1)[_0x8f4d('0x23')](handleEntityNotFound(_0x4a4f89,null))[_0x8f4d('0x23')](respondWithResult(_0x4a4f89,null))['catch'](handleError(_0x4a4f89,null));};exports[_0x8f4d('0x48')]=function(_0x36784b,_0x40916c){return db[_0x8f4d('0x29')][_0x8f4d('0x48')](_0x36784b[_0x8f4d('0x49')],{})[_0x8f4d('0x23')](respondWithResult(_0x40916c,0xc9))[_0x8f4d('0x42')](handleError(_0x40916c,null));};exports[_0x8f4d('0x22')]=function(_0x1f0f85,_0x5e78ad){if(_0x1f0f85[_0x8f4d('0x49')]['id']){delete _0x1f0f85[_0x8f4d('0x49')]['id'];}return db[_0x8f4d('0x29')][_0x8f4d('0x47')]({'where':{'id':_0x1f0f85['params']['id']}})[_0x8f4d('0x23')](handleEntityNotFound(_0x5e78ad,null))[_0x8f4d('0x23')](saveUpdates(_0x1f0f85[_0x8f4d('0x49')],null))[_0x8f4d('0x23')](respondWithResult(_0x5e78ad,null))['catch'](handleError(_0x5e78ad,null));};exports[_0x8f4d('0x24')]=function(_0x21ddf7,_0x1d12b7){return db[_0x8f4d('0x29')][_0x8f4d('0x47')]({'where':{'id':_0x21ddf7[_0x8f4d('0x44')]['id']}})[_0x8f4d('0x23')](handleEntityNotFound(_0x1d12b7,null))[_0x8f4d('0x23')](removeEntity(_0x1d12b7,null))['catch'](handleError(_0x1d12b7,null));};exports[_0x8f4d('0x4a')]=function(_0x599241,_0x4a15c8){return db['SquareReport'][_0x8f4d('0x4a')]()[_0x8f4d('0x23')](respondWithResult(_0x4a15c8,null))['catch'](handleError(_0x4a15c8,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 654f4dd..4c1e67c 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 _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 +var _0xe835=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SquareReport','report_square','uid_pname','uniqueid','leaveAt','util','../../config/logger'];(function(_0xd9a714,_0x4c4b32){var _0x59b26b=function(_0x34da6c){while(--_0x34da6c){_0xd9a714['push'](_0xd9a714['shift']());}};_0x59b26b(++_0x4c4b32);}(_0xe835,0x1b1));var _0x5e83=function(_0x224f65,_0x4750bf){_0x224f65=_0x224f65-0x0;var _0x3f921c=_0xe835[_0x224f65];return _0x3f921c;};'use strict';var _=require('lodash');var util=require(_0x5e83('0x0'));var logger=require(_0x5e83('0x1'))('api');var moment=require(_0x5e83('0x2'));var BPromise=require(_0x5e83('0x3'));var rp=require(_0x5e83('0x4'));var fs=require('fs');var path=require(_0x5e83('0x5'));var rimraf=require(_0x5e83('0x6'));var config=require(_0x5e83('0x7'));var attributes=require('./squareReport.attributes');module[_0x5e83('0x8')]=function(_0x4ce4f0,_0x179938){return _0x4ce4f0[_0x5e83('0x9')](_0x5e83('0xa'),attributes,{'tableName':_0x5e83('0xb'),'paranoid':![],'indexes':[{'name':_0x5e83('0xc'),'fields':[_0x5e83('0xd'),'project_name']},{'name':_0x5e83('0xe'),'fields':[_0x5e83('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index e0d6eb4..4ab8a91 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 _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 +var _0x492b=['rpc','../../config/environment','client','http','then','SquareReport,\x20%s,\x20%s','request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateSquareReport','SquareReport','create','body','options','raw','debug','UpdateSquareReport','update','where','attributes','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x11605,_0x3744f5){var _0x538dea=function(_0x4ec423){while(--_0x4ec423){_0x11605['push'](_0x11605['shift']());}};_0x538dea(++_0x3744f5);}(_0x492b,0x11a));var _0xb492=function(_0x4547a8,_0x149dd0){_0x4547a8=_0x4547a8-0x0;var _0x307c51=_0x492b[_0x4547a8];return _0x307c51;};'use strict';var _=require(_0xb492('0x0'));var util=require('util');var moment=require(_0xb492('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb492('0x2'));var db=require(_0xb492('0x3'))['db'];var utils=require(_0xb492('0x4'));var logger=require(_0xb492('0x5'))(_0xb492('0x6'));var config=require(_0xb492('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb492('0x8')][_0xb492('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x29847a,_0xf7d571,_0x446051){return new BPromise(function(_0x8301a4,_0xe9a06b){return client['request'](_0x29847a,_0x446051)[_0xb492('0xa')](function(_0x3d84f0){logger['info'](_0xb492('0xb'),_0xf7d571,_0xb492('0xc'));logger['debug'](_0xb492('0xd'),_0xf7d571,_0xb492('0xc'),JSON[_0xb492('0xe')](_0x3d84f0));if(_0x3d84f0['error']){if(_0x3d84f0[_0xb492('0xf')][_0xb492('0x10')]===0x1f4){logger[_0xb492('0xf')]('SquareReport,\x20%s,\x20%s',_0xf7d571,_0x3d84f0[_0xb492('0xf')]['message']);return _0xe9a06b(_0x3d84f0[_0xb492('0xf')][_0xb492('0x11')]);}logger['error'](_0xb492('0xb'),_0xf7d571,_0x3d84f0[_0xb492('0xf')][_0xb492('0x11')]);return _0x8301a4(_0x3d84f0['error']['message']);}else{logger[_0xb492('0x12')](_0xb492('0xb'),_0xf7d571,_0xb492('0xc'));_0x8301a4(_0x3d84f0[_0xb492('0x13')][_0xb492('0x11')]);}})[_0xb492('0x14')](function(_0x2f7403){logger[_0xb492('0xf')](_0xb492('0xb'),_0xf7d571,_0x2f7403);_0xe9a06b(_0x2f7403);});});}exports[_0xb492('0x15')]=function(_0x3b5296){var _0x1e2b7a=this;return new Promise(function(_0x548967,_0x53996c){return db[_0xb492('0x16')][_0xb492('0x17')](_0x3b5296[_0xb492('0x18')],{'raw':_0x3b5296[_0xb492('0x19')]?_0x3b5296[_0xb492('0x19')][_0xb492('0x1a')]===undefined?!![]:![]:!![]})[_0xb492('0xa')](function(_0x1fa47b){logger[_0xb492('0x12')](_0xb492('0x15'),_0x3b5296);logger[_0xb492('0x1b')](_0xb492('0x15'),_0x3b5296,JSON[_0xb492('0xe')](_0x1fa47b));_0x548967(_0x1fa47b);})[_0xb492('0x14')](function(_0x2f08c1){logger[_0xb492('0xf')]('CreateSquareReport',_0x2f08c1['message'],_0x3b5296);_0x53996c(_0x1e2b7a[_0xb492('0xf')](0x1f4,_0x2f08c1[_0xb492('0x11')]));});});};exports[_0xb492('0x1c')]=function(_0x1e1371){var _0x2d9e3e=this;return new Promise(function(_0x3f1049,_0x16bc04){return db[_0xb492('0x16')][_0xb492('0x1d')](_0x1e1371['body'],{'raw':_0x1e1371[_0xb492('0x19')]?_0x1e1371[_0xb492('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e1371[_0xb492('0x19')]?_0x1e1371[_0xb492('0x19')][_0xb492('0x1e')]||null:null,'attributes':_0x1e1371['options']?_0x1e1371[_0xb492('0x19')][_0xb492('0x1f')]||null:null,'limit':_0x1e1371['options']?_0x1e1371[_0xb492('0x19')]['limit']||null:null})[_0xb492('0xa')](function(_0x316c99){logger['info'](_0xb492('0x1c'),_0x1e1371);logger[_0xb492('0x1b')](_0xb492('0x1c'),_0x1e1371,JSON[_0xb492('0xe')](_0x316c99));_0x3f1049(_0x316c99);})[_0xb492('0x14')](function(_0x1b6c8d){logger[_0xb492('0xf')](_0xb492('0x1c'),_0x1b6c8d[_0xb492('0x11')],_0x1e1371);_0x16bc04(_0x2d9e3e[_0xb492('0xf')](0x1f4,_0x1b6c8d[_0xb492('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 01cd4ff..1e45214 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 _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 +var _0xa9af=['path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','/describe','describe','/:id','show','post','put','update','delete','exports','multer','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa9af,0x116));var _0xfa9a=function(_0x1cab2b,_0x2f05fa){_0x1cab2b=_0x1cab2b-0x0;var _0x59a640=_0xa9af[_0x1cab2b];return _0x59a640;};'use strict';var multer=require(_0xfa9a('0x0'));var util=require(_0xfa9a('0x1'));var path=require(_0xfa9a('0x2'));var timeout=require(_0xfa9a('0x3'));var express=require(_0xfa9a('0x4'));var router=express[_0xfa9a('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xfa9a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xfa9a('0x7'));var controller=require(_0xfa9a('0x8'));router[_0xfa9a('0x9')]('/',auth[_0xfa9a('0xa')](),controller['index']);router[_0xfa9a('0x9')](_0xfa9a('0xb'),auth[_0xfa9a('0xa')](),controller[_0xfa9a('0xc')]);router[_0xfa9a('0x9')](_0xfa9a('0xd'),auth[_0xfa9a('0xa')](),controller[_0xfa9a('0xe')]);router[_0xfa9a('0xf')]('/',auth[_0xfa9a('0xa')](),controller['create']);router[_0xfa9a('0x10')](_0xfa9a('0xd'),auth['isAuthenticated'](),controller[_0xfa9a('0x11')]);router[_0xfa9a('0x12')](_0xfa9a('0xd'),auth[_0xfa9a('0xa')](),controller['destroy']);module[_0xfa9a('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index e059b26..5593cb3 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 _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 +var _0x83f3=['STRING','TEXT','sequelize','exports'];(function(_0x2406a2,_0x2881aa){var _0x577133=function(_0x5e7c55){while(--_0x5e7c55){_0x2406a2['push'](_0x2406a2['shift']());}};_0x577133(++_0x2881aa);}(_0x83f3,0xb6));var _0x383f=function(_0x113cf3,_0x45dc37){_0x113cf3=_0x113cf3-0x0;var _0x568e99=_0x83f3[_0x113cf3];return _0x568e99;};'use strict';var Sequelize=require(_0x383f('0x0'));module[_0x383f('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x383f('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x383f('0x3')]},'project_name':{'type':Sequelize[_0x383f('0x2')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 99dfa61..afde049 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 _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 +var _0x8ff2=['index','SquareDetailsReport','rawAttributes','type','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','options','find','create','body','describe','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','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','undefined','offset','count','limit','set','apply','save','update','then','destroy','sendStatus','error','stack','name','send'];(function(_0xe24f4c,_0x3be26f){var _0x21fb1e=function(_0x428115){while(--_0x428115){_0xe24f4c['push'](_0xe24f4c['shift']());}};_0x21fb1e(++_0x3be26f);}(_0x8ff2,0x6b));var _0x28ff=function(_0x502b4d,_0x268e51){_0x502b4d=_0x502b4d-0x0;var _0x5a3535=_0x8ff2[_0x502b4d];return _0x5a3535;};'use strict';var emlformat=require(_0x28ff('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x28ff('0x1'));var jsonpatch=require(_0x28ff('0x2'));var rp=require(_0x28ff('0x3'));var moment=require(_0x28ff('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x28ff('0x5'));var util=require(_0x28ff('0x6'));var path=require(_0x28ff('0x7'));var sox=require(_0x28ff('0x8'));var csv=require(_0x28ff('0x9'));var ejs=require(_0x28ff('0xa'));var fs=require('fs');var fs_extra=require(_0x28ff('0xb'));var _=require(_0x28ff('0xc'));var squel=require(_0x28ff('0xd'));var crypto=require(_0x28ff('0xe'));var jsforce=require(_0x28ff('0xf'));var deskjs=require(_0x28ff('0x10'));var toCsv=require(_0x28ff('0x9'));var querystring=require(_0x28ff('0x11'));var Papa=require(_0x28ff('0x12'));var Redis=require(_0x28ff('0x13'));var authService=require(_0x28ff('0x14'));var qs=require(_0x28ff('0x15'));var as=require(_0x28ff('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x28ff('0x17'))(_0x28ff('0x18'));var utils=require(_0x28ff('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x28ff('0x1a'))['db'];function respondWithStatusCode(_0x2809f8,_0x1549db){_0x1549db=_0x1549db||0xcc;return function(_0x92b4a9){if(_0x92b4a9){return _0x2809f8['sendStatus'](_0x1549db);}return _0x2809f8[_0x28ff('0x1b')](_0x1549db)[_0x28ff('0x1c')]();};}function respondWithResult(_0x47c18b,_0x5d9b92){_0x5d9b92=_0x5d9b92||0xc8;return function(_0x125ec5){if(_0x125ec5){return _0x47c18b[_0x28ff('0x1b')](_0x5d9b92)[_0x28ff('0x1d')](_0x125ec5);}};}function respondWithFilteredResult(_0x197677,_0x55c8af){return function(_0x16872b){if(_0x16872b){var _0xffbccd=typeof _0x55c8af['offset']===_0x28ff('0x1e')&&typeof _0x55c8af['limit']==='undefined';var _0x33067=_0x16872b['count'];var _0x337a96=_0xffbccd?0x0:_0x55c8af[_0x28ff('0x1f')];var _0x113b74=_0xffbccd?_0x16872b[_0x28ff('0x20')]:_0x55c8af['offset']+_0x55c8af[_0x28ff('0x21')];var _0x4afb31;if(_0x113b74>=_0x33067){_0x113b74=_0x33067;_0x4afb31=0xc8;}else{_0x4afb31=0xce;}_0x197677[_0x28ff('0x1b')](_0x4afb31);return _0x197677[_0x28ff('0x22')]('Content-Range',_0x337a96+'-'+_0x113b74+'/'+_0x33067)[_0x28ff('0x1d')](_0x16872b);}return null;};}function patchUpdates(_0x14f4cb){return function(_0x5922c5){try{jsonpatch[_0x28ff('0x23')](_0x5922c5,_0x14f4cb,!![]);}catch(_0xb79b9e){return BPromise['reject'](_0xb79b9e);}return _0x5922c5[_0x28ff('0x24')]();};}function saveUpdates(_0x35cc71,_0x2bf310){return function(_0xfef97e){if(_0xfef97e){return _0xfef97e[_0x28ff('0x25')](_0x35cc71)[_0x28ff('0x26')](function(_0x4db2f0){return _0x4db2f0;});}return null;};}function removeEntity(_0x47ec32,_0x4584b3){return function(_0x5de4fc){if(_0x5de4fc){return _0x5de4fc[_0x28ff('0x27')]()['then'](function(){_0x47ec32[_0x28ff('0x1b')](0xcc)[_0x28ff('0x1c')]();});}};}function handleEntityNotFound(_0x40e5d7,_0x10759e){return function(_0x3a9a33){if(!_0x3a9a33){_0x40e5d7[_0x28ff('0x28')](0x194);}return _0x3a9a33;};}function handleError(_0x39c088,_0xedde68){_0xedde68=_0xedde68||0x1f4;return function(_0x3ea3d4){logger[_0x28ff('0x29')](_0x3ea3d4[_0x28ff('0x2a')]);if(_0x3ea3d4[_0x28ff('0x2b')]){delete _0x3ea3d4['name'];}_0x39c088[_0x28ff('0x1b')](_0xedde68)[_0x28ff('0x2c')](_0x3ea3d4);};}exports[_0x28ff('0x2d')]=function(_0x3076f6,_0x5ab3b0){var _0x1b7805={},_0x34a554={},_0x440667={'count':0x0,'rows':[]};var _0x5288a8=_['map'](db[_0x28ff('0x2e')][_0x28ff('0x2f')],function(_0x260b7c){return{'name':_0x260b7c['fieldName'],'type':_0x260b7c[_0x28ff('0x30')]['key']};});_0x34a554[_0x28ff('0x31')]=_[_0x28ff('0x32')](_0x5288a8,_0x28ff('0x2b'));_0x34a554[_0x28ff('0x33')]=_[_0x28ff('0x34')](_0x3076f6[_0x28ff('0x33')]);_0x34a554[_0x28ff('0x35')]=_['intersection'](_0x34a554['model'],_0x34a554[_0x28ff('0x33')]);_0x1b7805[_0x28ff('0x36')]=_['intersection'](_0x34a554[_0x28ff('0x31')],qs['fields'](_0x3076f6[_0x28ff('0x33')][_0x28ff('0x37')]));_0x1b7805['attributes']=_0x1b7805[_0x28ff('0x36')][_0x28ff('0x38')]?_0x1b7805[_0x28ff('0x36')]:_0x34a554['model'];if(!_0x3076f6[_0x28ff('0x33')][_0x28ff('0x39')](_0x28ff('0x3a'))){_0x1b7805[_0x28ff('0x21')]=qs[_0x28ff('0x21')](_0x3076f6[_0x28ff('0x33')][_0x28ff('0x21')]);_0x1b7805[_0x28ff('0x1f')]=qs[_0x28ff('0x1f')](_0x3076f6[_0x28ff('0x33')][_0x28ff('0x1f')]);}_0x1b7805['order']=qs['sort'](_0x3076f6[_0x28ff('0x33')][_0x28ff('0x3b')]);_0x1b7805[_0x28ff('0x3c')]=qs['filters'](_[_0x28ff('0x3d')](_0x3076f6['query'],_0x34a554[_0x28ff('0x35')]),_0x5288a8);if(_0x3076f6[_0x28ff('0x33')][_0x28ff('0x3e')]){_0x1b7805['where']=_[_0x28ff('0x3f')](_0x1b7805[_0x28ff('0x3c')],{'$or':_['map'](_0x5288a8,function(_0x892cec){if(_0x892cec[_0x28ff('0x30')]!==_0x28ff('0x40')){var _0x1dd2fe={};_0x1dd2fe[_0x892cec['name']]={'$like':'%'+_0x3076f6[_0x28ff('0x33')][_0x28ff('0x3e')]+'%'};return _0x1dd2fe;}})});}_0x1b7805=_[_0x28ff('0x3f')]({},_0x1b7805,_0x3076f6['options']);var _0x43f124={'where':_0x1b7805[_0x28ff('0x3c')]};return db[_0x28ff('0x2e')][_0x28ff('0x20')](_0x43f124)['then'](function(_0x11d914){_0x440667[_0x28ff('0x20')]=_0x11d914;if(_0x3076f6[_0x28ff('0x33')][_0x28ff('0x41')]){_0x1b7805[_0x28ff('0x42')]=[{'all':!![]}];}return db[_0x28ff('0x2e')][_0x28ff('0x43')](_0x1b7805);})[_0x28ff('0x26')](function(_0x27019a){_0x440667['rows']=_0x27019a;return _0x440667;})[_0x28ff('0x26')](respondWithFilteredResult(_0x5ab3b0,_0x1b7805))[_0x28ff('0x44')](handleError(_0x5ab3b0,null));};exports[_0x28ff('0x45')]=function(_0x5e793a,_0x28cf3a){var _0x413721={'raw':!![],'where':{'id':_0x5e793a[_0x28ff('0x46')]['id']}},_0x5b5461={};_0x5b5461[_0x28ff('0x31')]=_[_0x28ff('0x34')](db[_0x28ff('0x2e')]['rawAttributes']);_0x5b5461[_0x28ff('0x33')]=_[_0x28ff('0x34')](_0x5e793a[_0x28ff('0x33')]);_0x5b5461[_0x28ff('0x35')]=_['intersection'](_0x5b5461[_0x28ff('0x31')],_0x5b5461[_0x28ff('0x33')]);_0x413721['attributes']=_['intersection'](_0x5b5461[_0x28ff('0x31')],qs[_0x28ff('0x37')](_0x5e793a[_0x28ff('0x33')][_0x28ff('0x37')]));_0x413721[_0x28ff('0x36')]=_0x413721[_0x28ff('0x36')][_0x28ff('0x38')]?_0x413721['attributes']:_0x5b5461[_0x28ff('0x31')];if(_0x5e793a[_0x28ff('0x33')][_0x28ff('0x41')]){_0x413721[_0x28ff('0x42')]=[{'all':!![]}];}_0x413721=_[_0x28ff('0x3f')]({},_0x413721,_0x5e793a[_0x28ff('0x47')]);return db['SquareDetailsReport'][_0x28ff('0x48')](_0x413721)[_0x28ff('0x26')](handleEntityNotFound(_0x28cf3a,null))[_0x28ff('0x26')](respondWithResult(_0x28cf3a,null))[_0x28ff('0x44')](handleError(_0x28cf3a,null));};exports[_0x28ff('0x49')]=function(_0x3f61a4,_0x247a7c){return db[_0x28ff('0x2e')][_0x28ff('0x49')](_0x3f61a4[_0x28ff('0x4a')],{})[_0x28ff('0x26')](respondWithResult(_0x247a7c,0xc9))['catch'](handleError(_0x247a7c,null));};exports[_0x28ff('0x25')]=function(_0x1abb93,_0x2aafea){if(_0x1abb93[_0x28ff('0x4a')]['id']){delete _0x1abb93[_0x28ff('0x4a')]['id'];}return db['SquareDetailsReport'][_0x28ff('0x48')]({'where':{'id':_0x1abb93[_0x28ff('0x46')]['id']}})['then'](handleEntityNotFound(_0x2aafea,null))[_0x28ff('0x26')](saveUpdates(_0x1abb93['body'],null))[_0x28ff('0x26')](respondWithResult(_0x2aafea,null))['catch'](handleError(_0x2aafea,null));};exports['destroy']=function(_0x5bc96e,_0x528837){return db[_0x28ff('0x2e')][_0x28ff('0x48')]({'where':{'id':_0x5bc96e['params']['id']}})[_0x28ff('0x26')](handleEntityNotFound(_0x528837,null))[_0x28ff('0x26')](removeEntity(_0x528837,null))[_0x28ff('0x44')](handleError(_0x528837,null));};exports[_0x28ff('0x4b')]=function(_0xc522f7,_0x39f071){return db[_0x28ff('0x2e')]['describe']()[_0x28ff('0x26')](respondWithResult(_0x39f071,null))['catch'](handleError(_0x39f071,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index c22136f..543abfd 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 _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 +var _0x5580=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./squareReportDetail.attributes','exports','define','SquareDetailsReport','lodash','util'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x5580,0x15d));var _0x0558=function(_0x33e09a,_0x31479e){_0x33e09a=_0x33e09a-0x0;var _0x3daa3b=_0x5580[_0x33e09a];return _0x3daa3b;};'use strict';var _=require(_0x0558('0x0'));var util=require(_0x0558('0x1'));var logger=require(_0x0558('0x2'))(_0x0558('0x3'));var moment=require(_0x0558('0x4'));var BPromise=require(_0x0558('0x5'));var rp=require(_0x0558('0x6'));var fs=require('fs');var path=require(_0x0558('0x7'));var rimraf=require(_0x0558('0x8'));var config=require('../../config/environment');var attributes=require(_0x0558('0x9'));module[_0x0558('0xa')]=function(_0x3f5307,_0x11aed8){return _0x3f5307[_0x0558('0xb')](_0x0558('0xc'),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 6d3d6f4..1ba60d4 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 _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 +var _0xd4a2=['CreateSquareDetailsReport','create','body','options','raw','stringify','catch','lodash','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd4a2,0x173));var _0x2d4a=function(_0x34ea8c,_0x33b120){_0x34ea8c=_0x34ea8c-0x0;var _0x11a573=_0xd4a2[_0x34ea8c];return _0x11a573;};'use strict';var _=require(_0x2d4a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2d4a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2d4a('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x2d4a('0x3'));var logger=require('../../config/logger')(_0x2d4a('0x4'));var config=require(_0x2d4a('0x5'));var jayson=require(_0x2d4a('0x6'));var client=jayson[_0x2d4a('0x7')][_0x2d4a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x57058f,_0x45fefb,_0x41b161){return new BPromise(function(_0x1f237e,_0x29597e){return client[_0x2d4a('0x9')](_0x57058f,_0x41b161)[_0x2d4a('0xa')](function(_0xb9f016){logger[_0x2d4a('0xb')](_0x2d4a('0xc'),_0x45fefb,_0x2d4a('0xd'));logger[_0x2d4a('0xe')](_0x2d4a('0xf'),_0x45fefb,'request\x20sent',JSON['stringify'](_0xb9f016));if(_0xb9f016[_0x2d4a('0x10')]){if(_0xb9f016['error'][_0x2d4a('0x11')]===0x1f4){logger[_0x2d4a('0x10')](_0x2d4a('0xc'),_0x45fefb,_0xb9f016[_0x2d4a('0x10')][_0x2d4a('0x12')]);return _0x29597e(_0xb9f016[_0x2d4a('0x10')][_0x2d4a('0x12')]);}logger[_0x2d4a('0x10')]('SquareDetailsReport,\x20%s,\x20%s',_0x45fefb,_0xb9f016['error'][_0x2d4a('0x12')]);return _0x1f237e(_0xb9f016['error'][_0x2d4a('0x12')]);}else{logger[_0x2d4a('0xb')](_0x2d4a('0xc'),_0x45fefb,_0x2d4a('0xd'));_0x1f237e(_0xb9f016['result'][_0x2d4a('0x12')]);}})['catch'](function(_0x2838fa){logger['error'](_0x2d4a('0xc'),_0x45fefb,_0x2838fa);_0x29597e(_0x2838fa);});});}exports[_0x2d4a('0x13')]=function(_0x2188b2){var _0x388371=this;return new Promise(function(_0x498956,_0x4fd169){return db['SquareDetailsReport'][_0x2d4a('0x14')](_0x2188b2[_0x2d4a('0x15')],{'raw':_0x2188b2[_0x2d4a('0x16')]?_0x2188b2[_0x2d4a('0x16')][_0x2d4a('0x17')]===undefined?!![]:![]:!![]})[_0x2d4a('0xa')](function(_0x56445a){logger['info'](_0x2d4a('0x13'),_0x2188b2);logger[_0x2d4a('0xe')](_0x2d4a('0x13'),_0x2188b2,JSON[_0x2d4a('0x18')](_0x56445a));_0x498956(_0x56445a);})[_0x2d4a('0x19')](function(_0x2e7736){logger[_0x2d4a('0x10')](_0x2d4a('0x13'),_0x2e7736['message'],_0x2188b2);_0x4fd169(_0x388371[_0x2d4a('0x10')](0x1f4,_0x2e7736[_0x2d4a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 1072216..2d3f614 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 _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 +var _0x4939=['../../components/auth/service','get','isAuthenticated','/process/:pid/kill','exports','express','Router'];(function(_0x1a4cee,_0x1e9b9f){var _0x51bddd=function(_0x479fda){while(--_0x479fda){_0x1a4cee['push'](_0x1a4cee['shift']());}};_0x51bddd(++_0x1e9b9f);}(_0x4939,0xde));var _0x9493=function(_0x3ccdd1,_0x3d813c){_0x3ccdd1=_0x3ccdd1-0x0;var _0x4428c8=_0x4939[_0x3ccdd1];return _0x4428c8;};'use strict';var express=require(_0x9493('0x0'));var router=express[_0x9493('0x1')]();var auth=require(_0x9493('0x2'));var controller=require('./system.controller');router[_0x9493('0x3')]('/',auth[_0x9493('0x4')](),controller['index']);router[_0x9493('0x3')](_0x9493('0x5'),auth[_0x9493('0x4')](),controller['killProcess']);module[_0x9493('0x6')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 4f46025..653bace 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 _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 +var _0xe40e=['kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','child_process','exec','../../config/logger','api','util','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','status','send','getAllData','json','catch','killProcess','params','pid','then','split','length','indexOf','format','Process\x20with\x20pid\x20%s\x20not\x20found!'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe40e,0x1d7));var _0xee40=function(_0x21a562,_0x481be9){_0x21a562=_0x21a562-0x0;var _0x1e7ded=_0xe40e[_0x21a562];return _0x1e7ded;};'use strict';var info=require('systeminformation');var exec=require(_0xee40('0x0'))[_0xee40('0x1')];var logger=require(_0xee40('0x2'))(_0xee40('0x3'));var util=require(_0xee40('0x4'));var BPromise=require('bluebird');var _=require(_0xee40('0x5'));function handleError(_0x29b7bd,_0x471540,_0x4b9c1e){_0x471540=_0x471540||0x1f4;return function(_0x19c13b){logger[_0xee40('0x6')](_0xee40('0x7'),_0x4b9c1e,_0x471540,util[_0xee40('0x8')](_0x19c13b,{'showHidden':![],'depth':null}));delete _0x19c13b['name'];_0x29b7bd[_0xee40('0x9')](_0x471540)[_0xee40('0xa')](_0x19c13b);};}exports['index']=function(_0x6e1d34,_0x43992e){return info[_0xee40('0xb')]()['then'](function(_0x6bcb4e){return _0x43992e[_0xee40('0x9')](0xc8)[_0xee40('0xc')](_0x6bcb4e);})[_0xee40('0xd')](function(_0x364afc){return _0x43992e['status'](0x1f4)['json'](_0x364afc);});};exports[_0xee40('0xe')]=function(_0x10ae48,_0x592d86){var _0x84c8b5=['components/import/cm'];return new BPromise(function(_0x330e4b,_0x40d83a){return exec(util['format']('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x10ae48[_0xee40('0xf')][_0xee40('0x10')]),function(_0x2ab5a4,_0x1ca2c1,_0x5cd953){if(_0x2ab5a4){return _0x40d83a(_0x2ab5a4);}return _0x330e4b(_0x1ca2c1);});})[_0xee40('0x11')](function(_0x44ee51){var _0x352ed0=![];var _0x21b308=_0x44ee51[_0xee40('0x12')](/\n/);for(var _0x487f4a=0x0,_0x2d3ce0=_0x84c8b5[_0xee40('0x13')];_0x487f4a<_0x2d3ce0,_0x352ed0===![];_0x487f4a+=0x1){if(_0x44ee51[_0xee40('0x14')](_0x84c8b5[_0x487f4a])>=0x0){_0x352ed0=!![];}}if(!_0x352ed0){throw new Error(util[_0xee40('0x15')](_0xee40('0x16'),_0x10ae48[_0xee40('0xf')][_0xee40('0x10')]));}process[_0xee40('0x17')](_0x10ae48[_0xee40('0xf')][_0xee40('0x10')],_0xee40('0x18'));return _0x592d86['status'](0xc8)[_0xee40('0xc')]({'message':util[_0xee40('0x15')](_0xee40('0x19'),_0x10ae48[_0xee40('0xf')]['pid'])});})[_0xee40('0xd')](handleError(_0x592d86,null,'killProcess'));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 2e7cf5a..e8137db 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 _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 +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(_0x3a1dec,_0x1f943f){var _0x60ede0=function(_0x285fd5){while(--_0x285fd5){_0x3a1dec['push'](_0x3a1dec['shift']());}};_0x60ede0(++_0x1f943f);}(_0xa8a8,0xec));var _0x8a8a=function(_0x4a5e7a,_0x53ffba){_0x4a5e7a=_0x4a5e7a-0x0;var _0x41c2a0=_0xa8a8[_0x4a5e7a];return _0x41c2a0;};'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 3ebb683..89bc3a3 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 _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 +var _0x1c7c=['#0091EA','sequelize','exports','STRING','name'];(function(_0xc3b6c2,_0x316e35){var _0x337e19=function(_0x15db37){while(--_0x15db37){_0xc3b6c2['push'](_0xc3b6c2['shift']());}};_0x337e19(++_0x316e35);}(_0x1c7c,0x164));var _0xc1c7=function(_0x2d7444,_0x16b38f){_0x2d7444=_0x2d7444-0x0;var _0x1f4cc5=_0x1c7c[_0x2d7444];return _0x1f4cc5;};'use strict';var Sequelize=require(_0xc1c7('0x0'));module[_0xc1c7('0x1')]={'name':{'type':Sequelize[_0xc1c7('0x2')],'unique':_0xc1c7('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0xc1c7('0x4')},'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 49fe580..8c16c63 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 _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 +var _0xa676=['role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','save','destroy','then','Tags','UserProfileResource','sendStatus','error','stack','name','send','index','Tag','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','length','merge','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x25bca6,_0xe415ea){var _0x3f8d02=function(_0x3e581b){while(--_0x3e581b){_0x25bca6['push'](_0x25bca6['shift']());}};_0x3f8d02(++_0xe415ea);}(_0xa676,0x15b));var _0x6a67=function(_0x27312d,_0x251727){_0x27312d=_0x27312d-0x0;var _0x2a61b1=_0xa676[_0x27312d];return _0x2a61b1;};'use strict';var emlformat=require(_0x6a67('0x0'));var rimraf=require(_0x6a67('0x1'));var zipdir=require(_0x6a67('0x2'));var jsonpatch=require(_0x6a67('0x3'));var rp=require('request-promise');var moment=require(_0x6a67('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6a67('0x5'));var util=require(_0x6a67('0x6'));var path=require(_0x6a67('0x7'));var sox=require(_0x6a67('0x8'));var csv=require(_0x6a67('0x9'));var ejs=require(_0x6a67('0xa'));var fs=require('fs');var fs_extra=require(_0x6a67('0xb'));var _=require(_0x6a67('0xc'));var squel=require(_0x6a67('0xd'));var crypto=require(_0x6a67('0xe'));var jsforce=require(_0x6a67('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6a67('0x10'));var Papa=require(_0x6a67('0x11'));var Redis=require('ioredis');var authService=require(_0x6a67('0x12'));var qs=require(_0x6a67('0x13'));var as=require(_0x6a67('0x14'));var hardwareService=require(_0x6a67('0x15'));var logger=require(_0x6a67('0x16'))(_0x6a67('0x17'));var utils=require('../../config/utils');var config=require(_0x6a67('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x6a67('0x19'))['db'];function respondWithStatusCode(_0x58957a,_0x10ffad){_0x10ffad=_0x10ffad||0xcc;return function(_0x3d0512){if(_0x3d0512){return _0x58957a['sendStatus'](_0x10ffad);}return _0x58957a[_0x6a67('0x1a')](_0x10ffad)['end']();};}function respondWithResult(_0x13e1d0,_0x30e797){_0x30e797=_0x30e797||0xc8;return function(_0x12a33a){if(_0x12a33a){return _0x13e1d0[_0x6a67('0x1a')](_0x30e797)[_0x6a67('0x1b')](_0x12a33a);}};}function respondWithFilteredResult(_0x4faaa1,_0x14e4a1){return function(_0x4b26ea){if(_0x4b26ea){var _0x386232=typeof _0x14e4a1[_0x6a67('0x1c')]===_0x6a67('0x1d')&&typeof _0x14e4a1[_0x6a67('0x1e')]===_0x6a67('0x1d');var _0x23806a=_0x4b26ea['count'];var _0x5ee852=_0x386232?0x0:_0x14e4a1[_0x6a67('0x1c')];var _0x4d0874=_0x386232?_0x4b26ea[_0x6a67('0x1f')]:_0x14e4a1[_0x6a67('0x1c')]+_0x14e4a1[_0x6a67('0x1e')];var _0x3cad6a;if(_0x4d0874>=_0x23806a){_0x4d0874=_0x23806a;_0x3cad6a=0xc8;}else{_0x3cad6a=0xce;}_0x4faaa1['status'](_0x3cad6a);return _0x4faaa1[_0x6a67('0x20')](_0x6a67('0x21'),_0x5ee852+'-'+_0x4d0874+'/'+_0x23806a)['json'](_0x4b26ea);}return null;};}function patchUpdates(_0x390d9d){return function(_0x2e41f5){try{jsonpatch['apply'](_0x2e41f5,_0x390d9d,!![]);}catch(_0x30588a){return BPromise['reject'](_0x30588a);}return _0x2e41f5[_0x6a67('0x22')]();};}function saveUpdates(_0x43e73b,_0x202562){return function(_0xd08b97){if(_0xd08b97){return _0xd08b97['update'](_0x43e73b)['then'](function(_0x527ddd){return _0x527ddd;});}return null;};}function removeEntity(_0x2720b6,_0x1a43a9){return function(_0x30ac7f){if(_0x30ac7f){return _0x30ac7f[_0x6a67('0x23')]()[_0x6a67('0x24')](function(){var _0xf1c9d8=_0x30ac7f['get']({'plain':!![]});var _0x65173a=_0x6a67('0x25');return db[_0x6a67('0x26')][_0x6a67('0x23')]({'where':{'type':_0x65173a,'resourceId':_0xf1c9d8['id']}})[_0x6a67('0x24')](function(){return _0x30ac7f;});})['then'](function(){_0x2720b6[_0x6a67('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b71e6,_0x3f799f){return function(_0x328596){if(!_0x328596){_0x1b71e6[_0x6a67('0x27')](0x194);}return _0x328596;};}function handleError(_0x54a06d,_0x424291){_0x424291=_0x424291||0x1f4;return function(_0x4e43b2){logger[_0x6a67('0x28')](_0x4e43b2[_0x6a67('0x29')]);if(_0x4e43b2[_0x6a67('0x2a')]){delete _0x4e43b2[_0x6a67('0x2a')];}_0x54a06d['status'](_0x424291)[_0x6a67('0x2b')](_0x4e43b2);};}exports[_0x6a67('0x2c')]=function(_0x457cf8,_0x8b1d1){var _0x455cf9={},_0x1bf851={},_0x48bef1={'count':0x0,'rows':[]};var _0x20488a=_['map'](db[_0x6a67('0x2d')][_0x6a67('0x2e')],function(_0xe5879d){return{'name':_0xe5879d['fieldName'],'type':_0xe5879d['type'][_0x6a67('0x2f')]};});_0x1bf851[_0x6a67('0x30')]=_[_0x6a67('0x31')](_0x20488a,'name');_0x1bf851[_0x6a67('0x32')]=_[_0x6a67('0x33')](_0x457cf8[_0x6a67('0x32')]);_0x1bf851[_0x6a67('0x34')]=_[_0x6a67('0x35')](_0x1bf851['model'],_0x1bf851[_0x6a67('0x32')]);_0x455cf9[_0x6a67('0x36')]=_[_0x6a67('0x35')](_0x1bf851[_0x6a67('0x30')],qs[_0x6a67('0x37')](_0x457cf8[_0x6a67('0x32')][_0x6a67('0x37')]));_0x455cf9[_0x6a67('0x36')]=_0x455cf9[_0x6a67('0x36')]['length']?_0x455cf9['attributes']:_0x1bf851[_0x6a67('0x30')];if(!_0x457cf8[_0x6a67('0x32')]['hasOwnProperty'](_0x6a67('0x38'))){_0x455cf9[_0x6a67('0x1e')]=qs['limit'](_0x457cf8[_0x6a67('0x32')][_0x6a67('0x1e')]);_0x455cf9[_0x6a67('0x1c')]=qs['offset'](_0x457cf8[_0x6a67('0x32')]['offset']);}_0x455cf9[_0x6a67('0x39')]=qs[_0x6a67('0x3a')](_0x457cf8['query'][_0x6a67('0x3a')]);_0x455cf9[_0x6a67('0x3b')]=qs['filters'](_[_0x6a67('0x3c')](_0x457cf8[_0x6a67('0x32')],_0x1bf851['filters']),_0x20488a);if(_0x457cf8[_0x6a67('0x32')][_0x6a67('0x3d')]){_0x455cf9['where']=_['merge'](_0x455cf9[_0x6a67('0x3b')],{'$or':_['map'](_0x20488a,function(_0x550367){if(_0x550367[_0x6a67('0x3e')]!==_0x6a67('0x3f')){var _0x5eb65f={};_0x5eb65f[_0x550367[_0x6a67('0x2a')]]={'$like':'%'+_0x457cf8[_0x6a67('0x32')][_0x6a67('0x3d')]+'%'};return _0x5eb65f;}})});}_0x455cf9=_['merge']({},_0x455cf9,_0x457cf8[_0x6a67('0x40')]);var _0x1d17ff={'where':_0x455cf9[_0x6a67('0x3b')]};return db[_0x6a67('0x2d')][_0x6a67('0x1f')](_0x1d17ff)[_0x6a67('0x24')](function(_0x364546){_0x48bef1[_0x6a67('0x1f')]=_0x364546;if(_0x457cf8[_0x6a67('0x32')][_0x6a67('0x41')]){_0x455cf9[_0x6a67('0x42')]=[{'all':!![]}];}return db[_0x6a67('0x2d')][_0x6a67('0x43')](_0x455cf9);})[_0x6a67('0x24')](function(_0x1073f3){_0x48bef1[_0x6a67('0x44')]=_0x1073f3;return _0x48bef1;})[_0x6a67('0x24')](respondWithFilteredResult(_0x8b1d1,_0x455cf9))[_0x6a67('0x45')](handleError(_0x8b1d1,null));};exports[_0x6a67('0x46')]=function(_0x1132a0,_0x33e308){var _0x37d720={'raw':!![],'where':{'id':_0x1132a0['params']['id']}},_0x5e134c={};_0x5e134c[_0x6a67('0x30')]=_['keys'](db[_0x6a67('0x2d')][_0x6a67('0x2e')]);_0x5e134c[_0x6a67('0x32')]=_[_0x6a67('0x33')](_0x1132a0['query']);_0x5e134c[_0x6a67('0x34')]=_['intersection'](_0x5e134c[_0x6a67('0x30')],_0x5e134c[_0x6a67('0x32')]);_0x37d720['attributes']=_[_0x6a67('0x35')](_0x5e134c[_0x6a67('0x30')],qs[_0x6a67('0x37')](_0x1132a0[_0x6a67('0x32')][_0x6a67('0x37')]));_0x37d720[_0x6a67('0x36')]=_0x37d720[_0x6a67('0x36')][_0x6a67('0x47')]?_0x37d720[_0x6a67('0x36')]:_0x5e134c['model'];if(_0x1132a0[_0x6a67('0x32')][_0x6a67('0x41')]){_0x37d720[_0x6a67('0x42')]=[{'all':!![]}];}_0x37d720=_[_0x6a67('0x48')]({},_0x37d720,_0x1132a0[_0x6a67('0x40')]);return db['Tag'][_0x6a67('0x49')](_0x37d720)[_0x6a67('0x24')](handleEntityNotFound(_0x33e308,null))[_0x6a67('0x24')](respondWithResult(_0x33e308,null))[_0x6a67('0x45')](handleError(_0x33e308,null));};exports[_0x6a67('0x4a')]=function(_0x135362,_0x20884d){return db[_0x6a67('0x2d')][_0x6a67('0x4a')](_0x135362['body'],{})[_0x6a67('0x24')](function(_0x292698){var _0x385444=_0x135362[_0x6a67('0x4b')][_0x6a67('0x4c')]({'plain':!![]});if(!_0x385444)throw new Error(_0x6a67('0x4d'));if(_0x385444[_0x6a67('0x4e')]===_0x6a67('0x4b')){var _0x10f39d=_0x292698['get']({'plain':!![]});var _0xe37428=_0x6a67('0x25');return db['UserProfileSection'][_0x6a67('0x49')]({'where':{'name':_0xe37428,'userProfileId':_0x385444['userProfileId']},'raw':!![]})['then'](function(_0x223a72){if(_0x223a72&&_0x223a72[_0x6a67('0x4f')]===0x0){return db['UserProfileResource'][_0x6a67('0x4a')]({'name':_0x10f39d[_0x6a67('0x2a')],'resourceId':_0x10f39d['id'],'type':_0x223a72[_0x6a67('0x2a')],'sectionId':_0x223a72['id']},{})[_0x6a67('0x24')](function(){return _0x292698;});}else{return _0x292698;}})[_0x6a67('0x45')](function(_0x4bd4c6){logger['error'](_0x6a67('0x50'),_0x4bd4c6);throw _0x4bd4c6;});}return _0x292698;})[_0x6a67('0x24')](respondWithResult(_0x20884d,0xc9))[_0x6a67('0x45')](handleError(_0x20884d,null));};exports[_0x6a67('0x51')]=function(_0x454120,_0x3a11ad){if(_0x454120[_0x6a67('0x52')]['id']){delete _0x454120['body']['id'];}return db[_0x6a67('0x2d')][_0x6a67('0x49')]({'where':{'id':_0x454120[_0x6a67('0x53')]['id']}})[_0x6a67('0x24')](handleEntityNotFound(_0x3a11ad,null))['then'](saveUpdates(_0x454120[_0x6a67('0x52')],null))[_0x6a67('0x24')](respondWithResult(_0x3a11ad,null))[_0x6a67('0x45')](handleError(_0x3a11ad,null));};exports[_0x6a67('0x23')]=function(_0x45a78d,_0x280b00){return db[_0x6a67('0x2d')][_0x6a67('0x49')]({'where':{'id':_0x45a78d['params']['id']}})[_0x6a67('0x24')](handleEntityNotFound(_0x280b00,null))['then'](removeEntity(_0x280b00,null))['catch'](handleError(_0x280b00,null));};exports[_0x6a67('0x54')]=function(_0x22d1b1,_0x1ee0f5){return db[_0x6a67('0x2d')]['describe']()['then'](respondWithResult(_0x1ee0f5,null))[_0x6a67('0x45')](handleError(_0x1ee0f5,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 5d16ab4..307d1d0 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 _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 +var _0x3d4c=['exports','define','Tag','tools_tags','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./tag.attributes'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x3d4c,0xf4));var _0xc3d4=function(_0x167dcb,_0x367a39){_0x167dcb=_0x167dcb-0x0;var _0x5952bd=_0x3d4c[_0x167dcb];return _0x5952bd;};'use strict';var _=require('lodash');var util=require(_0xc3d4('0x0'));var logger=require(_0xc3d4('0x1'))(_0xc3d4('0x2'));var moment=require('moment');var BPromise=require(_0xc3d4('0x3'));var rp=require(_0xc3d4('0x4'));var fs=require('fs');var path=require(_0xc3d4('0x5'));var rimraf=require(_0xc3d4('0x6'));var config=require('../../config/environment');var attributes=require(_0xc3d4('0x7'));module[_0xc3d4('0x8')]=function(_0x177a71,_0x5e00f6){return _0x177a71[_0xc3d4('0x9')](_0xc3d4('0xa'),attributes,{'tableName':_0xc3d4('0xb'),'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 05ef846..9890891 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 _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 +var _0x579c=['message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Tag,\x20%s,\x20%s','debug','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x393164,_0x221ae6){var _0x31f975=function(_0x39796){while(--_0x39796){_0x393164['push'](_0x393164['shift']());}};_0x31f975(++_0x221ae6);}(_0x579c,0xda));var _0xc579=function(_0x36e678,_0x45cf20){_0x36e678=_0x36e678-0x0;var _0x71abb0=_0x579c[_0x36e678];return _0x71abb0;};'use strict';var _=require(_0xc579('0x0'));var util=require(_0xc579('0x1'));var moment=require(_0xc579('0x2'));var BPromise=require(_0xc579('0x3'));var rs=require(_0xc579('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc579('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc579('0x6'))(_0xc579('0x7'));var config=require(_0xc579('0x8'));var jayson=require(_0xc579('0x9'));var client=jayson[_0xc579('0xa')][_0xc579('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e451b,_0x585167,_0x1c6d9c){return new BPromise(function(_0x293c4a,_0x2ce949){return client[_0xc579('0xc')](_0x2e451b,_0x1c6d9c)[_0xc579('0xd')](function(_0x44b151){logger[_0xc579('0xe')](_0xc579('0xf'),_0x585167,'request\x20sent');logger[_0xc579('0x10')](_0xc579('0x11'),_0x585167,_0xc579('0x12'),JSON[_0xc579('0x13')](_0x44b151));if(_0x44b151[_0xc579('0x14')]){if(_0x44b151[_0xc579('0x14')][_0xc579('0x15')]===0x1f4){logger[_0xc579('0x14')](_0xc579('0xf'),_0x585167,_0x44b151[_0xc579('0x14')][_0xc579('0x16')]);return _0x2ce949(_0x44b151['error'][_0xc579('0x16')]);}logger['error'](_0xc579('0xf'),_0x585167,_0x44b151['error'][_0xc579('0x16')]);return _0x293c4a(_0x44b151['error'][_0xc579('0x16')]);}else{logger['info'](_0xc579('0xf'),_0x585167,_0xc579('0x12'));_0x293c4a(_0x44b151['result']['message']);}})[_0xc579('0x17')](function(_0x2abc55){logger[_0xc579('0x14')](_0xc579('0xf'),_0x585167,_0x2abc55);_0x2ce949(_0x2abc55);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 0cff6fe..b9c1d6b 100644 --- a/server/api/team/index.js +++ b/server/api/team/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_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 +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'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 cd74396..2441dc3 100644 --- a/server/api/team/team.attributes.js +++ b/server/api/team/team.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['STRING','name'];(function(_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 +var _0xb10b=['name','sequelize','STRING'];(function(_0x2dc40c,_0x213cde){var _0x47a8d6=function(_0x497399){while(--_0x497399){_0x2dc40c['push'](_0x2dc40c['shift']());}};_0x47a8d6(++_0x213cde);}(_0xb10b,0x12a));var _0xbb10=function(_0x12a66f,_0x30e98d){_0x12a66f=_0x12a66f-0x0;var _0x36a7d9=_0xb10b[_0x12a66f];return _0x36a7d9;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 9c54121..c81363c 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 _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 +var _0x0eed=['UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','WhatsappQueueId','UserVoicePrefix','VoicePrefixId','end','send','getQueues','isValidChannel','channel','ValidationError','Unknown\x20channel','capitalize','Queue','length','toLowerCase','Queues','addQueues','add','removeQueues','remove','ids','addAgents','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','Voice','through','QueueId','User','findOrCreate','emit','Queue:save','online','voicePause','UserVoiceQueueRt','SIP/%s','interface','TeamVoiceQueue','penalty','all','TeamVoicePrefix','findOne','upsert','spread','removeAgents','Queue:remove','getAgents','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','map','Team','rawAttributes','fieldName','model','query','attributes','intersection','fields','nolimit','order','sort','where','filters','pick','filter','merge','type','options','include','findAll','rows','catch','show','params','keys','includeAll','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','Teams','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','UserId','VoiceQueueId','MailQueueId','UserMailQueue','SmsQueueId','UserSmsQueue','destroy','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x0eed,0xd0));var _0xd0ee=function(_0x451308,_0x4c733c){_0x451308=_0x451308-0x0;var _0x460422=_0x0eed[_0x451308];return _0x460422;};'use strict';var emlformat=require(_0xd0ee('0x0'));var rimraf=require(_0xd0ee('0x1'));var zipdir=require(_0xd0ee('0x2'));var jsonpatch=require(_0xd0ee('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd0ee('0x4'));var Mustache=require(_0xd0ee('0x5'));var util=require('util');var path=require(_0xd0ee('0x6'));var sox=require(_0xd0ee('0x7'));var csv=require(_0xd0ee('0x8'));var ejs=require(_0xd0ee('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd0ee('0xa'));var squel=require('squel');var crypto=require(_0xd0ee('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd0ee('0x8'));var querystring=require(_0xd0ee('0xc'));var Papa=require(_0xd0ee('0xd'));var Redis=require(_0xd0ee('0xe'));var authService=require(_0xd0ee('0xf'));var qs=require(_0xd0ee('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd0ee('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xd0ee('0x12'));var licenseUtil=require(_0xd0ee('0x13'));var db=require(_0xd0ee('0x14'))['db'];config['redis']=_[_0xd0ee('0x15')](config[_0xd0ee('0x16')],{'host':_0xd0ee('0x17'),'port':0x18eb});var socket=require(_0xd0ee('0x18'))(new Redis(config[_0xd0ee('0x16')]));require(_0xd0ee('0x19'))[_0xd0ee('0x1a')](socket);function respondWithStatusCode(_0x41aa1f,_0x4ec0d9){_0x4ec0d9=_0x4ec0d9||0xcc;return function(_0x532110){if(_0x532110){return _0x41aa1f[_0xd0ee('0x1b')](_0x4ec0d9);}return _0x41aa1f[_0xd0ee('0x1c')](_0x4ec0d9)['end']();};}function respondWithResult(_0x143d60,_0x3eaa00){_0x3eaa00=_0x3eaa00||0xc8;return function(_0x1b8e5b){if(_0x1b8e5b){return _0x143d60[_0xd0ee('0x1c')](_0x3eaa00)[_0xd0ee('0x1d')](_0x1b8e5b);}};}function respondWithFilteredResult(_0x371583,_0x493546){return function(_0x2d6149){if(_0x2d6149){var _0x13b99a=typeof _0x493546[_0xd0ee('0x1e')]===_0xd0ee('0x1f')&&typeof _0x493546[_0xd0ee('0x20')]===_0xd0ee('0x1f');var _0x456a06=_0x2d6149[_0xd0ee('0x21')];var _0xbf5e8e=_0x13b99a?0x0:_0x493546['offset'];var _0x391d2b=_0x13b99a?_0x2d6149[_0xd0ee('0x21')]:_0x493546['offset']+_0x493546[_0xd0ee('0x20')];var _0x12ccee;if(_0x391d2b>=_0x456a06){_0x391d2b=_0x456a06;_0x12ccee=0xc8;}else{_0x12ccee=0xce;}_0x371583['status'](_0x12ccee);return _0x371583[_0xd0ee('0x22')](_0xd0ee('0x23'),_0xbf5e8e+'-'+_0x391d2b+'/'+_0x456a06)[_0xd0ee('0x1d')](_0x2d6149);}return null;};}function patchUpdates(_0x5958ef){return function(_0x2adcf4){try{jsonpatch[_0xd0ee('0x24')](_0x2adcf4,_0x5958ef,!![]);}catch(_0x130d77){return BPromise[_0xd0ee('0x25')](_0x130d77);}return _0x2adcf4[_0xd0ee('0x26')]();};}function saveUpdates(_0x2a26f7,_0x16e905){return function(_0x50cc45){if(_0x50cc45){return _0x50cc45[_0xd0ee('0x27')](_0x2a26f7)[_0xd0ee('0x28')](function(_0x167ff3){return _0x167ff3;});}return null;};}function handleEntityNotFound(_0x2b04e8,_0x242824){return function(_0x5726dd){if(!_0x5726dd){_0x2b04e8[_0xd0ee('0x1b')](0x194);}return _0x5726dd;};}function handleError(_0x5b0cbd,_0xe4998c){_0xe4998c=_0xe4998c||0x1f4;return function(_0x1ae4a1){logger[_0xd0ee('0x29')](_0x1ae4a1[_0xd0ee('0x2a')]);if(_0x1ae4a1[_0xd0ee('0x2b')]){delete _0x1ae4a1['name'];}_0x5b0cbd[_0xd0ee('0x1c')](_0xe4998c)['send'](_0x1ae4a1);};}exports[_0xd0ee('0x2c')]=function(_0x4505d3,_0x4ef9e0){var _0x2d0f4b={},_0x403b2b={},_0x1b7d0d={'count':0x0,'rows':[]};var _0x38f2ca=_[_0xd0ee('0x2d')](db[_0xd0ee('0x2e')][_0xd0ee('0x2f')],function(_0x12bf15){return{'name':_0x12bf15[_0xd0ee('0x30')],'type':_0x12bf15['type']['key']};});_0x403b2b[_0xd0ee('0x31')]=_[_0xd0ee('0x2d')](_0x38f2ca,_0xd0ee('0x2b'));_0x403b2b[_0xd0ee('0x32')]=_['keys'](_0x4505d3[_0xd0ee('0x32')]);_0x403b2b['filters']=_['intersection'](_0x403b2b[_0xd0ee('0x31')],_0x403b2b['query']);_0x2d0f4b[_0xd0ee('0x33')]=_[_0xd0ee('0x34')](_0x403b2b[_0xd0ee('0x31')],qs['fields'](_0x4505d3[_0xd0ee('0x32')][_0xd0ee('0x35')]));_0x2d0f4b[_0xd0ee('0x33')]=_0x2d0f4b[_0xd0ee('0x33')]['length']?_0x2d0f4b[_0xd0ee('0x33')]:_0x403b2b[_0xd0ee('0x31')];if(!_0x4505d3[_0xd0ee('0x32')]['hasOwnProperty'](_0xd0ee('0x36'))){_0x2d0f4b[_0xd0ee('0x20')]=qs[_0xd0ee('0x20')](_0x4505d3['query'][_0xd0ee('0x20')]);_0x2d0f4b['offset']=qs['offset'](_0x4505d3[_0xd0ee('0x32')][_0xd0ee('0x1e')]);}_0x2d0f4b[_0xd0ee('0x37')]=qs['sort'](_0x4505d3[_0xd0ee('0x32')][_0xd0ee('0x38')]);_0x2d0f4b[_0xd0ee('0x39')]=qs[_0xd0ee('0x3a')](_[_0xd0ee('0x3b')](_0x4505d3[_0xd0ee('0x32')],_0x403b2b[_0xd0ee('0x3a')]),_0x38f2ca);if(_0x4505d3[_0xd0ee('0x32')][_0xd0ee('0x3c')]){_0x2d0f4b[_0xd0ee('0x39')]=_[_0xd0ee('0x3d')](_0x2d0f4b[_0xd0ee('0x39')],{'$or':_[_0xd0ee('0x2d')](_0x38f2ca,function(_0x5307ee){if(_0x5307ee[_0xd0ee('0x3e')]!=='VIRTUAL'){var _0x2fefdd={};_0x2fefdd[_0x5307ee[_0xd0ee('0x2b')]]={'$like':'%'+_0x4505d3['query'][_0xd0ee('0x3c')]+'%'};return _0x2fefdd;}})});}_0x2d0f4b=_[_0xd0ee('0x3d')]({},_0x2d0f4b,_0x4505d3[_0xd0ee('0x3f')]);var _0x3c8789={'where':_0x2d0f4b['where']};return db[_0xd0ee('0x2e')][_0xd0ee('0x21')](_0x3c8789)['then'](function(_0x403566){_0x1b7d0d[_0xd0ee('0x21')]=_0x403566;if(_0x4505d3[_0xd0ee('0x32')]['includeAll']){_0x2d0f4b[_0xd0ee('0x40')]=[{'all':!![]}];}return db[_0xd0ee('0x2e')][_0xd0ee('0x41')](_0x2d0f4b);})[_0xd0ee('0x28')](function(_0x316ea3){_0x1b7d0d[_0xd0ee('0x42')]=_0x316ea3;return _0x1b7d0d;})['then'](respondWithFilteredResult(_0x4ef9e0,_0x2d0f4b))[_0xd0ee('0x43')](handleError(_0x4ef9e0,null));};exports[_0xd0ee('0x44')]=function(_0x546d55,_0x18281a){var _0x4ebe3e={'raw':![],'where':{'id':_0x546d55[_0xd0ee('0x45')]['id']}},_0x54c17e={};_0x54c17e[_0xd0ee('0x31')]=_[_0xd0ee('0x46')](db[_0xd0ee('0x2e')][_0xd0ee('0x2f')]);_0x54c17e[_0xd0ee('0x32')]=_[_0xd0ee('0x46')](_0x546d55[_0xd0ee('0x32')]);_0x54c17e[_0xd0ee('0x3a')]=_[_0xd0ee('0x34')](_0x54c17e[_0xd0ee('0x31')],_0x54c17e['query']);_0x4ebe3e['attributes']=_['intersection'](_0x54c17e[_0xd0ee('0x31')],qs[_0xd0ee('0x35')](_0x546d55[_0xd0ee('0x32')][_0xd0ee('0x35')]));_0x4ebe3e[_0xd0ee('0x33')]=_0x4ebe3e['attributes']['length']?_0x4ebe3e['attributes']:_0x54c17e[_0xd0ee('0x31')];if(_0x546d55[_0xd0ee('0x32')][_0xd0ee('0x47')]){_0x4ebe3e[_0xd0ee('0x40')]=[{'all':!![]}];}_0x4ebe3e=_[_0xd0ee('0x3d')]({},_0x4ebe3e,_0x546d55['options']);return db['Team']['find'](_0x4ebe3e)[_0xd0ee('0x28')](handleEntityNotFound(_0x18281a,null))[_0xd0ee('0x28')](respondWithResult(_0x18281a,null))[_0xd0ee('0x43')](handleError(_0x18281a,null));};exports[_0xd0ee('0x48')]=function(_0x10d7a0,_0x1e9bab){return db['Team'][_0xd0ee('0x48')](_0x10d7a0[_0xd0ee('0x49')],{})['then'](function(_0x1500f6){var _0x42b12f=_0x10d7a0['user']['get']({'plain':!![]});if(!_0x42b12f)throw new Error(_0xd0ee('0x4a'));if(_0x42b12f[_0xd0ee('0x4b')]===_0xd0ee('0x4c')){var _0x25e922=_0x1500f6[_0xd0ee('0x4d')]({'plain':!![]});var _0x4e9a3d=_0xd0ee('0x4e');return db[_0xd0ee('0x4f')][_0xd0ee('0x50')]({'where':{'name':_0x4e9a3d,'userProfileId':_0x42b12f[_0xd0ee('0x51')]},'raw':!![]})['then'](function(_0x13c05b){if(_0x13c05b&&_0x13c05b[_0xd0ee('0x52')]===0x0){return db[_0xd0ee('0x53')][_0xd0ee('0x48')]({'name':_0x25e922['name'],'resourceId':_0x25e922['id'],'type':_0x13c05b[_0xd0ee('0x2b')],'sectionId':_0x13c05b['id']},{})[_0xd0ee('0x28')](function(){return _0x1500f6;});}else{return _0x1500f6;}})['catch'](function(_0x2700d6){logger[_0xd0ee('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2700d6);throw _0x2700d6;});}return _0x1500f6;})['then'](respondWithResult(_0x1e9bab,0xc9))[_0xd0ee('0x43')](handleError(_0x1e9bab,null));};exports['update']=function(_0x11dda1,_0xc11aac){if(_0x11dda1['body']['id']){delete _0x11dda1[_0xd0ee('0x49')]['id'];}return db[_0xd0ee('0x2e')][_0xd0ee('0x50')]({'where':{'id':_0x11dda1[_0xd0ee('0x45')]['id']}})[_0xd0ee('0x28')](handleEntityNotFound(_0xc11aac,null))[_0xd0ee('0x28')](saveUpdates(_0x11dda1[_0xd0ee('0x49')],null))[_0xd0ee('0x28')](respondWithResult(_0xc11aac,null))[_0xd0ee('0x43')](handleError(_0xc11aac,null));};exports['destroy']=function(_0x3eee41,_0x220d55){var _0x6352db=_0x3eee41[_0xd0ee('0x45')]['id'];var _0x2c69c7=[];return db['sequelize'][_0xd0ee('0x54')](function(_0x535b1b){var _0x2f24d0=_0xd0ee('0x55')+_0x6352db;return db[_0xd0ee('0x56')][_0xd0ee('0x32')](_0x2f24d0,{'type':db[_0xd0ee('0x57')][_0xd0ee('0x58')][_0xd0ee('0x59')],'raw':!![],'transaction':_0x535b1b})[_0xd0ee('0x28')](function(_0x20d9b8){_0x2c69c7=_['map'](_0x20d9b8,function(_0xff2ff){return Number(_0xff2ff[_0xd0ee('0x5a')]);});})[_0xd0ee('0x28')](function(){var _0x4066dd='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0x6352db;return db[_0xd0ee('0x56')][_0xd0ee('0x32')](_0x4066dd,{'type':db['Sequelize'][_0xd0ee('0x58')][_0xd0ee('0x59')],'raw':!![],'transaction':_0x535b1b});})[_0xd0ee('0x28')](function(_0x3815d9){var _0x25a826=_[_0xd0ee('0x2d')](_0x3815d9,function(_0x51f8cb){return Number(_0x51f8cb[_0xd0ee('0x5b')]);});return db['UserVoiceQueue']['destroy']({'where':{'UserId':{'$in':_0x2c69c7},'VoiceQueueId':{'$in':_0x25a826}},'transaction':_0x535b1b});})[_0xd0ee('0x28')](function(){var _0x164524='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x6352db;return db['sequelize']['query'](_0x164524,{'type':db['Sequelize'][_0xd0ee('0x58')][_0xd0ee('0x59')],'raw':!![],'transaction':_0x535b1b});})[_0xd0ee('0x28')](function(_0x36d1fb){var _0x3579c9=_[_0xd0ee('0x2d')](_0x36d1fb,function(_0x30fc5e){return Number(_0x30fc5e[_0xd0ee('0x5c')]);});return db[_0xd0ee('0x5d')]['destroy']({'where':{'UserId':{'$in':_0x2c69c7},'MailQueueId':{'$in':_0x3579c9}},'transaction':_0x535b1b});})[_0xd0ee('0x28')](function(){var _0x197b0b='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x6352db;return db[_0xd0ee('0x56')][_0xd0ee('0x32')](_0x197b0b,{'type':db[_0xd0ee('0x57')]['QueryTypes'][_0xd0ee('0x59')],'raw':!![],'transaction':_0x535b1b});})[_0xd0ee('0x28')](function(_0x5a65d2){var _0x2c1f4c=_[_0xd0ee('0x2d')](_0x5a65d2,function(_0x2137f6){return Number(_0x2137f6[_0xd0ee('0x5e')]);});return db[_0xd0ee('0x5f')][_0xd0ee('0x60')]({'where':{'UserId':{'$in':_0x2c69c7},'SmsQueueId':{'$in':_0x2c1f4c}},'transaction':_0x535b1b});})[_0xd0ee('0x28')](function(){var _0x17ba42=_0xd0ee('0x61')+_0x6352db;return db['sequelize'][_0xd0ee('0x32')](_0x17ba42,{'type':db[_0xd0ee('0x57')][_0xd0ee('0x58')][_0xd0ee('0x59')],'raw':!![],'transaction':_0x535b1b});})[_0xd0ee('0x28')](function(_0x356bfe){var _0xabb51e=_[_0xd0ee('0x2d')](_0x356bfe,function(_0x380ac5){return Number(_0x380ac5[_0xd0ee('0x62')]);});return db['UserChatQueue']['destroy']({'where':{'UserId':{'$in':_0x2c69c7},'ChatQueueId':{'$in':_0xabb51e}},'transaction':_0x535b1b});})[_0xd0ee('0x28')](function(){var _0x27e5cc=_0xd0ee('0x63')+_0x6352db;return db['sequelize'][_0xd0ee('0x32')](_0x27e5cc,{'type':db['Sequelize'][_0xd0ee('0x58')][_0xd0ee('0x59')],'raw':!![],'transaction':_0x535b1b});})[_0xd0ee('0x28')](function(_0x583a71){var _0x16ef20=_['map'](_0x583a71,function(_0x2e799c){return Number(_0x2e799c['FaxQueueId']);});return db[_0xd0ee('0x64')]['destroy']({'where':{'UserId':{'$in':_0x2c69c7},'FaxQueueId':{'$in':_0x16ef20}},'transaction':_0x535b1b});})['then'](function(){var _0x14e34f=_0xd0ee('0x65')+_0x6352db;return db['sequelize'][_0xd0ee('0x32')](_0x14e34f,{'type':db[_0xd0ee('0x57')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x535b1b});})['then'](function(_0x2b8d7e){var _0x5e6861=_[_0xd0ee('0x2d')](_0x2b8d7e,function(_0x399bf5){return Number(_0x399bf5[_0xd0ee('0x66')]);});return db[_0xd0ee('0x67')][_0xd0ee('0x60')]({'where':{'UserId':{'$in':_0x2c69c7},'OpenchannelQueueId':{'$in':_0x5e6861}},'transaction':_0x535b1b});})[_0xd0ee('0x28')](function(){var _0x1a6ac6='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0x6352db;return db[_0xd0ee('0x56')][_0xd0ee('0x32')](_0x1a6ac6,{'type':db['Sequelize'][_0xd0ee('0x58')][_0xd0ee('0x59')],'raw':!![],'transaction':_0x535b1b});})[_0xd0ee('0x28')](function(_0x1ad216){var _0x3af838=_['map'](_0x1ad216,function(_0xf6e84b){return Number(_0xf6e84b[_0xd0ee('0x68')]);});return db['UserWhatsappQueue'][_0xd0ee('0x60')]({'where':{'UserId':{'$in':_0x2c69c7},'WhatsappQueueId':{'$in':_0x3af838}},'transaction':_0x535b1b});})['then'](function(){return db['TeamVoicePrefix'][_0xd0ee('0x50')]({'where':{'TeamId':_0x6352db}});})[_0xd0ee('0x28')](function(_0x39038c){if(_0x39038c===null){return;}return db[_0xd0ee('0x69')]['destroy']({'where':{'UserId':{'$in':_0x2c69c7},'VoicePrefixId':_0x39038c[_0xd0ee('0x6a')]},'transaction':_0x535b1b});})[_0xd0ee('0x28')](function(){return db['Team'][_0xd0ee('0x60')]({'where':{'id':_0x6352db},'cascade':!![],'transaction':_0x535b1b});})[_0xd0ee('0x28')](function(_0x9b1f2c){if(_0x9b1f2c===0x0){_0x220d55[_0xd0ee('0x1b')](0x194);}else{return db[_0xd0ee('0x53')][_0xd0ee('0x60')]({'where':{'type':_0xd0ee('0x4e'),'resourceId':_0x6352db},'cascade':!![],'transaction':_0x535b1b})['then'](function(){_0x220d55['status'](0xcc)[_0xd0ee('0x6b')]();});}})[_0xd0ee('0x43')](function(_0x1d60d7){_0x220d55[_0xd0ee('0x1c')](0x1f4)[_0xd0ee('0x6c')](_0x1d60d7);});});};exports[_0xd0ee('0x6d')]=function(_0xd080df,_0x325e69,_0x4948c2){return db['Team']['findOne']({'where':{'id':_0xd080df[_0xd0ee('0x45')]['id']}})[_0xd0ee('0x28')](handleEntityNotFound(_0x325e69,null))[_0xd0ee('0x28')](function(_0x51e644){if(!_0xd080df['query']['channel']||!utils[_0xd0ee('0x6e')](_0xd080df[_0xd0ee('0x32')][_0xd0ee('0x6f')])){throw new db[(_0xd0ee('0x57'))][(_0xd0ee('0x70'))](_0xd0ee('0x71'));}var _0x31136b={};var _0x5b31c2={};_0x5b31c2[_0xd0ee('0x31')]=_[_0xd0ee('0x46')](db[_[_0xd0ee('0x72')](_0xd080df[_0xd0ee('0x32')][_0xd0ee('0x6f')]['toLowerCase']())+_0xd0ee('0x73')][_0xd0ee('0x2f')]);_0x5b31c2[_0xd0ee('0x32')]=_[_0xd0ee('0x46')](_0xd080df['query']);_0x5b31c2['filters']=_['intersection'](_0x5b31c2['model'],_0x5b31c2[_0xd0ee('0x32')]);_0x31136b[_0xd0ee('0x33')]=_['intersection'](_0x5b31c2[_0xd0ee('0x31')],qs[_0xd0ee('0x35')](_0xd080df[_0xd0ee('0x32')][_0xd0ee('0x35')]));_0x31136b['attributes']=_0x31136b[_0xd0ee('0x33')][_0xd0ee('0x74')]?_0x31136b[_0xd0ee('0x33')]:_0x5b31c2[_0xd0ee('0x31')];_0x31136b[_0xd0ee('0x20')]=qs[_0xd0ee('0x20')](_0xd080df[_0xd0ee('0x32')][_0xd0ee('0x20')]);_0x31136b[_0xd0ee('0x1e')]=qs[_0xd0ee('0x1e')](_0xd080df[_0xd0ee('0x32')][_0xd0ee('0x1e')]);_0x31136b['order']=qs[_0xd0ee('0x38')](_0xd080df[_0xd0ee('0x32')]['sort']);_0x31136b[_0xd0ee('0x39')]=qs[_0xd0ee('0x3a')](_['pick'](_0xd080df[_0xd0ee('0x32')],_0x5b31c2[_0xd0ee('0x3a')]));_0x31136b=_[_0xd0ee('0x3d')]({},_0x31136b,_0xd080df[_0xd0ee('0x3f')]);return _0x51e644[_0xd0ee('0x4d')+_[_0xd0ee('0x72')](_0xd080df[_0xd0ee('0x32')][_0xd0ee('0x6f')][_0xd0ee('0x75')]())+_0xd0ee('0x76')](_0x31136b);})[_0xd0ee('0x28')](respondWithResult(_0x325e69,null))[_0xd0ee('0x43')](handleError(_0x325e69,null));};exports[_0xd0ee('0x77')]=function(_0x5a200f,_0x12eacd,_0x371d9d){return db[_0xd0ee('0x2e')]['findOne']({'where':{'id':_0x5a200f[_0xd0ee('0x45')]['id']}})[_0xd0ee('0x28')](function(_0x413fa1){if(_0x413fa1){if(!_0x5a200f[_0xd0ee('0x49')][_0xd0ee('0x6f')]||!utils[_0xd0ee('0x6e')](_0x5a200f[_0xd0ee('0x49')][_0xd0ee('0x6f')])){throw new db[(_0xd0ee('0x57'))][(_0xd0ee('0x70'))](_0xd0ee('0x71'));}return _0x413fa1[_0xd0ee('0x78')+_[_0xd0ee('0x72')](_0x5a200f[_0xd0ee('0x49')]['channel']['toLowerCase']())+'Queues'](_0x5a200f[_0xd0ee('0x49')]['ids']);}return null;})[_0xd0ee('0x28')](handleEntityNotFound(_0x12eacd,null))['then'](respondWithStatusCode(_0x12eacd,null))[_0xd0ee('0x43')](handleError(_0x12eacd,null));};exports[_0xd0ee('0x79')]=function(_0x121db9,_0x1fb8a2,_0x8970e9){return db[_0xd0ee('0x2e')]['findOne']({'where':{'id':_0x121db9[_0xd0ee('0x45')]['id']}})[_0xd0ee('0x28')](function(_0x2085d9){if(_0x2085d9){if(!_0x121db9[_0xd0ee('0x32')]['channel']||!utils[_0xd0ee('0x6e')](_0x121db9[_0xd0ee('0x32')]['channel'])){throw new db[(_0xd0ee('0x57'))][(_0xd0ee('0x70'))](_0xd0ee('0x71'));}return _0x2085d9[_0xd0ee('0x7a')+_['capitalize'](_0x121db9[_0xd0ee('0x32')]['channel'][_0xd0ee('0x75')]())+_0xd0ee('0x76')](_0x121db9[_0xd0ee('0x32')][_0xd0ee('0x7b')]);}return null;})['then'](handleEntityNotFound(_0x1fb8a2,null))[_0xd0ee('0x28')](respondWithStatusCode(_0x1fb8a2,null))[_0xd0ee('0x43')](handleError(_0x1fb8a2,null));};exports[_0xd0ee('0x7c')]=function(_0x506a83,_0x3c3693){var _0x30e7e0=_['isArray'](_0x506a83[_0xd0ee('0x49')]['ids'])?_0x506a83[_0xd0ee('0x49')]['ids']:[_0x506a83['body']['ids']];var _0x297299=_0x506a83['params']['id'];return db[_0xd0ee('0x2e')][_0xd0ee('0x50')]({'where':{'id':_0x297299}})['then'](handleEntityNotFound(_0x3c3693,null))[_0xd0ee('0x28')](function(_0x59d702){if(_0x59d702){var _0x34812b=['Voice',_0xd0ee('0x7d'),_0xd0ee('0x7e'),_0xd0ee('0x7f'),_0xd0ee('0x80'),_0xd0ee('0x81'),_0xd0ee('0x82')];return db['sequelize'][_0xd0ee('0x54')](function(_0x1f1111){var _0x5d1585=_[_0xd0ee('0x2d')](_0x34812b,function(_0x44ae68){var _0x3bc2c6={'attributes':['id','name']};if(_0x44ae68===_0xd0ee('0x83')){_0x3bc2c6[_0xd0ee('0x84')]={'attributes':['penalty']};}return _0x59d702[_0xd0ee('0x4d')+_0x44ae68+_0xd0ee('0x76')](_0x3bc2c6)[_0xd0ee('0x28')](function(_0x572969){var _0x59bff6=_['map'](_0x572969,function(_0x28a17a){var _0x2afc59=_['map'](_0x30e7e0,function(_0x1647c5){var _0x306692={'where':{'UserId':_0x1647c5,[_0x44ae68+_0xd0ee('0x85')]:_0x28a17a['id']},'transaction':_0x1f1111};if(_0x44ae68===_0xd0ee('0x83')){_0x306692[_0xd0ee('0x15')]={'penalty':_0x28a17a['TeamVoiceQueue']['penalty']};}return db[_0xd0ee('0x86')+_0x44ae68+_0xd0ee('0x73')][_0xd0ee('0x87')](_0x306692)['then'](function(){socket[_0xd0ee('0x88')](_0xd0ee('0x4c')+_0x44ae68+_0xd0ee('0x89'),{'UserId':_0x1647c5,[_0x44ae68+_0xd0ee('0x85')]:_0x28a17a['id']});if(_0x44ae68!==_0xd0ee('0x83')){return;}return db['User'][_0xd0ee('0x41')]({'where':{'id':_0x30e7e0,'online':0x1},'attributes':['id',_0xd0ee('0x2b'),_0xd0ee('0x8a'),_0xd0ee('0x8b'),'interface'],'raw':!![]})['then'](function(_0x539903){var _0x3c7d02=_[_0xd0ee('0x2d')](_0x539903,function(_0x36cae3){return db[_0xd0ee('0x8c')]['upsert']({'membername':_0x36cae3[_0xd0ee('0x2b')],'UserId':_0x36cae3['id'],'queue_name':_0x28a17a[_0xd0ee('0x2b')],'VoiceQueueId':_0x28a17a['id'],'interface':_['isNil'](_0x36cae3['interface'])?util['format'](_0xd0ee('0x8d'),_0x36cae3['name']):_0x36cae3[_0xd0ee('0x8e')],'paused':_0x36cae3[_0xd0ee('0x8b')]||![],'penalty':_0x28a17a[_0xd0ee('0x8f')][_0xd0ee('0x90')]},{'transaction':_0x1f1111});});return Promise['all'](_0x3c7d02);});});});return Promise[_0xd0ee('0x91')](_0x2afc59);});return Promise['all'](_0x59bff6);})['then'](function(){return db[_0xd0ee('0x92')][_0xd0ee('0x93')]({'where':{'teamId':_0x297299}})[_0xd0ee('0x28')](function(_0x153737){if(_0x153737){var _0x4b4448=_['map'](_0x30e7e0,function(_0x3cf30d){db['UserVoicePrefix'][_0xd0ee('0x94')]({'UserId':_0x3cf30d,'VoicePrefixId':_0x153737['VoicePrefixId']});});return Promise[_0xd0ee('0x91')](_0x4b4448);}});});});return Promise['all'](_0x5d1585)[_0xd0ee('0x28')](function(){return _0x59d702[_0xd0ee('0x7c')](_0x30e7e0,{'transaction':_0x1f1111})[_0xd0ee('0x95')](function(_0x5acc16){return _0x5acc16;});});});}})['then'](respondWithResult(_0x3c3693,null))[_0xd0ee('0x43')](handleError(_0x3c3693,null));};exports[_0xd0ee('0x96')]=function(_0xb94f2c,_0x5cc99e){var _0x4b398c=_['isArray'](_0xb94f2c[_0xd0ee('0x32')][_0xd0ee('0x7b')])?_0xb94f2c['query'][_0xd0ee('0x7b')]:[_0xb94f2c['query'][_0xd0ee('0x7b')]];var _0x334e8c=_0xb94f2c[_0xd0ee('0x45')]['id'];return db['Team']['find']({'where':{'id':_0x334e8c}})[_0xd0ee('0x28')](handleEntityNotFound(_0x5cc99e,null))['then'](function(_0x50be64){if(_0x50be64){var _0x306759=['Voice',_0xd0ee('0x7d'),'Mail',_0xd0ee('0x7f'),_0xd0ee('0x80'),_0xd0ee('0x81'),_0xd0ee('0x82')];return db[_0xd0ee('0x56')][_0xd0ee('0x54')](function(_0x55fb71){var _0x381bea=_[_0xd0ee('0x2d')](_0x306759,function(_0x21391f){var _0x1cd972={'attributes':['id',_0xd0ee('0x2b')]};return _0x50be64['get'+_0x21391f+_0xd0ee('0x76')](_0x1cd972)[_0xd0ee('0x28')](function(_0x19d6df){var _0x8dd4ee=_[_0xd0ee('0x2d')](_0x19d6df,function(_0x2d0e29){return _0x2d0e29['removeAgents'](_0x4b398c,{'transaction':_0x55fb71})['then'](function(){var _0x189f83=_['map'](_0x4b398c,function(_0x18317d){socket[_0xd0ee('0x88')](_0xd0ee('0x4c')+_0x21391f+_0xd0ee('0x97'),{'UserId':Number(_0x18317d),[_0x21391f+_0xd0ee('0x85')]:_0x2d0e29['id']});if(_0x21391f!==_0xd0ee('0x83')){return;}return db[_0xd0ee('0x8c')][_0xd0ee('0x60')]({'where':{'VoiceQueueId':_0x2d0e29['id'],'UserId':_0x18317d},'transaction':_0x55fb71});});return Promise[_0xd0ee('0x91')](_0x189f83);});});return Promise['all'](_0x8dd4ee);});});return Promise[_0xd0ee('0x91')](_0x381bea)[_0xd0ee('0x28')](function(){return _0x50be64['removeAgents'](_0x4b398c,{'transaction':_0x55fb71});})['then'](function(){return db[_0xd0ee('0x92')][_0xd0ee('0x93')]({'where':{'teamId':_0x334e8c}})[_0xd0ee('0x28')](function(_0x2d0dbf){if(_0x2d0dbf){var _0x3a8ae5=_[_0xd0ee('0x2d')](_0x4b398c,function(_0x2e3065){db[_0xd0ee('0x69')][_0xd0ee('0x60')]({'where':{'UserId':_0x2e3065,'VoicePrefixId':_0x2d0dbf[_0xd0ee('0x6a')]}});});return Promise['all'](_0x3a8ae5);}});});});}})[_0xd0ee('0x28')](respondWithStatusCode(_0x5cc99e,null))['catch'](handleError(_0x5cc99e,null));};exports[_0xd0ee('0x98')]=function(_0x1d9e39,_0x113a9e,_0x10948c){var _0x1e04d6={};var _0x8ab5ac={};var _0xb508e9;var _0x5c929e;return db[_0xd0ee('0x2e')][_0xd0ee('0x93')]({'where':{'id':_0x1d9e39[_0xd0ee('0x45')]['id']}})[_0xd0ee('0x28')](handleEntityNotFound(_0x113a9e,null))['then'](function(_0x1a5952){if(_0x1a5952){_0xb508e9=_0x1a5952;_0x8ab5ac[_0xd0ee('0x31')]=_['keys'](db[_0xd0ee('0x86')][_0xd0ee('0x2f')]);_0x8ab5ac['query']=_['keys'](_0x1d9e39[_0xd0ee('0x32')]);_0x8ab5ac[_0xd0ee('0x3a')]=_['intersection'](_0x8ab5ac[_0xd0ee('0x31')],_0x8ab5ac[_0xd0ee('0x32')]);_0x1e04d6[_0xd0ee('0x33')]=_[_0xd0ee('0x34')](_0x8ab5ac['model'],qs[_0xd0ee('0x35')](_0x1d9e39[_0xd0ee('0x32')][_0xd0ee('0x35')]));_0x1e04d6[_0xd0ee('0x33')]=_0x1e04d6[_0xd0ee('0x33')][_0xd0ee('0x74')]?_0x1e04d6[_0xd0ee('0x33')]:_0x8ab5ac['model'];_0x1e04d6[_0xd0ee('0x37')]=qs[_0xd0ee('0x38')](_0x1d9e39[_0xd0ee('0x32')][_0xd0ee('0x38')]);_0x1e04d6[_0xd0ee('0x39')]=qs[_0xd0ee('0x3a')](_[_0xd0ee('0x3b')](_0x1d9e39[_0xd0ee('0x32')],_0x8ab5ac[_0xd0ee('0x3a')]));if(_0x1d9e39[_0xd0ee('0x32')][_0xd0ee('0x3c')]){_0x1e04d6[_0xd0ee('0x39')]=_[_0xd0ee('0x3d')](_0x1e04d6['where'],{'$or':_[_0xd0ee('0x2d')](_0x1e04d6[_0xd0ee('0x33')],function(_0x2bb5eb){var _0x1dd683={};_0x1dd683[_0x2bb5eb]={'$like':'%'+_0x1d9e39[_0xd0ee('0x32')][_0xd0ee('0x3c')]+'%'};return _0x1dd683;})});}_0x1e04d6=_[_0xd0ee('0x3d')]({},_0x1e04d6,_0x1d9e39[_0xd0ee('0x3f')]);return _0xb508e9[_0xd0ee('0x98')](_0x1e04d6);}})['then'](function(_0x49e34f){if(_0x49e34f){_0x5c929e=_0x49e34f['length'];if(!_0x1d9e39['query'][_0xd0ee('0x99')](_0xd0ee('0x36'))){_0x1e04d6[_0xd0ee('0x20')]=qs['limit'](_0x1d9e39[_0xd0ee('0x32')]['limit']);_0x1e04d6[_0xd0ee('0x1e')]=qs[_0xd0ee('0x1e')](_0x1d9e39[_0xd0ee('0x32')][_0xd0ee('0x1e')]);}return _0xb508e9[_0xd0ee('0x98')](_0x1e04d6);}})['then'](function(_0x9824a2){if(_0x9824a2){return _0x9824a2?{'count':_0x5c929e,'rows':_0x9824a2}:null;}})['then'](respondWithResult(_0x113a9e,null))['catch'](handleError(_0x113a9e,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index a5af1a9..a337aa3 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 _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 +var _0x316f=['emit','hasOwnProperty','events','../../mysqldb','Team','setMaxListeners','save','remove'];(function(_0xa9b632,_0xa63f62){var _0x199708=function(_0x2c25e8){while(--_0x2c25e8){_0xa9b632['push'](_0xa9b632['shift']());}};_0x199708(++_0xa63f62);}(_0x316f,0x142));var _0xf316=function(_0x220a5f,_0x2d0b9f){_0x220a5f=_0x220a5f-0x0;var _0x3a05a9=_0x316f[_0x220a5f];return _0x3a05a9;};'use strict';var EventEmitter=require(_0xf316('0x0'));var Team=require(_0xf316('0x1'))['db'][_0xf316('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0xf316('0x3')](0x0);var events={'afterCreate':_0xf316('0x4'),'afterUpdate':'update','afterDestroy':_0xf316('0x5')};function emitEvent(_0x12c357){return function(_0x3174be,_0x321b90,_0x51c478){TeamEvents[_0xf316('0x6')](_0x12c357+':'+_0x3174be['id'],_0x3174be);TeamEvents[_0xf316('0x6')](_0x12c357,_0x3174be);_0x51c478(null);};}for(var e in events){if(events[_0xf316('0x7')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 133eb2c..056e083 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 _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 +var _0xf059=['Fax','Mail','Openchannel','Sms','Voice','Whatsapp','resolve','then','all','lodash','./team.attributes','get','Queues','map','setDataValue','channel','catch','exports','define','teams'];(function(_0x441dd4,_0x582db9){var _0x54ea8b=function(_0x308f42){while(--_0x308f42){_0x441dd4['push'](_0x441dd4['shift']());}};_0x54ea8b(++_0x582db9);}(_0xf059,0x1c1));var _0x9f05=function(_0x38abab,_0x5614b6){_0x38abab=_0x38abab-0x0;var _0x1d2ca3=_0xf059[_0x38abab];return _0x1d2ca3;};'use strict';var _=require(_0x9f05('0x0'));var attributes=require(_0x9f05('0x1'));function getQueuesByChannel(_0x3abb4c,_0x1b4f42){var _0x3e8d23=_0x9f05('0x2')+_0x1b4f42+_0x9f05('0x3');return _0x3abb4c[_0x3e8d23]()['then'](function(_0x6b8bcd){return _[_0x9f05('0x4')](_0x6b8bcd,function(_0x3b017f){_0x3b017f[_0x9f05('0x5')](_0x9f05('0x6'),_0x1b4f42);return _0x3b017f;});})[_0x9f05('0x7')](function(_0x4c18b3){throw _0x4c18b3;});}module[_0x9f05('0x8')]=function(_0x5acc93){return _0x5acc93[_0x9f05('0x9')]('Team',attributes,{'tableName':_0x9f05('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x91e530=this;var _0x34c199=['Chat',_0x9f05('0xb'),_0x9f05('0xc'),_0x9f05('0xd'),_0x9f05('0xe'),_0x9f05('0xf'),_0x9f05('0x10')];return Promise[_0x9f05('0x11')]()[_0x9f05('0x12')](function(){var _0x3d3506=_[_0x9f05('0x4')](_0x34c199,function(_0x9411b9){return getQueuesByChannel(_0x91e530,_0x9411b9);});return Promise[_0x9f05('0x13')](_0x3d3506);})[_0x9f05('0x7')](function(_0x383d16){throw _0x383d16;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 8200491..9e4bdbf 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 _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 +var _0x67fd=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','redis','localhost','socket.io-emitter','./team.socket','register','info','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','code','error','Team,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring'];(function(_0x2e8ae9,_0x3b74e1){var _0x2dd758=function(_0x11b5a1){while(--_0x11b5a1){_0x2e8ae9['push'](_0x2e8ae9['shift']());}};_0x2dd758(++_0x3b74e1);}(_0x67fd,0x7a));var _0xd67f=function(_0x374f78,_0x18b217){_0x374f78=_0x374f78-0x0;var _0x4a6019=_0x67fd[_0x374f78];return _0x4a6019;};'use strict';var _=require(_0xd67f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd67f('0x1'));var rs=require(_0xd67f('0x2'));var fs=require('fs');var Redis=require(_0xd67f('0x3'));var db=require(_0xd67f('0x4'))['db'];var utils=require(_0xd67f('0x5'));var logger=require(_0xd67f('0x6'))(_0xd67f('0x7'));var config=require('../../config/environment');var jayson=require(_0xd67f('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0xd67f('0x9')]=_['defaults'](config[_0xd67f('0x9')],{'host':_0xd67f('0xa'),'port':0x18eb});var socket=require(_0xd67f('0xb'))(new Redis(config[_0xd67f('0x9')]));require(_0xd67f('0xc'))[_0xd67f('0xd')](socket);function respondWithRpcPromise(_0x20a6c8,_0x599a38,_0x25b4d3){return new BPromise(function(_0x36b82f,_0x2bea8e){return client['request'](_0x20a6c8,_0x25b4d3)['then'](function(_0x1f9a95){logger[_0xd67f('0xe')]('Team,\x20%s,\x20%s',_0x599a38,_0xd67f('0xf'));logger[_0xd67f('0x10')](_0xd67f('0x11'),_0x599a38,_0xd67f('0xf'),JSON[_0xd67f('0x12')](_0x1f9a95));if(_0x1f9a95['error']){if(_0x1f9a95['error'][_0xd67f('0x13')]===0x1f4){logger[_0xd67f('0x14')](_0xd67f('0x15'),_0x599a38,_0x1f9a95[_0xd67f('0x14')][_0xd67f('0x16')]);return _0x2bea8e(_0x1f9a95[_0xd67f('0x14')]['message']);}logger['error'](_0xd67f('0x15'),_0x599a38,_0x1f9a95[_0xd67f('0x14')][_0xd67f('0x16')]);return _0x36b82f(_0x1f9a95[_0xd67f('0x14')][_0xd67f('0x16')]);}else{logger[_0xd67f('0xe')](_0xd67f('0x15'),_0x599a38,_0xd67f('0xf'));_0x36b82f(_0x1f9a95[_0xd67f('0x17')][_0xd67f('0x16')]);}})[_0xd67f('0x18')](function(_0x150709){logger[_0xd67f('0x14')](_0xd67f('0x15'),_0x599a38,_0x150709);_0x2bea8e(_0x150709);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 9ec98e5..345f22f 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 _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 +var _0xab7f=['remove','update','emit','register','length','team:','./team.events','save'];(function(_0x87a9e9,_0x48c5f3){var _0x34aafa=function(_0x5f114f){while(--_0x5f114f){_0x87a9e9['push'](_0x87a9e9['shift']());}};_0x34aafa(++_0x48c5f3);}(_0xab7f,0xa6));var _0xfab7=function(_0x25e634,_0x214a83){_0x25e634=_0x25e634-0x0;var _0x1949a4=_0xab7f[_0x25e634];return _0x1949a4;};'use strict';var TeamEvents=require(_0xfab7('0x0'));var events=[_0xfab7('0x1'),_0xfab7('0x2'),_0xfab7('0x3')];function createListener(_0x22a471,_0x4e1b3d){return function(_0x7693da){_0x4e1b3d[_0xfab7('0x4')](_0x22a471,_0x7693da);};}function removeListener(_0x233cd9,_0x1e13c6){return function(){TeamEvents['removeListener'](_0x233cd9,_0x1e13c6);};}exports[_0xfab7('0x5')]=function(_0x1213a8){for(var _0x5cde2d=0x0,_0x704224=events[_0xfab7('0x6')];_0x5cde2d<_0x704224;_0x5cde2d++){var _0x40610b=events[_0x5cde2d];var _0x2025c9=createListener(_0xfab7('0x7')+_0x40610b,_0x1213a8);TeamEvents['on'](_0x40610b,_0x2025c9);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 4748a08..3acebea 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 _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 +var _0xf089=['exports','INTEGER'];(function(_0x517a92,_0x3fa156){var _0x9193c9=function(_0x51464d){while(--_0x51464d){_0x517a92['push'](_0x517a92['shift']());}};_0x9193c9(++_0x3fa156);}(_0xf089,0xba));var _0x9f08=function(_0x2d35cf,_0x5bae94){_0x2d35cf=_0x2d35cf-0x0;var _0x41aba9=_0xf089[_0x2d35cf];return _0x41aba9;};'use strict';var Sequelize=require('sequelize');module[_0x9f08('0x0')]={'TeamId':{'type':Sequelize[_0x9f08('0x1')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index a7be661..124e8c5 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 _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 +var _0xd547=['define','../../config/logger','api','moment','bluebird','rimraf','./teamVoicePrefix.attributes'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xd547,0x1c1));var _0x7d54=function(_0x26d016,_0x14d83d){_0x26d016=_0x26d016-0x0;var _0x14bdbb=_0xd547[_0x26d016];return _0x14bdbb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7d54('0x0'))(_0x7d54('0x1'));var moment=require(_0x7d54('0x2'));var BPromise=require(_0x7d54('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7d54('0x4'));var config=require('../../config/environment');var attributes=require(_0x7d54('0x5'));module['exports']=function(_0x296dd6,_0x37defc){return _0x296dd6[_0x7d54('0x6')]('TeamVoicePrefix',attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index cb228e8..3bbb3fc 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 _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 +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x295c78,_0x18e670){var _0x2c8a5c=function(_0x4d9f47){while(--_0x4d9f47){_0x295c78['push'](_0x295c78['shift']());}};_0x2c8a5c(++_0x18e670);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2ca2d0,_0x3ea8e4){_0x2ca2d0=_0x2ca2d0-0x0;var _0x521c23=_0xcb91[_0x2ca2d0];return _0x521c23;};'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 2b366bf..5c966b6 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 _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 +var _0x02b2=['INTEGER','exports'];(function(_0x493dda,_0x1528d3){var _0x31a5a6=function(_0x43c676){while(--_0x43c676){_0x493dda['push'](_0x493dda['shift']());}};_0x31a5a6(++_0x1528d3);}(_0x02b2,0x83));var _0x202b=function(_0x1bcb09,_0x197ba9){_0x1bcb09=_0x1bcb09-0x0;var _0x3d4808=_0x02b2[_0x1bcb09];return _0x3d4808;};'use strict';var Sequelize=require('sequelize');module[_0x202b('0x0')]={'penalty':{'type':Sequelize[_0x202b('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 6a13dfc..f3f7855 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 _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 +var _0xb492=['path','rimraf','../../config/environment','./teamVoiceQueue.attributes','define','TeamVoiceQueue','team_has_voice_queues','util','../../config/logger','api','moment'];(function(_0x5179cc,_0x18948b){var _0x3831b4=function(_0x223c0e){while(--_0x223c0e){_0x5179cc['push'](_0x5179cc['shift']());}};_0x3831b4(++_0x18948b);}(_0xb492,0x172));var _0x2b49=function(_0x178988,_0x5df058){_0x178988=_0x178988-0x0;var _0x1566fd=_0xb492[_0x178988];return _0x1566fd;};'use strict';var _=require('lodash');var util=require(_0x2b49('0x0'));var logger=require(_0x2b49('0x1'))(_0x2b49('0x2'));var moment=require(_0x2b49('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2b49('0x4'));var rimraf=require(_0x2b49('0x5'));var config=require(_0x2b49('0x6'));var attributes=require(_0x2b49('0x7'));module['exports']=function(_0x53508a,_0x346359){return _0x53508a[_0x2b49('0x8')](_0x2b49('0x9'),attributes,{'tableName':_0x2b49('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 d795a05..3badfe0 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 _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 +var _0xc560=['message','info','result','catch','lodash','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x1a8834,_0x3281b5){var _0x1ea277=function(_0x5ce10b){while(--_0x5ce10b){_0x1a8834['push'](_0x1a8834['shift']());}};_0x1ea277(++_0x3281b5);}(_0xc560,0x82));var _0x0c56=function(_0x5b5669,_0x130bd3){_0x5b5669=_0x5b5669-0x0;var _0x26d1fc=_0xc560[_0x5b5669];return _0x26d1fc;};'use strict';var _=require(_0x0c56('0x0'));var util=require('util');var moment=require(_0x0c56('0x1'));var BPromise=require('bluebird');var rs=require(_0x0c56('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0c56('0x3'));var logger=require(_0x0c56('0x4'))(_0x0c56('0x5'));var config=require(_0x0c56('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x0c56('0x7')][_0x0c56('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x35b4ee,_0x1245b3,_0x501a0b){return new BPromise(function(_0x429ad1,_0x4f5a47){return client[_0x0c56('0x9')](_0x35b4ee,_0x501a0b)[_0x0c56('0xa')](function(_0x2c1669){logger['info'](_0x0c56('0xb'),_0x1245b3,_0x0c56('0xc'));logger[_0x0c56('0xd')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x1245b3,_0x0c56('0xc'),JSON[_0x0c56('0xe')](_0x2c1669));if(_0x2c1669[_0x0c56('0xf')]){if(_0x2c1669[_0x0c56('0xf')][_0x0c56('0x10')]===0x1f4){logger[_0x0c56('0xf')](_0x0c56('0xb'),_0x1245b3,_0x2c1669['error']['message']);return _0x4f5a47(_0x2c1669[_0x0c56('0xf')][_0x0c56('0x11')]);}logger[_0x0c56('0xf')](_0x0c56('0xb'),_0x1245b3,_0x2c1669[_0x0c56('0xf')][_0x0c56('0x11')]);return _0x429ad1(_0x2c1669['error'][_0x0c56('0x11')]);}else{logger[_0x0c56('0x12')](_0x0c56('0xb'),_0x1245b3,_0x0c56('0xc'));_0x429ad1(_0x2c1669[_0x0c56('0x13')]['message']);}})[_0x0c56('0x14')](function(_0x5df4cd){logger['error'](_0x0c56('0xb'),_0x1245b3,_0x5df4cd);_0x4f5a47(_0x5df4cd);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index a085eea..d43b131 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 _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 +var _0x1122=['delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','/:id','show','post','create','put','update'];(function(_0x5eaef1,_0x5e46aa){var _0x4f9e71=function(_0x254bcd){while(--_0x254bcd){_0x5eaef1['push'](_0x5eaef1['shift']());}};_0x4f9e71(++_0x5e46aa);}(_0x1122,0xac));var _0x2112=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1122[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x2112('0x0'));var util=require('util');var path=require(_0x2112('0x1'));var timeout=require(_0x2112('0x2'));var express=require(_0x2112('0x3'));var router=express[_0x2112('0x4')]();var fs_extra=require(_0x2112('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2112('0x6'));var controller=require('./template.controller');router[_0x2112('0x7')]('/',auth[_0x2112('0x8')](),controller['index']);router[_0x2112('0x7')](_0x2112('0x9'),auth[_0x2112('0x8')](),controller[_0x2112('0xa')]);router[_0x2112('0xb')]('/',auth[_0x2112('0x8')](),controller[_0x2112('0xc')]);router[_0x2112('0xd')](_0x2112('0x9'),auth['isAuthenticated'](),controller[_0x2112('0xe')]);router[_0x2112('0xf')](_0x2112('0x9'),auth[_0x2112('0x8')](),controller['destroy']);module[_0x2112('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 9ab8595..829d626 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 _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 +var _0x753b=['sequelize','STRING','TEXT'];(function(_0x422ce9,_0x42738e){var _0xd23934=function(_0x131bb4){while(--_0x131bb4){_0x422ce9['push'](_0x422ce9['shift']());}};_0xd23934(++_0x42738e);}(_0x753b,0xf0));var _0xb753=function(_0x2cb3eb,_0x4d83aa){_0x2cb3eb=_0x2cb3eb-0x0;var _0x2759ee=_0x753b[_0x2cb3eb];return _0x2759ee;};'use strict';var Sequelize=require(_0xb753('0x0'));module['exports']={'name':{'type':Sequelize[_0xb753('0x1')]},'description':{'type':Sequelize[_0xb753('0x1')]},'html':{'type':Sequelize[_0xb753('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index c734f1e..4e2c544 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 _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 +var _0x9094=['save','update','then','destroy','Templates','UserProfileResource','end','stack','name','send','map','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','Template','includeAll','findAll','rows','catch','show','params','include','create','body','user','role','get','find','userProfileId','autoAssociation','error','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','apply','reject'];(function(_0x38a6cf,_0x4714ab){var _0x21b138=function(_0x1208a6){while(--_0x1208a6){_0x38a6cf['push'](_0x38a6cf['shift']());}};_0x21b138(++_0x4714ab);}(_0x9094,0xd0));var _0x4909=function(_0x475bf2,_0x34f402){_0x475bf2=_0x475bf2-0x0;var _0x228b54=_0x9094[_0x475bf2];return _0x228b54;};'use strict';var emlformat=require(_0x4909('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4909('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4909('0x2'));var moment=require(_0x4909('0x3'));var BPromise=require(_0x4909('0x4'));var Mustache=require(_0x4909('0x5'));var util=require('util');var path=require(_0x4909('0x6'));var sox=require(_0x4909('0x7'));var csv=require(_0x4909('0x8'));var ejs=require(_0x4909('0x9'));var fs=require('fs');var fs_extra=require(_0x4909('0xa'));var _=require('lodash');var squel=require(_0x4909('0xb'));var crypto=require('crypto');var jsforce=require(_0x4909('0xc'));var deskjs=require(_0x4909('0xd'));var toCsv=require(_0x4909('0x8'));var querystring=require(_0x4909('0xe'));var Papa=require(_0x4909('0xf'));var Redis=require(_0x4909('0x10'));var authService=require(_0x4909('0x11'));var qs=require(_0x4909('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4909('0x13'));var logger=require(_0x4909('0x14'))(_0x4909('0x15'));var utils=require('../../config/utils');var config=require(_0x4909('0x16'));var licenseUtil=require(_0x4909('0x17'));var db=require(_0x4909('0x18'))['db'];function respondWithStatusCode(_0x3f1032,_0x167508){_0x167508=_0x167508||0xcc;return function(_0x241b51){if(_0x241b51){return _0x3f1032[_0x4909('0x19')](_0x167508);}return _0x3f1032['status'](_0x167508)['end']();};}function respondWithResult(_0x5e9498,_0x2582da){_0x2582da=_0x2582da||0xc8;return function(_0x1bc68a){if(_0x1bc68a){return _0x5e9498[_0x4909('0x1a')](_0x2582da)[_0x4909('0x1b')](_0x1bc68a);}};}function respondWithFilteredResult(_0x297d0b,_0x5c427b){return function(_0x2d7c8c){if(_0x2d7c8c){var _0x3c83be=typeof _0x5c427b['offset']===_0x4909('0x1c')&&typeof _0x5c427b[_0x4909('0x1d')]===_0x4909('0x1c');var _0x25ea16=_0x2d7c8c['count'];var _0x291b77=_0x3c83be?0x0:_0x5c427b['offset'];var _0x5b0ee0=_0x3c83be?_0x2d7c8c[_0x4909('0x1e')]:_0x5c427b[_0x4909('0x1f')]+_0x5c427b['limit'];var _0x3fdf44;if(_0x5b0ee0>=_0x25ea16){_0x5b0ee0=_0x25ea16;_0x3fdf44=0xc8;}else{_0x3fdf44=0xce;}_0x297d0b[_0x4909('0x1a')](_0x3fdf44);return _0x297d0b[_0x4909('0x20')]('Content-Range',_0x291b77+'-'+_0x5b0ee0+'/'+_0x25ea16)[_0x4909('0x1b')](_0x2d7c8c);}return null;};}function patchUpdates(_0x5a3ec7){return function(_0x46d105){try{jsonpatch[_0x4909('0x21')](_0x46d105,_0x5a3ec7,!![]);}catch(_0x582ebf){return BPromise[_0x4909('0x22')](_0x582ebf);}return _0x46d105[_0x4909('0x23')]();};}function saveUpdates(_0x3561ae,_0x9678bd){return function(_0x349252){if(_0x349252){return _0x349252[_0x4909('0x24')](_0x3561ae)[_0x4909('0x25')](function(_0x100db6){return _0x100db6;});}return null;};}function removeEntity(_0x10a169,_0x4ae9a1){return function(_0x2dedce){if(_0x2dedce){return _0x2dedce[_0x4909('0x26')]()[_0x4909('0x25')](function(){var _0x34e212=_0x2dedce['get']({'plain':!![]});var _0x44aa6f=_0x4909('0x27');return db[_0x4909('0x28')][_0x4909('0x26')]({'where':{'type':_0x44aa6f,'resourceId':_0x34e212['id']}})[_0x4909('0x25')](function(){return _0x2dedce;});})[_0x4909('0x25')](function(){_0x10a169['status'](0xcc)[_0x4909('0x29')]();});}};}function handleEntityNotFound(_0x2e8a3f,_0x21a753){return function(_0x33ba00){if(!_0x33ba00){_0x2e8a3f['sendStatus'](0x194);}return _0x33ba00;};}function handleError(_0x29215c,_0x5cc8c3){_0x5cc8c3=_0x5cc8c3||0x1f4;return function(_0x4faaf8){logger['error'](_0x4faaf8[_0x4909('0x2a')]);if(_0x4faaf8[_0x4909('0x2b')]){delete _0x4faaf8[_0x4909('0x2b')];}_0x29215c['status'](_0x5cc8c3)[_0x4909('0x2c')](_0x4faaf8);};}exports['index']=function(_0x43e585,_0x3982c0){var _0x36b675={},_0x5e07dd={},_0x378f43={'count':0x0,'rows':[]};var _0x19c3ba=_[_0x4909('0x2d')](db['Template'][_0x4909('0x2e')],function(_0xec4b92){return{'name':_0xec4b92['fieldName'],'type':_0xec4b92['type'][_0x4909('0x2f')]};});_0x5e07dd[_0x4909('0x30')]=_[_0x4909('0x2d')](_0x19c3ba,_0x4909('0x2b'));_0x5e07dd[_0x4909('0x31')]=_[_0x4909('0x32')](_0x43e585[_0x4909('0x31')]);_0x5e07dd[_0x4909('0x33')]=_['intersection'](_0x5e07dd[_0x4909('0x30')],_0x5e07dd[_0x4909('0x31')]);_0x36b675['attributes']=_[_0x4909('0x34')](_0x5e07dd[_0x4909('0x30')],qs[_0x4909('0x35')](_0x43e585['query'][_0x4909('0x35')]));_0x36b675[_0x4909('0x36')]=_0x36b675[_0x4909('0x36')]['length']?_0x36b675[_0x4909('0x36')]:_0x5e07dd[_0x4909('0x30')];if(!_0x43e585[_0x4909('0x31')]['hasOwnProperty'](_0x4909('0x37'))){_0x36b675[_0x4909('0x1d')]=qs[_0x4909('0x1d')](_0x43e585[_0x4909('0x31')][_0x4909('0x1d')]);_0x36b675[_0x4909('0x1f')]=qs[_0x4909('0x1f')](_0x43e585[_0x4909('0x31')][_0x4909('0x1f')]);}_0x36b675[_0x4909('0x38')]=qs[_0x4909('0x39')](_0x43e585[_0x4909('0x31')]['sort']);_0x36b675[_0x4909('0x3a')]=qs[_0x4909('0x33')](_['pick'](_0x43e585[_0x4909('0x31')],_0x5e07dd[_0x4909('0x33')]),_0x19c3ba);if(_0x43e585['query'][_0x4909('0x3b')]){_0x36b675[_0x4909('0x3a')]=_[_0x4909('0x3c')](_0x36b675[_0x4909('0x3a')],{'$or':_[_0x4909('0x2d')](_0x19c3ba,function(_0x3787ee){if(_0x3787ee[_0x4909('0x3d')]!==_0x4909('0x3e')){var _0x14fcb8={};_0x14fcb8[_0x3787ee[_0x4909('0x2b')]]={'$like':'%'+_0x43e585[_0x4909('0x31')][_0x4909('0x3b')]+'%'};return _0x14fcb8;}})});}_0x36b675=_[_0x4909('0x3c')]({},_0x36b675,_0x43e585[_0x4909('0x3f')]);var _0x64916={'where':_0x36b675[_0x4909('0x3a')]};return db[_0x4909('0x40')][_0x4909('0x1e')](_0x64916)[_0x4909('0x25')](function(_0x14b1ef){_0x378f43[_0x4909('0x1e')]=_0x14b1ef;if(_0x43e585[_0x4909('0x31')][_0x4909('0x41')]){_0x36b675['include']=[{'all':!![]}];}return db[_0x4909('0x40')][_0x4909('0x42')](_0x36b675);})[_0x4909('0x25')](function(_0x4acf79){_0x378f43[_0x4909('0x43')]=_0x4acf79;return _0x378f43;})[_0x4909('0x25')](respondWithFilteredResult(_0x3982c0,_0x36b675))[_0x4909('0x44')](handleError(_0x3982c0,null));};exports[_0x4909('0x45')]=function(_0x20be1d,_0x375b14){var _0x572ff6={'raw':!![],'where':{'id':_0x20be1d[_0x4909('0x46')]['id']}},_0x5a5c2d={};_0x5a5c2d['model']=_['keys'](db[_0x4909('0x40')]['rawAttributes']);_0x5a5c2d[_0x4909('0x31')]=_[_0x4909('0x32')](_0x20be1d[_0x4909('0x31')]);_0x5a5c2d[_0x4909('0x33')]=_[_0x4909('0x34')](_0x5a5c2d[_0x4909('0x30')],_0x5a5c2d[_0x4909('0x31')]);_0x572ff6['attributes']=_[_0x4909('0x34')](_0x5a5c2d[_0x4909('0x30')],qs[_0x4909('0x35')](_0x20be1d['query'][_0x4909('0x35')]));_0x572ff6[_0x4909('0x36')]=_0x572ff6[_0x4909('0x36')]['length']?_0x572ff6[_0x4909('0x36')]:_0x5a5c2d[_0x4909('0x30')];if(_0x20be1d['query'][_0x4909('0x41')]){_0x572ff6[_0x4909('0x47')]=[{'all':!![]}];}_0x572ff6=_['merge']({},_0x572ff6,_0x20be1d[_0x4909('0x3f')]);return db[_0x4909('0x40')]['find'](_0x572ff6)[_0x4909('0x25')](handleEntityNotFound(_0x375b14,null))[_0x4909('0x25')](respondWithResult(_0x375b14,null))[_0x4909('0x44')](handleError(_0x375b14,null));};exports[_0x4909('0x48')]=function(_0x3bd521,_0x5b797){return db['Template'][_0x4909('0x48')](_0x3bd521[_0x4909('0x49')],{})[_0x4909('0x25')](function(_0x247c08){var _0x5f283d=_0x3bd521[_0x4909('0x4a')]['get']({'plain':!![]});if(!_0x5f283d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5f283d[_0x4909('0x4b')]===_0x4909('0x4a')){var _0x14fc2d=_0x247c08[_0x4909('0x4c')]({'plain':!![]});var _0x258a41=_0x4909('0x27');return db['UserProfileSection'][_0x4909('0x4d')]({'where':{'name':_0x258a41,'userProfileId':_0x5f283d[_0x4909('0x4e')]},'raw':!![]})[_0x4909('0x25')](function(_0x325c72){if(_0x325c72&&_0x325c72[_0x4909('0x4f')]===0x0){return db[_0x4909('0x28')][_0x4909('0x48')]({'name':_0x14fc2d['name'],'resourceId':_0x14fc2d['id'],'type':_0x325c72['name'],'sectionId':_0x325c72['id']},{})[_0x4909('0x25')](function(){return _0x247c08;});}else{return _0x247c08;}})[_0x4909('0x44')](function(_0x4a619c){logger[_0x4909('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4a619c);throw _0x4a619c;});}return _0x247c08;})[_0x4909('0x25')](respondWithResult(_0x5b797,0xc9))[_0x4909('0x44')](handleError(_0x5b797,null));};exports[_0x4909('0x24')]=function(_0x51be70,_0x3b9a92){if(_0x51be70[_0x4909('0x49')]['id']){delete _0x51be70[_0x4909('0x49')]['id'];}return db[_0x4909('0x40')]['find']({'where':{'id':_0x51be70[_0x4909('0x46')]['id']}})['then'](handleEntityNotFound(_0x3b9a92,null))['then'](saveUpdates(_0x51be70['body'],null))['then'](respondWithResult(_0x3b9a92,null))['catch'](handleError(_0x3b9a92,null));};exports['destroy']=function(_0x37be21,_0x5157ce){return db[_0x4909('0x40')][_0x4909('0x4d')]({'where':{'id':_0x37be21[_0x4909('0x46')]['id']}})[_0x4909('0x25')](handleEntityNotFound(_0x5157ce,null))[_0x4909('0x25')](removeEntity(_0x5157ce,null))['catch'](handleError(_0x5157ce,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 131725e..45144ec 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 _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 +var _0xb738=['lodash','util','api','bluebird','request-promise','rimraf','../../config/environment','./template.attributes','exports','Template'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb738,0xbe));var _0x8b73=function(_0x5bbb2e,_0x29e778){_0x5bbb2e=_0x5bbb2e-0x0;var _0x43f582=_0xb738[_0x5bbb2e];return _0x43f582;};'use strict';var _=require(_0x8b73('0x0'));var util=require(_0x8b73('0x1'));var logger=require('../../config/logger')(_0x8b73('0x2'));var moment=require('moment');var BPromise=require(_0x8b73('0x3'));var rp=require(_0x8b73('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b73('0x5'));var config=require(_0x8b73('0x6'));var attributes=require(_0x8b73('0x7'));module[_0x8b73('0x8')]=function(_0x26ca83,_0x110ccf){return _0x26ca83['define'](_0x8b73('0x9'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index 8f69cb6..078b1fd 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 _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 +var _0x7418=['request\x20sent','debug','stringify','error','code','message','result','catch','findAll','options','raw','where','attributes','limit','include','model','map','GetTemplate','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','client','http','request','then','info','Template,\x20%s,\x20%s'];(function(_0x3446ef,_0x27c320){var _0x438057=function(_0x11772a){while(--_0x11772a){_0x3446ef['push'](_0x3446ef['shift']());}};_0x438057(++_0x27c320);}(_0x7418,0x186));var _0x8741=function(_0x1c5e5e,_0x2460e2){_0x1c5e5e=_0x1c5e5e-0x0;var _0x5756c6=_0x7418[_0x1c5e5e];return _0x5756c6;};'use strict';var _=require(_0x8741('0x0'));var util=require('util');var moment=require(_0x8741('0x1'));var BPromise=require(_0x8741('0x2'));var rs=require(_0x8741('0x3'));var fs=require('fs');var Redis=require(_0x8741('0x4'));var db=require(_0x8741('0x5'))['db'];var utils=require(_0x8741('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8741('0x7')][_0x8741('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3e3cc6,_0x3a0f42,_0x4b98fb){return new BPromise(function(_0x1d43a8,_0x467fb3){return client[_0x8741('0x9')](_0x3e3cc6,_0x4b98fb)[_0x8741('0xa')](function(_0x3b3c36){logger[_0x8741('0xb')](_0x8741('0xc'),_0x3a0f42,_0x8741('0xd'));logger[_0x8741('0xe')]('Template,\x20%s,\x20%s,\x20%s',_0x3a0f42,'request\x20sent',JSON[_0x8741('0xf')](_0x3b3c36));if(_0x3b3c36[_0x8741('0x10')]){if(_0x3b3c36[_0x8741('0x10')][_0x8741('0x11')]===0x1f4){logger[_0x8741('0x10')]('Template,\x20%s,\x20%s',_0x3a0f42,_0x3b3c36[_0x8741('0x10')][_0x8741('0x12')]);return _0x467fb3(_0x3b3c36[_0x8741('0x10')]['message']);}logger[_0x8741('0x10')](_0x8741('0xc'),_0x3a0f42,_0x3b3c36[_0x8741('0x10')][_0x8741('0x12')]);return _0x1d43a8(_0x3b3c36[_0x8741('0x10')][_0x8741('0x12')]);}else{logger[_0x8741('0xb')](_0x8741('0xc'),_0x3a0f42,_0x8741('0xd'));_0x1d43a8(_0x3b3c36[_0x8741('0x13')][_0x8741('0x12')]);}})[_0x8741('0x14')](function(_0x1eb8b4){logger[_0x8741('0x10')](_0x8741('0xc'),_0x3a0f42,_0x1eb8b4);_0x467fb3(_0x1eb8b4);});});}exports['GetTemplate']=function(_0x147378){var _0x178930=this;return new Promise(function(_0x3f641b,_0xe6501a){return db['Template'][_0x8741('0x15')]({'raw':_0x147378['options']?_0x147378[_0x8741('0x16')][_0x8741('0x17')]===undefined?!![]:![]:!![],'where':_0x147378[_0x8741('0x16')]?_0x147378[_0x8741('0x16')][_0x8741('0x18')]||null:null,'attributes':_0x147378[_0x8741('0x16')]?_0x147378[_0x8741('0x16')][_0x8741('0x19')]||null:null,'limit':_0x147378['options']?_0x147378[_0x8741('0x16')][_0x8741('0x1a')]||null:null,'include':_0x147378[_0x8741('0x16')]?_0x147378[_0x8741('0x16')][_0x8741('0x1b')]?_['map'](_0x147378[_0x8741('0x16')][_0x8741('0x1b')],function(_0x244158){return{'model':db[_0x244158[_0x8741('0x1c')]],'as':_0x244158['as'],'attributes':_0x244158[_0x8741('0x19')],'include':_0x244158[_0x8741('0x1b')]?_[_0x8741('0x1d')](_0x244158[_0x8741('0x1b')],function(_0x42ef18){return{'model':db[_0x42ef18['model']],'as':_0x42ef18['as'],'attributes':_0x42ef18[_0x8741('0x19')],'include':_0x42ef18[_0x8741('0x1b')]?_[_0x8741('0x1d')](_0x42ef18[_0x8741('0x1b')],function(_0x2fa3a9){return{'model':db[_0x2fa3a9[_0x8741('0x1c')]],'as':_0x2fa3a9['as'],'attributes':_0x2fa3a9[_0x8741('0x19')]};}):[]};}):[]};}):[]:[]})[_0x8741('0xa')](function(_0x465713){logger[_0x8741('0xb')](_0x8741('0x1e'),_0x147378);logger['debug'](_0x8741('0x1e'),_0x147378,JSON[_0x8741('0xf')](_0x465713));_0x3f641b(_0x465713);})[_0x8741('0x14')](function(_0x2f32da){logger[_0x8741('0x10')](_0x8741('0x1e'),_0x2f32da[_0x8741('0x12')],_0x147378);_0xe6501a(_0x178930['error'](0x1f4,_0x2f32da[_0x8741('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 14bf56b..795fe6f 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 _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 +var _0x85d3=['multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','getActions','post','create','/:id/actions','addAction','put','delete','destroy','exports'];(function(_0x38328a,_0x13a6d3){var _0x300e3f=function(_0x5388d9){while(--_0x5388d9){_0x38328a['push'](_0x38328a['shift']());}};_0x300e3f(++_0x13a6d3);}(_0x85d3,0xc8));var _0x385d=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x85d3[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x385d('0x0'));var util=require(_0x385d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x385d('0x2'));var router=express[_0x385d('0x3')]();var fs_extra=require(_0x385d('0x4'));var auth=require(_0x385d('0x5'));var interaction=require(_0x385d('0x6'));var config=require(_0x385d('0x7'));var controller=require('./trigger.controller');router[_0x385d('0x8')]('/',auth['isAuthenticated'](),controller[_0x385d('0x9')]);router[_0x385d('0x8')](_0x385d('0xa'),auth[_0x385d('0xb')](),controller['show']);router[_0x385d('0x8')](_0x385d('0xc'),auth[_0x385d('0xb')](),controller[_0x385d('0xd')]);router[_0x385d('0x8')](_0x385d('0xe'),auth['isAuthenticated'](),controller[_0x385d('0xf')]);router['get']('/:id/actions',auth[_0x385d('0xb')](),controller[_0x385d('0x10')]);router[_0x385d('0x11')]('/',auth[_0x385d('0xb')](),controller[_0x385d('0x12')]);router[_0x385d('0x11')](_0x385d('0xc'),auth['isAuthenticated'](),controller['addAllCondition']);router[_0x385d('0x11')](_0x385d('0xe'),auth[_0x385d('0xb')](),controller['addAnyCondition']);router[_0x385d('0x11')](_0x385d('0x13'),auth[_0x385d('0xb')](),controller[_0x385d('0x14')]);router[_0x385d('0x15')](_0x385d('0xa'),auth[_0x385d('0xb')](),controller['update']);router[_0x385d('0x16')]('/:id',auth[_0x385d('0xb')](),controller[_0x385d('0x17')]);module[_0x385d('0x18')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 232a13c..baeff9a 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 _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 +var _0xa772=['exports','STRING','BOOLEAN','sequelize'];(function(_0x228a08,_0x534024){var _0x49edae=function(_0x159aa4){while(--_0x159aa4){_0x228a08['push'](_0x228a08['shift']());}};_0x49edae(++_0x534024);}(_0xa772,0x19f));var _0x2a77=function(_0xef8146,_0x459c34){_0xef8146=_0xef8146-0x0;var _0x5a6cb0=_0xa772[_0xef8146];return _0x5a6cb0;};'use strict';var Sequelize=require(_0x2a77('0x0'));module[_0x2a77('0x1')]={'name':{'type':Sequelize[_0x2a77('0x2')]},'channel':{'type':Sequelize[_0x2a77('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x2a77('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 16e2d78..af2c3f4 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 _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 +var _0x326c=['count','limit','Content-Range','apply','reject','update','then','destroy','get','Triggers','end','error','name','send','index','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filter','merge','options','Trigger','includeAll','include','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','Condition','addAnyCondition','getAllConditions','findOne','order','hasOwnProperty','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','json','offset','undefined'];(function(_0x4dccf2,_0x5cfcd7){var _0x12640e=function(_0x1fb2c7){while(--_0x1fb2c7){_0x4dccf2['push'](_0x4dccf2['shift']());}};_0x12640e(++_0x5cfcd7);}(_0x326c,0xf3));var _0xc326=function(_0x10d45e,_0x4771d9){_0x10d45e=_0x10d45e-0x0;var _0x4406b2=_0x326c[_0x10d45e];return _0x4406b2;};'use strict';var emlformat=require(_0xc326('0x0'));var rimraf=require(_0xc326('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc326('0x2'));var rp=require(_0xc326('0x3'));var moment=require(_0xc326('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc326('0x5'));var util=require(_0xc326('0x6'));var path=require(_0xc326('0x7'));var sox=require(_0xc326('0x8'));var csv=require(_0xc326('0x9'));var ejs=require(_0xc326('0xa'));var fs=require('fs');var fs_extra=require(_0xc326('0xb'));var _=require(_0xc326('0xc'));var squel=require(_0xc326('0xd'));var crypto=require(_0xc326('0xe'));var jsforce=require(_0xc326('0xf'));var deskjs=require(_0xc326('0x10'));var toCsv=require('to-csv');var querystring=require(_0xc326('0x11'));var Papa=require(_0xc326('0x12'));var Redis=require(_0xc326('0x13'));var authService=require(_0xc326('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc326('0x15'));var logger=require(_0xc326('0x16'))(_0xc326('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc326('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x163dc0,_0x5be5e7){_0x5be5e7=_0x5be5e7||0xcc;return function(_0x5b4b04){if(_0x5b4b04){return _0x163dc0[_0xc326('0x19')](_0x5be5e7);}return _0x163dc0[_0xc326('0x1a')](_0x5be5e7)['end']();};}function respondWithResult(_0x396450,_0x2f8861){_0x2f8861=_0x2f8861||0xc8;return function(_0x21968b){if(_0x21968b){return _0x396450[_0xc326('0x1a')](_0x2f8861)[_0xc326('0x1b')](_0x21968b);}};}function respondWithFilteredResult(_0x4d16a8,_0x1ca658){return function(_0x34b101){if(_0x34b101){var _0x436a15=typeof _0x1ca658[_0xc326('0x1c')]===_0xc326('0x1d')&&typeof _0x1ca658['limit']===_0xc326('0x1d');var _0x252fc3=_0x34b101[_0xc326('0x1e')];var _0x56888c=_0x436a15?0x0:_0x1ca658[_0xc326('0x1c')];var _0x546e6c=_0x436a15?_0x34b101[_0xc326('0x1e')]:_0x1ca658[_0xc326('0x1c')]+_0x1ca658[_0xc326('0x1f')];var _0xcb1d99;if(_0x546e6c>=_0x252fc3){_0x546e6c=_0x252fc3;_0xcb1d99=0xc8;}else{_0xcb1d99=0xce;}_0x4d16a8[_0xc326('0x1a')](_0xcb1d99);return _0x4d16a8['set'](_0xc326('0x20'),_0x56888c+'-'+_0x546e6c+'/'+_0x252fc3)[_0xc326('0x1b')](_0x34b101);}return null;};}function patchUpdates(_0x30f5d0){return function(_0xc06b7d){try{jsonpatch[_0xc326('0x21')](_0xc06b7d,_0x30f5d0,!![]);}catch(_0x596c65){return BPromise[_0xc326('0x22')](_0x596c65);}return _0xc06b7d['save']();};}function saveUpdates(_0x22b57e,_0x5c9dd5){return function(_0x534b64){if(_0x534b64){return _0x534b64[_0xc326('0x23')](_0x22b57e)[_0xc326('0x24')](function(_0x36eac5){return _0x36eac5;});}return null;};}function removeEntity(_0x2d7eb2,_0x431716){return function(_0xb0ac54){if(_0xb0ac54){return _0xb0ac54[_0xc326('0x25')]()['then'](function(){var _0x7f0850=_0xb0ac54[_0xc326('0x26')]({'plain':!![]});var _0x20585c=_0xc326('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x20585c,'resourceId':_0x7f0850['id']}})[_0xc326('0x24')](function(){return _0xb0ac54;});})['then'](function(){_0x2d7eb2['status'](0xcc)[_0xc326('0x28')]();});}};}function handleEntityNotFound(_0x280d28,_0x3f1288){return function(_0x133884){if(!_0x133884){_0x280d28[_0xc326('0x19')](0x194);}return _0x133884;};}function handleError(_0x5d1713,_0xa9397){_0xa9397=_0xa9397||0x1f4;return function(_0x54fc57){logger[_0xc326('0x29')](_0x54fc57['stack']);if(_0x54fc57[_0xc326('0x2a')]){delete _0x54fc57[_0xc326('0x2a')];}_0x5d1713[_0xc326('0x1a')](_0xa9397)[_0xc326('0x2b')](_0x54fc57);};}exports[_0xc326('0x2c')]=function(_0x268315,_0x180dd1){var _0x3c37a6={},_0x46e177={},_0x47804c={'count':0x0,'rows':[]};var _0x11af99=_['map'](db['Trigger'][_0xc326('0x2d')],function(_0x265cfe){return{'name':_0x265cfe[_0xc326('0x2e')],'type':_0x265cfe[_0xc326('0x2f')]['key']};});_0x46e177['model']=_[_0xc326('0x30')](_0x11af99,_0xc326('0x2a'));_0x46e177[_0xc326('0x31')]=_[_0xc326('0x32')](_0x268315[_0xc326('0x31')]);_0x46e177[_0xc326('0x33')]=_[_0xc326('0x34')](_0x46e177[_0xc326('0x35')],_0x46e177[_0xc326('0x31')]);_0x3c37a6[_0xc326('0x36')]=_['intersection'](_0x46e177[_0xc326('0x35')],qs[_0xc326('0x37')](_0x268315[_0xc326('0x31')][_0xc326('0x37')]));_0x3c37a6['attributes']=_0x3c37a6['attributes'][_0xc326('0x38')]?_0x3c37a6[_0xc326('0x36')]:_0x46e177[_0xc326('0x35')];if(!_0x268315[_0xc326('0x31')]['hasOwnProperty'](_0xc326('0x39'))){_0x3c37a6[_0xc326('0x1f')]=qs[_0xc326('0x1f')](_0x268315[_0xc326('0x31')]['limit']);_0x3c37a6[_0xc326('0x1c')]=qs[_0xc326('0x1c')](_0x268315[_0xc326('0x31')][_0xc326('0x1c')]);}_0x3c37a6['order']=qs[_0xc326('0x3a')](_0x268315['query'][_0xc326('0x3a')]);_0x3c37a6[_0xc326('0x3b')]=qs['filters'](_[_0xc326('0x3c')](_0x268315[_0xc326('0x31')],_0x46e177[_0xc326('0x33')]),_0x11af99);if(_0x268315[_0xc326('0x31')][_0xc326('0x3d')]){_0x3c37a6['where']=_[_0xc326('0x3e')](_0x3c37a6[_0xc326('0x3b')],{'$or':_['map'](_0x11af99,function(_0x1cc339){if(_0x1cc339[_0xc326('0x2f')]!=='VIRTUAL'){var _0x5967b8={};_0x5967b8[_0x1cc339[_0xc326('0x2a')]]={'$like':'%'+_0x268315[_0xc326('0x31')][_0xc326('0x3d')]+'%'};return _0x5967b8;}})});}_0x3c37a6=_[_0xc326('0x3e')]({},_0x3c37a6,_0x268315[_0xc326('0x3f')]);var _0x23ea28={'where':_0x3c37a6[_0xc326('0x3b')]};return db[_0xc326('0x40')][_0xc326('0x1e')](_0x23ea28)['then'](function(_0x41b4bf){_0x47804c[_0xc326('0x1e')]=_0x41b4bf;if(_0x268315[_0xc326('0x31')][_0xc326('0x41')]){_0x3c37a6[_0xc326('0x42')]=[{'all':!![]}];}return db[_0xc326('0x40')]['findAll'](_0x3c37a6);})['then'](function(_0x2769c2){_0x47804c['rows']=_0x2769c2;return _0x47804c;})['then'](respondWithFilteredResult(_0x180dd1,_0x3c37a6))[_0xc326('0x43')](handleError(_0x180dd1,null));};exports[_0xc326('0x44')]=function(_0xbed59d,_0xbcf70e){var _0x1de4f9={'raw':![],'where':{'id':_0xbed59d[_0xc326('0x45')]['id']}},_0x4b0581={};_0x4b0581[_0xc326('0x35')]=_[_0xc326('0x32')](db[_0xc326('0x40')]['rawAttributes']);_0x4b0581[_0xc326('0x31')]=_[_0xc326('0x32')](_0xbed59d[_0xc326('0x31')]);_0x4b0581[_0xc326('0x33')]=_['intersection'](_0x4b0581[_0xc326('0x35')],_0x4b0581[_0xc326('0x31')]);_0x1de4f9['attributes']=_['intersection'](_0x4b0581[_0xc326('0x35')],qs[_0xc326('0x37')](_0xbed59d[_0xc326('0x31')][_0xc326('0x37')]));_0x1de4f9[_0xc326('0x36')]=_0x1de4f9[_0xc326('0x36')]['length']?_0x1de4f9[_0xc326('0x36')]:_0x4b0581[_0xc326('0x35')];if(_0xbed59d[_0xc326('0x31')]['includeAll']){_0x1de4f9[_0xc326('0x42')]=[{'all':!![]}];}_0x1de4f9=_[_0xc326('0x3e')]({},_0x1de4f9,_0xbed59d[_0xc326('0x3f')]);return db['Trigger'][_0xc326('0x46')](_0x1de4f9)[_0xc326('0x24')](handleEntityNotFound(_0xbcf70e,null))[_0xc326('0x24')](respondWithResult(_0xbcf70e,null))[_0xc326('0x43')](handleError(_0xbcf70e,null));};exports['create']=function(_0x2792e2,_0x374ef6){return db[_0xc326('0x40')][_0xc326('0x47')](_0x2792e2[_0xc326('0x48')],{})[_0xc326('0x24')](function(_0x229715){var _0x524f5f=_0x2792e2['user'][_0xc326('0x26')]({'plain':!![]});if(!_0x524f5f)throw new Error(_0xc326('0x49'));if(_0x524f5f[_0xc326('0x4a')]===_0xc326('0x4b')){var _0xeba863=_0x229715['get']({'plain':!![]});var _0x5e80da=_0xc326('0x27');return db['UserProfileSection'][_0xc326('0x46')]({'where':{'name':_0x5e80da,'userProfileId':_0x524f5f['userProfileId']},'raw':!![]})[_0xc326('0x24')](function(_0x577033){if(_0x577033&&_0x577033[_0xc326('0x4c')]===0x0){return db[_0xc326('0x4d')][_0xc326('0x47')]({'name':_0xeba863[_0xc326('0x2a')],'resourceId':_0xeba863['id'],'type':_0x577033[_0xc326('0x2a')],'sectionId':_0x577033['id']},{})[_0xc326('0x24')](function(){return _0x229715;});}else{return _0x229715;}})['catch'](function(_0x5cf9b0){logger[_0xc326('0x29')](_0xc326('0x4e'),_0x5cf9b0);throw _0x5cf9b0;});}return _0x229715;})['then'](respondWithResult(_0x374ef6,0xc9))['catch'](handleError(_0x374ef6,null));};exports[_0xc326('0x23')]=function(_0x95c566,_0x236061){if(_0x95c566[_0xc326('0x48')]['id']){delete _0x95c566[_0xc326('0x48')]['id'];}return db['Trigger']['find']({'where':{'id':_0x95c566[_0xc326('0x45')]['id']}})['then'](handleEntityNotFound(_0x236061,null))[_0xc326('0x24')](saveUpdates(_0x95c566[_0xc326('0x48')],null))[_0xc326('0x24')](respondWithResult(_0x236061,null))[_0xc326('0x43')](handleError(_0x236061,null));};exports[_0xc326('0x25')]=function(_0x47ec8d,_0x2c5ae1){return db[_0xc326('0x40')][_0xc326('0x46')]({'where':{'id':_0x47ec8d[_0xc326('0x45')]['id']}})['then'](handleEntityNotFound(_0x2c5ae1,null))[_0xc326('0x24')](removeEntity(_0x2c5ae1,null))['catch'](handleError(_0x2c5ae1,null));};exports[_0xc326('0x4f')]=function(_0x1d228b,_0x10a6dc,_0x554cc3){if(_0x1d228b[_0xc326('0x48')]['id']){delete _0x1d228b[_0xc326('0x48')]['id'];}return db[_0xc326('0x40')][_0xc326('0x46')]({'where':{'id':_0x1d228b['params']['id']}})[_0xc326('0x24')](handleEntityNotFound(_0x10a6dc,null))[_0xc326('0x24')](function(_0x1cc3d4){if(_0x1cc3d4){_0x1d228b[_0xc326('0x48')]['TriggerAllId']=_0x1cc3d4['id'];return db[_0xc326('0x50')][_0xc326('0x47')](_0x1d228b[_0xc326('0x48')]);}})[_0xc326('0x24')](respondWithResult(_0x10a6dc,null))[_0xc326('0x43')](handleError(_0x10a6dc,null));};exports[_0xc326('0x51')]=function(_0x304310,_0x4ea7c8,_0x276622){if(_0x304310['body']['id']){delete _0x304310[_0xc326('0x48')]['id'];}return db[_0xc326('0x40')]['find']({'where':{'id':_0x304310[_0xc326('0x45')]['id']}})['then'](handleEntityNotFound(_0x4ea7c8,null))['then'](function(_0x185f79){if(_0x185f79){_0x304310[_0xc326('0x48')]['TriggerAnyId']=_0x185f79['id'];return db['Condition'][_0xc326('0x47')](_0x304310[_0xc326('0x48')]);}})[_0xc326('0x24')](respondWithResult(_0x4ea7c8,null))[_0xc326('0x43')](handleError(_0x4ea7c8,null));};exports[_0xc326('0x52')]=function(_0x1bb1c9,_0x2372c0,_0x532753){var _0x248516={};var _0x5c82e3={};var _0x53de3c;var _0x13be5f;return db[_0xc326('0x40')][_0xc326('0x53')]({'where':{'id':_0x1bb1c9['params']['id']}})[_0xc326('0x24')](handleEntityNotFound(_0x2372c0,null))[_0xc326('0x24')](function(_0x242b39){if(_0x242b39){_0x53de3c=_0x242b39;_0x5c82e3['model']=_['keys'](db[_0xc326('0x50')][_0xc326('0x2d')]);_0x5c82e3['query']=_['keys'](_0x1bb1c9[_0xc326('0x31')]);_0x5c82e3[_0xc326('0x33')]=_[_0xc326('0x34')](_0x5c82e3['model'],_0x5c82e3[_0xc326('0x31')]);_0x248516[_0xc326('0x36')]=_[_0xc326('0x34')](_0x5c82e3['model'],qs['fields'](_0x1bb1c9[_0xc326('0x31')][_0xc326('0x37')]));_0x248516[_0xc326('0x36')]=_0x248516[_0xc326('0x36')][_0xc326('0x38')]?_0x248516[_0xc326('0x36')]:_0x5c82e3[_0xc326('0x35')];_0x248516[_0xc326('0x54')]=qs[_0xc326('0x3a')](_0x1bb1c9[_0xc326('0x31')][_0xc326('0x3a')]);_0x248516[_0xc326('0x3b')]=qs[_0xc326('0x33')](_[_0xc326('0x3c')](_0x1bb1c9[_0xc326('0x31')],_0x5c82e3[_0xc326('0x33')]));if(_0x1bb1c9[_0xc326('0x31')][_0xc326('0x3d')]){_0x248516[_0xc326('0x3b')]=_['merge'](_0x248516[_0xc326('0x3b')],{'$or':_[_0xc326('0x30')](_0x248516[_0xc326('0x36')],function(_0xe08208){var _0x4d15dd={};_0x4d15dd[_0xe08208]={'$like':'%'+_0x1bb1c9[_0xc326('0x31')][_0xc326('0x3d')]+'%'};return _0x4d15dd;})});}_0x248516=_[_0xc326('0x3e')]({},_0x248516,_0x1bb1c9[_0xc326('0x3f')]);return _0x53de3c[_0xc326('0x52')](_0x248516);}})[_0xc326('0x24')](function(_0x395bdc){if(_0x395bdc){_0x13be5f=_0x395bdc[_0xc326('0x38')];if(!_0x1bb1c9[_0xc326('0x31')][_0xc326('0x55')](_0xc326('0x39'))){_0x248516['limit']=qs[_0xc326('0x1f')](_0x1bb1c9[_0xc326('0x31')]['limit']);_0x248516[_0xc326('0x1c')]=qs[_0xc326('0x1c')](_0x1bb1c9[_0xc326('0x31')][_0xc326('0x1c')]);}return _0x53de3c[_0xc326('0x52')](_0x248516);}})['then'](function(_0x3e3e80){if(_0x3e3e80){return _0x3e3e80?{'count':_0x13be5f,'rows':_0x3e3e80}:null;}})['then'](respondWithResult(_0x2372c0,null))[_0xc326('0x43')](handleError(_0x2372c0,null));};exports['getAnyConditions']=function(_0x2ecbda,_0x278dd9,_0x3351ea){var _0x59a2ed={};var _0x5cde3c={};var _0x2e9c8e;var _0x33771f;return db[_0xc326('0x40')][_0xc326('0x53')]({'where':{'id':_0x2ecbda[_0xc326('0x45')]['id']}})['then'](handleEntityNotFound(_0x278dd9,null))['then'](function(_0x31ada5){if(_0x31ada5){_0x2e9c8e=_0x31ada5;_0x5cde3c['model']=_[_0xc326('0x32')](db['Condition'][_0xc326('0x2d')]);_0x5cde3c[_0xc326('0x31')]=_[_0xc326('0x32')](_0x2ecbda[_0xc326('0x31')]);_0x5cde3c[_0xc326('0x33')]=_[_0xc326('0x34')](_0x5cde3c[_0xc326('0x35')],_0x5cde3c[_0xc326('0x31')]);_0x59a2ed[_0xc326('0x36')]=_['intersection'](_0x5cde3c[_0xc326('0x35')],qs['fields'](_0x2ecbda['query'][_0xc326('0x37')]));_0x59a2ed[_0xc326('0x36')]=_0x59a2ed[_0xc326('0x36')]['length']?_0x59a2ed[_0xc326('0x36')]:_0x5cde3c['model'];_0x59a2ed[_0xc326('0x54')]=qs[_0xc326('0x3a')](_0x2ecbda[_0xc326('0x31')]['sort']);_0x59a2ed['where']=qs['filters'](_[_0xc326('0x3c')](_0x2ecbda[_0xc326('0x31')],_0x5cde3c[_0xc326('0x33')]));if(_0x2ecbda['query']['filter']){_0x59a2ed['where']=_[_0xc326('0x3e')](_0x59a2ed['where'],{'$or':_[_0xc326('0x30')](_0x59a2ed[_0xc326('0x36')],function(_0x1ecac8){var _0x3e9dc0={};_0x3e9dc0[_0x1ecac8]={'$like':'%'+_0x2ecbda[_0xc326('0x31')][_0xc326('0x3d')]+'%'};return _0x3e9dc0;})});}_0x59a2ed=_[_0xc326('0x3e')]({},_0x59a2ed,_0x2ecbda['options']);return _0x2e9c8e[_0xc326('0x56')](_0x59a2ed);}})['then'](function(_0x463b9c){if(_0x463b9c){_0x33771f=_0x463b9c['length'];if(!_0x2ecbda[_0xc326('0x31')]['hasOwnProperty'](_0xc326('0x39'))){_0x59a2ed[_0xc326('0x1f')]=qs[_0xc326('0x1f')](_0x2ecbda[_0xc326('0x31')][_0xc326('0x1f')]);_0x59a2ed[_0xc326('0x1c')]=qs[_0xc326('0x1c')](_0x2ecbda['query']['offset']);}return _0x2e9c8e[_0xc326('0x56')](_0x59a2ed);}})[_0xc326('0x24')](function(_0x59b49d){if(_0x59b49d){return _0x59b49d?{'count':_0x33771f,'rows':_0x59b49d}:null;}})[_0xc326('0x24')](respondWithResult(_0x278dd9,null))[_0xc326('0x43')](handleError(_0x278dd9,null));};exports[_0xc326('0x57')]=function(_0xb77f33,_0x1eaa26,_0x41ec71){if(_0xb77f33[_0xc326('0x48')]['id']){delete _0xb77f33[_0xc326('0x48')]['id'];}return db[_0xc326('0x40')][_0xc326('0x46')]({'where':{'id':_0xb77f33[_0xc326('0x45')]['id']}})[_0xc326('0x24')](handleEntityNotFound(_0x1eaa26,null))[_0xc326('0x24')](function(_0x5520d3){if(_0x5520d3){_0xb77f33[_0xc326('0x48')][_0xc326('0x58')]=_0x5520d3['id'];return db['Action'][_0xc326('0x47')](_0xb77f33[_0xc326('0x48')]);}})['then'](respondWithResult(_0x1eaa26,null))[_0xc326('0x43')](handleError(_0x1eaa26,null));};exports['getActions']=function(_0x5dfaa7,_0x4035b6,_0x250328){var _0x2956fe={};var _0x51f963={};var _0x70837e;var _0xee3523;return db[_0xc326('0x40')][_0xc326('0x53')]({'where':{'id':_0x5dfaa7[_0xc326('0x45')]['id']}})[_0xc326('0x24')](handleEntityNotFound(_0x4035b6,null))[_0xc326('0x24')](function(_0x4ad3a1){if(_0x4ad3a1){_0x70837e=_0x4ad3a1;_0x51f963[_0xc326('0x35')]=_[_0xc326('0x32')](db[_0xc326('0x59')]['rawAttributes']);_0x51f963[_0xc326('0x31')]=_[_0xc326('0x32')](_0x5dfaa7[_0xc326('0x31')]);_0x51f963['filters']=_[_0xc326('0x34')](_0x51f963[_0xc326('0x35')],_0x51f963[_0xc326('0x31')]);_0x2956fe[_0xc326('0x36')]=_['intersection'](_0x51f963[_0xc326('0x35')],qs[_0xc326('0x37')](_0x5dfaa7[_0xc326('0x31')][_0xc326('0x37')]));_0x2956fe[_0xc326('0x36')]=_0x2956fe[_0xc326('0x36')][_0xc326('0x38')]?_0x2956fe[_0xc326('0x36')]:_0x51f963['model'];_0x2956fe[_0xc326('0x54')]=qs['sort'](_0x5dfaa7[_0xc326('0x31')][_0xc326('0x3a')]);_0x2956fe[_0xc326('0x3b')]=qs[_0xc326('0x33')](_[_0xc326('0x3c')](_0x5dfaa7['query'],_0x51f963['filters']));if(_0x5dfaa7[_0xc326('0x31')]['filter']){_0x2956fe[_0xc326('0x3b')]=_['merge'](_0x2956fe[_0xc326('0x3b')],{'$or':_[_0xc326('0x30')](_0x2956fe[_0xc326('0x36')],function(_0x509d4b){var _0x287218={};_0x287218[_0x509d4b]={'$like':'%'+_0x5dfaa7[_0xc326('0x31')][_0xc326('0x3d')]+'%'};return _0x287218;})});}_0x2956fe=_[_0xc326('0x3e')]({},_0x2956fe,_0x5dfaa7[_0xc326('0x3f')]);return _0x70837e[_0xc326('0x5a')](_0x2956fe);}})[_0xc326('0x24')](function(_0x3f5f57){if(_0x3f5f57){_0xee3523=_0x3f5f57[_0xc326('0x38')];if(!_0x5dfaa7[_0xc326('0x31')][_0xc326('0x55')](_0xc326('0x39'))){_0x2956fe[_0xc326('0x1f')]=qs[_0xc326('0x1f')](_0x5dfaa7[_0xc326('0x31')][_0xc326('0x1f')]);_0x2956fe[_0xc326('0x1c')]=qs[_0xc326('0x1c')](_0x5dfaa7[_0xc326('0x31')]['offset']);}return _0x70837e['getActions'](_0x2956fe);}})[_0xc326('0x24')](function(_0x5d892a){if(_0x5d892a){return _0x5d892a?{'count':_0xee3523,'rows':_0x5d892a}:null;}})[_0xc326('0x24')](respondWithResult(_0x4035b6,null))['catch'](handleError(_0x4035b6,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index e3f2609..916b847 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 _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 +var _0x7868=['../../config/environment','./trigger.attributes','exports','define','Trigger','tools_triggers','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x5b8685,_0x1a1c28){var _0xa3ef57=function(_0xa91aad){while(--_0xa91aad){_0x5b8685['push'](_0x5b8685['shift']());}};_0xa3ef57(++_0x1a1c28);}(_0x7868,0x1c0));var _0x8786=function(_0x2736ba,_0x47553c){_0x2736ba=_0x2736ba-0x0;var _0x4be82d=_0x7868[_0x2736ba];return _0x4be82d;};'use strict';var _=require(_0x8786('0x0'));var util=require('util');var logger=require(_0x8786('0x1'))(_0x8786('0x2'));var moment=require(_0x8786('0x3'));var BPromise=require(_0x8786('0x4'));var rp=require(_0x8786('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8786('0x6'));var config=require(_0x8786('0x7'));var attributes=require(_0x8786('0x8'));module[_0x8786('0x9')]=function(_0x121ac4,_0x2c786d){return _0x121ac4[_0x8786('0xa')](_0x8786('0xb'),attributes,{'tableName':_0x8786('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index bcc4ba0..57a8e4e 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 _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 +var _0x194e=['raw','where','attributes','limit','map','include','model','GetTrigger','catch','ShowTrigger','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','Trigger','findAll','options'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x194e,0x1a2));var _0xe194=function(_0x2ba6ff,_0x2807c4){_0x2ba6ff=_0x2ba6ff-0x0;var _0x1578e4=_0x194e[_0x2ba6ff];return _0x1578e4;};'use strict';var _=require(_0xe194('0x0'));var util=require(_0xe194('0x1'));var moment=require(_0xe194('0x2'));var BPromise=require(_0xe194('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe194('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe194('0x5'))(_0xe194('0x6'));var config=require(_0xe194('0x7'));var jayson=require(_0xe194('0x8'));var client=jayson[_0xe194('0x9')][_0xe194('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3841ab,_0x225227,_0x31b6ec){return new BPromise(function(_0x49d608,_0x51e2eb){return client['request'](_0x3841ab,_0x31b6ec)[_0xe194('0xb')](function(_0x23cdd7){logger[_0xe194('0xc')](_0xe194('0xd'),_0x225227,_0xe194('0xe'));logger[_0xe194('0xf')]('Trigger,\x20%s,\x20%s,\x20%s',_0x225227,_0xe194('0xe'),JSON[_0xe194('0x10')](_0x23cdd7));if(_0x23cdd7['error']){if(_0x23cdd7[_0xe194('0x11')][_0xe194('0x12')]===0x1f4){logger[_0xe194('0x11')](_0xe194('0xd'),_0x225227,_0x23cdd7['error']['message']);return _0x51e2eb(_0x23cdd7['error'][_0xe194('0x13')]);}logger[_0xe194('0x11')]('Trigger,\x20%s,\x20%s',_0x225227,_0x23cdd7[_0xe194('0x11')][_0xe194('0x13')]);return _0x49d608(_0x23cdd7['error'][_0xe194('0x13')]);}else{logger[_0xe194('0xc')](_0xe194('0xd'),_0x225227,_0xe194('0xe'));_0x49d608(_0x23cdd7[_0xe194('0x14')][_0xe194('0x13')]);}})['catch'](function(_0x286e2b){logger[_0xe194('0x11')](_0xe194('0xd'),_0x225227,_0x286e2b);_0x51e2eb(_0x286e2b);});});}exports['GetTrigger']=function(_0x5a615d){var _0x76f1c2=this;return new Promise(function(_0x37772c,_0x45ebbb){return db[_0xe194('0x15')][_0xe194('0x16')]({'raw':_0x5a615d[_0xe194('0x17')]?_0x5a615d[_0xe194('0x17')][_0xe194('0x18')]===undefined?!![]:![]:!![],'where':_0x5a615d[_0xe194('0x17')]?_0x5a615d[_0xe194('0x17')][_0xe194('0x19')]||null:null,'attributes':_0x5a615d['options']?_0x5a615d[_0xe194('0x17')][_0xe194('0x1a')]||null:null,'limit':_0x5a615d['options']?_0x5a615d[_0xe194('0x17')][_0xe194('0x1b')]||null:null,'include':_0x5a615d[_0xe194('0x17')]?_0x5a615d[_0xe194('0x17')]['include']?_[_0xe194('0x1c')](_0x5a615d[_0xe194('0x17')][_0xe194('0x1d')],function(_0x466c44){return{'model':db[_0x466c44[_0xe194('0x1e')]],'as':_0x466c44['as'],'attributes':_0x466c44['attributes'],'include':_0x466c44[_0xe194('0x1d')]?_['map'](_0x466c44[_0xe194('0x1d')],function(_0x3a2ed4){return{'model':db[_0x3a2ed4[_0xe194('0x1e')]],'as':_0x3a2ed4['as'],'attributes':_0x3a2ed4['attributes'],'include':_0x3a2ed4[_0xe194('0x1d')]?_[_0xe194('0x1c')](_0x3a2ed4['include'],function(_0x3a46a3){return{'model':db[_0x3a46a3[_0xe194('0x1e')]],'as':_0x3a46a3['as'],'attributes':_0x3a46a3['attributes']};}):[]};}):[]};}):[]:[]})[_0xe194('0xb')](function(_0x4f9578){logger[_0xe194('0xc')](_0xe194('0x1f'),_0x5a615d);logger[_0xe194('0xf')](_0xe194('0x1f'),_0x5a615d,JSON[_0xe194('0x10')](_0x4f9578));_0x37772c(_0x4f9578);})[_0xe194('0x20')](function(_0x272dc1){logger[_0xe194('0x11')](_0xe194('0x1f'),_0x272dc1[_0xe194('0x13')],_0x5a615d);_0x45ebbb(_0x76f1c2['error'](0x1f4,_0x272dc1[_0xe194('0x13')]));});});};exports['ShowTrigger']=function(_0x1ce510){var _0x802b41=this;return new Promise(function(_0x4e61a2,_0x217efd){return db[_0xe194('0x15')]['find']({'raw':_0x1ce510[_0xe194('0x17')]?_0x1ce510['options'][_0xe194('0x18')]===undefined?!![]:![]:!![],'where':_0x1ce510[_0xe194('0x17')]?_0x1ce510[_0xe194('0x17')][_0xe194('0x19')]||null:null,'attributes':_0x1ce510[_0xe194('0x17')]?_0x1ce510[_0xe194('0x17')]['attributes']||null:null,'include':_0x1ce510[_0xe194('0x17')]?_0x1ce510[_0xe194('0x17')][_0xe194('0x1d')]?_[_0xe194('0x1c')](_0x1ce510[_0xe194('0x17')][_0xe194('0x1d')],function(_0x340cab){return{'model':db[_0x340cab[_0xe194('0x1e')]],'as':_0x340cab['as'],'attributes':_0x340cab[_0xe194('0x1a')],'include':_0x340cab[_0xe194('0x1d')]?_[_0xe194('0x1c')](_0x340cab[_0xe194('0x1d')],function(_0x10996c){return{'model':db[_0x10996c[_0xe194('0x1e')]],'as':_0x10996c['as'],'attributes':_0x10996c[_0xe194('0x1a')],'include':_0x10996c[_0xe194('0x1d')]?_['map'](_0x10996c[_0xe194('0x1d')],function(_0x3407ba){return{'model':db[_0x3407ba[_0xe194('0x1e')]],'as':_0x3407ba['as'],'attributes':_0x3407ba[_0xe194('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe194('0xb')](function(_0x4aad78){logger[_0xe194('0xc')](_0xe194('0x21'),_0x1ce510);logger[_0xe194('0xf')](_0xe194('0x21'),_0x1ce510,JSON[_0xe194('0x10')](_0x4aad78));_0x4e61a2(_0x4aad78);})[_0xe194('0x20')](function(_0x505cbc){logger['error']('ShowTrigger',_0x505cbc[_0xe194('0x13')],_0x1ce510);_0x217efd(_0x802b41[_0xe194('0x11')](0x1f4,_0x505cbc[_0xe194('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 881039c..3213143 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 _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 +var _0x34db=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','show','post','/:id/clone','clone','create','put','update','delete','destroy','exports','multer'];(function(_0x58ab96,_0x84a8e4){var _0x451aa2=function(_0x3b7f48){while(--_0x3b7f48){_0x58ab96['push'](_0x58ab96['shift']());}};_0x451aa2(++_0x84a8e4);}(_0x34db,0x149));var _0xb34d=function(_0xcbc16e,_0x1c30a5){_0xcbc16e=_0xcbc16e-0x0;var _0x4ee321=_0x34db[_0xcbc16e];return _0x4ee321;};'use strict';var multer=require(_0xb34d('0x0'));var util=require(_0xb34d('0x1'));var path=require(_0xb34d('0x2'));var timeout=require(_0xb34d('0x3'));var express=require('express');var router=express[_0xb34d('0x4')]();var fs_extra=require(_0xb34d('0x5'));var auth=require(_0xb34d('0x6'));var interaction=require(_0xb34d('0x7'));var config=require(_0xb34d('0x8'));var controller=require(_0xb34d('0x9'));router[_0xb34d('0xa')]('/',auth[_0xb34d('0xb')](),controller['index']);router['get']('/:id',auth[_0xb34d('0xb')](),controller[_0xb34d('0xc')]);router[_0xb34d('0xd')](_0xb34d('0xe'),auth[_0xb34d('0xb')](),controller[_0xb34d('0xf')]);router[_0xb34d('0xd')]('/',auth['isAuthenticated'](),controller[_0xb34d('0x10')]);router[_0xb34d('0x11')]('/:id',auth[_0xb34d('0xb')](),controller[_0xb34d('0x12')]);router[_0xb34d('0x13')]('/:id',auth[_0xb34d('0xb')](),controller[_0xb34d('0x14')]);module[_0xb34d('0x15')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index e0ede86..7182b54 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 _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 +var _0x7917=['shortinfo','inband','auto','rfc2833','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','never','INTEGER','always','accept','refuse','uac','pai','fingerprint','certificate','active','passive','actpass','dynamic','update,nonat','BOOLEAN','sequelize','exports','name','ENUM','friend','user','peer','STRING','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info'];(function(_0x5b2132,_0x49215e){var _0x486098=function(_0xd8f8a1){while(--_0xd8f8a1){_0x5b2132['push'](_0x5b2132['shift']());}};_0x486098(++_0x49215e);}(_0x7917,0x1a0));var _0x7791=function(_0x93ca28,_0x26e5e5){_0x93ca28=_0x93ca28-0x0;var _0x1fa374=_0x7917[_0x93ca28];return _0x1fa374;};'use strict';var Sequelize=require(_0x7791('0x0'));module[_0x7791('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x7791('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x7791('0x3')](_0x7791('0x4'),_0x7791('0x5'),_0x7791('0x6')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x7791('0x7')],'allowNull':![],'defaultValue':_0x7791('0x8')},'callingpres':{'type':Sequelize[_0x7791('0x3')](_0x7791('0x9'),'ALLOWED_PASSED_SCREEN',_0x7791('0xa'),_0x7791('0xb'),_0x7791('0xc'),_0x7791('0xd'),_0x7791('0xe'),_0x7791('0xf'))},'deny':{'type':Sequelize[_0x7791('0x7')]},'permit':{'type':Sequelize[_0x7791('0x7')]},'secret':{'type':Sequelize[_0x7791('0x7')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0x7791('0x7')]},'transport':{'type':Sequelize['STRING'],'defaultValue':_0x7791('0x10'),'set':function(_0x49b1cb){this[_0x7791('0x11')](_0x7791('0x12'),_0x49b1cb?_0x49b1cb[_0x7791('0x13')](','):null);},'get':function(){return this[_0x7791('0x14')](_0x7791('0x12'))?this['getDataValue']('transport')[_0x7791('0x15')](','):null;},'comment':_0x7791('0x16')},'dtmfmode':{'type':Sequelize[_0x7791('0x3')]('rfc2833',_0x7791('0x17'),_0x7791('0x18'),_0x7791('0x19'),_0x7791('0x1a')),'defaultValue':_0x7791('0x1b')},'directmedia':{'type':Sequelize[_0x7791('0x3')](_0x7791('0x1c'),'no',_0x7791('0x1d'),_0x7791('0x1e'),_0x7791('0x1f')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x7791('0x3')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize['STRING'],'defaultValue':_0x7791('0x20'),'set':function(_0x2d8ee1){this[_0x7791('0x11')](_0x7791('0x21'),_0x2d8ee1?_0x2d8ee1[_0x7791('0x13')](','):null);},'get':function(){return this['getDataValue'](_0x7791('0x21'))?this['getDataValue'](_0x7791('0x21'))[_0x7791('0x15')](','):null;},'comment':_0x7791('0x22')},'callgroup':{'type':Sequelize[_0x7791('0x7')]},'namedcallgroup':{'type':Sequelize[_0x7791('0x7')]},'pickupgroup':{'type':Sequelize[_0x7791('0x7')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x7791('0x7')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x7791('0x7')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x7791('0x7')],'defaultValue':_0x7791('0x23')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x16fe60){this['setDataValue'](_0x7791('0x24'),_0x16fe60?_0x16fe60[_0x7791('0x13')](';'):'ulaw;alaw;gsm');},'get':function(){return this['getDataValue']('allow')?this[_0x7791('0x14')]('allow')[_0x7791('0x15')](';'):null;},'comment':_0x7791('0x25')},'autoframing':{'type':Sequelize[_0x7791('0x3')](_0x7791('0x1c'),'no')},'insecure':{'type':Sequelize[_0x7791('0x7')],'defaultValue':_0x7791('0x26'),'set':function(_0x43be6a){this['setDataValue'](_0x7791('0x27'),_0x43be6a?_0x43be6a[_0x7791('0x13')](','):null);},'get':function(){return this[_0x7791('0x14')](_0x7791('0x27'))?this[_0x7791('0x14')](_0x7791('0x27'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x7791('0x3')](_0x7791('0x1c'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x7791('0x3')](_0x7791('0x1c'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x7791('0x3')](_0x7791('0x1c'),'no',_0x7791('0x28'))},'promiscredir':{'type':Sequelize[_0x7791('0x3')](_0x7791('0x1c'),'no')},'useclientcode':{'type':Sequelize[_0x7791('0x3')]('yes','no')},'accountcode':{'type':Sequelize[_0x7791('0x29')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x7791('0x7')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x7791('0x7')]},'callcounter':{'type':Sequelize[_0x7791('0x3')]('yes','no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x7791('0x3')](_0x7791('0x1c'),'no')},'allowsubscribe':{'type':Sequelize[_0x7791('0x3')]('yes','no')},'allowtransfer':{'type':Sequelize['ENUM'](_0x7791('0x1c'),'no')},'ignoresdpversion':{'type':Sequelize[_0x7791('0x3')](_0x7791('0x1c'),'no')},'subscribecontext':{'type':Sequelize[_0x7791('0x7')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x7791('0x3')](_0x7791('0x1c'),'no',_0x7791('0x2a')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x7791('0x29')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM']('yes','no')},'mailbox':{'type':Sequelize[_0x7791('0x7')]},'session_timers':{'type':Sequelize['ENUM'](_0x7791('0x2b'),_0x7791('0x2c'),'originate')},'session_expires':{'type':Sequelize[_0x7791('0x29')](0xb)},'session_minse':{'type':Sequelize[_0x7791('0x29')](0xb)},'session_refresher':{'type':Sequelize[_0x7791('0x3')](_0x7791('0x2d'),'uas'),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x7791('0x7')]},'regexten':{'type':Sequelize[_0x7791('0x7')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x7791('0x29')](0x5)},'qualify':{'type':Sequelize[_0x7791('0x3')](_0x7791('0x1c'),'no'),'defaultValue':_0x7791('0x1c')},'keepalive':{'type':Sequelize[_0x7791('0x29')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x7791('0x7')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x7791('0x29')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0x7791('0x3')](_0x7791('0x1c'),'no',_0x7791('0x2e')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x7791('0x7')]},'callbackextension':{'type':Sequelize[_0x7791('0x7')]},'timert1':{'type':Sequelize[_0x7791('0x29')](0xb)},'timerb':{'type':Sequelize[_0x7791('0x29')](0xb)},'qualifyfreq':{'type':Sequelize[_0x7791('0x29')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x7791('0x7')]},'unsolicited_mailbox':{'type':Sequelize[_0x7791('0x7')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x7791('0x29')](0xb)},'encryption':{'type':Sequelize[_0x7791('0x3')](_0x7791('0x1c'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x7791('0x3')]('yes','no')},'force_avp':{'type':Sequelize[_0x7791('0x3')](_0x7791('0x1c'),'no')},'icesupport':{'type':Sequelize[_0x7791('0x3')](_0x7791('0x1c'),'no')},'dtlsenable':{'type':Sequelize[_0x7791('0x3')](_0x7791('0x1c'),'no')},'dtlsverify':{'type':Sequelize[_0x7791('0x3')](_0x7791('0x1c'),'no',_0x7791('0x2f'),_0x7791('0x30'))},'dtlsrekey':{'type':Sequelize[_0x7791('0x29')](0xb)},'dtlscertfile':{'type':Sequelize[_0x7791('0x7')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x7791('0x7')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0x7791('0x3')](_0x7791('0x31'),_0x7791('0x32'),_0x7791('0x33')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x7791('0x7')]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x7791('0x7')]},'recordofffeature':{'type':Sequelize[_0x7791('0x7')]},'call_limit':{'type':Sequelize[_0x7791('0x29')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x7791('0x1c'),'no')},'subscribemwi':{'type':Sequelize[_0x7791('0x3')]('yes','no')},'vmexten':{'type':Sequelize[_0x7791('0x7')]},'mohinterpret':{'type':Sequelize[_0x7791('0x7')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0x7791('0x7')]},'description':{'type':Sequelize[_0x7791('0x7')]},'host':{'type':Sequelize[_0x7791('0x7')],'defaultValue':_0x7791('0x34')},'canreinvite':{'type':Sequelize[_0x7791('0x3')]('yes','no',_0x7791('0x1d'),_0x7791('0x1e'),_0x7791('0x35')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x7791('0x7')]},'otherFields':{'type':Sequelize[_0x7791('0x7')]},'active':{'type':Sequelize[_0x7791('0x36')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x7791('0x7')],'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 9b2cf70..b7610b4 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 _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 +var _0xd6d6=['sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','get','Trunks','UserProfileResource','stack','send','index','rawAttributes','fieldName','type','model','map','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','VIRTUAL','filter','merge','options','Trunk','includeAll','include','findAll','rows','show','params','find','clone','omit','createdAt','updatedAt','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','create','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','role','server/files/templates/registry.ejs','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','jayson/promise','client','http','request','then','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch'];(function(_0x1ac815,_0x356931){var _0xffda4a=function(_0x3adb70){while(--_0x3adb70){_0x1ac815['push'](_0x1ac815['shift']());}};_0xffda4a(++_0x356931);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x1845a8,_0x10ec9c){_0x1845a8=_0x1845a8-0x0;var _0x193681=_0xd6d6[_0x1845a8];return _0x193681;};'use strict';var emlformat=require(_0x6d6d('0x0'));var rimraf=require(_0x6d6d('0x1'));var zipdir=require(_0x6d6d('0x2'));var jsonpatch=require(_0x6d6d('0x3'));var rp=require('request-promise');var moment=require(_0x6d6d('0x4'));var BPromise=require(_0x6d6d('0x5'));var Mustache=require(_0x6d6d('0x6'));var util=require(_0x6d6d('0x7'));var path=require(_0x6d6d('0x8'));var sox=require(_0x6d6d('0x9'));var csv=require(_0x6d6d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6d6d('0xb'));var _=require(_0x6d6d('0xc'));var squel=require(_0x6d6d('0xd'));var crypto=require(_0x6d6d('0xe'));var jsforce=require(_0x6d6d('0xf'));var deskjs=require(_0x6d6d('0x10'));var toCsv=require(_0x6d6d('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6d6d('0x11'));var authService=require(_0x6d6d('0x12'));var qs=require(_0x6d6d('0x13'));var as=require(_0x6d6d('0x14'));var hardwareService=require(_0x6d6d('0x15'));var logger=require('../../config/logger')(_0x6d6d('0x16'));var utils=require(_0x6d6d('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6d6d('0x18'))['db'];var jayson=require(_0x6d6d('0x19'));var client=jayson[_0x6d6d('0x1a')][_0x6d6d('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x2b74ed,_0x41fbdf,_0x19cf50,_0x2cb2dd){return new BPromise(function(_0x5f4154,_0xd09ea7){var _0x3dd4b3=_0x2cb2dd||client;return _0x3dd4b3[_0x6d6d('0x1c')](_0x2b74ed,_0x19cf50)[_0x6d6d('0x1d')](function(_0x29cbd8){logger['info'](_0x6d6d('0x1e'),_0x41fbdf,'request\x20sent');logger[_0x6d6d('0x1f')](_0x6d6d('0x20'),_0x41fbdf,_0x6d6d('0x21'),JSON['stringify'](_0x29cbd8));if(_0x29cbd8['error']){if(_0x29cbd8[_0x6d6d('0x22')][_0x6d6d('0x23')]===0x1f4){logger[_0x6d6d('0x22')](_0x6d6d('0x1e'),_0x41fbdf,_0x29cbd8['error']['message']);return _0xd09ea7(_0x29cbd8[_0x6d6d('0x22')]['message']);}logger[_0x6d6d('0x22')](_0x6d6d('0x1e'),_0x41fbdf,_0x29cbd8[_0x6d6d('0x22')][_0x6d6d('0x24')]);return _0x5f4154(_0x29cbd8[_0x6d6d('0x22')][_0x6d6d('0x24')]);}else{logger[_0x6d6d('0x25')](_0x6d6d('0x1e'),_0x41fbdf,_0x6d6d('0x21'));_0x5f4154(_0x29cbd8[_0x6d6d('0x26')][_0x6d6d('0x24')]);}})[_0x6d6d('0x27')](function(_0x466a29){logger[_0x6d6d('0x22')](_0x6d6d('0x1e'),_0x41fbdf,_0x466a29);_0xd09ea7(_0x466a29);});});}function respondWithStatusCode(_0x25a02e,_0xced622){_0xced622=_0xced622||0xcc;return function(_0x583b10){if(_0x583b10){return _0x25a02e[_0x6d6d('0x28')](_0xced622);}return _0x25a02e[_0x6d6d('0x29')](_0xced622)[_0x6d6d('0x2a')]();};}function respondWithResult(_0x97ec9e,_0xf0df7f){_0xf0df7f=_0xf0df7f||0xc8;return function(_0x12fab2){if(_0x12fab2){return _0x97ec9e['status'](_0xf0df7f)[_0x6d6d('0x2b')](_0x12fab2);}};}function respondWithFilteredResult(_0x2b5e31,_0x235451){return function(_0x126ac8){if(_0x126ac8){var _0x25c121=typeof _0x235451[_0x6d6d('0x2c')]===_0x6d6d('0x2d')&&typeof _0x235451['limit']===_0x6d6d('0x2d');var _0x9595d8=_0x126ac8['count'];var _0x553645=_0x25c121?0x0:_0x235451[_0x6d6d('0x2c')];var _0x5273cd=_0x25c121?_0x126ac8[_0x6d6d('0x2e')]:_0x235451['offset']+_0x235451[_0x6d6d('0x2f')];var _0x20255e;if(_0x5273cd>=_0x9595d8){_0x5273cd=_0x9595d8;_0x20255e=0xc8;}else{_0x20255e=0xce;}_0x2b5e31[_0x6d6d('0x29')](_0x20255e);return _0x2b5e31[_0x6d6d('0x30')](_0x6d6d('0x31'),_0x553645+'-'+_0x5273cd+'/'+_0x9595d8)[_0x6d6d('0x2b')](_0x126ac8);}return null;};}function patchUpdates(_0xdda3f2){return function(_0x359cfd){try{jsonpatch[_0x6d6d('0x32')](_0x359cfd,_0xdda3f2,!![]);}catch(_0x34050a){return BPromise['reject'](_0x34050a);}return _0x359cfd[_0x6d6d('0x33')]();};}function saveUpdates(_0x4f1fc5,_0x18015a){return function(_0x1ea9b2){if(_0x1ea9b2){return _0x1ea9b2[_0x6d6d('0x34')](_0x4f1fc5)[_0x6d6d('0x1d')](function(_0x5c6248){return _0x5c6248;});}return null;};}function removeEntity(_0x182441,_0x4f2f13){return function(_0x3cc702){if(_0x3cc702){return _0x3cc702[_0x6d6d('0x35')]()['then'](function(){var _0x37993f=_0x3cc702[_0x6d6d('0x36')]({'plain':!![]});var _0x37ac94=_0x6d6d('0x37');return db[_0x6d6d('0x38')][_0x6d6d('0x35')]({'where':{'type':_0x37ac94,'resourceId':_0x37993f['id']}})[_0x6d6d('0x1d')](function(){return _0x3cc702;});})[_0x6d6d('0x1d')](function(){_0x182441[_0x6d6d('0x29')](0xcc)[_0x6d6d('0x2a')]();});}};}function handleEntityNotFound(_0x2fcf88,_0x3693da){return function(_0x17d863){if(!_0x17d863){_0x2fcf88[_0x6d6d('0x28')](0x194);}return _0x17d863;};}function handleError(_0x5a2397,_0x1335ef){_0x1335ef=_0x1335ef||0x1f4;return function(_0xf98bfa){logger[_0x6d6d('0x22')](_0xf98bfa[_0x6d6d('0x39')]);if(_0xf98bfa['name']){delete _0xf98bfa['name'];}_0x5a2397[_0x6d6d('0x29')](_0x1335ef)[_0x6d6d('0x3a')](_0xf98bfa);};}exports[_0x6d6d('0x3b')]=function(_0x4d42ff,_0x2a3f67){var _0x2607c1={},_0x23c173={},_0x125d79={'count':0x0,'rows':[]};var _0x52556b=_['map'](db['Trunk'][_0x6d6d('0x3c')],function(_0x4196f0){return{'name':_0x4196f0[_0x6d6d('0x3d')],'type':_0x4196f0[_0x6d6d('0x3e')]['key']};});_0x23c173[_0x6d6d('0x3f')]=_[_0x6d6d('0x40')](_0x52556b,_0x6d6d('0x41'));_0x23c173[_0x6d6d('0x42')]=_[_0x6d6d('0x43')](_0x4d42ff[_0x6d6d('0x42')]);_0x23c173['filters']=_[_0x6d6d('0x44')](_0x23c173[_0x6d6d('0x3f')],_0x23c173[_0x6d6d('0x42')]);_0x2607c1[_0x6d6d('0x45')]=_[_0x6d6d('0x44')](_0x23c173[_0x6d6d('0x3f')],qs[_0x6d6d('0x46')](_0x4d42ff['query'][_0x6d6d('0x46')]));_0x2607c1[_0x6d6d('0x45')]=_0x2607c1[_0x6d6d('0x45')][_0x6d6d('0x47')]?_0x2607c1[_0x6d6d('0x45')]:_0x23c173['model'];if(!_0x4d42ff[_0x6d6d('0x42')][_0x6d6d('0x48')]('nolimit')){_0x2607c1[_0x6d6d('0x2f')]=qs['limit'](_0x4d42ff[_0x6d6d('0x42')][_0x6d6d('0x2f')]);_0x2607c1['offset']=qs[_0x6d6d('0x2c')](_0x4d42ff[_0x6d6d('0x42')][_0x6d6d('0x2c')]);}_0x2607c1[_0x6d6d('0x49')]=qs[_0x6d6d('0x4a')](_0x4d42ff['query']['sort']);_0x2607c1[_0x6d6d('0x4b')]=qs['filters'](_['pick'](_0x4d42ff[_0x6d6d('0x42')],_0x23c173[_0x6d6d('0x4c')]),_0x52556b);if(_0x4d42ff[_0x6d6d('0x42')]['filter']){_0x2607c1[_0x6d6d('0x4b')]=_['merge'](_0x2607c1[_0x6d6d('0x4b')],{'$or':_[_0x6d6d('0x40')](_0x52556b,function(_0x1d3826){if(_0x1d3826[_0x6d6d('0x3e')]!==_0x6d6d('0x4d')){var _0x2669f0={};_0x2669f0[_0x1d3826[_0x6d6d('0x41')]]={'$like':'%'+_0x4d42ff['query'][_0x6d6d('0x4e')]+'%'};return _0x2669f0;}})});}_0x2607c1=_[_0x6d6d('0x4f')]({},_0x2607c1,_0x4d42ff[_0x6d6d('0x50')]);var _0x389e51={'where':_0x2607c1[_0x6d6d('0x4b')]};return db[_0x6d6d('0x51')][_0x6d6d('0x2e')](_0x389e51)[_0x6d6d('0x1d')](function(_0x24cec2){_0x125d79['count']=_0x24cec2;if(_0x4d42ff['query'][_0x6d6d('0x52')]){_0x2607c1[_0x6d6d('0x53')]=[{'all':!![]}];}return db[_0x6d6d('0x51')][_0x6d6d('0x54')](_0x2607c1);})[_0x6d6d('0x1d')](function(_0x492834){_0x125d79[_0x6d6d('0x55')]=_0x492834;return _0x125d79;})[_0x6d6d('0x1d')](respondWithFilteredResult(_0x2a3f67,_0x2607c1))[_0x6d6d('0x27')](handleError(_0x2a3f67,null));};exports[_0x6d6d('0x56')]=function(_0x2ee917,_0x23c2db){var _0x1f7a09={'raw':![],'where':{'id':_0x2ee917[_0x6d6d('0x57')]['id']}},_0x39ec2a={};_0x39ec2a[_0x6d6d('0x3f')]=_[_0x6d6d('0x43')](db[_0x6d6d('0x51')]['rawAttributes']);_0x39ec2a[_0x6d6d('0x42')]=_[_0x6d6d('0x43')](_0x2ee917[_0x6d6d('0x42')]);_0x39ec2a[_0x6d6d('0x4c')]=_[_0x6d6d('0x44')](_0x39ec2a['model'],_0x39ec2a[_0x6d6d('0x42')]);_0x1f7a09[_0x6d6d('0x45')]=_[_0x6d6d('0x44')](_0x39ec2a['model'],qs['fields'](_0x2ee917[_0x6d6d('0x42')]['fields']));_0x1f7a09[_0x6d6d('0x45')]=_0x1f7a09[_0x6d6d('0x45')][_0x6d6d('0x47')]?_0x1f7a09[_0x6d6d('0x45')]:_0x39ec2a[_0x6d6d('0x3f')];if(_0x2ee917[_0x6d6d('0x42')][_0x6d6d('0x52')]){_0x1f7a09[_0x6d6d('0x53')]=[{'all':!![]}];}_0x1f7a09=_[_0x6d6d('0x4f')]({},_0x1f7a09,_0x2ee917[_0x6d6d('0x50')]);return db['Trunk'][_0x6d6d('0x58')](_0x1f7a09)[_0x6d6d('0x1d')](handleEntityNotFound(_0x23c2db,null))[_0x6d6d('0x1d')](respondWithResult(_0x23c2db,null))[_0x6d6d('0x27')](handleError(_0x23c2db,null));};exports[_0x6d6d('0x59')]=function(_0x45f44a,_0x243be3){var _0x5e5ace={'where':{'id':_0x45f44a[_0x6d6d('0x57')]['id']}},_0x5a1cdc={};_0x5a1cdc[_0x6d6d('0x3f')]=_['keys'](db[_0x6d6d('0x51')][_0x6d6d('0x3c')]);_0x5e5ace[_0x6d6d('0x45')]=_[_0x6d6d('0x44')](_0x5a1cdc[_0x6d6d('0x3f')],qs[_0x6d6d('0x46')](_0x45f44a[_0x6d6d('0x42')][_0x6d6d('0x46')]));_0x5e5ace[_0x6d6d('0x45')]=_0x5e5ace[_0x6d6d('0x45')][_0x6d6d('0x47')]?_0x5e5ace[_0x6d6d('0x45')]:_0x5a1cdc[_0x6d6d('0x3f')];if(_0x45f44a[_0x6d6d('0x42')][_0x6d6d('0x52')]){_0x5e5ace['include']=[{'all':!![]}];}_0x5e5ace=_[_0x6d6d('0x4f')]({},_0x5e5ace,_0x45f44a[_0x6d6d('0x50')]);return db['Trunk'][_0x6d6d('0x58')](_0x5e5ace)[_0x6d6d('0x1d')](handleEntityNotFound(_0x243be3,null))[_0x6d6d('0x1d')](function(_0x407357){if(_0x407357){var _0x2d61cc=_0x407357[_0x6d6d('0x36')]({'plain':!![]});_0x2d61cc=qs[_0x6d6d('0x5a')](_0x2d61cc,['id',_0x6d6d('0x5b'),_0x6d6d('0x5c')]);_0x45f44a['body']=_['omit'](_0x45f44a[_0x6d6d('0x5d')],['id',_0x6d6d('0x5b'),_0x6d6d('0x5c')]);return db['Trunk']['create'](_[_0x6d6d('0x4f')](_0x2d61cc,_0x45f44a['body']),{'include':_0x45f44a[_0x6d6d('0x42')]['includeAll']?[{'all':!![]}]:undefined})[_0x6d6d('0x1d')](function(_0x367a6f){var _0x21f14c=_0x45f44a[_0x6d6d('0x5e')][_0x6d6d('0x36')]({'plain':!![]});if(!_0x21f14c)throw new Error(_0x6d6d('0x5f'));if(_0x21f14c['role']===_0x6d6d('0x5e')){var _0x5eb78f=_0x367a6f[_0x6d6d('0x36')]({'plain':!![]});var _0x52d9e7=_0x6d6d('0x37');return db[_0x6d6d('0x60')][_0x6d6d('0x58')]({'where':{'name':_0x52d9e7,'userProfileId':_0x21f14c[_0x6d6d('0x61')]},'raw':!![]})[_0x6d6d('0x1d')](function(_0x163bb7){if(_0x163bb7&&_0x163bb7[_0x6d6d('0x62')]===0x0){return db['UserProfileResource']['create']({'name':_0x5eb78f[_0x6d6d('0x41')],'resourceId':_0x5eb78f['id'],'type':_0x163bb7['name'],'sectionId':_0x163bb7['id']},{})[_0x6d6d('0x1d')](function(){return _0x367a6f;});}else{return _0x367a6f;}})['catch'](function(_0xe19d23){logger[_0x6d6d('0x22')](_0x6d6d('0x63'),_0xe19d23);throw _0xe19d23;});}return _0x367a6f;});}})[_0x6d6d('0x1d')](respondWithResult(_0x243be3,0xc9))[_0x6d6d('0x27')](handleError(_0x243be3,null));};exports[_0x6d6d('0x64')]=function(_0x5dd3b0,_0x3cedc0,_0xbca58e){var _0x3a6d79;return db[_0x6d6d('0x51')][_0x6d6d('0x64')](_0x5dd3b0[_0x6d6d('0x5d')],{'raw':!![]})[_0x6d6d('0x1d')](function(_0x589d64){_0x3a6d79=_0x589d64;return db[_0x6d6d('0x51')][_0x6d6d('0x54')]({'raw':!![]});})[_0x6d6d('0x1d')](function(_0x3bf8a7){var _0x1aa25d=fs[_0x6d6d('0x65')](path[_0x6d6d('0x66')](config[_0x6d6d('0x67')],_0x6d6d('0x68')),_0x6d6d('0x69'));var _0x1efc55=fs['readFileSync'](path['join'](config[_0x6d6d('0x67')],'server/files/templates/registry.ejs'),'utf8');var _0x5b6ca7=ejs[_0x6d6d('0x6a')](_0x1aa25d,{'trunks':_0x3bf8a7||[]});fs[_0x6d6d('0x6b')](_0x6d6d('0x6c'),_0x5b6ca7);if(_0x3a6d79[_0x6d6d('0x6d')]){var _0x2d4a04=ejs[_0x6d6d('0x6a')](_0x1efc55,{'trunks':_0x3bf8a7||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x2d4a04);}})[_0x6d6d('0x1d')](function(){return respondWithRpcPromise('Reload','create',{'module':'chan_sip.so'});})[_0x6d6d('0x1d')](function(){var _0x5cd494=_0x5dd3b0[_0x6d6d('0x5e')]['get']({'plain':!![]});if(!_0x5cd494)throw new Error(_0x6d6d('0x5f'));if(_0x5cd494[_0x6d6d('0x6e')]==='user'){var _0x52dca9=_0x3a6d79[_0x6d6d('0x36')]({'plain':!![]});return db[_0x6d6d('0x60')][_0x6d6d('0x58')]({'where':{'name':_0x6d6d('0x37'),'userProfileId':_0x5cd494['userProfileId']},'raw':!![]})[_0x6d6d('0x1d')](function(_0x264d24){if(_0x264d24&&_0x264d24[_0x6d6d('0x62')]===0x0){return db[_0x6d6d('0x38')]['create']({'name':_0x52dca9[_0x6d6d('0x41')],'resourceId':_0x52dca9['id'],'type':_0x264d24['name'],'sectionId':_0x264d24['id']},{})['then'](function(){return _0x3a6d79;});}else{return _0x3a6d79;}})['catch'](function(_0x3da125){logger['error'](_0x6d6d('0x63'),_0x3da125);throw _0x3da125;});}return _0x3a6d79;})[_0x6d6d('0x1d')](respondWithResult(_0x3cedc0,0xc9))[_0x6d6d('0x27')](handleError(_0x3cedc0,null));};exports['update']=function(_0x5146a4,_0x55d877,_0xcba8dd){var _0x542386;return db['Trunk'][_0x6d6d('0x58')]({'where':{'id':_0x5146a4[_0x6d6d('0x57')]['id']}})[_0x6d6d('0x1d')](handleEntityNotFound(_0x55d877,null))[_0x6d6d('0x1d')](saveUpdates(_0x5146a4[_0x6d6d('0x5d')],null))[_0x6d6d('0x1d')](function(_0x3f9aad){if(_0x3f9aad){_0x542386=_0x3f9aad;return db['Trunk']['findAll']({'raw':!![]});}})['then'](function(_0x5c20c5){if(_0x5c20c5){var _0x54bdef=fs['readFileSync'](path[_0x6d6d('0x66')](config[_0x6d6d('0x67')],_0x6d6d('0x68')),_0x6d6d('0x69'));var _0x59998e=fs['readFileSync'](path['join'](config[_0x6d6d('0x67')],_0x6d6d('0x6f')),_0x6d6d('0x69'));var _0x1c8d15=ejs['render'](_0x54bdef,{'trunks':_0x5c20c5||[]});fs['writeFileSync'](_0x6d6d('0x6c'),_0x1c8d15);var _0x1e1c4e=ejs['render'](_0x59998e,{'trunks':_0x5c20c5||[]});fs[_0x6d6d('0x6b')](_0x6d6d('0x70'),_0x1e1c4e);return respondWithRpcPromise(_0x6d6d('0x71'),_0x6d6d('0x34'),{'module':_0x6d6d('0x72')});}return null;})['then'](function(_0xf5586f){if(_0xf5586f){return _0x542386;}})['then'](respondWithResult(_0x55d877,null))[_0x6d6d('0x27')](handleError(_0x55d877,null));};exports['destroy']=function(_0x108108,_0x54a5a9,_0x445196){var _0x1bfce6;return db[_0x6d6d('0x51')][_0x6d6d('0x58')]({'where':{'id':_0x108108[_0x6d6d('0x57')]['id']}})[_0x6d6d('0x1d')](handleEntityNotFound(_0x54a5a9,null))[_0x6d6d('0x1d')](removeEntity(_0x54a5a9,null))[_0x6d6d('0x1d')](function(){return db[_0x6d6d('0x51')][_0x6d6d('0x54')]({'raw':!![]});})[_0x6d6d('0x1d')](function(_0xb2940d){var _0x7c1934=fs[_0x6d6d('0x65')](path[_0x6d6d('0x66')](config[_0x6d6d('0x67')],'server/files/templates/trunk.ejs'),'utf8');var _0x139b61=fs['readFileSync'](path[_0x6d6d('0x66')](config[_0x6d6d('0x67')],'server/files/templates/registry.ejs'),'utf8');var _0x1d2668=ejs['render'](_0x7c1934,{'trunks':_0xb2940d});var _0x2ab52f=ejs[_0x6d6d('0x6a')](_0x139b61,{'trunks':_0xb2940d});fs[_0x6d6d('0x6b')](_0x6d6d('0x6c'),_0x1d2668);fs[_0x6d6d('0x6b')](_0x6d6d('0x70'),_0x2ab52f);return respondWithRpcPromise(_0x6d6d('0x71'),_0x6d6d('0x35'),{'module':'chan_sip.so'});})[_0x6d6d('0x27')](handleError(_0x54a5a9,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index e1e0467..442f660 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 _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 +var _0xffcd=['request-promise','rimraf','../../config/environment','./trunk.attributes','Trunk','tools_trunks','lodash','../../config/logger','moment','bluebird'];(function(_0x109a3e,_0x273d51){var _0x1e9854=function(_0x5e93cb){while(--_0x5e93cb){_0x109a3e['push'](_0x109a3e['shift']());}};_0x1e9854(++_0x273d51);}(_0xffcd,0x7e));var _0xdffc=function(_0x1cdb03,_0x3f86dc){_0x1cdb03=_0x1cdb03-0x0;var _0x219b6e=_0xffcd[_0x1cdb03];return _0x219b6e;};'use strict';var _=require(_0xdffc('0x0'));var util=require('util');var logger=require(_0xdffc('0x1'))('api');var moment=require(_0xdffc('0x2'));var BPromise=require(_0xdffc('0x3'));var rp=require(_0xdffc('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdffc('0x5'));var config=require(_0xdffc('0x6'));var attributes=require(_0xdffc('0x7'));module['exports']=function(_0x4acddd,_0x1aaab9){return _0x4acddd['define'](_0xdffc('0x8'),attributes,{'tableName':_0xdffc('0x9'),'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 f633f3f..36f3e9f 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 _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 +var _0x3431=['catch','GetTrunk','Trunk','options','raw','where','attributes','limit','map','include','model','ShowTrunk','find','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x467bda,_0x33b665){var _0x3bbdf3=function(_0x370bcf){while(--_0x370bcf){_0x467bda['push'](_0x467bda['shift']());}};_0x3bbdf3(++_0x33b665);}(_0x3431,0x1ea));var _0x1343=function(_0x1af05b,_0x5134b5){_0x1af05b=_0x1af05b-0x0;var _0x5be7cc=_0x3431[_0x1af05b];return _0x5be7cc;};'use strict';var _=require(_0x1343('0x0'));var util=require(_0x1343('0x1'));var moment=require('moment');var BPromise=require(_0x1343('0x2'));var rs=require(_0x1343('0x3'));var fs=require('fs');var Redis=require(_0x1343('0x4'));var db=require(_0x1343('0x5'))['db'];var utils=require(_0x1343('0x6'));var logger=require(_0x1343('0x7'))(_0x1343('0x8'));var config=require('../../config/environment');var jayson=require(_0x1343('0x9'));var client=jayson[_0x1343('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d86f6,_0x2f10f3,_0x4570f0){return new BPromise(function(_0x3f9519,_0x451248){return client[_0x1343('0xb')](_0x3d86f6,_0x4570f0)[_0x1343('0xc')](function(_0x5bc107){logger[_0x1343('0xd')](_0x1343('0xe'),_0x2f10f3,'request\x20sent');logger['debug']('Trunk,\x20%s,\x20%s,\x20%s',_0x2f10f3,_0x1343('0xf'),JSON[_0x1343('0x10')](_0x5bc107));if(_0x5bc107[_0x1343('0x11')]){if(_0x5bc107['error'][_0x1343('0x12')]===0x1f4){logger['error'](_0x1343('0xe'),_0x2f10f3,_0x5bc107[_0x1343('0x11')][_0x1343('0x13')]);return _0x451248(_0x5bc107['error']['message']);}logger[_0x1343('0x11')]('Trunk,\x20%s,\x20%s',_0x2f10f3,_0x5bc107[_0x1343('0x11')]['message']);return _0x3f9519(_0x5bc107[_0x1343('0x11')][_0x1343('0x13')]);}else{logger[_0x1343('0xd')](_0x1343('0xe'),_0x2f10f3,_0x1343('0xf'));_0x3f9519(_0x5bc107['result'][_0x1343('0x13')]);}})[_0x1343('0x14')](function(_0x19c8c0){logger['error'](_0x1343('0xe'),_0x2f10f3,_0x19c8c0);_0x451248(_0x19c8c0);});});}exports[_0x1343('0x15')]=function(_0x4d650a){var _0x56821c=this;return new Promise(function(_0x159fee,_0x1f47cb){return db[_0x1343('0x16')]['findAll']({'raw':_0x4d650a[_0x1343('0x17')]?_0x4d650a[_0x1343('0x17')][_0x1343('0x18')]===undefined?!![]:![]:!![],'where':_0x4d650a[_0x1343('0x17')]?_0x4d650a[_0x1343('0x17')][_0x1343('0x19')]||null:null,'attributes':_0x4d650a[_0x1343('0x17')]?_0x4d650a['options'][_0x1343('0x1a')]||null:null,'limit':_0x4d650a[_0x1343('0x17')]?_0x4d650a[_0x1343('0x17')][_0x1343('0x1b')]||null:null,'include':_0x4d650a[_0x1343('0x17')]?_0x4d650a[_0x1343('0x17')]['include']?_[_0x1343('0x1c')](_0x4d650a[_0x1343('0x17')][_0x1343('0x1d')],function(_0x487905){return{'model':db[_0x487905['model']],'as':_0x487905['as'],'attributes':_0x487905['attributes'],'include':_0x487905[_0x1343('0x1d')]?_[_0x1343('0x1c')](_0x487905['include'],function(_0x310331){return{'model':db[_0x310331[_0x1343('0x1e')]],'as':_0x310331['as'],'attributes':_0x310331[_0x1343('0x1a')],'include':_0x310331['include']?_[_0x1343('0x1c')](_0x310331['include'],function(_0x216a30){return{'model':db[_0x216a30[_0x1343('0x1e')]],'as':_0x216a30['as'],'attributes':_0x216a30[_0x1343('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1343('0xc')](function(_0x492b9e){logger[_0x1343('0xd')](_0x1343('0x15'),_0x4d650a);logger['debug'](_0x1343('0x15'),_0x4d650a,JSON[_0x1343('0x10')](_0x492b9e));_0x159fee(_0x492b9e);})[_0x1343('0x14')](function(_0x163f20){logger[_0x1343('0x11')](_0x1343('0x15'),_0x163f20[_0x1343('0x13')],_0x4d650a);_0x1f47cb(_0x56821c[_0x1343('0x11')](0x1f4,_0x163f20['message']));});});};exports[_0x1343('0x1f')]=function(_0x25fbef){var _0x29f294=this;return new Promise(function(_0x13470c,_0x391d0d){return db[_0x1343('0x16')][_0x1343('0x20')]({'raw':_0x25fbef['options']?_0x25fbef['options'][_0x1343('0x18')]===undefined?!![]:![]:!![],'where':_0x25fbef['options']?_0x25fbef[_0x1343('0x17')][_0x1343('0x19')]||null:null,'attributes':_0x25fbef['options']?_0x25fbef['options'][_0x1343('0x1a')]||null:null,'include':_0x25fbef[_0x1343('0x17')]?_0x25fbef['options'][_0x1343('0x1d')]?_['map'](_0x25fbef[_0x1343('0x17')][_0x1343('0x1d')],function(_0x35ef2e){return{'model':db[_0x35ef2e[_0x1343('0x1e')]],'as':_0x35ef2e['as'],'attributes':_0x35ef2e[_0x1343('0x1a')],'include':_0x35ef2e[_0x1343('0x1d')]?_[_0x1343('0x1c')](_0x35ef2e[_0x1343('0x1d')],function(_0x8203d){return{'model':db[_0x8203d['model']],'as':_0x8203d['as'],'attributes':_0x8203d[_0x1343('0x1a')],'include':_0x8203d[_0x1343('0x1d')]?_[_0x1343('0x1c')](_0x8203d[_0x1343('0x1d')],function(_0x58d971){return{'model':db[_0x58d971[_0x1343('0x1e')]],'as':_0x58d971['as'],'attributes':_0x58d971[_0x1343('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1343('0xc')](function(_0x17985c){logger['info'](_0x1343('0x1f'),_0x25fbef);logger[_0x1343('0x21')](_0x1343('0x1f'),_0x25fbef,JSON[_0x1343('0x10')](_0x17985c));_0x13470c(_0x17985c);})[_0x1343('0x14')](function(_0x4c5d60){logger[_0x1343('0x11')](_0x1343('0x1f'),_0x4c5d60[_0x1343('0x13')],_0x25fbef);_0x391d0d(_0x29f294[_0x1343('0x11')](0x1f4,_0x4c5d60[_0x1343('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 3871442..711fe52 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 _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 +var _0x9c16=['put','update','exports','express','../../components/auth/service','./user-setting.controller'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9c16,0xdb));var _0x69c1=function(_0x370030,_0x3849f4){_0x370030=_0x370030-0x0;var _0x498e14=_0x9c16[_0x370030];return _0x498e14;};'use strict';var express=require(_0x69c1('0x0'));var router=express['Router']();var auth=require(_0x69c1('0x1'));var controller=require(_0x69c1('0x2'));router[_0x69c1('0x3')]('/:id',auth['isAuthenticated'](),controller[_0x69c1('0x4')]);module[_0x69c1('0x5')]=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 20013dc..b640e81 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 _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 +var _0x9138=['info','debug','exports','ENUM','TEXT','DATE','INTEGER','UserId','sequelize','error','warning'];(function(_0x36eea0,_0x3c2234){var _0x2e7cb0=function(_0x4fc149){while(--_0x4fc149){_0x36eea0['push'](_0x36eea0['shift']());}};_0x2e7cb0(++_0x3c2234);}(_0x9138,0x168));var _0x8913=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x9138[_0x2aec52];return _0x3b8835;};'use strict';var Sequelize=require(_0x8913('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x8913('0x1'),_0x8913('0x2'),_0x8913('0x3'),_0x8913('0x4')];module[_0x8913('0x5')]={'clientSideLoggingLevel':{'type':Sequelize[_0x8913('0x6')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x8913('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x8913('0x7')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x8913('0x8')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x8913('0x9')],'unique':_0x8913('0xa')}}; \ 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 e91c008..3972534 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 _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 +var _0x31c2=['redis','./user-setting.socket','register','defaults','localhost','status','json','then','sendStatus','stack','name','send','update','user','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','find','body','catch','lodash','api','../../config/environment','socket.io-emitter'];(function(_0x1fa479,_0x5b0155){var _0x382058=function(_0x1a91fb){while(--_0x1a91fb){_0x1fa479['push'](_0x1fa479['shift']());}};_0x382058(++_0x5b0155);}(_0x31c2,0x98));var _0x231c=function(_0x5082a5,_0x5bba1a){_0x5082a5=_0x5082a5-0x0;var _0x26ee42=_0x31c2[_0x5082a5];return _0x26ee42;};'use strict';var _=require(_0x231c('0x0'));var Redis=require('ioredis');var logger=require('../../config/logger')(_0x231c('0x1'));var config=require(_0x231c('0x2'));var db=require('../../mysqldb')['db'];var socket=require(_0x231c('0x3'))(new Redis(config[_0x231c('0x4')]));require(_0x231c('0x5'))[_0x231c('0x6')](socket);config[_0x231c('0x4')]=_[_0x231c('0x7')](config[_0x231c('0x4')],{'host':_0x231c('0x8'),'port':0x18eb});function respondWithResult(_0x5afc76,_0x1e3997){_0x1e3997=_0x1e3997||0xc8;return function(_0x4fd8b8){if(_0x4fd8b8){return _0x5afc76[_0x231c('0x9')](_0x1e3997)[_0x231c('0xa')](_0x4fd8b8);}};}function saveUpdates(_0x2e1839){return function(_0x417e5){if(_0x417e5){return _0x417e5['update'](_0x2e1839)[_0x231c('0xb')](function(_0x1b8eb5){return _0x1b8eb5;});}return null;};}function handleEntityNotFound(_0x1b482f){return function(_0x21dec8){if(!_0x21dec8){_0x1b482f[_0x231c('0xc')](0x194);}return _0x21dec8;};}function handleError(_0x2fa733,_0x4f2f2c){_0x4f2f2c=_0x4f2f2c||0x1f4;return function(_0x526318){logger['error'](_0x526318[_0x231c('0xd')]);if(_0x526318[_0x231c('0xe')]){delete _0x526318[_0x231c('0xe')];}_0x2fa733[_0x231c('0x9')](_0x4f2f2c)[_0x231c('0xf')](_0x526318);};}exports[_0x231c('0x10')]=function(_0x3f24df,_0x1fbdaf){if(_0x3f24df[_0x231c('0x11')][_0x231c('0x12')]!==_0x231c('0x13'))throw new Error(_0x231c('0x14'));if(isNaN(Number(_0x3f24df[_0x231c('0x15')]['id'])))throw new Error(_0x231c('0x16'));return db['UserSetting'][_0x231c('0x17')]({'where':{'id':_0x3f24df[_0x231c('0x15')]['id']}})[_0x231c('0xb')](handleEntityNotFound(_0x1fbdaf,null))[_0x231c('0xb')](saveUpdates(_0x3f24df[_0x231c('0x18')],null))['then'](respondWithResult(_0x1fbdaf,null))[_0x231c('0x19')](handleError(_0x1fbdaf,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 85a0767..756dfe9 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 _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 +var _0x4fc0=['exports','events','../../mysqldb','save','update','emit','hook'];(function(_0xea8307,_0xa86298){var _0x4f9b10=function(_0x4fe3d4){while(--_0x4fe3d4){_0xea8307['push'](_0xea8307['shift']());}};_0x4f9b10(++_0xa86298);}(_0x4fc0,0x120));var _0x04fc=function(_0x3ed62e,_0x12ea87){_0x3ed62e=_0x3ed62e-0x0;var _0x26e389=_0x4fc0[_0x3ed62e];return _0x26e389;};'use strict';var EventEmitter=require(_0x04fc('0x0'));var UserSetting=require(_0x04fc('0x1'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x04fc('0x2'),'afterUpdate':_0x04fc('0x3'),'afterDestroy':'remove'};function emitEvent(_0xf5d182){return function(_0x3ccf81,_0x35f856,_0x22de1d){UserSettingEvents[_0x04fc('0x4')](_0xf5d182+':'+_0x3ccf81['id'],_0x3ccf81);UserSettingEvents[_0x04fc('0x4')](_0xf5d182,_0x3ccf81);_0x22de1d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting[_0x04fc('0x5')](e,emitEvent(event));}}module[_0x04fc('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 4de44e1..fd33f9d 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 _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 +var _0x3a25=['exports','define','UserSetting','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x3a25,0x15d));var _0x53a2=function(_0x5550b7,_0x763e){_0x5550b7=_0x5550b7-0x0;var _0x509eef=_0x3a25[_0x5550b7];return _0x509eef;};'use strict';var attributes=require(_0x53a2('0x0'));module[_0x53a2('0x1')]=function(_0x200e41){return _0x200e41[_0x53a2('0x2')](_0x53a2('0x3'),attributes,{'tableName':_0x53a2('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x119389){if(!_0x119389[_0x53a2('0x5')])_0x119389[_0x53a2('0x6')]=null;else if(_0x119389[_0x53a2('0x6')]===null)_0x119389[_0x53a2('0x6')]=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 e985357..e7742ee 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 _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 +var _0x7fe5=['UserId','register','length','./user-setting.events','save','update','user-setting:update','emit','user-setting:update:user-'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7fe5,0x135));var _0x57fe=function(_0x4a8227,_0x27ab19){_0x4a8227=_0x4a8227-0x0;var _0x403b2c=_0x7fe5[_0x4a8227];return _0x403b2c;};'use strict';var UserSettingEvents=require(_0x57fe('0x0'));var events=[_0x57fe('0x1'),'remove',_0x57fe('0x2')];function createListener(_0x206f71,_0x1d7b7d){return function(_0x2dcd05){_0x1d7b7d['emit'](_0x206f71,_0x2dcd05);if(_0x206f71===_0x57fe('0x3')){_0x1d7b7d[_0x57fe('0x4')](_0x57fe('0x5')+_0x2dcd05[_0x57fe('0x6')],_0x2dcd05);}};}exports[_0x57fe('0x7')]=function(_0x3adf51){for(var _0x5cfc47=0x0,_0x5c5048=events[_0x57fe('0x8')];_0x5cfc47<_0x5c5048;_0x5cfc47++){var _0x8f047c=events[_0x5cfc47];var _0x379452=createListener('user-setting:'+_0x8f047c,_0x3adf51);UserSettingEvents['on'](_0x8f047c,_0x379452);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index fc363e2..3747c75 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 _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 +var _0xc69d=['get','isAuthenticated','index','/describe','describe','/whoami','/presence','getPresence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','/:id/whatsapp/interactions','getWhatsappInteractions','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','/:id/sms_accounts','getSmsAccounts','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getApiKey','post','/:id/contacts','addContacts','/create_many','bulkCreate','addQueues','diskStorage','join','server/files/images/','format','%s-%s','file','addAvatar','/:id/login','login','logout','pause','/:id/unpause','unpause','/:id/teams','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','/:id/fax_interactions','addFaxInteractions','addSmsInteractions','/:id/openchannel_interactions','/:id/whatsapp_interactions','addWhatsappInteractions','addOpenchannelAccounts','/:id/chat_websites','addChatWebsites','addWhatsappAccounts','/:id/api_key','put','update','/:id/password','changePassword','delete','removeQueues','removeChatInteractions','removeFaxInteractions','/:id/sms_interactions','removeWhatsappInteractions','removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','messengerSoundNotification','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4db543,_0x1f4a8a){var _0x3b506d=function(_0x57e8e1){while(--_0x57e8e1){_0x4db543['push'](_0x4db543['shift']());}};_0x3b506d(++_0x1f4a8a);}(_0xc69d,0x143));var _0xdc69=function(_0x427352,_0x1bce61){_0x427352=_0x427352-0x0;var _0x23e0e6=_0xc69d[_0x427352];return _0x23e0e6;};'use strict';var multer=require('multer');var util=require(_0xdc69('0x0'));var path=require(_0xdc69('0x1'));var timeout=require(_0xdc69('0x2'));var express=require('express');var router=express[_0xdc69('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xdc69('0x4'));var interaction=require(_0xdc69('0x5'));var config=require(_0xdc69('0x6'));var controller=require('./user.controller');router[_0xdc69('0x7')]('/',auth[_0xdc69('0x8')](),controller[_0xdc69('0x9')]);router['get'](_0xdc69('0xa'),auth['isAuthenticated'](),controller[_0xdc69('0xb')]);router[_0xdc69('0x7')](_0xdc69('0xc'),auth[_0xdc69('0x8')](),controller['whoami']);router[_0xdc69('0x7')](_0xdc69('0xd'),auth[_0xdc69('0x8')](),controller[_0xdc69('0xe')]);router[_0xdc69('0x7')](_0xdc69('0xf'),auth[_0xdc69('0x8')](),controller[_0xdc69('0x10')]);router[_0xdc69('0x7')](_0xdc69('0x11'),controller[_0xdc69('0x12')]);router[_0xdc69('0x7')](_0xdc69('0x13'),auth['isAuthenticated'](),controller[_0xdc69('0x14')]);router[_0xdc69('0x7')]('/:id/contacts',auth[_0xdc69('0x8')](),controller[_0xdc69('0x15')]);router['get'](_0xdc69('0x16'),auth[_0xdc69('0x8')](),controller[_0xdc69('0x17')]);router[_0xdc69('0x7')](_0xdc69('0x18'),auth[_0xdc69('0x8')](),controller[_0xdc69('0x19')]);router['get']('/:id/groups',auth[_0xdc69('0x8')](),controller[_0xdc69('0x1a')]);router[_0xdc69('0x7')](_0xdc69('0x1b'),auth[_0xdc69('0x8')](),controller[_0xdc69('0x1c')]);router[_0xdc69('0x7')](_0xdc69('0x1d'),auth[_0xdc69('0x8')](),controller[_0xdc69('0x1e')]);router[_0xdc69('0x7')](_0xdc69('0x1f'),auth[_0xdc69('0x8')](),controller[_0xdc69('0x20')]);router['get'](_0xdc69('0x21'),auth['isAuthenticated'](),controller['getOpenchannelInteractions']);router[_0xdc69('0x7')](_0xdc69('0x22'),auth[_0xdc69('0x8')](),controller[_0xdc69('0x23')]);router[_0xdc69('0x7')](_0xdc69('0x24'),auth[_0xdc69('0x8')](),controller[_0xdc69('0x25')]);router[_0xdc69('0x7')](_0xdc69('0x26'),auth[_0xdc69('0x8')](),controller['getFaxInteractions']);router[_0xdc69('0x7')](_0xdc69('0x27'),auth['isAuthenticated'](),controller[_0xdc69('0x28')]);router[_0xdc69('0x7')]('/:id/teams',auth['isAuthenticated'](),controller[_0xdc69('0x29')]);router[_0xdc69('0x7')](_0xdc69('0x2a'),auth['isAuthenticated'](),controller[_0xdc69('0x2b')]);router['get'](_0xdc69('0x2c'),auth['isAuthenticated'](),controller[_0xdc69('0x2d')]);router[_0xdc69('0x7')]('/:id/prefixes',auth[_0xdc69('0x8')](),controller['getVoicePrefixes']);router[_0xdc69('0x7')](_0xdc69('0x2e'),auth['isAuthenticated'](),controller[_0xdc69('0x2f')]);router['get'](_0xdc69('0x30'),auth[_0xdc69('0x8')](),controller[_0xdc69('0x31')]);router['get'](_0xdc69('0x32'),auth['isAuthenticated'](),controller['getOpenchannelAccounts']);router['get'](_0xdc69('0x33'),auth[_0xdc69('0x8')](),controller[_0xdc69('0x34')]);router[_0xdc69('0x7')]('/:id/chat_websites',auth[_0xdc69('0x8')](),controller[_0xdc69('0x35')]);router[_0xdc69('0x7')](_0xdc69('0x36'),auth['isAuthenticated'](),controller[_0xdc69('0x37')]);router[_0xdc69('0x7')](_0xdc69('0x38'),auth[_0xdc69('0x8')](),controller['getScheduledCalls']);router['get']('/:id/api_key',auth[_0xdc69('0x8')](),controller[_0xdc69('0x39')]);router[_0xdc69('0x3a')](_0xdc69('0x3b'),auth['isAuthenticated'](),controller[_0xdc69('0x3c')]);router[_0xdc69('0x3a')]('/',auth[_0xdc69('0x8')](),controller['create']);router[_0xdc69('0x3a')](_0xdc69('0x3d'),auth[_0xdc69('0x8')](),controller[_0xdc69('0x3e')]);router['post'](_0xdc69('0x16'),auth[_0xdc69('0x8')](),controller[_0xdc69('0x3f')]);var upload=multer({'storage':multer[_0xdc69('0x40')]({'destination':function(_0x5cae72,_0x245923,_0x215d48){_0x215d48(null,path[_0xdc69('0x41')](config['root'],_0xdc69('0x42')));},'filename':function(_0x3d1acd,_0x45af41,_0x11903f){_0x11903f(null,util[_0xdc69('0x43')](_0xdc69('0x44'),Date['now'](),_0x45af41['originalname']));}})});router[_0xdc69('0x3a')](_0xdc69('0x11'),upload['single'](_0xdc69('0x45')),controller[_0xdc69('0x46')]);router[_0xdc69('0x3a')](_0xdc69('0x47'),auth[_0xdc69('0x8')](),controller[_0xdc69('0x48')]);router['post']('/:id/logout',auth[_0xdc69('0x8')](),controller[_0xdc69('0x49')]);router[_0xdc69('0x3a')]('/:id/pause',auth[_0xdc69('0x8')](),controller[_0xdc69('0x4a')]);router['post'](_0xdc69('0x4b'),auth['isAuthenticated'](),controller[_0xdc69('0x4c')]);router[_0xdc69('0x3a')](_0xdc69('0x4d'),auth[_0xdc69('0x8')](),controller[_0xdc69('0x4e')]);router['post'](_0xdc69('0x4f'),auth[_0xdc69('0x8')](),controller[_0xdc69('0x50')]);router['post'](_0xdc69('0x51'),auth[_0xdc69('0x8')](),controller['addMailInteractions']);router[_0xdc69('0x3a')](_0xdc69('0x52'),auth['isAuthenticated'](),controller[_0xdc69('0x53')]);router[_0xdc69('0x3a')]('/:id/sms_interactions',auth[_0xdc69('0x8')](),controller[_0xdc69('0x54')]);router[_0xdc69('0x3a')](_0xdc69('0x55'),auth[_0xdc69('0x8')](),controller['addOpenchannelInteractions']);router[_0xdc69('0x3a')](_0xdc69('0x56'),auth[_0xdc69('0x8')](),controller[_0xdc69('0x57')]);router[_0xdc69('0x3a')]('/:id/fax_accounts',auth['isAuthenticated'](),controller['addFaxAccounts']);router['post']('/:id/mail_accounts',auth[_0xdc69('0x8')](),controller['addMailAccounts']);router[_0xdc69('0x3a')](_0xdc69('0x32'),auth[_0xdc69('0x8')](),controller[_0xdc69('0x58')]);router[_0xdc69('0x3a')](_0xdc69('0x33'),auth[_0xdc69('0x8')](),controller['addSmsAccounts']);router[_0xdc69('0x3a')](_0xdc69('0x59'),auth[_0xdc69('0x8')](),controller[_0xdc69('0x5a')]);router[_0xdc69('0x3a')](_0xdc69('0x36'),auth[_0xdc69('0x8')](),controller[_0xdc69('0x5b')]);router[_0xdc69('0x3a')](_0xdc69('0x5c'),auth['isAuthenticated'](),controller['createApiKey']);router[_0xdc69('0x5d')](_0xdc69('0xf'),auth[_0xdc69('0x8')](),controller[_0xdc69('0x5e')]);router[_0xdc69('0x5d')](_0xdc69('0x5f'),auth[_0xdc69('0x8')](),controller[_0xdc69('0x60')]);router[_0xdc69('0x61')](_0xdc69('0x16'),auth[_0xdc69('0x8')](),controller[_0xdc69('0x62')]);router['delete'](_0xdc69('0x4d'),auth[_0xdc69('0x8')](),controller['removeTeams']);router[_0xdc69('0x61')](_0xdc69('0xf'),auth[_0xdc69('0x8')](),controller['destroy']);router[_0xdc69('0x61')](_0xdc69('0x4f'),auth[_0xdc69('0x8')](),controller[_0xdc69('0x63')]);router['delete'](_0xdc69('0x51'),auth[_0xdc69('0x8')](),controller['removeMailInteractions']);router['delete']('/:id/fax_interactions',auth['isAuthenticated'](),controller[_0xdc69('0x64')]);router[_0xdc69('0x61')](_0xdc69('0x65'),auth['isAuthenticated'](),controller['removeSmsInteractions']);router[_0xdc69('0x61')](_0xdc69('0x55'),auth[_0xdc69('0x8')](),controller['removeOpenchannelInteractions']);router[_0xdc69('0x61')](_0xdc69('0x56'),auth[_0xdc69('0x8')](),controller[_0xdc69('0x66')]);router[_0xdc69('0x61')](_0xdc69('0x2e'),auth[_0xdc69('0x8')](),controller[_0xdc69('0x67')]);router[_0xdc69('0x61')](_0xdc69('0x30'),auth[_0xdc69('0x8')](),controller['removeMailAccounts']);router[_0xdc69('0x61')](_0xdc69('0x32'),auth[_0xdc69('0x8')](),controller[_0xdc69('0x68')]);router[_0xdc69('0x61')](_0xdc69('0x33'),auth[_0xdc69('0x8')](),controller[_0xdc69('0x69')]);router['delete'](_0xdc69('0x59'),auth[_0xdc69('0x8')](),controller[_0xdc69('0x6a')]);router[_0xdc69('0x61')](_0xdc69('0x36'),auth[_0xdc69('0x8')](),controller[_0xdc69('0x6b')]);router[_0xdc69('0x61')]('/:id/api_key',auth[_0xdc69('0x8')](),controller['removeApiKey']);router['post']('/:id/messengerSoundNotification',auth[_0xdc69('0x8')](),controller[_0xdc69('0x6c')]);module[_0xdc69('0x6d')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 9516361..aa1c343 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 _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 +var _0x5413=['nonat','TEXT','get','isArray','udp','wss','encryption','avpf','icesupport','dtlsenable','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','force_avp','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','util','lodash','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','toLowerCase','agent','telephone','local','INTEGER','BOOLEAN','DATE','dynamic','ENUM','friend','user','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','auto','yes','update','outgoing','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','\x22\x22\x20<>','always','accept','refuse','uac','uas','fingerprint','certificate','passive','actpass'];(function(_0x3bda58,_0x25bd78){var _0x1a7bf8=function(_0x5f3552){while(--_0x5f3552){_0x3bda58['push'](_0x3bda58['shift']());}};_0x1a7bf8(++_0x25bd78);}(_0x5413,0x1d9));var _0x3541=function(_0x3477e1,_0x50e3da){_0x3477e1=_0x3477e1-0x0;var _0x5d6a2e=_0x5413[_0x3477e1];return _0x5d6a2e;};'use strict';var Sequelize=require(_0x3541('0x0'));var moment=require(_0x3541('0x1'));var util=require(_0x3541('0x2'));var _=require(_0x3541('0x3'));module['exports']={'name':{'type':Sequelize[_0x3541('0x4')],'allowNull':![],'unique':_0x3541('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x17fc06){this[_0x3541('0x6')](_0x3541('0x5'),_0x17fc06);this[_0x3541('0x6')](_0x3541('0x7'),_0x17fc06);},'comment':_0x3541('0x8')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x582b98){this['setDataValue'](_0x3541('0x9'),_0x582b98);this['setDataValue'](_0x3541('0xa'),util[_0x3541('0xb')](_0x3541('0xc'),_0x582b98,this[_0x3541('0xd')](_0x3541('0xe'))));}},'alias':{'type':Sequelize[_0x3541('0x4')]},'email':{'type':Sequelize[_0x3541('0x4')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x29f0b0){if(_0x29f0b0){this[_0x3541('0x6')]('email',_0x29f0b0[_0x3541('0xf')]());}}},'role':{'type':Sequelize['ENUM']('admin','user',_0x3541('0x10'),_0x3541('0x11')),'allowNull':![]},'password':{'type':Sequelize[_0x3541('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x3541('0x4')],'defaultValue':_0x3541('0x12')},'internal':{'type':Sequelize[_0x3541('0x13')](0xb),'allowNull':![],'unique':_0x3541('0xe'),'set':function(_0x5998af){this['setDataValue'](_0x3541('0xe'),_0x5998af);this[_0x3541('0x6')]('accountcode',_0x5998af);this[_0x3541('0x6')](_0x3541('0xa'),util['format']('\x22%s\x22\x20<%s>',this['getDataValue'](_0x3541('0x9')),_0x5998af));}},'salt':{'type':Sequelize[_0x3541('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0x3541('0x4')]},'userpic':{'type':Sequelize[_0x3541('0x4')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x3541('0x4')]},'online':{'type':Sequelize[_0x3541('0x14')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x3541('0x15')]},'voicePause':{'type':Sequelize[_0x3541('0x14')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x3541('0x14')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x3541('0x14')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x3541('0x14')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x3541('0x14')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x3541('0x4')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x3541('0x15')]},'chatCapacity':{'type':Sequelize[_0x3541('0x13')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x3541('0x13')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x3541('0x13')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x3541('0x13')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x3541('0x13')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x3541('0x13')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x3541('0x14')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x3541('0x14')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x3541('0x13')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x3541('0x13')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x3541('0x14')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x3541('0x13')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x3541('0x14')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x3541('0x14')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x3541('0x14')],'defaultValue':![]},'description':{'type':Sequelize[_0x3541('0x4')],'allowNull':!![]},'host':{'type':Sequelize[_0x3541('0x4')],'allowNull':!![],'defaultValue':_0x3541('0x16')},'ipaddr':{'type':Sequelize[_0x3541('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0x3541('0x13')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x3541('0x13')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x3541('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x3541('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0x3541('0x13')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x3541('0x17')](_0x3541('0x18'),_0x3541('0x19'),_0x3541('0x1a')),'allowNull':!![],'defaultValue':_0x3541('0x18')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x3541('0x1b')},'callingpres':{'type':Sequelize['ENUM'](_0x3541('0x1c'),'ALLOWED_PASSED_SCREEN',_0x3541('0x1d'),_0x3541('0x1e'),_0x3541('0x1f'),_0x3541('0x20'),_0x3541('0x21'),_0x3541('0x22')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x3541('0x4')],'allowNull':!![]},'secret':{'type':Sequelize[_0x3541('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x3541('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x3541('0x4')],'allowNull':!![],'defaultValue':'udp','set':function(_0x4321ae){this[_0x3541('0x6')](_0x3541('0x23'),_0x4321ae?_0x4321ae[_0x3541('0x24')](','):null);},'get':function(){return this[_0x3541('0xd')](_0x3541('0x23'))?this[_0x3541('0xd')](_0x3541('0x23'))[_0x3541('0x25')](','):null;},'comment':_0x3541('0x26')},'dtmfmode':{'type':Sequelize[_0x3541('0x17')](_0x3541('0x27'),'info',_0x3541('0x28'),'inband',_0x3541('0x29')),'allowNull':!![],'defaultValue':_0x3541('0x27')},'directmedia':{'type':Sequelize[_0x3541('0x17')](_0x3541('0x2a'),'no','nonat',_0x3541('0x2b'),_0x3541('0x2c')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x3541('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x3541('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x3541('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0x3541('0x4')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x2336dc){this[_0x3541('0x6')](_0x3541('0x2d'),_0x2336dc?_0x2336dc[_0x3541('0x24')](','):null);},'get':function(){return this[_0x3541('0xd')](_0x3541('0x2d'))?this['getDataValue']('nat')[_0x3541('0x25')](','):null;},'comment':_0x3541('0x2e')},'callgroup':{'type':Sequelize[_0x3541('0x4')]},'namedcallgroup':{'type':Sequelize[_0x3541('0x4')]},'pickupgroup':{'type':Sequelize[_0x3541('0x4')]},'namedpickupgroup':{'type':Sequelize[_0x3541('0x4')]},'language':{'type':Sequelize[_0x3541('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x3541('0x4')]},'disallow':{'type':Sequelize[_0x3541('0x4')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0x3541('0x4')],'allowNull':![],'defaultValue':_0x3541('0x2f'),'set':function(_0x5c7ccb){this[_0x3541('0x6')](_0x3541('0x30'),_0x5c7ccb?_0x5c7ccb['join'](';'):_0x3541('0x2f'));},'get':function(){return this[_0x3541('0xd')](_0x3541('0x30'))?this[_0x3541('0xd')](_0x3541('0x30'))[_0x3541('0x25')](';'):null;},'comment':_0x3541('0x31')},'autoframing':{'type':Sequelize[_0x3541('0x17')](_0x3541('0x2a'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x3a42ee){this[_0x3541('0x6')]('insecure',_0x3a42ee?_0x3a42ee[_0x3541('0x24')](','):null);},'get':function(){return this[_0x3541('0xd')](_0x3541('0x32'))?this['getDataValue'](_0x3541('0x32'))[_0x3541('0x25')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x3541('0x17')](_0x3541('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x3541('0x17')](_0x3541('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x3541('0x2a'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x3541('0x17')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x3541('0x13')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x3541('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x3541('0x4')],'allowNull':!![],'defaultValue':_0x3541('0x33')},'amaflags':{'type':Sequelize[_0x3541('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x3541('0x17')](_0x3541('0x2a'),'no'),'allowNull':!![],'defaultValue':_0x3541('0x2a')},'busylevel':{'type':Sequelize[_0x3541('0x13')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x3541('0x17')](_0x3541('0x2a'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x3541('0x17')](_0x3541('0x2a'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x3541('0x17')](_0x3541('0x2a'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x3541('0x17')](_0x3541('0x2a'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x3541('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0x3541('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x3541('0x2a'),'no',_0x3541('0x34')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x3541('0x13')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x3541('0x17')](_0x3541('0x2a'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x3541('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x3541('0x35'),_0x3541('0x36'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x3541('0x13')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x3541('0x17')](_0x3541('0x37'),_0x3541('0x38')),'allowNull':!![],'defaultValue':_0x3541('0x38')},'t38pt_usertpsource':{'type':Sequelize[_0x3541('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x3541('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x3541('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x3541('0x17')]('yes','no'),'allowNull':!![],'defaultValue':_0x3541('0x2a')},'keepalive':{'type':Sequelize[_0x3541('0x13')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x3541('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x3541('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x3541('0x13')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x3541('0x17')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x3541('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x3541('0x13')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x3541('0x13')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x3541('0x13')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x3541('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x3541('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x3541('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x3541('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x3541('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x3541('0x13')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x3541('0x17')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x3541('0x17')](_0x3541('0x2a'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x3541('0x17')](_0x3541('0x2a'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x3541('0x2a'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x3541('0x17')](_0x3541('0x2a'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x3541('0x17')](_0x3541('0x2a'),'no',_0x3541('0x39'),_0x3541('0x3a')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x3541('0x13')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x3541('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x3541('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x3541('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x3541('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x3541('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x3541('0x17')]('active',_0x3541('0x3b'),_0x3541('0x3c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x3541('0x17')](_0x3541('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x3541('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x3541('0x13')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x3541('0x17')](_0x3541('0x2a'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x3541('0x17')](_0x3541('0x2a'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x3541('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x3541('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x3541('0x2a'),'no',_0x3541('0x3d'),_0x3541('0x2b'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x3541('0x14')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x3541('0x15')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x3541('0x3e')]},'showWebBar':{'type':Sequelize[_0x3541('0x13')],'defaultValue':0x0,'set':function(_0x539834){this[_0x3541('0x6')]('showWebBar',_0x539834);var _0x1d3c36=this[_0x3541('0x3f')]({'plain':!![]});switch(_0x539834){case 0x0:case 0x1:var _0x445036=_0x1d3c36[_0x3541('0x23')]?_[_0x3541('0x40')](_0x1d3c36[_0x3541('0x23')])?_0x1d3c36[_0x3541('0x23')][_0x3541('0x24')]():_0x1d3c36['transport']:_0x3541('0x41');if(_0x445036===_0x3541('0x42')){_0x445036=_0x3541('0x41');}this[_0x3541('0x6')](_0x3541('0x23'),_0x445036);this[_0x3541('0x6')](_0x3541('0x43'),'no');this['setDataValue'](_0x3541('0x44'),null);this[_0x3541('0x6')]('force_avp',null);this[_0x3541('0x6')](_0x3541('0x45'),null);this[_0x3541('0x6')](_0x3541('0x46'),null);this[_0x3541('0x6')]('dtlsverify',null);this[_0x3541('0x6')](_0x3541('0x47'),null);this[_0x3541('0x6')](_0x3541('0x48'),null);this[_0x3541('0x6')](_0x3541('0x49'),null);this['setDataValue'](_0x3541('0x4a'),'no');break;case 0x2:this[_0x3541('0x6')](_0x3541('0x23'),'wss');this['setDataValue']('encryption',_0x3541('0x2a'));this['setDataValue'](_0x3541('0x44'),_0x3541('0x2a'));this['setDataValue'](_0x3541('0x4b'),'yes');this[_0x3541('0x6')](_0x3541('0x45'),_0x3541('0x2a'));this[_0x3541('0x6')](_0x3541('0x46'),_0x3541('0x2a'));this[_0x3541('0x6')]('dtlsverify','no');this[_0x3541('0x6')](_0x3541('0x47'),_0x3541('0x3c'));this[_0x3541('0x6')](_0x3541('0x48'),_0x1d3c36[_0x3541('0x48')]||'/etc/pki/tls/certs/motion.crt');this['setDataValue'](_0x3541('0x49'),_0x1d3c36[_0x3541('0x49')]||_0x3541('0x4c'));this[_0x3541('0x6')](_0x3541('0x4a'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0x3541('0x3e')],'set':function(_0x48fbef){this['setDataValue'](_0x3541('0x4d'),_0x48fbef?_0x48fbef[_0x3541('0x24')](','):[]);},'get':function(){return this[_0x3541('0xd')]('permissions')?_[_0x3541('0x4e')](this[_0x3541('0xd')]('permissions')[_0x3541('0x25')](','),function(_0x593c06){return parseInt(_0x593c06,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x3541('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x3541('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x3541('0x4')]},'phoneBarUnconditional':{'type':Sequelize[_0x3541('0x14')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x3541('0x14')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x3541('0x14')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x3541('0x14')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x3541('0x14')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x3541('0x13')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x3541('0x13')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x3541('0x17')](_0x3541('0x2a'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x3541('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0x3541('0x14')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x3541('0x14')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x3541('0x4f')],'get':function(){return this[_0x3541('0xd')]('phoneBarEnableScreenRecordingByAgent')?this['getDataValue'](_0x3541('0x50')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x3541('0x14')],'defaultValue':![]},'interface':{'type':Sequelize[_0x3541('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x3541('0x14')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x3541('0x14')],'defaultValue':![],'set':function(_0xacd551){if(typeof _0xacd551===_0x3541('0x51')){var _0x4994f7=_0xacd551==='1'?!![]:_0xacd551==='0'?![]:_0xacd551===_0x3541('0x52')?!![]:_0xacd551===_0x3541('0x53')?![]:![];this[_0x3541('0x6')](_0x3541('0x54'),_0x4994f7);}else{this[_0x3541('0x6')](_0x3541('0x54'),_0xacd551);}}},'blocked':{'type':Sequelize[_0x3541('0x14')],'defaultValue':![],'set':function(_0x403b0d){this[_0x3541('0x6')](_0x3541('0x55'),_0x403b0d);if(_0x403b0d===!![]){this[_0x3541('0x6')](_0x3541('0x56'),moment());this[_0x3541('0x6')](_0x3541('0x57'),0x0);}else{this[_0x3541('0x6')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0x3541('0x15')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x3541('0x13')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x3541('0x14')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x3541('0x13')](0x5)[_0x3541('0x58')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x3541('0x14')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x3541('0x14')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x3541('0x14')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x3541('0x14')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x3541('0x14')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x3541('0x13')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x3541('0x14')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x3541('0x14')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x3541('0x13')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x3541('0x14')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x3541('0x14')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x3541('0x13')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x3541('0x14')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x3541('0x13')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x3541('0x14')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 046adc5..682cc3f 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 _0x4a68=['../../config/utils','../../config/environment','../../config/license/util','../../errors/api','APINotFoundError','APIForbiddenrror','handleError','../../mysqldb','socket.io-emitter','register','defaults','redis','localhost','client','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','request','info','User,\x20%s,\x20%s','debug','User,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','update','then','role','agent','emit','destroy','admin','Users','user','telephone','filter','ignore','map','value','includes','find','name','UserProfileResource','stack','User','rawAttributes','fieldName','key','salt','previousPasswords','resetPasswordToken','resetPasswordExpires','index','getOptions','query','userSetting','true','UserSetting','attributes','push','findAll','rows','openTabs','length','chat','dataValues','sms','fax','openchannel','all','show','params','includeAll','include','merge','options','whatsapp','mail','body','describe','addContacts','ids','omit','Setting','findById','securePassword','validatePasswordPattern','password','max','internal','isNil','min_internal','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','sequelize','QueryTypes','from','voicemail','VoiceMail','email','permissions','101','103','113','110','104','105','106','107','108','109','100','111','114','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','create','Telephones','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','Agents','isEmpty','compact','oldPassword','newPassword','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','Sequelize','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','Unauthorized','findOne','enforcePasswordHistory','passwordHistoryLimit','updatePasswordsHistory','addQueues','channel','online','voicePause','interface','isValidChannel','Unknown\x20channel','capitalize','toLowerCase','Queues','penalty','QueueId','Queue:save','voice','get','format','SIP/%s','UserVoiceQueueRt','upsert','removeQueues','remove','isArray','Queue:remove','addAvatar','file','getAvatar','root','userpic','existsSync','join','server/files/images/','getOpenTabs','FaxOpenTabs','FAX','createdAt','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WHATSAPP','concat','getContacts','User\x20with\x20id\x20%s\x20not\x20found','CmList','List','Tag','Tags','color','tag','getQueues','keys','filters','intersection','model','fields','sort','pick','where','Queue','Unknown\x20role','hasOwnProperty','order','getVoiceQueuesRt','nolimit','getGroups','getRecordings','VoiceRecording','getScreenRecordings','UserId','ScreenRecording','getOpenchannelInteractions','OpenchannelInteraction','MailInteraction','getSmsInteractions','SmsInteraction','FaxInteraction','getFaxInteractions','getWhatsappInteractions','WhatsappInteraction','phone','mobile','loginInPause','LOCAL/%s@from-sip/n','intrf','user:forcelogout','headers','x-forwarded-for','remoteAddress','socket','connection','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','forEach','LOGIN','device','PAUSE','LOGININPAUSE','YYYY-MM-DD\x20HH:mm:ss','isMiddleware','resolve','logout','QueuePause','pause','getChannels','type','DEFAULT\x20PAUSE','Channel\x20parameter\x20%s\x20is\x20invalid','mailPause','chatPause','faxPause','openchannelPause','smsPause','whatsappPause','lastPauseAt','unpause','getTeams','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','Team','getAssociatedQueues','addAgent','getDataValue','UserVoicePrefix','VoicePrefixId','removeTeams','Query\x20parameter\x20\x27ids\x27\x20is\x20required','flattenDeep','removeAgent','Voice','TeamVoicePrefix','getLists','getAgents','You\x20can\x27t\x20delete\x20yourself','CmHopper','addChatInteractions','spread','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','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','$and','$or','$gt','$gte','$lte','$ne','$eq','$notBetween','$in','$like','$notLike','$notILike','$contains','$contained','$any','firstName','lastName','CmContact','Contact','dialActive','VoiceQueue','getApiKey','retrieveApiKey','token','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','apiKeyNonce','apiKeyIat','send','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','getPresence','idle','unknown','ringing','teams','inbound','flatten','toString','lower','col','desc','asc','substring','uniqBy','getRealtimeAgents','voiceStatus','unavailable','busy','charAt','toUpperCase','slice','SELECT','select','field','ui.','InteractionId','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','OpenTabs','util','path','lodash','squel','../../components/auth/service','../../components/realtime/agents','../../config/logger'];(function(_0x65d7c5,_0x13e1e9){var _0x2ac24e=function(_0x1540f4){while(--_0x1540f4){_0x65d7c5['push'](_0x65d7c5['shift']());}};_0x2ac24e(++_0x13e1e9);}(_0x4a68,0x18c));var _0x84a6=function(_0x3009aa,_0x4df256){_0x3009aa=_0x3009aa-0x0;var _0x121ab2=_0x4a68[_0x3009aa];return _0x121ab2;};'use strict';var moment=require('moment');var util=require(_0x84a6('0x0'));var path=require(_0x84a6('0x1'));var fs=require('fs');var _=require(_0x84a6('0x2'));var squel=require(_0x84a6('0x3'));var Redis=require('ioredis');var jayson=require('jayson/promise');var authService=require(_0x84a6('0x4'));var contacts=require('../../components/contacts');var qs=require('../../components/parsers/qs');var rta=require(_0x84a6('0x5'));var logger=require(_0x84a6('0x6'))('api');var utils=require(_0x84a6('0x7'));var config=require(_0x84a6('0x8'));var licenseUtil=require(_0x84a6('0x9'));var APIBadRequestError=require(_0x84a6('0xa'))['APIBadRequestError'];var APINotFoundError=require(_0x84a6('0xa'))[_0x84a6('0xb')];var APIForbiddenError=require(_0x84a6('0xa'))[_0x84a6('0xc')];var APIHandleError=require(_0x84a6('0xa'))[_0x84a6('0xd')];var db=require(_0x84a6('0xe'))['db'];var socket=require(_0x84a6('0xf'))(new Redis(config['redis']));require('./user.socket')[_0x84a6('0x10')](socket);config['redis']=_[_0x84a6('0x11')](config[_0x84a6('0x12')],{'host':_0x84a6('0x13'),'port':0x18eb});var amiClient=jayson[_0x84a6('0x14')]['http']({'port':0x232a});var values;function respondWithStatusCode(_0x55dfb3,_0x218d5d){_0x218d5d=_0x218d5d||0xcc;return function(_0x27b48f){if(_0x27b48f){return _0x55dfb3[_0x84a6('0x15')](_0x218d5d);}return _0x55dfb3[_0x84a6('0x16')](_0x218d5d)[_0x84a6('0x17')]();};}function respondWithResult(_0x5e08e3,_0x48fb65){_0x48fb65=_0x48fb65||0xc8;return function(_0x5ab606){if(_0x5ab606){return _0x5e08e3['status'](_0x48fb65)[_0x84a6('0x18')](_0x5ab606);}};}function respondWithFilteredResult(_0x30c21c,_0x35377d){return function(_0x2e047c){if(_0x2e047c){var _0x247097=typeof _0x35377d[_0x84a6('0x19')]==='undefined'&&typeof _0x35377d[_0x84a6('0x1a')]===_0x84a6('0x1b');var _0x14f76a=_0x2e047c[_0x84a6('0x1c')];var _0x3a15e5=_0x247097?0x0:_0x35377d['offset'];var _0x150f01=_0x247097?_0x2e047c[_0x84a6('0x1c')]:_0x35377d[_0x84a6('0x19')]+_0x35377d[_0x84a6('0x1a')];var _0x1cae39;if(_0x150f01>=_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')]=_0x130d2b){_0x443d1e=_0x130d2b;_0x1bfb56=0xc8;}else{_0x1bfb56=0xce;}_0x558001[_0x2999('0x17')](_0x1bfb56);return _0x558001['set'](_0x2999('0x1e'),_0x34c63f+'-'+_0x443d1e+'/'+_0x130d2b)[_0x2999('0x19')](_0x140a07);}return null;};}function respondWithRpcPromise(_0x4967c7,_0xb6d23b,_0x88f52e,_0x4da1f1){return new Promise(function(_0x224baa,_0x235689){var _0x2386c1=_0x4da1f1||amiClient;return _0x2386c1['request'](_0x4967c7,_0x88f52e)[_0x2999('0x1f')](function(_0xb55174){logger[_0x2999('0x20')](_0x2999('0x21'),_0xb6d23b,'request\x20sent');logger[_0x2999('0x22')]('User,\x20%s,\x20%s,\x20%s',_0xb6d23b,_0x2999('0x23'),JSON[_0x2999('0x24')](_0xb55174));if(_0xb55174[_0x2999('0x25')]){if(_0xb55174['error'][_0x2999('0x26')]===0x1f4){logger[_0x2999('0x25')]('User,\x20%s,\x20%s',_0xb6d23b,_0xb55174[_0x2999('0x25')][_0x2999('0x27')]);return _0x235689(_0xb55174[_0x2999('0x25')][_0x2999('0x27')]);}logger[_0x2999('0x25')](_0x2999('0x21'),_0xb6d23b,_0xb55174[_0x2999('0x25')][_0x2999('0x27')]);return _0x224baa(_0xb55174[_0x2999('0x25')][_0x2999('0x27')]);}else{logger['info'](_0x2999('0x21'),_0xb6d23b,_0x2999('0x23'));_0x224baa(_0xb55174['result'][_0x2999('0x27')]);}})[_0x2999('0x28')](function(_0x532bcb){logger['error'](_0x2999('0x21'),_0xb6d23b,_0x532bcb);_0x235689(_0x532bcb);});});}function saveUpdates(_0x2b403){return function(_0x362650){if(_0x362650){return _0x362650[_0x2999('0x29')](_0x2b403)[_0x2999('0x1f')](function(_0x352969){if(_0x352969[_0x2999('0x2a')]===_0x2999('0x2b')){socket[_0x2999('0x2c')]('userNotification:recalc:'+_0x352969['id'],_0x352969);}return _0x352969;});}return null;};}function removeEntity(_0x23fce1,_0xcbda33){return function(_0xd32d6f){if(_0xd32d6f){return _0xd32d6f[_0x2999('0x2d')]({'transaction':_0xcbda33})[_0x2999('0x1f')](function(){var _0x261848=_0xd32d6f[_0x2999('0x2e')]({'plain':!![]});if(_0x261848[_0x2999('0x2a')]===_0x2999('0x2f'))return;var _0x53e053=[{'name':_0x2999('0x30'),'value':'user','ignore':!![]},{'name':_0x2999('0x31'),'value':_0x2999('0x2b'),'ignore':![]},{'name':_0x2999('0x32'),'value':_0x2999('0x33'),'ignore':![]}];var _0x557537=_(_0x53e053)[_0x2999('0x34')](_0x2999('0x35'))[_0x2999('0x36')](_0x2999('0x37'))[_0x2999('0x37')]();if(_[_0x2999('0x38')](_0x557537,_0x261848[_0x2999('0x2a')])){return;}var _0xc1d1cf=_[_0x2999('0x39')](_0x53e053,[_0x2999('0x37'),_0x261848[_0x2999('0x2a')]])[_0x2999('0x3a')];return db[_0x2999('0x3b')]['destroy']({'where':{'type':_0xc1d1cf,'resourceId':_0x261848['id']},'transaction':_0xcbda33})[_0x2999('0x1f')](function(){return _0xd32d6f;});})[_0x2999('0x1f')](function(){_0x23fce1[_0x2999('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x413f69){return function(_0x260d08){if(!_0x260d08){_0x413f69[_0x2999('0x3c')](0x194);}return _0x260d08;};}function handleError(_0x5bad76,_0x4fdfc6){_0x4fdfc6=_0x4fdfc6||0x1f4;return function(_0x756fe9){logger['error'](_0x756fe9['stack']);if(_0x756fe9[_0x2999('0x3a')]){delete _0x756fe9[_0x2999('0x3a')];}_0x5bad76[_0x2999('0x17')](_0x4fdfc6)[_0x2999('0x3d')](_0x756fe9);};}function getUserAttributes(){return _(db[_0x2999('0x3e')][_0x2999('0x3f')])[_0x2999('0x36')](function(_0x1784d9){return{'name':_0x1784d9['fieldName'],'type':_0x1784d9['type'][_0x2999('0x40')]};})[_0x2999('0x34')](function(_0x2a09cd){return![_0x2999('0x41'),_0x2999('0x42'),_0x2999('0x43'),_0x2999('0x44'),_0x2999('0x45'),_0x2999('0x46')][_0x2999('0x38')](_0x2a09cd[_0x2999('0x3a')]);})['value']();}exports['index']=function(_0x13a853,_0xcf2d4d){var _0x2b4beb={},_0x15d37f={'count':0x0,'rows':[]};var _0x5d5c5f=getUserAttributes();_0x2b4beb=qs[_0x2999('0x47')](_0x5d5c5f,_0x13a853);var _0xb5d719={'where':_0x2b4beb[_0x2999('0x48')]};return db[_0x2999('0x3e')]['count'](_0xb5d719)[_0x2999('0x1f')](function(_0x9ae7ee){_0x15d37f[_0x2999('0x1d')]=_0x9ae7ee;if(_0x13a853[_0x2999('0x49')][_0x2999('0x4a')]){_0x2b4beb[_0x2999('0x4b')]=[{'all':!![]}];}if(_0x13a853[_0x2999('0x49')][_0x2999('0x4c')]==='true'){_0x2b4beb[_0x2999('0x4b')]=[{'model':db[_0x2999('0x4d')],'as':_0x2999('0x4c')}];}if(!_['includes'](_0x2b4beb[_0x2999('0x4e')],'id')){_0x2b4beb[_0x2999('0x4e')][_0x2999('0x4f')]('id');}return db[_0x2999('0x3e')][_0x2999('0x50')](_0x2b4beb);})[_0x2999('0x1f')](function(_0xda0b91){_0x15d37f[_0x2999('0x51')]=_0xda0b91;if(_0x13a853[_0x2999('0x49')]['openTabs']===_0x2999('0x52')){var _0x579792=[];for(var _0x91826b=0x0;_0x91826b<_0x15d37f[_0x2999('0x51')]['length'];_0x91826b++){_0x579792[_0x2999('0x4f')](get_open_tabs(_0x2999('0x53'),_0x15d37f['rows'][_0x91826b]['dataValues']));_0x579792['push'](get_open_tabs(_0x2999('0x54'),_0x15d37f[_0x2999('0x51')][_0x91826b][_0x2999('0x55')]));_0x579792[_0x2999('0x4f')](get_open_tabs('fax',_0x15d37f[_0x2999('0x51')][_0x91826b]['dataValues']));_0x579792[_0x2999('0x4f')](get_open_tabs(_0x2999('0x56'),_0x15d37f[_0x2999('0x51')][_0x91826b][_0x2999('0x55')]));_0x579792[_0x2999('0x4f')](get_open_tabs(_0x2999('0x57'),_0x15d37f[_0x2999('0x51')][_0x91826b][_0x2999('0x55')]));_0x579792[_0x2999('0x4f')](get_open_tabs('whatsapp',_0x15d37f[_0x2999('0x51')][_0x91826b][_0x2999('0x55')]));}return Promise[_0x2999('0x58')](_0x579792)[_0x2999('0x1f')](function(){return _0x15d37f;});}else{return _0x15d37f;}})[_0x2999('0x1f')](respondWithFilteredResult(_0xcf2d4d,_0x2b4beb))[_0x2999('0x28')](handleError(_0xcf2d4d,null));};exports[_0x2999('0x59')]=function(_0x358539,_0x1e2a2e){var _0x728564=getUserAttributes();_0x358539[_0x2999('0x49')]['id']=_0x358539[_0x2999('0x5a')]['id'];var _0x4ca5d7=qs[_0x2999('0x47')](_0x728564,_0x358539);if(_0x358539[_0x2999('0x49')][_0x2999('0x4a')]){_0x4ca5d7[_0x2999('0x4b')]=[{'all':!![]}];}if(_0x358539[_0x2999('0x49')][_0x2999('0x4c')]===_0x2999('0x52')){_0x4ca5d7[_0x2999('0x4b')]=[{'model':db[_0x2999('0x4d')],'as':_0x2999('0x4c')}];}_0x4ca5d7=_[_0x2999('0x5b')]({},_0x4ca5d7,_0x358539[_0x2999('0x5c')]);if(!_[_0x2999('0x38')](_0x4ca5d7[_0x2999('0x4e')],'id')){_0x4ca5d7[_0x2999('0x4e')][_0x2999('0x4f')]('id');}return db['User']['find'](_0x4ca5d7)[_0x2999('0x1f')](handleEntityNotFound(_0x1e2a2e,null))[_0x2999('0x1f')](function(_0x110009){var _0x4fe312=[];values=_0x110009;if(_0x358539[_0x2999('0x49')][_0x2999('0x5d')]===_0x2999('0x52')){_0x4fe312[_0x2999('0x4f')](get_open_tabs('chat',_0x110009[_0x2999('0x55')]));_0x4fe312[_0x2999('0x4f')](get_open_tabs('sms',_0x110009[_0x2999('0x55')]));_0x4fe312[_0x2999('0x4f')](get_open_tabs(_0x2999('0x57'),_0x110009[_0x2999('0x55')]));_0x4fe312[_0x2999('0x4f')](get_open_tabs(_0x2999('0x5e'),_0x110009[_0x2999('0x55')]));_0x4fe312['push'](get_open_tabs('fax',_0x110009[_0x2999('0x55')]));_0x4fe312[_0x2999('0x4f')](get_open_tabs('mail',_0x110009[_0x2999('0x55')]));return Promise[_0x2999('0x58')](_0x4fe312);}else{return values;}})[_0x2999('0x1f')](function(){return values;})[_0x2999('0x1f')](respondWithResult(_0x1e2a2e,null))[_0x2999('0x28')](handleError(_0x1e2a2e,null));};exports[_0x2999('0x29')]=function(_0xddcaad,_0x33e8ec){if(_0xddcaad[_0x2999('0x5f')]['id']){delete _0xddcaad[_0x2999('0x5f')]['id'];}delete _0xddcaad[_0x2999('0x5f')]['role'];return db['User']['find']({'where':{'id':_0xddcaad[_0x2999('0x5a')]['id']}})[_0x2999('0x1f')](handleEntityNotFound(_0x33e8ec,null))[_0x2999('0x1f')](saveUpdates(_0xddcaad[_0x2999('0x5f')],null))[_0x2999('0x1f')](respondWithResult(_0x33e8ec,null))['catch'](handleError(_0x33e8ec,null));};exports[_0x2999('0x60')]=function(_0x5c8c59,_0x49138a){return db['User']['describe']()[_0x2999('0x1f')](respondWithResult(_0x49138a,null))[_0x2999('0x28')](handleError(_0x49138a,null));};exports['addContacts']=function(_0x56758d,_0x4be77d){return db[_0x2999('0x3e')][_0x2999('0x39')]({'where':{'id':_0x56758d[_0x2999('0x5a')]['id']}})[_0x2999('0x1f')](handleEntityNotFound(_0x4be77d,null))[_0x2999('0x1f')](function(_0x2c624e){if(_0x2c624e){return _0x2c624e['addContacts'](_0x56758d[_0x2999('0x5f')][_0x2999('0x61')],_[_0x2999('0x62')](_0x56758d[_0x2999('0x5f')],['ids','id'])||{});}})[_0x2999('0x1f')](respondWithResult(_0x4be77d,null))[_0x2999('0x28')](handleError(_0x4be77d,null));};function validateUser(_0x59effd){return new Promise(function(_0x446b5b,_0x2ed4df){if(_0x59effd[_0x2999('0x63')])return _0x446b5b(_0x59effd);return db[_0x2999('0x64')][_0x2999('0x65')](0x1)['then'](function(_0xb7cc62){if(_0xb7cc62[_0x2999('0x66')])authService['validatePasswordPattern'](_0x59effd[_0x2999('0x41')]);db[_0x2999('0x3e')][_0x2999('0x67')](_0x2999('0x63'))['then'](function(_0x3a3584){if(_['isNil'](_0x3a3584)){_0x59effd[_0x2999('0x63')]=_0xb7cc62[_0x2999('0x68')]||0x1;return;}if(_[_0x2999('0x69')](_0xb7cc62[_0x2999('0x68')])||_0xb7cc62[_0x2999('0x68')]===_0x3a3584){_0x59effd[_0x2999('0x63')]=_0x3a3584+0x1;return;}if(_0xb7cc62[_0x2999('0x68')]>_0x3a3584){_0x59effd[_0x2999('0x63')]=_0xb7cc62[_0x2999('0x68')];return;}return db[_0x2999('0x6a')][_0x2999('0x49')](_0x2999('0x6b'),{'type':db[_0x2999('0x6a')][_0x2999('0x6c')][_0x2999('0x6d')]})['then'](function(_0x40410f){if(_0x40410f&&_0x40410f[_0x2999('0x6e')]){for(var _0x64cac5=0x0,_0x3ab074=_0x40410f[_0x2999('0x6e')];_0x64cac5<_0x3ab074&&_[_0x2999('0x69')](_0x59effd[_0x2999('0x63')]);_0x64cac5++){if(_0xb7cc62[_0x2999('0x68')]<=_0x40410f[_0x64cac5][_0x2999('0x6f')]){_0x59effd[_0x2999('0x63')]=_0x40410f[_0x64cac5][_0x2999('0x6f')];}else if(_0xb7cc62['min_internal']>_0x40410f[_0x64cac5][_0x2999('0x6f')]&&_0xb7cc62[_0x2999('0x68')]<=_0x40410f[_0x64cac5]['to']){_0x59effd['internal']=_0xb7cc62[_0x2999('0x68')];}}}if(_[_0x2999('0x69')](_0x59effd[_0x2999('0x63')])){_0x59effd[_0x2999('0x63')]=_0x3a3584+0x1;}return _0x446b5b(_0x59effd);});});})[_0x2999('0x28')](function(_0x38fb7c){_0x2ed4df(_0x38fb7c);});});}function updateUser(_0x224b68){return new Promise(function(_0x4203aa,_0x3b2ff2){try{if(_0x224b68['voicemail']){_0x224b68[_0x2999('0x70')]=_0x224b68[_0x2999('0x63')];_0x224b68[_0x2999('0x71')]={'mailbox':_0x224b68[_0x2999('0x63')],'password':_0x224b68[_0x2999('0x41')],'fullname':_0x224b68['fullname'],'email':_0x224b68[_0x2999('0x72')]};}if(_0x224b68['role']===_0x2999('0x2b')){if(!_0x224b68[_0x2999('0x73')])_0x224b68[_0x2999('0x73')]=[_0x2999('0x74'),_0x2999('0x75'),'103',_0x2999('0x76'),'110','104','105',_0x2999('0x77'),'107',_0x2999('0x78'),_0x2999('0x79'),'100',_0x2999('0x7a'),_0x2999('0x7b'),_0x2999('0x7c')];}_0x4203aa(_0x224b68);}catch(_0xe0c25d){_0x3b2ff2(_0xe0c25d);}});}exports[_0x2999('0x7d')]=function(_0x41a10a,_0x14479d){if(_0x41a10a[_0x2999('0x7e')][_0x2999('0x2a')]===_0x2999('0x2b'))throw new Error('Unauthorized');if(_0x41a10a[_0x2999('0x5f')]['role']==='user'&&_0x41a10a['user'][_0x2999('0x2a')]!==_0x2999('0x2f')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x41a10a[_0x2999('0x5f')][_0x2999('0x2a')]===_0x2999('0x2f')&&_0x41a10a['user'][_0x2999('0x2a')]!==_0x2999('0x2f')){throw new Error(_0x2999('0x7f'));}return licenseUtil[_0x2999('0x80')]([_0x41a10a[_0x2999('0x5f')]])[_0x2999('0x1f')](function(){return validateUser(_0x41a10a[_0x2999('0x5f')]);})['then'](function(_0x4ccc94){return updateUser(_0x4ccc94)['then'](function(_0x49c6e6){if(_0x49c6e6[_0x2999('0x2a')]===_0x2999('0x2f')){_0x49c6e6[_0x2999('0x81')]=_0x41a10a[_0x2999('0x7e')][_0x2999('0x81')];delete _0x49c6e6[_0x2999('0x82')];}return _0x49c6e6;});})[_0x2999('0x1f')](function(_0x2ca884){return db['User'][_0x2999('0x7d')](_0x2ca884,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]});})[_0x2999('0x1f')](function(_0x358bff){if(_0x41a10a['body'][_0x2999('0x2a')]===_0x2999('0x7e'))return _0x358bff;if(_0x41a10a[_0x2999('0x7e')][_0x2999('0x2a')]!==_0x2999('0x7e'))return _0x358bff;return db[_0x2999('0x83')]['find']({'where':{'name':_0x358bff[_0x2999('0x2a')]===_0x2999('0x2b')?_0x2999('0x31'):_0x2999('0x32'),'userProfileId':_0x41a10a[_0x2999('0x7e')][_0x2999('0x82')]},'raw':!![]})[_0x2999('0x1f')](function(_0x21f02e){if(!_0x21f02e||_0x21f02e['autoAssociation']!=0x0)return _0x358bff;return db[_0x2999('0x3b')][_0x2999('0x7d')]({'name':_0x358bff[_0x2999('0x3a')],'resourceId':_0x358bff['id'],'type':_0x21f02e[_0x2999('0x3a')],'sectionId':_0x21f02e['id']},{})[_0x2999('0x1f')](function(){return _0x358bff;});})[_0x2999('0x28')](function(_0x337584){logger['error'](_0x2999('0x84'),_0x337584);throw _0x337584;});})[_0x2999('0x1f')](respondWithResult(_0x14479d,0xc9))[_0x2999('0x28')](handleError(_0x14479d,null));};exports['bulkCreate']=function(_0x38eb27,_0x385dc9){var _0x12ae04=_0x38eb27['body'];var _0x49cf8f=[];if(_0x38eb27[_0x2999('0x7e')][_0x2999('0x2a')]===_0x2999('0x2b'))throw new Error(_0x2999('0x85'));if(_['some'](_0x12ae04,[_0x2999('0x2a'),_0x2999('0x7e')])&&_0x38eb27[_0x2999('0x7e')][_0x2999('0x2a')]!==_0x2999('0x2f')){throw new Error(_0x2999('0x86'));}if(_[_0x2999('0x87')](_0x12ae04,[_0x2999('0x2a'),_0x2999('0x2f')])&&_0x38eb27[_0x2999('0x7e')]['role']!==_0x2999('0x2f')){throw new Error(_0x2999('0x88'));}return licenseUtil[_0x2999('0x80')](_0x12ae04)['then'](function(){return validateUser(_0x12ae04[0x0]);})[_0x2999('0x1f')](function(){for(var _0x3263a7=0x1;_0x3263a7<_0x12ae04[_0x2999('0x6e')];_0x3263a7++){var _0x35b038=_0x12ae04[_0x3263a7-0x1][_0x2999('0x63')];if(!_0x12ae04[_0x3263a7][_0x2999('0x63')])_0x12ae04[_0x3263a7][_0x2999('0x63')]=_0x35b038+0x1;_0x49cf8f[_0x2999('0x4f')](validateUser(_0x12ae04[_0x3263a7]));}return Promise[_0x2999('0x58')](_0x49cf8f);})['then'](function(){_0x49cf8f=[];for(var _0x3ccf94=0x0;_0x3ccf94<_0x12ae04['length'];_0x3ccf94++){_0x49cf8f[_0x2999('0x4f')](updateUser(_0x12ae04[_0x3ccf94]));}return Promise[_0x2999('0x58')](_0x49cf8f);})['then'](function(){_0x49cf8f=_0x12ae04[_0x2999('0x36')](function(_0x3bd387){return db['User'][_0x2999('0x7d')](_0x3bd387,{'include':[{'model':db[_0x2999('0x71')],'as':_0x2999('0x71')}]})['then'](function(_0x3df3dc){_0x3bd387['id']=_0x3df3dc['id'];return _0x3bd387;});});return Promise[_0x2999('0x58')](_0x49cf8f);})['then'](function(_0x5b315e){if(_0x38eb27[_0x2999('0x5f')][_0x2999('0x2a')]==='user')return _0x5b315e;if(_0x38eb27[_0x2999('0x7e')][_0x2999('0x2a')]!==_0x2999('0x7e'))return _0x5b315e;var _0x554aac=_[_0x2999('0x87')](_0x5b315e,function(_0x43100b){return _0x43100b['role']===_0x2999('0x2b')||_0x43100b[_0x2999('0x2a')]==='telephone';});if(!_0x554aac)return _0x5b315e;return db[_0x2999('0x83')][_0x2999('0x50')]({'where':{'name':{'$or':[_0x2999('0x31'),'Telephones']},'userProfileId':_0x38eb27[_0x2999('0x7e')]['userProfileId']},'raw':!![]})[_0x2999('0x1f')](function(_0x2b716e){if(_[_0x2999('0x89')](_0x2b716e)||!_['some'](_0x2b716e,[_0x2999('0x8a'),0x0]))return _0x5b315e;_0x49cf8f=[];var _0x2116cd=_(_0x2b716e)['map'](function(_0x43805e){if(_0x43805e['autoAssociation']===0x1)return;return _0x43805e['name']==='Agents'?_0x2999('0x2b'):_0x2999('0x33');})[_0x2999('0x8b')]()[_0x2999('0x37')]();for(var _0x56cfcb=0x0;_0x56cfcb<_0x5b315e[_0x2999('0x6e')];_0x56cfcb++){if(!_[_0x2999('0x38')](_0x2116cd,_0x5b315e[_0x56cfcb]['role']))return;var _0x343da9=_0x5b315e[_0x56cfcb][_0x2999('0x2a')]==='agent'?_0x2999('0x31'):'Telephones';_0x49cf8f['push'](db['UserProfileResource'][_0x2999('0x7d')]({'name':_0x5b315e[_0x56cfcb][_0x2999('0x3a')],'resourceId':_0x5b315e[_0x56cfcb]['id'],'type':_0x343da9,'sectionId':_[_0x2999('0x39')](_0x2b716e,[_0x2999('0x3a'),_0x343da9])['id']},{}));}return Promise[_0x2999('0x58')](_0x49cf8f);});})[_0x2999('0x1f')](respondWithResult(_0x385dc9,0xc9))[_0x2999('0x28')](handleError(_0x385dc9,null));};exports[_0x2999('0x8c')]=function(_0x4e7608,_0x59e5d5){if(_0x4e7608[_0x2999('0x5f')]['id']){delete _0x4e7608[_0x2999('0x5f')]['id'];}return db[_0x2999('0x3e')][_0x2999('0x39')]({'where':{'id':_0x4e7608[_0x2999('0x5a')]['id']}})[_0x2999('0x1f')](function(_0xb94909){if(!_0xb94909)return null;if(_0xb94909['id']===_0x4e7608[_0x2999('0x7e')]['id']){if(!_0x4e7608[_0x2999('0x5f')][_0x2999('0x8d')]||!_0x4e7608[_0x2999('0x5f')]['newPassword']){throw new db[(_0x2999('0x8e'))]['ValidationError'](_0x2999('0x8f'));}if(!_0xb94909['authenticate'](_0x4e7608[_0x2999('0x5f')]['oldPassword'])){throw new db[(_0x2999('0x8e'))][(_0x2999('0x90'))](_0x2999('0x91'));}if(_0x4e7608['body'][_0x2999('0x8d')]===_0x4e7608[_0x2999('0x5f')][_0x2999('0x92')]){throw new db[(_0x2999('0x8e'))][(_0x2999('0x90'))](_0x2999('0x93'));}}else if(_0x4e7608[_0x2999('0x7e')][_0x2999('0x2a')]===_0x2999('0x2f')){if(!_0x4e7608[_0x2999('0x5f')]['newPassword']){throw new db[(_0x2999('0x8e'))][(_0x2999('0x90'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x4e7608['user'][_0x2999('0x2a')]===_0x2999('0x7e')){if(!_0x4e7608[_0x2999('0x5f')][_0x2999('0x92')]){throw new db[(_0x2999('0x8e'))]['ValidationError'](_0x2999('0x94'));}if(_0xb94909[_0x2999('0x2a')]!==_0x2999('0x2b')){throw new db[(_0x2999('0x8e'))][(_0x2999('0x90'))](_0x2999('0x85'));}}else{throw new db[(_0x2999('0x8e'))]['ValidationError'](_0x2999('0x85'));}return _0xb94909;})[_0x2999('0x1f')](handleEntityNotFound(_0x59e5d5,null))[_0x2999('0x1f')](function(_0x3ab0b5){return db[_0x2999('0x64')][_0x2999('0x95')]({'attributes':['id',_0x2999('0x66'),_0x2999('0x96'),_0x2999('0x97')]})[_0x2999('0x1f')](function(_0x31651e){if(_0x31651e[_0x2999('0x66')])authService[_0x2999('0x98')](_0x4e7608[_0x2999('0x5f')][_0x2999('0x92')]);if(!_0x31651e[_0x2999('0x96')]||!_0x3ab0b5['previousPasswords'])return _0x3ab0b5;authService['validatePasswordHistory'](_0x4e7608[_0x2999('0x5f')]['newPassword'],_0x3ab0b5[_0x2999('0x43')],_0x31651e[_0x2999('0x97')]);return _0x3ab0b5;})[_0x2999('0x1f')](saveUpdates({'password':_0x4e7608[_0x2999('0x5f')][_0x2999('0x92')],'passwordResetAt':_0x4e7608[_0x2999('0x7e')]['id']==_0x4e7608[_0x2999('0x5a')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x4e7608[_0x2999('0x5f')][_0x2999('0x92')],_0x3ab0b5[_0x2999('0x43')])},null));})[_0x2999('0x1f')](respondWithResult(_0x59e5d5,null))[_0x2999('0x28')](handleError(_0x59e5d5,null));};exports[_0x2999('0x99')]=function(_0x34be67,_0x2f5f7c){var _0x74723=_0x34be67[_0x2999('0x5f')]['channel'];return db[_0x2999('0x3e')][_0x2999('0x39')]({'where':{'id':_0x34be67[_0x2999('0x5a')]['id']},'attributes':['id',_0x2999('0x3a'),_0x2999('0x2a'),_0x2999('0x9a'),'loginInPause',_0x2999('0x9b'),'interface']})['then'](handleEntityNotFound(_0x2f5f7c,null))[_0x2999('0x1f')](function(_0x557d22){if(_0x557d22){if(!utils['isValidChannel'](_0x74723)){throw new db[(_0x2999('0x8e'))][(_0x2999('0x90'))](_0x2999('0x9c'));}return _0x557d22[_0x2999('0x9d')+_[_0x2999('0x9e')](_0x74723['toLowerCase']())+_0x2999('0x9f')](_0x34be67[_0x2999('0x5f')][_0x2999('0x61')],{'penalty':_0x34be67['body']['penalty']||0x0})[_0x2999('0xa0')](function(_0x274be2){for(var _0x2b1ddd=0x0;_0x2b1ddd<_0x34be67['body']['ids'][_0x2999('0x6e')];_0x2b1ddd+=0x1){var _0x2c6e57={'UserId':Number(_0x34be67[_0x2999('0x5a')]['id'])};_0x2c6e57[_[_0x2999('0x9e')](_0x74723[_0x2999('0xa1')]())+_0x2999('0xa2')]=Number(_0x34be67[_0x2999('0x5f')][_0x2999('0x61')][_0x2b1ddd]);socket[_0x2999('0x2c')](_0x2999('0x7e')+_[_0x2999('0x9e')](_0x74723[_0x2999('0xa1')]())+_0x2999('0xa3'),_0x2c6e57);}return _0x274be2;})[_0x2999('0x1f')](function(){if(_0x74723==='voice'){return db[_0x2999('0xa4')][_0x2999('0x50')]({'where':{'id':_0x34be67[_0x2999('0x5f')][_0x2999('0x61')]||[]},'raw':!![],'attributes':['id',_0x2999('0x3a')]});}})[_0x2999('0x1f')](function(_0x3c0299){var _0x6fb475=_0x557d22[_0x2999('0x2e')]({'plain':!![]});var _0x506103=[];if(_0x74723==='voice'&&_0x6fb475[_0x2999('0x2a')]===_0x2999('0x2b')&&_0x6fb475['online']){for(let _0x5981f7=0x0;_0x5981f7<_0x3c0299['length'];_0x5981f7+=0x1){_0x506103['push']({'membername':_0x6fb475[_0x2999('0x3a')],'UserId':_0x6fb475['id'],'queue_name':_0x3c0299[_0x5981f7][_0x2999('0x3a')],'VoiceQueueId':_0x3c0299[_0x5981f7]['id'],'interface':_[_0x2999('0x69')](_0x6fb475['interface'])?util['format'](_0x2999('0xa5'),_0x6fb475[_0x2999('0x3a')]):_0x6fb475[_0x2999('0xa6')],'paused':_0x6fb475[_0x2999('0x9b')]||![],'penalty':_0x34be67['body'][_0x2999('0xa7')]||0x0});}return Promise['all'](_0x506103[_0x2999('0x36')](function(_0x2f51fd){return db[_0x2999('0xa8')]['upsert'](_0x2f51fd);}));}return _0x557d22;});}})['then'](respondWithStatusCode(_0x2f5f7c,null))[_0x2999('0x28')](handleError(_0x2f5f7c,null));};exports['removeQueues']=function(_0x941b36,_0x5b24f1){var _0x7ed6e8,_0x325087;return db[_0x2999('0x3e')]['find']({'where':{'id':_0x941b36[_0x2999('0x5a')]['id']},'attributes':['id',_0x2999('0x3a'),_0x2999('0x2a')]})[_0x2999('0x1f')](handleEntityNotFound(_0x5b24f1,null))['then'](function(_0x2947b6){if(_0x2947b6){_0x7ed6e8=_0x2947b6;if(!_0x941b36[_0x2999('0x49')][_0x2999('0xa9')]||!utils['isValidChannel'](_0x941b36['query'][_0x2999('0xa9')])){throw new db[(_0x2999('0x8e'))][(_0x2999('0x90'))]('Unknown\x20channel');}return _0x2947b6[_0x2999('0xaa')+_[_0x2999('0x9e')](_0x941b36['query'][_0x2999('0xa9')]['toLowerCase']())+_0x2999('0x9f')](_0x941b36[_0x2999('0x49')]['ids']);}})[_0x2999('0x1f')](function(_0x2f3462){if(_['isArray'](_0x941b36[_0x2999('0x49')][_0x2999('0x61')])){for(var _0xbcd9c2=0x0;_0xbcd9c2<_0x941b36[_0x2999('0x49')][_0x2999('0x61')][_0x2999('0x6e')];_0xbcd9c2+=0x1){_0x325087={'UserId':Number(_0x941b36['params']['id'])};_0x325087[_[_0x2999('0x9e')](_0x941b36[_0x2999('0x49')]['channel'][_0x2999('0xa1')]())+_0x2999('0xa2')]=Number(_0x941b36['query'][_0x2999('0x61')][_0xbcd9c2]);socket[_0x2999('0x2c')](_0x2999('0x7e')+_['capitalize'](_0x941b36[_0x2999('0x49')][_0x2999('0xa9')][_0x2999('0xa1')]())+_0x2999('0xab'),_0x325087);}}else{_0x325087={'UserId':Number(_0x941b36['params']['id'])};_0x325087[_[_0x2999('0x9e')](_0x941b36['query'][_0x2999('0xa9')][_0x2999('0xa1')]())+_0x2999('0xa2')]=Number(_0x941b36[_0x2999('0x49')][_0x2999('0x61')]);socket[_0x2999('0x2c')](_0x2999('0x7e')+_[_0x2999('0x9e')](_0x941b36[_0x2999('0x49')][_0x2999('0xa9')][_0x2999('0xa1')]())+_0x2999('0xab'),_0x325087);}return _0x2f3462;})[_0x2999('0x1f')](function(){if(_0x941b36[_0x2999('0x49')][_0x2999('0xa9')]===_0x2999('0xac')){return db['UserVoiceQueueRt'][_0x2999('0x2d')]({'where':{'UserId':_0x941b36['params']['id'],'VoiceQueueId':_0x941b36[_0x2999('0x49')]['ids']},'individualHooks':!![]})[_0x2999('0x1f')](function(){return _0x7ed6e8;});}return _0x7ed6e8;})[_0x2999('0x1f')](respondWithStatusCode(_0x5b24f1,null))[_0x2999('0x28')](handleError(_0x5b24f1,null));};exports[_0x2999('0xad')]=function(_0x3dfc57,_0x7f8bb6){_0x3dfc57[_0x2999('0x5f')]['userpic']=_0x3dfc57[_0x2999('0xae')]['filename'];return db[_0x2999('0x3e')][_0x2999('0x39')]({'where':{'id':_0x3dfc57[_0x2999('0x5a')]['id']}})['then'](handleEntityNotFound(_0x7f8bb6,null))['then'](saveUpdates(_0x3dfc57[_0x2999('0x5f')],null))[_0x2999('0x1f')](respondWithResult(_0x7f8bb6,null))[_0x2999('0x28')](handleError(_0x7f8bb6,null));};exports[_0x2999('0xaf')]=function(_0x4ab3ac,_0x241626){var _0x22a904=path['join'](config['root'],'server/files/images/logos/default_profile.png');return db['User'][_0x2999('0x39')]({'where':{'id':_0x4ab3ac[_0x2999('0x5a')]['id']},'attributes':['id',_0x2999('0xb0')],'raw':!![]})[_0x2999('0x1f')](handleEntityNotFound(_0x241626,null))[_0x2999('0x1f')](function(_0x49bf5c){if(_0x49bf5c){if(_[_0x2999('0x69')](_0x49bf5c[_0x2999('0xb0')])){return _0x241626[_0x2999('0xb1')](_0x22a904);}else{if(!fs[_0x2999('0xb2')](path[_0x2999('0xb3')](config[_0x2999('0xb4')],_0x2999('0xb5'),_0x49bf5c[_0x2999('0xb0')]))){return _0x241626[_0x2999('0xb1')](_0x22a904);}return _0x241626[_0x2999('0xb1')](path[_0x2999('0xb3')](config[_0x2999('0xb4')],_0x2999('0xb5'),_0x49bf5c[_0x2999('0xb0')]));}}})['catch'](handleError(_0x241626,null));};exports[_0x2999('0xb6')]=function(_0x4d9132,_0x37b5c2){return db[_0x2999('0x3e')][_0x2999('0x39')]({'where':{'id':_0x4d9132[_0x2999('0x5a')]['id']},'attributes':['id']})[_0x2999('0x1f')](handleEntityNotFound(_0x37b5c2,null))[_0x2999('0x1f')](function(_0x5ef0ea){var _0x1c0d55=[];values=_0x5ef0ea['dataValues'];_0x1c0d55[_0x2999('0x4f')](get_open_tabs('chat',_0x5ef0ea[_0x2999('0x55')]));_0x1c0d55[_0x2999('0x4f')](get_open_tabs(_0x2999('0x54'),_0x5ef0ea[_0x2999('0x55')]));_0x1c0d55[_0x2999('0x4f')](get_open_tabs(_0x2999('0x57'),_0x5ef0ea[_0x2999('0x55')]));_0x1c0d55['push'](get_open_tabs('whatsapp',_0x5ef0ea[_0x2999('0x55')]));_0x1c0d55[_0x2999('0x4f')](get_open_tabs('fax',_0x5ef0ea[_0x2999('0x55')]));_0x1c0d55[_0x2999('0x4f')](get_open_tabs(_0x2999('0x56'),_0x5ef0ea[_0x2999('0x55')]));return Promise[_0x2999('0x58')](_0x1c0d55);})[_0x2999('0x1f')](function(_0x3236b9){if(_0x3236b9){var _0x31c629=_['map'](values[_0x2999('0xb7')],function(_0x4a14c0){return{'channel':'CHAT','id':_0x4a14c0['id'],'createdAt':_0x4a14c0[_0x2999('0xb8')]};});var _0x1c8f84=_[_0x2999('0x36')](values[_0x2999('0xb9')],function(_0x371bca){return{'channel':'FAX','id':_0x371bca['id'],'createdAt':_0x371bca['createdAt']};});var _0x4a11bf=_[_0x2999('0x36')](values[_0x2999('0xba')],function(_0x3f3060){return{'channel':_0x2999('0xbb'),'id':_0x3f3060['id'],'createdAt':_0x3f3060['createdAt']};});var _0x47ad02=_[_0x2999('0x36')](values['MailOpenTabs'],function(_0x346f35){return{'channel':_0x2999('0xbc'),'id':_0x346f35['id'],'createdAt':_0x346f35[_0x2999('0xb8')]};});var _0x3ac968=_[_0x2999('0x36')](values[_0x2999('0xbd')],function(_0x171e24){return{'channel':_0x2999('0xbe'),'id':_0x171e24['id'],'createdAt':_0x171e24[_0x2999('0xb8')]};});var _0x437ec5=_['map'](values[_0x2999('0xbf')],function(_0x399fe3){return{'channel':'WHATSAPP','id':_0x399fe3['id'],'createdAt':_0x399fe3[_0x2999('0xb8')]};});var _0x1847b1=_[_0x2999('0xc0')](_0x31c629,_0x1c8f84,_0x4a11bf,_0x47ad02,_0x3ac968,_0x437ec5);var _0x507c70={'count':_0x1847b1[_0x2999('0x6e')],'rows':_0x1847b1};return _0x507c70;}else return null;})['then'](respondWithResult(_0x37b5c2,null))[_0x2999('0x28')](handleError(_0x37b5c2,null));};exports[_0x2999('0xc1')]=function(_0x5ad68d,_0x28ba4e){var _0x54cfd7={};return db[_0x2999('0x3e')][_0x2999('0x95')]({'where':{'id':_0x5ad68d[_0x2999('0x5a')]['id']}})['then'](function(_0x5b04d5){if(!_0x5b04d5){throw new APINotFoundError(util[_0x2999('0xc2')](_0x2999('0xc3'),_0x5ad68d[_0x2999('0x5a')]['id']));}return contacts[_0x2999('0x60')]();})[_0x2999('0x1f')](function(_0x3cf100){_0x5ad68d[_0x2999('0x49')][_0x2999('0x3e')]=_0x5ad68d[_0x2999('0x5a')]['id'];_0x54cfd7=qs['getOptions'](_0x3cf100,_0x5ad68d);if(_0x5ad68d['query'][_0x2999('0xc4')]('includeAll')){_0x54cfd7[_0x2999('0x4b')]=[{'model':db[_0x2999('0xc5')],'as':_0x2999('0xc6'),'required':![]},{'model':db[_0x2999('0xc7')],'as':_0x2999('0xc8'),'attributes':['id','name',_0x2999('0xc9')],'where':_0x5ad68d[_0x2999('0x49')][_0x2999('0xca')]?{'id':_0x5ad68d[_0x2999('0x49')][_0x2999('0xca')]}:undefined,'required':_0x5ad68d[_0x2999('0x49')][_0x2999('0xca')]?!![]:![]}];}return contacts['findAll'](_0x5ad68d[_0x2999('0x49')],_0x5ad68d[_0x2999('0x7e')],_0x54cfd7,_0x3cf100);})[_0x2999('0x1f')](respondWithFilteredResult(_0x28ba4e,_0x54cfd7))[_0x2999('0x28')](APIHandleError(_0x28ba4e));};exports[_0x2999('0xcb')]=function(_0xcc049d,_0x3db93a){var _0x4f4733;var _0x6d2049={};var _0x1f7ddf;return db[_0x2999('0x3e')][_0x2999('0x95')]({'where':{'id':_0xcc049d[_0x2999('0x5a')]['id']},'attributes':['id',_0x2999('0x3a'),'role']})[_0x2999('0x1f')](handleEntityNotFound(_0x3db93a,null))[_0x2999('0x1f')](function(_0x11b936){if(!utils[_0x2999('0xcc')](_0xcc049d[_0x2999('0x49')][_0x2999('0xa9')])){throw new db['Sequelize'][(_0x2999('0x90'))]('Unknown\x20channel');}_0x4f4733=_0x11b936;var _0x3117f3={};_0x3117f3[_0x2999('0xcd')]=_['keys'](db[_[_0x2999('0x9e')](_0xcc049d[_0x2999('0x49')]['channel'])+_0x2999('0xce')][_0x2999('0x3f')]);_0x3117f3[_0x2999('0x49')]=_[_0x2999('0xcf')](_0xcc049d[_0x2999('0x49')]);_0x3117f3[_0x2999('0xd0')]=_[_0x2999('0xd1')](_0x3117f3[_0x2999('0xcd')],_0x3117f3[_0x2999('0x49')]);_0x6d2049['attributes']=_[_0x2999('0xd1')](_0x3117f3[_0x2999('0xcd')],qs[_0x2999('0xd2')](_0xcc049d[_0x2999('0x49')]['fields']));_0x6d2049[_0x2999('0x4e')]=_0x6d2049[_0x2999('0x4e')][_0x2999('0x6e')]?_0x6d2049[_0x2999('0x4e')]:_0x3117f3[_0x2999('0xcd')];_0x6d2049[_0x2999('0xd3')]=qs[_0x2999('0xd4')](_0xcc049d[_0x2999('0x49')][_0x2999('0xd4')]);_0x6d2049[_0x2999('0x48')]=qs[_0x2999('0xd0')](_['pick'](_0xcc049d['query'],_0x3117f3[_0x2999('0xd0')]));if(_0xcc049d[_0x2999('0x49')][_0x2999('0x34')]){_0x6d2049[_0x2999('0x48')]=_[_0x2999('0x5b')](_0x6d2049[_0x2999('0x48')],{'$or':_[_0x2999('0x36')](_0x6d2049['attributes'],function(_0x51fde0){var _0x9d6640={};_0x9d6640[_0x51fde0]={'$like':'%'+_0xcc049d[_0x2999('0x49')][_0x2999('0x34')]+'%'};return _0x9d6640;})});}_0x6d2049=_[_0x2999('0x5b')]({},_0x6d2049,_0xcc049d[_0x2999('0x5c')]);switch(_0x4f4733[_0x2999('0x2a')]){case _0x2999('0x2f'):return db[_['capitalize'](_0xcc049d[_0x2999('0x49')][_0x2999('0xa9')])+'Queue'][_0x2999('0x50')](_0x6d2049);case'user':case _0x2999('0x2b'):return _0x4f4733[_0x2999('0x2e')+_['capitalize'](_0xcc049d['query'][_0x2999('0xa9')])+_0x2999('0x9f')](_0x6d2049);default:throw new db['Sequelize'][(_0x2999('0x90'))](_0x2999('0xd5'));}})[_0x2999('0x1f')](function(_0x44df3a){_0x1f7ddf=_0x44df3a[_0x2999('0x6e')];if(!_0xcc049d[_0x2999('0x49')][_0x2999('0xc4')](_0x2999('0xd6'))){_0x6d2049[_0x2999('0x1c')]=qs[_0x2999('0x1c')](_0xcc049d[_0x2999('0x49')][_0x2999('0x1c')]);_0x6d2049[_0x2999('0x1a')]=qs[_0x2999('0x1a')](_0xcc049d[_0x2999('0x49')][_0x2999('0x1a')]);}switch(_0x4f4733[_0x2999('0x2a')]){case'admin':return db[_['capitalize'](_0xcc049d[_0x2999('0x49')]['channel'])+_0x2999('0xce')][_0x2999('0x50')](_0x6d2049);case _0x2999('0x7e'):case'agent':return _0x4f4733[_0x2999('0x2e')+_[_0x2999('0x9e')](_0xcc049d[_0x2999('0x49')][_0x2999('0xa9')])+_0x2999('0x9f')](_0x6d2049);}})['then'](function(_0x5abda2){return{'count':_0x1f7ddf,'rows':_0x5abda2};})[_0x2999('0x1f')](respondWithResult(_0x3db93a,null))[_0x2999('0x28')](handleError(_0x3db93a,null));};exports['getVoiceQueuesRt']=function(_0x4e2060,_0x4dc70a){var _0x262d66={};var _0x355649={};var _0x35fd74;var _0x2ffeba;return db['User'][_0x2999('0x95')]({'where':{'id':_0x4e2060[_0x2999('0x5a')]['id']}})[_0x2999('0x1f')](handleEntityNotFound(_0x4dc70a,null))[_0x2999('0x1f')](function(_0x4294c5){if(_0x4294c5){_0x35fd74=_0x4294c5;_0x355649[_0x2999('0xcd')]=_[_0x2999('0xcf')](db['UserVoiceQueueRt']['rawAttributes']);_0x355649[_0x2999('0x49')]=_[_0x2999('0xcf')](_0x4e2060[_0x2999('0x49')]);_0x355649[_0x2999('0xd0')]=_[_0x2999('0xd1')](_0x355649[_0x2999('0xcd')],_0x355649[_0x2999('0x49')]);_0x262d66[_0x2999('0x4e')]=_[_0x2999('0xd1')](_0x355649[_0x2999('0xcd')],qs[_0x2999('0xd2')](_0x4e2060[_0x2999('0x49')][_0x2999('0xd2')]));_0x262d66[_0x2999('0x4e')]=_0x262d66[_0x2999('0x4e')][_0x2999('0x6e')]?_0x262d66[_0x2999('0x4e')]:_0x355649[_0x2999('0xcd')];_0x262d66[_0x2999('0xd3')]=qs[_0x2999('0xd4')](_0x4e2060[_0x2999('0x49')][_0x2999('0xd4')]);_0x262d66['where']=qs[_0x2999('0xd0')](_[_0x2999('0xd7')](_0x4e2060['query'],_0x355649[_0x2999('0xd0')]));if(_0x4e2060[_0x2999('0x49')][_0x2999('0x34')]){_0x262d66[_0x2999('0x48')]=_[_0x2999('0x5b')](_0x262d66[_0x2999('0x48')],{'$or':_['map'](_0x262d66['attributes'],function(_0x511513){var _0x55de37={};_0x55de37[_0x511513]={'$like':'%'+_0x4e2060[_0x2999('0x49')]['filter']+'%'};return _0x55de37;})});}_0x262d66=_[_0x2999('0x5b')]({},_0x262d66,_0x4e2060[_0x2999('0x5c')]);return _0x35fd74[_0x2999('0xd8')](_0x262d66);}})['then'](function(_0x468657){if(_0x468657){_0x2ffeba=_0x468657[_0x2999('0x6e')];if(!_0x4e2060[_0x2999('0x49')]['hasOwnProperty'](_0x2999('0xd6'))){_0x262d66['limit']=qs[_0x2999('0x1c')](_0x4e2060['query'][_0x2999('0x1c')]);_0x262d66[_0x2999('0x1a')]=qs[_0x2999('0x1a')](_0x4e2060[_0x2999('0x49')][_0x2999('0x1a')]);}return _0x35fd74['getVoiceQueuesRt'](_0x262d66);}})[_0x2999('0x1f')](function(_0x2f338e){if(_0x2f338e){return _0x2f338e?{'count':_0x2ffeba,'rows':_0x2f338e}:null;}})['then'](respondWithResult(_0x4dc70a,null))[_0x2999('0x28')](handleError(_0x4dc70a,null));};exports[_0x2999('0xd9')]=function(_0x2b4e36,_0x1e4588){var _0x166ff4={};var _0x34a92b={};var _0x3b393e;var _0x36a9ff;return db[_0x2999('0x3e')][_0x2999('0x95')]({'where':{'id':_0x2b4e36['params']['id']}})[_0x2999('0x1f')](handleEntityNotFound(_0x1e4588,null))[_0x2999('0x1f')](function(_0xfcc171){if(_0xfcc171){_0x3b393e=_0xfcc171;_0x34a92b[_0x2999('0xcd')]=_['keys'](db[_0x2999('0xda')]['rawAttributes']);_0x34a92b[_0x2999('0x49')]=_[_0x2999('0xcf')](_0x2b4e36['query']);_0x34a92b[_0x2999('0xd0')]=_['intersection'](_0x34a92b[_0x2999('0xcd')],_0x34a92b[_0x2999('0x49')]);_0x166ff4[_0x2999('0x4e')]=_[_0x2999('0xd1')](_0x34a92b[_0x2999('0xcd')],qs[_0x2999('0xd2')](_0x2b4e36[_0x2999('0x49')][_0x2999('0xd2')]));_0x166ff4[_0x2999('0x4e')]=_0x166ff4[_0x2999('0x4e')][_0x2999('0x6e')]?_0x166ff4[_0x2999('0x4e')]:_0x34a92b[_0x2999('0xcd')];_0x166ff4[_0x2999('0xd3')]=qs[_0x2999('0xd4')](_0x2b4e36[_0x2999('0x49')][_0x2999('0xd4')]);_0x166ff4['where']=qs['filters'](_[_0x2999('0xd7')](_0x2b4e36[_0x2999('0x49')],_0x34a92b['filters']));if(_0x2b4e36[_0x2999('0x49')][_0x2999('0x34')]){_0x166ff4['where']=_['merge'](_0x166ff4[_0x2999('0x48')],{'$or':_[_0x2999('0x36')](_0x166ff4[_0x2999('0x4e')],function(_0x494a87){var _0x36e9e2={};_0x36e9e2[_0x494a87]={'$like':'%'+_0x2b4e36['query'][_0x2999('0x34')]+'%'};return _0x36e9e2;})});}_0x166ff4=_[_0x2999('0x5b')]({},_0x166ff4,_0x2b4e36[_0x2999('0x5c')]);return _0x3b393e[_0x2999('0xd9')](_0x166ff4);}})[_0x2999('0x1f')](function(_0x20f6c3){if(_0x20f6c3){_0x36a9ff=_0x20f6c3[_0x2999('0x6e')];if(!_0x2b4e36['query'][_0x2999('0xc4')](_0x2999('0xd6'))){_0x166ff4['limit']=qs[_0x2999('0x1c')](_0x2b4e36[_0x2999('0x49')][_0x2999('0x1c')]);_0x166ff4[_0x2999('0x1a')]=qs['offset'](_0x2b4e36[_0x2999('0x49')]['offset']);}return _0x3b393e[_0x2999('0xd9')](_0x166ff4);}})[_0x2999('0x1f')](function(_0x4374a6){if(_0x4374a6){return _0x4374a6?{'count':_0x36a9ff,'rows':_0x4374a6}:null;}})[_0x2999('0x1f')](respondWithResult(_0x1e4588,null))['catch'](handleError(_0x1e4588,null));};exports[_0x2999('0xdb')]=function(_0x1c483b,_0x393d6b){var _0x5f1980={'raw':!![],'where':{}};var _0x44f12f={};var _0x47eca6={'count':0x0,'rows':[]};return db[_0x2999('0x3e')][_0x2999('0x95')]({'where':{'id':_0x1c483b[_0x2999('0x5a')]['id']}})['then'](handleEntityNotFound(_0x393d6b,null))[_0x2999('0x1f')](function(_0x11c402){if(_0x11c402){_0x44f12f[_0x2999('0xcd')]=_[_0x2999('0xcf')](db[_0x2999('0xdc')][_0x2999('0x3f')]);_0x44f12f[_0x2999('0x49')]=_['keys'](_0x1c483b['query']);_0x44f12f[_0x2999('0xd0')]=_['intersection'](_0x44f12f[_0x2999('0xcd')],_0x44f12f['query']);_0x5f1980['attributes']=_[_0x2999('0xd1')](_0x44f12f[_0x2999('0xcd')],qs[_0x2999('0xd2')](_0x1c483b['query'][_0x2999('0xd2')]));_0x5f1980[_0x2999('0x4e')]=_0x5f1980['attributes']['length']?_0x5f1980[_0x2999('0x4e')]:_0x44f12f['model'];if(!_0x1c483b[_0x2999('0x49')][_0x2999('0xc4')]('nolimit')){_0x5f1980[_0x2999('0x1c')]=qs['limit'](_0x1c483b[_0x2999('0x49')]['limit']);_0x5f1980['offset']=qs['offset'](_0x1c483b['query'][_0x2999('0x1a')]);}_0x5f1980[_0x2999('0xd3')]=qs['sort'](_0x1c483b[_0x2999('0x49')][_0x2999('0xd4')]);_0x5f1980['where']=qs[_0x2999('0xd0')](_[_0x2999('0xd7')](_0x1c483b[_0x2999('0x49')],_0x44f12f[_0x2999('0xd0')]));_0x5f1980[_0x2999('0x48')][_0x2999('0xdd')]=_0x11c402['id'];if(_0x1c483b[_0x2999('0x49')]['filter']){_0x5f1980[_0x2999('0x48')]=_[_0x2999('0x5b')](_0x5f1980[_0x2999('0x48')],{'$or':_[_0x2999('0x36')](_0x5f1980[_0x2999('0x4e')],function(_0x4466fa){var _0x3c1a34={};_0x3c1a34[_0x4466fa]={'$like':'%'+_0x1c483b[_0x2999('0x49')][_0x2999('0x34')]+'%'};return _0x3c1a34;})});}_0x5f1980=_['merge']({},_0x5f1980,_0x1c483b[_0x2999('0x5c')]);return db[_0x2999('0xdc')]['count']({'where':_0x5f1980[_0x2999('0x48')]})[_0x2999('0x1f')](function(_0x4cf487){_0x47eca6['count']=_0x4cf487;if(_0x1c483b['query'][_0x2999('0x4a')]){_0x5f1980[_0x2999('0x4b')]=[{'all':!![]}];}return db[_0x2999('0xdc')][_0x2999('0x50')](_0x5f1980);})[_0x2999('0x1f')](function(_0x52559a){_0x47eca6[_0x2999('0x51')]=_0x52559a;return _0x47eca6;});}})[_0x2999('0x1f')](respondWithFilteredResult(_0x393d6b,_0x5f1980))[_0x2999('0x28')](handleError(_0x393d6b,null));};exports['getScreenRecordings']=function(_0x2879e9,_0x20bf89){var _0x16da1a={'raw':!![],'where':{}};var _0x381b23={};var _0x3142bf={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x2879e9[_0x2999('0x5a')]['id']}})[_0x2999('0x1f')](handleEntityNotFound(_0x20bf89,null))[_0x2999('0x1f')](function(_0x20bd86){if(_0x20bd86){_0x381b23[_0x2999('0xcd')]=_[_0x2999('0xcf')](db['ScreenRecording'][_0x2999('0x3f')]);_0x381b23[_0x2999('0x49')]=_[_0x2999('0xcf')](_0x2879e9['query']);_0x381b23[_0x2999('0xd0')]=_[_0x2999('0xd1')](_0x381b23[_0x2999('0xcd')],_0x381b23['query']);_0x16da1a[_0x2999('0x4e')]=_[_0x2999('0xd1')](_0x381b23['model'],qs['fields'](_0x2879e9[_0x2999('0x49')]['fields']));_0x16da1a['attributes']=_0x16da1a[_0x2999('0x4e')][_0x2999('0x6e')]?_0x16da1a[_0x2999('0x4e')]:_0x381b23[_0x2999('0xcd')];if(!_0x2879e9[_0x2999('0x49')]['hasOwnProperty']('nolimit')){_0x16da1a[_0x2999('0x1c')]=qs[_0x2999('0x1c')](_0x2879e9[_0x2999('0x49')][_0x2999('0x1c')]);_0x16da1a[_0x2999('0x1a')]=qs[_0x2999('0x1a')](_0x2879e9[_0x2999('0x49')]['offset']);}_0x16da1a[_0x2999('0xd3')]=qs[_0x2999('0xd4')](_0x2879e9[_0x2999('0x49')][_0x2999('0xd4')]);_0x16da1a[_0x2999('0x48')]=qs['filters'](_[_0x2999('0xd7')](_0x2879e9[_0x2999('0x49')],_0x381b23[_0x2999('0xd0')]));_0x16da1a[_0x2999('0x48')]['UserId']=_0x20bd86['id'];if(_0x2879e9[_0x2999('0x49')]['filter']){_0x16da1a[_0x2999('0x48')]=_[_0x2999('0x5b')](_0x16da1a[_0x2999('0x48')],{'$or':_['map'](_0x16da1a[_0x2999('0x4e')],function(_0x3d9cd6){var _0xa49e66={};_0xa49e66[_0x3d9cd6]={'$like':'%'+_0x2879e9[_0x2999('0x49')]['filter']+'%'};return _0xa49e66;})});}_0x16da1a=_['merge']({},_0x16da1a,_0x2879e9[_0x2999('0x5c')]);return db[_0x2999('0xde')][_0x2999('0x1d')]({'where':_0x16da1a['where']})[_0x2999('0x1f')](function(_0x39ffa6){_0x3142bf[_0x2999('0x1d')]=_0x39ffa6;if(_0x2879e9[_0x2999('0x49')][_0x2999('0x4a')]){_0x16da1a['include']=[{'all':!![]}];}return db[_0x2999('0xde')][_0x2999('0x50')](_0x16da1a);})[_0x2999('0x1f')](function(_0x56e999){_0x3142bf[_0x2999('0x51')]=_0x56e999;return _0x3142bf;});}})[_0x2999('0x1f')](respondWithFilteredResult(_0x20bf89,_0x16da1a))['catch'](handleError(_0x20bf89,null));};exports[_0x2999('0xdf')]=function(_0x46d122,_0x30909e){var _0x460efb={};var _0x21028d={};var _0x3b0ef7;var _0x511bfb;return db[_0x2999('0x3e')][_0x2999('0x95')]({'where':{'id':_0x46d122['params']['id']}})[_0x2999('0x1f')](handleEntityNotFound(_0x30909e,null))[_0x2999('0x1f')](function(_0x4c5f7f){if(_0x4c5f7f){_0x3b0ef7=_0x4c5f7f;_0x21028d['model']=_[_0x2999('0xcf')](db[_0x2999('0xe0')][_0x2999('0x3f')]);_0x21028d[_0x2999('0x49')]=_[_0x2999('0xcf')](_0x46d122['query']);_0x21028d['filters']=_[_0x2999('0xd1')](_0x21028d[_0x2999('0xcd')],_0x21028d['query']);_0x460efb['attributes']=_[_0x2999('0xd1')](_0x21028d[_0x2999('0xcd')],qs[_0x2999('0xd2')](_0x46d122['query']['fields']));_0x460efb[_0x2999('0x4e')]=_0x460efb['attributes'][_0x2999('0x6e')]?_0x460efb['attributes']:_0x21028d[_0x2999('0xcd')];_0x460efb[_0x2999('0xd3')]=qs[_0x2999('0xd4')](_0x46d122[_0x2999('0x49')][_0x2999('0xd4')]);_0x460efb[_0x2999('0x48')]=qs[_0x2999('0xd0')](_[_0x2999('0xd7')](_0x46d122[_0x2999('0x49')],_0x21028d[_0x2999('0xd0')]));if(_0x46d122['query']['filter']){_0x460efb[_0x2999('0x48')]=_[_0x2999('0x5b')](_0x460efb[_0x2999('0x48')],{'$or':_[_0x2999('0x36')](_0x460efb[_0x2999('0x4e')],function(_0x39fd1a){var _0x5c7c64={};_0x5c7c64[_0x39fd1a]={'$like':'%'+_0x46d122['query']['filter']+'%'};return _0x5c7c64;})});}_0x460efb=_['merge']({},_0x460efb,_0x46d122['options']);return _0x3b0ef7['getChatInteractions'](_0x460efb);}})[_0x2999('0x1f')](function(_0x4dd3a0){if(_0x4dd3a0){_0x511bfb=_0x4dd3a0[_0x2999('0x6e')];if(!_0x46d122[_0x2999('0x49')][_0x2999('0xc4')](_0x2999('0xd6'))){_0x460efb[_0x2999('0x1c')]=qs[_0x2999('0x1c')](_0x46d122[_0x2999('0x49')][_0x2999('0x1c')]);_0x460efb['offset']=qs[_0x2999('0x1a')](_0x46d122[_0x2999('0x49')][_0x2999('0x1a')]);}return _0x3b0ef7[_0x2999('0xdf')](_0x460efb);}})[_0x2999('0x1f')](function(_0x373d7c){if(_0x373d7c){return _0x373d7c?{'count':_0x511bfb,'rows':_0x373d7c}:null;}})[_0x2999('0x1f')](respondWithResult(_0x30909e,null))[_0x2999('0x28')](handleError(_0x30909e,null));};exports[_0x2999('0xe1')]=function(_0x2d9b63,_0xa67764){var _0x304ef6={};var _0x126fe7={};var _0x160b02;var _0x1f3019;return db['User'][_0x2999('0x95')]({'where':{'id':_0x2d9b63['params']['id']}})['then'](handleEntityNotFound(_0xa67764,null))[_0x2999('0x1f')](function(_0x3e6a76){if(_0x3e6a76){_0x160b02=_0x3e6a76;_0x126fe7[_0x2999('0xcd')]=_['keys'](db[_0x2999('0xe2')][_0x2999('0x3f')]);_0x126fe7[_0x2999('0x49')]=_[_0x2999('0xcf')](_0x2d9b63[_0x2999('0x49')]);_0x126fe7[_0x2999('0xd0')]=_[_0x2999('0xd1')](_0x126fe7[_0x2999('0xcd')],_0x126fe7[_0x2999('0x49')]);_0x304ef6[_0x2999('0x4e')]=_[_0x2999('0xd1')](_0x126fe7[_0x2999('0xcd')],qs['fields'](_0x2d9b63[_0x2999('0x49')][_0x2999('0xd2')]));_0x304ef6[_0x2999('0x4e')]=_0x304ef6[_0x2999('0x4e')]['length']?_0x304ef6[_0x2999('0x4e')]:_0x126fe7[_0x2999('0xcd')];_0x304ef6['order']=qs[_0x2999('0xd4')](_0x2d9b63['query']['sort']);_0x304ef6[_0x2999('0x48')]=qs[_0x2999('0xd0')](_[_0x2999('0xd7')](_0x2d9b63[_0x2999('0x49')],_0x126fe7[_0x2999('0xd0')]));if(_0x2d9b63[_0x2999('0x49')][_0x2999('0x34')]){_0x304ef6[_0x2999('0x48')]=_[_0x2999('0x5b')](_0x304ef6[_0x2999('0x48')],{'$or':_[_0x2999('0x36')](_0x304ef6[_0x2999('0x4e')],function(_0x26bfb8){var _0x469589={};_0x469589[_0x26bfb8]={'$like':'%'+_0x2d9b63[_0x2999('0x49')]['filter']+'%'};return _0x469589;})});}_0x304ef6=_[_0x2999('0x5b')]({},_0x304ef6,_0x2d9b63[_0x2999('0x5c')]);return _0x160b02['getOpenchannelInteractions'](_0x304ef6);}})[_0x2999('0x1f')](function(_0xc8d35b){if(_0xc8d35b){_0x1f3019=_0xc8d35b['length'];if(!_0x2d9b63[_0x2999('0x49')][_0x2999('0xc4')](_0x2999('0xd6'))){_0x304ef6[_0x2999('0x1c')]=qs['limit'](_0x2d9b63[_0x2999('0x49')]['limit']);_0x304ef6['offset']=qs[_0x2999('0x1a')](_0x2d9b63[_0x2999('0x49')]['offset']);}return _0x160b02['getOpenchannelInteractions'](_0x304ef6);}})[_0x2999('0x1f')](function(_0x12b19c){if(_0x12b19c){return _0x12b19c?{'count':_0x1f3019,'rows':_0x12b19c}:null;}})['then'](respondWithResult(_0xa67764,null))[_0x2999('0x28')](handleError(_0xa67764,null));};exports[_0x2999('0xe3')]=function(_0x533be7,_0x18b0fb){var _0x30a4fb={'raw':!![],'where':{}};var _0x319f90={};var _0x58a64b={'count':0x0,'rows':[]};return db[_0x2999('0x3e')][_0x2999('0x95')]({'where':{'id':_0x533be7['params']['id']}})[_0x2999('0x1f')](handleEntityNotFound(_0x18b0fb,null))['then'](function(_0x2f3ee3){if(_0x2f3ee3){_0x319f90[_0x2999('0xcd')]=_['keys'](db['MailInteraction']['rawAttributes']);_0x319f90[_0x2999('0x49')]=_[_0x2999('0xcf')](_0x533be7[_0x2999('0x49')]);_0x319f90[_0x2999('0xd0')]=_['intersection'](_0x319f90[_0x2999('0xcd')],_0x319f90['query']);_0x30a4fb['attributes']=_[_0x2999('0xd1')](_0x319f90[_0x2999('0xcd')],qs[_0x2999('0xd2')](_0x533be7[_0x2999('0x49')][_0x2999('0xd2')]));_0x30a4fb[_0x2999('0x4e')]=_0x30a4fb[_0x2999('0x4e')][_0x2999('0x6e')]?_0x30a4fb[_0x2999('0x4e')]:_0x319f90[_0x2999('0xcd')];if(!_0x533be7['query'][_0x2999('0xc4')](_0x2999('0xd6'))){_0x30a4fb[_0x2999('0x1c')]=qs[_0x2999('0x1c')](_0x533be7[_0x2999('0x49')][_0x2999('0x1c')]);_0x30a4fb['offset']=qs['offset'](_0x533be7[_0x2999('0x49')][_0x2999('0x1a')]);}_0x30a4fb[_0x2999('0xd3')]=qs[_0x2999('0xd4')](_0x533be7['query']['sort']);_0x30a4fb[_0x2999('0x48')]=qs[_0x2999('0xd0')](_[_0x2999('0xd7')](_0x533be7[_0x2999('0x49')],_0x319f90['filters']));_0x30a4fb['where']['UserId']=_0x2f3ee3['id'];if(_0x533be7[_0x2999('0x49')][_0x2999('0x34')]){_0x30a4fb[_0x2999('0x48')]=_[_0x2999('0x5b')](_0x30a4fb['where'],{'$or':_[_0x2999('0x36')](_0x30a4fb[_0x2999('0x4e')],function(_0x25c341){var _0x39ebd7={};_0x39ebd7[_0x25c341]={'$like':'%'+_0x533be7[_0x2999('0x49')][_0x2999('0x34')]+'%'};return _0x39ebd7;})});}_0x30a4fb=_[_0x2999('0x5b')]({},_0x30a4fb,_0x533be7[_0x2999('0x5c')]);return db['MailInteraction'][_0x2999('0x1d')]({'where':_0x30a4fb[_0x2999('0x48')]})[_0x2999('0x1f')](function(_0x168653){_0x58a64b[_0x2999('0x1d')]=_0x168653;if(_0x533be7['query']['includeAll']){_0x30a4fb[_0x2999('0x4b')]=[{'all':!![]}];}return db[_0x2999('0xe4')]['findAll'](_0x30a4fb);})['then'](function(_0x2018d8){_0x58a64b[_0x2999('0x51')]=_0x2018d8;return _0x58a64b;});}})[_0x2999('0x1f')](respondWithFilteredResult(_0x18b0fb,_0x30a4fb))[_0x2999('0x28')](handleError(_0x18b0fb,null));};exports['getSmsInteractions']=function(_0x26d600,_0x2300af){var _0x22a22f={};var _0x51ba6b={};var _0x1d66a9;var _0xac6dd3;return db['User'][_0x2999('0x95')]({'where':{'id':_0x26d600['params']['id']}})[_0x2999('0x1f')](handleEntityNotFound(_0x2300af,null))[_0x2999('0x1f')](function(_0x591e4c){if(_0x591e4c){_0x1d66a9=_0x591e4c;_0x51ba6b[_0x2999('0xcd')]=_['keys'](db['SmsInteraction']['rawAttributes']);_0x51ba6b[_0x2999('0x49')]=_[_0x2999('0xcf')](_0x26d600['query']);_0x51ba6b[_0x2999('0xd0')]=_['intersection'](_0x51ba6b[_0x2999('0xcd')],_0x51ba6b[_0x2999('0x49')]);_0x22a22f['attributes']=_['intersection'](_0x51ba6b['model'],qs[_0x2999('0xd2')](_0x26d600[_0x2999('0x49')][_0x2999('0xd2')]));_0x22a22f[_0x2999('0x4e')]=_0x22a22f[_0x2999('0x4e')]['length']?_0x22a22f[_0x2999('0x4e')]:_0x51ba6b[_0x2999('0xcd')];_0x22a22f[_0x2999('0xd3')]=qs[_0x2999('0xd4')](_0x26d600[_0x2999('0x49')]['sort']);_0x22a22f[_0x2999('0x48')]=qs[_0x2999('0xd0')](_[_0x2999('0xd7')](_0x26d600['query'],_0x51ba6b['filters']));if(_0x26d600[_0x2999('0x49')][_0x2999('0x34')]){_0x22a22f[_0x2999('0x48')]=_[_0x2999('0x5b')](_0x22a22f[_0x2999('0x48')],{'$or':_[_0x2999('0x36')](_0x22a22f[_0x2999('0x4e')],function(_0x4c879d){var _0x3ad452={};_0x3ad452[_0x4c879d]={'$like':'%'+_0x26d600[_0x2999('0x49')]['filter']+'%'};return _0x3ad452;})});}_0x22a22f=_[_0x2999('0x5b')]({},_0x22a22f,_0x26d600[_0x2999('0x5c')]);return _0x1d66a9[_0x2999('0xe5')](_0x22a22f);}})['then'](function(_0x40cc81){if(_0x40cc81){_0xac6dd3=_0x40cc81['length'];if(!_0x26d600['query']['hasOwnProperty'](_0x2999('0xd6'))){_0x22a22f['limit']=qs[_0x2999('0x1c')](_0x26d600[_0x2999('0x49')][_0x2999('0x1c')]);_0x22a22f[_0x2999('0x1a')]=qs[_0x2999('0x1a')](_0x26d600['query'][_0x2999('0x1a')]);}return _0x1d66a9[_0x2999('0xe5')](_0x22a22f);}})[_0x2999('0x1f')](function(_0x457df0){if(_0x457df0){return _0x457df0?{'count':_0xac6dd3,'rows':_0x457df0}:null;}})[_0x2999('0x1f')](respondWithResult(_0x2300af,null))['catch'](handleError(_0x2300af,null));};exports[_0x2999('0xe6')]=function(_0x1b202f,_0x3eb8a4){var _0xc6bdf6={};var _0x37854d={};var _0x38c02b;var _0xf10681;return db[_0x2999('0x3e')]['findOne']({'where':{'id':_0x1b202f[_0x2999('0x5a')]['id']}})[_0x2999('0x1f')](handleEntityNotFound(_0x3eb8a4,null))[_0x2999('0x1f')](function(_0x3c938e){if(_0x3c938e){_0x38c02b=_0x3c938e;_0x37854d[_0x2999('0xcd')]=_['keys'](db[_0x2999('0xe7')]['rawAttributes']);_0x37854d['query']=_['keys'](_0x1b202f[_0x2999('0x49')]);_0x37854d[_0x2999('0xd0')]=_[_0x2999('0xd1')](_0x37854d[_0x2999('0xcd')],_0x37854d[_0x2999('0x49')]);_0xc6bdf6[_0x2999('0x4e')]=_[_0x2999('0xd1')](_0x37854d[_0x2999('0xcd')],qs[_0x2999('0xd2')](_0x1b202f['query']['fields']));_0xc6bdf6[_0x2999('0x4e')]=_0xc6bdf6[_0x2999('0x4e')][_0x2999('0x6e')]?_0xc6bdf6[_0x2999('0x4e')]:_0x37854d[_0x2999('0xcd')];_0xc6bdf6[_0x2999('0xd3')]=qs[_0x2999('0xd4')](_0x1b202f[_0x2999('0x49')][_0x2999('0xd4')]);_0xc6bdf6['where']=qs[_0x2999('0xd0')](_[_0x2999('0xd7')](_0x1b202f['query'],_0x37854d[_0x2999('0xd0')]));if(_0x1b202f['query'][_0x2999('0x34')]){_0xc6bdf6[_0x2999('0x48')]=_[_0x2999('0x5b')](_0xc6bdf6[_0x2999('0x48')],{'$or':_[_0x2999('0x36')](_0xc6bdf6['attributes'],function(_0x58956a){var _0x291fbb={};_0x291fbb[_0x58956a]={'$like':'%'+_0x1b202f[_0x2999('0x49')][_0x2999('0x34')]+'%'};return _0x291fbb;})});}_0xc6bdf6=_['merge']({},_0xc6bdf6,_0x1b202f['options']);return _0x38c02b[_0x2999('0xe6')](_0xc6bdf6);}})['then'](function(_0x4411a3){if(_0x4411a3){_0xf10681=_0x4411a3[_0x2999('0x6e')];if(!_0x1b202f['query']['hasOwnProperty']('nolimit')){_0xc6bdf6[_0x2999('0x1c')]=qs['limit'](_0x1b202f[_0x2999('0x49')]['limit']);_0xc6bdf6[_0x2999('0x1a')]=qs['offset'](_0x1b202f['query'][_0x2999('0x1a')]);}return _0x38c02b[_0x2999('0xe6')](_0xc6bdf6);}})[_0x2999('0x1f')](function(_0x3915e0){if(_0x3915e0){return _0x3915e0?{'count':_0xf10681,'rows':_0x3915e0}:null;}})[_0x2999('0x1f')](respondWithResult(_0x3eb8a4,null))['catch'](handleError(_0x3eb8a4,null));};exports[_0x2999('0xe8')]=function(_0x5abb0f,_0x1bf594){var _0x31f683={};var _0x42a911={};var _0x58945c;var _0x23ac51;return db['User'][_0x2999('0x95')]({'where':{'id':_0x5abb0f[_0x2999('0x5a')]['id']}})[_0x2999('0x1f')](handleEntityNotFound(_0x1bf594,null))[_0x2999('0x1f')](function(_0x38c3a9){if(_0x38c3a9){_0x58945c=_0x38c3a9;_0x42a911[_0x2999('0xcd')]=_[_0x2999('0xcf')](db['WhatsappInteraction']['rawAttributes']);_0x42a911['query']=_['keys'](_0x5abb0f['query']);_0x42a911[_0x2999('0xd0')]=_[_0x2999('0xd1')](_0x42a911[_0x2999('0xcd')],_0x42a911[_0x2999('0x49')]);_0x31f683[_0x2999('0x4e')]=_[_0x2999('0xd1')](_0x42a911['model'],qs['fields'](_0x5abb0f[_0x2999('0x49')][_0x2999('0xd2')]));_0x31f683[_0x2999('0x4e')]=_0x31f683[_0x2999('0x4e')][_0x2999('0x6e')]?_0x31f683[_0x2999('0x4e')]:_0x42a911[_0x2999('0xcd')];_0x31f683[_0x2999('0xd3')]=qs[_0x2999('0xd4')](_0x5abb0f[_0x2999('0x49')][_0x2999('0xd4')]);_0x31f683[_0x2999('0x48')]=qs[_0x2999('0xd0')](_[_0x2999('0xd7')](_0x5abb0f['query'],_0x42a911[_0x2999('0xd0')]));if(_0x5abb0f['query'][_0x2999('0x34')]){_0x31f683[_0x2999('0x48')]=_[_0x2999('0x5b')](_0x31f683[_0x2999('0x48')],{'$or':_[_0x2999('0x36')](_0x31f683[_0x2999('0x4e')],function(_0x5e10f0){var _0x58af7f={};_0x58af7f[_0x5e10f0]={'$like':'%'+_0x5abb0f[_0x2999('0x49')][_0x2999('0x34')]+'%'};return _0x58af7f;})});}_0x31f683=_[_0x2999('0x5b')]({},_0x31f683,_0x5abb0f['options']);return _0x58945c[_0x2999('0xe8')](_0x31f683);}})['then'](function(_0x38e7a3){if(_0x38e7a3){_0x23ac51=_0x38e7a3[_0x2999('0x6e')];if(!_0x5abb0f[_0x2999('0x49')]['hasOwnProperty'](_0x2999('0xd6'))){_0x31f683['limit']=qs['limit'](_0x5abb0f[_0x2999('0x49')][_0x2999('0x1c')]);_0x31f683[_0x2999('0x1a')]=qs[_0x2999('0x1a')](_0x5abb0f[_0x2999('0x49')][_0x2999('0x1a')]);}return _0x58945c[_0x2999('0xe8')](_0x31f683);}})['then'](function(_0x3c9a4b){if(_0x3c9a4b){return _0x3c9a4b?{'count':_0x23ac51,'rows':_0x3c9a4b}:null;}})['then'](respondWithResult(_0x1bf594,null))[_0x2999('0x28')](handleError(_0x1bf594,null));};exports[_0x2999('0xe9')]=function(_0x20886d,_0x1e2c86,_0x24102a){var _0x45121b;var _0x38e082;var _0x361df3;var _0x510c14=!_[_0x2999('0x69')](_0x20886d[_0x2999('0x5a')]['id'])?_0x20886d[_0x2999('0x5a')]['id']:!_[_0x2999('0x69')](_0x20886d['user']['id'])?_0x20886d[_0x2999('0x7e')]['id']:null;return db[_0x2999('0x3e')][_0x2999('0x39')]({'where':{'id':_0x510c14,'role':{'$or':[_0x2999('0x2f'),_0x2999('0x7e'),'agent']}},'attributes':['id',_0x2999('0x3a'),_0x2999('0xea'),'mobile',_0x2999('0x2a'),_0x2999('0x63'),'loginInPause']})[_0x2999('0x1f')](function(_0x2734b5){if(_0x2734b5){if(_0x2734b5['role']===_0x2999('0x2b')){_0x45121b=_0x2734b5;if(_0x20886d['body'][_0x2999('0xa6')]){_0x361df3=util[_0x2999('0xc2')](_0x2999('0xeb'),_0x45121b[_0x20886d[_0x2999('0x5f')][_0x2999('0xa6')]]);}else if(_0x20886d[_0x2999('0x5f')][_0x2999('0xec')]){_0x361df3=util['format'](_0x2999('0xa5'),_0x20886d[_0x2999('0x5f')][_0x2999('0xec')]);}else{_0x361df3=util[_0x2999('0xc2')](_0x2999('0xa5'),_0x45121b[_0x2999('0x3a')]);}socket['to'](util['format'](_0x2999('0xed'),_0x45121b[_0x2999('0x3a')]))['emit']('user:forcelogout',{'user':{'id':_0x45121b['id'],'name':_0x45121b[_0x2999('0x3a')]},'ip':_0x20886d[_0x2999('0xee')][_0x2999('0xef')]||_0x20886d['connection'][_0x2999('0xf0')]||_0x20886d[_0x2999('0xf1')][_0x2999('0xf0')]||_0x20886d[_0x2999('0xf2')][_0x2999('0xf1')][_0x2999('0xf0')]});return db[_0x2999('0xa8')]['destroy']({'where':{'membername':_0x45121b[_0x2999('0x3a')]},'individualHooks':!![]});}}else{throw new db[(_0x2999('0x8e'))][(_0x2999('0x90'))](_0x2999('0xf3'));}})[_0x2999('0x1f')](function(){if(_0x45121b){return _0x45121b[_0x2999('0xf4')]({'raw':!![]});}})[_0x2999('0x1f')](function(_0x3b4eb7){if(_0x45121b){if(_0x3b4eb7){_0x38e082=_0x3b4eb7;if(_0x38e082[_0x2999('0x6e')]){var _0xaad92e=_0x38e082[_0x2999('0x36')](function(_0x5f5200){var _0x4d7e77={'membername':_0x45121b['name'],'UserId':_0x45121b['id'],'queue_name':_0x5f5200[_0x2999('0x3a')],'VoiceQueueId':_0x5f5200['id'],'interface':_0x361df3,'paused':_0x45121b[_0x2999('0xf5')]||![],'penalty':_0x5f5200['UserVoiceQueue.penalty']||0x0};return db[_0x2999('0xa8')][_0x2999('0xf6')](_0x4d7e77);});return Promise['all'](_0xaad92e);}}}})[_0x2999('0x1f')](function(){if(_0x45121b){return db[_0x2999('0xf7')][_0x2999('0x50')]({'where':{'membername':_0x45121b[_0x2999('0x3a')],'exitAt':null}});}})[_0x2999('0x1f')](function(_0x3a60f8){if(_0x45121b){var _0x58ac03=[];_0x3a60f8[_0x2999('0xf8')](function(_0x232a13){_0x58ac03['push'](_0x232a13[_0x2999('0x29')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise['all'](_0x58ac03);}})[_0x2999('0x1f')](function(){if(_0x45121b){var _0x30ec59=[];var _0x1c9794=[];var _0x4f7761=utils[_0x2999('0xf9')]();var _0x18e3f7={'membername':_0x45121b[_0x2999('0x3a')],'interface':_0x361df3,'enterAt':moment()[_0x2999('0xc2')](_0x2999('0xfa')),'role':_0x45121b[_0x2999('0x2a')],'internal':_0x45121b[_0x2999('0x63')]};_0x4f7761[_0x2999('0xf8')](function(_0x2e170f){_0x30ec59[_0x2999('0x4f')](_['merge']({'channel':_0x2e170f,'type':_0x2999('0xfb'),'data1':_0x20886d[_0x2999('0x5f')][_0x2999('0xfc')],'data2':_0x361df3},_0x18e3f7));if(_0x45121b[_0x2999('0xf5')]){_0x1c9794[_0x2999('0x4f')](_[_0x2999('0x5b')]({'channel':_0x2e170f,'type':_0x2999('0xfd'),'data1':_0x2999('0xfe')},_0x18e3f7));}});return db[_0x2999('0xf7')][_0x2999('0xff')](_0x30ec59[_0x2999('0xc0')](_0x1c9794),{'individualHooks':!![]});}})[_0x2999('0x1f')](function(){if(_0x45121b){return _0x45121b[_0x2999('0x29')]({'online':!![],'lastLoginAt':moment()[_0x2999('0xc2')](_0x2999('0xfa')),'voicePause':_0x45121b[_0x2999('0xf5')]||![],'mailPause':_0x45121b['loginInPause']||![],'chatPause':_0x45121b[_0x2999('0xf5')]||![],'faxPause':_0x45121b[_0x2999('0xf5')]||![],'smsPause':_0x45121b[_0x2999('0xf5')]||![],'openchannelPause':_0x45121b[_0x2999('0xf5')]||![],'whatsappPause':_0x45121b[_0x2999('0xf5')]||![],'pauseType':_0x45121b['loginInPause']?'LOGININPAUSE':null,'interface':_0x361df3,'lastPauseAt':moment()[_0x2999('0xc2')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x2999('0x1f')](function(_0x823d68){if(_0x20886d[_0x2999('0x100')]){return _0x24102a();}else{return Promise[_0x2999('0x101')](_0x823d68)['then'](respondWithResult(_0x1e2c86,null));}})['catch'](handleError(_0x1e2c86,null));};exports[_0x2999('0x102')]=function(_0x3defee,_0x55af6d){var _0x4fed5c;return db[_0x2999('0x3e')][_0x2999('0x39')]({'where':{'id':_0x3defee['params']['id'],'role':'agent'},'attributes':['id',_0x2999('0x3a'),_0x2999('0x2a')]})[_0x2999('0x1f')](handleEntityNotFound(_0x55af6d,null))[_0x2999('0x1f')](function(_0x8dd068){if(_0x8dd068){_0x4fed5c=_0x8dd068;return db[_0x2999('0xa8')]['destroy']({'where':{'membername':_0x4fed5c['name']},'individualHooks':!![]});}})['then'](function(){return db['MemberReport'][_0x2999('0x50')]({'where':{'membername':_0x4fed5c[_0x2999('0x3a')],'exitAt':null}});})[_0x2999('0x1f')](function(_0x1c3d31){var _0x23c5e5=[];_0x1c3d31[_0x2999('0xf8')](function(_0x55f1c5){_0x23c5e5[_0x2999('0x4f')](_0x55f1c5[_0x2999('0x29')]({'exitAt':moment()['format'](_0x2999('0xfa'))}));});return Promise[_0x2999('0x58')](_0x23c5e5);})[_0x2999('0x1f')](function(){return _0x4fed5c[_0x2999('0x29')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x2999('0x1f')](respondWithResult(_0x55af6d,null))['catch'](handleError(_0x55af6d,null));};exports[_0x2999('0x103')]=function(_0x1a0066,_0x30b441){var _0x5d0a63;return db[_0x2999('0xa8')]['update']({'paused':0x1},{'where':{'UserId':_0x1a0066[_0x2999('0x5a')]['id']},'individualHooks':!![]})[_0x2999('0x1f')](function(){return db[_0x2999('0x3e')][_0x2999('0x39')]({'where':{'id':_0x1a0066['params']['id'],'role':_0x2999('0x2b')},'attributes':['id',_0x2999('0x3a'),_0x2999('0x2a'),'internal',_0x2999('0xa6'),_0x2999('0x9a')]});})[_0x2999('0x1f')](handleEntityNotFound(_0x30b441,null))['then'](function(_0x57a257){if(_0x57a257){_0x5d0a63=_0x57a257;return respondWithRpcPromise('QueuePause','pause',{'id':_0x5d0a63['id'],'name':_0x5d0a63[_0x2999('0x3a')],'pause':!![]});}})['then'](function(){if(_0x5d0a63){return db[_0x2999('0xf7')][_0x2999('0x50')]({'where':{'membername':_0x5d0a63[_0x2999('0x3a')],'type':'PAUSE','exitAt':null}});}})['then'](function(_0x806901){if(_0x806901[_0x2999('0x6e')]){var _0x578a90=moment()[_0x2999('0xc2')](_0x2999('0xfa'));for(var _0xbb891b=0x0,_0x376347=_0x806901[_0x2999('0x6e')];_0xbb891b<_0x376347;_0xbb891b++){_0x806901[_0xbb891b][_0x2999('0x104')]({'exitAt':_0x578a90});}}})['then'](function(){var _0xc8bb08=[];var _0x4767b8=utils[_0x2999('0xf9')]();_0x4767b8['forEach'](function(_0x195642){_0xc8bb08['push']({'channel':_0x195642,'membername':_0x5d0a63[_0x2999('0x3a')],'interface':_[_0x2999('0x69')](_0x5d0a63[_0x2999('0xa6')])?util[_0x2999('0xc2')]('SIP/%s',_0x5d0a63[_0x2999('0x3a')]):_0x5d0a63[_0x2999('0xa6')],'type':_0x2999('0xfd'),'enterAt':moment()[_0x2999('0xc2')](_0x2999('0xfa')),'data1':_0x1a0066[_0x2999('0x5f')][_0x2999('0x105')]||_0x2999('0x106'),'role':_0x5d0a63[_0x2999('0x2a')],'internal':_0x5d0a63[_0x2999('0x63')]});});return db['MemberReport']['bulkCreate'](_0xc8bb08,{'individualHooks':!![]});})[_0x2999('0x1f')](function(){return _0x5d0a63[_0x2999('0x29')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x1a0066['body'][_0x2999('0x105')]||_0x2999('0x106'),'lastPauseAt':moment()[_0x2999('0xc2')](_0x2999('0xfa'))});})[_0x2999('0x1f')](respondWithResult(_0x30b441,null))[_0x2999('0x28')](handleError(_0x30b441,null));};exports[_0x2999('0x107')]=function(_0x50eda9,_0x12828d){if(_0x50eda9[_0x2999('0x5f')][_0x2999('0xa9')]&&!utils[_0x2999('0xcc')](_0x50eda9[_0x2999('0x5f')]['channel'])){throw new APIBadRequestError(util[_0x2999('0xc2')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x50eda9[_0x2999('0x5f')][_0x2999('0xa9')]));}return db[_0x2999('0x3e')]['find']({'where':{'id':_0x50eda9[_0x2999('0x5a')]['id']},'attributes':['id',_0x2999('0x3a'),'role','internal','interface',_0x2999('0x9a'),'voicePause','mailPause','chatPause','faxPause',_0x2999('0x108'),_0x2999('0x109'),_0x2999('0x10a'),_0x2999('0x10b'),_0x2999('0x10c')]})[_0x2999('0x1f')](function(_0x2ad996){if(!_0x2ad996){throw new APINotFoundError(util[_0x2999('0xc2')](_0x2999('0xc3'),_0x50eda9[_0x2999('0x5a')]['id']));}return _0x2ad996[_0x2999('0x107')](_0x50eda9[_0x2999('0x5f')]['channel']);})[_0x2999('0x1f')](respondWithResult(_0x12828d,null))[_0x2999('0x28')](APIHandleError(_0x12828d));};exports[_0x2999('0x10d')]=function(_0xbe5972,_0xa75784){var _0x402c8f={};var _0x1da72a={};var _0x8c22b3;var _0x1881cb;return db[_0x2999('0x3e')][_0x2999('0x95')]({'where':{'id':_0xbe5972[_0x2999('0x5a')]['id']}})[_0x2999('0x1f')](handleEntityNotFound(_0xa75784,null))['then'](function(_0x751300){if(_0x751300){_0x8c22b3=_0x751300;_0x1da72a['model']=_[_0x2999('0xcf')](db[_0x2999('0x10e')][_0x2999('0x3f')]);_0x1da72a[_0x2999('0x49')]=_['keys'](_0xbe5972['query']);_0x1da72a[_0x2999('0xd0')]=_['intersection'](_0x1da72a[_0x2999('0xcd')],_0x1da72a[_0x2999('0x49')]);_0x402c8f['attributes']=_[_0x2999('0xd1')](_0x1da72a[_0x2999('0xcd')],qs[_0x2999('0xd2')](_0xbe5972[_0x2999('0x49')][_0x2999('0xd2')]));_0x402c8f[_0x2999('0x4e')]=_0x402c8f['attributes'][_0x2999('0x6e')]?_0x402c8f[_0x2999('0x4e')]:_0x1da72a[_0x2999('0xcd')];_0x402c8f['order']=qs[_0x2999('0xd4')](_0xbe5972[_0x2999('0x49')][_0x2999('0xd4')]);_0x402c8f['where']=qs['filters'](_['pick'](_0xbe5972[_0x2999('0x49')],_0x1da72a[_0x2999('0xd0')]));if(_0xbe5972['query'][_0x2999('0x34')]){_0x402c8f[_0x2999('0x48')]=_[_0x2999('0x5b')](_0x402c8f[_0x2999('0x48')],{'$or':_[_0x2999('0x36')](_0x402c8f[_0x2999('0x4e')],function(_0x376f42){var _0xa015b9={};_0xa015b9[_0x376f42]={'$like':'%'+_0xbe5972[_0x2999('0x49')][_0x2999('0x34')]+'%'};return _0xa015b9;})});}_0x402c8f=_['merge']({},_0x402c8f,_0xbe5972[_0x2999('0x5c')]);return _0x8c22b3['getTeams'](_0x402c8f);}})[_0x2999('0x1f')](function(_0x1b6f28){if(_0x1b6f28){_0x1881cb=_0x1b6f28['length'];if(!_0xbe5972[_0x2999('0x49')][_0x2999('0xc4')](_0x2999('0xd6'))){_0x402c8f[_0x2999('0x1c')]=qs[_0x2999('0x1c')](_0xbe5972[_0x2999('0x49')][_0x2999('0x1c')]);_0x402c8f[_0x2999('0x1a')]=qs['offset'](_0xbe5972[_0x2999('0x49')]['offset']);}return _0x8c22b3[_0x2999('0x10d')](_0x402c8f);}})[_0x2999('0x1f')](function(_0x543e5b){if(_0x543e5b){return _0x543e5b?{'count':_0x1881cb,'rows':_0x543e5b}:null;}})[_0x2999('0x1f')](respondWithResult(_0xa75784,null))[_0x2999('0x28')](handleError(_0xa75784,null));};exports[_0x2999('0x10f')]=function(_0x331195,_0x3a4e34){var _0x547d6c=_0x331195[_0x2999('0x5a')]['id'];var _0x294515=_0x331195[_0x2999('0x5f')]?_0x331195[_0x2999('0x5f')][_0x2999('0x61')]:null;var _0x1119e3=[];return Promise[_0x2999('0x101')]()['then'](function(){if(!_0x294515)throw new APIBadRequestError(_0x2999('0x110'));})[_0x2999('0x1f')](function(){return db[_0x2999('0x3e')][_0x2999('0x95')]({'where':{'id':_0x547d6c}});})['then'](function(_0xa8a29a){if(!_0xa8a29a)throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x331195[_0x2999('0x5a')]['id']));return db[_0x2999('0x6a')][_0x2999('0x111')](function(_0x3c5a18){return _0xa8a29a[_0x2999('0x10f')](_0x294515,{'transaction':_0x3c5a18})[_0x2999('0x1f')](function(){return db[_0x2999('0x10e')]['findAll']({'where':{'id':{'$in':_0x294515}}});})['then'](function(_0x1ff412){var _0x465ae3=_['map'](_0x1ff412,function(_0x3eac80){return _0x3eac80[_0x2999('0x112')]();});return Promise['all'](_0x465ae3);})[_0x2999('0x1f')](function(_0x36aaaf){_0x1119e3=_[_0x2999('0x113')](_0x36aaaf);var _0x212856=_[_0x2999('0x36')](_0x1119e3,function(_0x882ff9){return _0x882ff9[_0x2999('0x114')](_0xa8a29a['id'],{'transaction':_0x3c5a18});});return Promise[_0x2999('0x58')](_0x212856);})[_0x2999('0x1f')](function(){if(!_0xa8a29a[_0x2999('0x9a')])return;var _0x341794=_[_0x2999('0x34')](_0x1119e3,function(_0x287ecd){return _0x287ecd[_0x2999('0x115')]('channel')===_0x2999('0x116');});var _0x131e50=_['map'](_0x341794,function(_0x55b6b1){return db[_0x2999('0xa8')][_0x2999('0xf6')]({'membername':_0xa8a29a[_0x2999('0x3a')],'UserId':_0xa8a29a['id'],'queue_name':_0x55b6b1['name'],'VoiceQueueId':_0x55b6b1['id'],'interface':_[_0x2999('0x69')](_0xa8a29a[_0x2999('0xa6')])?util[_0x2999('0xc2')](_0x2999('0xa5'),_0xa8a29a[_0x2999('0x3a')]):_0xa8a29a[_0x2999('0xa6')],'paused':_0xa8a29a[_0x2999('0x9b')]||![],'penalty':_0xa8a29a[_0x2999('0xa7')]},{'transaction':_0x3c5a18});});return Promise[_0x2999('0x58')](_0x131e50);})[_0x2999('0x1f')](function(){return db[_0x2999('0x117')][_0x2999('0x50')]({'where':{'teamId':{'$in':_0x294515}}});})[_0x2999('0x1f')](function(_0x5d7d28){var _0x3b76e5=_['map'](_0x5d7d28,function(_0x1dbefa){return db[_0x2999('0x118')][_0x2999('0x7d')]({'UserId':_0xa8a29a['id'],'VoicePrefixId':_0x1dbefa[_0x2999('0x119')]},{'transaction':_0x3c5a18});});return Promise[_0x2999('0x58')](_0x3b76e5);});});})[_0x2999('0x1f')](function(){for(var _0x4f570c=0x0;_0x4f570c<_0x1119e3[_0x2999('0x6e')];_0x4f570c++){var _0x24eec3=_0x1119e3[_0x4f570c][_0x2999('0x115')](_0x2999('0xa9'));var _0x2621da=_0x24eec3+_0x2999('0xa2');socket['emit'](_0x2999('0x7e')+_0x24eec3+_0x2999('0xa3'),{'UserId':_0x547d6c,['queueField']:_0x1119e3[_0x4f570c]['id']});}})[_0x2999('0x1f')](respondWithStatusCode(_0x3a4e34,null))['catch'](APIHandleError(_0x3a4e34));};exports[_0x2999('0x11a')]=function(_0x417b34,_0x447509){var _0x300d53=_0x417b34[_0x2999('0x5a')]['id'];var _0x247cbf=null;if(_0x417b34[_0x2999('0x49')][_0x2999('0x61')]){_0x247cbf=_[_0x2999('0x11b')](_0x417b34[_0x2999('0x49')][_0x2999('0x61')])?_0x417b34['query']['ids']:[_0x417b34['query'][_0x2999('0x61')]];}var _0x59539d=[];return Promise[_0x2999('0x101')]()[_0x2999('0x1f')](function(){if(!_0x247cbf)throw new APIBadRequestError(_0x2999('0x11c'));})[_0x2999('0x1f')](function(){return db[_0x2999('0x3e')][_0x2999('0x95')]({'where':{'id':_0x300d53}});})['then'](function(_0x437217){if(!_0x437217)throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x417b34[_0x2999('0x5a')]['id']));return db[_0x2999('0x6a')]['transaction'](function(_0x3c4022){return _0x437217[_0x2999('0x11a')](_0x247cbf,{'transaction':_0x3c4022})[_0x2999('0x1f')](function(){return db[_0x2999('0x10e')][_0x2999('0x50')]({'where':{'id':{'$in':_0x247cbf}}});})[_0x2999('0x1f')](function(_0x541527){var _0x113695=_[_0x2999('0x36')](_0x541527,function(_0x53294e){return _0x53294e[_0x2999('0x112')]();});return Promise[_0x2999('0x58')](_0x113695);})[_0x2999('0x1f')](function(_0x12c9ac){_0x59539d=_[_0x2999('0x113')](_0x12c9ac);var _0x358e63=_[_0x2999('0x36')](_0x59539d,function(_0xa5a2d2){return _0xa5a2d2[_0x2999('0x11d')](_0x437217['id'],{'transaction':_0x3c4022});});return Promise[_0x2999('0x58')](_0x358e63);})[_0x2999('0x1f')](function(){if(!_0x437217['online'])return;var _0x348e9b=_[_0x2999('0x34')](_0x59539d,function(_0x61207c){return _0x61207c[_0x2999('0x115')](_0x2999('0xa9'))===_0x2999('0x116');});var _0x2782ec=_['map'](_0x348e9b,function(_0x264843){return db[_0x2999('0xa8')][_0x2999('0x2d')]({'where':{'VoiceQueueId':_0x264843['id'],'UserId':_0x437217['id']},'transaction':_0x3c4022});});return Promise['all'](_0x2782ec);})[_0x2999('0x1f')](function(){return db[_0x2999('0x117')]['findAll']({'where':{'teamId':{'$in':_0x247cbf}}});})['then'](function(_0x2f10e8){var _0x3ef834=_[_0x2999('0x36')](_0x2f10e8,function(_0x27b25f){return db[_0x2999('0x118')]['destroy']({'where':{'UserId':_0x437217['id'],'VoicePrefixId':_0x27b25f[_0x2999('0x119')]}},{'transaction':_0x3c4022});});return Promise[_0x2999('0x58')](_0x3ef834);});});})[_0x2999('0x1f')](function(){for(var _0x1c1846=0x0;_0x1c1846<_0x59539d[_0x2999('0x6e')];_0x1c1846++){var _0x10b94f=_0x59539d[_0x1c1846][_0x2999('0x115')](_0x2999('0xa9'));var _0x229829=_0x10b94f+_0x2999('0xa2');socket[_0x2999('0x2c')](_0x2999('0x7e')+_0x10b94f+_0x2999('0xab'),{'UserId':_0x300d53,['queueField']:_0x59539d[_0x1c1846]['id']});}})[_0x2999('0x1f')](respondWithStatusCode(_0x447509,null))[_0x2999('0x28')](APIHandleError(_0x447509));};exports['getLists']=function(_0x2c40c5,_0x4b15b8){var _0x400943={};var _0x202185={};var _0x118f80;var _0x369033;return db[_0x2999('0x3e')][_0x2999('0x95')]({'where':{'id':_0x2c40c5[_0x2999('0x5a')]['id']}})['then'](handleEntityNotFound(_0x4b15b8,null))['then'](function(_0x330167){if(_0x330167){_0x118f80=_0x330167;_0x202185[_0x2999('0xcd')]=_[_0x2999('0xcf')](db[_0x2999('0xc5')][_0x2999('0x3f')]);_0x202185[_0x2999('0x49')]=_['keys'](_0x2c40c5['query']);_0x202185['filters']=_[_0x2999('0xd1')](_0x202185[_0x2999('0xcd')],_0x202185[_0x2999('0x49')]);_0x400943[_0x2999('0x4e')]=_[_0x2999('0xd1')](_0x202185[_0x2999('0xcd')],qs['fields'](_0x2c40c5[_0x2999('0x49')][_0x2999('0xd2')]));_0x400943[_0x2999('0x4e')]=_0x400943[_0x2999('0x4e')][_0x2999('0x6e')]?_0x400943['attributes']:_0x202185[_0x2999('0xcd')];_0x400943[_0x2999('0xd3')]=qs[_0x2999('0xd4')](_0x2c40c5[_0x2999('0x49')][_0x2999('0xd4')]);_0x400943[_0x2999('0x48')]=qs[_0x2999('0xd0')](_[_0x2999('0xd7')](_0x2c40c5['query'],_0x202185['filters']));if(_0x2c40c5[_0x2999('0x49')][_0x2999('0x34')]){_0x400943[_0x2999('0x48')]=_[_0x2999('0x5b')](_0x400943['where'],{'$or':_[_0x2999('0x36')](_0x400943[_0x2999('0x4e')],function(_0x5bd79d){var _0x504429={};_0x504429[_0x5bd79d]={'$like':'%'+_0x2c40c5[_0x2999('0x49')][_0x2999('0x34')]+'%'};return _0x504429;})});}_0x400943=_['merge']({},_0x400943,_0x2c40c5[_0x2999('0x5c')]);return _0x118f80[_0x2999('0x11e')](_0x400943);}})[_0x2999('0x1f')](function(_0x39518e){if(_0x39518e){_0x369033=_0x39518e['length'];if(!_0x2c40c5[_0x2999('0x49')][_0x2999('0xc4')]('nolimit')){_0x400943['limit']=qs[_0x2999('0x1c')](_0x2c40c5[_0x2999('0x49')][_0x2999('0x1c')]);_0x400943[_0x2999('0x1a')]=qs[_0x2999('0x1a')](_0x2c40c5['query'][_0x2999('0x1a')]);}return _0x118f80[_0x2999('0x11e')](_0x400943);}})['then'](function(_0x8bcabc){if(_0x8bcabc){return _0x8bcabc?{'count':_0x369033,'rows':_0x8bcabc}:null;}})[_0x2999('0x1f')](respondWithResult(_0x4b15b8,null))[_0x2999('0x28')](handleError(_0x4b15b8,null));};exports['getAgents']=function(_0x55f336,_0x15542c){var _0x3ecfa6={};var _0x1dbb58={};var _0x371342;return db[_0x2999('0x3e')][_0x2999('0x95')]({'where':{'id':_0x55f336[_0x2999('0x5a')]['id']}})['then'](handleEntityNotFound(_0x15542c,null))[_0x2999('0x1f')](function(_0x5e8435){if(_0x5e8435){_0x371342=_0x5e8435;_0x1dbb58[_0x2999('0xcd')]=_[_0x2999('0xcf')](db[_0x2999('0x3e')][_0x2999('0x3f')]);_0x1dbb58[_0x2999('0x49')]=_[_0x2999('0xcf')](_0x55f336['query']);_0x1dbb58[_0x2999('0xd0')]=_['intersection'](_0x1dbb58[_0x2999('0xcd')],_0x1dbb58[_0x2999('0x49')]);_0x3ecfa6['attributes']=_['intersection'](_0x1dbb58[_0x2999('0xcd')],qs['fields'](_0x55f336[_0x2999('0x49')][_0x2999('0xd2')]));_0x3ecfa6[_0x2999('0x4e')]=_0x3ecfa6['attributes'][_0x2999('0x6e')]?_0x3ecfa6[_0x2999('0x4e')]:_0x1dbb58[_0x2999('0xcd')];_0x3ecfa6[_0x2999('0xd3')]=qs[_0x2999('0xd4')](_0x55f336[_0x2999('0x49')][_0x2999('0xd4')]);_0x3ecfa6['where']=qs['filters'](_['pick'](_0x55f336['query'],_0x1dbb58[_0x2999('0xd0')]));if(_0x55f336[_0x2999('0x49')][_0x2999('0x34')]){_0x3ecfa6['where']=_[_0x2999('0x5b')](_0x3ecfa6[_0x2999('0x48')],{'$or':_[_0x2999('0x36')](_0x3ecfa6[_0x2999('0x4e')],function(_0xf9abdd){var _0x3e57ed={};_0x3e57ed[_0xf9abdd]={'$like':'%'+_0x55f336['query']['filter']+'%'};return _0x3e57ed;})});}_0x3ecfa6[_0x2999('0xcd')]=db[_0x2999('0x3e')];_0x3ecfa6['as']=_0x2999('0x31');_0x3ecfa6=_[_0x2999('0x5b')]({},_0x3ecfa6,_0x55f336[_0x2999('0x5c')]);return _0x371342[_0x2999('0xf4')]({'include':[_0x3ecfa6]});}})['then'](function(_0x12454a){if(_0x12454a){var _0x32a436={},_0x5a1c23=[];for(var _0x31388b=0x0;_0x31388b<_0x12454a[_0x2999('0x6e')];_0x31388b+=0x1){for(var _0x4b8a97=0x0,_0x13b4c6;_0x4b8a97<_0x12454a[_0x31388b]['Agents']['length'];_0x4b8a97+=0x1){_0x13b4c6=_0x12454a[_0x31388b]['Agents'][_0x4b8a97][_0x2999('0x2e')]({'plain':!![]});_0x32a436[_0x13b4c6['id']]=_0x13b4c6;}}_0x32a436=_[_0x2999('0x11f')](_0x32a436);for(var _0x50bbc7=qs['offset'](_0x55f336[_0x2999('0x49')][_0x2999('0x1a')]);_0x50bbc7<_0x32a436['length']&&_0x5a1c23[_0x2999('0x6e')]=_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 +var _0xc6e9=['mailPause','smsPause','whatsappPause','pauseType','lastPauseAt','system','LogoutUser','destroy','forEach','all','LoginUser','mobile','phone','loginInPause','SIP/%s','count','agent','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','UserVoiceQueue.penalty','merge','callysquare','LOGININPAUSE','bulkCreate','concat','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','defaults','redis','localhost','socket.io-emitter','./user.socket','register','GetUser','User','options','raw','attributes','map','model','include','then','debug','stringify','catch','error','message','ShowUser','find','where','info','PauseUser','name','role','internal','format','User\x20with\x20id\x20%s\x20not\x20found','params','UserVoiceQueueRt','update','MemberReport','findAll','PAUSE','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','push','isNil','interface','type','body','uniqueid','DEFAULT\x20PAUSE','resolve','isValidChannel','channel','findOne','voicePause'];(function(_0x34c2d4,_0x418ed2){var _0x38796a=function(_0xf017c5){while(--_0xf017c5){_0x34c2d4['push'](_0x34c2d4['shift']());}};_0x38796a(++_0x418ed2);}(_0xc6e9,0x76));var _0x9c6e=function(_0x22aac4,_0x13ab22){_0x22aac4=_0x22aac4-0x0;var _0x31ebf9=_0xc6e9[_0x22aac4];return _0x31ebf9;};'use strict';var _=require(_0x9c6e('0x0'));var util=require(_0x9c6e('0x1'));var moment=require(_0x9c6e('0x2'));var BPromise=require(_0x9c6e('0x3'));var Redis=require(_0x9c6e('0x4'));var db=require(_0x9c6e('0x5'))['db'];var utils=require(_0x9c6e('0x6'));var logger=require(_0x9c6e('0x7'))(_0x9c6e('0x8'));var config=require(_0x9c6e('0x9'));config['redis']=_[_0x9c6e('0xa')](config[_0x9c6e('0xb')],{'host':_0x9c6e('0xc'),'port':0x18eb});var socket=require(_0x9c6e('0xd'))(new Redis(config['redis']));require(_0x9c6e('0xe'))[_0x9c6e('0xf')](socket);exports[_0x9c6e('0x10')]=function(_0x47214b){var _0x4ad6fb=this;return new Promise(function(_0x172081,_0x3c6b49){return db[_0x9c6e('0x11')]['findAll']({'raw':_0x47214b[_0x9c6e('0x12')]?_0x47214b[_0x9c6e('0x12')][_0x9c6e('0x13')]===undefined?!![]:![]:!![],'where':_0x47214b[_0x9c6e('0x12')]?_0x47214b['options']['where']||null:null,'attributes':_0x47214b[_0x9c6e('0x12')]?_0x47214b[_0x9c6e('0x12')][_0x9c6e('0x14')]||null:null,'limit':_0x47214b['options']?_0x47214b['options']['limit']||null:null,'include':_0x47214b[_0x9c6e('0x12')]?_0x47214b[_0x9c6e('0x12')]['include']?_[_0x9c6e('0x15')](_0x47214b[_0x9c6e('0x12')]['include'],function(_0x4a07de){return{'model':db[_0x4a07de[_0x9c6e('0x16')]],'as':_0x4a07de['as'],'attributes':_0x4a07de['attributes'],'include':_0x4a07de[_0x9c6e('0x17')]?_[_0x9c6e('0x15')](_0x4a07de['include'],function(_0x542167){return{'model':db[_0x542167['model']],'as':_0x542167['as'],'attributes':_0x542167[_0x9c6e('0x14')],'include':_0x542167[_0x9c6e('0x17')]?_[_0x9c6e('0x15')](_0x542167[_0x9c6e('0x17')],function(_0x587d93){return{'model':db[_0x587d93['model']],'as':_0x587d93['as'],'attributes':_0x587d93[_0x9c6e('0x14')]};}):[]};}):[]};}):[]:[]})[_0x9c6e('0x18')](function(_0x33de23){logger['info'](_0x9c6e('0x10'),_0x47214b);logger[_0x9c6e('0x19')]('GetUser',_0x47214b,JSON[_0x9c6e('0x1a')](_0x33de23));_0x172081(_0x33de23);})[_0x9c6e('0x1b')](function(_0x2fde3a){logger[_0x9c6e('0x1c')](_0x9c6e('0x10'),_0x2fde3a[_0x9c6e('0x1d')],_0x47214b);_0x3c6b49(_0x4ad6fb[_0x9c6e('0x1c')](0x1f4,_0x2fde3a['message']));});});};exports[_0x9c6e('0x1e')]=function(_0x1e26f2){var _0x196413=this;return new Promise(function(_0x2b026c,_0x4b072c){return db['User'][_0x9c6e('0x1f')]({'raw':_0x1e26f2[_0x9c6e('0x12')]?_0x1e26f2[_0x9c6e('0x12')][_0x9c6e('0x13')]===undefined?!![]:![]:!![],'where':_0x1e26f2['options']?_0x1e26f2[_0x9c6e('0x12')][_0x9c6e('0x20')]||null:null,'attributes':_0x1e26f2['options']?_0x1e26f2[_0x9c6e('0x12')][_0x9c6e('0x14')]||null:null,'include':_0x1e26f2[_0x9c6e('0x12')]?_0x1e26f2[_0x9c6e('0x12')][_0x9c6e('0x17')]?_[_0x9c6e('0x15')](_0x1e26f2[_0x9c6e('0x12')][_0x9c6e('0x17')],function(_0x943eaa){return{'model':db[_0x943eaa[_0x9c6e('0x16')]],'as':_0x943eaa['as'],'attributes':_0x943eaa[_0x9c6e('0x14')],'include':_0x943eaa[_0x9c6e('0x17')]?_[_0x9c6e('0x15')](_0x943eaa[_0x9c6e('0x17')],function(_0x271959){return{'model':db[_0x271959[_0x9c6e('0x16')]],'as':_0x271959['as'],'attributes':_0x271959['attributes'],'include':_0x271959[_0x9c6e('0x17')]?_['map'](_0x271959[_0x9c6e('0x17')],function(_0x510dc0){return{'model':db[_0x510dc0[_0x9c6e('0x16')]],'as':_0x510dc0['as'],'attributes':_0x510dc0['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x18947a){logger[_0x9c6e('0x21')](_0x9c6e('0x1e'),_0x1e26f2);logger[_0x9c6e('0x19')](_0x9c6e('0x1e'),_0x1e26f2,JSON[_0x9c6e('0x1a')](_0x18947a));_0x2b026c(_0x18947a);})['catch'](function(_0x32c752){logger['error'](_0x9c6e('0x1e'),_0x32c752[_0x9c6e('0x1d')],_0x1e26f2);_0x4b072c(_0x196413['error'](0x1f4,_0x32c752[_0x9c6e('0x1d')]));});});};exports[_0x9c6e('0x22')]=function(_0x37d1a4){var _0x10bc3f;return db[_0x9c6e('0x11')][_0x9c6e('0x1f')]({'where':_0x37d1a4[_0x9c6e('0x12')][_0x9c6e('0x20')]||{},'attributes':['id',_0x9c6e('0x23'),_0x9c6e('0x24'),_0x9c6e('0x25'),'interface']})['then'](function(_0x26c133){if(!_0x26c133){throw new Error(util[_0x9c6e('0x26')](_0x9c6e('0x27'),_0x37d1a4[_0x9c6e('0x28')]['id']));}_0x10bc3f=_0x26c133;return db[_0x9c6e('0x29')][_0x9c6e('0x2a')]({'paused':0x1},{'where':{'UserId':_0x10bc3f['id']},'individualHooks':!![]});})['then'](function(){return db[_0x9c6e('0x2b')][_0x9c6e('0x2c')]({'where':{'membername':_0x10bc3f[_0x9c6e('0x23')],'type':_0x9c6e('0x2d'),'exitAt':null}});})[_0x9c6e('0x18')](function(_0x4475d4){if(_0x4475d4&&_0x4475d4[_0x9c6e('0x2e')]){var _0x11f7e9=moment()['format'](_0x9c6e('0x2f'));for(var _0x3495e4=0x0,_0x59d92b=_0x4475d4[_0x9c6e('0x2e')];_0x3495e4<_0x59d92b;_0x3495e4++){_0x4475d4[_0x3495e4][_0x9c6e('0x30')]({'exitAt':_0x11f7e9});}}})[_0x9c6e('0x18')](function(){var _0x6dfbc3=[];var _0x19a583=utils[_0x9c6e('0x31')]();_0x19a583['forEach'](function(_0x3f60b1){_0x6dfbc3[_0x9c6e('0x32')]({'channel':_0x3f60b1,'membername':_0x10bc3f[_0x9c6e('0x23')],'interface':_[_0x9c6e('0x33')](_0x10bc3f[_0x9c6e('0x34')])?util[_0x9c6e('0x26')]('SIP/%s',_0x10bc3f[_0x9c6e('0x23')]):_0x10bc3f[_0x9c6e('0x34')],'type':_0x9c6e('0x2d'),'enterAt':moment()[_0x9c6e('0x26')](_0x9c6e('0x2f')),'data1':_0x37d1a4['body'][_0x9c6e('0x35')]||'DEFAULT\x20PAUSE','role':_0x10bc3f['role'],'internal':_0x10bc3f[_0x9c6e('0x25')],'uniqueid':_0x37d1a4[_0x9c6e('0x36')][_0x9c6e('0x37')]||null});});return db[_0x9c6e('0x2b')]['bulkCreate'](_0x6dfbc3,{'individualHooks':!![]});})[_0x9c6e('0x18')](function(){return _0x10bc3f[_0x9c6e('0x2a')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x37d1a4[_0x9c6e('0x36')][_0x9c6e('0x35')]||_0x9c6e('0x38'),'lastPauseAt':moment()[_0x9c6e('0x26')](_0x9c6e('0x2f'))});})['catch'](function(_0x12c463){throw _0x12c463;});};exports['UnpauseUser']=function(_0x22f304){return Promise[_0x9c6e('0x39')]()[_0x9c6e('0x18')](function(){if(_0x22f304[_0x9c6e('0x36')]['channel']&&!utils[_0x9c6e('0x3a')](_0x22f304[_0x9c6e('0x36')][_0x9c6e('0x3b')])){throw new Error(util[_0x9c6e('0x26')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x22f304['body'][_0x9c6e('0x3b')]));}return db[_0x9c6e('0x11')][_0x9c6e('0x3c')]({'where':_0x22f304['options'][_0x9c6e('0x20')]||{},'attributes':['id',_0x9c6e('0x23'),'role',_0x9c6e('0x25'),_0x9c6e('0x34'),'online',_0x9c6e('0x3d'),_0x9c6e('0x3e'),'chatPause','faxPause','openchannelPause',_0x9c6e('0x3f'),_0x9c6e('0x40'),_0x9c6e('0x41'),_0x9c6e('0x42')]});})[_0x9c6e('0x18')](function(_0x3edb1c){if(!_0x3edb1c){throw new Error(util[_0x9c6e('0x26')]('User\x20with\x20id\x20%s\x20not\x20found',_0x22f304[_0x9c6e('0x28')]['id']));}return _0x3edb1c['unpause'](_0x22f304['body'][_0x9c6e('0x3b')],_0x9c6e('0x43'));})[_0x9c6e('0x1b')](function(_0x2a186e){throw _0x2a186e;});};exports[_0x9c6e('0x44')]=function(_0x280d28){var _0x1a161f=this;return new Promise(function(_0x604d66,_0x337fb8){var _0x564fd8;return db[_0x9c6e('0x11')][_0x9c6e('0x3c')]({'where':_0x280d28['options'][_0x9c6e('0x20')]||{},'attributes':['id',_0x9c6e('0x23')]})[_0x9c6e('0x18')](function(_0x95db71){if(_0x95db71){_0x564fd8=_0x95db71;return db[_0x9c6e('0x29')][_0x9c6e('0x45')]({'where':{'membername':_0x564fd8[_0x9c6e('0x23')]},'individualHooks':!![]});}})[_0x9c6e('0x18')](function(){if(_0x564fd8){return db['MemberReport'][_0x9c6e('0x2c')]({'where':{'membername':_0x564fd8[_0x9c6e('0x23')],'exitAt':null}});}})[_0x9c6e('0x18')](function(_0x26315b){if(_0x564fd8){if(_0x26315b&&_0x26315b[_0x9c6e('0x2e')]){var _0x5a8e73=[];_0x26315b[_0x9c6e('0x46')](function(_0x34c69d){_0x5a8e73[_0x9c6e('0x32')](_0x34c69d[_0x9c6e('0x2a')]({'exitAt':moment()[_0x9c6e('0x26')](_0x9c6e('0x2f'))}));});return BPromise[_0x9c6e('0x47')](_0x5a8e73);}}})[_0x9c6e('0x18')](function(){if(_0x564fd8){return _0x564fd8[_0x9c6e('0x2a')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x9c6e('0x18')](function(_0x2749a6){_0x604d66(_0x2749a6);})[_0x9c6e('0x1b')](function(_0x338cf2){_0x337fb8(_0x1a161f[_0x9c6e('0x1c')](0x1f4,_0x338cf2['message']));});});};exports[_0x9c6e('0x48')]=function(_0x1d5df0){var _0x3b7af2=this;return new Promise(function(_0x514ee5,_0x134304){var _0x1d5967;var _0x534710;var _0x49e2a3;var _0x4dd3ee;return db[_0x9c6e('0x11')][_0x9c6e('0x3c')]({'where':_0x1d5df0[_0x9c6e('0x12')][_0x9c6e('0x20')]||{},'attributes':['id',_0x9c6e('0x23'),'role',_0x9c6e('0x49'),_0x9c6e('0x4a'),_0x9c6e('0x25'),_0x9c6e('0x4b'),'interface']})[_0x9c6e('0x18')](function(_0x2331e0){if(_0x2331e0){_0x1d5967=_0x2331e0;_0x4dd3ee=_0x1d5df0[_0x9c6e('0x36')]['interface']?_0x1d5df0[_0x9c6e('0x36')][_0x9c6e('0x34')]:util[_0x9c6e('0x26')](_0x9c6e('0x4c'),_0x1d5967['name']);return db[_0x9c6e('0x11')][_0x9c6e('0x4d')]({'where':{'role':_0x9c6e('0x4e'),'online':!![],'id':{'$ne':_0x1d5967['id']}}});}})[_0x9c6e('0x18')](function(_0x35139c){if(_0x35139c){_0x49e2a3=_0x35139c;return require('../../config/license/util')[_0x9c6e('0x4f')]();}})['then'](function(_0x25f046){if(_0x25f046&&_0x25f046[_0x9c6e('0x50')]&&_0x49e2a3>=_0x25f046[_0x9c6e('0x50')]){throw new Error(_0x9c6e('0x51'));}})[_0x9c6e('0x18')](function(){if(_0x1d5967){return db[_0x9c6e('0x29')][_0x9c6e('0x45')]({'where':{'membername':_0x1d5967['name']},'individualHooks':!![]});}})[_0x9c6e('0x18')](function(){if(_0x1d5967){return _0x1d5967[_0x9c6e('0x52')]({'raw':!![]});}})[_0x9c6e('0x18')](function(_0x4c5574){if(_0x1d5967){if(_0x4c5574){var _0x3144ba=[];_0x534710=_0x4c5574;if(_0x534710[_0x9c6e('0x2e')]){for(var _0x4fca20=0x0;_0x4fca20<_0x534710[_0x9c6e('0x2e')];_0x4fca20++){_0x3144ba[_0x9c6e('0x32')](db[_0x9c6e('0x29')][_0x9c6e('0x53')]({'membername':_0x1d5967[_0x9c6e('0x23')],'UserId':_0x1d5967['id'],'queue_name':_0x534710[_0x4fca20][_0x9c6e('0x23')],'VoiceQueueId':_0x534710[_0x4fca20]['id'],'interface':_0x4dd3ee,'paused':_0x1d5967[_0x9c6e('0x4b')]||![],'penalty':_0x534710[_0x4fca20][_0x9c6e('0x54')]||0x0}));}return BPromise[_0x9c6e('0x47')](_0x3144ba);}}}})[_0x9c6e('0x18')](function(){if(_0x1d5967){return db[_0x9c6e('0x2b')][_0x9c6e('0x2c')]({'where':{'membername':_0x1d5967[_0x9c6e('0x23')],'exitAt':null}});}})['then'](function(_0x4b616c){if(_0x1d5967){if(_0x4b616c&&_0x4b616c[_0x9c6e('0x2e')]){var _0x4970dc=[];_0x4b616c['forEach'](function(_0x152476){_0x4970dc[_0x9c6e('0x32')](_0x152476['update']({'exitAt':moment()[_0x9c6e('0x26')](_0x9c6e('0x2f'))}));});return BPromise['all'](_0x4970dc);}}})[_0x9c6e('0x18')](function(){if(_0x1d5967){var _0x25fd3e=[];var _0x179c70=[];var _0x45ab4d=utils[_0x9c6e('0x31')]();var _0x37917c={'membername':_0x1d5967[_0x9c6e('0x23')],'interface':_0x4dd3ee,'enterAt':moment()[_0x9c6e('0x26')](_0x9c6e('0x2f')),'role':_0x1d5967['role'],'internal':_0x1d5967[_0x9c6e('0x25')]};_0x45ab4d[_0x9c6e('0x46')](function(_0x2a2836){_0x25fd3e[_0x9c6e('0x32')](_[_0x9c6e('0x55')]({'channel':_0x2a2836,'type':'LOGIN','data1':_0x9c6e('0x56'),'data2':_0x4dd3ee},_0x37917c));if(_0x1d5967['loginInPause']){_0x179c70[_0x9c6e('0x32')](_['merge']({'channel':_0x2a2836,'type':'PAUSE','data1':_0x9c6e('0x57')},_0x37917c));}});return db['MemberReport'][_0x9c6e('0x58')](_0x25fd3e[_0x9c6e('0x59')](_0x179c70),{'individualHooks':!![]});}})[_0x9c6e('0x18')](function(){if(_0x1d5967){return _0x1d5967[_0x9c6e('0x2a')]({'online':!![],'lastLoginAt':moment()['format'](_0x9c6e('0x2f')),'voicePause':_0x1d5967['loginInPause']||![],'mailPause':_0x1d5967[_0x9c6e('0x4b')]||![],'chatPause':_0x1d5967[_0x9c6e('0x4b')]||![],'faxPause':_0x1d5967[_0x9c6e('0x4b')]||![],'smsPause':_0x1d5967[_0x9c6e('0x4b')]||![],'openchannelPause':_0x1d5967['loginInPause']||![],'pauseType':_0x1d5967[_0x9c6e('0x4b')]?_0x9c6e('0x57'):null,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x4dd3ee});}})['then'](function(_0x3db007){_0x514ee5(_0x3db007);})[_0x9c6e('0x1b')](function(_0x2a26f6){_0x134304(_0x3b7af2['error'](0x1f4,_0x2a26f6['message']));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index d7da419..62eed97 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 _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 +var _0xa281=['remove','removeListener','register','user:','./user.events','save'];(function(_0x3b99c6,_0x357d2d){var _0x3f8d18=function(_0x12ae97){while(--_0x12ae97){_0x3b99c6['push'](_0x3b99c6['shift']());}};_0x3f8d18(++_0x357d2d);}(_0xa281,0x19c));var _0x1a28=function(_0x5c37e7,_0x2af03b){_0x5c37e7=_0x5c37e7-0x0;var _0x3ec04f=_0xa281[_0x5c37e7];return _0x3ec04f;};'use strict';var UserEvents=require(_0x1a28('0x0'));var events=[_0x1a28('0x1'),_0x1a28('0x2'),'update'];function createListener(_0x13890b,_0x48da7c){return function(_0x3c7162){_0x48da7c['emit'](_0x13890b,_0x3c7162);};}function removeListener(_0x5cdb7e,_0x2e0ab4){return function(){UserEvents[_0x1a28('0x3')](_0x5cdb7e,_0x2e0ab4);};}exports[_0x1a28('0x4')]=function(_0x55c521){for(var _0x1ca582=0x0,_0x4e119c=events['length'];_0x1ca582<_0x4e119c;_0x1ca582++){var _0x4eb875=events[_0x1ca582];var _0x2028a5=createListener(_0x1a28('0x5')+_0x4eb875,_0x55c521);UserEvents['on'](_0x4eb875,_0x2028a5);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 794318d..082053b 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 _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 +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x2bfe36,_0x5a2522){var _0x31d3e8=function(_0x3e68a1){while(--_0x3e68a1){_0x2bfe36['push'](_0x2bfe36['shift']());}};_0x31d3e8(++_0x5a2522);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index e1ba0b4..775cfba 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 _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 +var _0x9825=['exports','INTEGER','sequelize'];(function(_0x342d75,_0x5ea999){var _0x5e8fa0=function(_0x17443d){while(--_0x17443d){_0x342d75['push'](_0x342d75['shift']());}};_0x5e8fa0(++_0x5ea999);}(_0x9825,0x14f));var _0x5982=function(_0x193150,_0x242a4f){_0x193150=_0x193150-0x0;var _0xabd6bd=_0x9825[_0x193150];return _0xabd6bd;};'use strict';var Sequelize=require(_0x5982('0x0'));module[_0x5982('0x1')]={'penalty':{'type':Sequelize[_0x5982('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 b2ddaac..58e92da 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 _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 +var _0xa418=['exports','define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./userChatQueue.attributes'];(function(_0x53eafd,_0x1863ee){var _0x4a33a3=function(_0x3785c1){while(--_0x3785c1){_0x53eafd['push'](_0x53eafd['shift']());}};_0x4a33a3(++_0x1863ee);}(_0xa418,0x170));var _0x8a41=function(_0x36ffa6,_0x4da9a5){_0x36ffa6=_0x36ffa6-0x0;var _0xb75312=_0xa418[_0x36ffa6];return _0xb75312;};'use strict';var _=require(_0x8a41('0x0'));var util=require(_0x8a41('0x1'));var logger=require(_0x8a41('0x2'))(_0x8a41('0x3'));var moment=require(_0x8a41('0x4'));var BPromise=require(_0x8a41('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8a41('0x6'));var rimraf=require(_0x8a41('0x7'));var config=require(_0x8a41('0x8'));var attributes=require(_0x8a41('0x9'));module[_0x8a41('0xa')]=function(_0xba087b,_0x337040){return _0xba087b[_0x8a41('0xb')](_0x8a41('0xc'),attributes,{'tableName':_0x8a41('0xd'),'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 3e0bdea..bfd7801 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 _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 +var _0x8453=['jayson/promise','client','http','info','UserChatQueue,\x20%s,\x20%s','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','lodash','util','moment','randomstring','../../config/utils','../../config/logger','../../config/environment'];(function(_0x58c20f,_0x4cdb1b){var _0x3b0318=function(_0x36fa84){while(--_0x36fa84){_0x58c20f['push'](_0x58c20f['shift']());}};_0x3b0318(++_0x4cdb1b);}(_0x8453,0x188));var _0x3845=function(_0xec2706,_0x2f3055){_0xec2706=_0xec2706-0x0;var _0x473e17=_0x8453[_0xec2706];return _0x473e17;};'use strict';var _=require(_0x3845('0x0'));var util=require(_0x3845('0x1'));var moment=require(_0x3845('0x2'));var BPromise=require('bluebird');var rs=require(_0x3845('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3845('0x4'));var logger=require(_0x3845('0x5'))('rpc');var config=require(_0x3845('0x6'));var jayson=require(_0x3845('0x7'));var client=jayson[_0x3845('0x8')][_0x3845('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b5a6f,_0x219b41,_0x142b42){return new BPromise(function(_0x23b4e3,_0x345e95){return client['request'](_0x3b5a6f,_0x142b42)['then'](function(_0x12e32c){logger[_0x3845('0xa')](_0x3845('0xb'),_0x219b41,'request\x20sent');logger[_0x3845('0xc')](_0x3845('0xd'),_0x219b41,_0x3845('0xe'),JSON[_0x3845('0xf')](_0x12e32c));if(_0x12e32c['error']){if(_0x12e32c['error'][_0x3845('0x10')]===0x1f4){logger['error'](_0x3845('0xb'),_0x219b41,_0x12e32c[_0x3845('0x11')][_0x3845('0x12')]);return _0x345e95(_0x12e32c[_0x3845('0x11')][_0x3845('0x12')]);}logger['error'](_0x3845('0xb'),_0x219b41,_0x12e32c[_0x3845('0x11')][_0x3845('0x12')]);return _0x23b4e3(_0x12e32c[_0x3845('0x11')]['message']);}else{logger[_0x3845('0xa')]('UserChatQueue,\x20%s,\x20%s',_0x219b41,_0x3845('0xe'));_0x23b4e3(_0x12e32c[_0x3845('0x13')]['message']);}})[_0x3845('0x14')](function(_0x53b815){logger['error'](_0x3845('0xb'),_0x219b41,_0x53b815);_0x345e95(_0x53b815);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 18be556..259186c 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 _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 +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x4d46bd,_0x4b467f){var _0x3b7bd3=function(_0x33f6af){while(--_0x33f6af){_0x4d46bd['push'](_0x4d46bd['shift']());}};_0x3b7bd3(++_0x4b467f);}(_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/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 7f320a1..04c2e9f 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 _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 +var _0xde1e=['INTEGER','STRING','sequelize'];(function(_0x232f4d,_0x55faeb){var _0x503465=function(_0x42a90a){while(--_0x42a90a){_0x232f4d['push'](_0x232f4d['shift']());}};_0x503465(++_0x55faeb);}(_0xde1e,0x13a));var _0xede1=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xde1e[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0xede1('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xede1('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xede1('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 0912d09..791fd3b 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 _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 +var _0xa1b3=['bluebird','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','util','../../config/logger','api','moment'];(function(_0xf4129c,_0x44fcf1){var _0x426611=function(_0x3b5bcd){while(--_0x3b5bcd){_0xf4129c['push'](_0xf4129c['shift']());}};_0x426611(++_0x44fcf1);}(_0xa1b3,0x13e));var _0x3a1b=function(_0x10a108,_0x532a7d){_0x10a108=_0x10a108-0x0;var _0x49588e=_0xa1b3[_0x10a108];return _0x49588e;};'use strict';var _=require('lodash');var util=require(_0x3a1b('0x0'));var logger=require(_0x3a1b('0x1'))(_0x3a1b('0x2'));var moment=require(_0x3a1b('0x3'));var BPromise=require(_0x3a1b('0x4'));var rp=require(_0x3a1b('0x5'));var fs=require('fs');var path=require(_0x3a1b('0x6'));var rimraf=require(_0x3a1b('0x7'));var config=require(_0x3a1b('0x8'));var attributes=require(_0x3a1b('0x9'));module[_0x3a1b('0xa')]=function(_0x3069c4,_0xc7d8c0){return _0x3069c4[_0x3a1b('0xb')](_0x3a1b('0xc'),attributes,{'tableName':_0x3a1b('0xd'),'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 4b9103b..00109d4 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 _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 +var _0x4528=['code','message','info','result','catch','lodash','util','moment','bluebird','../../mysqldb','rpc','jayson/promise','client','http','request','then','UserFaxQueue,\x20%s,\x20%s','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s','error'];(function(_0x4dee18,_0x2e6a4c){var _0x4e63c7=function(_0x1b6886){while(--_0x1b6886){_0x4dee18['push'](_0x4dee18['shift']());}};_0x4e63c7(++_0x2e6a4c);}(_0x4528,0x145));var _0x8452=function(_0x2948dc,_0x5a5404){_0x2948dc=_0x2948dc-0x0;var _0x4cbe58=_0x4528[_0x2948dc];return _0x4cbe58;};'use strict';var _=require(_0x8452('0x0'));var util=require(_0x8452('0x1'));var moment=require(_0x8452('0x2'));var BPromise=require(_0x8452('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8452('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8452('0x5'));var config=require('../../config/environment');var jayson=require(_0x8452('0x6'));var client=jayson[_0x8452('0x7')][_0x8452('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1b6283,_0x48163c,_0x153d96){return new BPromise(function(_0x2516b4,_0x510bd6){return client[_0x8452('0x9')](_0x1b6283,_0x153d96)[_0x8452('0xa')](function(_0x786160){logger['info'](_0x8452('0xb'),_0x48163c,_0x8452('0xc'));logger['debug'](_0x8452('0xd'),_0x48163c,_0x8452('0xc'),JSON['stringify'](_0x786160));if(_0x786160[_0x8452('0xe')]){if(_0x786160[_0x8452('0xe')][_0x8452('0xf')]===0x1f4){logger[_0x8452('0xe')](_0x8452('0xb'),_0x48163c,_0x786160[_0x8452('0xe')][_0x8452('0x10')]);return _0x510bd6(_0x786160[_0x8452('0xe')]['message']);}logger[_0x8452('0xe')](_0x8452('0xb'),_0x48163c,_0x786160[_0x8452('0xe')][_0x8452('0x10')]);return _0x2516b4(_0x786160[_0x8452('0xe')][_0x8452('0x10')]);}else{logger[_0x8452('0x11')](_0x8452('0xb'),_0x48163c,_0x8452('0xc'));_0x2516b4(_0x786160[_0x8452('0x12')][_0x8452('0x10')]);}})[_0x8452('0x13')](function(_0x4cc151){logger[_0x8452('0xe')](_0x8452('0xb'),_0x48163c,_0x4cc151);_0x510bd6(_0x4cc151);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 1e35e34..e342e97 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 _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 +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x3c7e62,_0x24e823){var _0xa18094=function(_0x341703){while(--_0x341703){_0x3c7e62['push'](_0x3c7e62['shift']());}};_0xa18094(++_0x24e823);}(_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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 72d6f6d..43d8161 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 _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 +var _0xded0=['sequelize','INTEGER'];(function(_0x102aaf,_0x4c760c){var _0x4c7c62=function(_0x5d2ff5){while(--_0x5d2ff5){_0x102aaf['push'](_0x102aaf['shift']());}};_0x4c7c62(++_0x4c760c);}(_0xded0,0xc8));var _0x0ded=function(_0x45edfc,_0x27aecf){_0x45edfc=_0x45edfc-0x0;var _0x4697e8=_0xded0[_0x45edfc];return _0x4697e8;};'use strict';var Sequelize=require(_0x0ded('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x0ded('0x1')],'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 8c4e9bf..c6c6d2c 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 _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 +var _0x14f3=['define','user_has_mail_queues','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x11c6b8,_0x5b2d7b){var _0x38b38f=function(_0x641ad0){while(--_0x641ad0){_0x11c6b8['push'](_0x11c6b8['shift']());}};_0x38b38f(++_0x5b2d7b);}(_0x14f3,0x197));var _0x314f=function(_0x83b40e,_0x2b1770){_0x83b40e=_0x83b40e-0x0;var _0x2edc83=_0x14f3[_0x83b40e];return _0x2edc83;};'use strict';var _=require(_0x314f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x314f('0x1'));var moment=require('moment');var BPromise=require(_0x314f('0x2'));var rp=require(_0x314f('0x3'));var fs=require('fs');var path=require(_0x314f('0x4'));var rimraf=require(_0x314f('0x5'));var config=require(_0x314f('0x6'));var attributes=require('./userMailQueue.attributes');module['exports']=function(_0x3059de,_0x4f2084){return _0x3059de[_0x314f('0x7')]('UserMailQueue',attributes,{'tableName':_0x314f('0x8'),'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 14f25bc..7778c27 100644 --- a/server/api/userMailQueue/userMailQueue.rpc.js +++ b/server/api/userMailQueue/userMailQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6aa7=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_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 +var _0x7fbe=['request','then','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x202207,_0x5ee35d){var _0x280bf2=function(_0x4be284){while(--_0x4be284){_0x202207['push'](_0x202207['shift']());}};_0x280bf2(++_0x5ee35d);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x4394b6,_0x12357f){_0x4394b6=_0x4394b6-0x0;var _0x360244=_0x7fbe[_0x4394b6];return _0x360244;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7fb('0x0'));var BPromise=require(_0xe7fb('0x1'));var rs=require(_0xe7fb('0x2'));var fs=require('fs');var Redis=require(_0xe7fb('0x3'));var db=require(_0xe7fb('0x4'))['db'];var utils=require(_0xe7fb('0x5'));var logger=require(_0xe7fb('0x6'))(_0xe7fb('0x7'));var config=require(_0xe7fb('0x8'));var jayson=require(_0xe7fb('0x9'));var client=jayson[_0xe7fb('0xa')][_0xe7fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24cd67,_0x1f943f,_0x5ad75b){return new BPromise(function(_0x213ebc,_0x228f6b){return client[_0xe7fb('0xc')](_0x24cd67,_0x5ad75b)[_0xe7fb('0xd')](function(_0x4ba197){logger['info'](_0xe7fb('0xe'),_0x1f943f,_0xe7fb('0xf'));logger[_0xe7fb('0x10')](_0xe7fb('0x11'),_0x1f943f,_0xe7fb('0xf'),JSON[_0xe7fb('0x12')](_0x4ba197));if(_0x4ba197[_0xe7fb('0x13')]){if(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x14')]===0x1f4){logger[_0xe7fb('0x13')](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);return _0x228f6b(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')]['message']);return _0x213ebc(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}else{logger['info'](_0xe7fb('0xe'),_0x1f943f,'request\x20sent');_0x213ebc(_0x4ba197[_0xe7fb('0x16')][_0xe7fb('0x15')]);}})[_0xe7fb('0x17')](function(_0x17e8a8){logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x17e8a8);_0x228f6b(_0x17e8a8);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 12f5237..c22e45c 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 _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 +var _0x6c0f=['exports','util','connect-timeout','express','../../components/interaction/service','../../config/environment','post','isAuthenticated','sendUserNotification'];(function(_0x5b1da8,_0x10a8a2){var _0x2aab30=function(_0x5c738a){while(--_0x5c738a){_0x5b1da8['push'](_0x5b1da8['shift']());}};_0x2aab30(++_0x10a8a2);}(_0x6c0f,0x17b));var _0xf6c0=function(_0x43dc07,_0x58465d){_0x43dc07=_0x43dc07-0x0;var _0x3b026d=_0x6c0f[_0x43dc07];return _0x3b026d;};'use strict';var multer=require('multer');var util=require(_0xf6c0('0x0'));var path=require('path');var timeout=require(_0xf6c0('0x1'));var express=require(_0xf6c0('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf6c0('0x3'));var config=require(_0xf6c0('0x4'));var controller=require('./userNotification.controller');router[_0xf6c0('0x5')]('/',auth[_0xf6c0('0x6')](),controller[_0xf6c0('0x7')]);module[_0xf6c0('0x8')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 15c6bd6..fe65b4e 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 _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 +var _0xc1a6=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x19fc3d,_0x27b107){var _0x3d702=function(_0x40137c){while(--_0x40137c){_0x19fc3d['push'](_0x19fc3d['shift']());}};_0x3d702(++_0x27b107);}(_0xc1a6,0x1db));var _0x6c1a=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0xc1a6[_0x513aa5];return _0x1a1a7c;};'use strict';var Sequelize=require(_0x6c1a('0x0'));module[_0x6c1a('0x1')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0x6c1a('0x2')]},'recipientsDescription':{'type':Sequelize[_0x6c1a('0x3')]},'beep':{'type':Sequelize[_0x6c1a('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 01d95c9..e7a66aa 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 _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 +var _0x7c59=['sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','send','sendUserNotification','hasOwnProperty','text','body','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Sequelize','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','voicequeue','whatsappqueue','user','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','join','sequelize','transaction','create','forEach','emit','userNotification:send','catch','Template','findOne','html','render','startCase','User','union','ids','queue','replace','all','flatten','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path'];(function(_0xc3acd1,_0x4489cd){var _0x1673b0=function(_0x10b5d3){while(--_0x10b5d3){_0xc3acd1['push'](_0xc3acd1['shift']());}};_0x1673b0(++_0x4489cd);}(_0x7c59,0x188));var _0x97c5=function(_0x4c4278,_0x28fb48){_0x4c4278=_0x4c4278-0x0;var _0x430bc6=_0x7c59[_0x4c4278];return _0x430bc6;};'use strict';var emlformat=require(_0x97c5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x97c5('0x1'));var jsonpatch=require(_0x97c5('0x2'));var rp=require(_0x97c5('0x3'));var moment=require(_0x97c5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x97c5('0x5'));var util=require(_0x97c5('0x6'));var path=require(_0x97c5('0x7'));var sox=require(_0x97c5('0x8'));var csv=require(_0x97c5('0x9'));var ejs=require(_0x97c5('0xa'));var fs=require('fs');var fs_extra=require(_0x97c5('0xb'));var _=require('lodash');var squel=require(_0x97c5('0xc'));var crypto=require(_0x97c5('0xd'));var jsforce=require(_0x97c5('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x97c5('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x97c5('0xf'));var authService=require(_0x97c5('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x97c5('0x11'));var hardwareService=require(_0x97c5('0x12'));var logger=require(_0x97c5('0x13'))(_0x97c5('0x14'));var utils=require('../../config/utils');var config=require(_0x97c5('0x15'));var licenseUtil=require(_0x97c5('0x16'));var db=require(_0x97c5('0x17'))['db'];config[_0x97c5('0x18')]=_[_0x97c5('0x19')](config[_0x97c5('0x18')],{'host':_0x97c5('0x1a'),'port':0x18eb});var socket=require(_0x97c5('0x1b'))(new Redis(config['redis']));require(_0x97c5('0x1c'))[_0x97c5('0x1d')](socket);function respondWithStatusCode(_0x22b566,_0x4420c0){_0x4420c0=_0x4420c0||0xcc;return function(_0x25d529){if(_0x25d529){return _0x22b566['sendStatus'](_0x4420c0);}return _0x22b566[_0x97c5('0x1e')](_0x4420c0)[_0x97c5('0x1f')]();};}function respondWithResult(_0x2cffb3,_0x487983){_0x487983=_0x487983||0xc8;return function(_0x18c091){if(_0x18c091){return _0x2cffb3['status'](_0x487983)[_0x97c5('0x20')](_0x18c091);}};}function respondWithFilteredResult(_0xc324d9,_0x592bb3){return function(_0x58dad5){if(_0x58dad5){var _0x319919=typeof _0x592bb3[_0x97c5('0x21')]==='undefined'&&typeof _0x592bb3[_0x97c5('0x22')]===_0x97c5('0x23');var _0x5f21ef=_0x58dad5['count'];var _0xa538bd=_0x319919?0x0:_0x592bb3['offset'];var _0x261245=_0x319919?_0x58dad5[_0x97c5('0x24')]:_0x592bb3['offset']+_0x592bb3['limit'];var _0x587d56;if(_0x261245>=_0x5f21ef){_0x261245=_0x5f21ef;_0x587d56=0xc8;}else{_0x587d56=0xce;}_0xc324d9['status'](_0x587d56);return _0xc324d9[_0x97c5('0x25')](_0x97c5('0x26'),_0xa538bd+'-'+_0x261245+'/'+_0x5f21ef)['json'](_0x58dad5);}return null;};}function patchUpdates(_0x2bf149){return function(_0x30eab7){try{jsonpatch[_0x97c5('0x27')](_0x30eab7,_0x2bf149,!![]);}catch(_0x3ad0e9){return BPromise[_0x97c5('0x28')](_0x3ad0e9);}return _0x30eab7[_0x97c5('0x29')]();};}function saveUpdates(_0x53c762,_0x4e8eb8){return function(_0x4867d2){if(_0x4867d2){return _0x4867d2[_0x97c5('0x2a')](_0x53c762)[_0x97c5('0x2b')](function(_0x15e30c){return _0x15e30c;});}return null;};}function removeEntity(_0x42ae21,_0x1f22bd){return function(_0x40a92f){if(_0x40a92f){return _0x40a92f[_0x97c5('0x2c')]()['then'](function(){_0x42ae21[_0x97c5('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52c144,_0x58fad5){return function(_0x3ec96f){if(!_0x3ec96f){_0x52c144[_0x97c5('0x2d')](0x194);}return _0x3ec96f;};}function handleError(_0x4846f6,_0x25d14e){_0x25d14e=_0x25d14e||0x1f4;return function(_0x154d4a){logger[_0x97c5('0x2e')](_0x154d4a[_0x97c5('0x2f')]);if(_0x154d4a['name']){delete _0x154d4a['name'];}_0x4846f6[_0x97c5('0x1e')](_0x25d14e)[_0x97c5('0x30')](_0x154d4a);};}exports[_0x97c5('0x31')]=function(_0x44e3af,_0x4d6cc6,_0x52795d){if(!_0x44e3af['body'][_0x97c5('0x32')](_0x97c5('0x33'))&&!_0x44e3af[_0x97c5('0x34')]['hasOwnProperty'](_0x97c5('0x35'))){throw new db['Sequelize'][(_0x97c5('0x36'))](_0x97c5('0x37'));}else{if(_0x44e3af['body'][_0x97c5('0x32')](_0x97c5('0x35'))&&!_0x44e3af['body'][_0x97c5('0x32')](_0x97c5('0x38'))){throw new db[(_0x97c5('0x39'))][(_0x97c5('0x36'))](_0x97c5('0x3a'));}if(!_0x44e3af[_0x97c5('0x34')][_0x97c5('0x32')](_0x97c5('0x3b'))){throw new db[(_0x97c5('0x39'))][(_0x97c5('0x36'))](_0x97c5('0x3c'));}else{try{var _0x2e87ac=JSON[_0x97c5('0x3d')](_0x44e3af[_0x97c5('0x34')]['recipients']);}catch(_0x1fb94e){logger['error'](_0x1fb94e);throw new db[(_0x97c5('0x39'))]['ValidationError'](_0x97c5('0x3e'));}var _0x1749ae=[_0x97c5('0x3f'),_0x97c5('0x40'),'mailqueue','openchannelqueue','smsqueue',_0x97c5('0x41'),_0x97c5('0x42'),'team',_0x97c5('0x43')];if(_['some'](_0x2e87ac,function(_0x5a9406){return!_[_0x97c5('0x44')](_0x1749ae,_0x5a9406[_0x97c5('0x45')][_0x97c5('0x46')]());})){throw new db['Sequelize'][(_0x97c5('0x36'))](_0x97c5('0x47'));}}}var _0x3d2dff={};_0x3d2dff[_0x97c5('0x48')]=_0x44e3af[_0x97c5('0x34')][_0x97c5('0x32')](_0x97c5('0x48'))?_0x44e3af[_0x97c5('0x34')][_0x97c5('0x48')]:_0x44e3af[_0x97c5('0x43')][_0x97c5('0x49')];_0x3d2dff[_0x97c5('0x4a')]=_[_0x97c5('0x4b')](_0x44e3af[_0x97c5('0x34')]['recipientsDescription'])?null:_0x44e3af['body'][_0x97c5('0x4a')];_0x3d2dff[_0x97c5('0x4c')]=_0x44e3af[_0x97c5('0x34')][_0x97c5('0x4c')]||![];_0x3d2dff[_0x97c5('0x4d')]=_0x44e3af[_0x97c5('0x43')]['id'];return getContent(_0x44e3af[_0x97c5('0x34')])[_0x97c5('0x2b')](function(_0x3bc442){_0x3d2dff[_0x97c5('0x34')]=_0x3bc442;return getRecipients(_0x2e87ac);})[_0x97c5('0x2b')](function(_0x18b689){_0x3d2dff[_0x97c5('0x4e')]=_['sortBy'](_0x18b689)[_0x97c5('0x4f')](',');return db[_0x97c5('0x50')][_0x97c5('0x51')](function(_0x4ce4bb){return db['UserNotification'][_0x97c5('0x52')](_0x3d2dff,{'raw':!![],'transaction':_0x4ce4bb})[_0x97c5('0x2b')](function(_0x3efd5a){var _0x5dae6a={'sender':_0x3d2dff['senderName'],'description':_0x3d2dff['recipientsDescription'],'content':_0x3d2dff[_0x97c5('0x34')],'beep':_0x3d2dff[_0x97c5('0x4c')]};_0x18b689[_0x97c5('0x53')](function(_0x149cf5){_0x5dae6a['recipient']=_0x149cf5;socket[_0x97c5('0x54')](_0x97c5('0x55'),_0x5dae6a);});return _0x3efd5a;});});})[_0x97c5('0x2b')](respondWithResult(_0x4d6cc6,0xc9))[_0x97c5('0x56')](handleError(_0x4d6cc6,null));};function getContent(_0x14e880){return new BPromise(function(_0x3137f3,_0x90982c){if(_0x14e880['text']){_0x3137f3(_0x14e880[_0x97c5('0x33')]);return;}return db[_0x97c5('0x57')][_0x97c5('0x58')]({'attributes':[_0x97c5('0x59')],'where':{'id':_0x14e880['TemplateId']},'raw':!![]})[_0x97c5('0x2b')](function(_0x2bdc38){if(!_0x2bdc38)throw new db[(_0x97c5('0x39'))][(_0x97c5('0x36'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x404d91=Mustache[_0x97c5('0x5a')](_0x2bdc38[_0x97c5('0x59')],_0x14e880[_0x97c5('0x38')]);_0x3137f3(_0x404d91);})[_0x97c5('0x56')](function(_0x7f5467){_0x90982c(_0x7f5467);});});}function getRecipients(_0x194322){return new BPromise(function(_0x37e02a,_0x499c3f){var _0x5ea877=[];var _0x42df0e=[];_0x194322[_0x97c5('0x53')](function(_0x5001fa){var _0x3417cb=_[_0x97c5('0x5b')](_0x5001fa[_0x97c5('0x45')][_0x97c5('0x46')]());if(_0x3417cb===_0x97c5('0x5c')){_0x5ea877=_[_0x97c5('0x5d')](_0x5ea877,_0x5001fa[_0x97c5('0x5e')]);}else{if(_[_0x97c5('0x44')](_0x3417cb,_0x97c5('0x5f')))_0x3417cb=_0x3417cb[_0x97c5('0x60')](_0x97c5('0x5f'),'Queue');_0x5001fa[_0x97c5('0x5e')]['forEach'](function(_0x29d391){_0x42df0e['push'](getAgents(_0x3417cb,_0x29d391));});}});return BPromise[_0x97c5('0x61')](_0x42df0e)['then'](function(_0x431030){_0x5ea877=_[_0x97c5('0x5d')](_0x5ea877,_[_0x97c5('0x62')](_0x431030));_0x37e02a(_0x5ea877);})['catch'](function(_0xe70411){_0x499c3f(_0xe70411);});});}function getAgents(_0x3f19be,_0x5dadff){return new BPromise(function(_0x56ad38,_0xc5855a){return db[_0x3f19be][_0x97c5('0x58')]({'where':{'id':_0x5dadff}})['then'](function(_0x371dd5){return _0x371dd5[_0x97c5('0x63')]({'attributes':['id'],'raw':!![]})[_0x97c5('0x2b')](function(_0x28a5c2){var _0x2de7d0=_['map'](_0x28a5c2,'id');_0x56ad38(_0x2de7d0);});})[_0x97c5('0x56')](function(_0x3201cd){_0xc5855a(_0x3201cd);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 616de59..4501d37 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 _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 +var _0x70be=['UserNotification','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x4f8cea,_0x4a3e4a){var _0x449c23=function(_0x2b0356){while(--_0x2b0356){_0x4f8cea['push'](_0x4f8cea['shift']());}};_0x449c23(++_0x4a3e4a);}(_0x70be,0x167));var _0xe70b=function(_0x497524,_0x1b7b58){_0x497524=_0x497524-0x0;var _0x35921f=_0x70be[_0x497524];return _0x35921f;};'use strict';var EventEmitter=require(_0xe70b('0x0'));var UserNotification=require('../../mysqldb')['db'][_0xe70b('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xe70b('0x2')](0x0);var events={'afterCreate':_0xe70b('0x3'),'afterUpdate':_0xe70b('0x4'),'afterDestroy':_0xe70b('0x5')};function emitEvent(_0x324dc4){return function(_0x54cfa8,_0x5433f5,_0x4fcfb9){UserNotificationEvents[_0xe70b('0x6')](_0x324dc4+':'+_0x54cfa8['id'],_0x54cfa8);UserNotificationEvents['emit'](_0x324dc4,_0x54cfa8);_0x4fcfb9(null);};}for(var e in events){if(events[_0xe70b('0x7')](e)){var event=events[e];UserNotification[_0xe70b('0x8')](e,emitEvent(event));}}module[_0xe70b('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 ca4689f..8fad5c3 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 _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 +var _0x4762=['UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','request-promise','path','rimraf','./userNotification.attributes','exports','define'];(function(_0x6573,_0x22a7f3){var _0x1fd512=function(_0x170032){while(--_0x170032){_0x6573['push'](_0x6573['shift']());}};_0x1fd512(++_0x22a7f3);}(_0x4762,0x17e));var _0x2476=function(_0x3df70a,_0x2c07da){_0x3df70a=_0x3df70a-0x0;var _0x5b4464=_0x4762[_0x3df70a];return _0x5b4464;};'use strict';var _=require('lodash');var util=require(_0x2476('0x0'));var logger=require(_0x2476('0x1'))(_0x2476('0x2'));var moment=require(_0x2476('0x3'));var BPromise=require('bluebird');var rp=require(_0x2476('0x4'));var fs=require('fs');var path=require(_0x2476('0x5'));var rimraf=require(_0x2476('0x6'));var config=require('../../config/environment');var attributes=require(_0x2476('0x7'));module[_0x2476('0x8')]=function(_0x12e5be,_0x226153){return _0x12e5be[_0x2476('0x9')](_0x2476('0xa'),attributes,{'tableName':_0x2476('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2476('0xc'),'collate':_0x2476('0xd')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 1781663..6b04a74 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 _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 +var _0xdbea=['code','message','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','./userNotification.socket','request','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4a8918,_0x2f16b9){var _0x2ad750=function(_0x4d3e05){while(--_0x4d3e05){_0x4a8918['push'](_0x4a8918['shift']());}};_0x2ad750(++_0x2f16b9);}(_0xdbea,0xc2));var _0xadbe=function(_0x4a5b2c,_0x453068){_0x4a5b2c=_0x4a5b2c-0x0;var _0x3f723d=_0xdbea[_0x4a5b2c];return _0x3f723d;};'use strict';var _=require(_0xadbe('0x0'));var util=require('util');var moment=require(_0xadbe('0x1'));var BPromise=require(_0xadbe('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xadbe('0x3'))['db'];var utils=require(_0xadbe('0x4'));var logger=require(_0xadbe('0x5'))(_0xadbe('0x6'));var config=require('../../config/environment');var jayson=require(_0xadbe('0x7'));var client=jayson[_0xadbe('0x8')][_0xadbe('0x9')]({'port':0x232a});config[_0xadbe('0xa')]=_[_0xadbe('0xb')](config[_0xadbe('0xa')],{'host':_0xadbe('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xadbe('0xa')]));require(_0xadbe('0xd'))['register'](socket);function respondWithRpcPromise(_0x3c8f02,_0x335832,_0x29ff13){return new BPromise(function(_0x970ad7,_0x3dca42){return client[_0xadbe('0xe')](_0x3c8f02,_0x29ff13)['then'](function(_0x3e4c8b){logger[_0xadbe('0xf')](_0xadbe('0x10'),_0x335832,_0xadbe('0x11'));logger[_0xadbe('0x12')](_0xadbe('0x13'),_0x335832,_0xadbe('0x11'),JSON[_0xadbe('0x14')](_0x3e4c8b));if(_0x3e4c8b['error']){if(_0x3e4c8b[_0xadbe('0x15')][_0xadbe('0x16')]===0x1f4){logger[_0xadbe('0x15')](_0xadbe('0x10'),_0x335832,_0x3e4c8b[_0xadbe('0x15')][_0xadbe('0x17')]);return _0x3dca42(_0x3e4c8b[_0xadbe('0x15')][_0xadbe('0x17')]);}logger[_0xadbe('0x15')](_0xadbe('0x10'),_0x335832,_0x3e4c8b[_0xadbe('0x15')][_0xadbe('0x17')]);return _0x970ad7(_0x3e4c8b[_0xadbe('0x15')][_0xadbe('0x17')]);}else{logger['info']('UserNotification,\x20%s,\x20%s',_0x335832,_0xadbe('0x11'));_0x970ad7(_0x3e4c8b['result']['message']);}})['catch'](function(_0x5ac18d){logger['error']('UserNotification,\x20%s,\x20%s',_0x335832,_0x5ac18d);_0x3dca42(_0x5ac18d);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index db22f34..539bfff 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 _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 +var _0xfe18=['./userNotification.events','save','update','emit','removeListener','register','length','userNotification:'];(function(_0x36a806,_0x24f3e9){var _0x4996da=function(_0x5bfe97){while(--_0x5bfe97){_0x36a806['push'](_0x36a806['shift']());}};_0x4996da(++_0x24f3e9);}(_0xfe18,0xf8));var _0x8fe1=function(_0x1ecb71,_0x370253){_0x1ecb71=_0x1ecb71-0x0;var _0x402229=_0xfe18[_0x1ecb71];return _0x402229;};'use strict';var UserNotificationEvents=require(_0x8fe1('0x0'));var events=[_0x8fe1('0x1'),'remove',_0x8fe1('0x2')];function createListener(_0x79c5bf,_0x56c48d){return function(_0x1f1292){_0x56c48d[_0x8fe1('0x3')](_0x79c5bf,_0x1f1292);};}function removeListener(_0x23253f,_0x54bccc){return function(){UserNotificationEvents[_0x8fe1('0x4')](_0x23253f,_0x54bccc);};}exports[_0x8fe1('0x5')]=function(_0x143a74){for(var _0x131a3e=0x0,_0x370198=events[_0x8fe1('0x6')];_0x131a3e<_0x370198;_0x131a3e++){var _0x547137=events[_0x131a3e];var _0x559887=createListener(_0x8fe1('0x7')+_0x547137,_0x143a74);UserNotificationEvents['on'](_0x547137,_0x559887);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 4ecf4ea..06ca5b9 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 _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 +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x1a5ad1,_0x357407){var _0x7b8b22=function(_0x312e53){while(--_0x312e53){_0x1a5ad1['push'](_0x1a5ad1['shift']());}};_0x7b8b22(++_0x357407);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'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 aa3a7f0..e016b00 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 _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 +var _0xe636=['exports','sequelize'];(function(_0x513026,_0x501473){var _0x51938c=function(_0x1ff930){while(--_0x1ff930){_0x513026['push'](_0x513026['shift']());}};_0x51938c(++_0x501473);}(_0xe636,0x16d));var _0x6e63=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xe636[_0x43d11d];return _0x38cd08;};'use strict';var Sequelize=require(_0x6e63('0x0'));module[_0x6e63('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index a933b4c..f99aaeb 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 _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 +var _0x1e4b=['../../config/environment','exports','define','user_has_openchannel_queues','util','../../config/logger','bluebird','path','rimraf'];(function(_0x5549d9,_0xf8dc19){var _0x27dcdf=function(_0x6c9bcc){while(--_0x6c9bcc){_0x5549d9['push'](_0x5549d9['shift']());}};_0x27dcdf(++_0xf8dc19);}(_0x1e4b,0x94));var _0xb1e4=function(_0x977300,_0x1dabec){_0x977300=_0x977300-0x0;var _0x151be2=_0x1e4b[_0x977300];return _0x151be2;};'use strict';var _=require('lodash');var util=require(_0xb1e4('0x0'));var logger=require(_0xb1e4('0x1'))('api');var moment=require('moment');var BPromise=require(_0xb1e4('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb1e4('0x3'));var rimraf=require(_0xb1e4('0x4'));var config=require(_0xb1e4('0x5'));var attributes=require('./userOpenchannelQueue.attributes');module[_0xb1e4('0x6')]=function(_0x4fdf76,_0x1178cb){return _0x4fdf76[_0xb1e4('0x7')]('UserOpenchannelQueue',attributes,{'tableName':_0xb1e4('0x8'),'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 07267bf..9543410 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 _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 +var _0xc997=['message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x18bd49,_0x27f778){var _0x49a907=function(_0x290663){while(--_0x290663){_0x18bd49['push'](_0x18bd49['shift']());}};_0x49a907(++_0x27f778);}(_0xc997,0x1a1));var _0x7c99=function(_0x38998c,_0x520824){_0x38998c=_0x38998c-0x0;var _0x30bfa9=_0xc997[_0x38998c];return _0x30bfa9;};'use strict';var _=require(_0x7c99('0x0'));var util=require(_0x7c99('0x1'));var moment=require('moment');var BPromise=require(_0x7c99('0x2'));var rs=require(_0x7c99('0x3'));var fs=require('fs');var Redis=require(_0x7c99('0x4'));var db=require(_0x7c99('0x5'))['db'];var utils=require(_0x7c99('0x6'));var logger=require('../../config/logger')(_0x7c99('0x7'));var config=require('../../config/environment');var jayson=require(_0x7c99('0x8'));var client=jayson['client'][_0x7c99('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x46a3dd,_0x214999,_0xb815){return new BPromise(function(_0x415e3e,_0x12b4ce){return client[_0x7c99('0xa')](_0x46a3dd,_0xb815)[_0x7c99('0xb')](function(_0x42be42){logger[_0x7c99('0xc')](_0x7c99('0xd'),_0x214999,_0x7c99('0xe'));logger[_0x7c99('0xf')](_0x7c99('0x10'),_0x214999,_0x7c99('0xe'),JSON[_0x7c99('0x11')](_0x42be42));if(_0x42be42[_0x7c99('0x12')]){if(_0x42be42[_0x7c99('0x12')][_0x7c99('0x13')]===0x1f4){logger[_0x7c99('0x12')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x214999,_0x42be42['error']['message']);return _0x12b4ce(_0x42be42[_0x7c99('0x12')]['message']);}logger[_0x7c99('0x12')](_0x7c99('0xd'),_0x214999,_0x42be42[_0x7c99('0x12')]['message']);return _0x415e3e(_0x42be42[_0x7c99('0x12')][_0x7c99('0x14')]);}else{logger['info'](_0x7c99('0xd'),_0x214999,_0x7c99('0xe'));_0x415e3e(_0x42be42[_0x7c99('0x15')][_0x7c99('0x14')]);}})[_0x7c99('0x16')](function(_0x158828){logger[_0x7c99('0x12')](_0x7c99('0xd'),_0x214999,_0x158828);_0x12b4ce(_0x158828);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index a6856e5..43b131f 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 _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 +var _0x9b37=['update','destroy','delete','removeResources','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','isAuthenticated','index','/describe','describe','get','/:id','show','getSections','/:id/resources','getResources','create','post','/:id/clone','clone','/:id/sections','addSections','put'];(function(_0x1a6422,_0x18db7a){var _0x3a9818=function(_0x53985a){while(--_0x53985a){_0x1a6422['push'](_0x1a6422['shift']());}};_0x3a9818(++_0x18db7a);}(_0x9b37,0x1c5));var _0x79b3=function(_0x54edc9,_0x345f01){_0x54edc9=_0x54edc9-0x0;var _0x2ae7a9=_0x9b37[_0x54edc9];return _0x2ae7a9;};'use strict';var multer=require('multer');var util=require(_0x79b3('0x0'));var path=require(_0x79b3('0x1'));var timeout=require(_0x79b3('0x2'));var express=require(_0x79b3('0x3'));var router=express[_0x79b3('0x4')]();var fs_extra=require(_0x79b3('0x5'));var auth=require(_0x79b3('0x6'));var interaction=require(_0x79b3('0x7'));var config=require(_0x79b3('0x8'));var controller=require(_0x79b3('0x9'));router['get']('/',auth[_0x79b3('0xa')](),controller[_0x79b3('0xb')]);router['get'](_0x79b3('0xc'),auth['isAuthenticated'](),controller[_0x79b3('0xd')]);router[_0x79b3('0xe')](_0x79b3('0xf'),auth['isAuthenticated'](),controller[_0x79b3('0x10')]);router['get']('/:id/sections',auth[_0x79b3('0xa')](),controller[_0x79b3('0x11')]);router['get'](_0x79b3('0x12'),auth['isAuthenticated'](),controller[_0x79b3('0x13')]);router['post']('/',auth[_0x79b3('0xa')](),controller[_0x79b3('0x14')]);router[_0x79b3('0x15')](_0x79b3('0x16'),auth['isAuthenticated'](),controller[_0x79b3('0x17')]);router[_0x79b3('0x15')](_0x79b3('0x18'),auth[_0x79b3('0xa')](),controller[_0x79b3('0x19')]);router[_0x79b3('0x15')](_0x79b3('0x12'),auth['isAuthenticated'](),controller['addResources']);router[_0x79b3('0x1a')](_0x79b3('0xf'),auth[_0x79b3('0xa')](),controller[_0x79b3('0x1b')]);router['delete'](_0x79b3('0xf'),auth[_0x79b3('0xa')](),controller[_0x79b3('0x1c')]);router[_0x79b3('0x1d')](_0x79b3('0x18'),auth[_0x79b3('0xa')](),controller['removeSections']);router[_0x79b3('0x1d')](_0x79b3('0x12'),auth['isAuthenticated'](),controller[_0x79b3('0x1e')]);module[_0x79b3('0x1f')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index a21074b..c1e7aac 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 _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 +var _0xb911=['crudPermissions','join','getDataValue','split','BOOLEAN','sequelize','exports','STRING','name','setDataValue'];(function(_0x2e64d5,_0x564c0f){var _0xabb0c4=function(_0x15c16c){while(--_0x15c16c){_0x2e64d5['push'](_0x2e64d5['shift']());}};_0xabb0c4(++_0x564c0f);}(_0xb911,0xa5));var _0x1b91=function(_0x49aa7d,_0x5d46d8){_0x49aa7d=_0x49aa7d-0x0;var _0xdd0d26=_0xb911[_0x49aa7d];return _0xdd0d26;};'use strict';var Sequelize=require(_0x1b91('0x0'));module[_0x1b91('0x1')]={'name':{'type':Sequelize[_0x1b91('0x2')],'allowNull':![],'unique':_0x1b91('0x3')},'crudPermissions':{'type':Sequelize[_0x1b91('0x2')],'set':function(_0x24085e){this[_0x1b91('0x4')](_0x1b91('0x5'),_0x24085e?_0x24085e[_0x1b91('0x6')](''):[]);},'get':function(){return this[_0x1b91('0x7')](_0x1b91('0x5'))?this['getDataValue'](_0x1b91('0x5'))[_0x1b91('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x1b91('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x1b91('0x9')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x1b91('0x9')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x1b91('0x9')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x1b91('0x9')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x1b91('0x9')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index f2a737f..5c08377 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 _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 +var _0x1b73=['end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','destroy','error','name','send','index','UserProfile','rawAttributes','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','filter','count','then','includeAll','include','findAll','rows','show','params','keys','options','find','catch','create','clone','omit','createdAt','updatedAt','crudPermissions','body','sequelize','transaction','get','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','Resources','update','describe','addSections','userProfileId','push','removeSections','ids','includes','isEmpty','subsections','enabled','concat','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','getResources','section','Missing\x20section\x20parameter','nolimit','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','sendStatus','status'];(function(_0x161cb8,_0x540393){var _0x599254=function(_0x9697de){while(--_0x9697de){_0x161cb8['push'](_0x161cb8['shift']());}};_0x599254(++_0x540393);}(_0x1b73,0x13f));var _0x31b7=function(_0x2cc4af,_0xdbef33){_0x2cc4af=_0x2cc4af-0x0;var _0x45e3ae=_0x1b73[_0x2cc4af];return _0x45e3ae;};'use strict';var emlformat=require(_0x31b7('0x0'));var rimraf=require(_0x31b7('0x1'));var zipdir=require(_0x31b7('0x2'));var jsonpatch=require(_0x31b7('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x31b7('0x4'));var Mustache=require(_0x31b7('0x5'));var util=require(_0x31b7('0x6'));var path=require(_0x31b7('0x7'));var sox=require(_0x31b7('0x8'));var csv=require('to-csv');var ejs=require(_0x31b7('0x9'));var fs=require('fs');var fs_extra=require(_0x31b7('0xa'));var _=require(_0x31b7('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x31b7('0xc'));var toCsv=require(_0x31b7('0xd'));var querystring=require(_0x31b7('0xe'));var Papa=require(_0x31b7('0xf'));var Redis=require(_0x31b7('0x10'));var authService=require(_0x31b7('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x31b7('0x12'));var logger=require(_0x31b7('0x13'))(_0x31b7('0x14'));var utils=require(_0x31b7('0x15'));var config=require(_0x31b7('0x16'));var licenseUtil=require(_0x31b7('0x17'));var db=require(_0x31b7('0x18'))['db'];config[_0x31b7('0x19')]=_[_0x31b7('0x1a')](config['redis'],{'host':_0x31b7('0x1b'),'port':0x18eb});var socket=require(_0x31b7('0x1c'))(new Redis(config[_0x31b7('0x19')]));require(_0x31b7('0x1d'))['register'](socket);function respondWithStatusCode(_0x326708,_0x30de8a){_0x30de8a=_0x30de8a||0xcc;return function(_0x56c639){if(_0x56c639){return _0x326708[_0x31b7('0x1e')](_0x30de8a);}return _0x326708[_0x31b7('0x1f')](_0x30de8a)[_0x31b7('0x20')]();};}function respondWithResult(_0x44a411,_0x2387d8){_0x2387d8=_0x2387d8||0xc8;return function(_0x452f8f){if(_0x452f8f){return _0x44a411[_0x31b7('0x1f')](_0x2387d8)[_0x31b7('0x21')](_0x452f8f);}};}function respondWithFilteredResult(_0x2a6f67,_0x4ced09){return function(_0x2b7c60){if(_0x2b7c60){var _0x3f4729=typeof _0x4ced09[_0x31b7('0x22')]===_0x31b7('0x23')&&typeof _0x4ced09[_0x31b7('0x24')]===_0x31b7('0x23');var _0x5c04d2=_0x2b7c60['count'];var _0x56e1e9=_0x3f4729?0x0:_0x4ced09[_0x31b7('0x22')];var _0xf7e0ae=_0x3f4729?_0x2b7c60['count']:_0x4ced09['offset']+_0x4ced09[_0x31b7('0x24')];var _0x25f4d2;if(_0xf7e0ae>=_0x5c04d2){_0xf7e0ae=_0x5c04d2;_0x25f4d2=0xc8;}else{_0x25f4d2=0xce;}_0x2a6f67[_0x31b7('0x1f')](_0x25f4d2);return _0x2a6f67[_0x31b7('0x25')](_0x31b7('0x26'),_0x56e1e9+'-'+_0xf7e0ae+'/'+_0x5c04d2)[_0x31b7('0x21')](_0x2b7c60);}return null;};}function patchUpdates(_0x24537e){return function(_0x4b0dcb){try{jsonpatch[_0x31b7('0x27')](_0x4b0dcb,_0x24537e,!![]);}catch(_0x1eefd0){return BPromise[_0x31b7('0x28')](_0x1eefd0);}return _0x4b0dcb[_0x31b7('0x29')]();};}function saveUpdates(_0x1bd79d,_0x5ce808){return function(_0x6daaf0){if(_0x6daaf0){return _0x6daaf0['update'](_0x1bd79d)['then'](function(_0x43c757){return _0x43c757;});}return null;};}function removeEntity(_0x2d3869,_0x594ea5){return function(_0xc3820d){if(_0xc3820d){return _0xc3820d[_0x31b7('0x2a')]()['then'](function(){_0x2d3869[_0x31b7('0x1f')](0xcc)[_0x31b7('0x20')]();});}};}function handleEntityNotFound(_0x4d8735,_0x2bacc6){return function(_0x17c601){if(!_0x17c601){_0x4d8735[_0x31b7('0x1e')](0x194);}return _0x17c601;};}function handleError(_0x274297,_0x1433b8){_0x1433b8=_0x1433b8||0x1f4;return function(_0x27d34e){logger[_0x31b7('0x2b')](_0x27d34e['stack']);if(_0x27d34e[_0x31b7('0x2c')]){delete _0x27d34e[_0x31b7('0x2c')];}_0x274297['status'](_0x1433b8)[_0x31b7('0x2d')](_0x27d34e);};}exports[_0x31b7('0x2e')]=function(_0x4db668,_0x52a787){var _0x179688={},_0x1bbfd6={},_0x6c15ea={'count':0x0,'rows':[]};var _0x38dac6=_['map'](db[_0x31b7('0x2f')][_0x31b7('0x30')],function(_0x1b1a6d){return{'name':_0x1b1a6d['fieldName'],'type':_0x1b1a6d[_0x31b7('0x31')][_0x31b7('0x32')]};});_0x1bbfd6[_0x31b7('0x33')]=_[_0x31b7('0x34')](_0x38dac6,'name');_0x1bbfd6[_0x31b7('0x35')]=_['keys'](_0x4db668[_0x31b7('0x35')]);_0x1bbfd6[_0x31b7('0x36')]=_['intersection'](_0x1bbfd6['model'],_0x1bbfd6[_0x31b7('0x35')]);_0x179688['attributes']=_[_0x31b7('0x37')](_0x1bbfd6[_0x31b7('0x33')],qs[_0x31b7('0x38')](_0x4db668[_0x31b7('0x35')]['fields']));_0x179688[_0x31b7('0x39')]=_0x179688['attributes'][_0x31b7('0x3a')]?_0x179688[_0x31b7('0x39')]:_0x1bbfd6[_0x31b7('0x33')];if(!_0x4db668[_0x31b7('0x35')][_0x31b7('0x3b')]('nolimit')){_0x179688[_0x31b7('0x24')]=qs[_0x31b7('0x24')](_0x4db668[_0x31b7('0x35')]['limit']);_0x179688['offset']=qs[_0x31b7('0x22')](_0x4db668[_0x31b7('0x35')][_0x31b7('0x22')]);}_0x179688['order']=qs[_0x31b7('0x3c')](_0x4db668['query'][_0x31b7('0x3c')]);_0x179688[_0x31b7('0x3d')]=qs[_0x31b7('0x36')](_[_0x31b7('0x3e')](_0x4db668[_0x31b7('0x35')],_0x1bbfd6[_0x31b7('0x36')]),_0x38dac6);if(_0x4db668[_0x31b7('0x35')]['filter']){_0x179688[_0x31b7('0x3d')]=_[_0x31b7('0x3f')](_0x179688[_0x31b7('0x3d')],{'$or':_[_0x31b7('0x34')](_0x38dac6,function(_0x4abfda){if(_0x4abfda[_0x31b7('0x31')]!==_0x31b7('0x40')){var _0x4f16aa={};_0x4f16aa[_0x4abfda[_0x31b7('0x2c')]]={'$like':'%'+_0x4db668[_0x31b7('0x35')][_0x31b7('0x41')]+'%'};return _0x4f16aa;}})});}_0x179688=_[_0x31b7('0x3f')]({},_0x179688,_0x4db668['options']);var _0xd9b100={'where':_0x179688[_0x31b7('0x3d')]};return db[_0x31b7('0x2f')][_0x31b7('0x42')](_0xd9b100)[_0x31b7('0x43')](function(_0x2f4cf3){_0x6c15ea[_0x31b7('0x42')]=_0x2f4cf3;if(_0x4db668[_0x31b7('0x35')][_0x31b7('0x44')]){_0x179688[_0x31b7('0x45')]=[{'all':!![]}];}return db[_0x31b7('0x2f')][_0x31b7('0x46')](_0x179688);})[_0x31b7('0x43')](function(_0x2a88f5){_0x6c15ea[_0x31b7('0x47')]=_0x2a88f5;return _0x6c15ea;})[_0x31b7('0x43')](respondWithFilteredResult(_0x52a787,_0x179688))['catch'](handleError(_0x52a787,null));};exports[_0x31b7('0x48')]=function(_0xb854ce,_0x1e9efe){var _0x553852={'raw':![],'where':{'id':_0xb854ce[_0x31b7('0x49')]['id']}},_0xc6d28c={};_0xc6d28c['model']=_['keys'](db['UserProfile'][_0x31b7('0x30')]);_0xc6d28c[_0x31b7('0x35')]=_[_0x31b7('0x4a')](_0xb854ce['query']);_0xc6d28c['filters']=_['intersection'](_0xc6d28c[_0x31b7('0x33')],_0xc6d28c[_0x31b7('0x35')]);_0x553852[_0x31b7('0x39')]=_[_0x31b7('0x37')](_0xc6d28c['model'],qs[_0x31b7('0x38')](_0xb854ce[_0x31b7('0x35')][_0x31b7('0x38')]));_0x553852[_0x31b7('0x39')]=_0x553852[_0x31b7('0x39')]['length']?_0x553852[_0x31b7('0x39')]:_0xc6d28c[_0x31b7('0x33')];if(_0xb854ce[_0x31b7('0x35')][_0x31b7('0x44')]){_0x553852[_0x31b7('0x45')]=[{'all':!![]}];}_0x553852=_[_0x31b7('0x3f')]({},_0x553852,_0xb854ce[_0x31b7('0x4b')]);return db[_0x31b7('0x2f')][_0x31b7('0x4c')](_0x553852)[_0x31b7('0x43')](handleEntityNotFound(_0x1e9efe,null))['then'](respondWithResult(_0x1e9efe,null))[_0x31b7('0x4d')](handleError(_0x1e9efe,null));};exports[_0x31b7('0x4e')]=function(_0x13688a,_0x4c3ef4){return db[_0x31b7('0x2f')][_0x31b7('0x4e')](_0x13688a['body'],{})[_0x31b7('0x43')](respondWithResult(_0x4c3ef4,0xc9))['catch'](handleError(_0x4c3ef4,null));};exports[_0x31b7('0x4f')]=function(_0x5b936d,_0x25a5c1){var _0x2525f5={'where':{'id':_0x5b936d[_0x31b7('0x49')]['id']}},_0x379bd3={};_0x379bd3[_0x31b7('0x33')]=_[_0x31b7('0x4a')](db['UserProfile'][_0x31b7('0x30')]);_0x2525f5[_0x31b7('0x39')]=_[_0x31b7('0x37')](_0x379bd3[_0x31b7('0x33')],qs['fields'](_0x5b936d['query'][_0x31b7('0x38')]));_0x2525f5[_0x31b7('0x39')]=_0x2525f5['attributes'][_0x31b7('0x3a')]?_0x2525f5[_0x31b7('0x39')]:_0x379bd3[_0x31b7('0x33')];if(_0x5b936d[_0x31b7('0x35')][_0x31b7('0x44')]){_0x2525f5[_0x31b7('0x45')]=[{'all':!![]}];}_0x2525f5=_[_0x31b7('0x3f')]({},_0x2525f5,_0x5b936d[_0x31b7('0x4b')]);return db[_0x31b7('0x2f')]['find'](_0x2525f5)[_0x31b7('0x43')](handleEntityNotFound(_0x25a5c1,null))[_0x31b7('0x43')](function(_0x4a193a){if(_0x4a193a){var _0x59d982=_0x4a193a['get']({'plain':!![]});_0x59d982=qs[_0x31b7('0x50')](_0x59d982,['id',_0x31b7('0x51'),_0x31b7('0x52'),_0x31b7('0x53')]);_0x5b936d[_0x31b7('0x54')]=_['omit'](_0x5b936d[_0x31b7('0x54')],['id',_0x31b7('0x51'),_0x31b7('0x52')]);return db[_0x31b7('0x55')][_0x31b7('0x56')](function(_0x41ccd9){return db['UserProfile'][_0x31b7('0x4e')](_[_0x31b7('0x3f')](_0x59d982,_0x5b936d['body']),{'include':_0x5b936d[_0x31b7('0x35')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x41ccd9})[_0x31b7('0x43')](function(_0x223dc5){var _0x5ca2c1=_0x223dc5[_0x31b7('0x57')]({'plain':!![]});return db[_0x31b7('0x58')]['findAll']({'where':{'userProfileId':_0x5b936d[_0x31b7('0x49')]['id']},'raw':!![]})[_0x31b7('0x43')](function(_0x1b91f1){if(_0x1b91f1){return BPromise[_0x31b7('0x59')](_0x1b91f1,function(_0x59e39b){return new BPromise(function(_0x4056ac,_0x5adffc){if(_0x59e39b[_0x31b7('0x5a')]===null||_0x59e39b[_0x31b7('0x5a')]===0x1)_0x4056ac(null);return db[_0x31b7('0x5b')]['findAll']({'where':{'sectionId':_0x59e39b['id']},'raw':!![]})[_0x31b7('0x43')](function(_0x135b7b){var _0x10257d=_[_0x31b7('0x34')](_0x135b7b,function(_0x1ad39f){return qs[_0x31b7('0x50')](_0x1ad39f,['id','createdAt',_0x31b7('0x52'),_0x31b7('0x5c')]);});_0x4056ac(_0x10257d);})['catch'](function(_0x3ba360){_0x5adffc(_0x3ba360);});})[_0x31b7('0x43')](function(_0x249755){var _0x421523=qs[_0x31b7('0x50')](_0x59e39b,['id',_0x31b7('0x51'),_0x31b7('0x52')]);_0x421523['userProfileId']=_0x5ca2c1['id'];if(_0x249755)_0x421523[_0x31b7('0x5d')]=_0x249755;return _0x421523;})[_0x31b7('0x43')](function(_0x84c694){return db[_0x31b7('0x58')][_0x31b7('0x4e')](_0x84c694,{'include':[{'model':db['UserProfileResource'],'as':_0x31b7('0x5d')}],'raw':!![],'transaction':_0x41ccd9});});})[_0x31b7('0x43')](function(){return _0x5ca2c1;});}});});});}})[_0x31b7('0x43')](respondWithResult(_0x25a5c1,0xc9))[_0x31b7('0x4d')](handleError(_0x25a5c1,null));};exports[_0x31b7('0x5e')]=function(_0x3193bb,_0x4c0f39){if(_0x3193bb[_0x31b7('0x54')]['id']){delete _0x3193bb[_0x31b7('0x54')]['id'];}return db[_0x31b7('0x2f')][_0x31b7('0x4c')]({'where':{'id':_0x3193bb[_0x31b7('0x49')]['id']}})[_0x31b7('0x43')](handleEntityNotFound(_0x4c0f39,null))[_0x31b7('0x43')](saveUpdates(_0x3193bb[_0x31b7('0x54')],null))[_0x31b7('0x43')](respondWithResult(_0x4c0f39,null))[_0x31b7('0x4d')](handleError(_0x4c0f39,null));};exports[_0x31b7('0x2a')]=function(_0x1c52fc,_0x5b457c){return db[_0x31b7('0x2f')][_0x31b7('0x4c')]({'where':{'id':_0x1c52fc['params']['id']}})['then'](handleEntityNotFound(_0x5b457c,null))['then'](removeEntity(_0x5b457c,null))[_0x31b7('0x4d')](handleError(_0x5b457c,null));};exports[_0x31b7('0x5f')]=function(_0x5e64ef,_0x20c9b7){return db[_0x31b7('0x2f')][_0x31b7('0x5f')]()[_0x31b7('0x43')](respondWithResult(_0x20c9b7,null))[_0x31b7('0x4d')](handleError(_0x20c9b7,null));};exports[_0x31b7('0x60')]=function(_0x56df1b,_0x1ae6c6){var _0x22359e=_0x56df1b[_0x31b7('0x54')];return db['UserProfile'][_0x31b7('0x4c')]({'where':{'id':_0x56df1b['params']['id']}})[_0x31b7('0x43')](handleEntityNotFound(_0x1ae6c6,null))[_0x31b7('0x43')](function(_0x262333){if(_0x262333){return db[_0x31b7('0x55')][_0x31b7('0x56')](function(_0x169e40){return db['UserProfileSection'][_0x31b7('0x2a')]({'where':{'userProfileId':_0x56df1b['params']['id'],'sectionId':_[_0x31b7('0x34')](_0x22359e,function(_0x139b5c){return _0x139b5c[_0x31b7('0x5c')];})},'transaction':_0x169e40})[_0x31b7('0x43')](function(){var _0xd22f17=_[_0x31b7('0x34')](_0x22359e,function(_0x4c58be){_0x4c58be[_0x31b7('0x61')]=_0x56df1b[_0x31b7('0x49')]['id'];return _0x4c58be;});var _0x4e96bf=[];return BPromise['each'](_0xd22f17,function(_0x46bde0){return db[_0x31b7('0x58')]['create'](_0x46bde0,{'include':[{'model':db['UserProfileResource'],'as':_0x31b7('0x5d')}],'raw':!![],'transaction':_0x169e40})[_0x31b7('0x43')](function(_0x4b7ffe){_0x4e96bf[_0x31b7('0x62')](_0x4b7ffe[_0x31b7('0x57')]({'plain':!![]}));});})[_0x31b7('0x43')](function(){return _0x4e96bf;});});});}})[_0x31b7('0x43')](function(_0x2654ef){return _0x2654ef;})[_0x31b7('0x43')](respondWithResult(_0x1ae6c6,null))[_0x31b7('0x4d')](handleError(_0x1ae6c6,null));};exports[_0x31b7('0x63')]=function(_0x244407,_0x30048f){var _0x325865;return db[_0x31b7('0x2f')][_0x31b7('0x4c')]({'where':{'id':_0x244407[_0x31b7('0x49')]['id']},'attributes':['id',_0x31b7('0x2c')]})[_0x31b7('0x43')](handleEntityNotFound(_0x30048f,null))[_0x31b7('0x43')](function(_0x5c1767){if(_0x5c1767){_0x325865=_0x5c1767;return db['UserProfileSection'][_0x31b7('0x2a')]({'where':{'userProfileId':_0x244407[_0x31b7('0x49')]['id'],'sectionId':_0x244407[_0x31b7('0x35')][_0x31b7('0x64')]}});}})['then'](function(){return _0x325865;})[_0x31b7('0x43')](respondWithStatusCode(_0x30048f,null))[_0x31b7('0x4d')](handleError(_0x30048f,null));};exports['getSections']=function(_0x47a548,_0x5a894e){var _0x34d0cb=[];var _0x18e0a2=[];return db[_0x31b7('0x58')]['findAll']({'where':{'userProfileId':_0x47a548['params']['id']},'raw':!![]})[_0x31b7('0x43')](function(_0x46020e){_0x34d0cb=_[_0x31b7('0x41')](_0x46020e,function(_0x1014ec){return _0x1014ec['enabled']===0x1||_[_0x31b7('0x65')]([0x3eb,0x709],_0x1014ec[_0x31b7('0x5c')]);});if(!_[_0x31b7('0x66')](_0x34d0cb)){return _[_0x31b7('0x34')](_0x34d0cb,function(_0x2949c4){return _0x2949c4[_0x31b7('0x5c')];});}else{return;}})[_0x31b7('0x43')](function(_0xb1f61d){if(_0xb1f61d)_0x18e0a2=_0xb1f61d;if(_['includes'](_0x18e0a2,0x64)){var _0x52f1a6=_[_0x31b7('0x4c')](_0x34d0cb,{'sectionId':0x64});return hasDefaultDashboard(_0x52f1a6)[_0x31b7('0x43')](function(_0x41e4be){return _[_0x31b7('0x34')](_0x34d0cb,function(_0x3d196c){if(_0x3d196c[_0x31b7('0x5c')]===0x64){_0x3d196c[_0x31b7('0x67')]=_0x41e4be;}return _0x3d196c;});});}else{return;}})[_0x31b7('0x43')](function(_0x111c1c){if(_0x111c1c)_0x34d0cb=_0x111c1c;if(_[_0x31b7('0x65')](_0x18e0a2,0x3eb)){var _0x3409a2=_['find'](_0x34d0cb,{'sectionId':0x3eb});return getCustomDashboards(_0x3409a2)[_0x31b7('0x43')](function(_0x59e126){return _['map'](_0x34d0cb,function(_0x8c56e){if(_0x3409a2[_0x31b7('0x68')]){if(_0x8c56e[_0x31b7('0x5c')]===0x3eb){_0x8c56e[_0x31b7('0x67')]=_0x59e126;}}else{if(_0x8c56e['sectionId']===0x64){if(!_0x8c56e[_0x31b7('0x67')]){_0x8c56e[_0x31b7('0x67')]=[];}_0x8c56e[_0x31b7('0x67')]=_0x8c56e['subsections'][_0x31b7('0x69')](_0x59e126);}}return _0x8c56e;});});}else{return;}})['then'](function(_0x5eacc8){if(_0x5eacc8)_0x34d0cb=_0x5eacc8;if(_['includes'](_0x18e0a2,0x709)){var _0x448fc4=_[_0x31b7('0x4c')](_0x34d0cb,{'sectionId':0x709});return getPlugins(_0x448fc4)['then'](function(_0x34ab7a){if(_0x448fc4[_0x31b7('0x68')]){return _[_0x31b7('0x34')](_0x34d0cb,function(_0x554f47){if(_0x554f47[_0x31b7('0x5c')]===0x709){_0x554f47[_0x31b7('0x67')]=_0x34ab7a;}return _0x554f47;});}else{var _0x433d83={'sectionId':0x76c,'enabled':0x1,'subsections':_0x34ab7a};var _0x286152=_['map'](_0x34d0cb);_0x286152['push'](_0x433d83);return _0x286152;}});}else{return;}})[_0x31b7('0x43')](function(_0x4b5341){if(_0x4b5341)_0x34d0cb=_0x4b5341;return _[_0x31b7('0x41')](_0x34d0cb,[_0x31b7('0x68'),0x1]);})['then'](respondWithResult(_0x5a894e,null))[_0x31b7('0x4d')](handleError(_0x5a894e,null));};function hasDefaultDashboard(_0x34ca4a){var _0x298cc3=[0x65];return new BPromise(function(_0x30b21e,_0x56b33e){try{if(_0x34ca4a[_0x31b7('0x5a')]){_0x30b21e(_0x298cc3);}else{return db[_0x31b7('0x5b')]['findOne']({'where':{'sectionId':_0x34ca4a['id']},'raw':!![]})[_0x31b7('0x43')](function(_0x135462){_0x135462?_0x30b21e(_0x298cc3):_0x30b21e();});}}catch(_0x4a43a7){_0x56b33e(_0x4a43a7);}});}function getCustomDashboards(_0x303fda){var _0x467bfc=[];return new BPromise(function(_0x38e4da,_0xcec7d7){try{if(_0x303fda[_0x31b7('0x5a')]){return db[_0x31b7('0x6a')][_0x31b7('0x46')]({'raw':!![]})[_0x31b7('0x43')](function(_0x187d3d){_0x187d3d[_0x31b7('0x6b')](function(_0x1962f8){_0x467bfc['push'](_0x1962f8['id']+0x1869f);});_0x38e4da(_0x467bfc);});}else{return db[_0x31b7('0x5b')][_0x31b7('0x46')]({'where':{'sectionId':_0x303fda['id']},'raw':!![]})[_0x31b7('0x43')](function(_0x18ffd7){_0x18ffd7['forEach'](function(_0x37994a){_0x467bfc[_0x31b7('0x62')](_0x37994a[_0x31b7('0x6c')]+0x1869f);});_0x38e4da(_0x467bfc);});}}catch(_0x2835be){_0xcec7d7(_0x2835be);}});}function getPlugins(_0x54943e){var _0x232477=[];return new BPromise(function(_0x189ca4,_0x56d2cb){try{if(_0x54943e[_0x31b7('0x5a')]){return db[_0x31b7('0x6d')][_0x31b7('0x46')]({'raw':!![]})[_0x31b7('0x43')](function(_0x5a92a5){_0x5a92a5['forEach'](function(_0x18eb72){_0x232477['push'](_0x18eb72['id']+0x15b38);});_0x189ca4(_0x232477);});}else{return db[_0x31b7('0x5b')]['findAll']({'where':{'sectionId':_0x54943e['id']},'raw':!![]})['then'](function(_0x8fba7c){_0x8fba7c[_0x31b7('0x6b')](function(_0x5ebcc8){_0x232477[_0x31b7('0x62')](_0x5ebcc8[_0x31b7('0x6c')]+0x15b38);});_0x189ca4(_0x232477);});}}catch(_0x59764d){_0x56d2cb(_0x59764d);}});}exports[_0x31b7('0x6e')]=function(_0x1b5627,_0x254c66){return db[_0x31b7('0x2f')][_0x31b7('0x4c')]({'where':{'id':_0x1b5627[_0x31b7('0x49')]['id']}})[_0x31b7('0x43')](handleEntityNotFound(_0x254c66,null))[_0x31b7('0x43')](function(_0x357ede){if(_0x357ede){return db['sequelize'][_0x31b7('0x56')](function(_0x4b093b){return db[_0x31b7('0x58')][_0x31b7('0x46')]({'where':{'userProfileId':_0x1b5627[_0x31b7('0x49')]['id']},'attributes':['id'],'raw':!![]})[_0x31b7('0x43')](function(_0x2fd818){if(_0x2fd818){return db[_0x31b7('0x58')][_0x31b7('0x2a')]({'where':{'userProfileId':_0x1b5627[_0x31b7('0x49')]['id'],'id':_[_0x31b7('0x34')](_0x2fd818,function(_0x16f12b){return _0x16f12b['id'];})},'transaction':_0x4b093b});}})[_0x31b7('0x43')](function(_0x273634){var _0x197891=_['map'](_0x1b5627[_0x31b7('0x54')],function(_0x65a682){_0x65a682[_0x31b7('0x61')]=_0x1b5627[_0x31b7('0x49')]['id'];return _0x65a682;});return db[_0x31b7('0x58')][_0x31b7('0x6f')](_0x197891,{'raw':!![],'transaction':_0x4b093b});})['then'](function(_0x549dd9){var _0x7c87c2=_['filter'](_[_0x31b7('0x34')](_0x549dd9,function(_0xf80d23){return _0xf80d23[_0x31b7('0x57')]({'plain':!![]});}),{'includeAll':![]});if(_0x7c87c2){return db[_0x31b7('0x58')]['findAll']({'where':{'userProfileId':_0x1b5627['params']['id'],'sectionId':_[_0x31b7('0x34')](_0x7c87c2,function(_0x4e7ca8){return _0x4e7ca8[_0x31b7('0x5c')];})},'attributes':['id',_0x31b7('0x5c')],'raw':!![]})['then'](function(_0x2b484a){var _0x3c4d05=_[_0x31b7('0x34')](_0x1b5627[_0x31b7('0x54')],function(_0x50dc36){_0x50dc36[_0x31b7('0x61')]=_0x1b5627[_0x31b7('0x49')]['id'];return _0x50dc36;});return db['UserProfileResource']['bulkCreate'](_0x3c4d05,{'raw':!![],'transaction':_0x4b093b});});}})[_0x31b7('0x4d')](handleError(_0x254c66,null));});}})['then'](function(_0x56794e){var _0x3af0a5=_['map'](_0x56794e,function(_0x11c58e){return _0x11c58e['get']({'plain':!![]});});})[_0x31b7('0x43')](respondWithResult(_0x254c66,null))[_0x31b7('0x4d')](handleError(_0x254c66,null));};exports['removeResources']=function(_0x3a7ab,_0xd52920,_0x4b4347){return db[_0x31b7('0x2f')][_0x31b7('0x4c')]({'where':{'id':_0x3a7ab['params']['id']}})[_0x31b7('0x43')](handleEntityNotFound(_0xd52920,null))[_0x31b7('0x43')](function(_0x2b5574){if(_0x2b5574){return _0x2b5574['removeResources'](_0x3a7ab[_0x31b7('0x35')]['ids']);}})['then'](respondWithStatusCode(_0xd52920,null))[_0x31b7('0x4d')](handleError(_0xd52920,null));};exports[_0x31b7('0x70')]=function(_0xf915c7,_0x11866d){var _0x571a9d={};if(!_0xf915c7['query'][_0x31b7('0x71')])throw new Error(_0x31b7('0x72'));if(!_0xf915c7[_0x31b7('0x35')][_0x31b7('0x3b')](_0x31b7('0x73'))){_0x571a9d['limit']=qs[_0x31b7('0x24')](_0xf915c7[_0x31b7('0x35')][_0x31b7('0x24')]);_0x571a9d[_0x31b7('0x22')]=qs[_0x31b7('0x22')](_0xf915c7[_0x31b7('0x35')][_0x31b7('0x22')]);}return db['UserProfile'][_0x31b7('0x4c')]({'where':{'id':_0xf915c7[_0x31b7('0x49')]['id']}})[_0x31b7('0x43')](function(_0xb25daa){if(!_0xb25daa)throw new Error(_0x31b7('0x74')+_0xf915c7[_0x31b7('0x49')]['id']);return db['UserProfile'][_0x31b7('0x70')](_0xf915c7);})[_0x31b7('0x43')](respondWithFilteredResult(_0x11866d,_0x571a9d))[_0x31b7('0x4d')](handleError(_0x11866d,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index deef6f4..f7388dd 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 _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 +var _0xc1fc=['emit','hook','exports','../../mysqldb','UserProfile','save','update','remove'];(function(_0x23ff6d,_0x4f528c){var _0x31c7a6=function(_0x5af9ef){while(--_0x5af9ef){_0x23ff6d['push'](_0x23ff6d['shift']());}};_0x31c7a6(++_0x4f528c);}(_0xc1fc,0x93));var _0xcc1f=function(_0x50411c,_0xb85c64){_0x50411c=_0x50411c-0x0;var _0x217b72=_0xc1fc[_0x50411c];return _0x217b72;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0xcc1f('0x0'))['db'][_0xcc1f('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xcc1f('0x2'),'afterUpdate':_0xcc1f('0x3'),'afterDestroy':_0xcc1f('0x4')};function emitEvent(_0x3f57ea){return function(_0x26d3b2,_0x52703d,_0x42d563){UserProfileEvents[_0xcc1f('0x5')](_0x3f57ea+':'+_0x26d3b2['id'],_0x26d3b2);UserProfileEvents['emit'](_0x3f57ea,_0x26d3b2);_0x42d563(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0xcc1f('0x6')](e,emitEvent(event));}}module[_0xcc1f('0x7')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index ce9b41a..39363e0 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 _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 +var _0xc8c7=['zohoaccounts','ZohoAccount','CannedAnswer','dispositions','Disposition','Dashboard','intervals','Interval','pauses','scheduler','Schedule','sounds','Sound','Tag','templates','Template','triggers','Trigger','trunks','Trunk','variables','Variable','Plugin','Reports','metrics','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','ui.','InteractionId','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','UserProfile','section','mergeResources','isEmpty','length','push','UserProfileSection','find','params','all','union','ignore','autoAssociation','model','rawAttributes','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','pick','merge','key','VIRTUAL','foreignKey','forEach','options','includeAll','include','reportType','reportId','DefaultReports','CustomReports','count','ids','customSorting','extraQueryConditions','Tags','tag','ThroughTags','color','rows','openTabs','dataValues','sms','fax','openchannel','whatsapp','lodash','./userProfile.attributes','exports','models','filter','field','value','then','findAll','associatedResources','catch','resolve','map','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','name','projectName','projects','JscriptyProject','CmContact','Lists','ListId','CmList','globalcustomfields','chatqueues','ChatQueue','chatwebsites','ChatWebsite','FaxQueue','faxaccounts','FaxAccount','inboundroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','voicerecordings','VoiceRecording','Agents','membername','agent','Telephones','role','telephone','VoiceQueues','VoiceQueue','QueueCampaigns','queue','outbound','musiconholds','VoiceMusicOnHold','chanspies','voiceprefixes','VoicePrefix','mailqueues','MailQueue','mailaccounts','MailAccount','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsaccounts','SmsAccount','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','queuecampaigns','agents','telephones','User','admin','zendeskaccounts','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','SugarcrmAccount','DeskAccount'];(function(_0x1f31cb,_0x49ed49){var _0x188f8d=function(_0x27c5fd){while(--_0x27c5fd){_0x1f31cb['push'](_0x1f31cb['shift']());}};_0x188f8d(++_0x49ed49);}(_0xc8c7,0x11a));var _0x7c8c=function(_0x34eeea,_0x5c037a){_0x34eeea=_0x34eeea-0x0;var _0x1e8596=_0xc8c7[_0x34eeea];return _0x1e8596;};'use strict';var _=require(_0x7c8c('0x0'));var attributes=require(_0x7c8c('0x1'));var squel=require('squel');module[_0x7c8c('0x2')]=function(_0x2e8739){var _0x2af804=_0x2e8739[_0x7c8c('0x3')];function _0x20aa4c(_0x19be45,_0x28dc95){return new Promise(function(_0x3ff5e9,_0x1b648a){if(!_0x28dc95)return _0x3ff5e9(null);var _0x59b39b=_0x28dc95['filter']?{[_0x28dc95[_0x7c8c('0x4')][_0x7c8c('0x5')]]:_0x28dc95[_0x7c8c('0x4')][_0x7c8c('0x6')]}:undefined;return _0x2af804[_0x19be45]['findAll']({'where':_0x59b39b,'raw':!![]})[_0x7c8c('0x7')](function(_0x3baf22){_0x28dc95['associatedResources']=_['map'](_0x3baf22,'id');_0x3ff5e9(_0x28dc95);})['catch'](function(_0x1bbdab){_0x1b648a(_0x1bbdab);});});}function _0x55cdf0(_0x494834,_0x5a577c){return new Promise(function(_0x359e34,_0x431318){var _0x1bb9db=_0x494834[_0x7c8c('0x4')]?{[_0x494834[_0x7c8c('0x4')]['field']]:_0x494834[_0x7c8c('0x4')][_0x7c8c('0x6')]}:undefined;return _0x2af804[_0x494834['model']][_0x7c8c('0x8')]({'where':_0x1bb9db,'raw':!![]})[_0x7c8c('0x7')](function(_0x49c6f1){_0x5a577c[_0x7c8c('0x9')]=_['map'](_0x49c6f1,function(_0x2d8248){return _0x2d8248['name'];});_0x359e34(_0x5a577c);})[_0x7c8c('0xa')](function(_0x96ff3f){_0x431318(_0x96ff3f);});});}function _0x5b17a3(_0x158190,_0x1a34ab,_0x45da1f){if(!_0x1a34ab)return Promise[_0x7c8c('0xb')](null);return new Promise(function(_0x33aa19,_0x3a9194){return _0x2af804['UserProfileResource'][_0x7c8c('0x8')]({'where':{'sectionId':_0x1a34ab['id']},'raw':!![]})['then'](function(_0x8d000){if(_0x158190[_0x7c8c('0x5')]&&_0x158190[_0x7c8c('0x5')]!=='id'){_0x1a34ab[_0x7c8c('0x9')]=_[_0x7c8c('0xc')](_0x8d000,function(_0x5c28fa){return _0x5c28fa[_0x158190[_0x7c8c('0x5')]];});}else{if(_0x45da1f===_0x7c8c('0xd')){_0x1a34ab[_0x7c8c('0x9')]=_[_0x7c8c('0xc')](_0x8d000,function(_0x31921e){return{'id':_0x31921e[_0x7c8c('0xe')],'type':_0x31921e[_0x7c8c('0xf')]};});}else{_0x1a34ab[_0x7c8c('0x9')]=_[_0x7c8c('0xc')](_0x8d000,function(_0x456a06){return _0x456a06[_0x7c8c('0xe')];});}}_0x33aa19(_0x1a34ab);})[_0x7c8c('0xa')](function(_0x8764b9){_0x3a9194(_0x8764b9);});});}function _0x58e710(_0x4d750c,_0xa7d234){var _0x103b46={'parentSections':[]};switch(_0x4d750c[_0x7c8c('0x10')]()){case _0x7c8c('0x11'):_0x103b46[_0x7c8c('0x12')]=_0x7c8c('0x13');break;case'odbc':_0x103b46[_0x7c8c('0x12')]=_0x7c8c('0x14');break;case _0x7c8c('0x15'):_0x103b46[_0x7c8c('0x12')]=_0x7c8c('0x16');_0x103b46[_0x7c8c('0x17')]=[{'name':_0x7c8c('0x18'),'field':_0x7c8c('0x19'),'foreignKey':_0x7c8c('0x1a')}];break;case _0x7c8c('0x1b'):_0x103b46[_0x7c8c('0x12')]=_0x7c8c('0x1c');break;case'contacts':_0x103b46[_0x7c8c('0x12')]=_0x7c8c('0x1d');_0x103b46[_0x7c8c('0x17')]=[{'name':_0x7c8c('0x1e'),'field':'id','foreignKey':_0x7c8c('0x1f')}];break;case'lists':_0x103b46[_0x7c8c('0x12')]=_0x7c8c('0x20');break;case'companies':_0x103b46[_0x7c8c('0x12')]='CmCompany';break;case _0x7c8c('0x21'):_0x103b46[_0x7c8c('0x12')]='CmCustomField';break;case _0x7c8c('0x22'):_0x103b46[_0x7c8c('0x12')]=_0x7c8c('0x23');break;case _0x7c8c('0x24'):_0x103b46['childModel']=_0x7c8c('0x25');break;case'faxqueues':_0x103b46[_0x7c8c('0x12')]=_0x7c8c('0x26');break;case _0x7c8c('0x27'):_0x103b46[_0x7c8c('0x12')]=_0x7c8c('0x28');break;case _0x7c8c('0x29'):case'internalroutes':case _0x7c8c('0x2a'):_0x103b46[_0x7c8c('0x12')]=_0x7c8c('0x2b');break;case _0x7c8c('0x2c'):_0x103b46[_0x7c8c('0x12')]=_0x7c8c('0x2d');break;case _0x7c8c('0x2e'):_0x103b46[_0x7c8c('0x12')]='VoiceMail';break;case _0x7c8c('0x2f'):_0x103b46[_0x7c8c('0x12')]=_0x7c8c('0x30');_0x103b46[_0x7c8c('0x17')]=[{'name':_0x7c8c('0x31'),'field':_0x7c8c('0x19'),'foreignKey':_0x7c8c('0x32'),'model':'User','filter':{'field':'role','value':[_0x7c8c('0x33')]}},{'name':_0x7c8c('0x34'),'field':'name','foreignKey':'membername','model':'User','filter':{'field':_0x7c8c('0x35'),'value':[_0x7c8c('0x36')]}},{'name':_0x7c8c('0x37'),'field':_0x7c8c('0x19'),'foreignKey':'queue','model':_0x7c8c('0x38'),'filter':{'field':_0x7c8c('0xf'),'value':['inbound']}},{'name':_0x7c8c('0x39'),'field':'name','foreignKey':_0x7c8c('0x3a'),'model':_0x7c8c('0x38'),'filter':{'field':_0x7c8c('0xf'),'value':[_0x7c8c('0x3b')]}}];break;case _0x7c8c('0x3c'):_0x103b46[_0x7c8c('0x12')]=_0x7c8c('0x3d');break;case _0x7c8c('0x3e'):_0x103b46[_0x7c8c('0x12')]='VoiceChanSpy';break;case _0x7c8c('0x3f'):_0x103b46[_0x7c8c('0x12')]=_0x7c8c('0x40');break;case'ivrcampaigns':_0x103b46[_0x7c8c('0x12')]='Campaign';break;case _0x7c8c('0x41'):_0x103b46[_0x7c8c('0x12')]=_0x7c8c('0x42');break;case _0x7c8c('0x43'):_0x103b46[_0x7c8c('0x12')]=_0x7c8c('0x44');break;case'mailsubstatuses':_0x103b46['childModel']='MailSubstatus';break;case'openchannelqueues':_0x103b46[_0x7c8c('0x12')]=_0x7c8c('0x45');break;case _0x7c8c('0x46'):_0x103b46[_0x7c8c('0x12')]=_0x7c8c('0x47');break;case'smsqueues':_0x103b46[_0x7c8c('0x12')]='SmsQueue';break;case _0x7c8c('0x48'):_0x103b46[_0x7c8c('0x12')]=_0x7c8c('0x49');break;case'whatsappqueues':_0x103b46[_0x7c8c('0x12')]=_0x7c8c('0x4a');break;case _0x7c8c('0x4b'):_0x103b46['childModel']=_0x7c8c('0x4c');break;case _0x7c8c('0x4d'):_0x103b46[_0x7c8c('0x12')]='Team';break;case'voicequeues':case _0x7c8c('0x4e'):_0x103b46[_0x7c8c('0x12')]=_0x7c8c('0x38');if(_0xa7d234){_0x103b46[_0x7c8c('0x17')]=[{'name':_0x7c8c('0x37')},{'name':_0x7c8c('0x39')}];}break;case'users':case _0x7c8c('0x4f'):case _0x7c8c('0x50'):_0x103b46[_0x7c8c('0x12')]=_0x7c8c('0x51');if(_0xa7d234){_0x103b46[_0x7c8c('0x17')]=[{'name':'Users','filter':{'field':_0x7c8c('0x35'),'value':[_0x7c8c('0x52'),'user']},'ignore':!![]},{'name':_0x7c8c('0x31')},{'name':'Telephones'}];}break;case _0x7c8c('0x53'):_0x103b46[_0x7c8c('0x12')]='ZendeskAccount';break;case _0x7c8c('0x54'):_0x103b46[_0x7c8c('0x12')]=_0x7c8c('0x55');break;case _0x7c8c('0x56'):_0x103b46[_0x7c8c('0x12')]=_0x7c8c('0x57');break;case'sugarcrmaccounts':_0x103b46[_0x7c8c('0x12')]=_0x7c8c('0x58');break;case'deskaccounts':_0x103b46[_0x7c8c('0x12')]=_0x7c8c('0x59');break;case _0x7c8c('0x5a'):_0x103b46[_0x7c8c('0x12')]=_0x7c8c('0x5b');break;case'vtigeraccounts':_0x103b46[_0x7c8c('0x12')]=_0x7c8c('0x51');break;case'cannedanswers':_0x103b46[_0x7c8c('0x12')]=_0x7c8c('0x5c');break;case _0x7c8c('0x5d'):_0x103b46[_0x7c8c('0x12')]=_0x7c8c('0x5e');break;case'customdashboards':_0x103b46[_0x7c8c('0x12')]=_0x7c8c('0x5f');break;case _0x7c8c('0x60'):_0x103b46['childModel']=_0x7c8c('0x61');break;case _0x7c8c('0x62'):_0x103b46[_0x7c8c('0x12')]='Pause';break;case _0x7c8c('0x63'):_0x103b46[_0x7c8c('0x12')]=_0x7c8c('0x64');break;case _0x7c8c('0x65'):_0x103b46[_0x7c8c('0x12')]=_0x7c8c('0x66');break;case'tags':_0x103b46[_0x7c8c('0x12')]=_0x7c8c('0x67');break;case _0x7c8c('0x68'):_0x103b46[_0x7c8c('0x12')]=_0x7c8c('0x69');break;case _0x7c8c('0x6a'):_0x103b46['childModel']=_0x7c8c('0x6b');break;case _0x7c8c('0x6c'):_0x103b46[_0x7c8c('0x12')]=_0x7c8c('0x6d');break;case _0x7c8c('0x6e'):_0x103b46[_0x7c8c('0x12')]=_0x7c8c('0x6f');break;case'plugins':_0x103b46[_0x7c8c('0x12')]=_0x7c8c('0x70');break;case'extractedreports':_0x103b46[_0x7c8c('0x12')]='AnalyticExtractedReport';_0x103b46[_0x7c8c('0x17')]=[{'name':_0x7c8c('0x71'),'field':'id','foreignKey':'reportId'}];break;case _0x7c8c('0x72'):_0x103b46[_0x7c8c('0x12')]=_0x7c8c('0x73');break;}return _0x103b46;}function _0x94a8d9(_0x3111ca,_0x520e91){var _0x895419=_0x3111ca[_0x7c8c('0x74')](0x0)[_0x7c8c('0x75')]()+_0x3111ca[_0x7c8c('0x76')](0x1);var _0x11cb25={'type':_0x2af804[_0x7c8c('0x77')]['QueryTypes']['SELECT'],'raw':!![]};return new Promise(function(_0x144df7,_0xae4abd){var _0x344fe5=squel['select']()[_0x7c8c('0x5')](_0x7c8c('0x78')+_0x895419+_0x7c8c('0x79'),'id')[_0x7c8c('0x5')]('ui.createdAt')[_0x7c8c('0x7a')](_0x7c8c('0x7b')+_0x3111ca+_0x7c8c('0x7c'),'ui')[_0x7c8c('0x7d')](_0x7c8c('0x7e'),_0x520e91['id']);return _0x2af804[_0x7c8c('0x7f')][_0x7c8c('0x80')](_0x344fe5[_0x7c8c('0x81')](),_0x11cb25)[_0x7c8c('0x7')](function(_0x258c20){_0x520e91[_0x895419+_0x7c8c('0x82')]=_0x258c20;_0x144df7(_0x258c20);})[_0x7c8c('0xa')](function(_0x1b178a){_0xae4abd(_0x1b178a);});});}return _0x2e8739[_0x7c8c('0x83')](_0x7c8c('0x84'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0xf6d0){var _0xd7b4ca=require('../../components/parsers/qs');var _0x5e581f={'raw':_0xf6d0[_0x7c8c('0x80')]['raw'],'where':{}};var _0x736e71={};var _0x3e41e9={'count':0x0,'rows':[]};var _0x3094b0=_0xf6d0[_0x7c8c('0x80')][_0x7c8c('0x85')];var _0x42869e=_0xf6d0[_0x7c8c('0x80')][_0x7c8c('0x86')]||![];var _0x4f5625=_0x58e710(_0x3094b0,_0x42869e);if(!_0x4f5625['childModel'])throw new Error('Invalid\x20section\x20\x27'+_0x3094b0+'\x27');var _0x32ab6b=[{'name':_0x3094b0}];if(!_[_0x7c8c('0x87')](_0x4f5625[_0x7c8c('0x17')]))_0x32ab6b=_0x4f5625['parentSections'];var _0x25469c=[];for(var _0x53b453=0x0;_0x53b453<_0x32ab6b[_0x7c8c('0x88')];_0x53b453++){_0x25469c[_0x7c8c('0x89')](_0x2af804[_0x7c8c('0x8a')][_0x7c8c('0x8b')]({'where':{'userProfileId':_0xf6d0[_0x7c8c('0x8c')]['id'],'name':_0x32ab6b[_0x53b453][_0x7c8c('0x19')]},'raw':!![]}));}return Promise[_0x7c8c('0x8d')](_0x25469c)[_0x7c8c('0x7')](function(_0x4ca834){var _0x12688c=_[_0x7c8c('0x4')](_0x4ca834,function(_0x8faec2){return _0x8faec2?_0x8faec2:undefined;});var _0x3bcd0f=_[_0x7c8c('0x4')](_0x32ab6b,['ignore',!![]]);var _0x44d950=_['isEmpty'](_0x12688c)&&_['isEmpty'](_0x3bcd0f)?null:_[_0x7c8c('0x8e')](_0x3bcd0f,_0x12688c);if(!_0x44d950)return null;var _0x1acbd9=[];for(var _0x21c420=0x0;_0x21c420<_0x44d950[_0x7c8c('0x88')];_0x21c420++){var _0x1556f4=_['find'](_0x32ab6b,function(_0x2e9aa9){return _0x44d950[_0x21c420]?_0x2e9aa9[_0x7c8c('0x19')]===_0x44d950[_0x21c420]['name']:null;});if(_0x1556f4){if(_0x44d950[_0x21c420][_0x7c8c('0x8f')]){_0x1acbd9[_0x7c8c('0x89')](_0x20aa4c(_0x4f5625[_0x7c8c('0x12')],_0x44d950[_0x21c420]));}else{if(!_0x44d950[_0x21c420][_0x7c8c('0x90')]){_0x1acbd9[_0x7c8c('0x89')](_0x5b17a3(_0x1556f4,_0x44d950[_0x21c420],_0x4f5625[_0x7c8c('0x12')]));}else{if(_0x1556f4[_0x7c8c('0x91')]){_0x1acbd9['push'](_0x55cdf0(_0x1556f4,_0x44d950[_0x21c420]));}}}}}return Promise[_0x7c8c('0x8d')](_0x1acbd9);})[_0x7c8c('0x7')](function(_0x2a432e){var _0x6d4f2b=_0x2a432e;var _0x249780=null;if(_0x6d4f2b){_0x249780=_0x6d4f2b[_0x7c8c('0x88')]===0x1?_0x6d4f2b[0x0]:null;}if(!_0x249780&&!_0x6d4f2b)return _0x3e41e9;var _0x3f4944=_0x2af804[_0x4f5625[_0x7c8c('0x12')]][_0x7c8c('0x92')];_0x736e71[_0x7c8c('0x91')]=_[_0x7c8c('0x93')](_0x3f4944);_0x736e71['query']=_[_0x7c8c('0x93')](_0xf6d0[_0x7c8c('0x80')]);_0x736e71[_0x7c8c('0x94')]=_[_0x7c8c('0x95')](_0x736e71[_0x7c8c('0x91')],_0x736e71[_0x7c8c('0x80')]);_0x5e581f[_0x7c8c('0x96')]=_['intersection'](_0x736e71['model'],_0xd7b4ca[_0x7c8c('0x97')](_0xf6d0[_0x7c8c('0x80')][_0x7c8c('0x97')]));_0x5e581f['attributes']=_0x5e581f[_0x7c8c('0x96')][_0x7c8c('0x88')]?_0x5e581f['attributes']:_0x736e71[_0x7c8c('0x91')];if(!_0xf6d0[_0x7c8c('0x80')][_0x7c8c('0x98')](_0x7c8c('0x99'))){_0x5e581f[_0x7c8c('0x9a')]=_0xd7b4ca['limit'](_0xf6d0[_0x7c8c('0x80')][_0x7c8c('0x9a')]);_0x5e581f[_0x7c8c('0x9b')]=_0xd7b4ca[_0x7c8c('0x9b')](_0xf6d0[_0x7c8c('0x80')]['offset']);}_0x5e581f[_0x7c8c('0x9c')]=_0xd7b4ca[_0x7c8c('0x9d')](_0xf6d0[_0x7c8c('0x80')][_0x7c8c('0x9d')]);_0x5e581f[_0x7c8c('0x7d')]=_0xd7b4ca['filters'](_[_0x7c8c('0x9e')](_0xf6d0[_0x7c8c('0x80')],_0x736e71[_0x7c8c('0x94')]));if(_0xf6d0['query']['filter']){_0x5e581f[_0x7c8c('0x7d')]=_[_0x7c8c('0x9f')](_0x5e581f[_0x7c8c('0x7d')],{'$or':_[_0x7c8c('0xc')](_0x3f4944,function(_0x4cdd51){if(_0x4cdd51[_0x7c8c('0xf')][_0x7c8c('0xa0')]!==_0x7c8c('0xa1')){var _0x484dbb={};_0x484dbb[_0x4cdd51[_0x7c8c('0x5')]]={'$like':'%'+_0xf6d0['query'][_0x7c8c('0x4')]+'%'};return _0x484dbb;}})});}var _0x26b25e=[];var _0x1317ed=null;var _0x56cc8c={};if(_0x249780){_0x1317ed=_[_0x7c8c('0x8b')](_0x32ab6b,['name',_0x249780['name']]);if(_0x1317ed[_0x7c8c('0x5')]){_0x56cc8c={};if(_0x4f5625['childModel']===_0x7c8c('0xd')){_0x56cc8c[_0x1317ed[_0x7c8c('0xa2')]]=_['map'](_0x249780[_0x7c8c('0x9')],'id');}else{_0x56cc8c[_0x1317ed[_0x7c8c('0xa2')]]=_0x249780[_0x7c8c('0x9')];}_0x26b25e[_0x7c8c('0x89')](_0x56cc8c);}else{_0x5e581f[_0x7c8c('0x7d')]['id']=_0x249780['associatedResources'];}}else{for(var _0x392b15=0x0;_0x392b15<_0x6d4f2b[_0x7c8c('0x88')];_0x392b15++){_0x1317ed=_['find'](_0x32ab6b,['name',_0x6d4f2b[_0x392b15][_0x7c8c('0x19')]]);if(_0x1317ed['field']){_0x56cc8c={};_0x56cc8c[_0x1317ed[_0x7c8c('0xa2')]]=_0x6d4f2b[_0x392b15][_0x7c8c('0x9')];_0x26b25e[_0x7c8c('0x89')](_0x56cc8c);}else{if(!_0x5e581f[_0x7c8c('0x7d')]['id'])_0x5e581f[_0x7c8c('0x7d')]['id']=[];_0x6d4f2b[_0x392b15][_0x7c8c('0x9')][_0x7c8c('0xa3')](function(_0x472abe){_0x5e581f[_0x7c8c('0x7d')]['id'][_0x7c8c('0x89')](_0x472abe);});}}}if(!_[_0x7c8c('0x87')](_0x26b25e)){_0x5e581f[_0x7c8c('0x7d')]=_[_0x7c8c('0x9f')](_0x5e581f[_0x7c8c('0x7d')],{'$and':{'$or':_0x26b25e}});}_0x5e581f=_[_0x7c8c('0x9f')]({},_0x5e581f,_0xf6d0[_0x7c8c('0xa4')]);if(_0x249780&&!_0x249780[_0x7c8c('0x90')]&&_0x4f5625[_0x7c8c('0x12')]===_0x7c8c('0xd')){if(_0xf6d0[_0x7c8c('0x80')][_0x7c8c('0xa5')]){_0x5e581f[_0x7c8c('0xa6')]=[{'all':!![]}];}return _0x2af804[_0x4f5625[_0x7c8c('0x12')]][_0x7c8c('0x8')](_0x5e581f)[_0x7c8c('0x7')](function(_0x3f243d){var _0x2931d8=[];_0x3f243d[_0x7c8c('0xa3')](function(_0x2b27be){var _0x32f6d4;switch(_0x2b27be[_0x7c8c('0xa7')]){case'default':_0x32f6d4=_[_0x7c8c('0x8b')](_0x249780['associatedResources'],function(_0x40e445){return _0x40e445['id']===_0x2b27be[_0x7c8c('0xa8')]&&_0x40e445[_0x7c8c('0xf')]===_0x7c8c('0xa9');});break;case'custom':_0x32f6d4=_['find'](_0x249780[_0x7c8c('0x9')],function(_0x2820ab){return _0x2820ab['id']===_0x2b27be[_0x7c8c('0xa8')]&&_0x2820ab[_0x7c8c('0xf')]===_0x7c8c('0xaa');});break;}if(_0x32f6d4)_0x2931d8[_0x7c8c('0x89')](_0x2b27be);});_0x3e41e9[_0x7c8c('0xab')]=_0x2931d8[_0x7c8c('0x88')];_0x3e41e9['rows']=_0x2931d8;return _0x3e41e9;});}else{if(!_[_0x7c8c('0x87')](_0xf6d0[_0x7c8c('0x80')][_0x7c8c('0xac')])){_0x5e581f[_0x7c8c('0x7d')]['id']=_0x5e581f['where']['id']?_['intersection'](_0x5e581f[_0x7c8c('0x7d')]['id'],_0xf6d0[_0x7c8c('0x80')][_0x7c8c('0xac')]):_0xf6d0['query'][_0x7c8c('0xac')];if(_0xf6d0[_0x7c8c('0x80')][_0x7c8c('0xad')]){_0x5e581f[_0x7c8c('0x9c')]=_0xf6d0[_0x7c8c('0x80')]['customSorting'];}}if(_0xf6d0['query'][_0x7c8c('0xae')]){_0x5e581f[_0x7c8c('0x7d')]=_[_0x7c8c('0x9f')](_0x5e581f[_0x7c8c('0x7d')],{'$and':_0xf6d0['query'][_0x7c8c('0xae')]});}return _0x2af804[_0x4f5625[_0x7c8c('0x12')]][_0x7c8c('0xab')]({'where':_0x5e581f[_0x7c8c('0x7d')]})[_0x7c8c('0x7')](function(_0x40b029){_0x3e41e9[_0x7c8c('0xab')]=_0x40b029;if(_0xf6d0[_0x7c8c('0x80')][_0x7c8c('0xa5')]){if(_0x4f5625['childModel']==='CmContact'){_0x5e581f[_0x7c8c('0xa6')]=[{'model':_0x2af804[_0x7c8c('0x67')],'as':_0x7c8c('0xaf'),'attributes':['id',_0x7c8c('0x19'),'color'],'required':_0xf6d0[_0x7c8c('0x80')][_0x7c8c('0xb0')]?!![]:![]},{'model':_0x2af804[_0x7c8c('0x67')],'as':_0x7c8c('0xb1'),'attributes':['id',_0x7c8c('0x19'),_0x7c8c('0xb2')],'through':_0xf6d0[_0x7c8c('0x80')][_0x7c8c('0xb0')]?{'attributes':[],'where':{'TagId':_0xf6d0[_0x7c8c('0x80')][_0x7c8c('0xb0')]||undefined}}:{},'required':_0xf6d0[_0x7c8c('0x80')][_0x7c8c('0xb0')]?!![]:![]}];}else{_0x5e581f['include']=[{'all':!![]}];}}return _0x2af804[_0x4f5625['childModel']][_0x7c8c('0x8')](_0x5e581f);})[_0x7c8c('0x7')](function(_0x2e7cae){_0x3e41e9[_0x7c8c('0xb3')]=_0x2e7cae;if(_0x3094b0===_0x7c8c('0x31')&&_0xf6d0[_0x7c8c('0x80')][_0x7c8c('0xb4')]==='true'){var _0x599f8f=[];for(var _0x572f16=0x0;_0x572f16<_0x3e41e9[_0x7c8c('0xb3')]['length'];_0x572f16++){_0x599f8f[_0x7c8c('0x89')](_0x94a8d9('chat',_0x3e41e9['rows'][_0x572f16][_0x7c8c('0xb5')]));_0x599f8f['push'](_0x94a8d9(_0x7c8c('0xb6'),_0x3e41e9['rows'][_0x572f16][_0x7c8c('0xb5')]));_0x599f8f['push'](_0x94a8d9(_0x7c8c('0xb7'),_0x3e41e9['rows'][_0x572f16][_0x7c8c('0xb5')]));_0x599f8f[_0x7c8c('0x89')](_0x94a8d9('mail',_0x3e41e9[_0x7c8c('0xb3')][_0x572f16][_0x7c8c('0xb5')]));_0x599f8f[_0x7c8c('0x89')](_0x94a8d9(_0x7c8c('0xb8'),_0x3e41e9[_0x7c8c('0xb3')][_0x572f16][_0x7c8c('0xb5')]));_0x599f8f['push'](_0x94a8d9(_0x7c8c('0xb9'),_0x3e41e9[_0x7c8c('0xb3')][_0x572f16][_0x7c8c('0xb5')]));}return Promise[_0x7c8c('0x8d')](_0x599f8f)[_0x7c8c('0x7')](function(){return _0x3e41e9;});}return _0x3e41e9;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index d6536a2..2258f88 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 _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 +var _0x7b84=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x55bbab,_0xbf139e){var _0x3a6eec=function(_0x4e9bd9){while(--_0x4e9bd9){_0x55bbab['push'](_0x55bbab['shift']());}};_0x3a6eec(++_0xbf139e);}(_0x7b84,0x17c));var _0x47b8=function(_0x4b7150,_0x5c23df){_0x4b7150=_0x4b7150-0x0;var _0x298641=_0x7b84[_0x4b7150];return _0x298641;};'use strict';var _=require(_0x47b8('0x0'));var util=require(_0x47b8('0x1'));var moment=require(_0x47b8('0x2'));var BPromise=require(_0x47b8('0x3'));var rs=require(_0x47b8('0x4'));var fs=require('fs');var Redis=require(_0x47b8('0x5'));var db=require(_0x47b8('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x47b8('0x7'))(_0x47b8('0x8'));var config=require(_0x47b8('0x9'));var jayson=require(_0x47b8('0xa'));var client=jayson[_0x47b8('0xb')][_0x47b8('0xc')]({'port':0x232a});config['redis']=_[_0x47b8('0xd')](config[_0x47b8('0xe')],{'host':_0x47b8('0xf'),'port':0x18eb});var socket=require(_0x47b8('0x10'))(new Redis(config[_0x47b8('0xe')]));require(_0x47b8('0x11'))[_0x47b8('0x12')](socket);function respondWithRpcPromise(_0x4570d4,_0x9414c2,_0x429262){return new BPromise(function(_0x289f98,_0x1a0a6a){return client[_0x47b8('0x13')](_0x4570d4,_0x429262)[_0x47b8('0x14')](function(_0x3e255e){logger[_0x47b8('0x15')](_0x47b8('0x16'),_0x9414c2,_0x47b8('0x17'));logger[_0x47b8('0x18')](_0x47b8('0x19'),_0x9414c2,_0x47b8('0x17'),JSON[_0x47b8('0x1a')](_0x3e255e));if(_0x3e255e[_0x47b8('0x1b')]){if(_0x3e255e[_0x47b8('0x1b')][_0x47b8('0x1c')]===0x1f4){logger[_0x47b8('0x1b')](_0x47b8('0x16'),_0x9414c2,_0x3e255e['error'][_0x47b8('0x1d')]);return _0x1a0a6a(_0x3e255e[_0x47b8('0x1b')][_0x47b8('0x1d')]);}logger[_0x47b8('0x1b')](_0x47b8('0x16'),_0x9414c2,_0x3e255e[_0x47b8('0x1b')][_0x47b8('0x1d')]);return _0x289f98(_0x3e255e['error'][_0x47b8('0x1d')]);}else{logger['info']('UserProfile,\x20%s,\x20%s',_0x9414c2,'request\x20sent');_0x289f98(_0x3e255e[_0x47b8('0x1e')][_0x47b8('0x1d')]);}})[_0x47b8('0x1f')](function(_0x5b3e8e){logger['error']('UserProfile,\x20%s,\x20%s',_0x9414c2,_0x5b3e8e);_0x1a0a6a(_0x5b3e8e);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 5dc7e96..4fadf53 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 _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 +var _0x63fb=['register','length','userProfile:','./userProfile.events','remove','update','emit','removeListener'];(function(_0xc8a931,_0x260690){var _0x28bd27=function(_0x591b9f){while(--_0x591b9f){_0xc8a931['push'](_0xc8a931['shift']());}};_0x28bd27(++_0x260690);}(_0x63fb,0x193));var _0xb63f=function(_0x3a53f2,_0x2e5f6f){_0x3a53f2=_0x3a53f2-0x0;var _0x1033bf=_0x63fb[_0x3a53f2];return _0x1033bf;};'use strict';var UserProfileEvents=require(_0xb63f('0x0'));var events=['save',_0xb63f('0x1'),_0xb63f('0x2')];function createListener(_0x4b2556,_0x30138a){return function(_0x5c87c7){_0x30138a[_0xb63f('0x3')](_0x4b2556,_0x5c87c7);};}function removeListener(_0x40a6fb,_0x246a9b){return function(){UserProfileEvents[_0xb63f('0x4')](_0x40a6fb,_0x246a9b);};}exports[_0xb63f('0x5')]=function(_0x5ac33b){for(var _0x199f2d=0x0,_0x1454ee=events[_0xb63f('0x6')];_0x199f2d<_0x1454ee;_0x199f2d++){var _0x5b6c8b=events[_0x199f2d];var _0x536908=createListener(_0xb63f('0x7')+_0x5b6c8b,_0x5ac33b);UserProfileEvents['on'](_0x5b6c8b,_0x536908);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index ff73fde..f2c790a 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 _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 +var _0x89e8=['delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe','describe','/:id','show','post','create'];(function(_0x37d62b,_0x152b4e){var _0x1186f0=function(_0x56f31e){while(--_0x56f31e){_0x37d62b['push'](_0x37d62b['shift']());}};_0x1186f0(++_0x152b4e);}(_0x89e8,0x74));var _0x889e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x89e8[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0x889e('0x0'));var util=require(_0x889e('0x1'));var path=require(_0x889e('0x2'));var timeout=require(_0x889e('0x3'));var express=require(_0x889e('0x4'));var router=express[_0x889e('0x5')]();var fs_extra=require(_0x889e('0x6'));var auth=require(_0x889e('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./userProfileResource.controller');router[_0x889e('0x8')]('/',auth[_0x889e('0x9')](),controller[_0x889e('0xa')]);router['get'](_0x889e('0xb'),auth['isAuthenticated'](),controller[_0x889e('0xc')]);router[_0x889e('0x8')](_0x889e('0xd'),auth['isAuthenticated'](),controller[_0x889e('0xe')]);router[_0x889e('0xf')]('/',auth[_0x889e('0x9')](),controller[_0x889e('0x10')]);router['put'](_0x889e('0xd'),auth[_0x889e('0x9')](),controller['update']);router[_0x889e('0x11')](_0x889e('0xd'),auth[_0x889e('0x9')](),controller[_0x889e('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index a6273bb..99ab158 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 _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 +var _0x4069=['STRING','INTEGER','exports'];(function(_0x14849c,_0x6ba88f){var _0x5ca1c0=function(_0x787e76){while(--_0x787e76){_0x14849c['push'](_0x14849c['shift']());}};_0x5ca1c0(++_0x6ba88f);}(_0x4069,0x6e));var _0x9406=function(_0x501f89,_0x2e5907){_0x501f89=_0x501f89-0x0;var _0x30d916=_0x4069[_0x501f89];return _0x30d916;};'use strict';var Sequelize=require('sequelize');module[_0x9406('0x0')]={'name':{'type':Sequelize[_0x9406('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x9406('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 ca3574c..cc76ecc 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 _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 +var _0x896e=['hasOwnProperty','nolimit','order','sort','where','merge','filter','UserProfileResource','includeAll','include','findAll','rows','catch','keys','length','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','destroy','then','end','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0x896e,0x1e9));var _0xe896=function(_0x4a7a12,_0x24b5bf){_0x4a7a12=_0x4a7a12-0x0;var _0x8d2bc5=_0x896e[_0x4a7a12];return _0x8d2bc5;};'use strict';var emlformat=require(_0xe896('0x0'));var rimraf=require(_0xe896('0x1'));var zipdir=require(_0xe896('0x2'));var jsonpatch=require(_0xe896('0x3'));var rp=require(_0xe896('0x4'));var moment=require(_0xe896('0x5'));var BPromise=require(_0xe896('0x6'));var Mustache=require(_0xe896('0x7'));var util=require(_0xe896('0x8'));var path=require(_0xe896('0x9'));var sox=require(_0xe896('0xa'));var csv=require(_0xe896('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe896('0xc'));var _=require(_0xe896('0xd'));var squel=require(_0xe896('0xe'));var crypto=require(_0xe896('0xf'));var jsforce=require(_0xe896('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xe896('0xb'));var querystring=require(_0xe896('0x11'));var Papa=require(_0xe896('0x12'));var Redis=require('ioredis');var authService=require(_0xe896('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xe896('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe896('0x15'))(_0xe896('0x16'));var utils=require(_0xe896('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xe896('0x18'));var db=require(_0xe896('0x19'))['db'];function respondWithStatusCode(_0x3e8ac9,_0x580aac){_0x580aac=_0x580aac||0xcc;return function(_0x2aa522){if(_0x2aa522){return _0x3e8ac9[_0xe896('0x1a')](_0x580aac);}return _0x3e8ac9[_0xe896('0x1b')](_0x580aac)['end']();};}function respondWithResult(_0x2d0e46,_0x7dcf8a){_0x7dcf8a=_0x7dcf8a||0xc8;return function(_0x1e7ef8){if(_0x1e7ef8){return _0x2d0e46['status'](_0x7dcf8a)['json'](_0x1e7ef8);}};}function respondWithFilteredResult(_0x446ce2,_0x25606b){return function(_0x51e7b7){if(_0x51e7b7){var _0x5e78d6=typeof _0x25606b[_0xe896('0x1c')]===_0xe896('0x1d')&&typeof _0x25606b['limit']===_0xe896('0x1d');var _0x4e062a=_0x51e7b7[_0xe896('0x1e')];var _0x32f86d=_0x5e78d6?0x0:_0x25606b[_0xe896('0x1c')];var _0x5dc89d=_0x5e78d6?_0x51e7b7[_0xe896('0x1e')]:_0x25606b[_0xe896('0x1c')]+_0x25606b[_0xe896('0x1f')];var _0xbebbe1;if(_0x5dc89d>=_0x4e062a){_0x5dc89d=_0x4e062a;_0xbebbe1=0xc8;}else{_0xbebbe1=0xce;}_0x446ce2[_0xe896('0x1b')](_0xbebbe1);return _0x446ce2[_0xe896('0x20')](_0xe896('0x21'),_0x32f86d+'-'+_0x5dc89d+'/'+_0x4e062a)[_0xe896('0x22')](_0x51e7b7);}return null;};}function patchUpdates(_0x49547b){return function(_0x180d46){try{jsonpatch['apply'](_0x180d46,_0x49547b,!![]);}catch(_0x5d2c8d){return BPromise[_0xe896('0x23')](_0x5d2c8d);}return _0x180d46[_0xe896('0x24')]();};}function saveUpdates(_0x40502b,_0xeeec7c){return function(_0x498469){if(_0x498469){return _0x498469[_0xe896('0x25')](_0x40502b)['then'](function(_0x5001f7){return _0x5001f7;});}return null;};}function removeEntity(_0x45dd49,_0x41e689){return function(_0x1e952a){if(_0x1e952a){return _0x1e952a[_0xe896('0x26')]()[_0xe896('0x27')](function(){_0x45dd49[_0xe896('0x1b')](0xcc)[_0xe896('0x28')]();});}};}function handleEntityNotFound(_0x4b71cc,_0x390128){return function(_0x163a75){if(!_0x163a75){_0x4b71cc[_0xe896('0x1a')](0x194);}return _0x163a75;};}function handleError(_0x569d5f,_0x26635e){_0x26635e=_0x26635e||0x1f4;return function(_0xd50fe2){logger[_0xe896('0x29')](_0xd50fe2[_0xe896('0x2a')]);if(_0xd50fe2[_0xe896('0x2b')]){delete _0xd50fe2[_0xe896('0x2b')];}_0x569d5f['status'](_0x26635e)[_0xe896('0x2c')](_0xd50fe2);};}exports[_0xe896('0x2d')]=function(_0x201653,_0xbfb15b){var _0xace03f={},_0x5e0d9b={},_0x47c268={'count':0x0,'rows':[]};var _0x5c7dae=_['map'](db['UserProfileResource'][_0xe896('0x2e')],function(_0x29a18e){return{'name':_0x29a18e[_0xe896('0x2f')],'type':_0x29a18e[_0xe896('0x30')][_0xe896('0x31')]};});_0x5e0d9b[_0xe896('0x32')]=_[_0xe896('0x33')](_0x5c7dae,_0xe896('0x2b'));_0x5e0d9b['query']=_['keys'](_0x201653[_0xe896('0x34')]);_0x5e0d9b[_0xe896('0x35')]=_[_0xe896('0x36')](_0x5e0d9b[_0xe896('0x32')],_0x5e0d9b['query']);_0xace03f[_0xe896('0x37')]=_['intersection'](_0x5e0d9b['model'],qs[_0xe896('0x38')](_0x201653[_0xe896('0x34')][_0xe896('0x38')]));_0xace03f['attributes']=_0xace03f['attributes']['length']?_0xace03f[_0xe896('0x37')]:_0x5e0d9b[_0xe896('0x32')];if(!_0x201653[_0xe896('0x34')][_0xe896('0x39')](_0xe896('0x3a'))){_0xace03f['limit']=qs[_0xe896('0x1f')](_0x201653[_0xe896('0x34')][_0xe896('0x1f')]);_0xace03f[_0xe896('0x1c')]=qs[_0xe896('0x1c')](_0x201653[_0xe896('0x34')][_0xe896('0x1c')]);}_0xace03f[_0xe896('0x3b')]=qs['sort'](_0x201653[_0xe896('0x34')][_0xe896('0x3c')]);_0xace03f['where']=qs[_0xe896('0x35')](_['pick'](_0x201653[_0xe896('0x34')],_0x5e0d9b['filters']),_0x5c7dae);if(_0x201653[_0xe896('0x34')]['filter']){_0xace03f[_0xe896('0x3d')]=_[_0xe896('0x3e')](_0xace03f[_0xe896('0x3d')],{'$or':_[_0xe896('0x33')](_0x5c7dae,function(_0xeb9bbf){if(_0xeb9bbf['type']!=='VIRTUAL'){var _0x203aea={};_0x203aea[_0xeb9bbf[_0xe896('0x2b')]]={'$like':'%'+_0x201653[_0xe896('0x34')][_0xe896('0x3f')]+'%'};return _0x203aea;}})});}_0xace03f=_[_0xe896('0x3e')]({},_0xace03f,_0x201653['options']);var _0x5b8131={'where':_0xace03f[_0xe896('0x3d')]};return db[_0xe896('0x40')]['count'](_0x5b8131)['then'](function(_0x19d2fd){_0x47c268[_0xe896('0x1e')]=_0x19d2fd;if(_0x201653[_0xe896('0x34')][_0xe896('0x41')]){_0xace03f[_0xe896('0x42')]=[{'all':!![]}];}return db[_0xe896('0x40')][_0xe896('0x43')](_0xace03f);})[_0xe896('0x27')](function(_0x372c71){_0x47c268[_0xe896('0x44')]=_0x372c71;return _0x47c268;})[_0xe896('0x27')](respondWithFilteredResult(_0xbfb15b,_0xace03f))[_0xe896('0x45')](handleError(_0xbfb15b,null));};exports['show']=function(_0x1e5434,_0x143ad4){var _0x59b97f={'raw':![],'where':{'id':_0x1e5434['params']['id']}},_0x57366b={};_0x57366b[_0xe896('0x32')]=_[_0xe896('0x46')](db[_0xe896('0x40')]['rawAttributes']);_0x57366b[_0xe896('0x34')]=_[_0xe896('0x46')](_0x1e5434['query']);_0x57366b['filters']=_['intersection'](_0x57366b[_0xe896('0x32')],_0x57366b[_0xe896('0x34')]);_0x59b97f[_0xe896('0x37')]=_[_0xe896('0x36')](_0x57366b[_0xe896('0x32')],qs[_0xe896('0x38')](_0x1e5434['query'][_0xe896('0x38')]));_0x59b97f[_0xe896('0x37')]=_0x59b97f['attributes'][_0xe896('0x47')]?_0x59b97f[_0xe896('0x37')]:_0x57366b[_0xe896('0x32')];if(_0x1e5434[_0xe896('0x34')]['includeAll']){_0x59b97f[_0xe896('0x42')]=[{'all':!![]}];}_0x59b97f=_[_0xe896('0x3e')]({},_0x59b97f,_0x1e5434[_0xe896('0x48')]);return db[_0xe896('0x40')][_0xe896('0x49')](_0x59b97f)[_0xe896('0x27')](handleEntityNotFound(_0x143ad4,null))['then'](respondWithResult(_0x143ad4,null))[_0xe896('0x45')](handleError(_0x143ad4,null));};exports['create']=function(_0x234a22,_0x1c6ae1){return db[_0xe896('0x40')][_0xe896('0x4a')](_0x234a22[_0xe896('0x4b')],{})[_0xe896('0x27')](respondWithResult(_0x1c6ae1,0xc9))['catch'](handleError(_0x1c6ae1,null));};exports[_0xe896('0x25')]=function(_0x206ad3,_0x4818cd){if(_0x206ad3[_0xe896('0x4b')]['id']){delete _0x206ad3[_0xe896('0x4b')]['id'];}return db['UserProfileResource'][_0xe896('0x49')]({'where':{'id':_0x206ad3['params']['id']}})[_0xe896('0x27')](handleEntityNotFound(_0x4818cd,null))[_0xe896('0x27')](saveUpdates(_0x206ad3[_0xe896('0x4b')],null))[_0xe896('0x27')](respondWithResult(_0x4818cd,null))[_0xe896('0x45')](handleError(_0x4818cd,null));};exports['destroy']=function(_0x1fa3fd,_0x819c8a){return db[_0xe896('0x40')]['find']({'where':{'id':_0x1fa3fd[_0xe896('0x4c')]['id']}})['then'](handleEntityNotFound(_0x819c8a,null))['then'](removeEntity(_0x819c8a,null))[_0xe896('0x45')](handleError(_0x819c8a,null));};exports[_0xe896('0x4d')]=function(_0x57aed3,_0x343adb){return db[_0xe896('0x40')]['describe']()['then'](respondWithResult(_0x343adb,null))[_0xe896('0x45')](handleError(_0x343adb,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index e7328de..7afec27 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 _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 +var _0x0862=['resourceId','sectionId','lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./userProfileResource.attributes','exports','define','user_profile_has_resources','compositeIndex'];(function(_0x50c710,_0x504134){var _0x2d5f79=function(_0x73e66c){while(--_0x73e66c){_0x50c710['push'](_0x50c710['shift']());}};_0x2d5f79(++_0x504134);}(_0x0862,0x152));var _0x2086=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x0862[_0x513aa5];return _0x1a1a7c;};'use strict';var _=require(_0x2086('0x0'));var util=require('util');var logger=require(_0x2086('0x1'))(_0x2086('0x2'));var moment=require(_0x2086('0x3'));var BPromise=require(_0x2086('0x4'));var rp=require(_0x2086('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2086('0x6'));var attributes=require(_0x2086('0x7'));module[_0x2086('0x8')]=function(_0x45b92c,_0x56b9c8){return _0x45b92c[_0x2086('0x9')]('UserProfileResource',attributes,{'tableName':_0x2086('0xa'),'paranoid':![],'indexes':[{'name':_0x2086('0xb'),'fields':[_0x2086('0xc'),_0x2086('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index c82384f..8a5a35c 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 _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 +var _0x961b=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x27767a,_0x35949f){var _0x2a76f8=function(_0x56cedc){while(--_0x56cedc){_0x27767a['push'](_0x27767a['shift']());}};_0x2a76f8(++_0x35949f);}(_0x961b,0x128));var _0xb961=function(_0x179b53,_0x31f6fe){_0x179b53=_0x179b53-0x0;var _0x38a146=_0x961b[_0x179b53];return _0x38a146;};'use strict';var _=require(_0xb961('0x0'));var util=require(_0xb961('0x1'));var moment=require(_0xb961('0x2'));var BPromise=require(_0xb961('0x3'));var rs=require(_0xb961('0x4'));var fs=require('fs');var Redis=require(_0xb961('0x5'));var db=require(_0xb961('0x6'))['db'];var utils=require(_0xb961('0x7'));var logger=require(_0xb961('0x8'))(_0xb961('0x9'));var config=require('../../config/environment');var jayson=require(_0xb961('0xa'));var client=jayson['client'][_0xb961('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x13974b,_0x200799,_0x3d55a4){return new BPromise(function(_0x54bd93,_0x50df2b){return client[_0xb961('0xc')](_0x13974b,_0x3d55a4)['then'](function(_0x43f985){logger[_0xb961('0xd')](_0xb961('0xe'),_0x200799,_0xb961('0xf'));logger['debug']('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x200799,_0xb961('0xf'),JSON['stringify'](_0x43f985));if(_0x43f985[_0xb961('0x10')]){if(_0x43f985[_0xb961('0x10')][_0xb961('0x11')]===0x1f4){logger[_0xb961('0x10')]('UserProfileResource,\x20%s,\x20%s',_0x200799,_0x43f985[_0xb961('0x10')]['message']);return _0x50df2b(_0x43f985['error'][_0xb961('0x12')]);}logger[_0xb961('0x10')](_0xb961('0xe'),_0x200799,_0x43f985[_0xb961('0x10')][_0xb961('0x12')]);return _0x54bd93(_0x43f985[_0xb961('0x10')][_0xb961('0x12')]);}else{logger[_0xb961('0xd')](_0xb961('0xe'),_0x200799,_0xb961('0xf'));_0x54bd93(_0x43f985[_0xb961('0x13')]['message']);}})[_0xb961('0x14')](function(_0x2ece3d){logger['error']('UserProfileResource,\x20%s,\x20%s',_0x200799,_0x2ece3d);_0x50df2b(_0x2ece3d);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 2a48e3f..969d268 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 _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 +var _0x54fa=['post','create','put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfileSection.controller','isAuthenticated','index','get','/describe','describe','/:id'];(function(_0x3032b5,_0xcb66eb){var _0x436871=function(_0x54f137){while(--_0x54f137){_0x3032b5['push'](_0x3032b5['shift']());}};_0x436871(++_0xcb66eb);}(_0x54fa,0x1be));var _0xa54f=function(_0x1d2bc8,_0x2860bc){_0x1d2bc8=_0x1d2bc8-0x0;var _0x1857e1=_0x54fa[_0x1d2bc8];return _0x1857e1;};'use strict';var multer=require(_0xa54f('0x0'));var util=require(_0xa54f('0x1'));var path=require(_0xa54f('0x2'));var timeout=require(_0xa54f('0x3'));var express=require(_0xa54f('0x4'));var router=express[_0xa54f('0x5')]();var fs_extra=require(_0xa54f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xa54f('0x7'));var config=require(_0xa54f('0x8'));var controller=require(_0xa54f('0x9'));router['get']('/',auth[_0xa54f('0xa')](),controller[_0xa54f('0xb')]);router[_0xa54f('0xc')](_0xa54f('0xd'),auth[_0xa54f('0xa')](),controller[_0xa54f('0xe')]);router[_0xa54f('0xc')](_0xa54f('0xf'),auth['isAuthenticated'](),controller['show']);router[_0xa54f('0x10')]('/',auth[_0xa54f('0xa')](),controller[_0xa54f('0x11')]);router[_0xa54f('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xa54f('0x13')]);router[_0xa54f('0x14')](_0xa54f('0xf'),auth[_0xa54f('0xa')](),controller['destroy']);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 ba04ac1..eb5c127 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 _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 +var _0x056b=['getDataValue','split','exports','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join'];(function(_0x5de169,_0x18aea3){var _0x910b5f=function(_0x2e9abe){while(--_0x2e9abe){_0x5de169['push'](_0x5de169['shift']());}};_0x910b5f(++_0x18aea3);}(_0x056b,0xb6));var _0xb056=function(_0x251afb,_0x4f2a61){_0x251afb=_0x251afb-0x0;var _0x3f90a0=_0x056b[_0x251afb];return _0x3f90a0;};'use strict';var Sequelize=require('sequelize');module[_0xb056('0x0')]={'name':{'type':Sequelize[_0xb056('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0xb056('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xb056('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0xb056('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xb056('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xb056('0x1')],'set':function(_0x4157e0){this[_0xb056('0x4')](_0xb056('0x5'),_0x4157e0?_0x4157e0[_0xb056('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0xb056('0x5'))?this[_0xb056('0x7')](_0xb056('0x5'))[_0xb056('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 0e71cb7..3c0c03f 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 _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 +var _0x5585=['rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','sort','pick','filter','where','merge','type','VIRTUAL','options','count','includeAll','findAll','rows','catch','keys','length','include','find','create','body','params','describe','eml-format','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','Content-Range','json','apply','save','then','destroy','sendStatus','error','stack','name','send','index','map','UserProfileSection'];(function(_0x25b7ea,_0x2af5c9){var _0x175ab1=function(_0x95a8d0){while(--_0x95a8d0){_0x25b7ea['push'](_0x25b7ea['shift']());}};_0x175ab1(++_0x2af5c9);}(_0x5585,0x69));var _0x5558=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x5585[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require(_0x5558('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5558('0x1'));var rp=require(_0x5558('0x2'));var moment=require(_0x5558('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5558('0x4'));var util=require(_0x5558('0x5'));var path=require('path');var sox=require(_0x5558('0x6'));var csv=require(_0x5558('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5558('0x8'));var squel=require(_0x5558('0x9'));var crypto=require(_0x5558('0xa'));var jsforce=require(_0x5558('0xb'));var deskjs=require(_0x5558('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5558('0xd'));var Papa=require(_0x5558('0xe'));var Redis=require(_0x5558('0xf'));var authService=require(_0x5558('0x10'));var qs=require(_0x5558('0x11'));var as=require(_0x5558('0x12'));var hardwareService=require(_0x5558('0x13'));var logger=require(_0x5558('0x14'))('api');var utils=require(_0x5558('0x15'));var config=require(_0x5558('0x16'));var licenseUtil=require(_0x5558('0x17'));var db=require(_0x5558('0x18'))['db'];function respondWithStatusCode(_0x599cd7,_0x257086){_0x257086=_0x257086||0xcc;return function(_0x1a6647){if(_0x1a6647){return _0x599cd7['sendStatus'](_0x257086);}return _0x599cd7[_0x5558('0x19')](_0x257086)['end']();};}function respondWithResult(_0x5a44bc,_0x3ca530){_0x3ca530=_0x3ca530||0xc8;return function(_0x436c55){if(_0x436c55){return _0x5a44bc[_0x5558('0x19')](_0x3ca530)['json'](_0x436c55);}};}function respondWithFilteredResult(_0x360423,_0x570865){return function(_0x41ba22){if(_0x41ba22){var _0x15711b=typeof _0x570865[_0x5558('0x1a')]===_0x5558('0x1b')&&typeof _0x570865[_0x5558('0x1c')]===_0x5558('0x1b');var _0x31819e=_0x41ba22['count'];var _0x237473=_0x15711b?0x0:_0x570865[_0x5558('0x1a')];var _0x789d1e=_0x15711b?_0x41ba22['count']:_0x570865[_0x5558('0x1a')]+_0x570865[_0x5558('0x1c')];var _0x5cd1b0;if(_0x789d1e>=_0x31819e){_0x789d1e=_0x31819e;_0x5cd1b0=0xc8;}else{_0x5cd1b0=0xce;}_0x360423[_0x5558('0x19')](_0x5cd1b0);return _0x360423['set'](_0x5558('0x1d'),_0x237473+'-'+_0x789d1e+'/'+_0x31819e)[_0x5558('0x1e')](_0x41ba22);}return null;};}function patchUpdates(_0x24616d){return function(_0x379dbd){try{jsonpatch[_0x5558('0x1f')](_0x379dbd,_0x24616d,!![]);}catch(_0x4179af){return BPromise['reject'](_0x4179af);}return _0x379dbd[_0x5558('0x20')]();};}function saveUpdates(_0xcd2e5b,_0x228c08){return function(_0x21e55c){if(_0x21e55c){return _0x21e55c['update'](_0xcd2e5b)[_0x5558('0x21')](function(_0x3a2323){return _0x3a2323;});}return null;};}function removeEntity(_0x34bf75,_0x51dcea){return function(_0x46ef42){if(_0x46ef42){return _0x46ef42[_0x5558('0x22')]()[_0x5558('0x21')](function(){_0x34bf75[_0x5558('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4950c1,_0x2a2ed5){return function(_0x5f001f){if(!_0x5f001f){_0x4950c1[_0x5558('0x23')](0x194);}return _0x5f001f;};}function handleError(_0x23aa43,_0x2e4928){_0x2e4928=_0x2e4928||0x1f4;return function(_0x17eb25){logger[_0x5558('0x24')](_0x17eb25[_0x5558('0x25')]);if(_0x17eb25[_0x5558('0x26')]){delete _0x17eb25['name'];}_0x23aa43[_0x5558('0x19')](_0x2e4928)[_0x5558('0x27')](_0x17eb25);};}exports[_0x5558('0x28')]=function(_0x56f566,_0x1c3dd3){var _0x18ef49={},_0x3ea6ef={},_0x41f347={'count':0x0,'rows':[]};var _0x2ccd85=_[_0x5558('0x29')](db[_0x5558('0x2a')][_0x5558('0x2b')],function(_0x6f32f1){return{'name':_0x6f32f1[_0x5558('0x2c')],'type':_0x6f32f1['type'][_0x5558('0x2d')]};});_0x3ea6ef['model']=_[_0x5558('0x29')](_0x2ccd85,_0x5558('0x26'));_0x3ea6ef[_0x5558('0x2e')]=_['keys'](_0x56f566['query']);_0x3ea6ef[_0x5558('0x2f')]=_[_0x5558('0x30')](_0x3ea6ef[_0x5558('0x31')],_0x3ea6ef[_0x5558('0x2e')]);_0x18ef49[_0x5558('0x32')]=_[_0x5558('0x30')](_0x3ea6ef[_0x5558('0x31')],qs[_0x5558('0x33')](_0x56f566[_0x5558('0x2e')]['fields']));_0x18ef49['attributes']=_0x18ef49[_0x5558('0x32')]['length']?_0x18ef49[_0x5558('0x32')]:_0x3ea6ef[_0x5558('0x31')];if(!_0x56f566[_0x5558('0x2e')][_0x5558('0x34')]('nolimit')){_0x18ef49['limit']=qs[_0x5558('0x1c')](_0x56f566[_0x5558('0x2e')][_0x5558('0x1c')]);_0x18ef49['offset']=qs['offset'](_0x56f566[_0x5558('0x2e')][_0x5558('0x1a')]);}_0x18ef49['order']=qs[_0x5558('0x35')](_0x56f566[_0x5558('0x2e')][_0x5558('0x35')]);_0x18ef49['where']=qs[_0x5558('0x2f')](_[_0x5558('0x36')](_0x56f566[_0x5558('0x2e')],_0x3ea6ef[_0x5558('0x2f')]),_0x2ccd85);if(_0x56f566[_0x5558('0x2e')][_0x5558('0x37')]){_0x18ef49[_0x5558('0x38')]=_[_0x5558('0x39')](_0x18ef49[_0x5558('0x38')],{'$or':_[_0x5558('0x29')](_0x2ccd85,function(_0x25eb89){if(_0x25eb89[_0x5558('0x3a')]!==_0x5558('0x3b')){var _0xc97f01={};_0xc97f01[_0x25eb89[_0x5558('0x26')]]={'$like':'%'+_0x56f566[_0x5558('0x2e')][_0x5558('0x37')]+'%'};return _0xc97f01;}})});}_0x18ef49=_['merge']({},_0x18ef49,_0x56f566[_0x5558('0x3c')]);var _0x5e41cb={'where':_0x18ef49[_0x5558('0x38')]};return db[_0x5558('0x2a')][_0x5558('0x3d')](_0x5e41cb)[_0x5558('0x21')](function(_0x5ce0e1){_0x41f347['count']=_0x5ce0e1;if(_0x56f566[_0x5558('0x2e')][_0x5558('0x3e')]){_0x18ef49['include']=[{'all':!![]}];}return db[_0x5558('0x2a')][_0x5558('0x3f')](_0x18ef49);})[_0x5558('0x21')](function(_0x4455f3){_0x41f347[_0x5558('0x40')]=_0x4455f3;return _0x41f347;})[_0x5558('0x21')](respondWithFilteredResult(_0x1c3dd3,_0x18ef49))[_0x5558('0x41')](handleError(_0x1c3dd3,null));};exports['show']=function(_0xa511e2,_0x432833){var _0x5135f7={'raw':![],'where':{'id':_0xa511e2['params']['id']}},_0x3b8a79={};_0x3b8a79['model']=_[_0x5558('0x42')](db[_0x5558('0x2a')]['rawAttributes']);_0x3b8a79[_0x5558('0x2e')]=_['keys'](_0xa511e2['query']);_0x3b8a79[_0x5558('0x2f')]=_[_0x5558('0x30')](_0x3b8a79[_0x5558('0x31')],_0x3b8a79['query']);_0x5135f7[_0x5558('0x32')]=_['intersection'](_0x3b8a79[_0x5558('0x31')],qs[_0x5558('0x33')](_0xa511e2['query'][_0x5558('0x33')]));_0x5135f7[_0x5558('0x32')]=_0x5135f7['attributes'][_0x5558('0x43')]?_0x5135f7[_0x5558('0x32')]:_0x3b8a79[_0x5558('0x31')];if(_0xa511e2[_0x5558('0x2e')][_0x5558('0x3e')]){_0x5135f7[_0x5558('0x44')]=[{'all':!![]}];}_0x5135f7=_['merge']({},_0x5135f7,_0xa511e2[_0x5558('0x3c')]);return db['UserProfileSection'][_0x5558('0x45')](_0x5135f7)[_0x5558('0x21')](handleEntityNotFound(_0x432833,null))[_0x5558('0x21')](respondWithResult(_0x432833,null))[_0x5558('0x41')](handleError(_0x432833,null));};exports[_0x5558('0x46')]=function(_0x22ccbc,_0xcf8d8e){return db['UserProfileSection']['create'](_0x22ccbc[_0x5558('0x47')],{})[_0x5558('0x21')](respondWithResult(_0xcf8d8e,0xc9))['catch'](handleError(_0xcf8d8e,null));};exports['update']=function(_0xe0dadf,_0x325bc7){if(_0xe0dadf[_0x5558('0x47')]['id']){delete _0xe0dadf[_0x5558('0x47')]['id'];}return db[_0x5558('0x2a')]['find']({'where':{'id':_0xe0dadf[_0x5558('0x48')]['id']}})[_0x5558('0x21')](handleEntityNotFound(_0x325bc7,null))[_0x5558('0x21')](saveUpdates(_0xe0dadf[_0x5558('0x47')],null))[_0x5558('0x21')](respondWithResult(_0x325bc7,null))[_0x5558('0x41')](handleError(_0x325bc7,null));};exports[_0x5558('0x22')]=function(_0xe0f649,_0x1cbee2){return db[_0x5558('0x2a')][_0x5558('0x45')]({'where':{'id':_0xe0f649[_0x5558('0x48')]['id']}})[_0x5558('0x21')](handleEntityNotFound(_0x1cbee2,null))['then'](removeEntity(_0x1cbee2,null))['catch'](handleError(_0x1cbee2,null));};exports[_0x5558('0x49')]=function(_0x226a60,_0x14492d){return db[_0x5558('0x2a')][_0x5558('0x49')]()[_0x5558('0x21')](respondWithResult(_0x14492d,null))[_0x5558('0x41')](handleError(_0x14492d,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 5688673..8c73659 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 _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 +var _0xe34b=['user_profile_has_sections','compositeIndex','sectionId','userProfileId','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./userProfileSection.attributes','exports','define'];(function(_0x58b0b0,_0x181418){var _0x170d83=function(_0xb082ef){while(--_0xb082ef){_0x58b0b0['push'](_0x58b0b0['shift']());}};_0x170d83(++_0x181418);}(_0xe34b,0x199));var _0xbe34=function(_0x16db8b,_0xca7d28){_0x16db8b=_0x16db8b-0x0;var _0x5ba017=_0xe34b[_0x16db8b];return _0x5ba017;};'use strict';var _=require('lodash');var util=require(_0xbe34('0x0'));var logger=require(_0xbe34('0x1'))(_0xbe34('0x2'));var moment=require(_0xbe34('0x3'));var BPromise=require(_0xbe34('0x4'));var rp=require(_0xbe34('0x5'));var fs=require('fs');var path=require(_0xbe34('0x6'));var rimraf=require('rimraf');var config=require(_0xbe34('0x7'));var attributes=require(_0xbe34('0x8'));module[_0xbe34('0x9')]=function(_0x51368d,_0x35b096){return _0x51368d[_0xbe34('0xa')]('UserProfileSection',attributes,{'tableName':_0xbe34('0xb'),'paranoid':![],'indexes':[{'name':_0xbe34('0xc'),'fields':[_0xbe34('0xd'),_0xbe34('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 65392b0..55dd980 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 _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 +var _0x8ba5=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','lodash'];(function(_0x5abfe7,_0x192368){var _0x420155=function(_0x1a660b){while(--_0x1a660b){_0x5abfe7['push'](_0x5abfe7['shift']());}};_0x420155(++_0x192368);}(_0x8ba5,0x1da));var _0x58ba=function(_0x1d1219,_0x23fc71){_0x1d1219=_0x1d1219-0x0;var _0x5b5b89=_0x8ba5[_0x1d1219];return _0x5b5b89;};'use strict';var _=require(_0x58ba('0x0'));var util=require(_0x58ba('0x1'));var moment=require(_0x58ba('0x2'));var BPromise=require(_0x58ba('0x3'));var rs=require(_0x58ba('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x58ba('0x5'))['db'];var utils=require(_0x58ba('0x6'));var logger=require(_0x58ba('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x58ba('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x48b43b,_0x6fcbf,_0x3aee06){return new BPromise(function(_0x212d71,_0x396c9f){return client['request'](_0x48b43b,_0x3aee06)[_0x58ba('0x9')](function(_0x52541e){logger[_0x58ba('0xa')](_0x58ba('0xb'),_0x6fcbf,_0x58ba('0xc'));logger['debug'](_0x58ba('0xd'),_0x6fcbf,'request\x20sent',JSON[_0x58ba('0xe')](_0x52541e));if(_0x52541e['error']){if(_0x52541e['error'][_0x58ba('0xf')]===0x1f4){logger[_0x58ba('0x10')]('UserProfileSection,\x20%s,\x20%s',_0x6fcbf,_0x52541e[_0x58ba('0x10')][_0x58ba('0x11')]);return _0x396c9f(_0x52541e[_0x58ba('0x10')][_0x58ba('0x11')]);}logger[_0x58ba('0x10')]('UserProfileSection,\x20%s,\x20%s',_0x6fcbf,_0x52541e[_0x58ba('0x10')][_0x58ba('0x11')]);return _0x212d71(_0x52541e['error'][_0x58ba('0x11')]);}else{logger[_0x58ba('0xa')](_0x58ba('0xb'),_0x6fcbf,'request\x20sent');_0x212d71(_0x52541e[_0x58ba('0x12')][_0x58ba('0x11')]);}})['catch'](function(_0x3ed424){logger[_0x58ba('0x10')](_0x58ba('0xb'),_0x6fcbf,_0x3ed424);_0x396c9f(_0x3ed424);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 3b7813b..9f1c65d 100644 --- a/server/api/userSmsQueue/index.js +++ b/server/api/userSmsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_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 +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x391c6a,_0x24bf28){var _0x3bb007=function(_0x8f3b01){while(--_0x8f3b01){_0x391c6a['push'](_0x391c6a['shift']());}};_0x3bb007(++_0x24bf28);}(_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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 19d9b8f..83623c5 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 _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 +var _0x2a68=['INTEGER','sequelize','exports'];(function(_0x27c021,_0x190f72){var _0x1d0700=function(_0x8b02b4){while(--_0x8b02b4){_0x27c021['push'](_0x27c021['shift']());}};_0x1d0700(++_0x190f72);}(_0x2a68,0x148));var _0x82a6=function(_0x3460c0,_0x37bb39){_0x3460c0=_0x3460c0-0x0;var _0x48b3ac=_0x2a68[_0x3460c0];return _0x48b3ac;};'use strict';var Sequelize=require(_0x82a6('0x0'));module[_0x82a6('0x1')]={'penalty':{'type':Sequelize[_0x82a6('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 80b63ca..e7f1dfd 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 _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 +var _0xa899=['./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x219e3d,_0x5e287e){var _0x28474c=function(_0x38ce70){while(--_0x38ce70){_0x219e3d['push'](_0x219e3d['shift']());}};_0x28474c(++_0x5e287e);}(_0xa899,0x155));var _0x9a89=function(_0x55fa03,_0xcb96c2){_0x55fa03=_0x55fa03-0x0;var _0x2cd7cd=_0xa899[_0x55fa03];return _0x2cd7cd;};'use strict';var _=require(_0x9a89('0x0'));var util=require(_0x9a89('0x1'));var logger=require(_0x9a89('0x2'))('api');var moment=require(_0x9a89('0x3'));var BPromise=require(_0x9a89('0x4'));var rp=require(_0x9a89('0x5'));var fs=require('fs');var path=require(_0x9a89('0x6'));var rimraf=require(_0x9a89('0x7'));var config=require(_0x9a89('0x8'));var attributes=require(_0x9a89('0x9'));module[_0x9a89('0xa')]=function(_0x126099,_0x413d15){return _0x126099[_0x9a89('0xb')](_0x9a89('0xc'),attributes,{'tableName':_0x9a89('0xd'),'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 6a666eb..4827e69 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 _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 +var _0x013f=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','UserSmsQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x52a72f,_0x15b029){var _0x3c620a=function(_0x50221e){while(--_0x50221e){_0x52a72f['push'](_0x52a72f['shift']());}};_0x3c620a(++_0x15b029);}(_0x013f,0x198));var _0xf013=function(_0x236058,_0x4447a0){_0x236058=_0x236058-0x0;var _0x3ce3bd=_0x013f[_0x236058];return _0x3ce3bd;};'use strict';var _=require(_0xf013('0x0'));var util=require('util');var moment=require(_0xf013('0x1'));var BPromise=require(_0xf013('0x2'));var rs=require(_0xf013('0x3'));var fs=require('fs');var Redis=require(_0xf013('0x4'));var db=require(_0xf013('0x5'))['db'];var utils=require(_0xf013('0x6'));var logger=require(_0xf013('0x7'))(_0xf013('0x8'));var config=require(_0xf013('0x9'));var jayson=require(_0xf013('0xa'));var client=jayson[_0xf013('0xb')][_0xf013('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5505fc,_0x2fe69e,_0xc81c15){return new BPromise(function(_0x941a4c,_0x4a5b31){return client[_0xf013('0xd')](_0x5505fc,_0xc81c15)[_0xf013('0xe')](function(_0x6ae683){logger[_0xf013('0xf')](_0xf013('0x10'),_0x2fe69e,_0xf013('0x11'));logger['debug'](_0xf013('0x12'),_0x2fe69e,_0xf013('0x11'),JSON['stringify'](_0x6ae683));if(_0x6ae683['error']){if(_0x6ae683[_0xf013('0x13')][_0xf013('0x14')]===0x1f4){logger[_0xf013('0x13')](_0xf013('0x10'),_0x2fe69e,_0x6ae683['error'][_0xf013('0x15')]);return _0x4a5b31(_0x6ae683[_0xf013('0x13')]['message']);}logger[_0xf013('0x13')](_0xf013('0x10'),_0x2fe69e,_0x6ae683[_0xf013('0x13')][_0xf013('0x15')]);return _0x941a4c(_0x6ae683[_0xf013('0x13')][_0xf013('0x15')]);}else{logger[_0xf013('0xf')](_0xf013('0x10'),_0x2fe69e,_0xf013('0x11'));_0x941a4c(_0x6ae683[_0xf013('0x16')][_0xf013('0x15')]);}})[_0xf013('0x17')](function(_0x3a64f9){logger[_0xf013('0x13')](_0xf013('0x10'),_0x2fe69e,_0x3a64f9);_0x4a5b31(_0x3a64f9);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index e92e6a0..8abaacb 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 _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 +var _0x01b5=['exports','INTEGER','sequelize'];(function(_0x354f40,_0x2f7840){var _0x5501c3=function(_0x8f3b2b){while(--_0x8f3b2b){_0x354f40['push'](_0x354f40['shift']());}};_0x5501c3(++_0x2f7840);}(_0x01b5,0xf2));var _0x501b=function(_0x5e6e15,_0x1cdfcf){_0x5e6e15=_0x5e6e15-0x0;var _0x2e8e41=_0x01b5[_0x5e6e15];return _0x2e8e41;};'use strict';var Sequelize=require(_0x501b('0x0'));module[_0x501b('0x1')]={'UserId':{'type':Sequelize[_0x501b('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x501b('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index fbe57b6..ae86965 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(_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 +var _0xa9e0=['../../config/environment','./userVoicePrefix.attributes','exports','define','UserVoicePrefix','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x4186d4,_0x10f534){var _0x4094d7=function(_0x52d732){while(--_0x52d732){_0x4186d4['push'](_0x4186d4['shift']());}};_0x4094d7(++_0x10f534);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 2ef2ec0..eb0abd1 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 _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 +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x487702,_0x49f5d4){var _0x5e7150=function(_0x2b2b29){while(--_0x2b2b29){_0x487702['push'](_0x487702['shift']());}};_0x5e7150(++_0x49f5d4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index b11cbc7..1d5e10b 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 _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 +var _0xb670=['exports','sequelize'];(function(_0x228058,_0x2815aa){var _0x79b701=function(_0x15d029){while(--_0x15d029){_0x228058['push'](_0x228058['shift']());}};_0x79b701(++_0x2815aa);}(_0xb670,0x1c3));var _0x0b67=function(_0x49870c,_0x4d2e2b){_0x49870c=_0x49870c-0x0;var _0x2c98f5=_0xb670[_0x49870c];return _0x2c98f5;};'use strict';var Sequelize=require(_0x0b67('0x0'));module[_0x0b67('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 8ee1ea9..87ead83 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 _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 +var _0x70e8=['define','UserVoiceQueue','util','../../config/logger','./userVoiceQueue.attributes'];(function(_0x8c5f27,_0x29dda1){var _0x1f18ee=function(_0x12a751){while(--_0x12a751){_0x8c5f27['push'](_0x8c5f27['shift']());}};_0x1f18ee(++_0x29dda1);}(_0x70e8,0x156));var _0x870e=function(_0x3a2469,_0x5c47fc){_0x3a2469=_0x3a2469-0x0;var _0x6a45e2=_0x70e8[_0x3a2469];return _0x6a45e2;};'use strict';var _=require('lodash');var util=require(_0x870e('0x0'));var logger=require(_0x870e('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x870e('0x2'));module['exports']=function(_0x23391d,_0x3227fc){return _0x23391d[_0x870e('0x3')](_0x870e('0x4'),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 c0546cf..49dd6f7 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 _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 +var _0xb7e9=['ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x5db1a4,_0x14aa78){var _0x21ac3f=function(_0x108068){while(--_0x108068){_0x5db1a4['push'](_0x5db1a4['shift']());}};_0x21ac3f(++_0x14aa78);}(_0xb7e9,0xf5));var _0x9b7e=function(_0x1a635e,_0x241651){_0x1a635e=_0x1a635e-0x0;var _0x5b3345=_0xb7e9[_0x1a635e];return _0x5b3345;};'use strict';var _=require(_0x9b7e('0x0'));var util=require(_0x9b7e('0x1'));var moment=require(_0x9b7e('0x2'));var BPromise=require(_0x9b7e('0x3'));var rs=require(_0x9b7e('0x4'));var fs=require('fs');var Redis=require(_0x9b7e('0x5'));var db=require(_0x9b7e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9b7e('0x7'))(_0x9b7e('0x8'));var config=require('../../config/environment');var jayson=require(_0x9b7e('0x9'));var client=jayson[_0x9b7e('0xa')][_0x9b7e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x38be24,_0x2a8151,_0x22d1b0){return new BPromise(function(_0x4b1731,_0x962f5){return client[_0x9b7e('0xc')](_0x38be24,_0x22d1b0)[_0x9b7e('0xd')](function(_0x44f440){logger[_0x9b7e('0xe')](_0x9b7e('0xf'),_0x2a8151,_0x9b7e('0x10'));logger[_0x9b7e('0x11')](_0x9b7e('0x12'),_0x2a8151,'request\x20sent',JSON[_0x9b7e('0x13')](_0x44f440));if(_0x44f440[_0x9b7e('0x14')]){if(_0x44f440[_0x9b7e('0x14')][_0x9b7e('0x15')]===0x1f4){logger[_0x9b7e('0x14')]('UserVoiceQueue,\x20%s,\x20%s',_0x2a8151,_0x44f440[_0x9b7e('0x14')][_0x9b7e('0x16')]);return _0x962f5(_0x44f440[_0x9b7e('0x14')][_0x9b7e('0x16')]);}logger[_0x9b7e('0x14')](_0x9b7e('0xf'),_0x2a8151,_0x44f440[_0x9b7e('0x14')][_0x9b7e('0x16')]);return _0x4b1731(_0x44f440[_0x9b7e('0x14')]['message']);}else{logger[_0x9b7e('0xe')]('UserVoiceQueue,\x20%s,\x20%s',_0x2a8151,_0x9b7e('0x10'));_0x4b1731(_0x44f440[_0x9b7e('0x17')][_0x9b7e('0x16')]);}})[_0x9b7e('0x18')](function(_0x34bc63){logger[_0x9b7e('0x14')]('UserVoiceQueue,\x20%s,\x20%s',_0x2a8151,_0x34bc63);_0x962f5(_0x34bc63);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index a55f9cd..69b65c8 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 _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 +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x3d897f,_0x441a93){var _0xc00f4b=function(_0x31134d){while(--_0x31134d){_0x3d897f['push'](_0x3d897f['shift']());}};_0xc00f4b(++_0x441a93);}(_0x70e0,0x17b));var _0x070e=function(_0x1417bc,_0x14247d){_0x1417bc=_0x1417bc-0x0;var _0x11b393=_0x70e0[_0x1417bc];return _0x11b393;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index a8d2f70..2438484 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 _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 +var _0x9f2d=['queue_interface','exports','INTEGER','Required\x20by\x20Asterisk','STRING'];(function(_0x2553ad,_0x25b970){var _0x110c92=function(_0x134ddf){while(--_0x134ddf){_0x2553ad['push'](_0x2553ad['shift']());}};_0x110c92(++_0x25b970);}(_0x9f2d,0x16e));var _0xd9f2=function(_0x5c2f97,_0x305508){_0x5c2f97=_0x5c2f97-0x0;var _0x3fbc28=_0x9f2d[_0x5c2f97];return _0x3fbc28;};'use strict';var Sequelize=require('sequelize');module[_0xd9f2('0x0')]={'uniqueid':{'type':Sequelize[_0xd9f2('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xd9f2('0x2')},'membername':{'type':Sequelize[_0xd9f2('0x3')],'allowNull':![],'comment':_0xd9f2('0x2')},'UserId':{'type':Sequelize[_0xd9f2('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'queue_interface','comment':_0xd9f2('0x2')},'VoiceQueueId':{'type':Sequelize[_0xd9f2('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0xd9f2('0x3')],'allowNull':![],'unique':_0xd9f2('0x4'),'comment':_0xd9f2('0x2')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xd9f2('0x2')},'paused':{'type':Sequelize[_0xd9f2('0x1')](0xb),'defaultValue':0x0,'comment':_0xd9f2('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 1020023..95d0e9c 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 _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 +var _0x69bd=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserVoiceQueueRt','update','remove'];(function(_0x321df4,_0x3efec5){var _0x50d06c=function(_0x3ac0f4){while(--_0x3ac0f4){_0x321df4['push'](_0x321df4['shift']());}};_0x50d06c(++_0x3efec5);}(_0x69bd,0x16c));var _0xd69b=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x69bd[_0x5608a3];return _0x1ed50a;};'use strict';var EventEmitter=require(_0xd69b('0x0'));var UserVoiceQueueRt=require(_0xd69b('0x1'))['db'][_0xd69b('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xd69b('0x3'),'afterDestroy':_0xd69b('0x4')};function emitEvent(_0x1beee0){return function(_0x5aac37,_0x1f6da4,_0x1d1d5e){UserVoiceQueueRtEvents[_0xd69b('0x5')](_0x1beee0+':'+_0x5aac37['id'],_0x5aac37);UserVoiceQueueRtEvents[_0xd69b('0x5')](_0x1beee0,_0x5aac37);_0x1d1d5e(null);};}for(var e in events){if(events[_0xd69b('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0xd69b('0x7')](e,emitEvent(event));}}module[_0xd69b('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 37fa7de..9b4e376 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 _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 +var _0x2377=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2377,0xcb));var _0x7237=function(_0x3965c3,_0xfe89c7){_0x3965c3=_0x3965c3-0x0;var _0x1effaf=_0x2377[_0x3965c3];return _0x1effaf;};'use strict';var _=require('lodash');var util=require(_0x7237('0x0'));var logger=require(_0x7237('0x1'))('api');var moment=require(_0x7237('0x2'));var BPromise=require(_0x7237('0x3'));var rp=require(_0x7237('0x4'));var fs=require('fs');var path=require(_0x7237('0x5'));var rimraf=require(_0x7237('0x6'));var config=require(_0x7237('0x7'));var attributes=require(_0x7237('0x8'));module[_0x7237('0x9')]=function(_0x463f04,_0x337940){return _0x463f04[_0x7237('0xa')](_0x7237('0xb'),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 2d399fc..53e6292 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 _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 +var _0xe1a7=['where','sequelize','outboundQueuePauses','GetVoiceQueueRtPauses','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','request\x20sent','debug','stringify','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','info','result','catch','findAll','options','raw'];(function(_0x4f5bbc,_0x28f972){var _0x9ceb1c=function(_0x54426c){while(--_0x54426c){_0x4f5bbc['push'](_0x4f5bbc['shift']());}};_0x9ceb1c(++_0x28f972);}(_0xe1a7,0xf9));var _0x7e1a=function(_0x1d72c0,_0x555853){_0x1d72c0=_0x1d72c0-0x0;var _0x1549df=_0xe1a7[_0x1d72c0];return _0x1549df;};'use strict';var _=require(_0x7e1a('0x0'));var util=require(_0x7e1a('0x1'));var moment=require(_0x7e1a('0x2'));var BPromise=require(_0x7e1a('0x3'));var rs=require(_0x7e1a('0x4'));var fs=require('fs');var Redis=require(_0x7e1a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7e1a('0x6'));var logger=require('../../config/logger')(_0x7e1a('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7e1a('0x8')][_0x7e1a('0x9')]({'port':0x232a});config[_0x7e1a('0xa')]=_[_0x7e1a('0xb')](config[_0x7e1a('0xa')],{'host':_0x7e1a('0xc'),'port':0x18eb});var socket=require(_0x7e1a('0xd'))(new Redis(config['redis']));require(_0x7e1a('0xe'))[_0x7e1a('0xf')](socket);function respondWithRpcPromise(_0x1c86e3,_0x5581d9,_0x4f2e53){return new BPromise(function(_0x47b224,_0x7d872b){return client[_0x7e1a('0x10')](_0x1c86e3,_0x4f2e53)[_0x7e1a('0x11')](function(_0x4ad1be){logger['info']('UserVoiceQueueRt,\x20%s,\x20%s',_0x5581d9,_0x7e1a('0x12'));logger[_0x7e1a('0x13')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x5581d9,_0x7e1a('0x12'),JSON[_0x7e1a('0x14')](_0x4ad1be));if(_0x4ad1be[_0x7e1a('0x15')]){if(_0x4ad1be[_0x7e1a('0x15')][_0x7e1a('0x16')]===0x1f4){logger[_0x7e1a('0x15')](_0x7e1a('0x17'),_0x5581d9,_0x4ad1be['error'][_0x7e1a('0x18')]);return _0x7d872b(_0x4ad1be[_0x7e1a('0x15')][_0x7e1a('0x18')]);}logger[_0x7e1a('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x5581d9,_0x4ad1be[_0x7e1a('0x15')][_0x7e1a('0x18')]);return _0x47b224(_0x4ad1be[_0x7e1a('0x15')][_0x7e1a('0x18')]);}else{logger[_0x7e1a('0x19')](_0x7e1a('0x17'),_0x5581d9,_0x7e1a('0x12'));_0x47b224(_0x4ad1be[_0x7e1a('0x1a')]['message']);}})[_0x7e1a('0x1b')](function(_0x5e113a){logger[_0x7e1a('0x15')](_0x7e1a('0x17'),_0x5581d9,_0x5e113a);_0x7d872b(_0x5e113a);});});}exports['GetVoiceQueueRtPauses']=function(_0x7f85a6){var _0x51d6a3=this;return new Promise(function(_0x292b2a,_0x2d18ae){return db['UserVoiceQueueRt'][_0x7e1a('0x1c')]({'raw':_0x7f85a6[_0x7e1a('0x1d')]?_0x7f85a6[_0x7e1a('0x1d')][_0x7e1a('0x1e')]===undefined?!![]:![]:!![],'where':_0x7f85a6['options']?_0x7f85a6['options'][_0x7e1a('0x1f')]||null:null,'attributes':[[db[_0x7e1a('0x20')]['fn']('COUNT',db[_0x7e1a('0x20')]['fn']('IF',db['sequelize']['literal']('`paused`\x20=\x201,\x201,\x20null'))),_0x7e1a('0x21')]]})[_0x7e1a('0x11')](function(_0x2add67){logger['info'](_0x7e1a('0x22'),_0x7f85a6);logger[_0x7e1a('0x13')]('GetVoiceQueueRtPauses',_0x7f85a6,JSON[_0x7e1a('0x14')](_0x2add67));_0x292b2a(_0x2add67);})[_0x7e1a('0x1b')](function(_0x26b1dd){logger['error'](_0x7e1a('0x22'),_0x26b1dd[_0x7e1a('0x18')],_0x7f85a6);_0x2d18ae(_0x51d6a3['error'](0x1f4,_0x26b1dd[_0x7e1a('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 648f43a..6c8b4a4 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 _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 +var _0x07d7=['remove','update','emit','removeListener','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save'];(function(_0x1f7ad3,_0x5a9448){var _0x471339=function(_0x58791a){while(--_0x58791a){_0x1f7ad3['push'](_0x1f7ad3['shift']());}};_0x471339(++_0x5a9448);}(_0x07d7,0x85));var _0x707d=function(_0x1aeda2,_0x1217eb){_0x1aeda2=_0x1aeda2-0x0;var _0x32dc6d=_0x07d7[_0x1aeda2];return _0x32dc6d;};'use strict';var UserVoiceQueueRtEvents=require(_0x707d('0x0'));var events=[_0x707d('0x1'),_0x707d('0x2'),_0x707d('0x3')];function createListener(_0x11ffb9,_0x38a92e){return function(_0x100f39){_0x38a92e[_0x707d('0x4')](_0x11ffb9,_0x100f39);};}function removeListener(_0x38c520,_0x2a5ddd){return function(){UserVoiceQueueRtEvents[_0x707d('0x5')](_0x38c520,_0x2a5ddd);};}exports[_0x707d('0x6')]=function(_0x1808da){for(var _0x1456bd=0x0,_0x1bdf46=events[_0x707d('0x7')];_0x1456bd<_0x1bdf46;_0x1456bd++){var _0x50de20=events[_0x1456bd];var _0x4c9e57=createListener(_0x707d('0x8')+_0x50de20,_0x1808da);UserVoiceQueueRtEvents['on'](_0x50de20,_0x4c9e57);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index e881298..b18f09b 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(_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 +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x17c419,_0x4f04bb){var _0x3e5cfc=function(_0x31b749){while(--_0x31b749){_0x17c419['push'](_0x17c419['shift']());}};_0x3e5cfc(++_0x4f04bb);}(_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 b1bd6d9..40d0009 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 _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 +var _0xe2c8=['INTEGER','sequelize'];(function(_0x4f638a,_0x31ad6d){var _0x1aef26=function(_0x5e4208){while(--_0x5e4208){_0x4f638a['push'](_0x4f638a['shift']());}};_0x1aef26(++_0x31ad6d);}(_0xe2c8,0x17d));var _0x8e2c=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0xe2c8[_0x2e4aa2];return _0x5e6092;};'use strict';var Sequelize=require(_0x8e2c('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x8e2c('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index c137aa4..c1566b9 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 _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 +var _0xe187=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','lodash','util'];(function(_0x2091d6,_0x32a61b){var _0x361405=function(_0xf2b351){while(--_0xf2b351){_0x2091d6['push'](_0x2091d6['shift']());}};_0x361405(++_0x32a61b);}(_0xe187,0x177));var _0x7e18=function(_0xb51856,_0x3636fe){_0xb51856=_0xb51856-0x0;var _0x4d0628=_0xe187[_0xb51856];return _0x4d0628;};'use strict';var _=require(_0x7e18('0x0'));var util=require(_0x7e18('0x1'));var logger=require(_0x7e18('0x2'))(_0x7e18('0x3'));var moment=require(_0x7e18('0x4'));var BPromise=require('bluebird');var rp=require(_0x7e18('0x5'));var fs=require('fs');var path=require(_0x7e18('0x6'));var rimraf=require(_0x7e18('0x7'));var config=require(_0x7e18('0x8'));var attributes=require(_0x7e18('0x9'));module[_0x7e18('0xa')]=function(_0x3859c8,_0x286fa9){return _0x3859c8[_0x7e18('0xb')](_0x7e18('0xc'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index a5bb4e4..d5bd7dc 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 _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 +var _0xde0f=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb'];(function(_0x6ec16,_0x2e8212){var _0x2b62ac=function(_0x3aa462){while(--_0x3aa462){_0x6ec16['push'](_0x6ec16['shift']());}};_0x2b62ac(++_0x2e8212);}(_0xde0f,0x91));var _0xfde0=function(_0x659152,_0x3c2828){_0x659152=_0x659152-0x0;var _0x3248eb=_0xde0f[_0x659152];return _0x3248eb;};'use strict';var _=require(_0xfde0('0x0'));var util=require('util');var moment=require(_0xfde0('0x1'));var BPromise=require('bluebird');var rs=require(_0xfde0('0x2'));var fs=require('fs');var Redis=require(_0xfde0('0x3'));var db=require(_0xfde0('0x4'))['db'];var utils=require(_0xfde0('0x5'));var logger=require(_0xfde0('0x6'))(_0xfde0('0x7'));var config=require(_0xfde0('0x8'));var jayson=require(_0xfde0('0x9'));var client=jayson[_0xfde0('0xa')][_0xfde0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b1329,_0x387cd6,_0x5ebacc){return new BPromise(function(_0x3023a1,_0x5b6346){return client[_0xfde0('0xc')](_0x4b1329,_0x5ebacc)[_0xfde0('0xd')](function(_0x1106ae){logger[_0xfde0('0xe')](_0xfde0('0xf'),_0x387cd6,'request\x20sent');logger[_0xfde0('0x10')](_0xfde0('0x11'),_0x387cd6,_0xfde0('0x12'),JSON[_0xfde0('0x13')](_0x1106ae));if(_0x1106ae[_0xfde0('0x14')]){if(_0x1106ae['error'][_0xfde0('0x15')]===0x1f4){logger[_0xfde0('0x14')](_0xfde0('0xf'),_0x387cd6,_0x1106ae[_0xfde0('0x14')][_0xfde0('0x16')]);return _0x5b6346(_0x1106ae[_0xfde0('0x14')]['message']);}logger[_0xfde0('0x14')]('UserWhatsappQueue,\x20%s,\x20%s',_0x387cd6,_0x1106ae[_0xfde0('0x14')][_0xfde0('0x16')]);return _0x3023a1(_0x1106ae[_0xfde0('0x14')]['message']);}else{logger[_0xfde0('0xe')](_0xfde0('0xf'),_0x387cd6,'request\x20sent');_0x3023a1(_0x1106ae[_0xfde0('0x17')][_0xfde0('0x16')]);}})[_0xfde0('0x18')](function(_0x47b01c){logger['error']('UserWhatsappQueue,\x20%s,\x20%s',_0x387cd6,_0x47b01c);_0x5b6346(_0x47b01c);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 9b7f533..aab60a9 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 _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 +var _0x9ffd=['isAuthenticated','get','/:id','show','post','create','delete','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x572706,_0xadcdb5){var _0x556ee9=function(_0x5c174b){while(--_0x5c174b){_0x572706['push'](_0x572706['shift']());}};_0x556ee9(++_0xadcdb5);}(_0x9ffd,0x1d7));var _0xd9ff=function(_0x8c5732,_0x3af31d){_0x8c5732=_0x8c5732-0x0;var _0x446ed6=_0x9ffd[_0x8c5732];return _0x446ed6;};'use strict';var multer=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var path=require(_0xd9ff('0x2'));var timeout=require(_0xd9ff('0x3'));var express=require('express');var router=express[_0xd9ff('0x4')]();var fs_extra=require(_0xd9ff('0x5'));var auth=require(_0xd9ff('0x6'));var interaction=require(_0xd9ff('0x7'));var config=require(_0xd9ff('0x8'));var controller=require('./variable.controller');router['get']('/',auth[_0xd9ff('0x9')](),controller['index']);router[_0xd9ff('0xa')](_0xd9ff('0xb'),auth['isAuthenticated'](),controller[_0xd9ff('0xc')]);router[_0xd9ff('0xd')]('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xe')]);router['put'](_0xd9ff('0xb'),auth[_0xd9ff('0x9')](),controller['update']);router[_0xd9ff('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);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 e12d691..f1abdb9 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 _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 +var _0x3fa8=['name','sequelize','exports','STRING'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x3fa8,0x191));var _0x83fa=function(_0xa84f31,_0x261b6f){_0xa84f31=_0xa84f31-0x0;var _0x4cc842=_0x3fa8[_0xa84f31];return _0x4cc842;};'use strict';var Sequelize=require(_0x83fa('0x0'));module[_0x83fa('0x1')]={'name':{'type':Sequelize[_0x83fa('0x2')],'unique':_0x83fa('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 4d723de..f6f6088 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 _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 +var _0x5bd9=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','Variable','rawAttributes','fieldName','type','model','keys','filters','attributes','intersection','fields','query','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0x5bd9,0x95));var _0x95bd=function(_0x44dacd,_0x2d5880){_0x44dacd=_0x44dacd-0x0;var _0x2ffee8=_0x5bd9[_0x44dacd];return _0x2ffee8;};'use strict';var emlformat=require(_0x95bd('0x0'));var rimraf=require(_0x95bd('0x1'));var zipdir=require(_0x95bd('0x2'));var jsonpatch=require(_0x95bd('0x3'));var rp=require(_0x95bd('0x4'));var moment=require(_0x95bd('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x95bd('0x6'));var util=require(_0x95bd('0x7'));var path=require(_0x95bd('0x8'));var sox=require(_0x95bd('0x9'));var csv=require(_0x95bd('0xa'));var ejs=require(_0x95bd('0xb'));var fs=require('fs');var fs_extra=require(_0x95bd('0xc'));var _=require(_0x95bd('0xd'));var squel=require(_0x95bd('0xe'));var crypto=require(_0x95bd('0xf'));var jsforce=require(_0x95bd('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x95bd('0xa'));var querystring=require(_0x95bd('0x11'));var Papa=require(_0x95bd('0x12'));var Redis=require(_0x95bd('0x13'));var authService=require(_0x95bd('0x14'));var qs=require(_0x95bd('0x15'));var as=require(_0x95bd('0x16'));var hardwareService=require(_0x95bd('0x17'));var logger=require(_0x95bd('0x18'))(_0x95bd('0x19'));var utils=require(_0x95bd('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0x95bd('0x1b'));var db=require(_0x95bd('0x1c'))['db'];function respondWithStatusCode(_0x3f524b,_0x3db8e1){_0x3db8e1=_0x3db8e1||0xcc;return function(_0x231d82){if(_0x231d82){return _0x3f524b['sendStatus'](_0x3db8e1);}return _0x3f524b['status'](_0x3db8e1)[_0x95bd('0x1d')]();};}function respondWithResult(_0x465812,_0x23b609){_0x23b609=_0x23b609||0xc8;return function(_0x130b9a){if(_0x130b9a){return _0x465812[_0x95bd('0x1e')](_0x23b609)[_0x95bd('0x1f')](_0x130b9a);}};}function respondWithFilteredResult(_0x1ca242,_0x5056e0){return function(_0xd7e187){if(_0xd7e187){var _0x1cf27c=typeof _0x5056e0[_0x95bd('0x20')]===_0x95bd('0x21')&&typeof _0x5056e0[_0x95bd('0x22')]===_0x95bd('0x21');var _0x10ea7c=_0xd7e187[_0x95bd('0x23')];var _0x32e608=_0x1cf27c?0x0:_0x5056e0[_0x95bd('0x20')];var _0x35b34c=_0x1cf27c?_0xd7e187['count']:_0x5056e0[_0x95bd('0x20')]+_0x5056e0[_0x95bd('0x22')];var _0x2bb835;if(_0x35b34c>=_0x10ea7c){_0x35b34c=_0x10ea7c;_0x2bb835=0xc8;}else{_0x2bb835=0xce;}_0x1ca242[_0x95bd('0x1e')](_0x2bb835);return _0x1ca242[_0x95bd('0x24')](_0x95bd('0x25'),_0x32e608+'-'+_0x35b34c+'/'+_0x10ea7c)['json'](_0xd7e187);}return null;};}function patchUpdates(_0x1aeeda){return function(_0x518be2){try{jsonpatch[_0x95bd('0x26')](_0x518be2,_0x1aeeda,!![]);}catch(_0x26ffd5){return BPromise['reject'](_0x26ffd5);}return _0x518be2[_0x95bd('0x27')]();};}function saveUpdates(_0x1a95ac,_0x218c77){return function(_0x21c819){if(_0x21c819){return _0x21c819[_0x95bd('0x28')](_0x1a95ac)[_0x95bd('0x29')](function(_0x59ca2f){return _0x59ca2f;});}return null;};}function removeEntity(_0x4c8980,_0xef29b7){return function(_0x2beb94){if(_0x2beb94){return _0x2beb94[_0x95bd('0x2a')]()['then'](function(){var _0x1c5b34=_0x2beb94[_0x95bd('0x2b')]({'plain':!![]});var _0x152e1a='Variables';return db[_0x95bd('0x2c')][_0x95bd('0x2a')]({'where':{'type':_0x152e1a,'resourceId':_0x1c5b34['id']}})['then'](function(){return _0x2beb94;});})[_0x95bd('0x29')](function(){_0x4c8980[_0x95bd('0x1e')](0xcc)[_0x95bd('0x1d')]();});}};}function handleEntityNotFound(_0x2cd409,_0x2ef7d3){return function(_0x117479){if(!_0x117479){_0x2cd409['sendStatus'](0x194);}return _0x117479;};}function handleError(_0x583479,_0x49f89e){_0x49f89e=_0x49f89e||0x1f4;return function(_0x353503){logger[_0x95bd('0x2d')](_0x353503[_0x95bd('0x2e')]);if(_0x353503[_0x95bd('0x2f')]){delete _0x353503[_0x95bd('0x2f')];}_0x583479[_0x95bd('0x1e')](_0x49f89e)[_0x95bd('0x30')](_0x353503);};}exports[_0x95bd('0x31')]=function(_0x2aefa1,_0x3b91da){var _0x145188={},_0x3e5d64={},_0x3e8df7={'count':0x0,'rows':[]};var _0xab5d97=_[_0x95bd('0x32')](db[_0x95bd('0x33')][_0x95bd('0x34')],function(_0x2f5f60){return{'name':_0x2f5f60[_0x95bd('0x35')],'type':_0x2f5f60[_0x95bd('0x36')]['key']};});_0x3e5d64[_0x95bd('0x37')]=_['map'](_0xab5d97,'name');_0x3e5d64['query']=_[_0x95bd('0x38')](_0x2aefa1['query']);_0x3e5d64[_0x95bd('0x39')]=_['intersection'](_0x3e5d64['model'],_0x3e5d64['query']);_0x145188[_0x95bd('0x3a')]=_[_0x95bd('0x3b')](_0x3e5d64[_0x95bd('0x37')],qs[_0x95bd('0x3c')](_0x2aefa1[_0x95bd('0x3d')][_0x95bd('0x3c')]));_0x145188[_0x95bd('0x3a')]=_0x145188[_0x95bd('0x3a')][_0x95bd('0x3e')]?_0x145188[_0x95bd('0x3a')]:_0x3e5d64[_0x95bd('0x37')];if(!_0x2aefa1[_0x95bd('0x3d')][_0x95bd('0x3f')](_0x95bd('0x40'))){_0x145188['limit']=qs['limit'](_0x2aefa1[_0x95bd('0x3d')][_0x95bd('0x22')]);_0x145188['offset']=qs['offset'](_0x2aefa1[_0x95bd('0x3d')][_0x95bd('0x20')]);}_0x145188['order']=qs[_0x95bd('0x41')](_0x2aefa1[_0x95bd('0x3d')][_0x95bd('0x41')]);_0x145188[_0x95bd('0x42')]=qs[_0x95bd('0x39')](_[_0x95bd('0x43')](_0x2aefa1[_0x95bd('0x3d')],_0x3e5d64['filters']),_0xab5d97);if(_0x2aefa1['query']['filter']){_0x145188[_0x95bd('0x42')]=_[_0x95bd('0x44')](_0x145188[_0x95bd('0x42')],{'$or':_[_0x95bd('0x32')](_0xab5d97,function(_0x58866f){if(_0x58866f[_0x95bd('0x36')]!==_0x95bd('0x45')){var _0x4d11ed={};_0x4d11ed[_0x58866f['name']]={'$like':'%'+_0x2aefa1['query']['filter']+'%'};return _0x4d11ed;}})});}_0x145188=_[_0x95bd('0x44')]({},_0x145188,_0x2aefa1[_0x95bd('0x46')]);var _0x46d32e={'where':_0x145188[_0x95bd('0x42')]};return db[_0x95bd('0x33')][_0x95bd('0x23')](_0x46d32e)['then'](function(_0xaedb51){_0x3e8df7[_0x95bd('0x23')]=_0xaedb51;if(_0x2aefa1['query'][_0x95bd('0x47')]){_0x145188[_0x95bd('0x48')]=[{'all':!![]}];}return db['Variable'][_0x95bd('0x49')](_0x145188);})['then'](function(_0x477f3e){_0x3e8df7[_0x95bd('0x4a')]=_0x477f3e;return _0x3e8df7;})[_0x95bd('0x29')](respondWithFilteredResult(_0x3b91da,_0x145188))[_0x95bd('0x4b')](handleError(_0x3b91da,null));};exports[_0x95bd('0x4c')]=function(_0x1761a3,_0x3ebc27){var _0x382968={'raw':!![],'where':{'id':_0x1761a3['params']['id']}},_0x56c488={};_0x56c488['model']=_['keys'](db[_0x95bd('0x33')][_0x95bd('0x34')]);_0x56c488['query']=_[_0x95bd('0x38')](_0x1761a3[_0x95bd('0x3d')]);_0x56c488[_0x95bd('0x39')]=_[_0x95bd('0x3b')](_0x56c488[_0x95bd('0x37')],_0x56c488[_0x95bd('0x3d')]);_0x382968['attributes']=_[_0x95bd('0x3b')](_0x56c488[_0x95bd('0x37')],qs['fields'](_0x1761a3['query']['fields']));_0x382968[_0x95bd('0x3a')]=_0x382968[_0x95bd('0x3a')]['length']?_0x382968[_0x95bd('0x3a')]:_0x56c488[_0x95bd('0x37')];if(_0x1761a3[_0x95bd('0x3d')][_0x95bd('0x47')]){_0x382968['include']=[{'all':!![]}];}_0x382968=_[_0x95bd('0x44')]({},_0x382968,_0x1761a3[_0x95bd('0x46')]);return db[_0x95bd('0x33')][_0x95bd('0x4d')](_0x382968)[_0x95bd('0x29')](handleEntityNotFound(_0x3ebc27,null))['then'](respondWithResult(_0x3ebc27,null))[_0x95bd('0x4b')](handleError(_0x3ebc27,null));};exports[_0x95bd('0x4e')]=function(_0x2795f2,_0x298332){return db[_0x95bd('0x33')][_0x95bd('0x4e')](_0x2795f2[_0x95bd('0x4f')],{})[_0x95bd('0x29')](function(_0x43c1b4){var _0x253a56=_0x2795f2[_0x95bd('0x50')]['get']({'plain':!![]});if(!_0x253a56)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x253a56['role']===_0x95bd('0x50')){var _0x540cf0=_0x43c1b4[_0x95bd('0x2b')]({'plain':!![]});var _0x37be85='Variables';return db[_0x95bd('0x51')]['find']({'where':{'name':_0x37be85,'userProfileId':_0x253a56[_0x95bd('0x52')]},'raw':!![]})['then'](function(_0x5679d9){if(_0x5679d9&&_0x5679d9[_0x95bd('0x53')]===0x0){return db[_0x95bd('0x2c')][_0x95bd('0x4e')]({'name':_0x540cf0['name'],'resourceId':_0x540cf0['id'],'type':_0x5679d9[_0x95bd('0x2f')],'sectionId':_0x5679d9['id']},{})[_0x95bd('0x29')](function(){return _0x43c1b4;});}else{return _0x43c1b4;}})['catch'](function(_0x28d1f4){logger[_0x95bd('0x2d')](_0x95bd('0x54'),_0x28d1f4);throw _0x28d1f4;});}return _0x43c1b4;})['then'](respondWithResult(_0x298332,0xc9))[_0x95bd('0x4b')](handleError(_0x298332,null));};exports[_0x95bd('0x28')]=function(_0x57fdcb,_0xf7015a){if(_0x57fdcb[_0x95bd('0x4f')]['id']){delete _0x57fdcb[_0x95bd('0x4f')]['id'];}return db[_0x95bd('0x33')][_0x95bd('0x4d')]({'where':{'id':_0x57fdcb[_0x95bd('0x55')]['id']}})['then'](handleEntityNotFound(_0xf7015a,null))['then'](saveUpdates(_0x57fdcb[_0x95bd('0x4f')],null))[_0x95bd('0x29')](respondWithResult(_0xf7015a,null))[_0x95bd('0x4b')](handleError(_0xf7015a,null));};exports[_0x95bd('0x2a')]=function(_0x3b38ee,_0x615632){return db['Variable']['find']({'where':{'id':_0x3b38ee['params']['id']}})[_0x95bd('0x29')](handleEntityNotFound(_0x615632,null))[_0x95bd('0x29')](removeEntity(_0x615632,null))['catch'](handleError(_0x615632,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index c3c5acf..71339a9 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 _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 +var _0xa930=['Variable','tools_variables','lodash','../../config/logger','api','moment','bluebird','path','../../config/environment','./variable.attributes','exports','define'];(function(_0x386b03,_0x5d0000){var _0xd3d524=function(_0x474754){while(--_0x474754){_0x386b03['push'](_0x386b03['shift']());}};_0xd3d524(++_0x5d0000);}(_0xa930,0xc2));var _0x0a93=function(_0x35f2c2,_0x5480ef){_0x35f2c2=_0x35f2c2-0x0;var _0x2d0eb3=_0xa930[_0x35f2c2];return _0x2d0eb3;};'use strict';var _=require(_0x0a93('0x0'));var util=require('util');var logger=require(_0x0a93('0x1'))(_0x0a93('0x2'));var moment=require(_0x0a93('0x3'));var BPromise=require(_0x0a93('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a93('0x5'));var rimraf=require('rimraf');var config=require(_0x0a93('0x6'));var attributes=require(_0x0a93('0x7'));module[_0x0a93('0x8')]=function(_0x49ce89,_0x331678){return _0x49ce89[_0x0a93('0x9')](_0x0a93('0xa'),attributes,{'tableName':_0x0a93('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 67c3f8d..00bf8b0 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(_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 +var _0x814b=['model','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowVariable','options','where','include','map','attributes'];(function(_0x30bb17,_0x26bb25){var _0x5e6d5f=function(_0x33b879){while(--_0x33b879){_0x30bb17['push'](_0x30bb17['shift']());}};_0x5e6d5f(++_0x26bb25);}(_0x814b,0x1a2));var _0xb814=function(_0x7e918f,_0x48cf10){_0x7e918f=_0x7e918f-0x0;var _0x5b35ab=_0x814b[_0x7e918f];return _0x5b35ab;};'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')]('Variable,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});}exports[_0xb814('0x18')]=function(_0x55ba16){var _0x270598=this;return new Promise(function(_0xfac75b,_0x4c3007){return db['Variable']['find']({'raw':_0x55ba16[_0xb814('0x19')]?_0x55ba16['options']['raw']===undefined?!![]:![]:!![],'where':_0x55ba16[_0xb814('0x19')]?_0x55ba16[_0xb814('0x19')][_0xb814('0x1a')]||null:null,'attributes':_0x55ba16['options']?_0x55ba16[_0xb814('0x19')]['attributes']||null:null,'include':_0x55ba16[_0xb814('0x19')]?_0x55ba16[_0xb814('0x19')][_0xb814('0x1b')]?_[_0xb814('0x1c')](_0x55ba16[_0xb814('0x19')][_0xb814('0x1b')],function(_0x1f5d40){return{'model':db[_0x1f5d40['model']],'as':_0x1f5d40['as'],'attributes':_0x1f5d40[_0xb814('0x1d')],'include':_0x1f5d40['include']?_[_0xb814('0x1c')](_0x1f5d40[_0xb814('0x1b')],function(_0x31c7ec){return{'model':db[_0x31c7ec[_0xb814('0x1e')]],'as':_0x31c7ec['as'],'attributes':_0x31c7ec[_0xb814('0x1d')],'include':_0x31c7ec[_0xb814('0x1b')]?_[_0xb814('0x1c')](_0x31c7ec['include'],function(_0x392222){return{'model':db[_0x392222[_0xb814('0x1e')]],'as':_0x392222['as'],'attributes':_0x392222[_0xb814('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb814('0xd')](function(_0x32ed56){logger[_0xb814('0xe')](_0xb814('0x18'),_0x55ba16);logger[_0xb814('0x11')]('ShowVariable',_0x55ba16,JSON[_0xb814('0x1f')](_0x32ed56));_0xfac75b(_0x32ed56);})[_0xb814('0x17')](function(_0x52ed64){logger[_0xb814('0x13')](_0xb814('0x18'),_0x52ed64[_0xb814('0x15')],_0x55ba16);_0x4c3007(_0x270598['error'](0x1f4,_0x52ed64[_0xb814('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index e6f213b..7b67c63 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 _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 +var _0x604d=['index','/fetch','isAuthenticated','canUpdate','fetch','get','/reset','/pull','pull','/restart','/migrations','migrations','exports','Router','../../components/auth/service','./version.controller'];(function(_0x1d9211,_0x4c1c91){var _0x3fdaa4=function(_0x43625){while(--_0x43625){_0x1d9211['push'](_0x1d9211['shift']());}};_0x3fdaa4(++_0x4c1c91);}(_0x604d,0x1bd));var _0xd604=function(_0xf7a8be,_0x1bf7d3){_0xf7a8be=_0xf7a8be-0x0;var _0x5b566b=_0x604d[_0xf7a8be];return _0x5b566b;};'use strict';var express=require('express');var router=express[_0xd604('0x0')]();var auth=require(_0xd604('0x1'));var controller=require(_0xd604('0x2'));router['get']('/',controller[_0xd604('0x3')]);router['get'](_0xd604('0x4'),auth[_0xd604('0x5')](),auth[_0xd604('0x6')](),controller[_0xd604('0x7')]);router[_0xd604('0x8')](_0xd604('0x9'),auth['isAuthenticated'](),auth['canUpdate'](),controller['reset']);router[_0xd604('0x8')](_0xd604('0xa'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xd604('0xb')]);router['get'](_0xd604('0xc'),auth[_0xd604('0x5')](),controller['restart']);router[_0xd604('0x8')](_0xd604('0xd'),controller[_0xd604('0xe')]);module[_0xd604('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 76223c5..5dee3fa 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 _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 +var _0x4b78=['last','catch','UniqueConstraintError','Database\x20already\x20up-to-date','path','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','exports','query','latest','fetch','tags','status','json','origin','master','error','git\x20fetch','git\x20fetch\x20origin\x20master','reset','FETCH_HEAD','info','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','migrations','readdirSync','join','replace','.js','push','length','sort','Migration','sequelize','getQueryInterface','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','server','\x20to\x20'];(function(_0x51878f,_0x1c88c6){var _0x311bc2=function(_0x31ed2b){while(--_0x31ed2b){_0x51878f['push'](_0x51878f['shift']());}};_0x311bc2(++_0x1c88c6);}(_0x4b78,0x1ac));var _0x84b7=function(_0x44ead3,_0x1b7866){_0x44ead3=_0x44ead3-0x0;var _0x1110c9=_0x4b78[_0x44ead3];return _0x1110c9;};'use strict';var Umzug=require('umzug');var path=require(_0x84b7('0x0'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x84b7('0x1'))(module,_0x84b7('0x2'));var compareVersions=require(_0x84b7('0x3'));var exec=require(_0x84b7('0x4'))[_0x84b7('0x5')];var db=require(_0x84b7('0x6'))['db'];var config=require(_0x84b7('0x7'));var pm2=require(_0x84b7('0x8'));var logger=require(_0x84b7('0x9'))(_0x84b7('0xa'));var git=require(_0x84b7('0xb'))(config[_0x84b7('0xc')]);exports['index']=function(_0x12f080,_0x516376){var _0x289a67={'current':module[_0x84b7('0xd')][_0x84b7('0x2')],'phonebar':0x2};if(_0x12f080[_0x84b7('0xe')]&&_0x12f080['query'][_0x84b7('0xf')]){return git[_0x84b7('0x10')]()[_0x84b7('0x11')](function(_0x57b627,_0x17c536){_0x289a67[_0x84b7('0xf')]=(_0x57b627?module[_0x84b7('0xd')][_0x84b7('0x2')]:_0x17c536[_0x84b7('0xf')])||'2.0.0';return _0x516376[_0x84b7('0x12')](0xc8)[_0x84b7('0x13')](_0x289a67);});}else{return _0x516376[_0x84b7('0x12')](0xc8)[_0x84b7('0x13')](_0x289a67);}};exports[_0x84b7('0x10')]=function(_0x569edb,_0x5eb55b){return git['fetch']([_0x84b7('0x14'),_0x84b7('0x15')],function(_0x33b7ed){if(_0x33b7ed){logger[_0x84b7('0x16')](_0x33b7ed);return _0x5eb55b[_0x84b7('0x12')](0x1f4)[_0x84b7('0x13')](_0x33b7ed);}logger['info'](_0x84b7('0x17'));return _0x5eb55b[_0x84b7('0x12')](0xc8)[_0x84b7('0x13')]({'output':_0x84b7('0x18')});});};exports['reset']=function(_0x2f407b,_0x255e18){return git[_0x84b7('0x19')](['--hard',_0x84b7('0x1a')],function(_0x169283){if(_0x169283){logger[_0x84b7('0x16')](_0x169283);return _0x255e18[_0x84b7('0x12')](0x1f4)[_0x84b7('0x13')](_0x169283);}logger[_0x84b7('0x1b')](_0x84b7('0x1c'));return _0x255e18[_0x84b7('0x12')](0xc8)[_0x84b7('0x13')]({'output':_0x84b7('0x1d')});});};exports['pull']=function(_0x48b89d,_0x36d128){exec('npm\x20install\x20--production',function(_0x47803b,_0x7e358a,_0x27bfbe){logger[_0x84b7('0x1b')](_0x7e358a);logger[_0x84b7('0x1b')](_0x27bfbe);if(_0x47803b){logger[_0x84b7('0x16')](_0x47803b);return _0x36d128[_0x84b7('0x12')](0x1f4)[_0x84b7('0x13')](_0x47803b);}return _0x36d128[_0x84b7('0x12')](0xc8)['json']({'output':_0x7e358a});});};exports[_0x84b7('0x1e')]=function(_0x2bb188,_0x1c0240){return pm2[_0x84b7('0x1e')](_0x84b7('0x1f'))[_0x84b7('0x20')](function(_0x4b0e11){logger['info'](_0x84b7('0x21'),_0x4b0e11);return _0x1c0240[_0x84b7('0x12')](0xc8)['json']({'output':_0x84b7('0x22')});})['catch'](function(_0x4b11bd){logger[_0x84b7('0x16')](_0x4b11bd);return _0x1c0240[_0x84b7('0x12')](0x1f4)[_0x84b7('0x13')](_0x4b11bd);});};exports[_0x84b7('0x23')]=function(_0x50521c,_0x28e93c){var _0x3469e7=fs[_0x84b7('0x24')](path[_0x84b7('0x25')](config['root'],'server',_0x84b7('0x23')));var _0x105a83=[];for(var _0x15f9ec=0x0;_0x15f9ec<_0x3469e7['length'];_0x15f9ec++){var _0x584729=_0x3469e7[_0x15f9ec][_0x84b7('0x26')](_0x84b7('0x27'),'');if(compareVersions(module[_0x84b7('0xd')][_0x84b7('0x2')],_0x584729)===-0x1){_0x105a83[_0x84b7('0x28')](_0x584729);}}if(_0x105a83[_0x84b7('0x29')]){var _0x1fa51d=_0x105a83[_0x84b7('0x2a')](compareVersions);var _0x425d80=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0x84b7('0x2b')],'modelName':_0x84b7('0x2b'),'columnName':_0x84b7('0x2')},'migrations':{'params':[db[_0x84b7('0x2c')][_0x84b7('0x2d')](),db['sequelize']['constructor'],function(){throw new Error(_0x84b7('0x2e'));}],'path':path[_0x84b7('0x25')](config[_0x84b7('0xc')],_0x84b7('0x2f'),_0x84b7('0x23')),'pattern':/\.js$/}});_0x425d80['up']({'migrations':_['map'](_0x1fa51d,function(_0x1114fd){return _0x1114fd+_0x84b7('0x27');})})['then'](function(){return _0x28e93c[_0x84b7('0x12')](0xc8)[_0x84b7('0x13')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0x84b7('0xd')][_0x84b7('0x2')]+_0x84b7('0x30')+_[_0x84b7('0x31')](_0x1fa51d),'migrations':_[_0x84b7('0x25')](_0x1fa51d)});})[_0x84b7('0x32')](function(_0x4bdb25){if(_0x4bdb25 instanceof db[_0x84b7('0x2c')][_0x84b7('0x33')]){return _0x28e93c[_0x84b7('0x12')](0xc8)[_0x84b7('0x13')]({'output':_0x84b7('0x34')});}else{return _0x28e93c['status'](0x1f4)['json'](_0x4bdb25);}});}else{return _0x28e93c[_0x84b7('0x12')](0xc8)[_0x84b7('0x13')]({'output':_0x84b7('0x34')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 22435e7..2be5350 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 _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 +var _0x6f08=['../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','index','get','/describe','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x5bafd3,_0x474626){var _0x4aeb83=function(_0x4ab61a){while(--_0x4ab61a){_0x5bafd3['push'](_0x5bafd3['shift']());}};_0x4aeb83(++_0x474626);}(_0x6f08,0x197));var _0x86f0=function(_0x20b621,_0x5f01c7){_0x20b621=_0x20b621-0x0;var _0x188180=_0x6f08[_0x20b621];return _0x188180;};'use strict';var multer=require(_0x86f0('0x0'));var util=require(_0x86f0('0x1'));var path=require(_0x86f0('0x2'));var timeout=require(_0x86f0('0x3'));var express=require(_0x86f0('0x4'));var router=express['Router']();var fs_extra=require(_0x86f0('0x5'));var auth=require(_0x86f0('0x6'));var interaction=require(_0x86f0('0x7'));var config=require(_0x86f0('0x8'));var controller=require(_0x86f0('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x86f0('0xa')]);router[_0x86f0('0xb')](_0x86f0('0xc'),auth[_0x86f0('0xd')](),controller[_0x86f0('0xe')]);router[_0x86f0('0xb')](_0x86f0('0xf'),auth[_0x86f0('0xd')](),controller['show']);router[_0x86f0('0x10')]('/',auth[_0x86f0('0xd')](),controller[_0x86f0('0x11')]);router[_0x86f0('0x12')]('/:id',auth[_0x86f0('0xd')](),controller[_0x86f0('0x13')]);router[_0x86f0('0x14')](_0x86f0('0xf'),auth[_0x86f0('0xd')](),controller[_0x86f0('0x15')]);module[_0x86f0('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index d7090f6..70618fe 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 _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 +var _0x082b=['BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','INTEGER'];(function(_0x7fb0c2,_0x1b2cc3){var _0x46faaf=function(_0x12e249){while(--_0x12e249){_0x7fb0c2['push'](_0x7fb0c2['shift']());}};_0x46faaf(++_0x1b2cc3);}(_0x082b,0x1ec));var _0xb082=function(_0x509042,_0x541f21){_0x509042=_0x509042-0x0;var _0x1ac556=_0x082b[_0x509042];return _0x1ac556;};'use strict';var Sequelize=require(_0xb082('0x0'));module[_0xb082('0x1')]={'type':{'type':Sequelize[_0xb082('0x2')]},'uniqueid':{'type':Sequelize[_0xb082('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xb082('0x2')]},'queue':{'type':Sequelize[_0xb082('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xb082('0x2')]},'agentcalledAt':{'type':Sequelize[_0xb082('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0xb082('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xb082('0x3')]},'agentdumpAt':{'type':Sequelize[_0xb082('0x3')]},'holdtime':{'type':Sequelize[_0xb082('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xb082('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xb082('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xb082('0x4')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xb082('0x4')]},'reason':{'type':Sequelize[_0xb082('0x2')]},'lastevent':{'type':Sequelize[_0xb082('0x2')]},'channel':{'type':Sequelize[_0xb082('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xb082('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xb082('0x2')]},'language':{'type':Sequelize[_0xb082('0x2')]},'accountcode':{'type':Sequelize[_0xb082('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xb082('0x2')]},'priority':{'type':Sequelize[_0xb082('0x2')]},'destchannel':{'type':Sequelize[_0xb082('0x2')]},'destchannelstate':{'type':Sequelize[_0xb082('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xb082('0x2')]},'destcalleridnum':{'type':Sequelize[_0xb082('0x2')]},'destcalleridname':{'type':Sequelize[_0xb082('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xb082('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xb082('0x2')]},'destaccountcode':{'type':Sequelize[_0xb082('0x2')]},'destcontext':{'type':Sequelize[_0xb082('0x2')]},'destexten':{'type':Sequelize[_0xb082('0x2')]},'destpriority':{'type':Sequelize[_0xb082('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xb082('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xb082('0x2')]},'transfer':{'type':Sequelize[_0xb082('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xb082('0x2')],'comment':_0xb082('0x6')},'transferexten':{'type':Sequelize[_0xb082('0x2')]},'transferuniqueid':{'type':Sequelize[_0xb082('0x2')]},'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 9822f3a..47a438a 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(_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 +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(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'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 ccfae49..d0edcc1 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 _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 +var _0x2494=['api','moment','bluebird','request-promise','path','./voiceAgentReport.attributes','define','report_agent','uniqueid','destuniqueid','lodash','../../config/logger'];(function(_0x98c222,_0x227796){var _0x551728=function(_0x240c29){while(--_0x240c29){_0x98c222['push'](_0x98c222['shift']());}};_0x551728(++_0x227796);}(_0x2494,0x82));var _0x4249=function(_0x12cf2c,_0x2c6dcb){_0x12cf2c=_0x12cf2c-0x0;var _0x23be34=_0x2494[_0x12cf2c];return _0x23be34;};'use strict';var _=require(_0x4249('0x0'));var util=require('util');var logger=require(_0x4249('0x1'))(_0x4249('0x2'));var moment=require(_0x4249('0x3'));var BPromise=require(_0x4249('0x4'));var rp=require(_0x4249('0x5'));var fs=require('fs');var path=require(_0x4249('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4249('0x7'));module['exports']=function(_0x3c2d8d,_0x1d4ca8){return _0x3c2d8d[_0x4249('0x8')]('VoiceAgentReport',attributes,{'tableName':_0x4249('0x9'),'paranoid':![],'indexes':[{'fields':[_0x4249('0xa'),_0x4249('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 4858428..c48d197 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 _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 +var _0x76da=['request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','VoiceAgentReport','create','body','options','raw','CreateVoiceAgentReport','update','where','attributes','limit','UpdateVoiceAgentReport','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x5c1313,_0x298d41){var _0x11ad57=function(_0x24dde7){while(--_0x24dde7){_0x5c1313['push'](_0x5c1313['shift']());}};_0x11ad57(++_0x298d41);}(_0x76da,0xc7));var _0xa76d=function(_0x19b70f,_0x3fdbe9){_0x19b70f=_0x19b70f-0x0;var _0x4bce32=_0x76da[_0x19b70f];return _0x4bce32;};'use strict';var _=require('lodash');var util=require(_0xa76d('0x0'));var moment=require(_0xa76d('0x1'));var BPromise=require(_0xa76d('0x2'));var rs=require(_0xa76d('0x3'));var fs=require('fs');var Redis=require(_0xa76d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa76d('0x5'));var logger=require(_0xa76d('0x6'))(_0xa76d('0x7'));var config=require(_0xa76d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa76d('0x9')][_0xa76d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5b5a4e,_0x44862f,_0x22bc25){return new BPromise(function(_0x3de231,_0x27c5c1){return client[_0xa76d('0xb')](_0x5b5a4e,_0x22bc25)[_0xa76d('0xc')](function(_0x23d796){logger[_0xa76d('0xd')](_0xa76d('0xe'),_0x44862f,_0xa76d('0xf'));logger[_0xa76d('0x10')](_0xa76d('0x11'),_0x44862f,'request\x20sent',JSON[_0xa76d('0x12')](_0x23d796));if(_0x23d796['error']){if(_0x23d796['error'][_0xa76d('0x13')]===0x1f4){logger[_0xa76d('0x14')]('VoiceAgentReport,\x20%s,\x20%s',_0x44862f,_0x23d796['error']['message']);return _0x27c5c1(_0x23d796[_0xa76d('0x14')]['message']);}logger[_0xa76d('0x14')](_0xa76d('0xe'),_0x44862f,_0x23d796['error'][_0xa76d('0x15')]);return _0x3de231(_0x23d796[_0xa76d('0x14')][_0xa76d('0x15')]);}else{logger[_0xa76d('0xd')](_0xa76d('0xe'),_0x44862f,'request\x20sent');_0x3de231(_0x23d796[_0xa76d('0x16')][_0xa76d('0x15')]);}})[_0xa76d('0x17')](function(_0xa73685){logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x44862f,_0xa73685);_0x27c5c1(_0xa73685);});});}exports['CreateVoiceAgentReport']=function(_0x59afcb){var _0x55717c=this;return new Promise(function(_0xa460bc,_0x3ebf9c){return db[_0xa76d('0x18')][_0xa76d('0x19')](_0x59afcb[_0xa76d('0x1a')],{'raw':_0x59afcb[_0xa76d('0x1b')]?_0x59afcb[_0xa76d('0x1b')][_0xa76d('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x2bd70e){logger[_0xa76d('0xd')](_0xa76d('0x1d'),_0x59afcb);logger['debug'](_0xa76d('0x1d'),_0x59afcb,JSON[_0xa76d('0x12')](_0x2bd70e));_0xa460bc(_0x2bd70e);})[_0xa76d('0x17')](function(_0x2f302e){logger[_0xa76d('0x14')](_0xa76d('0x1d'),_0x2f302e['message'],_0x59afcb);_0x3ebf9c(_0x55717c[_0xa76d('0x14')](0x1f4,_0x2f302e[_0xa76d('0x15')]));});});};exports['UpdateVoiceAgentReport']=function(_0x2a5540){var _0xa6e28a=this;return new Promise(function(_0x55d43d,_0x4b4f51){return db[_0xa76d('0x18')][_0xa76d('0x1e')](_0x2a5540[_0xa76d('0x1a')],{'raw':_0x2a5540[_0xa76d('0x1b')]?_0x2a5540[_0xa76d('0x1b')][_0xa76d('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a5540[_0xa76d('0x1b')]?_0x2a5540[_0xa76d('0x1b')][_0xa76d('0x1f')]||null:null,'attributes':_0x2a5540[_0xa76d('0x1b')]?_0x2a5540['options'][_0xa76d('0x20')]||null:null,'limit':_0x2a5540[_0xa76d('0x1b')]?_0x2a5540[_0xa76d('0x1b')][_0xa76d('0x21')]||null:null})[_0xa76d('0xc')](function(_0x48397b){logger[_0xa76d('0xd')]('UpdateVoiceAgentReport',_0x2a5540);logger[_0xa76d('0x10')](_0xa76d('0x22'),_0x2a5540,JSON[_0xa76d('0x12')](_0x48397b));_0x55d43d(_0x48397b);})[_0xa76d('0x17')](function(_0x4d2946){logger[_0xa76d('0x14')](_0xa76d('0x22'),_0x4d2946[_0xa76d('0x15')],_0x2a5540);_0x4b4f51(_0xa6e28a[_0xa76d('0x14')](0x1f4,_0x4d2946[_0xa76d('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 486f466..089c7c0 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 _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 +var _0x0fda=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','multer','path','connect-timeout','express'];(function(_0x3204e2,_0x3cfdf5){var _0x36cdab=function(_0x387dbf){while(--_0x387dbf){_0x3204e2['push'](_0x3204e2['shift']());}};_0x36cdab(++_0x3cfdf5);}(_0x0fda,0x1a0));var _0xa0fd=function(_0x40abc1,_0x46a57a){_0x40abc1=_0x40abc1-0x0;var _0x8f4ba=_0x0fda[_0x40abc1];return _0x8f4ba;};'use strict';var multer=require(_0xa0fd('0x0'));var util=require('util');var path=require(_0xa0fd('0x1'));var timeout=require(_0xa0fd('0x2'));var express=require(_0xa0fd('0x3'));var router=express[_0xa0fd('0x4')]();var fs_extra=require(_0xa0fd('0x5'));var auth=require(_0xa0fd('0x6'));var interaction=require(_0xa0fd('0x7'));var config=require('../../config/environment');var controller=require('./voiceCallReport.controller');router[_0xa0fd('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa0fd('0x8')](_0xa0fd('0x9'),auth[_0xa0fd('0xa')](),controller[_0xa0fd('0xb')]);router['get'](_0xa0fd('0xc'),auth[_0xa0fd('0xa')](),controller[_0xa0fd('0xd')]);router[_0xa0fd('0xe')]('/',auth['isAuthenticated'](),controller[_0xa0fd('0xf')]);router[_0xa0fd('0x10')](_0xa0fd('0xc'),auth['isAuthenticated'](),controller[_0xa0fd('0x11')]);router[_0xa0fd('0x12')](_0xa0fd('0xc'),auth[_0xa0fd('0xa')](),controller[_0xa0fd('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index a19b4cf..ade292b 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 _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 +var _0x4046=['ENUM','inbound','internal','TEXT','DATE','INTEGER','exports','STRING'];(function(_0x3d5ed6,_0x40388c){var _0x48bf10=function(_0x53c301){while(--_0x53c301){_0x3d5ed6['push'](_0x3d5ed6['shift']());}};_0x48bf10(++_0x40388c);}(_0x4046,0x126));var _0x6404=function(_0x50d7e9,_0xbae438){_0x50d7e9=_0x50d7e9-0x0;var _0x2de11a=_0x4046[_0x50d7e9];return _0x2de11a;};'use strict';var Sequelize=require('sequelize');module[_0x6404('0x0')]={'uniqueid':{'type':Sequelize[_0x6404('0x1')]},'type':{'type':Sequelize[_0x6404('0x2')](_0x6404('0x3'),_0x6404('0x4'),'outbound','inbound-fax','outbound-fax','dialer')},'tag':{'type':Sequelize[_0x6404('0x1')]},'accountcode':{'type':Sequelize[_0x6404('0x1')]},'source':{'type':Sequelize[_0x6404('0x1')]},'destination':{'type':Sequelize[_0x6404('0x1')]},'destinationcontext':{'type':Sequelize[_0x6404('0x1')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x6404('0x1')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x6404('0x5')]},'starttime':{'type':Sequelize[_0x6404('0x6')]},'systemanswertime':{'type':Sequelize[_0x6404('0x6')]},'answertime':{'type':Sequelize[_0x6404('0x6')]},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x6404('0x7')]},'mohtime':{'type':Sequelize[_0x6404('0x7')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x6404('0x1')]},'amaflags':{'type':Sequelize[_0x6404('0x1')]},'userfield':{'type':Sequelize[_0x6404('0x1')]},'userDisposition':{'type':Sequelize[_0x6404('0x1')]},'userSecondDisposition':{'type':Sequelize[_0x6404('0x1')]},'userThirdDisposition':{'type':Sequelize[_0x6404('0x1')]},'note':{'type':Sequelize[_0x6404('0x1')]},'prefix':{'type':Sequelize[_0x6404('0x1')]},'routeid':{'type':Sequelize[_0x6404('0x7')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index e13187f..8b1a9ff 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(_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 +var _0xadb5=['filter','VIRTUAL','merge','options','includeAll','include','fullname','User','findAll','rows','show','rawAttributes','length','find','catch','body','params','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0xadb5,0xad));var _0x5adb=function(_0x353764,_0x324741){_0x353764=_0x353764-0x0;var _0x1af1b3=_0xadb5[_0x353764];return _0x1af1b3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5adb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5adb('0x1'));var rp=require(_0x5adb('0x2'));var moment=require(_0x5adb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5adb('0x4'));var util=require(_0x5adb('0x5'));var path=require(_0x5adb('0x6'));var sox=require('sox');var csv=require(_0x5adb('0x7'));var ejs=require(_0x5adb('0x8'));var fs=require('fs');var fs_extra=require(_0x5adb('0x9'));var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x7'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0b70,_0x5433bf){_0x5433bf=_0x5433bf||0xcc;return function(_0x8cfcc6){if(_0x8cfcc6){return _0x2a0b70[_0x5adb('0x18')](_0x5433bf);}return _0x2a0b70[_0x5adb('0x19')](_0x5433bf)['end']();};}function respondWithResult(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xc8;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['status'](_0x34af2c)[_0x5adb('0x1a')](_0xf82f72);}};}function respondWithFilteredResult(_0x518823,_0x367d82){return function(_0x42a482){if(_0x42a482){var _0x30614e=typeof _0x367d82[_0x5adb('0x1b')]===_0x5adb('0x1c')&&typeof _0x367d82[_0x5adb('0x1d')]===_0x5adb('0x1c');var _0x42f4c6=_0x42a482[_0x5adb('0x1e')];var _0x529b65=_0x30614e?0x0:_0x367d82[_0x5adb('0x1b')];var _0x5de028=_0x30614e?_0x42a482[_0x5adb('0x1e')]:_0x367d82['offset']+_0x367d82[_0x5adb('0x1d')];var _0x50e84f;if(_0x5de028>=_0x42f4c6){_0x5de028=_0x42f4c6;_0x50e84f=0xc8;}else{_0x50e84f=0xce;}_0x518823['status'](_0x50e84f);return _0x518823[_0x5adb('0x1f')](_0x5adb('0x20'),_0x529b65+'-'+_0x5de028+'/'+_0x42f4c6)[_0x5adb('0x1a')](_0x42a482);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x21')](_0x3754cc)[_0x5adb('0x22')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0xfd9bb9[_0x5adb('0x19')](0xcc)[_0x5adb('0x24')]();});}};}function handleEntityNotFound(_0x49f203,_0x2fee18){return function(_0x2e1e63){if(!_0x2e1e63){_0x49f203['sendStatus'](0x194);}return _0x2e1e63;};}function handleError(_0x1feecf,_0x1ded9f){_0x1ded9f=_0x1ded9f||0x1f4;return function(_0x1a0acd){logger['error'](_0x1a0acd[_0x5adb('0x25')]);if(_0x1a0acd[_0x5adb('0x26')]){delete _0x1a0acd[_0x5adb('0x26')];}_0x1feecf[_0x5adb('0x19')](_0x1ded9f)[_0x5adb('0x27')](_0x1a0acd);};}exports[_0x5adb('0x28')]=function(_0x4a5d46,_0x49992e){var _0x5d457e={},_0x39bddd={},_0x1eac55={'count':0x0,'rows':[]};var _0x60a672=_[_0x5adb('0x29')](db[_0x5adb('0x2a')]['rawAttributes'],function(_0x11ec2a){return{'name':_0x11ec2a[_0x5adb('0x2b')],'type':_0x11ec2a[_0x5adb('0x2c')][_0x5adb('0x2d')]};});_0x39bddd[_0x5adb('0x2e')]=_[_0x5adb('0x29')](_0x60a672,_0x5adb('0x26'));_0x39bddd[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x4a5d46[_0x5adb('0x2f')]);_0x39bddd['filters']=_[_0x5adb('0x31')](_0x39bddd['model'],_0x39bddd[_0x5adb('0x2f')]);_0x5d457e[_0x5adb('0x32')]=_['intersection'](_0x39bddd[_0x5adb('0x2e')],qs[_0x5adb('0x33')](_0x4a5d46[_0x5adb('0x2f')]['fields']));_0x5d457e[_0x5adb('0x32')]=_0x5d457e[_0x5adb('0x32')]['length']?_0x5d457e['attributes']:_0x39bddd[_0x5adb('0x2e')];if(!_0x4a5d46['query'][_0x5adb('0x34')](_0x5adb('0x35'))){_0x5d457e[_0x5adb('0x1d')]=qs[_0x5adb('0x1d')](_0x4a5d46[_0x5adb('0x2f')]['limit']);_0x5d457e[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x4a5d46[_0x5adb('0x2f')]['offset']);}_0x5d457e['order']=qs[_0x5adb('0x36')](_0x4a5d46[_0x5adb('0x2f')]['sort']);_0x5d457e[_0x5adb('0x37')]=qs['filters'](_[_0x5adb('0x38')](_0x4a5d46['query'],_0x39bddd[_0x5adb('0x39')]),_0x60a672);if(_0x4a5d46['query'][_0x5adb('0x3a')]){_0x5d457e[_0x5adb('0x37')]=_['merge'](_0x5d457e[_0x5adb('0x37')],{'$or':_['map'](_0x60a672,function(_0xadbe37){if(_0xadbe37[_0x5adb('0x2c')]!==_0x5adb('0x3b')){var _0x50edd1={};_0x50edd1[_0xadbe37[_0x5adb('0x26')]]={'$like':'%'+_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3a')]+'%'};return _0x50edd1;}})});}_0x5d457e=_[_0x5adb('0x3c')]({},_0x5d457e,_0x4a5d46[_0x5adb('0x3d')]);var _0x52d74f={'where':_0x5d457e['where']};return db['VoiceCallReport']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'attributes':['id',_0x5adb('0x26'),_0x5adb('0x40'),'alias'],'model':db['User'],'as':_0x5adb('0x41')}];}return db['VoiceCallReport'][_0x5adb('0x42')](_0x5d457e);})[_0x5adb('0x22')](function(_0x299746){_0x1eac55[_0x5adb('0x43')]=_0x299746;return _0x1eac55;})[_0x5adb('0x22')](respondWithFilteredResult(_0x49992e,_0x5d457e))['catch'](handleError(_0x49992e,null));};exports[_0x5adb('0x44')]=function(_0x565b03,_0x508690){var _0x4160ad={'raw':!![],'where':{'id':_0x565b03['params']['id']}},_0x1a256c={};_0x1a256c[_0x5adb('0x2e')]=_[_0x5adb('0x30')](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x1a256c[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x565b03[_0x5adb('0x2f')]);_0x1a256c['filters']=_['intersection'](_0x1a256c[_0x5adb('0x2e')],_0x1a256c[_0x5adb('0x2f')]);_0x4160ad[_0x5adb('0x32')]=_[_0x5adb('0x31')](_0x1a256c['model'],qs['fields'](_0x565b03[_0x5adb('0x2f')][_0x5adb('0x33')]));_0x4160ad[_0x5adb('0x32')]=_0x4160ad[_0x5adb('0x32')][_0x5adb('0x46')]?_0x4160ad['attributes']:_0x1a256c[_0x5adb('0x2e')];if(_0x565b03[_0x5adb('0x2f')]['includeAll']){_0x4160ad[_0x5adb('0x3f')]=[{'all':!![]}];}_0x4160ad=_[_0x5adb('0x3c')]({},_0x4160ad,_0x565b03[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')][_0x5adb('0x47')](_0x4160ad)[_0x5adb('0x22')](handleEntityNotFound(_0x508690,null))[_0x5adb('0x22')](respondWithResult(_0x508690,null))[_0x5adb('0x48')](handleError(_0x508690,null));};exports['create']=function(_0x3a925b,_0x57dc8b){return db['VoiceCallReport']['create'](_0x3a925b[_0x5adb('0x49')],{})[_0x5adb('0x22')](respondWithResult(_0x57dc8b,0xc9))[_0x5adb('0x48')](handleError(_0x57dc8b,null));};exports['destroy']=function(_0x2ad69d,_0x5cbab5){return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'id':_0x2ad69d[_0x5adb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5cbab5,null))[_0x5adb('0x22')](removeEntity(_0x5cbab5,null))['catch'](handleError(_0x5cbab5,null));};exports[_0x5adb('0x4b')]=function(_0x6dc067,_0x55c535){return db[_0x5adb('0x2a')][_0x5adb('0x4b')]()[_0x5adb('0x22')](respondWithResult(_0x55c535,null))[_0x5adb('0x48')](handleError(_0x55c535,null));};exports[_0x5adb('0x21')]=function(_0x4cb36c,_0x36b847){if(_0x4cb36c[_0x5adb('0x49')][_0x5adb('0x4c')]){delete _0x4cb36c[_0x5adb('0x49')]['uniqueid'];}return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'uniqueid':_0x4cb36c[_0x5adb('0x4a')]['id'],'UserId':{'$or':[null,_0x4cb36c['user']['id']]}}})[_0x5adb('0x22')](handleEntityNotFound(_0x36b847,null))[_0x5adb('0x22')](saveUpdates(_0x4cb36c[_0x5adb('0x49')],null))[_0x5adb('0x22')](respondWithResult(_0x36b847,null))['catch'](handleError(_0x36b847,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index c05d3d0..5661326 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 _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 +var _0x1c4d=['VoiceCallReport','report_call','uniqueid','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./voiceCallReport.attributes','define'];(function(_0x229031,_0x1fee27){var _0x5c4f63=function(_0x197fbe){while(--_0x197fbe){_0x229031['push'](_0x229031['shift']());}};_0x5c4f63(++_0x1fee27);}(_0x1c4d,0x1d7));var _0xd1c4=function(_0xc33471,_0x1aee66){_0xc33471=_0xc33471-0x0;var _0x5a7d3d=_0x1c4d[_0xc33471];return _0x5a7d3d;};'use strict';var _=require('lodash');var util=require(_0xd1c4('0x0'));var logger=require(_0xd1c4('0x1'))(_0xd1c4('0x2'));var moment=require('moment');var BPromise=require(_0xd1c4('0x3'));var rp=require(_0xd1c4('0x4'));var fs=require('fs');var path=require(_0xd1c4('0x5'));var rimraf=require(_0xd1c4('0x6'));var config=require('../../config/environment');var attributes=require(_0xd1c4('0x7'));module['exports']=function(_0x406eb6,_0x12e793){return _0x406eb6[_0xd1c4('0x8')](_0xd1c4('0x9'),attributes,{'tableName':_0xd1c4('0xa'),'paranoid':![],'indexes':[{'fields':[_0xd1c4('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 0e9c733..9409e3a 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 _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 +var _0xfb9c=['CreateVoiceCallReport','create','body','UpdateVoiceCallReport','update','lodash','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','request','then','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetVoiceCallReport','VoiceCallReport','raw','options','where','attributes','limit','include','map','model'];(function(_0x3fab66,_0x3193c8){var _0x181c4b=function(_0x20dd42){while(--_0x20dd42){_0x3fab66['push'](_0x3fab66['shift']());}};_0x181c4b(++_0x3193c8);}(_0xfb9c,0x89));var _0xcfb9=function(_0x426de2,_0x24acaf){_0x426de2=_0x426de2-0x0;var _0x1dbafc=_0xfb9c[_0x426de2];return _0x1dbafc;};'use strict';var _=require(_0xcfb9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xcfb9('0x1'));var rs=require(_0xcfb9('0x2'));var fs=require('fs');var Redis=require(_0xcfb9('0x3'));var db=require(_0xcfb9('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xcfb9('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x271db7,_0xe8c006,_0x4f3d96){return new BPromise(function(_0x1369b5,_0x515800){return client[_0xcfb9('0x6')](_0x271db7,_0x4f3d96)[_0xcfb9('0x7')](function(_0x122e85){logger['info'](_0xcfb9('0x8'),_0xe8c006,_0xcfb9('0x9'));logger[_0xcfb9('0xa')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0xe8c006,_0xcfb9('0x9'),JSON[_0xcfb9('0xb')](_0x122e85));if(_0x122e85[_0xcfb9('0xc')]){if(_0x122e85[_0xcfb9('0xc')][_0xcfb9('0xd')]===0x1f4){logger[_0xcfb9('0xc')](_0xcfb9('0x8'),_0xe8c006,_0x122e85[_0xcfb9('0xc')]['message']);return _0x515800(_0x122e85[_0xcfb9('0xc')][_0xcfb9('0xe')]);}logger[_0xcfb9('0xc')]('VoiceCallReport,\x20%s,\x20%s',_0xe8c006,_0x122e85[_0xcfb9('0xc')][_0xcfb9('0xe')]);return _0x1369b5(_0x122e85['error']['message']);}else{logger[_0xcfb9('0xf')]('VoiceCallReport,\x20%s,\x20%s',_0xe8c006,_0xcfb9('0x9'));_0x1369b5(_0x122e85[_0xcfb9('0x10')][_0xcfb9('0xe')]);}})[_0xcfb9('0x11')](function(_0x412e99){logger[_0xcfb9('0xc')](_0xcfb9('0x8'),_0xe8c006,_0x412e99);_0x515800(_0x412e99);});});}exports[_0xcfb9('0x12')]=function(_0x2e9a0c){var _0x12538f=this;return new Promise(function(_0x58703d,_0x1d6de0){return db[_0xcfb9('0x13')]['findAll']({'raw':_0x2e9a0c['options']?_0x2e9a0c['options'][_0xcfb9('0x14')]===undefined?!![]:![]:!![],'where':_0x2e9a0c['options']?_0x2e9a0c[_0xcfb9('0x15')][_0xcfb9('0x16')]||null:null,'attributes':_0x2e9a0c['options']?_0x2e9a0c[_0xcfb9('0x15')][_0xcfb9('0x17')]||null:null,'limit':_0x2e9a0c[_0xcfb9('0x15')]?_0x2e9a0c[_0xcfb9('0x15')][_0xcfb9('0x18')]||null:null,'include':_0x2e9a0c['options']?_0x2e9a0c[_0xcfb9('0x15')][_0xcfb9('0x19')]?_[_0xcfb9('0x1a')](_0x2e9a0c[_0xcfb9('0x15')][_0xcfb9('0x19')],function(_0x110864){return{'model':db[_0x110864[_0xcfb9('0x1b')]],'as':_0x110864['as'],'attributes':_0x110864['attributes'],'include':_0x110864[_0xcfb9('0x19')]?_[_0xcfb9('0x1a')](_0x110864[_0xcfb9('0x19')],function(_0x508b2f){return{'model':db[_0x508b2f['model']],'as':_0x508b2f['as'],'attributes':_0x508b2f[_0xcfb9('0x17')],'include':_0x508b2f[_0xcfb9('0x19')]?_[_0xcfb9('0x1a')](_0x508b2f['include'],function(_0x59e204){return{'model':db[_0x59e204['model']],'as':_0x59e204['as'],'attributes':_0x59e204[_0xcfb9('0x17')]};}):[]};}):[]};}):[]:[]})[_0xcfb9('0x7')](function(_0x4013a3){logger[_0xcfb9('0xf')]('GetVoiceCallReport',_0x2e9a0c);logger['debug'](_0xcfb9('0x12'),_0x2e9a0c,JSON[_0xcfb9('0xb')](_0x4013a3));_0x58703d(_0x4013a3);})[_0xcfb9('0x11')](function(_0x19225a){logger['error']('GetVoiceCallReport',_0x19225a['message'],_0x2e9a0c);_0x1d6de0(_0x12538f[_0xcfb9('0xc')](0x1f4,_0x19225a['message']));});});};exports[_0xcfb9('0x1c')]=function(_0x504493){var _0x2c8c95=this;return new Promise(function(_0x5bf7bd,_0x2f05bc){return db[_0xcfb9('0x13')][_0xcfb9('0x1d')](_0x504493[_0xcfb9('0x1e')],{'raw':_0x504493['options']?_0x504493[_0xcfb9('0x15')][_0xcfb9('0x14')]===undefined?!![]:![]:!![]})['then'](function(_0x62c48d){logger[_0xcfb9('0xf')](_0xcfb9('0x1c'),_0x504493);logger[_0xcfb9('0xa')](_0xcfb9('0x1c'),_0x504493,JSON['stringify'](_0x62c48d));_0x5bf7bd(_0x62c48d);})['catch'](function(_0x266952){logger[_0xcfb9('0xc')](_0xcfb9('0x1c'),_0x266952[_0xcfb9('0xe')],_0x504493);_0x2f05bc(_0x2c8c95['error'](0x1f4,_0x266952[_0xcfb9('0xe')]));});});};exports[_0xcfb9('0x1f')]=function(_0x1a48e0){var _0x3e8a9e=this;return new Promise(function(_0x3e1efa,_0x2d51ec){return db[_0xcfb9('0x13')][_0xcfb9('0x20')](_0x1a48e0[_0xcfb9('0x1e')],{'raw':_0x1a48e0[_0xcfb9('0x15')]?_0x1a48e0[_0xcfb9('0x15')][_0xcfb9('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a48e0[_0xcfb9('0x15')]?_0x1a48e0[_0xcfb9('0x15')]['where']||null:null,'attributes':_0x1a48e0[_0xcfb9('0x15')]?_0x1a48e0[_0xcfb9('0x15')]['attributes']||null:null,'limit':_0x1a48e0[_0xcfb9('0x15')]?_0x1a48e0[_0xcfb9('0x15')][_0xcfb9('0x18')]||null:null})[_0xcfb9('0x7')](function(_0x2b6d5f){logger[_0xcfb9('0xf')](_0xcfb9('0x1f'),_0x1a48e0);logger[_0xcfb9('0xa')](_0xcfb9('0x1f'),_0x1a48e0,JSON['stringify'](_0x2b6d5f));_0x3e1efa(_0x2b6d5f);})[_0xcfb9('0x11')](function(_0x203e52){logger[_0xcfb9('0xc')]('UpdateVoiceCallReport',_0x203e52['message'],_0x1a48e0);_0x2d51ec(_0x3e8a9e['error'](0x1f4,_0x203e52[_0xcfb9('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 475785f..4be3de6 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 _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 +var _0x38f9=['util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','show','post','isAuthenticated','create','put','/:id','update','destroy','exports'];(function(_0x3f6df1,_0x1fd59d){var _0x468a85=function(_0xda1a96){while(--_0xda1a96){_0x3f6df1['push'](_0x3f6df1['shift']());}};_0x468a85(++_0x1fd59d);}(_0x38f9,0xbb));var _0x938f=function(_0x2eb5bc,_0x4634c6){_0x2eb5bc=_0x2eb5bc-0x0;var _0x51c7b1=_0x38f9[_0x2eb5bc];return _0x51c7b1;};'use strict';var multer=require('multer');var util=require(_0x938f('0x0'));var path=require(_0x938f('0x1'));var timeout=require(_0x938f('0x2'));var express=require('express');var router=express[_0x938f('0x3')]();var fs_extra=require(_0x938f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x938f('0x5'));var config=require(_0x938f('0x6'));var controller=require('./voiceChanSpy.controller');router[_0x938f('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x938f('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x938f('0x8')]);router[_0x938f('0x9')]('/',auth[_0x938f('0xa')](),controller[_0x938f('0xb')]);router[_0x938f('0xc')](_0x938f('0xd'),auth[_0x938f('0xa')](),controller[_0x938f('0xe')]);router['delete'](_0x938f('0xd'),auth['isAuthenticated'](),controller[_0x938f('0xf')]);module[_0x938f('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 5887b19..ee79350 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 _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 +var _0xe4c5=['split','BOOLEAN','sequelize','exports','STRING','options','join','getDataValue'];(function(_0x2a1494,_0x271b73){var _0x50091e=function(_0x13a2d7){while(--_0x13a2d7){_0x2a1494['push'](_0x2a1494['shift']());}};_0x50091e(++_0x271b73);}(_0xe4c5,0x8a));var _0x5e4c=function(_0x4d52f5,_0x412544){_0x4d52f5=_0x4d52f5-0x0;var _0x5bd5e5=_0xe4c5[_0x4d52f5];return _0x5bd5e5;};'use strict';var Sequelize=require(_0x5e4c('0x0'));module[_0x5e4c('0x1')]={'name':{'type':Sequelize[_0x5e4c('0x2')]},'prefix':{'type':Sequelize[_0x5e4c('0x2')],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0x5e4c('0x2')],'set':function(_0x29e177){this['setDataValue'](_0x5e4c('0x3'),_0x29e177?_0x29e177[_0x5e4c('0x4')](''):[]);},'get':function(){return this[_0x5e4c('0x5')]('options')?this[_0x5e4c('0x5')]('options')[_0x5e4c('0x6')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x5e4c('0x2')]},'record':{'type':Sequelize[_0x5e4c('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x5e4c('0x2')]},'description':{'type':Sequelize[_0x5e4c('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 134b7c9..cb792e5 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 _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 +var _0x1b32=['end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','VoiceChanSpy','findAll','rows','show','params','includeAll','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ChanSpies','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','get'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x1b32,0x85));var _0x21b3=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x1b32[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x21b3('0x0'));var zipdir=require(_0x21b3('0x1'));var jsonpatch=require(_0x21b3('0x2'));var rp=require(_0x21b3('0x3'));var moment=require(_0x21b3('0x4'));var BPromise=require(_0x21b3('0x5'));var Mustache=require(_0x21b3('0x6'));var util=require(_0x21b3('0x7'));var path=require(_0x21b3('0x8'));var sox=require(_0x21b3('0x9'));var csv=require(_0x21b3('0xa'));var ejs=require(_0x21b3('0xb'));var fs=require('fs');var fs_extra=require(_0x21b3('0xc'));var _=require(_0x21b3('0xd'));var squel=require(_0x21b3('0xe'));var crypto=require('crypto');var jsforce=require(_0x21b3('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x21b3('0x10'));var Redis=require(_0x21b3('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x21b3('0x12'));var hardwareService=require(_0x21b3('0x13'));var logger=require(_0x21b3('0x14'))('api');var utils=require(_0x21b3('0x15'));var config=require(_0x21b3('0x16'));var licenseUtil=require(_0x21b3('0x17'));var db=require(_0x21b3('0x18'))['db'];function respondWithStatusCode(_0x40cc5a,_0x2c7abb){_0x2c7abb=_0x2c7abb||0xcc;return function(_0x3bff49){if(_0x3bff49){return _0x40cc5a[_0x21b3('0x19')](_0x2c7abb);}return _0x40cc5a[_0x21b3('0x1a')](_0x2c7abb)['end']();};}function respondWithResult(_0xa537ad,_0x810f46){_0x810f46=_0x810f46||0xc8;return function(_0x43bede){if(_0x43bede){return _0xa537ad['status'](_0x810f46)[_0x21b3('0x1b')](_0x43bede);}};}function respondWithFilteredResult(_0x4c931d,_0x3f7b4a){return function(_0x579a37){if(_0x579a37){var _0x15662a=typeof _0x3f7b4a[_0x21b3('0x1c')]===_0x21b3('0x1d')&&typeof _0x3f7b4a[_0x21b3('0x1e')]==='undefined';var _0x3f7e7a=_0x579a37['count'];var _0x408c17=_0x15662a?0x0:_0x3f7b4a[_0x21b3('0x1c')];var _0xaf1eba=_0x15662a?_0x579a37[_0x21b3('0x1f')]:_0x3f7b4a['offset']+_0x3f7b4a[_0x21b3('0x1e')];var _0x1e31bb;if(_0xaf1eba>=_0x3f7e7a){_0xaf1eba=_0x3f7e7a;_0x1e31bb=0xc8;}else{_0x1e31bb=0xce;}_0x4c931d[_0x21b3('0x1a')](_0x1e31bb);return _0x4c931d['set'](_0x21b3('0x20'),_0x408c17+'-'+_0xaf1eba+'/'+_0x3f7e7a)[_0x21b3('0x1b')](_0x579a37);}return null;};}function patchUpdates(_0x2f996d){return function(_0x3fe141){try{jsonpatch[_0x21b3('0x21')](_0x3fe141,_0x2f996d,!![]);}catch(_0x1be234){return BPromise[_0x21b3('0x22')](_0x1be234);}return _0x3fe141['save']();};}function saveUpdates(_0xbb78f3,_0x54695b){return function(_0x139672){if(_0x139672){return _0x139672[_0x21b3('0x23')](_0xbb78f3)[_0x21b3('0x24')](function(_0x4fcb87){return _0x4fcb87;});}return null;};}function removeEntity(_0x19ba2c,_0x5bda6e){return function(_0x3ee234){if(_0x3ee234){return _0x3ee234[_0x21b3('0x25')]()[_0x21b3('0x24')](function(){var _0x4412f0=_0x3ee234[_0x21b3('0x26')]({'plain':!![]});var _0x2e3221='ChanSpies';return db['UserProfileResource']['destroy']({'where':{'type':_0x2e3221,'resourceId':_0x4412f0['id']}})[_0x21b3('0x24')](function(){return _0x3ee234;});})[_0x21b3('0x24')](function(){_0x19ba2c[_0x21b3('0x1a')](0xcc)[_0x21b3('0x27')]();});}};}function handleEntityNotFound(_0x18eba4,_0x58a356){return function(_0x170e78){if(!_0x170e78){_0x18eba4['sendStatus'](0x194);}return _0x170e78;};}function handleError(_0x16d012,_0x56063c){_0x56063c=_0x56063c||0x1f4;return function(_0x469e42){logger[_0x21b3('0x28')](_0x469e42[_0x21b3('0x29')]);if(_0x469e42['name']){delete _0x469e42[_0x21b3('0x2a')];}_0x16d012[_0x21b3('0x1a')](_0x56063c)[_0x21b3('0x2b')](_0x469e42);};}exports[_0x21b3('0x2c')]=function(_0x34663e,_0x210c49){var _0x2cc056={},_0x4bbec2={},_0x5c3f6f={'count':0x0,'rows':[]};var _0x2053d4=_[_0x21b3('0x2d')](db['VoiceChanSpy'][_0x21b3('0x2e')],function(_0xa04ac7){return{'name':_0xa04ac7[_0x21b3('0x2f')],'type':_0xa04ac7[_0x21b3('0x30')][_0x21b3('0x31')]};});_0x4bbec2[_0x21b3('0x32')]=_[_0x21b3('0x2d')](_0x2053d4,_0x21b3('0x2a'));_0x4bbec2[_0x21b3('0x33')]=_['keys'](_0x34663e['query']);_0x4bbec2[_0x21b3('0x34')]=_['intersection'](_0x4bbec2[_0x21b3('0x32')],_0x4bbec2[_0x21b3('0x33')]);_0x2cc056['attributes']=_[_0x21b3('0x35')](_0x4bbec2[_0x21b3('0x32')],qs[_0x21b3('0x36')](_0x34663e[_0x21b3('0x33')]['fields']));_0x2cc056[_0x21b3('0x37')]=_0x2cc056[_0x21b3('0x37')][_0x21b3('0x38')]?_0x2cc056[_0x21b3('0x37')]:_0x4bbec2['model'];if(!_0x34663e[_0x21b3('0x33')]['hasOwnProperty'](_0x21b3('0x39'))){_0x2cc056[_0x21b3('0x1e')]=qs[_0x21b3('0x1e')](_0x34663e[_0x21b3('0x33')][_0x21b3('0x1e')]);_0x2cc056[_0x21b3('0x1c')]=qs[_0x21b3('0x1c')](_0x34663e['query']['offset']);}_0x2cc056[_0x21b3('0x3a')]=qs[_0x21b3('0x3b')](_0x34663e[_0x21b3('0x33')][_0x21b3('0x3b')]);_0x2cc056['where']=qs[_0x21b3('0x34')](_[_0x21b3('0x3c')](_0x34663e[_0x21b3('0x33')],_0x4bbec2[_0x21b3('0x34')]),_0x2053d4);if(_0x34663e[_0x21b3('0x33')][_0x21b3('0x3d')]){_0x2cc056[_0x21b3('0x3e')]=_[_0x21b3('0x3f')](_0x2cc056[_0x21b3('0x3e')],{'$or':_[_0x21b3('0x2d')](_0x2053d4,function(_0x36dd10){if(_0x36dd10['type']!==_0x21b3('0x40')){var _0x321050={};_0x321050[_0x36dd10['name']]={'$like':'%'+_0x34663e[_0x21b3('0x33')]['filter']+'%'};return _0x321050;}})});}_0x2cc056=_[_0x21b3('0x3f')]({},_0x2cc056,_0x34663e[_0x21b3('0x41')]);var _0x483f0c={'where':_0x2cc056['where']};return db['VoiceChanSpy'][_0x21b3('0x1f')](_0x483f0c)[_0x21b3('0x24')](function(_0x3e6501){_0x5c3f6f[_0x21b3('0x1f')]=_0x3e6501;if(_0x34663e['query']['includeAll']){_0x2cc056[_0x21b3('0x42')]=[{'all':!![]}];}return db[_0x21b3('0x43')][_0x21b3('0x44')](_0x2cc056);})[_0x21b3('0x24')](function(_0x306bf2){_0x5c3f6f[_0x21b3('0x45')]=_0x306bf2;return _0x5c3f6f;})[_0x21b3('0x24')](respondWithFilteredResult(_0x210c49,_0x2cc056))['catch'](handleError(_0x210c49,null));};exports[_0x21b3('0x46')]=function(_0x44cf7d,_0x164de9){var _0x282b05={'raw':![],'where':{'id':_0x44cf7d[_0x21b3('0x47')]['id']}},_0x119b43={};_0x119b43['model']=_['keys'](db[_0x21b3('0x43')][_0x21b3('0x2e')]);_0x119b43[_0x21b3('0x33')]=_['keys'](_0x44cf7d[_0x21b3('0x33')]);_0x119b43[_0x21b3('0x34')]=_[_0x21b3('0x35')](_0x119b43[_0x21b3('0x32')],_0x119b43[_0x21b3('0x33')]);_0x282b05[_0x21b3('0x37')]=_['intersection'](_0x119b43[_0x21b3('0x32')],qs[_0x21b3('0x36')](_0x44cf7d[_0x21b3('0x33')]['fields']));_0x282b05['attributes']=_0x282b05['attributes'][_0x21b3('0x38')]?_0x282b05[_0x21b3('0x37')]:_0x119b43[_0x21b3('0x32')];if(_0x44cf7d[_0x21b3('0x33')][_0x21b3('0x48')]){_0x282b05[_0x21b3('0x42')]=[{'all':!![]}];}_0x282b05=_[_0x21b3('0x3f')]({},_0x282b05,_0x44cf7d[_0x21b3('0x41')]);return db[_0x21b3('0x43')]['find'](_0x282b05)['then'](handleEntityNotFound(_0x164de9,null))['then'](respondWithResult(_0x164de9,null))[_0x21b3('0x49')](handleError(_0x164de9,null));};exports[_0x21b3('0x4a')]=function(_0x4046cd,_0x2e4add){return db[_0x21b3('0x43')][_0x21b3('0x4a')](_0x4046cd[_0x21b3('0x4b')],{})[_0x21b3('0x24')](function(_0x3590b0){var _0x46c106=_0x4046cd['user'][_0x21b3('0x26')]({'plain':!![]});if(!_0x46c106)throw new Error(_0x21b3('0x4c'));if(_0x46c106[_0x21b3('0x4d')]===_0x21b3('0x4e')){var _0x34509e=_0x3590b0[_0x21b3('0x26')]({'plain':!![]});var _0xf10700=_0x21b3('0x4f');return db[_0x21b3('0x50')]['find']({'where':{'name':_0xf10700,'userProfileId':_0x46c106[_0x21b3('0x51')]},'raw':!![]})[_0x21b3('0x24')](function(_0x3cfd1e){if(_0x3cfd1e&&_0x3cfd1e[_0x21b3('0x52')]===0x0){return db[_0x21b3('0x53')]['create']({'name':_0x34509e['name'],'resourceId':_0x34509e['id'],'type':_0x3cfd1e[_0x21b3('0x2a')],'sectionId':_0x3cfd1e['id']},{})[_0x21b3('0x24')](function(){return _0x3590b0;});}else{return _0x3590b0;}})[_0x21b3('0x49')](function(_0x1be6d3){logger[_0x21b3('0x28')](_0x21b3('0x54'),_0x1be6d3);throw _0x1be6d3;});}return _0x3590b0;})['then'](respondWithResult(_0x2e4add,0xc9))['catch'](handleError(_0x2e4add,null));};exports[_0x21b3('0x23')]=function(_0xc28070,_0x45eb49){if(_0xc28070[_0x21b3('0x4b')]['id']){delete _0xc28070['body']['id'];}return db[_0x21b3('0x43')]['find']({'where':{'id':_0xc28070[_0x21b3('0x47')]['id']}})[_0x21b3('0x24')](handleEntityNotFound(_0x45eb49,null))['then'](saveUpdates(_0xc28070['body'],null))[_0x21b3('0x24')](respondWithResult(_0x45eb49,null))[_0x21b3('0x49')](handleError(_0x45eb49,null));};exports[_0x21b3('0x25')]=function(_0xd3eb29,_0xc612b5){return db[_0x21b3('0x43')][_0x21b3('0x55')]({'where':{'id':_0xd3eb29['params']['id']}})[_0x21b3('0x24')](handleEntityNotFound(_0xc612b5,null))[_0x21b3('0x24')](removeEntity(_0xc612b5,null))[_0x21b3('0x49')](handleError(_0xc612b5,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 8e06f0d..b00a678 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 _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 +var _0x58ff=['recordingFormat','auth','push','ChanSpy','SIP/%s,%s','options','StopMixMonitor','length','concat','internal','name','findAll','agent','then','catch','models','voice_chanspy','VoiceExtension','bulkCreate','destroy','lodash','./voiceChanSpy.attributes','context','from-sip','format','%s%s','system','merge','Set','chanspy','record','${UNIQUEID}.%s,a'];(function(_0x1c2517,_0x310fc4){var _0x7661ef=function(_0x165f6c){while(--_0x165f6c){_0x1c2517['push'](_0x1c2517['shift']());}};_0x7661ef(++_0x310fc4);}(_0x58ff,0x1d4));var _0xf58f=function(_0x3e14a3,_0x479d7b){_0x3e14a3=_0x3e14a3-0x0;var _0x3c330d=_0x58ff[_0x3e14a3];return _0x3c330d;};'use strict';var _=require(_0xf58f('0x0'));var util=require('util');var BPromise=require('bluebird');var attributes=require(_0xf58f('0x1'));var getUserApplications=function(_0x495f5a,_0x478a98,_0x4e27d3){var _0x44c8f8=0x1;var _0x7b897e=[];var _0xb0fe10={'context':_0x478a98[_0xf58f('0x2')]||_0xf58f('0x3'),'exten':util[_0xf58f('0x4')](_0xf58f('0x5'),_0x495f5a['prefix'],_0x4e27d3),'type':_0xf58f('0x6'),'isApp':![],'ChanSpyId':_0x495f5a['id'],'UserId':_0x478a98['id']};_0x7b897e['push'](_[_0xf58f('0x7')]({'app':_0xf58f('0x8'),'appdata':util[_0xf58f('0x4')]('CDR(type)=%s',_0xf58f('0x9')),'priority':_0x44c8f8++},_0xb0fe10));if(_0x495f5a[_0xf58f('0xa')]){_0x7b897e['push'](_[_0xf58f('0x7')]({'app':'MixMonitor','appdata':util[_0xf58f('0x4')](_0xf58f('0xb'),_0x495f5a[_0xf58f('0xc')]),'priority':_0x44c8f8++},_0xb0fe10));}if(_0x495f5a[_0xf58f('0xd')]){_0x7b897e[_0xf58f('0xe')](_[_0xf58f('0x7')]({'app':'Authenticate','appdata':_0x495f5a['password'],'priority':_0x44c8f8++},_0xb0fe10));}_0x7b897e[_0xf58f('0xe')](_[_0xf58f('0x7')]({'app':_0xf58f('0xf'),'appdata':util['format'](_0xf58f('0x10'),_0x478a98['name'],_0x495f5a[_0xf58f('0x11')]?_0x495f5a['options']['join'](''):''),'priority':_0x44c8f8++},_0xb0fe10));if(_0x495f5a['record']){_0x7b897e[_0xf58f('0xe')](_[_0xf58f('0x7')]({'app':_0xf58f('0x12'),'priority':_0x44c8f8++},_0xb0fe10));}return _0x7b897e;};var getChanSpyApplications=function(_0x3d1754,_0x2d6b62){var _0x213497=[];for(var _0x1e6449=0x0,_0x1ce66b=0x1;_0x1e6449<_0x2d6b62[_0xf58f('0x13')];_0x1e6449++,_0x1ce66b=0x1){_0x213497=_0x213497[_0xf58f('0x14')](getUserApplications(_0x3d1754,_0x2d6b62[_0x1e6449],_0x2d6b62[_0x1e6449][_0xf58f('0x15')]));if(_0x2d6b62[_0x1e6449][_0xf58f('0x15')]!=_0x2d6b62[_0x1e6449][_0xf58f('0x16')]){_0x213497=_0x213497[_0xf58f('0x14')](getUserApplications(_0x3d1754,_0x2d6b62[_0x1e6449],_0x2d6b62[_0x1e6449]['name']));}}return _0x213497;};var getChanSpyPromise=function(_0x1c7985,_0x2fa043){return new BPromise(function(_0x389515,_0x2bd328){return _0x1c7985['User'][_0xf58f('0x17')]({'attributes':['id',_0xf58f('0x16'),_0xf58f('0x15')],'where':{'role':_0xf58f('0x18'),'chanspy':!![]},'raw':!![]})[_0xf58f('0x19')](function(_0x1b066c){if(_0x1b066c){return _0x389515(getChanSpyApplications(_0x2fa043,_0x1b066c));}return _0x389515([]);})[_0xf58f('0x1a')](function(_0x2f41ca){_0x2bd328(_0x2f41ca);});});};module['exports']=function(_0x293d5c,_0x5cfcb7){var _0x456319=_0x293d5c[_0xf58f('0x1b')];return _0x293d5c['define']('VoiceChanSpy',attributes,{'tableName':_0xf58f('0x1c'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4d5190,_0x1b805f,_0x406289){return getChanSpyPromise(_0x456319,_0x4d5190)[_0xf58f('0x19')](function(_0x304253){if(_0x304253&&_0x304253[_0xf58f('0x13')]){return _0x456319[_0xf58f('0x1d')][_0xf58f('0x1e')](_0x304253);}})[_0xf58f('0x19')](function(){_0x406289();})[_0xf58f('0x1a')](function(_0x236a24){_0x406289(_0x236a24);});},'afterUpdate':function(_0x17c75d,_0x559ca5,_0x5299d2){return _0x456319['VoiceExtension'][_0xf58f('0x1f')]({'where':{'ChanSpyId':_0x17c75d['id']}})['then'](function(){return getChanSpyPromise(_0x456319,_0x17c75d);})[_0xf58f('0x19')](function(_0x5b0f3f){if(_0x5b0f3f&&_0x5b0f3f[_0xf58f('0x13')]){return _0x456319[_0xf58f('0x1d')]['bulkCreate'](_0x5b0f3f);}})['then'](function(){_0x5299d2();})[_0xf58f('0x1a')](function(_0x6abca7){_0x5299d2(_0x6abca7);});},'afterDestroy':function(_0x2a8807,_0x3519cc,_0x332eb7){return _0x456319[_0xf58f('0x1d')][_0xf58f('0x1f')]({'where':{'ChanSpyId':_0x2a8807['id']}})[_0xf58f('0x19')](function(){_0x332eb7();})[_0xf58f('0x1a')](function(_0x5a0555){_0x332eb7(_0x5a0555);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 3c3b5e4..b95085a 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 _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 +var _0x6c76=['request\x20sent','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','request','info','VoiceChanSpy,\x20%s,\x20%s'];(function(_0x435eac,_0x459918){var _0x436f53=function(_0x450946){while(--_0x450946){_0x435eac['push'](_0x435eac['shift']());}};_0x436f53(++_0x459918);}(_0x6c76,0x184));var _0x66c7=function(_0x551b0a,_0x41348c){_0x551b0a=_0x551b0a-0x0;var _0x5dacb8=_0x6c76[_0x551b0a];return _0x5dacb8;};'use strict';var _=require(_0x66c7('0x0'));var util=require(_0x66c7('0x1'));var moment=require(_0x66c7('0x2'));var BPromise=require('bluebird');var rs=require(_0x66c7('0x3'));var fs=require('fs');var Redis=require(_0x66c7('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x66c7('0x5'))(_0x66c7('0x6'));var config=require('../../config/environment');var jayson=require(_0x66c7('0x7'));var client=jayson[_0x66c7('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23408c,_0x4dffcd,_0x4fa6ce){return new BPromise(function(_0x208d06,_0x2b0065){return client[_0x66c7('0x9')](_0x23408c,_0x4fa6ce)['then'](function(_0x20c010){logger[_0x66c7('0xa')](_0x66c7('0xb'),_0x4dffcd,_0x66c7('0xc'));logger['debug'](_0x66c7('0xd'),_0x4dffcd,_0x66c7('0xc'),JSON[_0x66c7('0xe')](_0x20c010));if(_0x20c010[_0x66c7('0xf')]){if(_0x20c010[_0x66c7('0xf')][_0x66c7('0x10')]===0x1f4){logger[_0x66c7('0xf')]('VoiceChanSpy,\x20%s,\x20%s',_0x4dffcd,_0x20c010[_0x66c7('0xf')][_0x66c7('0x11')]);return _0x2b0065(_0x20c010[_0x66c7('0xf')][_0x66c7('0x11')]);}logger[_0x66c7('0xf')](_0x66c7('0xb'),_0x4dffcd,_0x20c010[_0x66c7('0xf')][_0x66c7('0x11')]);return _0x208d06(_0x20c010[_0x66c7('0xf')]['message']);}else{logger[_0x66c7('0xa')]('VoiceChanSpy,\x20%s,\x20%s',_0x4dffcd,_0x66c7('0xc'));_0x208d06(_0x20c010[_0x66c7('0x12')][_0x66c7('0x11')]);}})[_0x66c7('0x13')](function(_0x22b262){logger['error']('VoiceChanSpy,\x20%s,\x20%s',_0x4dffcd,_0x22b262);_0x2b0065(_0x22b262);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 90d1aeb..9127a72 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 _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 +var _0x126d=['/:id','update','delete','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceContext.controller','isAuthenticated','post','create','put'];(function(_0x5d163f,_0x2710e6){var _0x5b6990=function(_0x485d17){while(--_0x485d17){_0x5d163f['push'](_0x5d163f['shift']());}};_0x5b6990(++_0x2710e6);}(_0x126d,0xe4));var _0xd126=function(_0x541a54,_0x5ced7e){_0x541a54=_0x541a54-0x0;var _0x243e40=_0x126d[_0x541a54];return _0x243e40;};'use strict';var multer=require(_0xd126('0x0'));var util=require('util');var path=require(_0xd126('0x1'));var timeout=require(_0xd126('0x2'));var express=require('express');var router=express[_0xd126('0x3')]();var fs_extra=require(_0xd126('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd126('0x5'));var config=require(_0xd126('0x6'));var controller=require(_0xd126('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0xd126('0x8')](),controller['show']);router[_0xd126('0x9')]('/',auth[_0xd126('0x8')](),controller[_0xd126('0xa')]);router[_0xd126('0xb')](_0xd126('0xc'),auth[_0xd126('0x8')](),controller[_0xd126('0xd')]);router[_0xd126('0xe')]('/:id',auth[_0xd126('0x8')](),controller['destroy']);module[_0xd126('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index fb50876..b8aebb7 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 _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 +var _0x2499=['sequelize','exports','STRING','BOOLEAN'];(function(_0x8cbc94,_0x53c62d){var _0x284b48=function(_0xa85952){while(--_0xa85952){_0x8cbc94['push'](_0x8cbc94['shift']());}};_0x284b48(++_0x53c62d);}(_0x2499,0x108));var _0x9249=function(_0x2a71d8,_0x2244ba){_0x2a71d8=_0x2a71d8-0x0;var _0x39008f=_0x2499[_0x2a71d8];return _0x39008f;};'use strict';var Sequelize=require(_0x9249('0x0'));module[_0x9249('0x1')]={'name':{'type':Sequelize[_0x9249('0x2')],'unique':'name'},'description':{'type':Sequelize[_0x9249('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x9249('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 92e5b20..186a786 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 _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 +var _0x4c7c=['findAll','rows','params','intersection','create','body','readFileSync','join','root','server/files/templates/context.ejs','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','utf8','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','http','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','Contexts','UserProfileResource','destroy','status','stack','name','send','index','VoiceContext','rawAttributes','fieldName','map','query','keys','filters','attributes','model','fields','length','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include'];(function(_0x3a62c9,_0x4656c3){var _0x26f7b2=function(_0xb388f3){while(--_0xb388f3){_0x3a62c9['push'](_0x3a62c9['shift']());}};_0x26f7b2(++_0x4656c3);}(_0x4c7c,0x153));var _0xc4c7=function(_0x3987a1,_0x447793){_0x3987a1=_0x3987a1-0x0;var _0xe2596e=_0x4c7c[_0x3987a1];return _0xe2596e;};'use strict';var emlformat=require(_0xc4c7('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc4c7('0x1'));var rp=require(_0xc4c7('0x2'));var moment=require(_0xc4c7('0x3'));var BPromise=require(_0xc4c7('0x4'));var Mustache=require(_0xc4c7('0x5'));var util=require('util');var path=require(_0xc4c7('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc4c7('0x7'));var _=require(_0xc4c7('0x8'));var squel=require(_0xc4c7('0x9'));var crypto=require(_0xc4c7('0xa'));var jsforce=require(_0xc4c7('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xc4c7('0xc'));var querystring=require(_0xc4c7('0xd'));var Papa=require(_0xc4c7('0xe'));var Redis=require(_0xc4c7('0xf'));var authService=require(_0xc4c7('0x10'));var qs=require(_0xc4c7('0x11'));var as=require(_0xc4c7('0x12'));var hardwareService=require(_0xc4c7('0x13'));var logger=require(_0xc4c7('0x14'))(_0xc4c7('0x15'));var utils=require(_0xc4c7('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xc4c7('0x17'));var db=require(_0xc4c7('0x18'))['db'];var jayson=require(_0xc4c7('0x19'));var client=jayson['client'][_0xc4c7('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x384256,_0x15fabd,_0x437a19,_0x66b0c5){return new BPromise(function(_0x37f0e4,_0x18a3ab){var _0x5f3dd2=_0x66b0c5||client;return _0x5f3dd2['request'](_0x384256,_0x437a19)[_0xc4c7('0x1b')](function(_0x329ef1){logger[_0xc4c7('0x1c')](_0xc4c7('0x1d'),_0x15fabd,_0xc4c7('0x1e'));logger[_0xc4c7('0x1f')](_0xc4c7('0x20'),_0x15fabd,_0xc4c7('0x1e'),JSON['stringify'](_0x329ef1));if(_0x329ef1[_0xc4c7('0x21')]){if(_0x329ef1[_0xc4c7('0x21')][_0xc4c7('0x22')]===0x1f4){logger[_0xc4c7('0x21')]('VoiceContext,\x20%s,\x20%s',_0x15fabd,_0x329ef1['error'][_0xc4c7('0x23')]);return _0x18a3ab(_0x329ef1[_0xc4c7('0x21')][_0xc4c7('0x23')]);}logger[_0xc4c7('0x21')](_0xc4c7('0x1d'),_0x15fabd,_0x329ef1[_0xc4c7('0x21')][_0xc4c7('0x23')]);return _0x37f0e4(_0x329ef1[_0xc4c7('0x21')][_0xc4c7('0x23')]);}else{logger[_0xc4c7('0x1c')](_0xc4c7('0x1d'),_0x15fabd,'request\x20sent');_0x37f0e4(_0x329ef1[_0xc4c7('0x24')][_0xc4c7('0x23')]);}})[_0xc4c7('0x25')](function(_0x5e41f7){logger[_0xc4c7('0x21')]('VoiceContext,\x20%s,\x20%s',_0x15fabd,_0x5e41f7);_0x18a3ab(_0x5e41f7);});});}function respondWithStatusCode(_0x9eb020,_0x43c890){_0x43c890=_0x43c890||0xcc;return function(_0x2575c3){if(_0x2575c3){return _0x9eb020['sendStatus'](_0x43c890);}return _0x9eb020['status'](_0x43c890)[_0xc4c7('0x26')]();};}function respondWithResult(_0x2edcdd,_0x3e1711){_0x3e1711=_0x3e1711||0xc8;return function(_0x210d19){if(_0x210d19){return _0x2edcdd['status'](_0x3e1711)[_0xc4c7('0x27')](_0x210d19);}};}function respondWithFilteredResult(_0x56c164,_0x2e4788){return function(_0x24681c){if(_0x24681c){var _0x8af12f=typeof _0x2e4788[_0xc4c7('0x28')]===_0xc4c7('0x29')&&typeof _0x2e4788[_0xc4c7('0x2a')]==='undefined';var _0x492dcd=_0x24681c[_0xc4c7('0x2b')];var _0x5151b0=_0x8af12f?0x0:_0x2e4788[_0xc4c7('0x28')];var _0x438f8a=_0x8af12f?_0x24681c[_0xc4c7('0x2b')]:_0x2e4788['offset']+_0x2e4788[_0xc4c7('0x2a')];var _0x221486;if(_0x438f8a>=_0x492dcd){_0x438f8a=_0x492dcd;_0x221486=0xc8;}else{_0x221486=0xce;}_0x56c164['status'](_0x221486);return _0x56c164[_0xc4c7('0x2c')](_0xc4c7('0x2d'),_0x5151b0+'-'+_0x438f8a+'/'+_0x492dcd)[_0xc4c7('0x27')](_0x24681c);}return null;};}function patchUpdates(_0x42ff13){return function(_0xe593a7){try{jsonpatch[_0xc4c7('0x2e')](_0xe593a7,_0x42ff13,!![]);}catch(_0x42debe){return BPromise[_0xc4c7('0x2f')](_0x42debe);}return _0xe593a7[_0xc4c7('0x30')]();};}function saveUpdates(_0x403eca,_0x2cc467){return function(_0x13ee79){if(_0x13ee79){return _0x13ee79[_0xc4c7('0x31')](_0x403eca)[_0xc4c7('0x1b')](function(_0x1b0f12){return _0x1b0f12;});}return null;};}function removeEntity(_0x9bb919,_0x1ce34a){return function(_0xc52432){if(_0xc52432){return _0xc52432['destroy']()['then'](function(){var _0x1eb53c=_0xc52432['get']({'plain':!![]});var _0x9e239f=_0xc4c7('0x32');return db[_0xc4c7('0x33')][_0xc4c7('0x34')]({'where':{'type':_0x9e239f,'resourceId':_0x1eb53c['id']}})['then'](function(){return _0xc52432;});})[_0xc4c7('0x1b')](function(){_0x9bb919[_0xc4c7('0x35')](0xcc)[_0xc4c7('0x26')]();});}};}function handleEntityNotFound(_0x28b7d8,_0x1b8815){return function(_0x1ca2a1){if(!_0x1ca2a1){_0x28b7d8['sendStatus'](0x194);}return _0x1ca2a1;};}function handleError(_0x81aa01,_0x184efa){_0x184efa=_0x184efa||0x1f4;return function(_0x48ac01){logger['error'](_0x48ac01[_0xc4c7('0x36')]);if(_0x48ac01[_0xc4c7('0x37')]){delete _0x48ac01[_0xc4c7('0x37')];}_0x81aa01[_0xc4c7('0x35')](_0x184efa)[_0xc4c7('0x38')](_0x48ac01);};}exports[_0xc4c7('0x39')]=function(_0x33cace,_0x5ca41a){var _0x51bf1c={},_0x6f6cf1={},_0x401a25={'count':0x0,'rows':[]};var _0x79f27c=_['map'](db[_0xc4c7('0x3a')][_0xc4c7('0x3b')],function(_0xcbef7a){return{'name':_0xcbef7a[_0xc4c7('0x3c')],'type':_0xcbef7a['type']['key']};});_0x6f6cf1['model']=_[_0xc4c7('0x3d')](_0x79f27c,_0xc4c7('0x37'));_0x6f6cf1[_0xc4c7('0x3e')]=_[_0xc4c7('0x3f')](_0x33cace[_0xc4c7('0x3e')]);_0x6f6cf1[_0xc4c7('0x40')]=_['intersection'](_0x6f6cf1['model'],_0x6f6cf1[_0xc4c7('0x3e')]);_0x51bf1c[_0xc4c7('0x41')]=_['intersection'](_0x6f6cf1[_0xc4c7('0x42')],qs[_0xc4c7('0x43')](_0x33cace[_0xc4c7('0x3e')]['fields']));_0x51bf1c[_0xc4c7('0x41')]=_0x51bf1c['attributes'][_0xc4c7('0x44')]?_0x51bf1c[_0xc4c7('0x41')]:_0x6f6cf1[_0xc4c7('0x42')];if(!_0x33cace[_0xc4c7('0x3e')]['hasOwnProperty'](_0xc4c7('0x45'))){_0x51bf1c[_0xc4c7('0x2a')]=qs['limit'](_0x33cace[_0xc4c7('0x3e')][_0xc4c7('0x2a')]);_0x51bf1c[_0xc4c7('0x28')]=qs[_0xc4c7('0x28')](_0x33cace[_0xc4c7('0x3e')][_0xc4c7('0x28')]);}_0x51bf1c[_0xc4c7('0x46')]=qs[_0xc4c7('0x47')](_0x33cace[_0xc4c7('0x3e')][_0xc4c7('0x47')]);_0x51bf1c[_0xc4c7('0x48')]=qs['filters'](_[_0xc4c7('0x49')](_0x33cace['query'],_0x6f6cf1['filters']),_0x79f27c);if(_0x33cace[_0xc4c7('0x3e')]['filter']){_0x51bf1c['where']=_[_0xc4c7('0x4a')](_0x51bf1c[_0xc4c7('0x48')],{'$or':_[_0xc4c7('0x3d')](_0x79f27c,function(_0x354416){if(_0x354416[_0xc4c7('0x4b')]!==_0xc4c7('0x4c')){var _0x2f12b6={};_0x2f12b6[_0x354416[_0xc4c7('0x37')]]={'$like':'%'+_0x33cace['query'][_0xc4c7('0x4d')]+'%'};return _0x2f12b6;}})});}_0x51bf1c=_[_0xc4c7('0x4a')]({},_0x51bf1c,_0x33cace[_0xc4c7('0x4e')]);var _0x4b435c={'where':_0x51bf1c[_0xc4c7('0x48')]};return db[_0xc4c7('0x3a')][_0xc4c7('0x2b')](_0x4b435c)['then'](function(_0x3581e0){_0x401a25['count']=_0x3581e0;if(_0x33cace[_0xc4c7('0x3e')][_0xc4c7('0x4f')]){_0x51bf1c[_0xc4c7('0x50')]=[{'all':!![]}];}return db[_0xc4c7('0x3a')][_0xc4c7('0x51')](_0x51bf1c);})['then'](function(_0x1098c2){_0x401a25[_0xc4c7('0x52')]=_0x1098c2;return _0x401a25;})['then'](respondWithFilteredResult(_0x5ca41a,_0x51bf1c))['catch'](handleError(_0x5ca41a,null));};exports['show']=function(_0x2ebfd8,_0x4d63c0){var _0x178bfd={'raw':![],'where':{'id':_0x2ebfd8[_0xc4c7('0x53')]['id']}},_0x3c7438={};_0x3c7438[_0xc4c7('0x42')]=_['keys'](db[_0xc4c7('0x3a')][_0xc4c7('0x3b')]);_0x3c7438[_0xc4c7('0x3e')]=_[_0xc4c7('0x3f')](_0x2ebfd8[_0xc4c7('0x3e')]);_0x3c7438[_0xc4c7('0x40')]=_[_0xc4c7('0x54')](_0x3c7438[_0xc4c7('0x42')],_0x3c7438[_0xc4c7('0x3e')]);_0x178bfd[_0xc4c7('0x41')]=_[_0xc4c7('0x54')](_0x3c7438[_0xc4c7('0x42')],qs['fields'](_0x2ebfd8[_0xc4c7('0x3e')][_0xc4c7('0x43')]));_0x178bfd[_0xc4c7('0x41')]=_0x178bfd[_0xc4c7('0x41')][_0xc4c7('0x44')]?_0x178bfd[_0xc4c7('0x41')]:_0x3c7438[_0xc4c7('0x42')];if(_0x2ebfd8[_0xc4c7('0x3e')]['includeAll']){_0x178bfd[_0xc4c7('0x50')]=[{'all':!![]}];}_0x178bfd=_[_0xc4c7('0x4a')]({},_0x178bfd,_0x2ebfd8['options']);return db[_0xc4c7('0x3a')]['find'](_0x178bfd)[_0xc4c7('0x1b')](handleEntityNotFound(_0x4d63c0,null))[_0xc4c7('0x1b')](respondWithResult(_0x4d63c0,null))[_0xc4c7('0x25')](handleError(_0x4d63c0,null));};exports['create']=function(_0x1dd647,_0x1bfaad,_0xfe4645){var _0x1e4361;return db[_0xc4c7('0x3a')][_0xc4c7('0x55')](_0x1dd647[_0xc4c7('0x56')],{'raw':!![]})['then'](function(_0x1f9717){_0x1e4361=_0x1f9717;return db[_0xc4c7('0x3a')][_0xc4c7('0x51')]({'raw':!![]});})[_0xc4c7('0x1b')](function(_0x877f2e){var _0x57ecdf=fs[_0xc4c7('0x57')](path[_0xc4c7('0x58')](config[_0xc4c7('0x59')],_0xc4c7('0x5a')),'utf8');var _0x11182a=ejs[_0xc4c7('0x5b')](_0x57ecdf,{'contexts':_0x877f2e||[]});fs[_0xc4c7('0x5c')](_0xc4c7('0x5d'),_0x11182a);})['then'](function(){return respondWithRpcPromise(_0xc4c7('0x5e'),'create',{'module':_0xc4c7('0x5f')});})['then'](function(){var _0x710442=_0x1dd647[_0xc4c7('0x60')][_0xc4c7('0x61')]({'plain':!![]});if(!_0x710442)throw new Error(_0xc4c7('0x62'));if(_0x710442[_0xc4c7('0x63')]===_0xc4c7('0x60')){var _0x4817dc=_0x1e4361[_0xc4c7('0x61')]({'plain':!![]});return db['UserProfileSection'][_0xc4c7('0x64')]({'where':{'name':_0xc4c7('0x32'),'userProfileId':_0x710442[_0xc4c7('0x65')]},'raw':!![]})[_0xc4c7('0x1b')](function(_0xe8816e){if(_0xe8816e&&_0xe8816e[_0xc4c7('0x66')]===0x0){return db['UserProfileResource'][_0xc4c7('0x55')]({'name':_0x4817dc[_0xc4c7('0x37')],'resourceId':_0x4817dc['id'],'type':_0xe8816e[_0xc4c7('0x37')],'sectionId':_0xe8816e['id']},{})[_0xc4c7('0x1b')](function(){return _0x1e4361;});}else{return _0x1e4361;}})['catch'](function(_0x198373){logger[_0xc4c7('0x21')](_0xc4c7('0x67'),_0x198373);throw _0x198373;});}return _0x1e4361;})[_0xc4c7('0x1b')](respondWithResult(_0x1bfaad,0xc9))[_0xc4c7('0x25')](handleError(_0x1bfaad,null));};exports['update']=function(_0x38cba9,_0x3b5e83,_0x3ab432){var _0x15173c;return db[_0xc4c7('0x3a')][_0xc4c7('0x64')]({'where':{'id':_0x38cba9[_0xc4c7('0x53')]['id']}})['then'](handleEntityNotFound(_0x3b5e83,null))[_0xc4c7('0x1b')](saveUpdates(_0x38cba9[_0xc4c7('0x56')],null))[_0xc4c7('0x1b')](function(_0x4f4a52){if(_0x4f4a52){_0x15173c=_0x4f4a52;return db[_0xc4c7('0x3a')][_0xc4c7('0x51')]({'raw':!![]});}})[_0xc4c7('0x1b')](function(_0x4b668d){var _0x23111c=fs[_0xc4c7('0x57')](path['join'](config['root'],'server/files/templates/context.ejs'),_0xc4c7('0x68'));var _0x19f7ce=ejs[_0xc4c7('0x5b')](_0x23111c,{'contexts':_0x4b668d||[]});fs['writeFileSync'](_0xc4c7('0x5d'),_0x19f7ce);})[_0xc4c7('0x1b')](function(){return respondWithRpcPromise('Reload',_0xc4c7('0x31'),{'module':_0xc4c7('0x5f')});})[_0xc4c7('0x1b')](function(){return _0x15173c;})['then'](respondWithResult(_0x3b5e83,null))[_0xc4c7('0x25')](handleError(_0x3b5e83,null));};exports[_0xc4c7('0x34')]=function(_0x5678a0,_0x1e7f4a,_0x23baf0){var _0x2c8288;return db[_0xc4c7('0x3a')]['find']({'where':{'id':_0x5678a0[_0xc4c7('0x53')]['id']}})[_0xc4c7('0x1b')](handleEntityNotFound(_0x1e7f4a,null))['then'](removeEntity(_0x1e7f4a,null))[_0xc4c7('0x1b')](function(){return db['VoiceContext'][_0xc4c7('0x51')]({'raw':!![]});})['then'](function(_0x200d01){var _0x2cb3cd=fs[_0xc4c7('0x57')](path[_0xc4c7('0x58')](config[_0xc4c7('0x59')],_0xc4c7('0x5a')),'utf8');var _0x207ec4=ejs[_0xc4c7('0x5b')](_0x2cb3cd,{'contexts':_0x200d01});fs[_0xc4c7('0x5c')](_0xc4c7('0x5d'),_0x207ec4);return respondWithRpcPromise('Reload',_0xc4c7('0x34'),{'module':'chan_sip.so'});})[_0xc4c7('0x25')](handleError(_0x1e7f4a,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 8972012..74c4bcb 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 _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 +var _0x9f99=['exports','define','voice_contexts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x54cc79,_0x51052f){var _0x15586f=function(_0x504626){while(--_0x504626){_0x54cc79['push'](_0x54cc79['shift']());}};_0x15586f(++_0x51052f);}(_0x9f99,0xd3));var _0x99f9=function(_0x5d9b07,_0x4fc1d1){_0x5d9b07=_0x5d9b07-0x0;var _0x15eefb=_0x9f99[_0x5d9b07];return _0x15eefb;};'use strict';var _=require(_0x99f9('0x0'));var util=require(_0x99f9('0x1'));var logger=require(_0x99f9('0x2'))(_0x99f9('0x3'));var moment=require(_0x99f9('0x4'));var BPromise=require(_0x99f9('0x5'));var rp=require(_0x99f9('0x6'));var fs=require('fs');var path=require(_0x99f9('0x7'));var rimraf=require(_0x99f9('0x8'));var config=require(_0x99f9('0x9'));var attributes=require('./voiceContext.attributes');module[_0x99f9('0xa')]=function(_0xb8ca4c,_0x292eee){return _0xb8ca4c[_0x99f9('0xb')]('VoiceContext',attributes,{'tableName':_0x99f9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index b666f85..88a6521 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 _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 +var _0x8b1a=['rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceContext,\x20%s,\x20%s','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x2f6541,_0x363cba){var _0x4d76d8=function(_0x86404){while(--_0x86404){_0x2f6541['push'](_0x2f6541['shift']());}};_0x4d76d8(++_0x363cba);}(_0x8b1a,0x152));var _0xa8b1=function(_0x10a3f2,_0x5d782f){_0x10a3f2=_0x10a3f2-0x0;var _0x21ee20=_0x8b1a[_0x10a3f2];return _0x21ee20;};'use strict';var _=require(_0xa8b1('0x0'));var util=require(_0xa8b1('0x1'));var moment=require(_0xa8b1('0x2'));var BPromise=require('bluebird');var rs=require(_0xa8b1('0x3'));var fs=require('fs');var Redis=require(_0xa8b1('0x4'));var db=require(_0xa8b1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa8b1('0x6'))(_0xa8b1('0x7'));var config=require(_0xa8b1('0x8'));var jayson=require(_0xa8b1('0x9'));var client=jayson[_0xa8b1('0xa')][_0xa8b1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5db169,_0x2a3030,_0x459cf9){return new BPromise(function(_0x5d958d,_0xabb2b9){return client[_0xa8b1('0xc')](_0x5db169,_0x459cf9)['then'](function(_0x112113){logger[_0xa8b1('0xd')](_0xa8b1('0xe'),_0x2a3030,'request\x20sent');logger['debug'](_0xa8b1('0xf'),_0x2a3030,'request\x20sent',JSON[_0xa8b1('0x10')](_0x112113));if(_0x112113[_0xa8b1('0x11')]){if(_0x112113[_0xa8b1('0x11')][_0xa8b1('0x12')]===0x1f4){logger[_0xa8b1('0x11')](_0xa8b1('0xe'),_0x2a3030,_0x112113[_0xa8b1('0x11')][_0xa8b1('0x13')]);return _0xabb2b9(_0x112113['error'][_0xa8b1('0x13')]);}logger[_0xa8b1('0x11')]('VoiceContext,\x20%s,\x20%s',_0x2a3030,_0x112113[_0xa8b1('0x11')]['message']);return _0x5d958d(_0x112113[_0xa8b1('0x11')]['message']);}else{logger[_0xa8b1('0xd')](_0xa8b1('0xe'),_0x2a3030,_0xa8b1('0x14'));_0x5d958d(_0x112113[_0xa8b1('0x15')][_0xa8b1('0x13')]);}})[_0xa8b1('0x16')](function(_0x219e46){logger[_0xa8b1('0x11')]('VoiceContext,\x20%s,\x20%s',_0x2a3030,_0x219e46);_0xabb2b9(_0x219e46);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index c0ba288..ab5f7af 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 _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 +var _0xd892=['post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show'];(function(_0x1c898b,_0x36a68a){var _0x52285f=function(_0x48d514){while(--_0x48d514){_0x1c898b['push'](_0x1c898b['shift']());}};_0x52285f(++_0x36a68a);}(_0xd892,0x13f));var _0x2d89=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xd892[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require(_0x2d89('0x0'));var util=require(_0x2d89('0x1'));var path=require(_0x2d89('0x2'));var timeout=require(_0x2d89('0x3'));var express=require('express');var router=express[_0x2d89('0x4')]();var fs_extra=require(_0x2d89('0x5'));var auth=require(_0x2d89('0x6'));var interaction=require(_0x2d89('0x7'));var config=require(_0x2d89('0x8'));var controller=require(_0x2d89('0x9'));router[_0x2d89('0xa')]('/',auth['isAuthenticated'](),controller[_0x2d89('0xb')]);router[_0x2d89('0xa')](_0x2d89('0xc'),auth[_0x2d89('0xd')](),controller[_0x2d89('0xe')]);router[_0x2d89('0xa')](_0x2d89('0xf'),auth['isAuthenticated'](),controller[_0x2d89('0x10')]);router[_0x2d89('0x11')]('/',auth[_0x2d89('0xd')](),controller[_0x2d89('0x12')]);router[_0x2d89('0x13')](_0x2d89('0xf'),auth[_0x2d89('0xd')](),controller[_0x2d89('0x14')]);router[_0x2d89('0x15')]('/:id',auth[_0x2d89('0xd')](),controller[_0x2d89('0x16')]);module[_0x2d89('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 6ff13f1..ca68b0e 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 _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 +var _0x54ef=['STRING','INTEGER','DATE','called,connect,complete','sequelize','exports'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x54ef,0x112));var _0xf54e=function(_0x26fc5f,_0x25d1ce){_0x26fc5f=_0x26fc5f-0x0;var _0xc5b3cc=_0x54ef[_0x26fc5f];return _0xc5b3cc;};'use strict';var Sequelize=require(_0xf54e('0x0'));module[_0xf54e('0x1')]={'privilege':{'type':Sequelize[_0xf54e('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xf54e('0x3')]},'channelstatedesc':{'type':Sequelize[_0xf54e('0x2')]},'calleridnum':{'type':Sequelize[_0xf54e('0x2')]},'calleridname':{'type':Sequelize[_0xf54e('0x2')]},'connectedlinenum':{'type':Sequelize[_0xf54e('0x2')]},'connectedlinename':{'type':Sequelize[_0xf54e('0x2')]},'language':{'type':Sequelize[_0xf54e('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xf54e('0x2')]},'priority':{'type':Sequelize[_0xf54e('0x3')]},'uniqueid':{'type':Sequelize[_0xf54e('0x2')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xf54e('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xf54e('0x2')]},'destcalleridnum':{'type':Sequelize[_0xf54e('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xf54e('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xf54e('0x2')]},'destlanguage':{'type':Sequelize[_0xf54e('0x2')]},'destaccountcode':{'type':Sequelize[_0xf54e('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xf54e('0x2')]},'destpriority':{'type':Sequelize[_0xf54e('0x3')]},'destuniqueid':{'type':Sequelize[_0xf54e('0x2')]},'destlinkedid':{'type':Sequelize[_0xf54e('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0xf54e('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xf54e('0x4')]},'lastevent':{'type':Sequelize[_0xf54e('0x2')],'comment':_0xf54e('0x5')},'routeId':{'type':Sequelize[_0xf54e('0x3')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0xf54e('0x3')]},'billableseconds':{'type':Sequelize[_0xf54e('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 5c55f3f..25acd80 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 _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 +var _0xe0b8=['update','then','destroy','error','stack','name','send','index','map','VoiceDialReport','fieldName','type','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','include','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save'];(function(_0x49b14d,_0x578d07){var _0x3d2488=function(_0x5a8668){while(--_0x5a8668){_0x49b14d['push'](_0x49b14d['shift']());}};_0x3d2488(++_0x578d07);}(_0xe0b8,0xc3));var _0x8e0b=function(_0x504acb,_0x3783ed){_0x504acb=_0x504acb-0x0;var _0x25fef6=_0xe0b8[_0x504acb];return _0x25fef6;};'use strict';var emlformat=require(_0x8e0b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8e0b('0x1'));var jsonpatch=require(_0x8e0b('0x2'));var rp=require(_0x8e0b('0x3'));var moment=require(_0x8e0b('0x4'));var BPromise=require(_0x8e0b('0x5'));var Mustache=require('mustache');var util=require(_0x8e0b('0x6'));var path=require(_0x8e0b('0x7'));var sox=require(_0x8e0b('0x8'));var csv=require(_0x8e0b('0x9'));var ejs=require(_0x8e0b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8e0b('0xb'));var crypto=require(_0x8e0b('0xc'));var jsforce=require(_0x8e0b('0xd'));var deskjs=require(_0x8e0b('0xe'));var toCsv=require(_0x8e0b('0x9'));var querystring=require('querystring');var Papa=require(_0x8e0b('0xf'));var Redis=require(_0x8e0b('0x10'));var authService=require(_0x8e0b('0x11'));var qs=require(_0x8e0b('0x12'));var as=require(_0x8e0b('0x13'));var hardwareService=require(_0x8e0b('0x14'));var logger=require(_0x8e0b('0x15'))(_0x8e0b('0x16'));var utils=require(_0x8e0b('0x17'));var config=require(_0x8e0b('0x18'));var licenseUtil=require(_0x8e0b('0x19'));var db=require(_0x8e0b('0x1a'))['db'];function respondWithStatusCode(_0x3d18d4,_0x31aa5f){_0x31aa5f=_0x31aa5f||0xcc;return function(_0x29baf4){if(_0x29baf4){return _0x3d18d4[_0x8e0b('0x1b')](_0x31aa5f);}return _0x3d18d4[_0x8e0b('0x1c')](_0x31aa5f)[_0x8e0b('0x1d')]();};}function respondWithResult(_0x10b144,_0x241f0e){_0x241f0e=_0x241f0e||0xc8;return function(_0x2eac21){if(_0x2eac21){return _0x10b144[_0x8e0b('0x1c')](_0x241f0e)[_0x8e0b('0x1e')](_0x2eac21);}};}function respondWithFilteredResult(_0x28e3a3,_0x3a7378){return function(_0x31753a){if(_0x31753a){var _0x28d5ee=typeof _0x3a7378[_0x8e0b('0x1f')]==='undefined'&&typeof _0x3a7378[_0x8e0b('0x20')]==='undefined';var _0x3fd279=_0x31753a[_0x8e0b('0x21')];var _0x3df32f=_0x28d5ee?0x0:_0x3a7378[_0x8e0b('0x1f')];var _0x4595ca=_0x28d5ee?_0x31753a[_0x8e0b('0x21')]:_0x3a7378['offset']+_0x3a7378[_0x8e0b('0x20')];var _0x571d32;if(_0x4595ca>=_0x3fd279){_0x4595ca=_0x3fd279;_0x571d32=0xc8;}else{_0x571d32=0xce;}_0x28e3a3['status'](_0x571d32);return _0x28e3a3[_0x8e0b('0x22')](_0x8e0b('0x23'),_0x3df32f+'-'+_0x4595ca+'/'+_0x3fd279)['json'](_0x31753a);}return null;};}function patchUpdates(_0x31b365){return function(_0x3e01ad){try{jsonpatch[_0x8e0b('0x24')](_0x3e01ad,_0x31b365,!![]);}catch(_0x5cf820){return BPromise[_0x8e0b('0x25')](_0x5cf820);}return _0x3e01ad[_0x8e0b('0x26')]();};}function saveUpdates(_0x2bb7d6,_0x1acf49){return function(_0x5368bb){if(_0x5368bb){return _0x5368bb[_0x8e0b('0x27')](_0x2bb7d6)[_0x8e0b('0x28')](function(_0x2184a1){return _0x2184a1;});}return null;};}function removeEntity(_0x2787af,_0x45d5d7){return function(_0x2fefef){if(_0x2fefef){return _0x2fefef[_0x8e0b('0x29')]()[_0x8e0b('0x28')](function(){_0x2787af['status'](0xcc)[_0x8e0b('0x1d')]();});}};}function handleEntityNotFound(_0x451ede,_0x2884ee){return function(_0x3fccf5){if(!_0x3fccf5){_0x451ede[_0x8e0b('0x1b')](0x194);}return _0x3fccf5;};}function handleError(_0x354304,_0x216a32){_0x216a32=_0x216a32||0x1f4;return function(_0x5af52a){logger[_0x8e0b('0x2a')](_0x5af52a[_0x8e0b('0x2b')]);if(_0x5af52a[_0x8e0b('0x2c')]){delete _0x5af52a[_0x8e0b('0x2c')];}_0x354304[_0x8e0b('0x1c')](_0x216a32)[_0x8e0b('0x2d')](_0x5af52a);};}exports[_0x8e0b('0x2e')]=function(_0x3d904d,_0x3ad64b){var _0x23351f={},_0x4f9301={},_0x426fa8={'count':0x0,'rows':[]};var _0x58298c=_[_0x8e0b('0x2f')](db[_0x8e0b('0x30')]['rawAttributes'],function(_0x2e84d0){return{'name':_0x2e84d0[_0x8e0b('0x31')],'type':_0x2e84d0[_0x8e0b('0x32')]['key']};});_0x4f9301[_0x8e0b('0x33')]=_[_0x8e0b('0x2f')](_0x58298c,_0x8e0b('0x2c'));_0x4f9301[_0x8e0b('0x34')]=_[_0x8e0b('0x35')](_0x3d904d['query']);_0x4f9301[_0x8e0b('0x36')]=_[_0x8e0b('0x37')](_0x4f9301[_0x8e0b('0x33')],_0x4f9301[_0x8e0b('0x34')]);_0x23351f['attributes']=_[_0x8e0b('0x37')](_0x4f9301['model'],qs[_0x8e0b('0x38')](_0x3d904d['query'][_0x8e0b('0x38')]));_0x23351f['attributes']=_0x23351f[_0x8e0b('0x39')]['length']?_0x23351f[_0x8e0b('0x39')]:_0x4f9301[_0x8e0b('0x33')];if(!_0x3d904d[_0x8e0b('0x34')]['hasOwnProperty'](_0x8e0b('0x3a'))){_0x23351f[_0x8e0b('0x20')]=qs[_0x8e0b('0x20')](_0x3d904d[_0x8e0b('0x34')][_0x8e0b('0x20')]);_0x23351f[_0x8e0b('0x1f')]=qs[_0x8e0b('0x1f')](_0x3d904d[_0x8e0b('0x34')][_0x8e0b('0x1f')]);}_0x23351f[_0x8e0b('0x3b')]=qs[_0x8e0b('0x3c')](_0x3d904d['query'][_0x8e0b('0x3c')]);_0x23351f[_0x8e0b('0x3d')]=qs[_0x8e0b('0x36')](_[_0x8e0b('0x3e')](_0x3d904d[_0x8e0b('0x34')],_0x4f9301[_0x8e0b('0x36')]),_0x58298c);if(_0x3d904d[_0x8e0b('0x34')][_0x8e0b('0x3f')]){_0x23351f[_0x8e0b('0x3d')]=_[_0x8e0b('0x40')](_0x23351f[_0x8e0b('0x3d')],{'$or':_['map'](_0x58298c,function(_0x54d828){if(_0x54d828['type']!==_0x8e0b('0x41')){var _0x2fafb2={};_0x2fafb2[_0x54d828['name']]={'$like':'%'+_0x3d904d[_0x8e0b('0x34')][_0x8e0b('0x3f')]+'%'};return _0x2fafb2;}})});}_0x23351f=_[_0x8e0b('0x40')]({},_0x23351f,_0x3d904d[_0x8e0b('0x42')]);var _0x36473e={'where':_0x23351f[_0x8e0b('0x3d')]};return db[_0x8e0b('0x30')][_0x8e0b('0x21')](_0x36473e)[_0x8e0b('0x28')](function(_0x3f787f){_0x426fa8[_0x8e0b('0x21')]=_0x3f787f;if(_0x3d904d[_0x8e0b('0x34')][_0x8e0b('0x43')]){_0x23351f['include']=[{'all':!![]}];}return db[_0x8e0b('0x30')][_0x8e0b('0x44')](_0x23351f);})[_0x8e0b('0x28')](function(_0x42f4b4){_0x426fa8[_0x8e0b('0x45')]=_0x42f4b4;return _0x426fa8;})[_0x8e0b('0x28')](respondWithFilteredResult(_0x3ad64b,_0x23351f))['catch'](handleError(_0x3ad64b,null));};exports[_0x8e0b('0x46')]=function(_0x525df9,_0x38f4e2){var _0xd1495={'raw':!![],'where':{'id':_0x525df9[_0x8e0b('0x47')]['id']}},_0x19cc7e={};_0x19cc7e[_0x8e0b('0x33')]=_[_0x8e0b('0x35')](db[_0x8e0b('0x30')]['rawAttributes']);_0x19cc7e['query']=_[_0x8e0b('0x35')](_0x525df9[_0x8e0b('0x34')]);_0x19cc7e[_0x8e0b('0x36')]=_[_0x8e0b('0x37')](_0x19cc7e['model'],_0x19cc7e['query']);_0xd1495[_0x8e0b('0x39')]=_['intersection'](_0x19cc7e['model'],qs[_0x8e0b('0x38')](_0x525df9[_0x8e0b('0x34')][_0x8e0b('0x38')]));_0xd1495[_0x8e0b('0x39')]=_0xd1495[_0x8e0b('0x39')]['length']?_0xd1495['attributes']:_0x19cc7e[_0x8e0b('0x33')];if(_0x525df9[_0x8e0b('0x34')]['includeAll']){_0xd1495[_0x8e0b('0x48')]=[{'all':!![]}];}_0xd1495=_[_0x8e0b('0x40')]({},_0xd1495,_0x525df9['options']);return db[_0x8e0b('0x30')][_0x8e0b('0x49')](_0xd1495)[_0x8e0b('0x28')](handleEntityNotFound(_0x38f4e2,null))['then'](respondWithResult(_0x38f4e2,null))[_0x8e0b('0x4a')](handleError(_0x38f4e2,null));};exports[_0x8e0b('0x4b')]=function(_0xbed59a,_0x3473cf){return db[_0x8e0b('0x30')]['create'](_0xbed59a[_0x8e0b('0x4c')],{})[_0x8e0b('0x28')](respondWithResult(_0x3473cf,0xc9))[_0x8e0b('0x4a')](handleError(_0x3473cf,null));};exports[_0x8e0b('0x27')]=function(_0x94179a,_0x23ecc7){if(_0x94179a['body']['id']){delete _0x94179a[_0x8e0b('0x4c')]['id'];}return db[_0x8e0b('0x30')][_0x8e0b('0x49')]({'where':{'id':_0x94179a[_0x8e0b('0x47')]['id']}})['then'](handleEntityNotFound(_0x23ecc7,null))[_0x8e0b('0x28')](saveUpdates(_0x94179a[_0x8e0b('0x4c')],null))[_0x8e0b('0x28')](respondWithResult(_0x23ecc7,null))[_0x8e0b('0x4a')](handleError(_0x23ecc7,null));};exports[_0x8e0b('0x29')]=function(_0x5ca44b,_0x5192c9){return db[_0x8e0b('0x30')][_0x8e0b('0x49')]({'where':{'id':_0x5ca44b[_0x8e0b('0x47')]['id']}})[_0x8e0b('0x28')](handleEntityNotFound(_0x5192c9,null))[_0x8e0b('0x28')](removeEntity(_0x5192c9,null))[_0x8e0b('0x4a')](handleError(_0x5192c9,null));};exports[_0x8e0b('0x4d')]=function(_0x3fdefc,_0x206038){return db[_0x8e0b('0x30')][_0x8e0b('0x4d')]()['then'](respondWithResult(_0x206038,null))[_0x8e0b('0x4a')](handleError(_0x206038,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index f1bf33e..7a91480 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 _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 +var _0x11fe=['moment','bluebird','request-promise','rimraf','../../config/environment','exports','VoiceDialReport','uniqueid','util','../../config/logger','api'];(function(_0x29a508,_0x137127){var _0x1eb0a1=function(_0x2c2798){while(--_0x2c2798){_0x29a508['push'](_0x29a508['shift']());}};_0x1eb0a1(++_0x137127);}(_0x11fe,0xb8));var _0xe11f=function(_0x2cf90b,_0x2d23f0){_0x2cf90b=_0x2cf90b-0x0;var _0x4f7701=_0x11fe[_0x2cf90b];return _0x4f7701;};'use strict';var _=require('lodash');var util=require(_0xe11f('0x0'));var logger=require(_0xe11f('0x1'))(_0xe11f('0x2'));var moment=require(_0xe11f('0x3'));var BPromise=require(_0xe11f('0x4'));var rp=require(_0xe11f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe11f('0x6'));var config=require(_0xe11f('0x7'));var attributes=require('./voiceDialReport.attributes');module[_0xe11f('0x8')]=function(_0x561a45,_0x1ac005){return _0x561a45['define'](_0xe11f('0x9'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0xe11f('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 b91852d..e8702b6 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 _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 +var _0x6c9f=['limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','VoiceDialReport','body','options','raw','then','CreateVoiceDialReport','UpdateVoiceDialReport','update','where'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x6c9f,0x1c1));var _0xf6c9=function(_0x538593,_0x39c216){_0x538593=_0x538593-0x0;var _0x2aeeb3=_0x6c9f[_0x538593];return _0x2aeeb3;};'use strict';var _=require('lodash');var util=require(_0xf6c9('0x0'));var moment=require(_0xf6c9('0x1'));var BPromise=require(_0xf6c9('0x2'));var rs=require(_0xf6c9('0x3'));var fs=require('fs');var Redis=require(_0xf6c9('0x4'));var db=require(_0xf6c9('0x5'))['db'];var utils=require(_0xf6c9('0x6'));var logger=require(_0xf6c9('0x7'))(_0xf6c9('0x8'));var config=require('../../config/environment');var jayson=require(_0xf6c9('0x9'));var client=jayson[_0xf6c9('0xa')][_0xf6c9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x58972f,_0x51be38,_0x847d8e){return new BPromise(function(_0x357a8a,_0x40440b){return client[_0xf6c9('0xc')](_0x58972f,_0x847d8e)['then'](function(_0xa1cb2e){logger['info'](_0xf6c9('0xd'),_0x51be38,_0xf6c9('0xe'));logger[_0xf6c9('0xf')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x51be38,_0xf6c9('0xe'),JSON[_0xf6c9('0x10')](_0xa1cb2e));if(_0xa1cb2e[_0xf6c9('0x11')]){if(_0xa1cb2e[_0xf6c9('0x11')]['code']===0x1f4){logger[_0xf6c9('0x11')](_0xf6c9('0xd'),_0x51be38,_0xa1cb2e[_0xf6c9('0x11')][_0xf6c9('0x12')]);return _0x40440b(_0xa1cb2e[_0xf6c9('0x11')][_0xf6c9('0x12')]);}logger[_0xf6c9('0x11')]('VoiceDialReport,\x20%s,\x20%s',_0x51be38,_0xa1cb2e[_0xf6c9('0x11')][_0xf6c9('0x12')]);return _0x357a8a(_0xa1cb2e[_0xf6c9('0x11')][_0xf6c9('0x12')]);}else{logger[_0xf6c9('0x13')](_0xf6c9('0xd'),_0x51be38,_0xf6c9('0xe'));_0x357a8a(_0xa1cb2e[_0xf6c9('0x14')][_0xf6c9('0x12')]);}})[_0xf6c9('0x15')](function(_0x543437){logger[_0xf6c9('0x11')]('VoiceDialReport,\x20%s,\x20%s',_0x51be38,_0x543437);_0x40440b(_0x543437);});});}exports['CreateVoiceDialReport']=function(_0x1626da){var _0x41402b=this;return new Promise(function(_0x9f7815,_0x3842d5){return db[_0xf6c9('0x16')]['create'](_0x1626da[_0xf6c9('0x17')],{'raw':_0x1626da['options']?_0x1626da[_0xf6c9('0x18')][_0xf6c9('0x19')]===undefined?!![]:![]:!![]})[_0xf6c9('0x1a')](function(_0x5bc89a){logger[_0xf6c9('0x13')](_0xf6c9('0x1b'),_0x1626da);logger[_0xf6c9('0xf')]('CreateVoiceDialReport',_0x1626da,JSON[_0xf6c9('0x10')](_0x5bc89a));_0x9f7815(_0x5bc89a);})[_0xf6c9('0x15')](function(_0x2cd4c7){logger[_0xf6c9('0x11')]('CreateVoiceDialReport',_0x2cd4c7[_0xf6c9('0x12')],_0x1626da);_0x3842d5(_0x41402b[_0xf6c9('0x11')](0x1f4,_0x2cd4c7['message']));});});};exports[_0xf6c9('0x1c')]=function(_0x527503){var _0x28198d=this;return new Promise(function(_0x38734e,_0x4fd431){return db[_0xf6c9('0x16')][_0xf6c9('0x1d')](_0x527503[_0xf6c9('0x17')],{'raw':_0x527503[_0xf6c9('0x18')]?_0x527503['options'][_0xf6c9('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x527503[_0xf6c9('0x18')]?_0x527503[_0xf6c9('0x18')][_0xf6c9('0x1e')]||null:null,'attributes':_0x527503[_0xf6c9('0x18')]?_0x527503[_0xf6c9('0x18')]['attributes']||null:null,'limit':_0x527503['options']?_0x527503['options'][_0xf6c9('0x1f')]||null:null})[_0xf6c9('0x1a')](function(_0x314899){logger['info'](_0xf6c9('0x1c'),_0x527503);logger[_0xf6c9('0xf')]('UpdateVoiceDialReport',_0x527503,JSON['stringify'](_0x314899));_0x38734e(_0x314899);})[_0xf6c9('0x15')](function(_0x5962cb){logger[_0xf6c9('0x11')](_0xf6c9('0x1c'),_0x5962cb[_0xf6c9('0x12')],_0x527503);_0x4fd431(_0x28198d[_0xf6c9('0x11')](0x1f4,_0x5962cb[_0xf6c9('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 0a440e0..9244d93 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 _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 +var _0x6e5d=['post','/:id/applications','addApplications','put','/:id','update','destroy','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','create'];(function(_0x6f7a77,_0x5494c6){var _0x2b33ff=function(_0x5960a4){while(--_0x5960a4){_0x6f7a77['push'](_0x6f7a77['shift']());}};_0x2b33ff(++_0x5494c6);}(_0x6e5d,0xc2));var _0xd6e5=function(_0x12f3ec,_0x1299a8){_0x12f3ec=_0x12f3ec-0x0;var _0x2a67c3=_0x6e5d[_0x12f3ec];return _0x2a67c3;};'use strict';var multer=require(_0xd6e5('0x0'));var util=require(_0xd6e5('0x1'));var path=require(_0xd6e5('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xd6e5('0x3'));var auth=require(_0xd6e5('0x4'));var interaction=require(_0xd6e5('0x5'));var config=require(_0xd6e5('0x6'));var controller=require('./voiceExtension.controller');router[_0xd6e5('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0xd6e5('0x8')](),controller['show']);router['post']('/',auth[_0xd6e5('0x8')](),controller[_0xd6e5('0x9')]);router[_0xd6e5('0xa')](_0xd6e5('0xb'),auth['isAuthenticated'](),controller[_0xd6e5('0xc')]);router[_0xd6e5('0xd')](_0xd6e5('0xe'),auth[_0xd6e5('0x8')](),controller[_0xd6e5('0xf')]);router['delete'](_0xd6e5('0xe'),auth[_0xd6e5('0x8')](),controller[_0xd6e5('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index f3e1b70..68aedec 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 _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 +var _0xbd5c=['*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','exten','sequelize','exports','compositeIndex','STRING','NoOp','internal','inbound-fax','outbound-fax','any'];(function(_0xc37557,_0x4db6fb){var _0x132210=function(_0x3f746d){while(--_0x3f746d){_0xc37557['push'](_0xc37557['shift']());}};_0x132210(++_0x4db6fb);}(_0xbd5c,0x1e1));var _0xcbd5=function(_0x4b1074,_0x303b2a){_0x4b1074=_0x4b1074-0x0;var _0x500719=_0xbd5c[_0x4b1074];return _0x500719;};'use strict';var Sequelize=require(_0xcbd5('0x0'));module[_0xcbd5('0x1')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xcbd5('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xcbd5('0x3')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0xcbd5('0x3')],'allowNull':![],'defaultValue':'1','unique':_0xcbd5('0x2')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xcbd5('0x3')],'allowNull':![],'defaultValue':_0xcbd5('0x4')},'appdata':{'type':Sequelize[_0xcbd5('0x3')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM']('inbound','outbound',_0xcbd5('0x5'),_0xcbd5('0x6'),_0xcbd5('0x7'),'system',_0xcbd5('0x8')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xcbd5('0x3')],'allowNull':![],'defaultValue':_0xcbd5('0x9')},'IntervalId':{'type':Sequelize[_0xcbd5('0xa')]},'isApp':{'type':Sequelize[_0xcbd5('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xcbd5('0x3')],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize[_0xcbd5('0xb')],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize[_0xcbd5('0x3')],'defaultValue':'wav'},'answer':{'type':Sequelize[_0xcbd5('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0xcbd5('0xc')],'get':function(_0x43667a){return this['getDataValue'](_0xcbd5('0xd'));}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 48b25c9..26e19aa 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 _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 +var _0x9d49=['options','includeAll','include','catch','show','keys','rawAttributes','params','create','startsWith','exten','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','description','recordingFormat','cutdigits','mandatoryDisposition','alias','context','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','findOne','VoiceExtensionId','isApp','bulkCreate','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','status','json','offset','undefined','count','limit','set','Content-Range','destroy','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','filter','ignore','map','value','includes','find','name','UserProfileResource','end','sendStatus','error','stack','send','index','VoiceExtension','fieldName','key','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x9d49,0x18c));var _0x99d4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9d49[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x99d4('0x0'));var Redis=require(_0x99d4('0x1'));var qs=require(_0x99d4('0x2'));var logger=require(_0x99d4('0x3'))(_0x99d4('0x4'));var config=require(_0x99d4('0x5'));var db=require('../../mysqldb')['db'];config[_0x99d4('0x6')]=_[_0x99d4('0x7')](config[_0x99d4('0x6')],{'host':_0x99d4('0x8'),'port':0x18eb});var socket=require(_0x99d4('0x9'))(new Redis(config[_0x99d4('0x6')]));require('./voiceExtension.socket')[_0x99d4('0xa')](socket);function respondWithStatusCode(_0x2c5dac,_0x5a80c6){_0x5a80c6=_0x5a80c6||0xcc;return function(_0x1ee23a){if(_0x1ee23a){return _0x2c5dac['sendStatus'](_0x5a80c6);}return _0x2c5dac[_0x99d4('0xb')](_0x5a80c6)['end']();};}function respondWithResult(_0x7c5ebb,_0x2f9587){_0x2f9587=_0x2f9587||0xc8;return function(_0x52c7af){if(_0x52c7af){return _0x7c5ebb['status'](_0x2f9587)[_0x99d4('0xc')](_0x52c7af);}};}function respondWithFilteredResult(_0x3a4614,_0x5a5162){return function(_0x412ed8){if(_0x412ed8){var _0x303d5f=typeof _0x5a5162[_0x99d4('0xd')]===_0x99d4('0xe')&&typeof _0x5a5162['limit']===_0x99d4('0xe');var _0x2c5eeb=_0x412ed8['count'];var _0x307565=_0x303d5f?0x0:_0x5a5162[_0x99d4('0xd')];var _0x159514=_0x303d5f?_0x412ed8[_0x99d4('0xf')]:_0x5a5162[_0x99d4('0xd')]+_0x5a5162[_0x99d4('0x10')];var _0x4b6074;if(_0x159514>=_0x2c5eeb){_0x159514=_0x2c5eeb;_0x4b6074=0xc8;}else{_0x4b6074=0xce;}_0x3a4614[_0x99d4('0xb')](_0x4b6074);return _0x3a4614[_0x99d4('0x11')](_0x99d4('0x12'),_0x307565+'-'+_0x159514+'/'+_0x2c5eeb)[_0x99d4('0xc')](_0x412ed8);}return null;};}function removeEntity(_0x299afa){return function(_0x1a14d0){if(_0x1a14d0){return _0x1a14d0[_0x99d4('0x13')]()[_0x99d4('0x14')](function(){var _0x3003f3=_0x1a14d0[_0x99d4('0x15')]({'plain':!![]});var _0x34b340=[{'name':_0x99d4('0x16'),'value':_0x99d4('0x17'),'ignore':![]},{'name':_0x99d4('0x18'),'value':_0x99d4('0x19'),'ignore':![]},{'name':_0x99d4('0x1a'),'value':'internal','ignore':![]}];var _0xd53336=_(_0x34b340)[_0x99d4('0x1b')](_0x99d4('0x1c'))[_0x99d4('0x1d')](_0x99d4('0x1e'))[_0x99d4('0x1e')]();if(_[_0x99d4('0x1f')](_0xd53336,_0x3003f3['type'])){return;}var _0x2bec7a=_[_0x99d4('0x20')](_0x34b340,[_0x99d4('0x1e'),_0x3003f3['type']])[_0x99d4('0x21')];return db[_0x99d4('0x22')][_0x99d4('0x13')]({'where':{'type':_0x2bec7a,'resourceId':_0x3003f3['id']}})[_0x99d4('0x14')](function(){return _0x1a14d0;});})[_0x99d4('0x14')](function(){_0x299afa['status'](0xcc)[_0x99d4('0x23')]();});}};}function handleEntityNotFound(_0xea18a0){return function(_0x2da5fd){if(!_0x2da5fd){_0xea18a0[_0x99d4('0x24')](0x194);}return _0x2da5fd;};}function handleError(_0x305284,_0x33d2d2){_0x33d2d2=_0x33d2d2||0x1f4;return function(_0xfb142a){logger[_0x99d4('0x25')](_0xfb142a[_0x99d4('0x26')]);if(_0xfb142a[_0x99d4('0x21')]){delete _0xfb142a[_0x99d4('0x21')];}_0x305284['status'](_0x33d2d2)[_0x99d4('0x27')](_0xfb142a);};}exports[_0x99d4('0x28')]=function(_0x1dc145,_0x3b7064){var _0x5bc519={},_0x35767e={},_0x1f95b2={'count':0x0,'rows':[]};var _0x3e9314=_[_0x99d4('0x1d')](db[_0x99d4('0x29')]['rawAttributes'],function(_0x2f11ec){return{'name':_0x2f11ec[_0x99d4('0x2a')],'type':_0x2f11ec['type'][_0x99d4('0x2b')]};});_0x35767e['model']=_[_0x99d4('0x1d')](_0x3e9314,_0x99d4('0x21'));_0x35767e[_0x99d4('0x2c')]=_['keys'](_0x1dc145[_0x99d4('0x2c')]);_0x35767e[_0x99d4('0x2d')]=_['intersection'](_0x35767e['model'],_0x35767e[_0x99d4('0x2c')]);_0x5bc519[_0x99d4('0x2e')]=_[_0x99d4('0x2f')](_0x35767e[_0x99d4('0x30')],qs[_0x99d4('0x31')](_0x1dc145[_0x99d4('0x2c')][_0x99d4('0x31')]));_0x5bc519['attributes']=_0x5bc519[_0x99d4('0x2e')][_0x99d4('0x32')]?_0x5bc519[_0x99d4('0x2e')]:_0x35767e[_0x99d4('0x30')];if(!_0x1dc145[_0x99d4('0x2c')][_0x99d4('0x33')](_0x99d4('0x34'))){_0x5bc519[_0x99d4('0x10')]=qs[_0x99d4('0x10')](_0x1dc145[_0x99d4('0x2c')][_0x99d4('0x10')]);_0x5bc519[_0x99d4('0xd')]=qs[_0x99d4('0xd')](_0x1dc145[_0x99d4('0x2c')][_0x99d4('0xd')]);}_0x5bc519['order']=qs[_0x99d4('0x35')](_0x1dc145[_0x99d4('0x2c')][_0x99d4('0x35')]);_0x5bc519[_0x99d4('0x36')]=qs[_0x99d4('0x2d')](_[_0x99d4('0x37')](_0x1dc145[_0x99d4('0x2c')],_0x35767e['filters']),_0x3e9314);if(_0x1dc145[_0x99d4('0x2c')][_0x99d4('0x1b')]){_0x5bc519['where']=_[_0x99d4('0x38')](_0x5bc519[_0x99d4('0x36')],{'$or':_[_0x99d4('0x1d')](_0x3e9314,function(_0x2f7a80){if(_0x2f7a80[_0x99d4('0x39')]!==_0x99d4('0x3a')){var _0x3f9566={};_0x3f9566[_0x2f7a80[_0x99d4('0x21')]]={'$like':'%'+_0x1dc145[_0x99d4('0x2c')][_0x99d4('0x1b')]+'%'};return _0x3f9566;}})});}_0x5bc519=_[_0x99d4('0x38')]({},_0x5bc519,_0x1dc145[_0x99d4('0x3b')]);var _0x88e19a={'where':_0x5bc519['where']};return db[_0x99d4('0x29')][_0x99d4('0xf')](_0x88e19a)[_0x99d4('0x14')](function(_0xea802c){_0x1f95b2[_0x99d4('0xf')]=_0xea802c;if(_0x1dc145[_0x99d4('0x2c')][_0x99d4('0x3c')]){_0x5bc519[_0x99d4('0x3d')]=[{'all':!![]}];}return db[_0x99d4('0x29')]['findAll'](_0x5bc519);})['then'](function(_0x1bb55d){_0x1f95b2['rows']=_0x1bb55d;return _0x1f95b2;})[_0x99d4('0x14')](respondWithFilteredResult(_0x3b7064,_0x5bc519))[_0x99d4('0x3e')](handleError(_0x3b7064,null));};exports[_0x99d4('0x3f')]=function(_0x4c80ef,_0x513449){var _0x67ab7d={'raw':![],'where':{'id':_0x4c80ef['params']['id']}},_0x371123={};_0x371123['model']=_[_0x99d4('0x40')](db[_0x99d4('0x29')][_0x99d4('0x41')]);_0x371123[_0x99d4('0x2c')]=_[_0x99d4('0x40')](_0x4c80ef[_0x99d4('0x2c')]);_0x371123[_0x99d4('0x2d')]=_[_0x99d4('0x2f')](_0x371123[_0x99d4('0x30')],_0x371123[_0x99d4('0x2c')]);_0x67ab7d['attributes']=_[_0x99d4('0x2f')](_0x371123['model'],qs['fields'](_0x4c80ef['query'][_0x99d4('0x31')]));_0x67ab7d[_0x99d4('0x2e')]=_0x67ab7d[_0x99d4('0x2e')][_0x99d4('0x32')]?_0x67ab7d[_0x99d4('0x2e')]:_0x371123[_0x99d4('0x30')];if(_0x4c80ef[_0x99d4('0x2c')][_0x99d4('0x3c')]){_0x67ab7d[_0x99d4('0x3d')]=[{'all':!![]}];}_0x67ab7d=_['merge']({},_0x67ab7d,_0x4c80ef[_0x99d4('0x3b')]);return db[_0x99d4('0x29')][_0x99d4('0x20')](_0x67ab7d)[_0x99d4('0x14')](handleEntityNotFound(_0x513449,null))[_0x99d4('0x14')](respondWithResult(_0x513449,null))[_0x99d4('0x3e')](handleError(_0x513449,null));};exports[_0x99d4('0x13')]=function(_0x46da09,_0x2b6083){return db['VoiceExtension']['find']({'where':{'id':_0x46da09[_0x99d4('0x42')]['id']}})[_0x99d4('0x14')](handleEntityNotFound(_0x2b6083,null))[_0x99d4('0x14')](removeEntity(_0x2b6083,null))[_0x99d4('0x3e')](handleError(_0x2b6083,null));};exports[_0x99d4('0x43')]=function(_0x41bfca,_0x54e196){if(_0x41bfca['body'][_0x99d4('0x39')]==='outbound'&&!_[_0x99d4('0x44')](_0x41bfca['body'][_0x99d4('0x45')],'_')){_0x41bfca[_0x99d4('0x46')]['exten']='_'['concat'](_0x41bfca[_0x99d4('0x46')][_0x99d4('0x45')]);}return db[_0x99d4('0x29')][_0x99d4('0x43')](_0x41bfca[_0x99d4('0x46')],{'raw':![]})[_0x99d4('0x14')](function(_0x5e0b1f){var _0x435204=_0x41bfca[_0x99d4('0x47')]['get']({'plain':!![]});if(!_0x435204)throw new Error(_0x99d4('0x48'));if(_0x435204[_0x99d4('0x49')]===_0x99d4('0x47')){var _0x3929dd=_0x5e0b1f[_0x99d4('0x15')]({'plain':!![]});var _0x26adf2=[{'name':_0x99d4('0x16'),'value':_0x99d4('0x17')},{'name':'OutboundRoutes','value':_0x99d4('0x19')},{'name':'InternalRoutes','value':'internal'}];var _0x499fe3=_[_0x99d4('0x20')](_0x26adf2,[_0x99d4('0x1e'),_0x3929dd['type']])[_0x99d4('0x21')];return db['UserProfileSection']['find']({'where':{'name':_0x499fe3,'userProfileId':_0x435204['userProfileId']},'raw':!![]})[_0x99d4('0x14')](function(_0x5ab573){if(_0x5ab573&&_0x5ab573['autoAssociation']===0x0){return db[_0x99d4('0x22')][_0x99d4('0x43')]({'name':_0x3929dd[_0x99d4('0x21')],'resourceId':_0x3929dd['id'],'type':_0x5ab573[_0x99d4('0x21')],'sectionId':_0x5ab573['id']},{})[_0x99d4('0x14')](function(){return _0x5e0b1f;});}else{return _0x5e0b1f;}})['catch'](function(_0x5bf0d9){logger[_0x99d4('0x25')](_0x99d4('0x4a'),_0x5bf0d9);throw _0x5bf0d9;});}return _0x5e0b1f;})[_0x99d4('0x14')](respondWithResult(_0x54e196,0xc9))[_0x99d4('0x3e')](handleError(_0x54e196,null));};exports[_0x99d4('0x4b')]=function(_0x2984a4,_0x33798b){if(_0x2984a4[_0x99d4('0x46')]['id']){delete _0x2984a4[_0x99d4('0x46')]['id'];}return db[_0x99d4('0x29')][_0x99d4('0x20')]({'where':{'id':_0x2984a4['params']['id']}})['then'](handleEntityNotFound(_0x33798b,null))['then'](function(_0x322f51){if(_0x322f51){return db[_0x99d4('0x29')][_0x99d4('0x4b')](_['pick'](_0x2984a4[_0x99d4('0x46')],['exten','context',_0x99d4('0x4c'),_0x99d4('0x4d'),_0x99d4('0x4e'),_0x99d4('0x4f'),_0x99d4('0x50')]),{'where':{'context':_0x322f51[_0x99d4('0x51')],'exten':_0x322f51[_0x99d4('0x45')]},'individualHooks':!![]})[_0x99d4('0x14')](function(_0x47887f){return _0x47887f;});}return null;})[_0x99d4('0x14')](respondWithStatusCode(_0x33798b,null))[_0x99d4('0x3e')](handleError(_0x33798b,null));};exports[_0x99d4('0x52')]=function(_0x4ed96f,_0x3369c1){var _0x58893c=_0x4ed96f[_0x99d4('0x42')]['id'];var _0x54a16a=_0x4ed96f['body'];var _0x5dd5dc=0xc8;var _0x33386d=null;return db[_0x99d4('0x53')][_0x99d4('0x54')]({'isolationLevel':db[_0x99d4('0x53')][_0x99d4('0x55')][_0x99d4('0x56')]['READ_COMMITTED']},function(_0x424d05){return db['VoiceExtension'][_0x99d4('0x57')]({'where':{'id':_0x58893c},'transaction':_0x424d05})[_0x99d4('0x14')](function(_0x1efa70){if(_0x1efa70){return db[_0x99d4('0x29')][_0x99d4('0x13')]({'where':{'VoiceExtensionId':_0x58893c},'transaction':_0x424d05})['then'](function(){var _0x332800=_['map'](_0x54a16a,function(_0x55beb1){_0x55beb1[_0x99d4('0x58')]=_0x58893c;_0x55beb1[_0x99d4('0x59')]=!![];return _0x55beb1;});return _0x1efa70['createRouting'](_0x332800);})[_0x99d4('0x14')](function(_0x3e0f7b){return db[_0x99d4('0x29')][_0x99d4('0x5a')](_0x3e0f7b,{'transaction':_0x424d05});});}else{_0x5dd5dc=0x194;_0x33386d=[];}});})[_0x99d4('0x14')](function(){if(_0x5dd5dc!==0x194){return db[_0x99d4('0x29')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x58893c},'order':'cast(priority\x20as\x20unsigned)'})[_0x99d4('0x14')](function(_0x143b3b){_0x33386d=_0x143b3b;});}})[_0x99d4('0x3e')](function(_0x5a5a47){_0x5dd5dc=0x1f4;logger['error'](_0x5a5a47['stack']);if(_0x5a5a47[_0x99d4('0x21')]){delete _0x5a5a47[_0x99d4('0x21')];}_0x33386d=_0x5a5a47;})['finally'](function(){if(_0x33386d===null){_0x3369c1['sendStatus'](_0x5dd5dc);}else{if(_0x5dd5dc===0x1f4){_0x3369c1[_0x99d4('0xb')](_0x5dd5dc)[_0x99d4('0x27')](_0x33386d);}else{_0x3369c1['status'](_0x5dd5dc)['json'](_0x33386d);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 6f9ac92..9272f80 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 _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 +var _0x23f4=['update','emit','hasOwnProperty','exports','events','../../mysqldb','VoiceExtension','setMaxListeners','save'];(function(_0x221f60,_0x107209){var _0x3a10c7=function(_0x5b758e){while(--_0x5b758e){_0x221f60['push'](_0x221f60['shift']());}};_0x3a10c7(++_0x107209);}(_0x23f4,0x187));var _0x423f=function(_0x2aed5c,_0x448bda){_0x2aed5c=_0x2aed5c-0x0;var _0xa522f7=_0x23f4[_0x2aed5c];return _0xa522f7;};'use strict';var EventEmitter=require(_0x423f('0x0'));var VoiceExtension=require(_0x423f('0x1'))['db'][_0x423f('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x423f('0x3')](0x0);var events={'afterCreate':_0x423f('0x4'),'afterUpdate':_0x423f('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4cea63){return function(_0x12d72c,_0x27fef9,_0x1ad3c1){VoiceExtensionEvents[_0x423f('0x6')](_0x4cea63+':'+_0x12d72c['id'],_0x12d72c);VoiceExtensionEvents[_0x423f('0x6')](_0x4cea63,_0x12d72c);_0x1ad3c1(null);};}for(var e in events){if(events[_0x423f('0x7')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0x423f('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 e7ebfa9..9c69bac 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 _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 +var _0x4369=['./voiceExtension.attributes','exports','models','type','Set','context','alias','CDR(routeAlias)=','exten','push','inbound','CDR(routeid)=','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','CDR(type)=outbound','No\x20alias\x20set','CDR(destination)=','${EXTEN:','cutdigits','${EXTEN}','outbound','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','XCALLY-MOTION-ANSWER=0','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','options','url','split','length','name','param','phone','prefix','SIP','U(xcally-mixmonitor-context)','replace','join','isEmpty','Interval','findAll','IntervalId','then','*,*,*,*','intervals','interval','map','toLowerCase','hasOwnProperty','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','NoOp(No\x20number\x20available)','queue','includes','app','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1',',${EXTEN},','appType','outboundDial','appdata','agi','last','priority','concat','define','VoiceExtension','voice_extensions','get','Hangup','lodash'];(function(_0xc5a279,_0x155360){var _0xc755d3=function(_0x15051c){while(--_0x15051c){_0xc5a279['push'](_0xc5a279['shift']());}};_0xc755d3(++_0x155360);}(_0x4369,0x147));var _0x9436=function(_0x2d344f,_0x25fa84){_0x2d344f=_0x2d344f-0x0;var _0x2e796b=_0x4369[_0x2d344f];return _0x2e796b;};'use strict';var _=require(_0x9436('0x0'));var attributes=require(_0x9436('0x1'));module[_0x9436('0x2')]=function(_0xccbafe){var _0x1b3b97=_0xccbafe[_0x9436('0x3')];function _0x13ffbc(_0x1f45ec){var _0x36fead=0x2;var _0x58ac40=[{'type':_0x1f45ec[_0x9436('0x4')],'app':_0x9436('0x5'),'appdata':'CDR(type)='+_0x1f45ec[_0x9436('0x4')],'context':_0x1f45ec[_0x9436('0x6')],'exten':_0x1f45ec['exten'],'priority':_0x36fead++,'VoiceExtensionId':_0x1f45ec['id']},{'type':_0x1f45ec['type'],'app':_0x1f45ec[_0x9436('0x7')]?_0x9436('0x5'):'NoOp','appdata':_0x1f45ec[_0x9436('0x7')]?_0x9436('0x8')+_0x1f45ec[_0x9436('0x7')]:'No\x20alias\x20set','context':_0x1f45ec[_0x9436('0x6')],'exten':_0x1f45ec[_0x9436('0x9')],'priority':_0x36fead++,'VoiceExtensionId':_0x1f45ec['id']}];if(_0x1f45ec[_0x9436('0x4')]==='inbound'){_0x58ac40[_0x9436('0xa')]({'type':_0x9436('0xb'),'app':'Set','appdata':_0x9436('0xc')+_0x1f45ec['id'],'context':_0x1f45ec[_0x9436('0x6')],'exten':_0x1f45ec[_0x9436('0x9')],'priority':_0x36fead++,'VoiceExtensionId':_0x1f45ec['id']});}_0x58ac40[_0x9436('0xa')]({'type':_0x1f45ec[_0x9436('0x4')],'app':_0x9436('0x5'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x1f45ec[_0x9436('0x6')],'exten':_0x1f45ec[_0x9436('0x9')],'priority':_0x36fead++,'VoiceExtensionId':_0x1f45ec['id']},{'type':_0x1f45ec[_0x9436('0x4')],'app':_0x9436('0x5'),'appdata':_0x9436('0xd'),'context':_0x1f45ec['context'],'exten':_0x1f45ec['exten'],'priority':_0x36fead++,'VoiceExtensionId':_0x1f45ec['id']},{'type':_0x1f45ec[_0x9436('0x4')],'app':_0x9436('0x5'),'appdata':_0x9436('0xe'),'context':_0x1f45ec[_0x9436('0x6')],'exten':_0x1f45ec['exten'],'priority':_0x36fead++,'VoiceExtensionId':_0x1f45ec['id']});return _0x58ac40;}function _0x2e7dd7(_0x13de72){var _0xf18d37=0x2;var _0x563525=[{'type':'outbound','app':'Set','appdata':_0x9436('0xf'),'context':_0x13de72[_0x9436('0x6')],'exten':_0x13de72['exten'],'priority':_0xf18d37++,'VoiceExtensionId':_0x13de72['id']},{'type':'outbound','app':_0x13de72[_0x9436('0x7')]?_0x9436('0x5'):'NoOp','appdata':_0x13de72['alias']?_0x9436('0x8')+_0x13de72[_0x9436('0x7')]:_0x9436('0x10'),'context':_0x13de72[_0x9436('0x6')],'exten':_0x13de72[_0x9436('0x9')],'priority':_0xf18d37++,'VoiceExtensionId':_0x13de72['id']},{'type':'outbound','app':_0x9436('0x5'),'appdata':_0x9436('0x11')+(_0x13de72['cutdigits']?_0x9436('0x12')+_0x13de72[_0x9436('0x13')]+'}':_0x9436('0x14')),'context':_0x13de72[_0x9436('0x6')],'exten':_0x13de72[_0x9436('0x9')],'priority':_0xf18d37++,'VoiceExtensionId':_0x13de72['id']},{'type':'outbound','app':_0x9436('0x5'),'appdata':_0x9436('0xc')+_0x13de72['id'],'context':_0x13de72[_0x9436('0x6')],'exten':_0x13de72['exten'],'priority':_0xf18d37++,'VoiceExtensionId':_0x13de72['id']},{'type':_0x9436('0x15'),'app':_0x9436('0x16'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0xf18d37+0x2)+_0x9436('0x17')+(_0xf18d37+0x1)+')','context':_0x13de72[_0x9436('0x6')],'exten':_0x13de72[_0x9436('0x9')],'priority':_0xf18d37++,'VoiceExtensionId':_0x13de72['id']},{'type':_0x9436('0x15'),'app':_0x9436('0x5'),'appdata':_0x13de72[_0x9436('0x13')]?_0x9436('0x18')+_0x13de72[_0x9436('0x13')]+'}':_0x9436('0x19'),'context':_0x13de72[_0x9436('0x6')],'exten':_0x13de72['exten'],'priority':_0xf18d37++,'VoiceExtensionId':_0x13de72['id']},{'type':_0x9436('0x15'),'app':_0x9436('0x5'),'appdata':_0x9436('0x1a'),'context':_0x13de72['context'],'exten':_0x13de72[_0x9436('0x9')],'priority':_0xf18d37++,'VoiceExtensionId':_0x13de72['id']},{'type':_0x9436('0x15'),'app':'Set','appdata':_0x9436('0xd'),'context':_0x13de72[_0x9436('0x6')],'exten':_0x13de72[_0x9436('0x9')],'priority':_0xf18d37++,'VoiceExtensionId':_0x13de72['id']},{'type':'outbound','app':_0x9436('0x5'),'appdata':_0x9436('0xe'),'context':_0x13de72[_0x9436('0x6')],'exten':_0x13de72[_0x9436('0x9')],'priority':_0xf18d37++,'VoiceExtensionId':_0x13de72['id']},{'type':_0x9436('0x15'),'app':_0x9436('0x5'),'appdata':_0x9436('0x1b')+_0x13de72['id'],'context':_0x13de72['context'],'exten':_0x13de72[_0x9436('0x9')],'priority':_0xf18d37++,'VoiceExtensionId':_0x13de72['id']}];if(_0x13de72['hasOwnProperty'](_0x9436('0x1c'))&&_0x13de72[_0x9436('0x1c')]!==_0x9436('0x1d')){_0x563525[_0x9436('0xa')]({'type':_0x9436('0x15'),'app':_0x9436('0x5'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x13de72[_0x9436('0x6')],'exten':_0x13de72[_0x9436('0x9')],'priority':_0xf18d37++,'VoiceExtensionId':_0x13de72['id']},{'type':_0x9436('0x15'),'app':'Set','appdata':_0x9436('0x1e')+_0x13de72['recordingFormat']||_0x9436('0x1f'),'context':_0x13de72['context'],'exten':_0x13de72[_0x9436('0x9')],'priority':_0xf18d37++,'VoiceExtensionId':_0x13de72['id']});}return _0x563525;}function _0x4a0d78(_0x292fd8,_0x4eef69){var _0x4dec0d=[{'name':_0x9436('0x20'),'param':0x0},{'name':'timeout','param':0x1},{'name':_0x9436('0x21'),'param':0x2},{'name':_0x9436('0x22'),'param':0x3}];var _0x3cab66={};var _0x2eb120=_0x4eef69[_0x9436('0x23')](',');var _0x3a0b15=[];for(var _0x9933f4=0x0;_0x9933f4<_0x4dec0d[_0x9436('0x24')];_0x9933f4++){switch(_0x4dec0d[_0x9933f4][_0x9436('0x25')]){case _0x9436('0x20'):_0x3cab66[_0x9436('0x20')]=_0x2eb120[_0x4dec0d[_0x9933f4][_0x9436('0x26')]][_0x9436('0x23')]('/')[0x1];_0x3cab66[_0x9436('0x27')]=_0x2eb120[_0x4dec0d[_0x9933f4]['param']][_0x9436('0x23')]('/')[0x2];_0x3cab66[_0x9436('0x28')]=_0x3cab66[_0x9436('0x27')]?_0x3cab66['phone'][_0x9436('0x23')]('$')[0x0]:undefined;_0x3cab66[_0x9436('0x27')]=_0x292fd8[_0x9436('0x13')]?(_0x3cab66[_0x9436('0x28')]||'')+_0x9436('0x12')+_0x292fd8[_0x9436('0x13')]+'}':(_0x3cab66['prefix']||'')+_0x9436('0x14');_0x3a0b15[_0x4dec0d[_0x9933f4]['param']]=[_0x9436('0x29'),_0x3cab66[_0x9436('0x20')],_0x3cab66[_0x9436('0x27')]]['join']('/');break;case _0x9436('0x21'):_0x3cab66['options']=_0x2eb120[_0x4dec0d[_0x9933f4][_0x9436('0x26')]];if(_0x292fd8[_0x9436('0x1c')]!==_0x9436('0x1d')){if(_0x3cab66[_0x9436('0x21')]['indexOf'](_0x9436('0x2a'))<0x0){_0x3cab66[_0x9436('0x21')]+=_0x9436('0x2a');}}else{_0x3cab66[_0x9436('0x21')]=_0x3cab66[_0x9436('0x21')][_0x9436('0x2b')]('U(xcally-mixmonitor-context)','');}_0x3a0b15[_0x4dec0d[_0x9933f4][_0x9436('0x26')]]=_0x3cab66[_0x9436('0x21')];break;default:_0x3a0b15[_0x4dec0d[_0x9933f4]['param']]=_0x2eb120[_0x4dec0d[_0x9933f4][_0x9436('0x26')]];}}return _0x3a0b15[_0x9436('0x2c')](',');}function _0x455d04(_0x2fde43,_0x15f6cf,_0x2785f4){return new Promise(function(_0x443b4a,_0x3c0645){var _0x5408ee=[];if(_[_0x9436('0x2d')](_0x15f6cf))return _0x443b4a(_0x5408ee);_0x1b3b97[_0x9436('0x2e')][_0x9436('0x2f')]({'attributes':['id','interval',_0x9436('0x30')],'raw':!![]})[_0x9436('0x31')](function(_0x45998b){for(var _0x37a7bf=0x0,_0x5b5ff4=0x0;_0x37a7bf<_0x15f6cf[_0x9436('0x24')];_0x37a7bf++,_0x5b5ff4=0x0){var _0x3bf473=_0x15f6cf[_0x37a7bf];var _0x2e776b=[];var _0x3fc8dd=[];delete _0x3bf473['id'];if(_0x3bf473['interval']!==_0x9436('0x32')){_0x3bf473[_0x9436('0x33')]=[_0x3bf473[_0x9436('0x34')]];}else{_0x3bf473[_0x9436('0x33')]=_0x3bf473[_0x9436('0x30')]?_[_0x9436('0x35')](_['filter'](_0x45998b,{'IntervalId':_0x3bf473[_0x9436('0x30')]}),_0x9436('0x34')):[];}_0x3bf473[_0x9436('0x6')]=_0x2fde43[_0x9436('0x6')];_0x3bf473['exten']=_0x2fde43[_0x9436('0x9')];if(_0x3bf473['type'])_0x3bf473['type']=_0x3bf473[_0x9436('0x4')][_0x9436('0x36')]();if(_0x2fde43[_0x9436('0x4')]===_0x9436('0x15')){if(_0x3bf473[_0x9436('0x37')](_0x9436('0x38'))&&_0x3bf473[_0x9436('0x38')]&&_0x3bf473[_0x9436('0x38')]!=='--'){_0x2e776b[_0x9436('0xa')]({'type':_0x3bf473['type'][_0x9436('0x36')](),'app':_0x9436('0x5'),'appdata':_0x9436('0x39')+_0x3bf473['tag'],'context':_0x2fde43[_0x9436('0x6')],'exten':_0x2fde43[_0x9436('0x9')],'priority':_0x3bf473['intervals'][_0x9436('0x24')]+_0x2785f4+_0x5b5ff4++,'VoiceExtensionId':_0x2fde43['id']});}_0x2e776b[_0x9436('0xa')]({'type':_0x3bf473['type'][_0x9436('0x36')](),'app':_0x9436('0x16'),'appdata':_0x9436('0x3a')+(_0x3bf473[_0x9436('0x3b')]?'Set(CALLERID(all)='+_0x3bf473[_0x9436('0x3b')]+')':_0x9436('0x3c')),'context':_0x2fde43[_0x9436('0x6')],'exten':_0x2fde43['exten'],'priority':_0x3bf473[_0x9436('0x33')][_0x9436('0x24')]+_0x2785f4+_0x5b5ff4++,'VoiceExtensionId':_0x2fde43['id']});}else{if(_0x3bf473[_0x9436('0x37')]('answer')){if([_0x9436('0x3d'),'playback'][_0x9436('0x3e')](_0x3bf473[_0x9436('0x3f')][_0x9436('0x36')]())&&_0x3bf473['appType']!==_0x9436('0x40')){if(_0x3bf473[_0x9436('0x41')]){_0x2e776b[_0x9436('0xa')]({'type':_0x3bf473[_0x9436('0x4')][_0x9436('0x36')](),'app':_0x9436('0x16'),'appdata':_0x9436('0x42'),'context':_0x2fde43['context'],'exten':_0x2fde43[_0x9436('0x9')],'priority':_0x3bf473[_0x9436('0x33')]['length']+_0x2785f4+_0x5b5ff4++,'VoiceExtensionId':_0x2fde43['id']});_0x2e776b[_0x9436('0xa')]({'type':_0x3bf473[_0x9436('0x4')]['toLowerCase'](),'app':_0x9436('0x5'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x2fde43[_0x9436('0x6')],'exten':_0x2fde43[_0x9436('0x9')],'priority':_0x3bf473[_0x9436('0x33')][_0x9436('0x24')]+_0x2785f4+_0x5b5ff4++,'VoiceExtensionId':_0x2fde43['id']});}else{_0x2e776b[_0x9436('0xa')]({'type':_0x3bf473[_0x9436('0x4')][_0x9436('0x36')](),'app':_0x9436('0x16'),'appdata':_0x9436('0x43'),'context':_0x2fde43['context'],'exten':_0x2fde43['exten'],'priority':_0x3bf473[_0x9436('0x33')][_0x9436('0x24')]+_0x2785f4+_0x5b5ff4++,'VoiceExtensionId':_0x2fde43['id']});_0x2e776b[_0x9436('0xa')]({'type':_0x3bf473[_0x9436('0x4')][_0x9436('0x36')](),'app':'Set','appdata':_0x9436('0x44'),'context':_0x2fde43[_0x9436('0x6')],'exten':_0x2fde43[_0x9436('0x9')],'priority':_0x3bf473[_0x9436('0x33')][_0x9436('0x24')]+_0x2785f4+_0x5b5ff4++,'VoiceExtensionId':_0x2fde43['id']});}}}}for(var _0x49082a=0x0;_0x49082a<_0x3bf473['intervals']['length'];_0x49082a++){var _0x39964b=_0x2785f4+_0x3bf473[_0x9436('0x33')][_0x9436('0x24')];var _0x3bf7d7=_0x49082a===_0x3bf473[_0x9436('0x33')][_0x9436('0x24')]-0x1?_0x2785f4+_0x2e776b[_0x9436('0x24')]+_0x3fc8dd[_0x9436('0x24')]+0x2:_0x2785f4+_0x49082a+0x1;_0x2e776b['splice'](_0x49082a,0x0,{'type':_0x2fde43[_0x9436('0x4')],'app':'GotoIfTime','appdata':_0x3bf473[_0x9436('0x33')][_0x49082a]+'?'+_0x2fde43[_0x9436('0x6')]+_0x9436('0x45')+_0x39964b+':'+_0x2fde43['context']+_0x9436('0x45')+_0x3bf7d7,'exten':_0x2fde43[_0x9436('0x9')],'context':_0x2fde43['context'],'priority':_0x2785f4+_0x49082a,'VoiceExtensionId':_0x2fde43['id']});}if(_0x3bf473[_0x9436('0x46')]===_0x9436('0x47')){_0x3bf473[_0x9436('0x48')]=_0x4a0d78(_0x2fde43,_0x3bf473[_0x9436('0x48')]);}if(_0x3bf473['appType']===_0x9436('0x49')){_0x2e776b[_0x9436('0xa')]({'type':_0x3bf473[_0x9436('0x4')]['toLowerCase'](),'app':_0x9436('0x5'),'appdata':'XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','context':_0x2fde43[_0x9436('0x6')],'exten':_0x2fde43[_0x9436('0x9')],'priority':_0x3bf473[_0x9436('0x33')][_0x9436('0x24')]+_0x2785f4+_0x5b5ff4++,'VoiceExtensionId':_0x2fde43['id']});}_0x3bf473['priority']=_0x2e776b[_0x9436('0x24')]?_[_0x9436('0x4a')](_0x2e776b)[_0x9436('0x4b')]+0x1:_0x2785f4;_0x5408ee=_[_0x9436('0x4c')](_0x5408ee,_0x2e776b,[_0x3bf473],_0x3fc8dd);_0x2785f4=_[_0x9436('0x4a')](_0x5408ee)[_0x9436('0x4b')]+0x1;}return _0x443b4a(_0x5408ee);})['catch'](function(_0x42ce0a){_0x3c0645(_0x42ce0a);});});}return _0xccbafe[_0x9436('0x4d')](_0x9436('0x4e'),attributes,{'tableName':_0x9436('0x4f'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x28acf6){var _0x11dc6c=this[_0x9436('0x50')]({'plain':!![]});var _0x56a4fe=_0x11dc6c[_0x9436('0x4')]===_0x9436('0x15')?_0x2e7dd7(_0x11dc6c):_0x13ffbc(_0x11dc6c);return _0x455d04(_0x11dc6c,_0x28acf6,_[_0x9436('0x4a')](_0x56a4fe)[_0x9436('0x4b')]+0x1)[_0x9436('0x31')](function(_0x1c43d2){var _0x49eed8=_[_0x9436('0x4c')](_0x56a4fe,_0x1c43d2);_0x49eed8['push']({'type':_0x11dc6c[_0x9436('0x4')],'app':_0x9436('0x51'),'exten':_0x11dc6c['exten'],'context':_0x11dc6c[_0x9436('0x6')],'priority':_['last'](_0x49eed8)[_0x9436('0x4b')]+0x1,'VoiceExtensionId':_0x11dc6c['id']});return _0x49eed8;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 3834cca..155708b 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 _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 +var _0x46ed=['stringify','code','error','VoiceExtension,\x20%s,\x20%s','message','result','GetVoiceExtension','VoiceExtension','findAll','options','where','attributes','limit','include','model','map','debug','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','request','then','info','request\x20sent'];(function(_0xe1b979,_0x33e0c1){var _0xc7b23c=function(_0x461850){while(--_0x461850){_0xe1b979['push'](_0xe1b979['shift']());}};_0xc7b23c(++_0x33e0c1);}(_0x46ed,0x168));var _0xd46e=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x46ed[_0x5c2e3e];return _0x53f64a;};'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')]('VoiceExtension,\x20%s,\x20%s',_0x81235b,_0xd46e('0x13'));logger['debug']('VoiceExtension,\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')]('VoiceExtension,\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')]({'raw':_0x2273c5[_0xd46e('0x1d')]?_0x2273c5[_0xd46e('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x2273c5[_0xd46e('0x1d')]?_0x2273c5[_0xd46e('0x1d')][_0xd46e('0x1e')]||null:null,'attributes':_0x2273c5[_0xd46e('0x1d')]?_0x2273c5[_0xd46e('0x1d')][_0xd46e('0x1f')]||null:null,'limit':_0x2273c5[_0xd46e('0x1d')]?_0x2273c5[_0xd46e('0x1d')][_0xd46e('0x20')]||null:null,'include':_0x2273c5['options']?_0x2273c5[_0xd46e('0x1d')]['include']?_['map'](_0x2273c5[_0xd46e('0x1d')][_0xd46e('0x21')],function(_0x21135f){return{'model':db[_0x21135f[_0xd46e('0x22')]],'as':_0x21135f['as'],'attributes':_0x21135f[_0xd46e('0x1f')],'include':_0x21135f[_0xd46e('0x21')]?_[_0xd46e('0x23')](_0x21135f['include'],function(_0x45d789){return{'model':db[_0x45d789[_0xd46e('0x22')]],'as':_0x45d789['as'],'attributes':_0x45d789[_0xd46e('0x1f')],'include':_0x45d789[_0xd46e('0x21')]?_[_0xd46e('0x23')](_0x45d789[_0xd46e('0x21')],function(_0x58aeef){return{'model':db[_0x58aeef[_0xd46e('0x22')]],'as':_0x58aeef['as'],'attributes':_0x58aeef[_0xd46e('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd46e('0x11')](function(_0xa716ce){logger[_0xd46e('0x12')](_0xd46e('0x1a'),_0x2273c5);logger[_0xd46e('0x24')](_0xd46e('0x1a'),_0x2273c5,JSON[_0xd46e('0x14')](_0xa716ce));_0x312d6f(_0xa716ce);})[_0xd46e('0x25')](function(_0x2ff785){logger[_0xd46e('0x16')](_0xd46e('0x1a'),_0x2ff785['message'],_0x2273c5);_0x3b5fa4(_0x409010[_0xd46e('0x16')](0x1f4,_0x2ff785[_0xd46e('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 1182d28..4ef30a4 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 _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 +var _0x5fc3=['./voiceExtension.events','save','update','emit','removeListener','register','voiceExtension:'];(function(_0x470d59,_0x2d6c72){var _0x48d24b=function(_0x1ebd42){while(--_0x1ebd42){_0x470d59['push'](_0x470d59['shift']());}};_0x48d24b(++_0x2d6c72);}(_0x5fc3,0xa8));var _0x35fc=function(_0x33a694,_0x9b6640){_0x33a694=_0x33a694-0x0;var _0x41ff01=_0x5fc3[_0x33a694];return _0x41ff01;};'use strict';var VoiceExtensionEvents=require(_0x35fc('0x0'));var events=[_0x35fc('0x1'),'remove',_0x35fc('0x2')];function createListener(_0x2ac6da,_0x196bc2){return function(_0x91d024){_0x196bc2[_0x35fc('0x3')](_0x2ac6da,_0x91d024);};}function removeListener(_0x5e75e6,_0x2d1404){return function(){VoiceExtensionEvents[_0x35fc('0x4')](_0x5e75e6,_0x2d1404);};}exports[_0x35fc('0x5')]=function(_0x5b85ad){for(var _0x5754be=0x0,_0x19a0d1=events['length'];_0x5754be<_0x19a0d1;_0x5754be++){var _0x16e153=events[_0x5754be];var _0x27524f=createListener(_0x35fc('0x6')+_0x16e153,_0x5b85ad);VoiceExtensionEvents['on'](_0x16e153,_0x27524f);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 94cf6fc..8723bf0 100644 --- a/server/api/voiceMail/index.js +++ b/server/api/voiceMail/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfcf0=['update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','post','put'];(function(_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 +var _0x4bd3=['post','create','put','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/messages','getMessages'];(function(_0x4b6e14,_0x3ba2ab){var _0xe645ea=function(_0xddb70c){while(--_0xddb70c){_0x4b6e14['push'](_0x4b6e14['shift']());}};_0xe645ea(++_0x3ba2ab);}(_0x4bd3,0x174));var _0x34bd=function(_0x836243,_0x47a394){_0x836243=_0x836243-0x0;var _0x1fed20=_0x4bd3[_0x836243];return _0x1fed20;};'use strict';var multer=require(_0x34bd('0x0'));var util=require('util');var path=require(_0x34bd('0x1'));var timeout=require(_0x34bd('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x34bd('0x3'));var interaction=require(_0x34bd('0x4'));var config=require(_0x34bd('0x5'));var controller=require('./voiceMail.controller');router[_0x34bd('0x6')]('/',auth[_0x34bd('0x7')](),controller['index']);router[_0x34bd('0x6')](_0x34bd('0x8'),auth['isAuthenticated'](),controller[_0x34bd('0x9')]);router[_0x34bd('0x6')](_0x34bd('0xa'),auth[_0x34bd('0x7')](),controller[_0x34bd('0xb')]);router[_0x34bd('0xc')]('/',auth['isAuthenticated'](),controller[_0x34bd('0xd')]);router[_0x34bd('0xe')](_0x34bd('0x8'),auth[_0x34bd('0x7')](),controller['update']);router['delete'](_0x34bd('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x34bd('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 46588de..b0bba42 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 _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 +var _0x4039=['exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','central','ENUM','yes','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','\x20-\x20','mailbox','sequelize'];(function(_0x3631bd,_0x3b23c7){var _0x44c442=function(_0x507752){while(--_0x507752){_0x3631bd['push'](_0x3631bd['shift']());}};_0x44c442(++_0x3b23c7);}(_0x4039,0x14f));var _0x9403=function(_0x18abd2,_0x22d4b3){_0x18abd2=_0x18abd2-0x0;var _0x1dcad6=_0x4039[_0x18abd2];return _0x1dcad6;};'use strict';var Sequelize=require(_0x9403('0x0'));module[_0x9403('0x1')]={'customer_id':{'type':Sequelize[_0x9403('0x2')]},'context':{'type':Sequelize[_0x9403('0x2')],'defaultValue':_0x9403('0x3'),'unique':_0x9403('0x4')},'mailbox':{'type':Sequelize[_0x9403('0x2')],'defaultValue':'','allowNull':![],'unique':_0x9403('0x4')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0x9403('0x2')]},'email':{'type':Sequelize[_0x9403('0x2')],'validate':{'isEmail':!![]},'set':function(_0x3cf953){this[_0x9403('0x5')](_0x9403('0x6'),typeof _0x3cf953==='string'&&_0x3cf953['trim']()?_0x3cf953['trim']():null);}},'pager':{'type':Sequelize[_0x9403('0x2')]},'tz':{'type':Sequelize[_0x9403('0x2')],'defaultValue':_0x9403('0x7')},'attach':{'type':Sequelize[_0x9403('0x8')](_0x9403('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x9403('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x9403('0x2')]},'review':{'type':Sequelize[_0x9403('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x9403('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x9403('0x8')](_0x9403('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x9403('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x9403('0x8')](_0x9403('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x9403('0x8')](_0x9403('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x9403('0x8')]('yes','no'),'defaultValue':_0x9403('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x9403('0x8')](_0x9403('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x9403('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x9403('0x8')]('yes','no'),'defaultValue':_0x9403('0x9'),'allowNull':![]},'stamp':{'type':_0x9403('0xa')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0x9403('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x9403('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x9403('0xc')],'get':function(){return this[_0x9403('0xd')]('fullname')+_0x9403('0xe')+this[_0x9403('0xd')](_0x9403('0xf'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 736668a..ddc9f1f 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 _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 +var _0x84a0=['UserProfileSection','userProfileId','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','VoiceMailMessage','mailbox','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','save','update','destroy','then','get','Voicemails','error','stack','name','send','index','map','VoiceMail','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','keys','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user'];(function(_0x1d80be,_0x3a60ff){var _0xf9a4f3=function(_0x5b8a08){while(--_0x5b8a08){_0x1d80be['push'](_0x1d80be['shift']());}};_0xf9a4f3(++_0x3a60ff);}(_0x84a0,0x66));var _0x084a=function(_0x3c69a3,_0xb8ce21){_0x3c69a3=_0x3c69a3-0x0;var _0x46e814=_0x84a0[_0x3c69a3];return _0x46e814;};'use strict';var emlformat=require(_0x084a('0x0'));var rimraf=require(_0x084a('0x1'));var zipdir=require(_0x084a('0x2'));var jsonpatch=require(_0x084a('0x3'));var rp=require('request-promise');var moment=require(_0x084a('0x4'));var BPromise=require(_0x084a('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x084a('0x6'));var sox=require(_0x084a('0x7'));var csv=require('to-csv');var ejs=require(_0x084a('0x8'));var fs=require('fs');var fs_extra=require(_0x084a('0x9'));var _=require(_0x084a('0xa'));var squel=require(_0x084a('0xb'));var crypto=require(_0x084a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x084a('0xd'));var toCsv=require(_0x084a('0xe'));var querystring=require(_0x084a('0xf'));var Papa=require(_0x084a('0x10'));var Redis=require(_0x084a('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x084a('0x12'));var hardwareService=require(_0x084a('0x13'));var logger=require(_0x084a('0x14'))(_0x084a('0x15'));var utils=require(_0x084a('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x084a('0x17'))['db'];function respondWithStatusCode(_0x3ca72f,_0xec90a5){_0xec90a5=_0xec90a5||0xcc;return function(_0x9245b1){if(_0x9245b1){return _0x3ca72f[_0x084a('0x18')](_0xec90a5);}return _0x3ca72f[_0x084a('0x19')](_0xec90a5)[_0x084a('0x1a')]();};}function respondWithResult(_0x3a76d1,_0x5aef40){_0x5aef40=_0x5aef40||0xc8;return function(_0x4277c9){if(_0x4277c9){return _0x3a76d1['status'](_0x5aef40)[_0x084a('0x1b')](_0x4277c9);}};}function respondWithFilteredResult(_0x3ccaca,_0x366624){return function(_0x2d35b8){if(_0x2d35b8){var _0xd20527=typeof _0x366624['offset']===_0x084a('0x1c')&&typeof _0x366624['limit']===_0x084a('0x1c');var _0x355b45=_0x2d35b8['count'];var _0xf2c333=_0xd20527?0x0:_0x366624[_0x084a('0x1d')];var _0x4134b9=_0xd20527?_0x2d35b8[_0x084a('0x1e')]:_0x366624[_0x084a('0x1d')]+_0x366624[_0x084a('0x1f')];var _0x447a19;if(_0x4134b9>=_0x355b45){_0x4134b9=_0x355b45;_0x447a19=0xc8;}else{_0x447a19=0xce;}_0x3ccaca[_0x084a('0x19')](_0x447a19);return _0x3ccaca[_0x084a('0x20')](_0x084a('0x21'),_0xf2c333+'-'+_0x4134b9+'/'+_0x355b45)[_0x084a('0x1b')](_0x2d35b8);}return null;};}function patchUpdates(_0x279e25){return function(_0x116328){try{jsonpatch[_0x084a('0x22')](_0x116328,_0x279e25,!![]);}catch(_0xf0dd98){return BPromise['reject'](_0xf0dd98);}return _0x116328[_0x084a('0x23')]();};}function saveUpdates(_0x1ad257,_0x41a90f){return function(_0x2d62bf){if(_0x2d62bf){return _0x2d62bf[_0x084a('0x24')](_0x1ad257)['then'](function(_0x755c24){return _0x755c24;});}return null;};}function removeEntity(_0x288e9e,_0x6346a5){return function(_0x1f2c9f){if(_0x1f2c9f){return _0x1f2c9f[_0x084a('0x25')]()[_0x084a('0x26')](function(){var _0x5be167=_0x1f2c9f[_0x084a('0x27')]({'plain':!![]});var _0x2af138=_0x084a('0x28');return db['UserProfileResource'][_0x084a('0x25')]({'where':{'type':_0x2af138,'resourceId':_0x5be167['id']}})[_0x084a('0x26')](function(){return _0x1f2c9f;});})[_0x084a('0x26')](function(){_0x288e9e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4874fe,_0x52227a){return function(_0x33b88f){if(!_0x33b88f){_0x4874fe['sendStatus'](0x194);}return _0x33b88f;};}function handleError(_0x5bea78,_0x51c9f4){_0x51c9f4=_0x51c9f4||0x1f4;return function(_0x3b8176){logger[_0x084a('0x29')](_0x3b8176[_0x084a('0x2a')]);if(_0x3b8176[_0x084a('0x2b')]){delete _0x3b8176[_0x084a('0x2b')];}_0x5bea78[_0x084a('0x19')](_0x51c9f4)[_0x084a('0x2c')](_0x3b8176);};}exports[_0x084a('0x2d')]=function(_0x5e6ea8,_0x2ed3cd){var _0x3b2b38={},_0x501a16={},_0xe1980b={'count':0x0,'rows':[]};var _0x24bcf5=_[_0x084a('0x2e')](db[_0x084a('0x2f')][_0x084a('0x30')],function(_0x202602){return{'name':_0x202602[_0x084a('0x31')],'type':_0x202602[_0x084a('0x32')][_0x084a('0x33')]};});_0x501a16[_0x084a('0x34')]=_[_0x084a('0x2e')](_0x24bcf5,_0x084a('0x2b'));_0x501a16[_0x084a('0x35')]=_['keys'](_0x5e6ea8['query']);_0x501a16[_0x084a('0x36')]=_[_0x084a('0x37')](_0x501a16[_0x084a('0x34')],_0x501a16[_0x084a('0x35')]);_0x3b2b38[_0x084a('0x38')]=_['intersection'](_0x501a16[_0x084a('0x34')],qs[_0x084a('0x39')](_0x5e6ea8[_0x084a('0x35')]['fields']));_0x3b2b38[_0x084a('0x38')]=_0x3b2b38[_0x084a('0x38')][_0x084a('0x3a')]?_0x3b2b38['attributes']:_0x501a16['model'];if(!_0x5e6ea8['query'][_0x084a('0x3b')](_0x084a('0x3c'))){_0x3b2b38[_0x084a('0x1f')]=qs['limit'](_0x5e6ea8[_0x084a('0x35')][_0x084a('0x1f')]);_0x3b2b38[_0x084a('0x1d')]=qs[_0x084a('0x1d')](_0x5e6ea8[_0x084a('0x35')][_0x084a('0x1d')]);}_0x3b2b38[_0x084a('0x3d')]=qs[_0x084a('0x3e')](_0x5e6ea8[_0x084a('0x35')][_0x084a('0x3e')]);_0x3b2b38[_0x084a('0x3f')]=qs[_0x084a('0x36')](_[_0x084a('0x40')](_0x5e6ea8[_0x084a('0x35')],_0x501a16[_0x084a('0x36')]),_0x24bcf5);if(_0x5e6ea8['query'][_0x084a('0x41')]){_0x3b2b38[_0x084a('0x3f')]=_[_0x084a('0x42')](_0x3b2b38[_0x084a('0x3f')],{'$or':_[_0x084a('0x2e')](_0x24bcf5,function(_0x22862b){if(_0x22862b[_0x084a('0x32')]!==_0x084a('0x43')){var _0x13dc4c={};_0x13dc4c[_0x22862b['name']]={'$like':'%'+_0x5e6ea8[_0x084a('0x35')][_0x084a('0x41')]+'%'};return _0x13dc4c;}})});}_0x3b2b38=_[_0x084a('0x42')]({},_0x3b2b38,_0x5e6ea8[_0x084a('0x44')]);var _0x256008={'where':_0x3b2b38[_0x084a('0x3f')]};return db['VoiceMail'][_0x084a('0x1e')](_0x256008)[_0x084a('0x26')](function(_0x55c5f4){_0xe1980b[_0x084a('0x1e')]=_0x55c5f4;if(_0x5e6ea8[_0x084a('0x35')][_0x084a('0x45')]){_0x3b2b38['include']=[{'all':!![]}];}return db[_0x084a('0x2f')][_0x084a('0x46')](_0x3b2b38);})['then'](function(_0x3e2b92){_0xe1980b[_0x084a('0x47')]=_0x3e2b92;return _0xe1980b;})['then'](respondWithFilteredResult(_0x2ed3cd,_0x3b2b38))['catch'](handleError(_0x2ed3cd,null));};exports[_0x084a('0x48')]=function(_0x17a8d4,_0x3726bd){var _0xec2713={'raw':!![],'where':{'id':_0x17a8d4[_0x084a('0x49')]['id']}},_0x1e2a2d={};_0x1e2a2d[_0x084a('0x34')]=_[_0x084a('0x4a')](db[_0x084a('0x2f')][_0x084a('0x30')]);_0x1e2a2d[_0x084a('0x35')]=_['keys'](_0x17a8d4['query']);_0x1e2a2d[_0x084a('0x36')]=_[_0x084a('0x37')](_0x1e2a2d[_0x084a('0x34')],_0x1e2a2d['query']);_0xec2713[_0x084a('0x38')]=_[_0x084a('0x37')](_0x1e2a2d[_0x084a('0x34')],qs[_0x084a('0x39')](_0x17a8d4[_0x084a('0x35')]['fields']));_0xec2713[_0x084a('0x38')]=_0xec2713['attributes'][_0x084a('0x3a')]?_0xec2713[_0x084a('0x38')]:_0x1e2a2d[_0x084a('0x34')];if(_0x17a8d4['query']['includeAll']){_0xec2713[_0x084a('0x4b')]=[{'all':!![]}];}_0xec2713=_[_0x084a('0x42')]({},_0xec2713,_0x17a8d4['options']);return db[_0x084a('0x2f')][_0x084a('0x4c')](_0xec2713)[_0x084a('0x26')](handleEntityNotFound(_0x3726bd,null))[_0x084a('0x26')](respondWithResult(_0x3726bd,null))['catch'](handleError(_0x3726bd,null));};exports[_0x084a('0x4d')]=function(_0x865368,_0x31677b){return db[_0x084a('0x2f')]['create'](_0x865368[_0x084a('0x4e')],{})[_0x084a('0x26')](function(_0x411fa9){var _0x2d3d01=_0x865368['user']['get']({'plain':!![]});if(!_0x2d3d01)throw new Error(_0x084a('0x4f'));if(_0x2d3d01[_0x084a('0x50')]===_0x084a('0x51')){var _0x264f09=_0x411fa9[_0x084a('0x27')]({'plain':!![]});var _0x3b2df4=_0x084a('0x28');return db[_0x084a('0x52')][_0x084a('0x4c')]({'where':{'name':_0x3b2df4,'userProfileId':_0x2d3d01[_0x084a('0x53')]},'raw':!![]})[_0x084a('0x26')](function(_0x98769c){if(_0x98769c&&_0x98769c['autoAssociation']===0x0){return db[_0x084a('0x54')][_0x084a('0x4d')]({'name':_0x264f09[_0x084a('0x2b')],'resourceId':_0x264f09['id'],'type':_0x98769c[_0x084a('0x2b')],'sectionId':_0x98769c['id']},{})[_0x084a('0x26')](function(){return _0x411fa9;});}else{return _0x411fa9;}})[_0x084a('0x55')](function(_0xa5362){logger['error'](_0x084a('0x56'),_0xa5362);throw _0xa5362;});}return _0x411fa9;})[_0x084a('0x26')](respondWithResult(_0x31677b,0xc9))[_0x084a('0x55')](handleError(_0x31677b,null));};exports['update']=function(_0x54ca1f,_0x424cd1){if(_0x54ca1f['body']['id']){delete _0x54ca1f[_0x084a('0x4e')]['id'];}return db[_0x084a('0x2f')]['find']({'where':{'id':_0x54ca1f[_0x084a('0x49')]['id']}})['then'](handleEntityNotFound(_0x424cd1,null))['then'](saveUpdates(_0x54ca1f[_0x084a('0x4e')],null))[_0x084a('0x26')](respondWithResult(_0x424cd1,null))[_0x084a('0x55')](handleError(_0x424cd1,null));};exports[_0x084a('0x25')]=function(_0x2a8056,_0x57d397){return db[_0x084a('0x2f')]['find']({'where':{'id':_0x2a8056[_0x084a('0x49')]['id']}})[_0x084a('0x26')](handleEntityNotFound(_0x57d397,null))[_0x084a('0x26')](removeEntity(_0x57d397,null))['catch'](handleError(_0x57d397,null));};exports[_0x084a('0x57')]=function(_0x339088,_0x12db87,_0x9246dd){return db['VoiceMail'][_0x084a('0x58')]({'where':{'id':_0x339088['params']['id']}})[_0x084a('0x26')](handleEntityNotFound(_0x12db87,null))[_0x084a('0x26')](function(_0x21a18a){var _0x4cc344;var _0x589e38={},_0xd37003={};_0xd37003[_0x084a('0x34')]=_['keys'](db[_0x084a('0x59')]['rawAttributes']);_0xd37003['query']=_[_0x084a('0x4a')](_0x339088[_0x084a('0x35')]);_0xd37003[_0x084a('0x36')]=_[_0x084a('0x37')](_0xd37003[_0x084a('0x34')],_0xd37003[_0x084a('0x35')]);_0x589e38[_0x084a('0x38')]=_[_0x084a('0x37')](_0xd37003[_0x084a('0x34')],qs['fields'](_0x339088[_0x084a('0x35')][_0x084a('0x39')]));_0x589e38[_0x084a('0x38')]=_0x589e38['attributes'][_0x084a('0x3a')]?_0x589e38[_0x084a('0x38')]:_0xd37003['model'];if(!_0x339088[_0x084a('0x35')]['hasOwnProperty']('nolimit')){_0x589e38[_0x084a('0x1f')]=qs['limit'](_0x339088['query'][_0x084a('0x1f')]);_0x589e38[_0x084a('0x1d')]=qs[_0x084a('0x1d')](_0x339088['query'][_0x084a('0x1d')]);}_0x589e38[_0x084a('0x3d')]=qs[_0x084a('0x3e')](_0x339088[_0x084a('0x35')][_0x084a('0x3e')]);_0x589e38[_0x084a('0x3f')]=qs[_0x084a('0x36')](_['pick'](_0x339088['query'],_0xd37003[_0x084a('0x36')]));if(_0x339088[_0x084a('0x35')]['filter']){_0x589e38[_0x084a('0x3f')]=_[_0x084a('0x42')](_0x589e38[_0x084a('0x3f')],{'$or':_[_0x084a('0x2e')](_0x589e38['attributes'],function(_0x21dd85){var _0x3fa52e={};_0x3fa52e[_0x21dd85]={'$like':'%'+_0x339088[_0x084a('0x35')]['filter']+'%'};return _0x3fa52e;})});}_0x589e38['where']=_[_0x084a('0x42')](_0x589e38[_0x084a('0x3f')],{'mailboxuser':_0x21a18a[_0x084a('0x5a')]});_0x589e38=_[_0x084a('0x42')]({},_0x589e38,_0x339088[_0x084a('0x44')]);return db[_0x084a('0x59')][_0x084a('0x5b')](_0x589e38)['then'](respondWithFilteredResult(_0x12db87,_0x589e38));})[_0x084a('0x55')](handleError(_0x12db87,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 2875925..a512ceb 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 _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 +var _0xb060=['mailbox_context','mailbox','context','lodash','util','../../config/logger','api','moment','request-promise','./voiceMail.attributes','exports'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0xb060,0x1b0));var _0x0b06=function(_0xd82abf,_0x4f9171){_0xd82abf=_0xd82abf-0x0;var _0x28dbf2=_0xb060[_0xd82abf];return _0x28dbf2;};'use strict';var _=require(_0x0b06('0x0'));var util=require(_0x0b06('0x1'));var logger=require(_0x0b06('0x2'))(_0x0b06('0x3'));var moment=require(_0x0b06('0x4'));var BPromise=require('bluebird');var rp=require(_0x0b06('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0b06('0x6'));module[_0x0b06('0x7')]=function(_0x293514,_0x539097){return _0x293514['define']('VoiceMail',attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x0b06('0x8'),'fields':[_0x0b06('0x9'),_0x0b06('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 5ac70a0..51b5a6e 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 _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 +var _0xf0b9=['stringify','error','code','message','request\x20sent','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMail,\x20%s,\x20%s','debug','VoiceMail,\x20%s,\x20%s,\x20%s'];(function(_0x543700,_0x5e623d){var _0x5330a0=function(_0x267f3a){while(--_0x267f3a){_0x543700['push'](_0x543700['shift']());}};_0x5330a0(++_0x5e623d);}(_0xf0b9,0x17e));var _0x9f0b=function(_0x31e7aa,_0x393df2){_0x31e7aa=_0x31e7aa-0x0;var _0x35e503=_0xf0b9[_0x31e7aa];return _0x35e503;};'use strict';var _=require('lodash');var util=require(_0x9f0b('0x0'));var moment=require(_0x9f0b('0x1'));var BPromise=require(_0x9f0b('0x2'));var rs=require(_0x9f0b('0x3'));var fs=require('fs');var Redis=require(_0x9f0b('0x4'));var db=require(_0x9f0b('0x5'))['db'];var utils=require(_0x9f0b('0x6'));var logger=require(_0x9f0b('0x7'))('rpc');var config=require(_0x9f0b('0x8'));var jayson=require(_0x9f0b('0x9'));var client=jayson[_0x9f0b('0xa')][_0x9f0b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x343eba,_0x26672b,_0x15a434){return new BPromise(function(_0x397c74,_0x420905){return client[_0x9f0b('0xc')](_0x343eba,_0x15a434)[_0x9f0b('0xd')](function(_0x471ddb){logger[_0x9f0b('0xe')](_0x9f0b('0xf'),_0x26672b,'request\x20sent');logger[_0x9f0b('0x10')](_0x9f0b('0x11'),_0x26672b,'request\x20sent',JSON[_0x9f0b('0x12')](_0x471ddb));if(_0x471ddb[_0x9f0b('0x13')]){if(_0x471ddb[_0x9f0b('0x13')][_0x9f0b('0x14')]===0x1f4){logger[_0x9f0b('0x13')]('VoiceMail,\x20%s,\x20%s',_0x26672b,_0x471ddb[_0x9f0b('0x13')][_0x9f0b('0x15')]);return _0x420905(_0x471ddb[_0x9f0b('0x13')][_0x9f0b('0x15')]);}logger['error'](_0x9f0b('0xf'),_0x26672b,_0x471ddb[_0x9f0b('0x13')][_0x9f0b('0x15')]);return _0x397c74(_0x471ddb[_0x9f0b('0x13')]['message']);}else{logger['info'](_0x9f0b('0xf'),_0x26672b,_0x9f0b('0x16'));_0x397c74(_0x471ddb[_0x9f0b('0x17')][_0x9f0b('0x15')]);}})[_0x9f0b('0x18')](function(_0xc82764){logger[_0x9f0b('0x13')](_0x9f0b('0xf'),_0x26672b,_0xc82764);_0x420905(_0xc82764);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 99bf0e1..6abb99a 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 _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 +var _0x85f4=['./voiceMailMessage.controller','get','isAuthenticated','index','/:id','/:id/download','download','post','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1602a5,_0x21b902){var _0x3b01e1=function(_0x4ca0df){while(--_0x4ca0df){_0x1602a5['push'](_0x1602a5['shift']());}};_0x3b01e1(++_0x21b902);}(_0x85f4,0xa0));var _0x485f=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x85f4[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require('multer');var util=require(_0x485f('0x0'));var path=require(_0x485f('0x1'));var timeout=require(_0x485f('0x2'));var express=require(_0x485f('0x3'));var router=express[_0x485f('0x4')]();var fs_extra=require(_0x485f('0x5'));var auth=require(_0x485f('0x6'));var interaction=require(_0x485f('0x7'));var config=require('../../config/environment');var controller=require(_0x485f('0x8'));router[_0x485f('0x9')]('/',auth[_0x485f('0xa')](),controller[_0x485f('0xb')]);router['get'](_0x485f('0xc'),auth[_0x485f('0xa')](),controller['show']);router[_0x485f('0x9')](_0x485f('0xd'),auth[_0x485f('0xa')](),controller[_0x485f('0xe')]);router[_0x485f('0xf')]('/',auth[_0x485f('0xa')](),controller[_0x485f('0x10')]);router[_0x485f('0x11')](_0x485f('0xc'),auth[_0x485f('0xa')](),controller[_0x485f('0x12')]);router['delete'](_0x485f('0xc'),auth[_0x485f('0xa')](),controller[_0x485f('0x13')]);module[_0x485f('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 5d1192f..85df931 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 _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 +var _0xd598=['BLOB','TIMESTAMP','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue','INTEGER','STRING'];(function(_0x2cbfbb,_0x2a062d){var _0xe0a2dc=function(_0x366897){while(--_0x366897){_0x2cbfbb['push'](_0x2cbfbb['shift']());}};_0xe0a2dc(++_0x2a062d);}(_0xd598,0xff));var _0x8d59=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xd598[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x8d59('0x0'));module[_0x8d59('0x1')]={'name':{'type':Sequelize[_0x8d59('0x2')],'get':function(_0x415949){return this[_0x8d59('0x3')]('id');}},'msgnum':{'type':Sequelize[_0x8d59('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0x8d59('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x8d59('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0x8d59('0x5')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0x8d59('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x8d59('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0x8d59('0x6')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0x8d59('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x8d59('0x5')],'defaultValue':''},'stamp':{'type':_0x8d59('0x7'),'defaultValue':Sequelize['literal'](_0x8d59('0x8'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 16384fd..a1dc8be 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 _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 +var _0xba03=['fields','attributes','length','query','hasOwnProperty','nolimit','order','sort','pick','merge','where','options','includeAll','include','findAll','rows','params','keys','intersection','catch','create','body','find','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','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','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','VoiceMailMessage','rawAttributes','fieldName','type','map','filters','model'];(function(_0x545b71,_0x4f44eb){var _0x26e587=function(_0x293b81){while(--_0x293b81){_0x545b71['push'](_0x545b71['shift']());}};_0x26e587(++_0x4f44eb);}(_0xba03,0x75));var _0x3ba0=function(_0x4d1cb8,_0xe5e0d2){_0x4d1cb8=_0x4d1cb8-0x0;var _0x416922=_0xba03[_0x4d1cb8];return _0x416922;};'use strict';var emlformat=require(_0x3ba0('0x0'));var rimraf=require(_0x3ba0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3ba0('0x2'));var rp=require(_0x3ba0('0x3'));var moment=require('moment');var BPromise=require(_0x3ba0('0x4'));var Mustache=require(_0x3ba0('0x5'));var util=require(_0x3ba0('0x6'));var path=require('path');var sox=require(_0x3ba0('0x7'));var csv=require(_0x3ba0('0x8'));var ejs=require(_0x3ba0('0x9'));var fs=require('fs');var fs_extra=require(_0x3ba0('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x3ba0('0xb'));var jsforce=require(_0x3ba0('0xc'));var deskjs=require(_0x3ba0('0xd'));var toCsv=require(_0x3ba0('0x8'));var querystring=require('querystring');var Papa=require(_0x3ba0('0xe'));var Redis=require('ioredis');var authService=require(_0x3ba0('0xf'));var qs=require(_0x3ba0('0x10'));var as=require(_0x3ba0('0x11'));var hardwareService=require(_0x3ba0('0x12'));var logger=require(_0x3ba0('0x13'))('api');var utils=require(_0x3ba0('0x14'));var config=require(_0x3ba0('0x15'));var licenseUtil=require(_0x3ba0('0x16'));var db=require(_0x3ba0('0x17'))['db'];function respondWithStatusCode(_0x3f45c1,_0x2a3b1e){_0x2a3b1e=_0x2a3b1e||0xcc;return function(_0x3f7f9b){if(_0x3f7f9b){return _0x3f45c1[_0x3ba0('0x18')](_0x2a3b1e);}return _0x3f45c1[_0x3ba0('0x19')](_0x2a3b1e)[_0x3ba0('0x1a')]();};}function respondWithResult(_0x14bdfc,_0x17298f){_0x17298f=_0x17298f||0xc8;return function(_0x72547){if(_0x72547){return _0x14bdfc['status'](_0x17298f)[_0x3ba0('0x1b')](_0x72547);}};}function respondWithFilteredResult(_0x2b586e,_0x424f2a){return function(_0x3ab1d0){if(_0x3ab1d0){var _0x4e2606=typeof _0x424f2a[_0x3ba0('0x1c')]==='undefined'&&typeof _0x424f2a[_0x3ba0('0x1d')]===_0x3ba0('0x1e');var _0xdc06e5=_0x3ab1d0[_0x3ba0('0x1f')];var _0x1136b5=_0x4e2606?0x0:_0x424f2a[_0x3ba0('0x1c')];var _0x1db3e2=_0x4e2606?_0x3ab1d0[_0x3ba0('0x1f')]:_0x424f2a['offset']+_0x424f2a[_0x3ba0('0x1d')];var _0x231b25;if(_0x1db3e2>=_0xdc06e5){_0x1db3e2=_0xdc06e5;_0x231b25=0xc8;}else{_0x231b25=0xce;}_0x2b586e[_0x3ba0('0x19')](_0x231b25);return _0x2b586e[_0x3ba0('0x20')](_0x3ba0('0x21'),_0x1136b5+'-'+_0x1db3e2+'/'+_0xdc06e5)[_0x3ba0('0x1b')](_0x3ab1d0);}return null;};}function patchUpdates(_0x1ee1f5){return function(_0x3fa618){try{jsonpatch[_0x3ba0('0x22')](_0x3fa618,_0x1ee1f5,!![]);}catch(_0x105d29){return BPromise[_0x3ba0('0x23')](_0x105d29);}return _0x3fa618['save']();};}function saveUpdates(_0x524eb5,_0x2c122a){return function(_0x26a635){if(_0x26a635){return _0x26a635[_0x3ba0('0x24')](_0x524eb5)[_0x3ba0('0x25')](function(_0x47b046){return _0x47b046;});}return null;};}function removeEntity(_0x4d1017,_0x4776c4){return function(_0x508f85){if(_0x508f85){return _0x508f85[_0x3ba0('0x26')]()[_0x3ba0('0x25')](function(){_0x4d1017[_0x3ba0('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x164932,_0x3b262b){return function(_0x119792){if(!_0x119792){_0x164932['sendStatus'](0x194);}return _0x119792;};}function handleError(_0x34a3c5,_0x5e45da){_0x5e45da=_0x5e45da||0x1f4;return function(_0x382207){logger[_0x3ba0('0x27')](_0x382207[_0x3ba0('0x28')]);if(_0x382207['name']){delete _0x382207[_0x3ba0('0x29')];}_0x34a3c5[_0x3ba0('0x19')](_0x5e45da)[_0x3ba0('0x2a')](_0x382207);};}exports[_0x3ba0('0x2b')]=function(_0x1216d6,_0x4ce1eb){var _0x17a1e2={},_0x3227d1={},_0x372a82={'count':0x0,'rows':[]};var _0x55ea04=_['map'](db[_0x3ba0('0x2c')][_0x3ba0('0x2d')],function(_0x1a88d7){return{'name':_0x1a88d7[_0x3ba0('0x2e')],'type':_0x1a88d7[_0x3ba0('0x2f')]['key']};});_0x3227d1['model']=_['differenceBy'](_[_0x3ba0('0x30')](_0x55ea04,'name'),[_0x3ba0('0x29')]);_0x3227d1['query']=_['keys'](_0x1216d6['query']);_0x3227d1[_0x3ba0('0x31')]=_['intersection'](_0x3227d1[_0x3ba0('0x32')],_0x3227d1['query']);_0x17a1e2['attributes']=_['intersection'](_0x3227d1[_0x3ba0('0x32')],qs['fields'](_0x1216d6['query'][_0x3ba0('0x33')]));_0x17a1e2[_0x3ba0('0x34')]=_0x17a1e2['attributes'][_0x3ba0('0x35')]?_0x17a1e2[_0x3ba0('0x34')]:_0x3227d1[_0x3ba0('0x32')];if(!_0x1216d6[_0x3ba0('0x36')][_0x3ba0('0x37')](_0x3ba0('0x38'))){_0x17a1e2[_0x3ba0('0x1d')]=qs['limit'](_0x1216d6['query'][_0x3ba0('0x1d')]);_0x17a1e2[_0x3ba0('0x1c')]=qs['offset'](_0x1216d6[_0x3ba0('0x36')][_0x3ba0('0x1c')]);}_0x17a1e2[_0x3ba0('0x39')]=qs[_0x3ba0('0x3a')](_0x1216d6[_0x3ba0('0x36')]['sort']);_0x17a1e2['where']=qs[_0x3ba0('0x31')](_[_0x3ba0('0x3b')](_0x1216d6[_0x3ba0('0x36')],_0x3227d1[_0x3ba0('0x31')]),_0x55ea04);if(_0x1216d6[_0x3ba0('0x36')]['filter']){_0x17a1e2['where']=_[_0x3ba0('0x3c')](_0x17a1e2[_0x3ba0('0x3d')],{'$or':_['map'](_0x55ea04,function(_0x5cfa88){if(_0x5cfa88[_0x3ba0('0x2f')]!=='VIRTUAL'){var _0x267be3={};_0x267be3[_0x5cfa88[_0x3ba0('0x29')]]={'$like':'%'+_0x1216d6[_0x3ba0('0x36')]['filter']+'%'};return _0x267be3;}})});}_0x17a1e2=_['merge']({},_0x17a1e2,_0x1216d6[_0x3ba0('0x3e')]);var _0x190185={'where':_0x17a1e2['where']};return db[_0x3ba0('0x2c')][_0x3ba0('0x1f')](_0x190185)[_0x3ba0('0x25')](function(_0x176cee){_0x372a82[_0x3ba0('0x1f')]=_0x176cee;if(_0x1216d6[_0x3ba0('0x36')][_0x3ba0('0x3f')]){_0x17a1e2[_0x3ba0('0x40')]=[{'all':!![]}];}return db[_0x3ba0('0x2c')][_0x3ba0('0x41')](_0x17a1e2);})[_0x3ba0('0x25')](function(_0x99bf77){_0x372a82[_0x3ba0('0x42')]=_0x99bf77;return _0x372a82;})[_0x3ba0('0x25')](respondWithFilteredResult(_0x4ce1eb,_0x17a1e2))['catch'](handleError(_0x4ce1eb,null));};exports['show']=function(_0x55ba34,_0x4ee514){var _0x1a3378={'raw':!![],'where':{'id':_0x55ba34[_0x3ba0('0x43')]['id']}},_0x104c55={};_0x104c55[_0x3ba0('0x32')]=_[_0x3ba0('0x44')](db['VoiceMailMessage'][_0x3ba0('0x2d')]);_0x104c55[_0x3ba0('0x36')]=_[_0x3ba0('0x44')](_0x55ba34['query']);_0x104c55[_0x3ba0('0x31')]=_['intersection'](_0x104c55[_0x3ba0('0x32')],_0x104c55[_0x3ba0('0x36')]);_0x1a3378[_0x3ba0('0x34')]=_[_0x3ba0('0x45')](_0x104c55[_0x3ba0('0x32')],qs[_0x3ba0('0x33')](_0x55ba34['query'][_0x3ba0('0x33')]));_0x1a3378['attributes']=_0x1a3378[_0x3ba0('0x34')][_0x3ba0('0x35')]?_0x1a3378['attributes']:_0x104c55[_0x3ba0('0x32')];if(_0x55ba34['query']['includeAll']){_0x1a3378[_0x3ba0('0x40')]=[{'all':!![]}];}_0x1a3378=_[_0x3ba0('0x3c')]({},_0x1a3378,_0x55ba34['options']);return db[_0x3ba0('0x2c')]['find'](_0x1a3378)['then'](handleEntityNotFound(_0x4ee514,null))[_0x3ba0('0x25')](respondWithResult(_0x4ee514,null))[_0x3ba0('0x46')](handleError(_0x4ee514,null));};exports[_0x3ba0('0x47')]=function(_0x22ae52,_0x34fe69){return db[_0x3ba0('0x2c')][_0x3ba0('0x47')](_0x22ae52[_0x3ba0('0x48')],{})[_0x3ba0('0x25')](respondWithResult(_0x34fe69,0xc9))['catch'](handleError(_0x34fe69,null));};exports[_0x3ba0('0x24')]=function(_0x3e3229,_0x171287){if(_0x3e3229[_0x3ba0('0x48')]['id']){delete _0x3e3229['body']['id'];}return db[_0x3ba0('0x2c')][_0x3ba0('0x49')]({'where':{'id':_0x3e3229[_0x3ba0('0x43')]['id']}})[_0x3ba0('0x25')](handleEntityNotFound(_0x171287,null))[_0x3ba0('0x25')](saveUpdates(_0x3e3229['body'],null))[_0x3ba0('0x25')](respondWithResult(_0x171287,null))['catch'](handleError(_0x171287,null));};exports['destroy']=function(_0x3248da,_0x46dba8){return db[_0x3ba0('0x2c')][_0x3ba0('0x49')]({'where':{'id':_0x3248da[_0x3ba0('0x43')]['id']}})['then'](handleEntityNotFound(_0x46dba8,null))[_0x3ba0('0x25')](removeEntity(_0x46dba8,null))[_0x3ba0('0x46')](handleError(_0x46dba8,null));};exports[_0x3ba0('0x4a')]=function(_0x4734c7,_0x3ef21c,_0x3b3be1){return db[_0x3ba0('0x2c')][_0x3ba0('0x49')]({'where':{'id':_0x4734c7[_0x3ba0('0x43')]['id']},'attributes':['id',_0x3ba0('0x4b'),_0x3ba0('0x4c')]})['then'](handleEntityNotFound(_0x3ef21c,null))['then'](function(_0x150092){if(_0x150092){if(!_0x150092['recording']){throw new db[(_0x3ba0('0x4d'))][(_0x3ba0('0x4e'))](_0x3ba0('0x4f'));}var _0x4fa3f0={'Content-Type':'audio/wav','Content-Disposition':_0x3ba0('0x50')};if(_0x150092[_0x3ba0('0x4c')]){_0x4fa3f0[_0x3ba0('0x51')]=_0x3ba0('0x52')+_0x150092[_0x3ba0('0x4c')]+_0x3ba0('0x53');}_0x3ef21c[_0x3ba0('0x20')](_0x4fa3f0);return _0x3ef21c[_0x3ba0('0x2a')](new Buffer(_0x150092['recording']));}})[_0x3ba0('0x46')](handleError(_0x3ef21c,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 647d472..de5ee94 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 _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 +var _0xf481=['bluebird','request-promise','path','../../config/environment','exports','define','VoiceMailMessage','voice_voicemail_messages','lodash','util','../../config/logger','api','moment'];(function(_0x1f191e,_0x1d8a0e){var _0x2d8ec7=function(_0x130862){while(--_0x130862){_0x1f191e['push'](_0x1f191e['shift']());}};_0x2d8ec7(++_0x1d8a0e);}(_0xf481,0xff));var _0x1f48=function(_0x35c561,_0x1ade37){_0x35c561=_0x35c561-0x0;var _0x3c3f89=_0xf481[_0x35c561];return _0x3c3f89;};'use strict';var _=require(_0x1f48('0x0'));var util=require(_0x1f48('0x1'));var logger=require(_0x1f48('0x2'))(_0x1f48('0x3'));var moment=require(_0x1f48('0x4'));var BPromise=require(_0x1f48('0x5'));var rp=require(_0x1f48('0x6'));var fs=require('fs');var path=require(_0x1f48('0x7'));var rimraf=require('rimraf');var config=require(_0x1f48('0x8'));var attributes=require('./voiceMailMessage.attributes');module[_0x1f48('0x9')]=function(_0x4b4a57,_0x5c7d35){return _0x4b4a57[_0x1f48('0xa')](_0x1f48('0xb'),attributes,{'tableName':_0x1f48('0xc'),'paranoid':![],'indexes':[{'name':'dir','fields':['dir']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 8d8f0f4..7620e61 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 _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 +var _0xe9b6=['http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x40e8ef,_0x586c4c){var _0x3017c9=function(_0x1e6576){while(--_0x1e6576){_0x40e8ef['push'](_0x40e8ef['shift']());}};_0x3017c9(++_0x586c4c);}(_0xe9b6,0x194));var _0x6e9b=function(_0x1d9254,_0x5cbd27){_0x1d9254=_0x1d9254-0x0;var _0x5f5d42=_0xe9b6[_0x1d9254];return _0x5f5d42;};'use strict';var _=require(_0x6e9b('0x0'));var util=require(_0x6e9b('0x1'));var moment=require(_0x6e9b('0x2'));var BPromise=require(_0x6e9b('0x3'));var rs=require(_0x6e9b('0x4'));var fs=require('fs');var Redis=require(_0x6e9b('0x5'));var db=require(_0x6e9b('0x6'))['db'];var utils=require(_0x6e9b('0x7'));var logger=require('../../config/logger')(_0x6e9b('0x8'));var config=require(_0x6e9b('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6e9b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x12068f,_0x1cc896,_0x2093bb){return new BPromise(function(_0x4ef255,_0x41a862){return client[_0x6e9b('0xb')](_0x12068f,_0x2093bb)[_0x6e9b('0xc')](function(_0x32e088){logger[_0x6e9b('0xd')](_0x6e9b('0xe'),_0x1cc896,_0x6e9b('0xf'));logger[_0x6e9b('0x10')](_0x6e9b('0x11'),_0x1cc896,'request\x20sent',JSON['stringify'](_0x32e088));if(_0x32e088[_0x6e9b('0x12')]){if(_0x32e088[_0x6e9b('0x12')][_0x6e9b('0x13')]===0x1f4){logger[_0x6e9b('0x12')]('VoiceMailMessage,\x20%s,\x20%s',_0x1cc896,_0x32e088[_0x6e9b('0x12')]['message']);return _0x41a862(_0x32e088[_0x6e9b('0x12')][_0x6e9b('0x14')]);}logger['error'](_0x6e9b('0xe'),_0x1cc896,_0x32e088['error'][_0x6e9b('0x14')]);return _0x4ef255(_0x32e088[_0x6e9b('0x12')]['message']);}else{logger['info'](_0x6e9b('0xe'),_0x1cc896,'request\x20sent');_0x4ef255(_0x32e088[_0x6e9b('0x15')]['message']);}})[_0x6e9b('0x16')](function(_0x4ee207){logger[_0x6e9b('0x12')](_0x6e9b('0xe'),_0x1cc896,_0x4ee207);_0x41a862(_0x4ee207);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 9a89002..43125be 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 _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 +var _0x3c6b=['isAuthenticated','show','/:id/sounds','post','create','addSound','put','update','delete','destroy','removeSound','exports','multer','path','connect-timeout','express','Router','./voiceMusicOnHold.controller','index','get','/:id'];(function(_0x3029bf,_0x119679){var _0x54df2b=function(_0x43efb2){while(--_0x43efb2){_0x3029bf['push'](_0x3029bf['shift']());}};_0x54df2b(++_0x119679);}(_0x3c6b,0x186));var _0xb3c6=function(_0x192a70,_0x43ac92){_0x192a70=_0x192a70-0x0;var _0x10ec9f=_0x3c6b[_0x192a70];return _0x10ec9f;};'use strict';var multer=require(_0xb3c6('0x0'));var util=require('util');var path=require(_0xb3c6('0x1'));var timeout=require(_0xb3c6('0x2'));var express=require(_0xb3c6('0x3'));var router=express[_0xb3c6('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb3c6('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xb3c6('0x6')]);router[_0xb3c6('0x7')](_0xb3c6('0x8'),auth[_0xb3c6('0x9')](),controller[_0xb3c6('0xa')]);router[_0xb3c6('0x7')](_0xb3c6('0xb'),auth[_0xb3c6('0x9')](),controller['getSounds']);router[_0xb3c6('0xc')]('/',auth[_0xb3c6('0x9')](),controller[_0xb3c6('0xd')]);router[_0xb3c6('0xc')]('/:id/sounds',auth[_0xb3c6('0x9')](),controller[_0xb3c6('0xe')]);router[_0xb3c6('0xf')](_0xb3c6('0x8'),auth[_0xb3c6('0x9')](),controller[_0xb3c6('0x10')]);router[_0xb3c6('0x11')]('/:id',auth[_0xb3c6('0x9')](),controller[_0xb3c6('0x12')]);router[_0xb3c6('0x11')]('/:id/sounds/:id2',auth['isAuthenticated'](),controller[_0xb3c6('0x13')]);module[_0xb3c6('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 c74e2c2..4126b62 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 _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 +var _0x10cd=['sequelize','exports','STRING','name','ENUM','custom','files','mp3nb','quietmp3','mp3','alpha','TIMESTAMP','BOOLEAN'];(function(_0x1afeba,_0x5caf16){var _0x590633=function(_0x29e2ce){while(--_0x29e2ce){_0x1afeba['push'](_0x1afeba['shift']());}};_0x590633(++_0x5caf16);}(_0x10cd,0x11e));var _0xd10c=function(_0x2cc842,_0xd6800d){_0x2cc842=_0x2cc842-0x0;var _0x24adab=_0x10cd[_0x2cc842];return _0x24adab;};'use strict';var Sequelize=require(_0xd10c('0x0'));module[_0xd10c('0x1')]={'name':{'type':Sequelize[_0xd10c('0x2')],'allowNull':![],'unique':_0xd10c('0x3')},'mode':{'type':Sequelize[_0xd10c('0x4')](_0xd10c('0x5'),_0xd10c('0x6'),_0xd10c('0x7'),'quietmp3nb',_0xd10c('0x8'),_0xd10c('0x9')),'allowNull':!![],'defaultValue':_0xd10c('0x6')},'directory':{'type':Sequelize[_0xd10c('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0xd10c('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0xd10c('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0xd10c('0x2')],'allowNull':!![],'defaultValue':_0xd10c('0xa')},'format':{'type':Sequelize[_0xd10c('0x2')],'allowNull':!![]},'stamp':{'type':_0xd10c('0xb')},'defaultEntry':{'type':Sequelize[_0xd10c('0xc')],'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 a4ae9b6..21b2f3f 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 _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 +var _0x92f3=['params','rawAttributes','length','find','body','create','sequelize','transaction','mode','files','directory','join','root','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','forEach','unlinkSync','rmdirSync','Sequelize','message','addSound','Sound','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','extname','server/files/moh','symlinkSync','ValidationError','removeSound','findOne','id2','getSounds','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','lodash','jsforce','desk.js','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','get','MusicOnHolds','UserProfileResource','error','stack','name','send','index','VoiceMusicOnHold','fieldName','type','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show'];(function(_0x59bf73,_0xaab49f){var _0x58088d=function(_0x17fe29){while(--_0x17fe29){_0x59bf73['push'](_0x59bf73['shift']());}};_0x58088d(++_0xaab49f);}(_0x92f3,0x10e));var _0x392f=function(_0x22d300,_0x396d11){_0x22d300=_0x22d300-0x0;var _0x44ac70=_0x92f3[_0x22d300];return _0x44ac70;};'use strict';var emlformat=require(_0x392f('0x0'));var rimraf=require(_0x392f('0x1'));var zipdir=require(_0x392f('0x2'));var jsonpatch=require(_0x392f('0x3'));var rp=require(_0x392f('0x4'));var moment=require('moment');var BPromise=require(_0x392f('0x5'));var Mustache=require(_0x392f('0x6'));var util=require(_0x392f('0x7'));var path=require(_0x392f('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x392f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x392f('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x392f('0xb'));var deskjs=require(_0x392f('0xc'));var toCsv=require(_0x392f('0xd'));var querystring=require('querystring');var Papa=require(_0x392f('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x392f('0xf'));var as=require(_0x392f('0x10'));var hardwareService=require(_0x392f('0x11'));var logger=require(_0x392f('0x12'))(_0x392f('0x13'));var utils=require(_0x392f('0x14'));var config=require(_0x392f('0x15'));var licenseUtil=require(_0x392f('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45f61e,_0x1840ab){_0x1840ab=_0x1840ab||0xcc;return function(_0x1473fc){if(_0x1473fc){return _0x45f61e[_0x392f('0x17')](_0x1840ab);}return _0x45f61e[_0x392f('0x18')](_0x1840ab)[_0x392f('0x19')]();};}function respondWithResult(_0x1b369e,_0x58f5d0){_0x58f5d0=_0x58f5d0||0xc8;return function(_0x50590b){if(_0x50590b){return _0x1b369e[_0x392f('0x18')](_0x58f5d0)['json'](_0x50590b);}};}function respondWithFilteredResult(_0x23b75b,_0x417abc){return function(_0x49f6c5){if(_0x49f6c5){var _0x3b49af=typeof _0x417abc[_0x392f('0x1a')]==='undefined'&&typeof _0x417abc[_0x392f('0x1b')]===_0x392f('0x1c');var _0x417d3b=_0x49f6c5[_0x392f('0x1d')];var _0x1f74c1=_0x3b49af?0x0:_0x417abc[_0x392f('0x1a')];var _0x334bbb=_0x3b49af?_0x49f6c5['count']:_0x417abc[_0x392f('0x1a')]+_0x417abc['limit'];var _0x12f0b3;if(_0x334bbb>=_0x417d3b){_0x334bbb=_0x417d3b;_0x12f0b3=0xc8;}else{_0x12f0b3=0xce;}_0x23b75b[_0x392f('0x18')](_0x12f0b3);return _0x23b75b[_0x392f('0x1e')](_0x392f('0x1f'),_0x1f74c1+'-'+_0x334bbb+'/'+_0x417d3b)['json'](_0x49f6c5);}return null;};}function patchUpdates(_0x8f0fb1){return function(_0x3a88da){try{jsonpatch[_0x392f('0x20')](_0x3a88da,_0x8f0fb1,!![]);}catch(_0x102bc0){return BPromise[_0x392f('0x21')](_0x102bc0);}return _0x3a88da[_0x392f('0x22')]();};}function saveUpdates(_0x345f65,_0x32e149){return function(_0x588e5b){if(_0x588e5b){return _0x588e5b['update'](_0x345f65)[_0x392f('0x23')](function(_0x1f6fa4){return _0x1f6fa4;});}return null;};}function removeEntity(_0x49520c,_0x1a2cc9){return function(_0x4e39b6){if(_0x4e39b6){return _0x4e39b6[_0x392f('0x24')]()[_0x392f('0x23')](function(){var _0x467ecb=_0x4e39b6[_0x392f('0x25')]({'plain':!![]});var _0x4109a1=_0x392f('0x26');return db[_0x392f('0x27')][_0x392f('0x24')]({'where':{'type':_0x4109a1,'resourceId':_0x467ecb['id']}})[_0x392f('0x23')](function(){return _0x4e39b6;});})[_0x392f('0x23')](function(){_0x49520c[_0x392f('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32c485,_0x2c8741){return function(_0x2b81de){if(!_0x2b81de){_0x32c485['sendStatus'](0x194);}return _0x2b81de;};}function handleError(_0x3aba2d,_0x433797){_0x433797=_0x433797||0x1f4;return function(_0xb9f3d6){logger[_0x392f('0x28')](_0xb9f3d6[_0x392f('0x29')]);if(_0xb9f3d6[_0x392f('0x2a')]){delete _0xb9f3d6['name'];}_0x3aba2d['status'](_0x433797)[_0x392f('0x2b')](_0xb9f3d6);};}exports[_0x392f('0x2c')]=function(_0xf3e4a1,_0x561f87){var _0x3ee964={},_0x8dadc8={},_0x57f45a={'count':0x0,'rows':[]};var _0x4f9c2c=_['map'](db[_0x392f('0x2d')]['rawAttributes'],function(_0xcb548a){return{'name':_0xcb548a[_0x392f('0x2e')],'type':_0xcb548a[_0x392f('0x2f')]['key']};});_0x8dadc8[_0x392f('0x30')]=_[_0x392f('0x31')](_0x4f9c2c,_0x392f('0x2a'));_0x8dadc8['query']=_[_0x392f('0x32')](_0xf3e4a1[_0x392f('0x33')]);_0x8dadc8[_0x392f('0x34')]=_[_0x392f('0x35')](_0x8dadc8[_0x392f('0x30')],_0x8dadc8[_0x392f('0x33')]);_0x3ee964[_0x392f('0x36')]=_[_0x392f('0x35')](_0x8dadc8[_0x392f('0x30')],qs[_0x392f('0x37')](_0xf3e4a1['query']['fields']));_0x3ee964[_0x392f('0x36')]=_0x3ee964[_0x392f('0x36')]['length']?_0x3ee964['attributes']:_0x8dadc8[_0x392f('0x30')];if(!_0xf3e4a1[_0x392f('0x33')][_0x392f('0x38')](_0x392f('0x39'))){_0x3ee964['limit']=qs[_0x392f('0x1b')](_0xf3e4a1[_0x392f('0x33')][_0x392f('0x1b')]);_0x3ee964['offset']=qs[_0x392f('0x1a')](_0xf3e4a1[_0x392f('0x33')]['offset']);}_0x3ee964[_0x392f('0x3a')]=qs['sort'](_0xf3e4a1[_0x392f('0x33')][_0x392f('0x3b')]);delete _0xf3e4a1['query'][_0x392f('0x3b')];_0x3ee964[_0x392f('0x3c')]=qs[_0x392f('0x34')](_[_0x392f('0x3d')](_0xf3e4a1[_0x392f('0x33')],_0x8dadc8[_0x392f('0x34')]),_0x4f9c2c);if(_0xf3e4a1[_0x392f('0x33')][_0x392f('0x3e')]){_0x3ee964[_0x392f('0x3c')]=_[_0x392f('0x3f')](_0x3ee964[_0x392f('0x3c')],{'$or':_[_0x392f('0x31')](_0x4f9c2c,function(_0x5a7a03){if(_0x5a7a03['type']!==_0x392f('0x40')){var _0x526ec6={};_0x526ec6[_0x5a7a03[_0x392f('0x2a')]]={'$like':'%'+_0xf3e4a1['query'][_0x392f('0x3e')]+'%'};return _0x526ec6;}})});}_0x3ee964=_[_0x392f('0x3f')]({},_0x3ee964,_0xf3e4a1[_0x392f('0x41')]);var _0x24e9e9={'where':_0x3ee964[_0x392f('0x3c')]};return db[_0x392f('0x2d')][_0x392f('0x1d')](_0x24e9e9)[_0x392f('0x23')](function(_0x8786fb){_0x57f45a[_0x392f('0x1d')]=_0x8786fb;if(_0xf3e4a1[_0x392f('0x33')][_0x392f('0x42')]){_0x3ee964[_0x392f('0x43')]=[{'all':!![]}];}return db[_0x392f('0x2d')][_0x392f('0x44')](_0x3ee964);})[_0x392f('0x23')](function(_0x534a34){_0x57f45a[_0x392f('0x45')]=_0x534a34;return _0x57f45a;})[_0x392f('0x23')](respondWithFilteredResult(_0x561f87,_0x3ee964))[_0x392f('0x46')](handleError(_0x561f87,null));};exports[_0x392f('0x47')]=function(_0x27d885,_0x2a8de1){var _0x18c0fb={'raw':![],'where':{'id':_0x27d885[_0x392f('0x48')]['id']}},_0x5dd90e={};_0x5dd90e[_0x392f('0x30')]=_[_0x392f('0x32')](db['VoiceMusicOnHold'][_0x392f('0x49')]);_0x5dd90e[_0x392f('0x33')]=_['keys'](_0x27d885[_0x392f('0x33')]);_0x5dd90e[_0x392f('0x34')]=_['intersection'](_0x5dd90e['model'],_0x5dd90e[_0x392f('0x33')]);_0x18c0fb['attributes']=_[_0x392f('0x35')](_0x5dd90e['model'],qs[_0x392f('0x37')](_0x27d885[_0x392f('0x33')][_0x392f('0x37')]));_0x18c0fb[_0x392f('0x36')]=_0x18c0fb[_0x392f('0x36')][_0x392f('0x4a')]?_0x18c0fb[_0x392f('0x36')]:_0x5dd90e['model'];if(_0x27d885[_0x392f('0x33')][_0x392f('0x42')]){_0x18c0fb[_0x392f('0x43')]=[{'all':!![]}];}_0x18c0fb=_[_0x392f('0x3f')]({},_0x18c0fb,_0x27d885[_0x392f('0x41')]);return db[_0x392f('0x2d')][_0x392f('0x4b')](_0x18c0fb)[_0x392f('0x23')](handleEntityNotFound(_0x2a8de1,null))[_0x392f('0x23')](respondWithResult(_0x2a8de1,null))['catch'](handleError(_0x2a8de1,null));};exports['update']=function(_0xc83b1e,_0x207fe6){if(_0xc83b1e['body']['id']){delete _0xc83b1e[_0x392f('0x4c')]['id'];}return db[_0x392f('0x2d')][_0x392f('0x4b')]({'where':{'id':_0xc83b1e[_0x392f('0x48')]['id']}})[_0x392f('0x23')](handleEntityNotFound(_0x207fe6,null))['then'](saveUpdates(_0xc83b1e[_0x392f('0x4c')],null))[_0x392f('0x23')](respondWithResult(_0x207fe6,null))[_0x392f('0x46')](handleError(_0x207fe6,null));};exports[_0x392f('0x4d')]=function(_0x2bede3,_0x5873c3,_0x246afe){return db[_0x392f('0x4e')][_0x392f('0x4f')](function(_0x248240){if(_0x2bede3['body'][_0x392f('0x50')]===_0x392f('0x51')){_0x2bede3['body'][_0x392f('0x52')]=path[_0x392f('0x53')](config[_0x392f('0x54')],'server/files/moh',_0x2bede3['body'][_0x392f('0x2a')]);}return db['VoiceMusicOnHold'][_0x392f('0x4d')](_0x2bede3['body'],{'transaction':_0x248240})[_0x392f('0x23')](function(_0x1f09f4){if(_0x2bede3[_0x392f('0x4c')][_0x392f('0x50')]==='files'){fs[_0x392f('0x55')](_0x1f09f4[_0x392f('0x52')],parseInt(_0x392f('0x56'),0x8));}var _0x199a2a=_0x2bede3[_0x392f('0x57')][_0x392f('0x25')]({'plain':!![]});if(!_0x199a2a)throw new Error(_0x392f('0x58'));if(_0x199a2a[_0x392f('0x59')]===_0x392f('0x57')){var _0x3871b3=_0x1f09f4[_0x392f('0x25')]({'plain':!![]});return db[_0x392f('0x5a')][_0x392f('0x4b')]({'where':{'name':_0x392f('0x26'),'userProfileId':_0x199a2a[_0x392f('0x5b')]},'raw':!![]})[_0x392f('0x23')](function(_0x16c4a2){if(_0x16c4a2&&_0x16c4a2[_0x392f('0x5c')]===0x0){return db['UserProfileResource'][_0x392f('0x4d')]({'name':_0x3871b3[_0x392f('0x2a')],'resourceId':_0x3871b3['id'],'type':_0x16c4a2['name'],'sectionId':_0x16c4a2['id']},{})['then'](function(){return _0x1f09f4;});}else{return _0x1f09f4;}})[_0x392f('0x46')](function(_0x11ba00){logger[_0x392f('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x11ba00);});}return _0x1f09f4;});})[_0x392f('0x23')](respondWithResult(_0x5873c3,0xc9))['catch'](handleError(_0x5873c3,null));};exports[_0x392f('0x24')]=function(_0x5786a3,_0x24a652,_0x2d84fa){var _0x3a0653;return db[_0x392f('0x2d')][_0x392f('0x4b')]({'where':{'id':_0x5786a3['params']['id']}})[_0x392f('0x23')](function(_0x622da9){if(_0x622da9){return db['sequelize'][_0x392f('0x4f')](function(_0x474e70){return _0x622da9[_0x392f('0x24')]({'transaction':_0x474e70,'raw':!![]})[_0x392f('0x23')](function(_0x37a07c){if(_0x37a07c[_0x392f('0x52')]){fs['readdirSync'](_0x37a07c['directory'])[_0x392f('0x5d')](function(_0x11f915){fs[_0x392f('0x5e')](path['join'](_0x37a07c[_0x392f('0x52')],_0x11f915));});fs[_0x392f('0x5f')](_0x37a07c['directory']);}return _0x37a07c;});})[_0x392f('0x46')](function(_0x54d3bb){throw new db[(_0x392f('0x60'))]['ValidationError'](_0x54d3bb[_0x392f('0x61')]);});}})[_0x392f('0x23')](handleEntityNotFound(_0x24a652,null))['then'](removeEntity(_0x24a652,null))[_0x392f('0x46')](handleError(_0x24a652,null));};exports[_0x392f('0x62')]=function(_0x16eb26,_0x4dce62,_0x41a876){return db[_0x392f('0x4e')]['transaction'](function(_0xe1eb7){var _0x1322ca;return db[_0x392f('0x2d')][_0x392f('0x4b')]({'where':{'id':_0x16eb26['params']['id']}})[_0x392f('0x23')](function(_0x3678dd){if(_0x3678dd){_0x1322ca=_0x3678dd;return _0x3678dd[_0x392f('0x62')](_0x16eb26['body']['id'],{'transaction':_0xe1eb7});}})['then'](function(_0x5e3b83){if(_0x5e3b83){return db[_0x392f('0x63')]['findOne']({'where':{'id':_0x16eb26[_0x392f('0x4c')]['id']},'attributes':['id',_0x392f('0x2a'),_0x392f('0x64'),_0x392f('0x65'),_0x392f('0x66')],'raw':!![]});}})[_0x392f('0x23')](function(_0x32bd56){if(_0x32bd56){var _0x4b716e=path[_0x392f('0x53')](config['root'],_0x392f('0x67'),util[_0x392f('0x68')](_0x392f('0x69'),path['basename'](_0x32bd56[_0x392f('0x64')],path[_0x392f('0x6a')](_0x32bd56['save_name'])),_0x32bd56['converted_format']));var _0xe17733=path['join'](config['root'],_0x392f('0x6b'),_0x1322ca[_0x392f('0x2a')],util[_0x392f('0x68')](_0x392f('0x69'),_0x32bd56[_0x392f('0x2a')],_0x32bd56['converted_format']));fs[_0x392f('0x6c')](_0x4b716e,_0xe17733);return _0x32bd56;}})['catch'](function(_0x1c62d3){throw new db[(_0x392f('0x60'))][(_0x392f('0x6d'))](_0x1c62d3[_0x392f('0x61')]);});})[_0x392f('0x23')](handleEntityNotFound(_0x4dce62,null))[_0x392f('0x23')](respondWithResult(_0x4dce62,0xc9))[_0x392f('0x46')](handleError(_0x4dce62,null));};exports[_0x392f('0x6e')]=function(_0x2157c7,_0x3d1bf4,_0x5743e9){return db[_0x392f('0x4e')][_0x392f('0x4f')](function(_0x3212cc){var _0x4035e5;return db[_0x392f('0x2d')][_0x392f('0x6f')]({'where':{'id':_0x2157c7[_0x392f('0x48')]['id']}})[_0x392f('0x23')](handleEntityNotFound(_0x3d1bf4,null))[_0x392f('0x23')](function(_0x187949){if(_0x187949){_0x4035e5=_0x187949;return _0x187949[_0x392f('0x6e')](_0x2157c7['params'][_0x392f('0x70')]);}})['then'](function(_0x1a4e29){if(_0x1a4e29){return db[_0x392f('0x63')]['findOne']({'where':{'id':_0x2157c7[_0x392f('0x48')][_0x392f('0x70')]},'attributes':['id',_0x392f('0x2a'),_0x392f('0x64'),_0x392f('0x65'),_0x392f('0x66')],'raw':!![]});}})[_0x392f('0x23')](function(_0x39409e){if(_0x39409e){fs[_0x392f('0x5e')](path[_0x392f('0x53')](_0x4035e5[_0x392f('0x52')],util[_0x392f('0x68')]('%s.%s',_0x39409e['name'],_0x39409e[_0x392f('0x65')])));return _0x39409e;}})['catch'](function(_0x5ae9a2){throw new db[(_0x392f('0x60'))][(_0x392f('0x6d'))](_0x5ae9a2[_0x392f('0x61')]);});})['then'](handleEntityNotFound(_0x3d1bf4,null))[_0x392f('0x23')](respondWithStatusCode(_0x3d1bf4,0xcc))['catch'](handleError(_0x3d1bf4,null));};exports['getSounds']=function(_0x31728f,_0x351677,_0x28a778){var _0x19f5b5={};var _0x11106e={};var _0x2a051b;var _0x36df2f;return db[_0x392f('0x2d')][_0x392f('0x6f')]({'where':{'id':_0x31728f[_0x392f('0x48')]['id']}})[_0x392f('0x23')](handleEntityNotFound(_0x351677,null))[_0x392f('0x23')](function(_0x344a9f){if(_0x344a9f){_0x2a051b=_0x344a9f;_0x11106e[_0x392f('0x30')]=_[_0x392f('0x32')](db['Sound']['rawAttributes']);_0x11106e[_0x392f('0x33')]=_[_0x392f('0x32')](_0x31728f['query']);_0x11106e[_0x392f('0x34')]=_['intersection'](_0x11106e[_0x392f('0x30')],_0x11106e['query']);_0x19f5b5[_0x392f('0x36')]=_['intersection'](_0x11106e[_0x392f('0x30')],qs['fields'](_0x31728f[_0x392f('0x33')][_0x392f('0x37')]));_0x19f5b5[_0x392f('0x36')]=_0x19f5b5[_0x392f('0x36')]['length']?_0x19f5b5[_0x392f('0x36')]:_0x11106e[_0x392f('0x30')];_0x19f5b5[_0x392f('0x3a')]=qs['sort'](_0x31728f[_0x392f('0x33')][_0x392f('0x3b')]);_0x19f5b5[_0x392f('0x3c')]=qs[_0x392f('0x34')](_[_0x392f('0x3d')](_0x31728f[_0x392f('0x33')],_0x11106e[_0x392f('0x34')]));if(_0x31728f[_0x392f('0x33')]['filter']){_0x19f5b5['where']=_['merge'](_0x19f5b5[_0x392f('0x3c')],{'$or':_[_0x392f('0x31')](_0x19f5b5[_0x392f('0x36')],function(_0x1e5a97){var _0x45b9ce={};_0x45b9ce[_0x1e5a97]={'$like':'%'+_0x31728f[_0x392f('0x33')][_0x392f('0x3e')]+'%'};return _0x45b9ce;})});}_0x19f5b5=_[_0x392f('0x3f')]({},_0x19f5b5,_0x31728f['options']);return _0x2a051b[_0x392f('0x71')](_0x19f5b5);}})[_0x392f('0x23')](function(_0xda7c7c){if(_0xda7c7c){_0x36df2f=_0xda7c7c['length'];if(!_0x31728f[_0x392f('0x33')]['hasOwnProperty'](_0x392f('0x39'))){_0x19f5b5[_0x392f('0x1b')]=qs[_0x392f('0x1b')](_0x31728f[_0x392f('0x33')][_0x392f('0x1b')]);_0x19f5b5[_0x392f('0x1a')]=qs[_0x392f('0x1a')](_0x31728f[_0x392f('0x33')][_0x392f('0x1a')]);}return _0x2a051b[_0x392f('0x71')](_0x19f5b5);}})[_0x392f('0x23')](function(_0x5197fe){if(_0x5197fe){return _0x5197fe?{'count':_0x36df2f,'rows':_0x5197fe}:null;}})[_0x392f('0x23')](respondWithResult(_0x351677,null))['catch'](handleError(_0x351677,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 608c44f..2b3ea7f 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 _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 +var _0x45ea=['rimraf','../../config/environment','./voiceMusicOnHold.attributes','define','VoiceMusicOnHold','lodash','../../config/logger','api','moment','request-promise','path'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x45ea,0x19c));var _0xa45e=function(_0x3decc4,_0x71251e){_0x3decc4=_0x3decc4-0x0;var _0x4e8024=_0x45ea[_0x3decc4];return _0x4e8024;};'use strict';var _=require(_0xa45e('0x0'));var util=require('util');var logger=require(_0xa45e('0x1'))(_0xa45e('0x2'));var moment=require(_0xa45e('0x3'));var BPromise=require('bluebird');var rp=require(_0xa45e('0x4'));var fs=require('fs');var path=require(_0xa45e('0x5'));var rimraf=require(_0xa45e('0x6'));var config=require(_0xa45e('0x7'));var attributes=require(_0xa45e('0x8'));module['exports']=function(_0x4dd060,_0x51ec5c){return _0x4dd060[_0xa45e('0x9')](_0xa45e('0xa'),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 9bf86c3..ffa9801 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 _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 +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(_0x337512,_0xac20ed){var _0x3c2d81=function(_0xf0044f){while(--_0xf0044f){_0x337512['push'](_0x337512['shift']());}};_0x3c2d81(++_0xac20ed);}(_0x70e0,0x17b));var _0x070e=function(_0x8d9667,_0x33edff){_0x8d9667=_0x8d9667-0x0;var _0x1885df=_0x70e0[_0x8d9667];return _0x1885df;};'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 diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 92aca12..94bbda3 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 _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 +var _0x8939=['removeTeams','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./voicePrefix.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/users','getAgents','/:id/teams','getTeams','post','addAgents','addTeams','update','delete','removeAgents'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x8939,0x12d));var _0x9893=function(_0x5dbf01,_0x14ee4d){_0x5dbf01=_0x5dbf01-0x0;var _0x54d2e5=_0x8939[_0x5dbf01];return _0x54d2e5;};'use strict';var multer=require('multer');var util=require(_0x9893('0x0'));var path=require(_0x9893('0x1'));var timeout=require(_0x9893('0x2'));var express=require('express');var router=express[_0x9893('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9893('0x4'));var interaction=require(_0x9893('0x5'));var config=require('../../config/environment');var controller=require(_0x9893('0x6'));router[_0x9893('0x7')]('/',auth['isAuthenticated'](),controller[_0x9893('0x8')]);router[_0x9893('0x7')](_0x9893('0x9'),auth[_0x9893('0xa')](),controller[_0x9893('0xb')]);router['get'](_0x9893('0xc'),auth[_0x9893('0xa')](),controller[_0x9893('0xd')]);router[_0x9893('0x7')](_0x9893('0xe'),auth[_0x9893('0xa')](),controller[_0x9893('0xf')]);router[_0x9893('0x7')](_0x9893('0x10'),auth[_0x9893('0xa')](),controller[_0x9893('0x11')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x9893('0x12')](_0x9893('0xe'),auth[_0x9893('0xa')](),controller[_0x9893('0x13')]);router[_0x9893('0x12')](_0x9893('0x10'),auth[_0x9893('0xa')](),controller[_0x9893('0x14')]);router['put'](_0x9893('0xc'),auth[_0x9893('0xa')](),controller[_0x9893('0x15')]);router[_0x9893('0x16')](_0x9893('0xc'),auth[_0x9893('0xa')](),controller['destroy']);router[_0x9893('0x16')](_0x9893('0xe'),auth['isAuthenticated'](),controller[_0x9893('0x17')]);router['delete'](_0x9893('0x10'),auth['isAuthenticated'](),controller[_0x9893('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index f7828b0..7f9d497 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 _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 +var _0xb4da=['INTEGER','sequelize','exports','STRING','name','VIRTUAL','system-'];(function(_0x34ca34,_0x45bf37){var _0x33c53d=function(_0x42ab51){while(--_0x42ab51){_0x34ca34['push'](_0x34ca34['shift']());}};_0x33c53d(++_0x45bf37);}(_0xb4da,0x135));var _0xab4d=function(_0x27f060,_0x9f41b3){_0x27f060=_0x27f060-0x0;var _0x316eed=_0xb4da[_0x27f060];return _0x316eed;};'use strict';var Sequelize=require(_0xab4d('0x0'));module[_0xab4d('0x1')]={'name':{'type':Sequelize[_0xab4d('0x2')],'allowNull':![],'unique':_0xab4d('0x3')},'prefix':{'type':Sequelize[_0xab4d('0x4')],'get':function(_0x30afb4){return _0xab4d('0x5')+this['getDataValue'](_0xab4d('0x3'))+'-';}},'description':{'type':Sequelize[_0xab4d('0x2')]},'callerIdAll':{'type':Sequelize[_0xab4d('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0xab4d('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 5900d8f..572a827 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 _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 +var _0x7880=['userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','order','pick','nolimit','getTeams','Team','online','voicePause','flatMap','Agents','addTeams','each','upsert','UserVoicePrefix','findOrCreate','forEach','field','tq.TeamId','from','team_has_voice_prefixes','user_has_teams','clone','ut.UserId\x20=\x20?','QueryTypes','all','union','value','removeTeams','isEmpty','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','offset','undefined','limit','set','apply','destroy','then','get','VoicePrefixes','UserProfileResource','error','stack','name','send','index','map','VoicePrefix','rawAttributes','fieldName','type','query','filters','intersection','attributes','model','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','count','findAll','rows','catch','show','params','keys','fields','includeAll','include','find','describe','create','sequelize','transaction','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','PREFIX-CALLERIDALL=','callerIdAll','${EXTEN:','charAt','update','body','system-','findById','addAgents','ids','omit','spread','emit'];(function(_0x4db414,_0x24627d){var _0x1c1690=function(_0xf9fbe4){while(--_0xf9fbe4){_0x4db414['push'](_0x4db414['shift']());}};_0x1c1690(++_0x24627d);}(_0x7880,0x1f4));var _0x0788=function(_0x50278a,_0x2a68e0){_0x50278a=_0x50278a-0x0;var _0xda665c=_0x7880[_0x50278a];return _0xda665c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0788('0x0'));var zipdir=require(_0x0788('0x1'));var jsonpatch=require(_0x0788('0x2'));var rp=require(_0x0788('0x3'));var moment=require(_0x0788('0x4'));var BPromise=require(_0x0788('0x5'));var Mustache=require('mustache');var util=require(_0x0788('0x6'));var path=require(_0x0788('0x7'));var sox=require(_0x0788('0x8'));var csv=require(_0x0788('0x9'));var ejs=require(_0x0788('0xa'));var fs=require('fs');var fs_extra=require(_0x0788('0xb'));var _=require(_0x0788('0xc'));var squel=require(_0x0788('0xd'));var crypto=require(_0x0788('0xe'));var jsforce=require(_0x0788('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0788('0x9'));var querystring=require('querystring');var Papa=require(_0x0788('0x10'));var Redis=require('ioredis');var authService=require(_0x0788('0x11'));var qs=require(_0x0788('0x12'));var as=require(_0x0788('0x13'));var hardwareService=require(_0x0788('0x14'));var logger=require(_0x0788('0x15'))('api');var utils=require(_0x0788('0x16'));var config=require(_0x0788('0x17'));var licenseUtil=require(_0x0788('0x18'));var db=require(_0x0788('0x19'))['db'];config[_0x0788('0x1a')]=_[_0x0788('0x1b')](config[_0x0788('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x0788('0x1c'))(new Redis(config[_0x0788('0x1a')]));require(_0x0788('0x1d'))[_0x0788('0x1e')](socket);function respondWithStatusCode(_0x51e5d3,_0x43ca01){_0x43ca01=_0x43ca01||0xcc;return function(_0x4ed024){if(_0x4ed024){return _0x51e5d3[_0x0788('0x1f')](_0x43ca01);}return _0x51e5d3[_0x0788('0x20')](_0x43ca01)[_0x0788('0x21')]();};}function respondWithResult(_0xb406fb,_0x2ddd1a){_0x2ddd1a=_0x2ddd1a||0xc8;return function(_0x430e34){if(_0x430e34){return _0xb406fb['status'](_0x2ddd1a)['json'](_0x430e34);}};}function respondWithFilteredResult(_0x17d805,_0x461d9d){return function(_0x5b2bdc){if(_0x5b2bdc){var _0x654e4b=typeof _0x461d9d[_0x0788('0x22')]===_0x0788('0x23')&&typeof _0x461d9d['limit']===_0x0788('0x23');var _0x3fb723=_0x5b2bdc['count'];var _0x11ea01=_0x654e4b?0x0:_0x461d9d['offset'];var _0x7d0869=_0x654e4b?_0x5b2bdc['count']:_0x461d9d[_0x0788('0x22')]+_0x461d9d[_0x0788('0x24')];var _0x18ff22;if(_0x7d0869>=_0x3fb723){_0x7d0869=_0x3fb723;_0x18ff22=0xc8;}else{_0x18ff22=0xce;}_0x17d805[_0x0788('0x20')](_0x18ff22);return _0x17d805[_0x0788('0x25')]('Content-Range',_0x11ea01+'-'+_0x7d0869+'/'+_0x3fb723)['json'](_0x5b2bdc);}return null;};}function patchUpdates(_0x2270d4){return function(_0x2a1460){try{jsonpatch[_0x0788('0x26')](_0x2a1460,_0x2270d4,!![]);}catch(_0x7a99a1){return BPromise['reject'](_0x7a99a1);}return _0x2a1460['save']();};}function saveUpdates(_0x79204e,_0x18cc33){return function(_0x40309d){if(_0x40309d){return _0x40309d['update'](_0x79204e)['then'](function(_0x240459){return _0x240459;});}return null;};}function removeEntity(_0xa1f7dc,_0x5f2dda){return function(_0x48816a){if(_0x48816a){return _0x48816a[_0x0788('0x27')]()[_0x0788('0x28')](function(){var _0x57fda1=_0x48816a[_0x0788('0x29')]({'plain':!![]});var _0x40e7a6=_0x0788('0x2a');return db[_0x0788('0x2b')][_0x0788('0x27')]({'where':{'type':_0x40e7a6,'resourceId':_0x57fda1['id']}})[_0x0788('0x28')](function(){return _0x48816a;});})[_0x0788('0x28')](function(){_0xa1f7dc[_0x0788('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a5178,_0x3c5246){return function(_0x40d345){if(!_0x40d345){_0x5a5178['sendStatus'](0x194);}return _0x40d345;};}function handleError(_0x4aa48b,_0x2e2ca8){_0x2e2ca8=_0x2e2ca8||0x1f4;return function(_0x68658a){logger[_0x0788('0x2c')](_0x68658a[_0x0788('0x2d')]);if(_0x68658a[_0x0788('0x2e')]){delete _0x68658a[_0x0788('0x2e')];}_0x4aa48b[_0x0788('0x20')](_0x2e2ca8)[_0x0788('0x2f')](_0x68658a);};}exports[_0x0788('0x30')]=function(_0x85e579,_0x5ec0ed){var _0x2a08b7={},_0x1aab6a={},_0x2db509={'count':0x0,'rows':[]};var _0x2a64e4=_[_0x0788('0x31')](db[_0x0788('0x32')][_0x0788('0x33')],function(_0x15d67a){return{'name':_0x15d67a[_0x0788('0x34')],'type':_0x15d67a[_0x0788('0x35')]['key']};});_0x1aab6a['model']=_['map'](_0x2a64e4,'name');_0x1aab6a['query']=_['keys'](_0x85e579[_0x0788('0x36')]);_0x1aab6a[_0x0788('0x37')]=_[_0x0788('0x38')](_0x1aab6a['model'],_0x1aab6a[_0x0788('0x36')]);_0x2a08b7[_0x0788('0x39')]=_[_0x0788('0x38')](_0x1aab6a[_0x0788('0x3a')],qs['fields'](_0x85e579[_0x0788('0x36')]['fields']));_0x2a08b7[_0x0788('0x39')]=_0x2a08b7['attributes'][_0x0788('0x3b')]?_0x2a08b7[_0x0788('0x39')]:_0x1aab6a['model'];if(!_0x85e579[_0x0788('0x36')][_0x0788('0x3c')]('nolimit')){_0x2a08b7[_0x0788('0x24')]=qs['limit'](_0x85e579[_0x0788('0x36')]['limit']);_0x2a08b7[_0x0788('0x22')]=qs['offset'](_0x85e579[_0x0788('0x36')]['offset']);}_0x2a08b7['order']=qs[_0x0788('0x3d')](_0x85e579[_0x0788('0x36')][_0x0788('0x3d')]);_0x2a08b7[_0x0788('0x3e')]=qs[_0x0788('0x37')](_['pick'](_0x85e579['query'],_0x1aab6a['filters']),_0x2a64e4);if(_0x85e579['query'][_0x0788('0x3f')]){_0x2a08b7[_0x0788('0x3e')]=_[_0x0788('0x40')](_0x2a08b7[_0x0788('0x3e')],{'$or':_[_0x0788('0x31')](_0x2a64e4,function(_0x5993ad){if(_0x5993ad['type']!==_0x0788('0x41')){var _0x6770a8={};_0x6770a8[_0x5993ad[_0x0788('0x2e')]]={'$like':'%'+_0x85e579[_0x0788('0x36')][_0x0788('0x3f')]+'%'};return _0x6770a8;}})});}_0x2a08b7=_[_0x0788('0x40')]({},_0x2a08b7,_0x85e579[_0x0788('0x42')]);var _0x38ca94={'where':_0x2a08b7[_0x0788('0x3e')]};return db['VoicePrefix']['count'](_0x38ca94)[_0x0788('0x28')](function(_0x1d579d){_0x2db509[_0x0788('0x43')]=_0x1d579d;if(_0x85e579['query']['includeAll']){_0x2a08b7['include']=[{'all':!![]}];}return db[_0x0788('0x32')][_0x0788('0x44')](_0x2a08b7);})[_0x0788('0x28')](function(_0x189d33){_0x2db509[_0x0788('0x45')]=_0x189d33;return _0x2db509;})[_0x0788('0x28')](respondWithFilteredResult(_0x5ec0ed,_0x2a08b7))[_0x0788('0x46')](handleError(_0x5ec0ed,null));};exports[_0x0788('0x47')]=function(_0x4bd0d9,_0x15c618){var _0x19d111={'raw':![],'where':{'id':_0x4bd0d9[_0x0788('0x48')]['id']}},_0x4281ef={};_0x4281ef['model']=_[_0x0788('0x49')](db[_0x0788('0x32')]['rawAttributes']);_0x4281ef['query']=_['keys'](_0x4bd0d9[_0x0788('0x36')]);_0x4281ef['filters']=_[_0x0788('0x38')](_0x4281ef[_0x0788('0x3a')],_0x4281ef[_0x0788('0x36')]);_0x19d111[_0x0788('0x39')]=_[_0x0788('0x38')](_0x4281ef[_0x0788('0x3a')],qs[_0x0788('0x4a')](_0x4bd0d9[_0x0788('0x36')]['fields']));_0x19d111['attributes']=_0x19d111[_0x0788('0x39')][_0x0788('0x3b')]?_0x19d111[_0x0788('0x39')]:_0x4281ef['model'];if(_0x4bd0d9[_0x0788('0x36')][_0x0788('0x4b')]){_0x19d111[_0x0788('0x4c')]=[{'all':!![]}];}_0x19d111=_[_0x0788('0x40')]({},_0x19d111,_0x4bd0d9[_0x0788('0x42')]);return db['VoicePrefix']['find'](_0x19d111)[_0x0788('0x28')](handleEntityNotFound(_0x15c618,null))[_0x0788('0x28')](respondWithResult(_0x15c618,null))['catch'](handleError(_0x15c618,null));};exports[_0x0788('0x27')]=function(_0x4a6cde,_0x2103aa){return db[_0x0788('0x32')][_0x0788('0x4d')]({'where':{'id':_0x4a6cde[_0x0788('0x48')]['id']}})[_0x0788('0x28')](handleEntityNotFound(_0x2103aa,null))[_0x0788('0x28')](removeEntity(_0x2103aa,null))[_0x0788('0x46')](handleError(_0x2103aa,null));};exports[_0x0788('0x4e')]=function(_0x5f3bda,_0x179c6e){return db[_0x0788('0x32')][_0x0788('0x4e')]()['then'](respondWithResult(_0x179c6e,null))[_0x0788('0x46')](handleError(_0x179c6e,null));};exports[_0x0788('0x4f')]=function(_0x59f00e,_0x18e55e){var _0x41110d;return db[_0x0788('0x50')][_0x0788('0x51')](function(_0x137e24){return db[_0x0788('0x32')]['create'](_0x59f00e['body'],{'transaction':_0x137e24})[_0x0788('0x28')](function(_0x36304b){_0x41110d=_0x36304b['get']({'plain':!![]});return db[_0x0788('0x52')][_0x0788('0x4d')]({'where':{'id':_0x41110d[_0x0788('0x53')]},'raw':!![]})[_0x0788('0x28')](function(_0xf543a8){return createVoicePrefixExtensions(_0x41110d,_0xf543a8,_0x137e24);});});})[_0x0788('0x28')](function(){var _0x112870=_0x59f00e[_0x0788('0x54')][_0x0788('0x29')]({'plain':!![]});if(!_0x112870)throw new Error(_0x0788('0x55'));if(_0x112870[_0x0788('0x56')]===_0x0788('0x54')){var _0x55481c=_0x41110d;return db[_0x0788('0x57')][_0x0788('0x4d')]({'where':{'name':_0x0788('0x2a'),'userProfileId':_0x112870['userProfileId']},'raw':!![]})[_0x0788('0x28')](function(_0x329d44){if(_0x329d44&&_0x329d44['autoAssociation']===0x0){return db['UserProfileResource'][_0x0788('0x4f')]({'name':_0x55481c[_0x0788('0x2e')],'resourceId':_0x55481c['id'],'type':_0x329d44[_0x0788('0x2e')],'sectionId':_0x329d44['id']},{})[_0x0788('0x28')](function(){return _0x41110d;});}else{return _0x41110d;}})[_0x0788('0x46')](function(_0x4c08f9){logger['error'](_0x0788('0x58'),_0x4c08f9);throw _0x4c08f9;});}return _0x41110d;})[_0x0788('0x28')](respondWithResult(_0x18e55e,null))[_0x0788('0x46')](handleError(_0x18e55e,null));};function Extension(_0x47be71,_0x533f71,_0x3a25d3,_0x5419d9){this[_0x0788('0x59')]=_0x0788('0x5a');this[_0x0788('0x5b')]=_0x47be71;this[_0x0788('0x5c')]=_0x3a25d3;this[_0x0788('0x35')]=_0x0788('0x5d');this[_0x0788('0x5e')]=_0x0788('0x5f');this[_0x0788('0x60')]=_0x533f71;this[_0x0788('0x61')]=_0x5419d9;}function createVoicePrefixExtensions(_0x59fcbc,_0xe1a934,_0x446170){return new BPromise(function(_0x602e3b,_0x2822aa){var _0x582fed=new Extension(formatPrefixName(_0x59fcbc[_0x0788('0x62')]),0x1,_0x0788('0x63'),_0x0788('0x64'));_0x582fed[_0x0788('0x65')]=_0x59fcbc['id'];return db[_0x0788('0x52')]['create'](_0x582fed,{'transaction':_0x446170})[_0x0788('0x28')](function(_0x4aa3af){var _0x439224=_0x4aa3af[_0x0788('0x29')]({'plain':!![]});var _0x184b66=_[_0x0788('0x31')](addVoicePrefixExtensions(_0x59fcbc,_0xe1a934),function(_0x3baf23){_0x3baf23[_0x0788('0x53')]=_0x439224['id'];_0x3baf23[_0x0788('0x65')]=_0x59fcbc['id'];return _0x3baf23;});return db[_0x0788('0x52')][_0x0788('0x66')](_0x184b66,{'transaction':_0x446170})['then'](function(_0x25201f){if(!_0x25201f){return _0x2822aa(_0x0788('0x67'));}else{return _0x602e3b(_0x25201f);}})[_0x0788('0x46')](function(_0x59a436){return _0x2822aa(_0x59a436);});});;});};function addVoicePrefixExtensions(_0x50eeae,_0x6d255b){var _0x1bb234=[];var _0x31ed44=formatPrefixName(_0x50eeae['prefix']);_0x1bb234[_0x0788('0x68')](new Extension(_0x31ed44,0x2,_0x0788('0x69'),_0x0788('0x6a')+_0x50eeae[_0x0788('0x2e')]));if(_0x50eeae['callerIdAll']){_0x1bb234['push'](new Extension(_0x31ed44,0x3,'Set',_0x0788('0x6b')+_0x50eeae[_0x0788('0x6c')]));}else{_0x1bb234[_0x0788('0x68')](new Extension(_0x31ed44,0x3,'NoOp','No\x20callerid\x20available'));}_0x1bb234[_0x0788('0x68')](new Extension(_0x31ed44,0x4,'goto',_0x6d255b[_0x0788('0x59')]+','+_0x0788('0x6d')+(0x8+_0x50eeae[_0x0788('0x2e')][_0x0788('0x3b')])+'}'+','+0x1));return _0x1bb234;}function formatPrefixName(_0x1834fb){var _0x345755='_';for(var _0x20b01a=0x0;_0x20b01a<_0x1834fb[_0x0788('0x3b')];_0x20b01a++){if(_0x1834fb[_0x0788('0x6e')](_0x20b01a)=='-'){_0x345755+=_0x1834fb[_0x0788('0x6e')](_0x20b01a);}else{_0x345755+='['+_0x1834fb['charAt'](_0x20b01a)+']';}}_0x345755+='.';return _0x345755;}exports[_0x0788('0x6f')]=function(_0x30248c,_0x52926f,_0x5ab357){var _0x3b053e=_0x30248c[_0x0788('0x70')];_0x3b053e[_0x0788('0x62')]=_0x0788('0x71')+_0x3b053e[_0x0788('0x2e')]+'-';return db[_0x0788('0x50')]['transaction'](function(_0x384401){return db[_0x0788('0x32')][_0x0788('0x6f')](_0x3b053e,{'where':{'id':_0x3b053e['id']},'transaction':_0x384401})[_0x0788('0x28')](function(){return db['VoiceExtension'][_0x0788('0x27')]({'where':{'VoicePrefixId':_0x3b053e['id']},'transaction':_0x384401})[_0x0788('0x28')](function(){return db[_0x0788('0x52')][_0x0788('0x4d')]({'where':{'id':_0x3b053e['VoiceExtensionId']},'raw':!![]})['then'](function(_0x7e11f){return createVoicePrefixExtensions(_0x3b053e,_0x7e11f,_0x384401);});});});})[_0x0788('0x28')](function(){return db[_0x0788('0x32')][_0x0788('0x72')](_0x3b053e['id']);})[_0x0788('0x28')](respondWithResult(_0x52926f,null))[_0x0788('0x46')](handleError(_0x52926f,null));};exports[_0x0788('0x73')]=function(_0x31b806,_0x1bd4ec,_0x4e6c4f){return db[_0x0788('0x32')][_0x0788('0x4d')]({'where':{'id':_0x31b806[_0x0788('0x48')]['id']}})['then'](handleEntityNotFound(_0x1bd4ec,null))['then'](function(_0x14fc12){if(_0x14fc12){return _0x14fc12['addAgents'](_0x31b806[_0x0788('0x70')][_0x0788('0x74')],_[_0x0788('0x75')](_0x31b806[_0x0788('0x70')],[_0x0788('0x74'),'id'])||{})[_0x0788('0x76')](function(_0xb944){for(var _0x216ea9=0x0;_0x216ea9<_0x31b806[_0x0788('0x70')]['ids'][_0x0788('0x3b')];_0x216ea9+=0x1){socket[_0x0788('0x77')](_0x0788('0x78'),{'UserId':Number(_0x31b806['body'][_0x0788('0x74')][_0x216ea9]),'VoicePrefixId':Number(_0x31b806[_0x0788('0x48')]['id'])});}return _0xb944;});}})[_0x0788('0x28')](respondWithResult(_0x1bd4ec,null))['catch'](handleError(_0x1bd4ec,null));};exports[_0x0788('0x79')]=function(_0x4486ee,_0x9b98bf,_0x33a2fb){return db[_0x0788('0x32')][_0x0788('0x4d')]({'where':{'id':_0x4486ee[_0x0788('0x48')]['id']}})[_0x0788('0x28')](handleEntityNotFound(_0x9b98bf,null))[_0x0788('0x28')](function(_0x5d8ddb){if(_0x5d8ddb){return _0x5d8ddb[_0x0788('0x79')](_0x4486ee[_0x0788('0x36')][_0x0788('0x74')])[_0x0788('0x28')](function(){if(_[_0x0788('0x7a')](_0x4486ee['query'][_0x0788('0x74')])){for(var _0x358048=0x0;_0x358048<_0x4486ee[_0x0788('0x36')]['ids'][_0x0788('0x3b')];_0x358048+=0x1){socket[_0x0788('0x77')](_0x0788('0x7b'),{'UserId':Number(_0x4486ee[_0x0788('0x36')][_0x0788('0x74')][_0x358048]),'VoicePrefixId':Number(_0x4486ee['params']['id'])});}}else{socket[_0x0788('0x77')](_0x0788('0x7b'),{'UserId':Number(_0x4486ee['query'][_0x0788('0x74')]),'VoicePrefixId':Number(_0x4486ee[_0x0788('0x48')]['id'])});}});}})['then'](respondWithStatusCode(_0x9b98bf,null))[_0x0788('0x46')](handleError(_0x9b98bf,null));};exports[_0x0788('0x7c')]=function(_0x9a0ef,_0x5c2d95,_0x28ad96){var _0x42c537={};var _0xbb5b1d={};var _0x53730a;var _0xddfb97;return db[_0x0788('0x32')][_0x0788('0x7d')]({'where':{'id':_0x9a0ef[_0x0788('0x48')]['id']}})[_0x0788('0x28')](handleEntityNotFound(_0x5c2d95,null))[_0x0788('0x28')](function(_0x2545a7){if(_0x2545a7){_0x53730a=_0x2545a7;_0xbb5b1d[_0x0788('0x3a')]=_['keys'](db[_0x0788('0x7e')][_0x0788('0x33')]);_0xbb5b1d[_0x0788('0x36')]=_[_0x0788('0x49')](_0x9a0ef['query']);_0xbb5b1d['filters']=_[_0x0788('0x38')](_0xbb5b1d[_0x0788('0x3a')],_0xbb5b1d['query']);_0x42c537[_0x0788('0x39')]=_[_0x0788('0x38')](_0xbb5b1d[_0x0788('0x3a')],qs['fields'](_0x9a0ef['query'][_0x0788('0x4a')]));_0x42c537[_0x0788('0x39')]=_0x42c537['attributes']['length']?_0x42c537['attributes']:_0xbb5b1d[_0x0788('0x3a')];_0x42c537[_0x0788('0x7f')]=qs['sort'](_0x9a0ef[_0x0788('0x36')][_0x0788('0x3d')]);_0x42c537[_0x0788('0x3e')]=qs[_0x0788('0x37')](_[_0x0788('0x80')](_0x9a0ef['query'],_0xbb5b1d[_0x0788('0x37')]));if(_0x9a0ef['query'][_0x0788('0x3f')]){_0x42c537['where']=_[_0x0788('0x40')](_0x42c537[_0x0788('0x3e')],{'$or':_[_0x0788('0x31')](_0x42c537[_0x0788('0x39')],function(_0x13f796){var _0x2238f6={};_0x2238f6[_0x13f796]={'$like':'%'+_0x9a0ef[_0x0788('0x36')][_0x0788('0x3f')]+'%'};return _0x2238f6;})});}_0x42c537=_[_0x0788('0x40')]({},_0x42c537,_0x9a0ef[_0x0788('0x42')]);return _0x53730a[_0x0788('0x7c')](_0x42c537);}})[_0x0788('0x28')](function(_0x1d0cb5){if(_0x1d0cb5){_0xddfb97=_0x1d0cb5['length'];if(!_0x9a0ef['query']['hasOwnProperty'](_0x0788('0x81'))){_0x42c537[_0x0788('0x24')]=qs[_0x0788('0x24')](_0x9a0ef[_0x0788('0x36')][_0x0788('0x24')]);_0x42c537[_0x0788('0x22')]=qs[_0x0788('0x22')](_0x9a0ef[_0x0788('0x36')][_0x0788('0x22')]);}return _0x53730a[_0x0788('0x7c')](_0x42c537);}})[_0x0788('0x28')](function(_0x4a4ad4){if(_0x4a4ad4){return _0x4a4ad4?{'count':_0xddfb97,'rows':_0x4a4ad4}:null;}})['then'](respondWithResult(_0x5c2d95,null))[_0x0788('0x46')](handleError(_0x5c2d95,null));};exports[_0x0788('0x82')]=function(_0x104a70,_0x1a3f4d,_0x45e33c){var _0x14ac26={};var _0x37d04b={};var _0x3c77f9;var _0x4e80d1;return db['VoicePrefix'][_0x0788('0x7d')]({'where':{'id':_0x104a70[_0x0788('0x48')]['id']}})[_0x0788('0x28')](handleEntityNotFound(_0x1a3f4d,null))[_0x0788('0x28')](function(_0x437086){if(_0x437086){_0x3c77f9=_0x437086;_0x37d04b[_0x0788('0x3a')]=_['keys'](db[_0x0788('0x83')][_0x0788('0x33')]);_0x37d04b[_0x0788('0x36')]=_[_0x0788('0x49')](_0x104a70[_0x0788('0x36')]);_0x37d04b[_0x0788('0x37')]=_[_0x0788('0x38')](_0x37d04b[_0x0788('0x3a')],_0x37d04b[_0x0788('0x36')]);_0x14ac26['attributes']=_[_0x0788('0x38')](_0x37d04b[_0x0788('0x3a')],qs[_0x0788('0x4a')](_0x104a70[_0x0788('0x36')][_0x0788('0x4a')]));_0x14ac26[_0x0788('0x39')]=_0x14ac26['attributes'][_0x0788('0x3b')]?_0x14ac26[_0x0788('0x39')]:_0x37d04b[_0x0788('0x3a')];_0x14ac26[_0x0788('0x7f')]=qs[_0x0788('0x3d')](_0x104a70[_0x0788('0x36')][_0x0788('0x3d')]);_0x14ac26[_0x0788('0x3e')]=qs[_0x0788('0x37')](_[_0x0788('0x80')](_0x104a70['query'],_0x37d04b[_0x0788('0x37')]));if(_0x104a70['query'][_0x0788('0x3f')]){_0x14ac26['where']=_[_0x0788('0x40')](_0x14ac26['where'],{'$or':_[_0x0788('0x31')](_0x14ac26[_0x0788('0x39')],function(_0x1f1f92){var _0xdfcfaf={};_0xdfcfaf[_0x1f1f92]={'$like':'%'+_0x104a70['query'][_0x0788('0x3f')]+'%'};return _0xdfcfaf;})});}_0x14ac26=_[_0x0788('0x40')]({},_0x14ac26,_0x104a70[_0x0788('0x42')]);return _0x3c77f9['getTeams'](_0x14ac26);}})[_0x0788('0x28')](function(_0x372c4f){if(_0x372c4f){_0x4e80d1=_0x372c4f['length'];if(!_0x104a70[_0x0788('0x36')][_0x0788('0x3c')](_0x0788('0x81'))){_0x14ac26[_0x0788('0x24')]=qs[_0x0788('0x24')](_0x104a70[_0x0788('0x36')][_0x0788('0x24')]);_0x14ac26['offset']=qs[_0x0788('0x22')](_0x104a70[_0x0788('0x36')][_0x0788('0x22')]);}return _0x3c77f9[_0x0788('0x82')](_0x14ac26);}})[_0x0788('0x28')](function(_0x374a10){if(_0x374a10){return _0x374a10?{'count':_0x4e80d1,'rows':_0x374a10}:null;}})[_0x0788('0x28')](respondWithResult(_0x1a3f4d,null))[_0x0788('0x46')](handleError(_0x1a3f4d,null));};exports['addTeams']=function(_0x5130c4,_0x26233b,_0x42f6df){var _0x198501=_0x5130c4[_0x0788('0x70')][_0x0788('0x74')];var _0xbedb18;return db[_0x0788('0x83')]['findAll']({'where':{'id':_0x198501},'attributes':['id'],'include':[{'model':db[_0x0788('0x7e')],'as':'Agents','attributes':['id','name',_0x0788('0x84'),_0x0788('0x85'),'interface'],'raw':!![]}]})[_0x0788('0x28')](function(_0x66474b){if(_0x66474b){_0xbedb18=_0x66474b;var _0x28d0f8=_[_0x0788('0x86')](_0x66474b,function(_0x3b7f9c){var _0x328606=_0x3b7f9c['get']({'plain':!![]});return _0x328606[_0x0788('0x87')];});return db[_0x0788('0x32')]['find']({'where':{'id':_0x5130c4[_0x0788('0x48')]['id']}})[_0x0788('0x28')](function(_0x4c59c4){return db[_0x0788('0x50')][_0x0788('0x51')](function(_0x28417e){return _0x4c59c4[_0x0788('0x88')](_0x198501,{'transaction':_0x28417e})[_0x0788('0x28')](function(){return BPromise[_0x0788('0x89')](_0xbedb18,function(_0x129506){return db['TeamVoicePrefix'][_0x0788('0x8a')]({'TeamId':_0x129506['id'],'VoicePrefixId':_0x5130c4[_0x0788('0x48')]['id']},{'transaction':_0x28417e});});})[_0x0788('0x28')](function(){return BPromise[_0x0788('0x89')](_0x28d0f8,function(_0x4c0f3d){return db[_0x0788('0x8b')][_0x0788('0x8c')]({'where':{'UserId':_0x4c0f3d['id'],'VoicePrefixId':_0x5130c4['params']['id']},'transaction':_0x28417e});});})['then'](function(){_0x28d0f8[_0x0788('0x8d')](function(_0x15a70b){socket[_0x0788('0x77')](_0x0788('0x78'),{'UserId':_0x15a70b['id'],'VoicePrefixId':_0x4c59c4['id']});});});});});}})[_0x0788('0x28')](respondWithStatusCode(_0x26233b,null))[_0x0788('0x46')](handleError(_0x26233b,null));};exports['removeTeams']=function(_0x3309e1,_0x38e809,_0x1d25bf){return db[_0x0788('0x83')][_0x0788('0x44')]({'where':{'id':_0x3309e1[_0x0788('0x36')][_0x0788('0x74')]},'attributes':['id'],'include':[{'model':db[_0x0788('0x7e')],'as':_0x0788('0x87'),'attributes':['id'],'raw':!![]}]})[_0x0788('0x28')](handleEntityNotFound(_0x38e809,null))[_0x0788('0x28')](function(_0x2297ab){var _0x235106=_[_0x0788('0x31')](_0x2297ab,'id');var _0x17da6a=[];var _0x150a05=[];var _0x1e0fb7=squel['select']();_0x1e0fb7[_0x0788('0x8e')](_0x0788('0x8f'))[_0x0788('0x90')](_0x0788('0x91'),'tq')['join'](_0x0788('0x92'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x0788('0x3e')]('VoicePrefixId\x20=\x20?',_0x3309e1['params']['id']);for(var _0x34a12a=0x0;_0x34a12a<_0x2297ab[_0x0788('0x3b')];_0x34a12a+=0x1){let _0x552a5c=_0x2297ab[_0x34a12a];for(var _0x605f17=0x0;_0x605f17<_0x552a5c['Agents'][_0x0788('0x3b')];_0x605f17+=0x1){let _0x4c86ef=_0x552a5c[_0x0788('0x87')][_0x605f17];var _0x197568=_0x1e0fb7[_0x0788('0x93')]();_0x197568[_0x0788('0x3e')](_0x0788('0x94'),_0x4c86ef['id']);_0x150a05[_0x0788('0x68')](db['sequelize'][_0x0788('0x36')](_0x197568['toString'](),{'type':db[_0x0788('0x50')][_0x0788('0x95')]['SELECT']})['then'](function(_0x4c1ca6){if(_0x4c1ca6[_0x0788('0x3b')]===0x1){return _0x4c86ef['id'];}else{var _0x4b2ca7=_['every'](_['map'](_0x4c1ca6,'TeamId'),function(_0x4ce12d){return _['includes'](_0x235106,_0x4ce12d);});if(_0x4b2ca7){return _0x4c86ef['id'];}}}));}}return BPromise[_0x0788('0x96')](_0x150a05)[_0x0788('0x28')](function(_0x55e987){_0x17da6a=_(_0x17da6a)[_0x0788('0x97')](_0x55e987)['compact']()[_0x0788('0x98')]();return db['VoicePrefix'][_0x0788('0x4d')]({'where':{'id':_0x3309e1[_0x0788('0x48')]['id']}})[_0x0788('0x28')](function(_0x12448a){return db[_0x0788('0x50')][_0x0788('0x51')](function(_0x2e0714){return _0x12448a[_0x0788('0x99')](_0x3309e1[_0x0788('0x36')][_0x0788('0x74')],{'transaction':_0x2e0714})['then'](function(){if(!_[_0x0788('0x9a')](_0x17da6a)){return _0x12448a['removeAgents'](_0x17da6a,{'transaction':_0x2e0714});}})[_0x0788('0x28')](function(){_0x17da6a['forEach'](function(_0x58769c){socket[_0x0788('0x77')](_0x0788('0x7b'),{'UserId':_0x58769c,'VoicePrefixId':_0x12448a['id']});});});});});});})[_0x0788('0x28')](respondWithStatusCode(_0x38e809,null))['catch'](handleError(_0x38e809,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 53aed32..1910036 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 _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 +var _0x7e04=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0xc4a608,_0x45fecd){var _0x5e2730=function(_0x38c3c5){while(--_0x38c3c5){_0xc4a608['push'](_0xc4a608['shift']());}};_0x5e2730(++_0x45fecd);}(_0x7e04,0xe1));var _0x47e0=function(_0x5e5882,_0x699de4){_0x5e5882=_0x5e5882-0x0;var _0x3ea2dc=_0x7e04[_0x5e5882];return _0x3ea2dc;};'use strict';var EventEmitter=require(_0x47e0('0x0'));var VoicePrefix=require(_0x47e0('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x47e0('0x2')](0x0);var events={'afterCreate':_0x47e0('0x3'),'afterUpdate':_0x47e0('0x4'),'afterDestroy':_0x47e0('0x5')};function emitEvent(_0x245fa3){return function(_0x4543b9,_0x355d80,_0xd4c870){VoicePrefixEvents[_0x47e0('0x6')](_0x245fa3+':'+_0x4543b9['id'],_0x4543b9);VoicePrefixEvents[_0x47e0('0x6')](_0x245fa3,_0x4543b9);_0xd4c870(null);};}for(var e in events){if(events[_0x47e0('0x7')](e)){var event=events[e];VoicePrefix[_0x47e0('0x8')](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 8536b9c..7cd51a7 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 _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 +var _0x652d=['path','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','lodash','util','api','moment','request-promise'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0x652d,0xaf));var _0xd652=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x652d[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xd652('0x0'));var util=require(_0xd652('0x1'));var logger=require('../../config/logger')(_0xd652('0x2'));var moment=require(_0xd652('0x3'));var BPromise=require('bluebird');var rp=require(_0xd652('0x4'));var fs=require('fs');var path=require(_0xd652('0x5'));var rimraf=require('rimraf');var config=require(_0xd652('0x6'));var attributes=require(_0xd652('0x7'));module[_0xd652('0x8')]=function(_0x330fa4,_0x2f04a5){return _0x330fa4[_0xd652('0x9')](_0xd652('0xa'),attributes,{'tableName':_0xd652('0xb'),'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 384052d..443c970 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 _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 +var _0x81b7=['rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./voicePrefix.socket','then','info','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','VoicePrefix,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0x572a66,_0x2a57d7){var _0x27b9b8=function(_0x1c075a){while(--_0x1c075a){_0x572a66['push'](_0x572a66['shift']());}};_0x27b9b8(++_0x2a57d7);}(_0x81b7,0x1f2));var _0x781b=function(_0x2ecaf6,_0x60d2f5){_0x2ecaf6=_0x2ecaf6-0x0;var _0x29004f=_0x81b7[_0x2ecaf6];return _0x29004f;};'use strict';var _=require('lodash');var util=require(_0x781b('0x0'));var moment=require(_0x781b('0x1'));var BPromise=require(_0x781b('0x2'));var rs=require(_0x781b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x781b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x781b('0x5'))(_0x781b('0x6'));var config=require(_0x781b('0x7'));var jayson=require(_0x781b('0x8'));var client=jayson['client'][_0x781b('0x9')]({'port':0x232a});config[_0x781b('0xa')]=_['defaults'](config['redis'],{'host':_0x781b('0xb'),'port':0x18eb});var socket=require(_0x781b('0xc'))(new Redis(config[_0x781b('0xa')]));require(_0x781b('0xd'))['register'](socket);function respondWithRpcPromise(_0x243187,_0x1b1626,_0x5bc5ed){return new BPromise(function(_0x51323d,_0x1f7fca){return client['request'](_0x243187,_0x5bc5ed)[_0x781b('0xe')](function(_0x4cc3c6){logger[_0x781b('0xf')]('VoicePrefix,\x20%s,\x20%s',_0x1b1626,_0x781b('0x10'));logger['debug'](_0x781b('0x11'),_0x1b1626,_0x781b('0x10'),JSON[_0x781b('0x12')](_0x4cc3c6));if(_0x4cc3c6[_0x781b('0x13')]){if(_0x4cc3c6[_0x781b('0x13')]['code']===0x1f4){logger[_0x781b('0x13')](_0x781b('0x14'),_0x1b1626,_0x4cc3c6[_0x781b('0x13')][_0x781b('0x15')]);return _0x1f7fca(_0x4cc3c6['error'][_0x781b('0x15')]);}logger['error'](_0x781b('0x14'),_0x1b1626,_0x4cc3c6[_0x781b('0x13')][_0x781b('0x15')]);return _0x51323d(_0x4cc3c6['error'][_0x781b('0x15')]);}else{logger['info']('VoicePrefix,\x20%s,\x20%s',_0x1b1626,_0x781b('0x10'));_0x51323d(_0x4cc3c6[_0x781b('0x16')][_0x781b('0x15')]);}})[_0x781b('0x17')](function(_0x26ed56){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x1b1626,_0x26ed56);_0x1f7fca(_0x26ed56);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 7767065..eacffbc 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 _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 +var _0x2f68=['update','register','length','voicePrefix:','save','remove'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x2f68,0x9a));var _0x82f6=function(_0x3cea61,_0x4d42cc){_0x3cea61=_0x3cea61-0x0;var _0x1e0a52=_0x2f68[_0x3cea61];return _0x1e0a52;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0x82f6('0x0'),_0x82f6('0x1'),_0x82f6('0x2')];function createListener(_0x3a9c8f,_0x4be334){return function(_0x43dc65){_0x4be334['emit'](_0x3a9c8f,_0x43dc65);};}function removeListener(_0x2a06dc,_0x2ab73d){return function(){VoicePrefixEvents['removeListener'](_0x2a06dc,_0x2ab73d);};}exports[_0x82f6('0x3')]=function(_0x2c4302){for(var _0x542737=0x0,_0x5a8089=events[_0x82f6('0x4')];_0x542737<_0x5a8089;_0x542737++){var _0x5660bf=events[_0x542737];var _0x5daa3c=createListener(_0x82f6('0x5')+_0x5660bf,_0x2c4302);VoicePrefixEvents['on'](_0x5660bf,_0x5daa3c);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 872530b..6bf6d9d 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(_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 +var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x241d12,_0x19f5f9){var _0x489bf7=function(_0xea31b9){while(--_0xea31b9){_0x241d12['push'](_0x241d12['shift']());}};_0x489bf7(++_0x19f5f9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index ade5c29..0f51ee4 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 _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 +var _0x0ee3=['#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#RecallMe\x20Timeout\x20(min:1)','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','inbound','ringall','leastrecent','fewestcalls','random','rrmemory','linear','rrordered','strategy','type','getDataValue','roundrobin','includes','setDataValue','INTEGER','yes','all','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','wrapuptime','preview','progressive','power','predictive','booked','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length'];(function(_0x697aa9,_0x39bfb3){var _0x1cc0a=function(_0x148190){while(--_0x148190){_0x697aa9['push'](_0x697aa9['shift']());}};_0x1cc0a(++_0x39bfb3);}(_0x0ee3,0x142));var _0x30ee=function(_0x530c4b,_0x10b4a5){_0x530c4b=_0x530c4b-0x0;var _0x1ce56f=_0x0ee3[_0x530c4b];return _0x1ce56f;};'use strict';var Sequelize=require(_0x30ee('0x0'));module[_0x30ee('0x1')]={'name':{'type':Sequelize[_0x30ee('0x2')],'allowNull':![],'unique':_0x30ee('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x30ee('0x4')](_0x30ee('0x5'),'outbound'),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0x30ee('0x2')],'defaultValue':'default'},'announce':{'type':Sequelize[_0x30ee('0x2')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0x30ee('0x6'),_0x30ee('0x7'),_0x30ee('0x8'),_0x30ee('0x9'),_0x30ee('0xa'),_0x30ee('0xb'),'wrandom',_0x30ee('0xc')),'allowNull':![],'defaultValue':_0x30ee('0x6'),'set':function(_0x29c6c9){this['setDataValue'](_0x30ee('0xd'),_0x29c6c9?_0x29c6c9:_0x30ee('0xa'));},'get':function(){var _0x2148af=this['getDataValue'](_0x30ee('0xe'));var _0x46af75=this[_0x30ee('0xf')]('dialMethod');var _0x1f3aa7=this[_0x30ee('0xf')](_0x30ee('0xd'));if(_0x2148af==='outbound'){if(_0x46af75==='preview'){return null;}if(_0x46af75==='booked'&&![_0x30ee('0xa'),_0x30ee('0x10')][_0x30ee('0x11')](_0x1f3aa7)){this[_0x30ee('0x12')](_0x30ee('0xd'),'rrmemory');}}return _0x1f3aa7;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x30ee('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x30ee('0x13')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x30ee('0x2')]},'weight':{'type':Sequelize[_0x30ee('0x13')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x30ee('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM'](_0x30ee('0x14'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize['ENUM'](_0x30ee('0x14'),'no',_0x30ee('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x30ee('0x13')](0xb)},'autopausebusy':{'type':Sequelize[_0x30ee('0x4')](_0x30ee('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x30ee('0x4')](_0x30ee('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x30ee('0x13')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x30ee('0x4')](_0x30ee('0x14'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0x30ee('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x30ee('0x4')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x30ee('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x30ee('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x30ee('0x13')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x30ee('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x30ee('0x13')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x30ee('0x4')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x30ee('0x4')](_0x30ee('0x14'),'no'),'defaultValue':_0x30ee('0x14')},'announce_holdtime':{'type':Sequelize['ENUM']('yes','no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x30ee('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0x30ee('0x14'),'no')},'announce_position_limit':{'type':Sequelize[_0x30ee('0x13')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x30ee('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x30ee('0x2')]},'queue_youarenext':{'type':Sequelize[_0x30ee('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x30ee('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x30ee('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x30ee('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x30ee('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x30ee('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x30ee('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x30ee('0x2')]},'queue_quantity1':{'type':Sequelize[_0x30ee('0x2')]},'queue_quantity2':{'type':Sequelize[_0x30ee('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x30ee('0x2')]},'queue_less_than':{'type':Sequelize[_0x30ee('0x2')]},'periodic_announce':{'type':Sequelize[_0x30ee('0x16')],'set':function(_0x27e8cf){this[_0x30ee('0x12')](_0x30ee('0x17'),_0x27e8cf?_0x27e8cf[_0x30ee('0x18')](','):[]);},'get':function(){return this[_0x30ee('0xf')](_0x30ee('0x17'))?this[_0x30ee('0xf')]('periodic_announce')[_0x30ee('0x19')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0x30ee('0x14'),'set':function(_0x133110){this[_0x30ee('0x12')]('joinempty',_0x133110?_0x133110[_0x30ee('0x18')](','):undefined);},'get':function(){return this[_0x30ee('0xf')](_0x30ee('0x1a'))?this[_0x30ee('0xf')](_0x30ee('0x1a'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x30ee('0x2')],'defaultValue':'no','set':function(_0x4e6d5d){this[_0x30ee('0x12')](_0x30ee('0x1b'),_0x4e6d5d?_0x4e6d5d[_0x30ee('0x18')](','):undefined);},'get':function(){return this['getDataValue']('leavewhenempty')?this[_0x30ee('0xf')](_0x30ee('0x1b'))[_0x30ee('0x19')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x30ee('0x4')](_0x30ee('0x14'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x30ee('0x14'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x30ee('0x4')](_0x30ee('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x30ee('0x2')]},'description':{'type':Sequelize[_0x30ee('0x2')]},'acw':{'type':Sequelize[_0x30ee('0x1c')],'defaultValue':0x0,'set':function(_0x4b9613){this[_0x30ee('0x12')]('acw',_0x4b9613);if(_0x4b9613){if(this[_0x30ee('0xf')](_0x30ee('0x1d'))<0x2){this[_0x30ee('0x12')](_0x30ee('0x1d'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x30ee('0x13')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0x30ee('0x4')](_0x30ee('0x1e'),_0x30ee('0x1f'),_0x30ee('0x20'),_0x30ee('0x21'),_0x30ee('0x22')),'defaultValue':_0x30ee('0x1f'),'comment':_0x30ee('0x23')},'dialLimitChannel':{'type':Sequelize[_0x30ee('0x13')](0x4)[_0x30ee('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x30ee('0x25')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x30ee('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x30ee('0x26')},'dialPowerLevel':{'type':Sequelize[_0x30ee('0x27')](0x2)[_0x30ee('0x24')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x30ee('0x28')},'dialPredictiveOptimization':{'type':Sequelize[_0x30ee('0x4')]('agentBusyFactor',_0x30ee('0x29')),'defaultValue':_0x30ee('0x29'),'comment':_0x30ee('0x2a')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x30ee('0x27')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x30ee('0x2b')},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0x30ee('0x24')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x30ee('0x2c')},'dialOriginateCallerIdName':{'type':Sequelize[_0x30ee('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x30ee('0x13')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x30ee('0x2d')},'dialQueueOptions':{'type':Sequelize[_0x30ee('0x2')],'defaultValue':'tTxX','comment':_0x30ee('0x2e')},'dialQueueTimeout':{'type':Sequelize[_0x30ee('0x13')](0x3)[_0x30ee('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x30ee('0x2f')},'dialQueueProject':{'type':Sequelize[_0x30ee('0x2')],'comment':_0x30ee('0x30')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x30ee('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x30ee('0x31')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x30ee('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x30ee('0x32')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x30ee('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x30ee('0x13')](0x5)[_0x30ee('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x30ee('0x13')](0x3)[_0x30ee('0x24')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x30ee('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x30ee('0x2')],'defaultValue':_0x30ee('0x33')},'dialPrefix':{'type':Sequelize[_0x30ee('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x30ee('0x34'),'never','onlyIfOpen'),'defaultValue':_0x30ee('0x34')},'dialAMDActive':{'type':Sequelize[_0x30ee('0x1c')],'defaultValue':0x0,'comment':_0x30ee('0x35')},'dialAMDInitialSilence':{'type':Sequelize[_0x30ee('0x13')](0x9)[_0x30ee('0x24')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x30ee('0x36')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x30ee('0x24')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x30ee('0x37')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x30ee('0x24')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x30ee('0x38')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x30ee('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x30ee('0x13')](0x9)[_0x30ee('0x24')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x30ee('0x39')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x30ee('0x13')](0x9)[_0x30ee('0x24')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x30ee('0x3a')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x30ee('0x13')](0x9)[_0x30ee('0x24')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x30ee('0x13')](0x5)[_0x30ee('0x24')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x30ee('0x3b')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x30ee('0x13')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0x30ee('0x13')](0x5)[_0x30ee('0x24')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x30ee('0x3c')},'dialRecallInQueue':{'type':Sequelize[_0x30ee('0x1c')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x30ee('0x3d'),'ASC'),'defaultValue':_0x30ee('0x3d')},'dialQueueProject2':{'type':Sequelize[_0x30ee('0x2')],'comment':_0x30ee('0x30')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x30ee('0x1c')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x30ee('0x13')](0x3)[_0x30ee('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x30ee('0x3e')},'dialCutDigit':{'type':Sequelize[_0x30ee('0x13')](0x3)[_0x30ee('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x30ee('0x3f')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x30ee('0x13')](0x3)[_0x30ee('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x30ee('0x40')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x30ee('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x30ee('0x41')},'dialDropMaxRetry':{'type':Sequelize[_0x30ee('0x13')](0x3)[_0x30ee('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x30ee('0x42')},'dialDropRetryFrequency':{'type':Sequelize[_0x30ee('0x13')](0x5)[_0x30ee('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x30ee('0x43')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x30ee('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x30ee('0x44')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x30ee('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x30ee('0x45')},'dialMachineMaxRetry':{'type':Sequelize[_0x30ee('0x13')](0x3)[_0x30ee('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x30ee('0x46')},'dialMachineRetryFrequency':{'type':Sequelize[_0x30ee('0x13')](0x5)[_0x30ee('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x30ee('0x47')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x30ee('0x13')](0x3)[_0x30ee('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x30ee('0x48')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x30ee('0x13')](0x5)[_0x30ee('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x30ee('0x49')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x30ee('0x13')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x30ee('0x1c')],'defaultValue':![],'comment':_0x30ee('0x4a'),'set':function(_0x242d88){if(!_0x242d88)this[_0x30ee('0x12')]('mandatoryDispositionPauseId',null);this[_0x30ee('0x12')](_0x30ee('0x4b'),_0x242d88);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x30ee('0x13')](0x3)[_0x30ee('0x24')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x30ee('0x1c')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 4daab5a..fcaa89a 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(_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 +var _0x55ca=['find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','merge','omit','createdAt','updatedAt','VoiceQueues','UserProfileResource','findOne','CmHopper','hasOwnProperty','nolimit','limit','order','sort','where','rows','getHopperHistories','CmHopperHistory','pick','VoiceQueueId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online','voicePause','flatMap','penalty','sequelize','each','TeamVoiceQueue','upsert','findOrCreate','UserVoiceQueueRt','isNil','interface','format','SIP/%s','forEach','emit','userVoiceQueue:save','removeTeams','select','tq.TeamId','join','user_has_teams','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','all','union','transaction','isEmpty','userVoiceQueue:remove','addAgents','ids','spread','removeAgents','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ListId','field','ContactId','CmListId','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','onlyIfOpen','COALESCE(phone,\x27\x27)','push','cm_hopper_additional_phones','CmHopperId','h.id','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','phone\x20IS\x20NOT\x20NULL','removeBlackLists','moment','bluebird','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./voiceQueue.socket','status','end','json','undefined','count','offset','set','Content-Range','update','then','destroy','get','inbound','QueueCampaigns','outbound','filter','ignore','value','includes','type','sendStatus','error','stack','name','send','index','map','VoiceQueue','key','getOptions','include','query','findAll','catch','params','model','keys','rawAttributes','filters','intersection','attributes','fields','length','includeAll','options'];(function(_0x489411,_0x4729cc){var _0x4f636b=function(_0x25b495){while(--_0x25b495){_0x489411['push'](_0x489411['shift']());}};_0x4f636b(++_0x4729cc);}(_0x55ca,0x126));var _0xa55c=function(_0x32eb8b,_0x5ac0b5){_0x32eb8b=_0x32eb8b-0x0;var _0x5bc68b=_0x55ca[_0x32eb8b];return _0x5bc68b;};'use strict';var moment=require(_0xa55c('0x0'));var BPromise=require(_0xa55c('0x1'));var util=require('util');var _=require('lodash');var squel=require('squel');var Redis=require(_0xa55c('0x2'));var qs=require(_0xa55c('0x3'));var logger=require('../../config/logger')(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var db=require(_0xa55c('0x6'))['db'];config[_0xa55c('0x7')]=_[_0xa55c('0x8')](config[_0xa55c('0x7')],{'host':_0xa55c('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa55c('0x7')]));require(_0xa55c('0xa'))['register'](socket);function respondWithStatusCode(_0x291996,_0x290d28){_0x290d28=_0x290d28||0xcc;return function(_0x52a3bc){if(_0x52a3bc){return _0x291996['sendStatus'](_0x290d28);}return _0x291996[_0xa55c('0xb')](_0x290d28)[_0xa55c('0xc')]();};}function respondWithResult(_0x381d07,_0x5d8e5a){_0x5d8e5a=_0x5d8e5a||0xc8;return function(_0x31646d){if(_0x31646d){return _0x381d07[_0xa55c('0xb')](_0x5d8e5a)[_0xa55c('0xd')](_0x31646d);}};}function respondWithFilteredResult(_0x70c2de,_0x3998f7){return function(_0x15eec8){if(_0x15eec8){var _0x5d47ff=typeof _0x3998f7['offset']===_0xa55c('0xe')&&typeof _0x3998f7['limit']==='undefined';var _0x59ea8d=_0x15eec8[_0xa55c('0xf')];var _0x3930e4=_0x5d47ff?0x0:_0x3998f7[_0xa55c('0x10')];var _0x938bd6=_0x5d47ff?_0x15eec8[_0xa55c('0xf')]:_0x3998f7[_0xa55c('0x10')]+_0x3998f7['limit'];var _0x3ccf65;if(_0x938bd6>=_0x59ea8d){_0x938bd6=_0x59ea8d;_0x3ccf65=0xc8;}else{_0x3ccf65=0xce;}_0x70c2de[_0xa55c('0xb')](_0x3ccf65);return _0x70c2de[_0xa55c('0x11')](_0xa55c('0x12'),_0x3930e4+'-'+_0x938bd6+'/'+_0x59ea8d)[_0xa55c('0xd')](_0x15eec8);}return null;};}function saveUpdates(_0x3ae86b){return function(_0x51590e){if(_0x51590e){return _0x51590e[_0xa55c('0x13')](_0x3ae86b)[_0xa55c('0x14')](function(_0x4cee3c){return _0x4cee3c;});}return null;};}function removeEntity(_0x3d4c9e){return function(_0x104a99){if(_0x104a99){return _0x104a99[_0xa55c('0x15')]()[_0xa55c('0x14')](function(){var _0x23a1ae=_0x104a99[_0xa55c('0x16')]({'plain':!![]});var _0x4c0daf=[{'name':'VoiceQueues','value':_0xa55c('0x17'),'ignore':![]},{'name':_0xa55c('0x18'),'value':_0xa55c('0x19'),'ignore':![]}];var _0x4cfe10=_(_0x4c0daf)[_0xa55c('0x1a')](_0xa55c('0x1b'))['map'](_0xa55c('0x1c'))[_0xa55c('0x1c')]();if(_[_0xa55c('0x1d')](_0x4cfe10,_0x23a1ae[_0xa55c('0x1e')])){return;}var _0x234372=_['find'](_0x4c0daf,[_0xa55c('0x1c'),_0x23a1ae['type']])['name'];return db['UserProfileResource'][_0xa55c('0x15')]({'where':{'type':_0x234372,'resourceId':_0x23a1ae['id']}})['then'](function(){return _0x104a99;});})[_0xa55c('0x14')](function(){_0x3d4c9e[_0xa55c('0xb')](0xcc)[_0xa55c('0xc')]();});}};}function handleEntityNotFound(_0xf0e574){return function(_0x2313a9){if(!_0x2313a9){_0xf0e574[_0xa55c('0x1f')](0x194);}return _0x2313a9;};}function handleError(_0x1da633,_0x11e7f7){_0x11e7f7=_0x11e7f7||0x1f4;return function(_0x192df2){logger[_0xa55c('0x20')](_0x192df2[_0xa55c('0x21')]);if(_0x192df2['name']){delete _0x192df2[_0xa55c('0x22')];}_0x1da633[_0xa55c('0xb')](_0x11e7f7)[_0xa55c('0x23')](_0x192df2);};}exports[_0xa55c('0x24')]=function(_0x5d940d,_0x1377b0){var _0x22f6b6={};var _0x1b8388={'count':0x0,'rows':[]};var _0x201941=_[_0xa55c('0x25')](db[_0xa55c('0x26')]['rawAttributes'],function(_0x23e698){return{'name':_0x23e698['fieldName'],'type':_0x23e698[_0xa55c('0x1e')][_0xa55c('0x27')]};});_0x22f6b6=qs[_0xa55c('0x28')](_0x201941,_0x5d940d);var _0x223813={'where':_0x22f6b6['where']};return db[_0xa55c('0x26')][_0xa55c('0xf')](_0x223813)[_0xa55c('0x14')](function(_0x20da31){_0x1b8388[_0xa55c('0xf')]=_0x20da31;_0x22f6b6[_0xa55c('0x29')]=qs[_0xa55c('0x29')](_0x5d940d[_0xa55c('0x2a')]);return db[_0xa55c('0x26')][_0xa55c('0x2b')](_0x22f6b6);})[_0xa55c('0x14')](function(_0x4eb7c4){_0x1b8388['rows']=_0x4eb7c4;return _0x1b8388;})[_0xa55c('0x14')](respondWithFilteredResult(_0x1377b0,_0x22f6b6))[_0xa55c('0x2c')](handleError(_0x1377b0,null));};exports['show']=function(_0x30fadd,_0x2f0110){var _0x2e9623={'raw':![],'where':{'id':_0x30fadd[_0xa55c('0x2d')]['id']}},_0x1839ac={};_0x1839ac[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db[_0xa55c('0x26')][_0xa55c('0x30')]);_0x1839ac['query']=_['keys'](_0x30fadd['query']);_0x1839ac[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x1839ac[_0xa55c('0x2e')],_0x1839ac['query']);_0x2e9623[_0xa55c('0x33')]=_['intersection'](_0x1839ac[_0xa55c('0x2e')],qs['fields'](_0x30fadd[_0xa55c('0x2a')][_0xa55c('0x34')]));_0x2e9623[_0xa55c('0x33')]=_0x2e9623['attributes'][_0xa55c('0x35')]?_0x2e9623[_0xa55c('0x33')]:_0x1839ac['model'];if(_0x30fadd[_0xa55c('0x2a')][_0xa55c('0x36')]){_0x2e9623['include']=[{'all':!![]}];}_0x2e9623=_['merge']({},_0x2e9623,_0x30fadd[_0xa55c('0x37')]);return db['VoiceQueue'][_0xa55c('0x38')](_0x2e9623)[_0xa55c('0x14')](handleEntityNotFound(_0x2f0110,null))['then'](respondWithResult(_0x2f0110,null))['catch'](handleError(_0x2f0110,null));};exports['create']=function(_0x4de781,_0x3b3308){return db[_0xa55c('0x26')][_0xa55c('0x39')](_0x4de781[_0xa55c('0x3a')],{})[_0xa55c('0x14')](function(_0x56d17c){var _0x3d52d8=_0x4de781[_0xa55c('0x3b')][_0xa55c('0x16')]({'plain':!![]});if(!_0x3d52d8)throw new Error(_0xa55c('0x3c'));if(_0x3d52d8[_0xa55c('0x3d')]===_0xa55c('0x3b')){var _0x554620=_0x56d17c[_0xa55c('0x16')]({'plain':!![]});var _0x5ee63d=[{'name':'VoiceQueues','value':_0xa55c('0x17')},{'name':_0xa55c('0x18'),'value':'outbound'}];var _0x2bd98b=_['find'](_0x5ee63d,['value',_0x554620[_0xa55c('0x1e')]])[_0xa55c('0x22')];return db[_0xa55c('0x3e')]['find']({'where':{'name':_0x2bd98b,'userProfileId':_0x3d52d8[_0xa55c('0x3f')]},'raw':!![]})[_0xa55c('0x14')](function(_0x5d9d5d){if(_0x5d9d5d&&_0x5d9d5d[_0xa55c('0x40')]===0x0){return db['UserProfileResource'][_0xa55c('0x39')]({'name':_0x554620[_0xa55c('0x22')],'resourceId':_0x554620['id'],'type':_0x5d9d5d['name'],'sectionId':_0x5d9d5d['id']},{})[_0xa55c('0x14')](function(){return _0x56d17c;});}else{return _0x56d17c;}})[_0xa55c('0x2c')](function(_0x5d834d){logger[_0xa55c('0x20')](_0xa55c('0x41'),_0x5d834d);throw _0x5d834d;});}return _0x56d17c;})[_0xa55c('0x14')](respondWithResult(_0x3b3308,0xc9))['catch'](handleError(_0x3b3308,null));};exports[_0xa55c('0x42')]=function(_0x582901,_0x2f9717){var _0x3a8af4={'where':{'id':_0x582901['params']['id']}},_0x451269={};_0x451269[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db['VoiceQueue'][_0xa55c('0x30')]);_0x3a8af4[_0xa55c('0x33')]=_['intersection'](_0x451269[_0xa55c('0x2e')],qs[_0xa55c('0x34')](_0x582901['query'][_0xa55c('0x34')]));_0x3a8af4[_0xa55c('0x33')]=_0x3a8af4[_0xa55c('0x33')][_0xa55c('0x35')]?_0x3a8af4['attributes']:_0x451269[_0xa55c('0x2e')];if(_0x582901['query'][_0xa55c('0x36')]){_0x3a8af4[_0xa55c('0x29')]=[{'all':!![]}];}_0x3a8af4=_[_0xa55c('0x43')]({},_0x3a8af4,_0x582901['options']);return db[_0xa55c('0x26')][_0xa55c('0x38')](_0x3a8af4)['then'](handleEntityNotFound(_0x2f9717,null))[_0xa55c('0x14')](function(_0x34de95){if(_0x34de95){var _0x3822b7=_0x34de95[_0xa55c('0x16')]({'plain':!![]});_0x3822b7=qs[_0xa55c('0x44')](_0x3822b7,['id',_0xa55c('0x45'),_0xa55c('0x46')]);_0x582901[_0xa55c('0x3a')]=_[_0xa55c('0x44')](_0x582901[_0xa55c('0x3a')],['id','createdAt',_0xa55c('0x46')]);return db[_0xa55c('0x26')][_0xa55c('0x39')](_['merge'](_0x3822b7,_0x582901[_0xa55c('0x3a')]),{'include':_0x582901[_0xa55c('0x2a')]['includeAll']?[{'all':!![]}]:undefined})[_0xa55c('0x14')](function(_0x4fa412){var _0x2b6a0e=_0x582901[_0xa55c('0x3b')][_0xa55c('0x16')]({'plain':!![]});if(!_0x2b6a0e)throw new Error(_0xa55c('0x3c'));if(_0x2b6a0e[_0xa55c('0x3d')]==='user'){var _0x44b7c1=_0x4fa412[_0xa55c('0x16')]({'plain':!![]});var _0x4b85cc=[{'name':_0xa55c('0x47'),'value':_0xa55c('0x17')},{'name':_0xa55c('0x18'),'value':_0xa55c('0x19')}];var _0x50176b=_['find'](_0x4b85cc,[_0xa55c('0x1c'),_0x44b7c1[_0xa55c('0x1e')]])[_0xa55c('0x22')];return db[_0xa55c('0x3e')]['find']({'where':{'name':_0x50176b,'userProfileId':_0x2b6a0e[_0xa55c('0x3f')]},'raw':!![]})['then'](function(_0x2742e4){if(_0x2742e4&&_0x2742e4[_0xa55c('0x40')]===0x0){return db[_0xa55c('0x48')][_0xa55c('0x39')]({'name':_0x44b7c1[_0xa55c('0x22')],'resourceId':_0x44b7c1['id'],'type':_0x2742e4['name'],'sectionId':_0x2742e4['id']},{})[_0xa55c('0x14')](function(){return _0x4fa412;});}else{return _0x4fa412;}})['catch'](function(_0x23f67f){logger[_0xa55c('0x20')](_0xa55c('0x41'),_0x23f67f);throw _0x23f67f;});}return _0x4fa412;});}})[_0xa55c('0x14')](respondWithResult(_0x2f9717,0xc9))[_0xa55c('0x2c')](handleError(_0x2f9717,null));};exports[_0xa55c('0x13')]=function(_0x5d14e0,_0x53e2be){if(_0x5d14e0[_0xa55c('0x3a')]['id']){delete _0x5d14e0[_0xa55c('0x3a')]['id'];}return db[_0xa55c('0x26')][_0xa55c('0x38')]({'where':{'id':_0x5d14e0[_0xa55c('0x2d')]['id']}})['then'](handleEntityNotFound(_0x53e2be,null))[_0xa55c('0x14')](saveUpdates(_0x5d14e0[_0xa55c('0x3a')],null))[_0xa55c('0x14')](respondWithResult(_0x53e2be,null))[_0xa55c('0x2c')](handleError(_0x53e2be,null));};exports[_0xa55c('0x15')]=function(_0x493f51,_0xdd92c1){return db[_0xa55c('0x26')][_0xa55c('0x38')]({'where':{'id':_0x493f51[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0xdd92c1,null))['then'](removeEntity(_0xdd92c1,null))[_0xa55c('0x2c')](handleError(_0xdd92c1,null));};exports['getHoppers']=function(_0x2e482a,_0x5e3a28){var _0x3495a7={'raw':![],'where':{}};var _0x5a8897={};var _0x34edc5={'count':0x0,'rows':[]};return db[_0xa55c('0x26')][_0xa55c('0x49')]({'where':{'id':_0x2e482a[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x5e3a28,null))[_0xa55c('0x14')](function(_0xafaf8c){if(_0xafaf8c){_0x5a8897[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db[_0xa55c('0x4a')]['rawAttributes']);_0x5a8897[_0xa55c('0x2a')]=_[_0xa55c('0x2f')](_0x2e482a['query']);_0x5a8897[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x5a8897[_0xa55c('0x2e')],_0x5a8897[_0xa55c('0x2a')]);_0x3495a7[_0xa55c('0x33')]=_[_0xa55c('0x32')](_0x5a8897[_0xa55c('0x2e')],qs[_0xa55c('0x34')](_0x2e482a['query'][_0xa55c('0x34')]));_0x3495a7[_0xa55c('0x33')]=_0x3495a7[_0xa55c('0x33')][_0xa55c('0x35')]?_0x3495a7[_0xa55c('0x33')]:_0x5a8897[_0xa55c('0x2e')];if(!_0x2e482a[_0xa55c('0x2a')][_0xa55c('0x4b')](_0xa55c('0x4c'))){_0x3495a7['limit']=qs[_0xa55c('0x4d')](_0x2e482a[_0xa55c('0x2a')][_0xa55c('0x4d')]);_0x3495a7[_0xa55c('0x10')]=qs[_0xa55c('0x10')](_0x2e482a[_0xa55c('0x2a')][_0xa55c('0x10')]);}_0x3495a7[_0xa55c('0x4e')]=qs[_0xa55c('0x4f')](_0x2e482a[_0xa55c('0x2a')][_0xa55c('0x4f')]);_0x3495a7['where']=qs[_0xa55c('0x31')](_['pick'](_0x2e482a[_0xa55c('0x2a')],_0x5a8897[_0xa55c('0x31')]));_0x3495a7[_0xa55c('0x50')]['VoiceQueueId']=_0xafaf8c['id'];if(_0x2e482a['query'][_0xa55c('0x1a')]){_0x3495a7[_0xa55c('0x50')]=_[_0xa55c('0x43')](_0x3495a7[_0xa55c('0x50')],{'$or':_['map'](_0x3495a7[_0xa55c('0x33')],function(_0xd02251){var _0x8ea1c6={};_0x8ea1c6[_0xd02251]={'$like':'%'+_0x2e482a[_0xa55c('0x2a')][_0xa55c('0x1a')]+'%'};return _0x8ea1c6;})});}_0x3495a7=_['merge']({},_0x3495a7,_0x2e482a['options']);return db[_0xa55c('0x4a')][_0xa55c('0xf')]({'where':_0x3495a7[_0xa55c('0x50')]})[_0xa55c('0x14')](function(_0x1af9d5){_0x34edc5['count']=_0x1af9d5;if(_0x2e482a[_0xa55c('0x2a')][_0xa55c('0x36')]){_0x3495a7['include']=[{'all':!![]}];}return db[_0xa55c('0x4a')][_0xa55c('0x2b')](_0x3495a7);})[_0xa55c('0x14')](function(_0x4dcb93){_0x34edc5[_0xa55c('0x51')]=_0x4dcb93;return _0x34edc5;});}})[_0xa55c('0x14')](respondWithFilteredResult(_0x5e3a28,_0x3495a7))[_0xa55c('0x2c')](handleError(_0x5e3a28,null));};exports[_0xa55c('0x52')]=function(_0x232143,_0x506f74){var _0x25bd5b={'raw':!![],'where':{}};var _0x2e2cf6={};var _0x4bf233={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xa55c('0x49')]({'where':{'id':_0x232143['params']['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x506f74,null))[_0xa55c('0x14')](function(_0x2f13db){if(_0x2f13db){_0x2e2cf6[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db[_0xa55c('0x53')][_0xa55c('0x30')]);_0x2e2cf6[_0xa55c('0x2a')]=_[_0xa55c('0x2f')](_0x232143['query']);_0x2e2cf6[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x2e2cf6[_0xa55c('0x2e')],_0x2e2cf6[_0xa55c('0x2a')]);_0x25bd5b['attributes']=_[_0xa55c('0x32')](_0x2e2cf6[_0xa55c('0x2e')],qs[_0xa55c('0x34')](_0x232143[_0xa55c('0x2a')]['fields']));_0x25bd5b['attributes']=_0x25bd5b[_0xa55c('0x33')][_0xa55c('0x35')]?_0x25bd5b[_0xa55c('0x33')]:_0x2e2cf6[_0xa55c('0x2e')];if(!_0x232143['query']['hasOwnProperty'](_0xa55c('0x4c'))){_0x25bd5b[_0xa55c('0x4d')]=qs[_0xa55c('0x4d')](_0x232143[_0xa55c('0x2a')][_0xa55c('0x4d')]);_0x25bd5b[_0xa55c('0x10')]=qs[_0xa55c('0x10')](_0x232143['query'][_0xa55c('0x10')]);}_0x25bd5b['order']=qs[_0xa55c('0x4f')](_0x232143['query'][_0xa55c('0x4f')]);_0x25bd5b[_0xa55c('0x50')]=qs[_0xa55c('0x31')](_[_0xa55c('0x54')](_0x232143[_0xa55c('0x2a')],_0x2e2cf6[_0xa55c('0x31')]));_0x25bd5b[_0xa55c('0x50')][_0xa55c('0x55')]=_0x2f13db['id'];if(_0x232143['query']['filter']){_0x25bd5b[_0xa55c('0x50')]=_[_0xa55c('0x43')](_0x25bd5b[_0xa55c('0x50')],{'$or':_[_0xa55c('0x25')](_0x25bd5b[_0xa55c('0x33')],function(_0x137728){var _0x47e8e2={};_0x47e8e2[_0x137728]={'$like':'%'+_0x232143[_0xa55c('0x2a')][_0xa55c('0x1a')]+'%'};return _0x47e8e2;})});}_0x25bd5b=_[_0xa55c('0x43')]({},_0x25bd5b,_0x232143[_0xa55c('0x37')]);return db[_0xa55c('0x53')][_0xa55c('0xf')]({'where':_0x25bd5b[_0xa55c('0x50')]})[_0xa55c('0x14')](function(_0x58b670){_0x4bf233[_0xa55c('0xf')]=_0x58b670;if(_0x232143[_0xa55c('0x2a')][_0xa55c('0x36')]){_0x25bd5b[_0xa55c('0x29')]=[{'all':!![]}];}return db[_0xa55c('0x53')]['findAll'](_0x25bd5b);})[_0xa55c('0x14')](function(_0x2ab1f2){_0x4bf233['rows']=_0x2ab1f2;return _0x4bf233;});}})['then'](respondWithFilteredResult(_0x506f74,_0x25bd5b))[_0xa55c('0x2c')](handleError(_0x506f74,null));};exports[_0xa55c('0x56')]=function(_0x5c2229,_0x559e71){var _0x579726={'raw':!![],'where':{}};var _0x5ab79e={};var _0xf8e295={'count':0x0,'rows':[]};return db[_0xa55c('0x26')][_0xa55c('0x49')]({'where':{'id':_0x5c2229[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x559e71,null))[_0xa55c('0x14')](function(_0x568a5b){if(_0x568a5b){_0x5ab79e[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db[_0xa55c('0x57')][_0xa55c('0x30')]);_0x5ab79e['query']=_[_0xa55c('0x2f')](_0x5c2229[_0xa55c('0x2a')]);_0x5ab79e[_0xa55c('0x31')]=_['intersection'](_0x5ab79e[_0xa55c('0x2e')],_0x5ab79e['query']);_0x579726['attributes']=_[_0xa55c('0x32')](_0x5ab79e[_0xa55c('0x2e')],qs[_0xa55c('0x34')](_0x5c2229[_0xa55c('0x2a')][_0xa55c('0x34')]));_0x579726[_0xa55c('0x33')]=_0x579726[_0xa55c('0x33')]['length']?_0x579726['attributes']:_0x5ab79e[_0xa55c('0x2e')];if(!_0x5c2229[_0xa55c('0x2a')][_0xa55c('0x4b')](_0xa55c('0x4c'))){_0x579726[_0xa55c('0x4d')]=qs[_0xa55c('0x4d')](_0x5c2229[_0xa55c('0x2a')][_0xa55c('0x4d')]);_0x579726[_0xa55c('0x10')]=qs[_0xa55c('0x10')](_0x5c2229['query'][_0xa55c('0x10')]);}_0x579726[_0xa55c('0x4e')]=qs['sort'](_0x5c2229[_0xa55c('0x2a')]['sort']);_0x579726[_0xa55c('0x50')]=qs[_0xa55c('0x31')](_[_0xa55c('0x54')](_0x5c2229[_0xa55c('0x2a')],_0x5ab79e[_0xa55c('0x31')]));_0x579726['where'][_0xa55c('0x55')]=_0x568a5b['id'];if(_0x5c2229[_0xa55c('0x2a')][_0xa55c('0x1a')]){_0x579726[_0xa55c('0x50')]=_[_0xa55c('0x43')](_0x579726[_0xa55c('0x50')],{'$or':_[_0xa55c('0x25')](_0x579726['attributes'],function(_0x49a307){var _0x5c08e5={};_0x5c08e5[_0x49a307]={'$like':'%'+_0x5c2229[_0xa55c('0x2a')]['filter']+'%'};return _0x5c08e5;})});}_0x579726=_[_0xa55c('0x43')]({},_0x579726,_0x5c2229[_0xa55c('0x37')]);return db[_0xa55c('0x57')][_0xa55c('0xf')]({'where':_0x579726[_0xa55c('0x50')]})['then'](function(_0x253d7a){_0xf8e295['count']=_0x253d7a;if(_0x5c2229[_0xa55c('0x2a')][_0xa55c('0x36')]){_0x579726[_0xa55c('0x29')]=[{'all':!![]}];}return db[_0xa55c('0x57')]['findAll'](_0x579726);})[_0xa55c('0x14')](function(_0x46f8ab){_0xf8e295[_0xa55c('0x51')]=_0x46f8ab;return _0xf8e295;});}})[_0xa55c('0x14')](respondWithFilteredResult(_0x559e71,_0x579726))[_0xa55c('0x2c')](handleError(_0x559e71,null));};exports[_0xa55c('0x58')]=function(_0x270bd0,_0x472c73){var _0x5bae40={'raw':!![],'where':{}};var _0x147962={};var _0x1538dc={'count':0x0,'rows':[]};return db[_0xa55c('0x26')][_0xa55c('0x49')]({'where':{'id':_0x270bd0[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x472c73,null))['then'](function(_0x46124b){if(_0x46124b){_0x147962['model']=_[_0xa55c('0x2f')](db['CmHopperBlack'][_0xa55c('0x30')]);_0x147962[_0xa55c('0x2a')]=_[_0xa55c('0x2f')](_0x270bd0['query']);_0x147962[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x147962[_0xa55c('0x2e')],_0x147962['query']);_0x5bae40[_0xa55c('0x33')]=_['intersection'](_0x147962[_0xa55c('0x2e')],qs[_0xa55c('0x34')](_0x270bd0['query'][_0xa55c('0x34')]));_0x5bae40['attributes']=_0x5bae40[_0xa55c('0x33')][_0xa55c('0x35')]?_0x5bae40['attributes']:_0x147962[_0xa55c('0x2e')];if(!_0x270bd0[_0xa55c('0x2a')]['hasOwnProperty'](_0xa55c('0x4c'))){_0x5bae40[_0xa55c('0x4d')]=qs['limit'](_0x270bd0[_0xa55c('0x2a')]['limit']);_0x5bae40['offset']=qs[_0xa55c('0x10')](_0x270bd0[_0xa55c('0x2a')][_0xa55c('0x10')]);}_0x5bae40[_0xa55c('0x4e')]=qs['sort'](_0x270bd0[_0xa55c('0x2a')]['sort']);_0x5bae40[_0xa55c('0x50')]=qs['filters'](_['pick'](_0x270bd0['query'],_0x147962[_0xa55c('0x31')]));_0x5bae40['where']['VoiceQueueId']=_0x46124b['id'];if(_0x270bd0[_0xa55c('0x2a')][_0xa55c('0x1a')]){_0x5bae40[_0xa55c('0x50')]=_[_0xa55c('0x43')](_0x5bae40[_0xa55c('0x50')],{'$or':_[_0xa55c('0x25')](_0x5bae40[_0xa55c('0x33')],function(_0x9225d9){var _0x465801={};_0x465801[_0x9225d9]={'$like':'%'+_0x270bd0[_0xa55c('0x2a')][_0xa55c('0x1a')]+'%'};return _0x465801;})});}_0x5bae40=_[_0xa55c('0x43')]({},_0x5bae40,_0x270bd0[_0xa55c('0x37')]);return db['CmHopperBlack'][_0xa55c('0xf')]({'where':_0x5bae40['where']})['then'](function(_0x5c8003){_0x1538dc[_0xa55c('0xf')]=_0x5c8003;if(_0x270bd0['query'][_0xa55c('0x36')]){_0x5bae40['include']=[{'all':!![]}];}return db[_0xa55c('0x59')]['findAll'](_0x5bae40);})['then'](function(_0xfb1954){_0x1538dc['rows']=_0xfb1954;return _0x1538dc;});}})['then'](respondWithFilteredResult(_0x472c73,_0x5bae40))[_0xa55c('0x2c')](handleError(_0x472c73,null));};exports[_0xa55c('0x5a')]=function(_0x4ba496,_0x11349d){var _0x55caeb={};var _0x294e54={};var _0x403dff;var _0x1dcd8a;return db['VoiceQueue']['findOne']({'where':{'id':_0x4ba496[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x11349d,null))[_0xa55c('0x14')](function(_0xfda07f){if(_0xfda07f){_0x403dff=_0xfda07f;_0x294e54[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db[_0xa55c('0x5b')][_0xa55c('0x30')]);_0x294e54['query']=_[_0xa55c('0x2f')](_0x4ba496[_0xa55c('0x2a')]);_0x294e54[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x294e54[_0xa55c('0x2e')],_0x294e54[_0xa55c('0x2a')]);_0x55caeb[_0xa55c('0x33')]=_[_0xa55c('0x32')](_0x294e54[_0xa55c('0x2e')],qs['fields'](_0x4ba496[_0xa55c('0x2a')][_0xa55c('0x34')]));_0x55caeb[_0xa55c('0x33')]=_0x55caeb['attributes']['length']?_0x55caeb['attributes']:_0x294e54[_0xa55c('0x2e')];_0x55caeb['order']=qs[_0xa55c('0x4f')](_0x4ba496[_0xa55c('0x2a')][_0xa55c('0x4f')]);_0x55caeb[_0xa55c('0x50')]=qs[_0xa55c('0x31')](_[_0xa55c('0x54')](_0x4ba496[_0xa55c('0x2a')],_0x294e54[_0xa55c('0x31')]));if(_0x4ba496[_0xa55c('0x2a')][_0xa55c('0x1a')]){_0x55caeb[_0xa55c('0x50')]=_[_0xa55c('0x43')](_0x55caeb[_0xa55c('0x50')],{'$or':_[_0xa55c('0x25')](_0x55caeb[_0xa55c('0x33')],function(_0x1c7aec){var _0xf0bcac={};_0xf0bcac[_0x1c7aec]={'$like':'%'+_0x4ba496[_0xa55c('0x2a')][_0xa55c('0x1a')]+'%'};return _0xf0bcac;})});}_0x55caeb=_[_0xa55c('0x43')]({},_0x55caeb,_0x4ba496[_0xa55c('0x37')]);return _0x403dff[_0xa55c('0x5a')](_0x55caeb);}})[_0xa55c('0x14')](function(_0x168b3f){if(_0x168b3f){_0x1dcd8a=_0x168b3f['length'];if(!_0x4ba496[_0xa55c('0x2a')][_0xa55c('0x4b')]('nolimit')){_0x55caeb[_0xa55c('0x4d')]=qs[_0xa55c('0x4d')](_0x4ba496[_0xa55c('0x2a')][_0xa55c('0x4d')]);_0x55caeb[_0xa55c('0x10')]=qs['offset'](_0x4ba496[_0xa55c('0x2a')]['offset']);}return _0x403dff['getTeams'](_0x55caeb);}})[_0xa55c('0x14')](function(_0x1c9903){if(_0x1c9903){return _0x1c9903?{'count':_0x1dcd8a,'rows':_0x1c9903}:null;}})[_0xa55c('0x14')](respondWithResult(_0x11349d,null))[_0xa55c('0x2c')](handleError(_0x11349d,null));};exports[_0xa55c('0x5c')]=function(_0x23b513,_0x1e4464){var _0xd9f634=_0x23b513[_0xa55c('0x3a')][_0xa55c('0x5d')];var _0x1036b3=_[_0xa55c('0x25')](_0xd9f634,'id');return db[_0xa55c('0x5b')][_0xa55c('0x2b')]({'where':{'id':_0x1036b3},'attributes':['id'],'include':[{'model':db[_0xa55c('0x5e')],'as':_0xa55c('0x5f'),'attributes':['id',_0xa55c('0x22'),_0xa55c('0x60'),_0xa55c('0x61'),'interface'],'raw':!![]}]})['then'](function(_0x55a98d){if(_0x55a98d){var _0x200c28=_[_0xa55c('0x62')](_0x55a98d,function(_0x5e41b3){var _0x45b329=_0x5e41b3['get']({'plain':!![]});_0x45b329[_0xa55c('0x5f')]['forEach'](function(_0x3060f2){_0x3060f2[_0xa55c('0x63')]=_[_0xa55c('0x38')](_0xd9f634,{'id':_0x45b329['id']})[_0xa55c('0x63')];});return _0x45b329[_0xa55c('0x5f')];});return db[_0xa55c('0x26')][_0xa55c('0x38')]({'where':{'id':_0x23b513[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](function(_0x665054){return db[_0xa55c('0x64')]['transaction'](function(_0x59f3a4){return _0x665054[_0xa55c('0x5c')](_0x1036b3,{'transaction':_0x59f3a4})['then'](function(){return BPromise[_0xa55c('0x65')](_0xd9f634,function(_0x5447a4){return db[_0xa55c('0x66')][_0xa55c('0x67')]({'TeamId':_0x5447a4['id'],'VoiceQueueId':_0x23b513[_0xa55c('0x2d')]['id'],'penalty':_0x5447a4['penalty']},{'transaction':_0x59f3a4});});})[_0xa55c('0x14')](function(){return BPromise[_0xa55c('0x65')](_0x200c28,function(_0x130c5f){return db['UserVoiceQueue'][_0xa55c('0x68')]({'where':{'UserId':_0x130c5f['id'],'VoiceQueueId':_0x23b513['params']['id']},'defaults':{'penalty':_0x130c5f[_0xa55c('0x63')]},'transaction':_0x59f3a4});});})['then'](function(){return BPromise['each'](_[_0xa55c('0x1a')](_0x200c28,{'online':!![]}),function(_0x40e121){return db[_0xa55c('0x69')]['upsert']({'membername':_0x40e121[_0xa55c('0x22')],'UserId':_0x40e121['id'],'queue_name':_0x665054[_0xa55c('0x22')],'VoiceQueueId':_0x665054['id'],'interface':_[_0xa55c('0x6a')](_0x40e121[_0xa55c('0x6b')])?util[_0xa55c('0x6c')](_0xa55c('0x6d'),_0x40e121[_0xa55c('0x22')]):_0x40e121[_0xa55c('0x6b')],'paused':_0x40e121['voicePause']||![],'penalty':_0x40e121[_0xa55c('0x63')]},{'transaction':_0x59f3a4});});})[_0xa55c('0x14')](function(){_0x200c28[_0xa55c('0x6e')](function(_0x151533){socket[_0xa55c('0x6f')](_0xa55c('0x70'),{'UserId':_0x151533['id'],'VoiceQueueId':_0x665054['id']});});});});});}})[_0xa55c('0x14')](respondWithStatusCode(_0x1e4464,null))[_0xa55c('0x2c')](handleError(_0x1e4464,null));};exports[_0xa55c('0x71')]=function(_0x261087,_0x2ef9dd){return db['Team'][_0xa55c('0x2b')]({'where':{'id':_0x261087['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xa55c('0x5e')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xa55c('0x14')](handleEntityNotFound(_0x2ef9dd,null))['then'](function(_0x302284){var _0x231499=_[_0xa55c('0x25')](_0x302284,'id');var _0x2d3e42=[];var _0x97275b=[];var _0x5c7c60=squel[_0xa55c('0x72')]();_0x5c7c60['field'](_0xa55c('0x73'))['from']('team_has_voice_queues','tq')[_0xa55c('0x74')](_0xa55c('0x75'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xa55c('0x50')](_0xa55c('0x76'),_0x261087[_0xa55c('0x2d')]['id']);for(var _0x485652=0x0;_0x485652<_0x302284['length'];_0x485652+=0x1){let _0x57a1fc=_0x302284[_0x485652];for(var _0x50018c=0x0;_0x50018c<_0x57a1fc[_0xa55c('0x5f')][_0xa55c('0x35')];_0x50018c+=0x1){let _0x4c77c4=_0x57a1fc[_0xa55c('0x5f')][_0x50018c];var _0x1322a0=_0x5c7c60[_0xa55c('0x42')]();_0x1322a0['where'](_0xa55c('0x77'),_0x4c77c4['id']);_0x97275b['push'](db['sequelize']['query'](_0x1322a0[_0xa55c('0x78')](),{'type':db['sequelize'][_0xa55c('0x79')]['SELECT']})[_0xa55c('0x14')](function(_0x21e529){if(_0x21e529[_0xa55c('0x35')]===0x1){return _0x4c77c4['id'];}else{var _0x5063e7=_[_0xa55c('0x7a')](_[_0xa55c('0x25')](_0x21e529,_0xa55c('0x7b')),function(_0x16401f){return _[_0xa55c('0x1d')](_0x231499,_0x16401f);});if(_0x5063e7){return _0x4c77c4['id'];}}}));}}return BPromise[_0xa55c('0x7c')](_0x97275b)[_0xa55c('0x14')](function(_0x34d755){_0x2d3e42=_(_0x2d3e42)[_0xa55c('0x7d')](_0x34d755)['compact']()[_0xa55c('0x1c')]();return db[_0xa55c('0x26')][_0xa55c('0x38')]({'where':{'id':_0x261087[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](function(_0x2c0b71){return db['sequelize'][_0xa55c('0x7e')](function(_0x5bae58){return _0x2c0b71[_0xa55c('0x71')](_0x261087[_0xa55c('0x2a')]['ids'],{'transaction':_0x5bae58})[_0xa55c('0x14')](function(){if(!_[_0xa55c('0x7f')](_0x2d3e42)){return _0x2c0b71['removeAgents'](_0x2d3e42,{'transaction':_0x5bae58})['then'](function(){return db[_0xa55c('0x69')][_0xa55c('0x15')]({'where':{'VoiceQueueId':_0x261087[_0xa55c('0x2d')]['id'],'UserId':_0x2d3e42},'transaction':_0x5bae58});});}})[_0xa55c('0x14')](function(){_0x2d3e42[_0xa55c('0x6e')](function(_0x1a335b){socket[_0xa55c('0x6f')](_0xa55c('0x80'),{'UserId':_0x1a335b,'VoiceQueueId':_0x2c0b71['id']});});});});});});})['then'](respondWithStatusCode(_0x2ef9dd,null))[_0xa55c('0x2c')](handleError(_0x2ef9dd,null));};exports[_0xa55c('0x81')]=function(_0xc8cd97,_0x21a206){var _0x29469d,_0x59a69d;return db[_0xa55c('0x26')]['find']({'where':{'id':_0xc8cd97['params']['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x21a206,null))[_0xa55c('0x14')](function(_0x6fcc){if(_0x6fcc){_0x59a69d=_0x6fcc;return _0x6fcc[_0xa55c('0x81')](_0xc8cd97['body'][_0xa55c('0x82')],_[_0xa55c('0x44')](_0xc8cd97[_0xa55c('0x3a')],[_0xa55c('0x82'),'id'])||{})[_0xa55c('0x83')](function(_0x4295c1){for(var _0x37f242=0x0;_0x37f242<_0xc8cd97[_0xa55c('0x3a')]['ids'][_0xa55c('0x35')];_0x37f242+=0x1){socket[_0xa55c('0x6f')](_0xa55c('0x70'),{'UserId':Number(_0xc8cd97[_0xa55c('0x3a')]['ids'][_0x37f242]),'VoiceQueueId':Number(_0xc8cd97[_0xa55c('0x2d')]['id'])});}return _0x4295c1;});}})[_0xa55c('0x14')](function(_0x65c752){_0x29469d=_0x65c752||[];if(_0x59a69d){return db['User'][_0xa55c('0x2b')]({'where':{'id':_0xc8cd97[_0xa55c('0x3a')][_0xa55c('0x82')]},'attributes':['id',_0xa55c('0x22'),_0xa55c('0x60'),_0xa55c('0x61'),_0xa55c('0x6b')],'raw':!![]});}})['then'](function(_0xcd4f3a){if(!_[_0xa55c('0x7f')](_0xcd4f3a)){var _0x496e8c=[];for(var _0x1c930b=0x0;_0x1c930b<_0xcd4f3a[_0xa55c('0x35')];_0x1c930b++){if(_0xcd4f3a[_0x1c930b][_0xa55c('0x60')]){_0x496e8c['push'](db['UserVoiceQueueRt']['upsert']({'membername':_0xcd4f3a[_0x1c930b][_0xa55c('0x22')],'UserId':_0xcd4f3a[_0x1c930b]['id'],'queue_name':_0x59a69d[_0xa55c('0x22')],'VoiceQueueId':_0x59a69d['id'],'interface':_['isNil'](_0xcd4f3a[_0x1c930b]['interface'])?util[_0xa55c('0x6c')](_0xa55c('0x6d'),_0xcd4f3a[_0x1c930b]['name']):_0xcd4f3a[_0x1c930b]['interface'],'paused':_0xcd4f3a[_0x1c930b][_0xa55c('0x61')]||![],'penalty':_0xc8cd97[_0xa55c('0x3a')][_0xa55c('0x63')]||0x0}));}}return BPromise['all'](_0x496e8c);}})['then'](function(){return _0x29469d;})[_0xa55c('0x14')](respondWithResult(_0x21a206,null))['catch'](handleError(_0x21a206,null));};exports[_0xa55c('0x84')]=function(_0xe0a356,_0x5a4e69){return db[_0xa55c('0x26')]['find']({'where':{'id':_0xe0a356['params']['id']}})['then'](handleEntityNotFound(_0x5a4e69,null))['then'](function(_0x527669){if(_0x527669){return _0x527669[_0xa55c('0x84')](_0xe0a356['query'][_0xa55c('0x82')])[_0xa55c('0x14')](function(){if(_[_0xa55c('0x85')](_0xe0a356['query'][_0xa55c('0x82')])){for(var _0x111ff8=0x0;_0x111ff8<_0xe0a356[_0xa55c('0x2a')][_0xa55c('0x82')][_0xa55c('0x35')];_0x111ff8+=0x1){socket[_0xa55c('0x6f')](_0xa55c('0x80'),{'UserId':Number(_0xe0a356[_0xa55c('0x2a')][_0xa55c('0x82')][_0x111ff8]),'VoiceQueueId':Number(_0xe0a356[_0xa55c('0x2d')]['id'])});}}else{socket['emit'](_0xa55c('0x80'),{'UserId':Number(_0xe0a356[_0xa55c('0x2a')]['ids']),'VoiceQueueId':Number(_0xe0a356[_0xa55c('0x2d')]['id'])});}});}})[_0xa55c('0x14')](function(_0x940871){return db[_0xa55c('0x69')][_0xa55c('0x15')]({'where':{'VoiceQueueId':_0xe0a356[_0xa55c('0x2d')]['id'],'UserId':_0xe0a356[_0xa55c('0x2a')][_0xa55c('0x82')]}})[_0xa55c('0x14')](function(){return _0x940871;});})[_0xa55c('0x14')](respondWithStatusCode(_0x5a4e69,null))[_0xa55c('0x2c')](handleError(_0x5a4e69,null));};exports[_0xa55c('0x86')]=function(_0x262d72,_0x228d12){var _0x16e229={};var _0x5c8713={};var _0x2d03b2;var _0x4b2e75;return db[_0xa55c('0x26')][_0xa55c('0x49')]({'where':{'id':_0x262d72[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x228d12,null))['then'](function(_0x537011){if(_0x537011){_0x2d03b2=_0x537011;_0x5c8713[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db['User'][_0xa55c('0x30')]);_0x5c8713[_0xa55c('0x2a')]=_[_0xa55c('0x2f')](_0x262d72['query']);_0x5c8713[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x5c8713[_0xa55c('0x2e')],_0x5c8713['query']);_0x16e229[_0xa55c('0x33')]=_['intersection'](_0x5c8713[_0xa55c('0x2e')],qs[_0xa55c('0x34')](_0x262d72[_0xa55c('0x2a')][_0xa55c('0x34')]));_0x16e229[_0xa55c('0x33')]=_0x16e229['attributes'][_0xa55c('0x35')]?_0x16e229[_0xa55c('0x33')]:_0x5c8713[_0xa55c('0x2e')];_0x16e229['order']=qs[_0xa55c('0x4f')](_0x262d72[_0xa55c('0x2a')][_0xa55c('0x4f')]);_0x16e229['where']=qs[_0xa55c('0x31')](_[_0xa55c('0x54')](_0x262d72[_0xa55c('0x2a')],_0x5c8713[_0xa55c('0x31')]));if(_0x262d72[_0xa55c('0x2a')][_0xa55c('0x1a')]){_0x16e229[_0xa55c('0x50')]=_['merge'](_0x16e229[_0xa55c('0x50')],{'$or':_[_0xa55c('0x25')](_0x16e229[_0xa55c('0x33')],function(_0x100ccb){var _0x531e60={};_0x531e60[_0x100ccb]={'$like':'%'+_0x262d72[_0xa55c('0x2a')][_0xa55c('0x1a')]+'%'};return _0x531e60;})});}_0x16e229=_[_0xa55c('0x43')]({},_0x16e229,_0x262d72[_0xa55c('0x37')]);return _0x2d03b2[_0xa55c('0x86')](_0x16e229);}})[_0xa55c('0x14')](function(_0x243cf3){if(_0x243cf3){_0x4b2e75=_0x243cf3['length'];if(!_0x262d72[_0xa55c('0x2a')][_0xa55c('0x4b')](_0xa55c('0x4c'))){_0x16e229[_0xa55c('0x4d')]=qs[_0xa55c('0x4d')](_0x262d72['query']['limit']);_0x16e229['offset']=qs[_0xa55c('0x10')](_0x262d72[_0xa55c('0x2a')][_0xa55c('0x10')]);}return _0x2d03b2[_0xa55c('0x86')](_0x16e229);}})[_0xa55c('0x14')](function(_0xb22076){if(_0xb22076){return _0xb22076?{'count':_0x4b2e75,'rows':_0xb22076}:null;}})[_0xa55c('0x14')](respondWithResult(_0x228d12,null))[_0xa55c('0x2c')](handleError(_0x228d12,null));};exports['getMembers']=function(_0x35c42c,_0x3b2174){var _0x35375e={};var _0x19a5f1={};var _0x3e7cfa;var _0xd511c0;return db['VoiceQueue'][_0xa55c('0x49')]({'where':{'id':_0x35c42c['params']['id']}})['then'](handleEntityNotFound(_0x3b2174,null))['then'](function(_0x58831d){if(_0x58831d){_0x3e7cfa=_0x58831d;_0x19a5f1[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db[_0xa55c('0x69')][_0xa55c('0x30')]);_0x19a5f1[_0xa55c('0x2a')]=_[_0xa55c('0x2f')](_0x35c42c[_0xa55c('0x2a')]);_0x19a5f1[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x19a5f1[_0xa55c('0x2e')],_0x19a5f1[_0xa55c('0x2a')]);_0x35375e['attributes']=_['intersection'](_0x19a5f1[_0xa55c('0x2e')],qs['fields'](_0x35c42c[_0xa55c('0x2a')][_0xa55c('0x34')]));_0x35375e[_0xa55c('0x33')]=_0x35375e[_0xa55c('0x33')][_0xa55c('0x35')]?_0x35375e[_0xa55c('0x33')]:_0x19a5f1[_0xa55c('0x2e')];_0x35375e[_0xa55c('0x4e')]=qs[_0xa55c('0x4f')](_0x35c42c['query'][_0xa55c('0x4f')]);_0x35375e[_0xa55c('0x50')]=qs['filters'](_['pick'](_0x35c42c[_0xa55c('0x2a')],_0x19a5f1[_0xa55c('0x31')]));if(_0x35c42c[_0xa55c('0x2a')]['filter']){_0x35375e[_0xa55c('0x50')]=_[_0xa55c('0x43')](_0x35375e[_0xa55c('0x50')],{'$or':_[_0xa55c('0x25')](_0x35375e['attributes'],function(_0x55459c){var _0x33d58c={};_0x33d58c[_0x55459c]={'$like':'%'+_0x35c42c['query']['filter']+'%'};return _0x33d58c;})});}_0x35375e=_[_0xa55c('0x43')]({},_0x35375e,_0x35c42c[_0xa55c('0x37')]);return _0x3e7cfa[_0xa55c('0x87')](_0x35375e);}})[_0xa55c('0x14')](function(_0x5184ea){if(_0x5184ea){_0xd511c0=_0x5184ea[_0xa55c('0x35')];if(!_0x35c42c[_0xa55c('0x2a')][_0xa55c('0x4b')](_0xa55c('0x4c'))){_0x35375e[_0xa55c('0x4d')]=qs['limit'](_0x35c42c[_0xa55c('0x2a')][_0xa55c('0x4d')]);_0x35375e[_0xa55c('0x10')]=qs[_0xa55c('0x10')](_0x35c42c[_0xa55c('0x2a')][_0xa55c('0x10')]);}return _0x3e7cfa[_0xa55c('0x87')](_0x35375e);}})['then'](function(_0x2d5e0e){return _0x2d5e0e?{'count':_0xd511c0,'rows':_0x2d5e0e}:null;})['then'](respondWithResult(_0x3b2174,null))[_0xa55c('0x2c')](handleError(_0x3b2174,null));};exports[_0xa55c('0x88')]=function(_0x3755a7,_0x50663f){var _0x50b42f={};var _0x307b39={};var _0x1319c6;var _0x536e1d;return db['VoiceQueue'][_0xa55c('0x49')]({'where':{'id':_0x3755a7[_0xa55c('0x2d')]['id']}})['then'](handleEntityNotFound(_0x50663f,null))[_0xa55c('0x14')](function(_0x568a42){if(_0x568a42){_0x1319c6=_0x568a42;_0x307b39[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db[_0xa55c('0x89')][_0xa55c('0x30')]);_0x307b39['query']=_[_0xa55c('0x2f')](_0x3755a7[_0xa55c('0x2a')]);_0x307b39[_0xa55c('0x31')]=_['intersection'](_0x307b39['model'],_0x307b39[_0xa55c('0x2a')]);_0x50b42f['attributes']=_['intersection'](_0x307b39[_0xa55c('0x2e')],qs[_0xa55c('0x34')](_0x3755a7[_0xa55c('0x2a')][_0xa55c('0x34')]));_0x50b42f[_0xa55c('0x33')]=_0x50b42f[_0xa55c('0x33')][_0xa55c('0x35')]?_0x50b42f[_0xa55c('0x33')]:_0x307b39[_0xa55c('0x2e')];_0x50b42f[_0xa55c('0x4e')]=qs['sort'](_0x3755a7['query'][_0xa55c('0x4f')]);_0x50b42f[_0xa55c('0x50')]=qs[_0xa55c('0x31')](_[_0xa55c('0x54')](_0x3755a7['query'],_0x307b39[_0xa55c('0x31')]));if(_0x3755a7[_0xa55c('0x2a')][_0xa55c('0x1a')]){_0x50b42f[_0xa55c('0x50')]=_['merge'](_0x50b42f[_0xa55c('0x50')],{'$or':_['map'](_0x50b42f['attributes'],function(_0x545806){var _0x4fbb59={};_0x4fbb59[_0x545806]={'$like':'%'+_0x3755a7[_0xa55c('0x2a')][_0xa55c('0x1a')]+'%'};return _0x4fbb59;})});}_0x50b42f=_['merge']({},_0x50b42f,_0x3755a7[_0xa55c('0x37')]);return _0x1319c6[_0xa55c('0x88')](_0x50b42f);}})[_0xa55c('0x14')](function(_0x3899bd){if(_0x3899bd){_0x536e1d=_0x3899bd[_0xa55c('0x35')];if(!_0x3755a7[_0xa55c('0x2a')]['hasOwnProperty'](_0xa55c('0x4c'))){_0x50b42f[_0xa55c('0x4d')]=qs[_0xa55c('0x4d')](_0x3755a7[_0xa55c('0x2a')]['limit']);_0x50b42f['offset']=qs['offset'](_0x3755a7[_0xa55c('0x2a')][_0xa55c('0x10')]);}return _0x1319c6[_0xa55c('0x88')](_0x50b42f);}})[_0xa55c('0x14')](function(_0x1205cb){if(_0x1205cb){return _0x1205cb?{'count':_0x536e1d,'rows':_0x1205cb}:null;}})[_0xa55c('0x14')](respondWithResult(_0x50663f,null))[_0xa55c('0x2c')](handleError(_0x50663f,null));};exports[_0xa55c('0x8a')]=function(_0x499008,_0x4ef239){var _0x3e3208=moment()[_0xa55c('0x6c')]('YYYY-MM-DD\x20HH:mm:ss');var _0x1e19d6,_0x286b33;return db['VoiceQueue']['find']({'where':{'id':_0x499008[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x4ef239,null))[_0xa55c('0x14')](function(_0x236015){if(_0x236015){_0x286b33=_0x236015;return _0x236015['addLists'](_0x499008['body'][_0xa55c('0x82')],_[_0xa55c('0x44')](_0x499008[_0xa55c('0x3a')],[_0xa55c('0x82'),'id'])||{});}return null;})[_0xa55c('0x83')](function(_0x18e4fd){var _0x185c5b;_0x1e19d6=_0x18e4fd||[];var _0x2511fe=[];if(_0x18e4fd){for(var _0x3ba948=0x0;_0x3ba948<_0x18e4fd[_0xa55c('0x35')];_0x3ba948+=0x1){var _0x5e83e9=_0x18e4fd[_0x3ba948][_0xa55c('0x16')]({'plain':!![]});_0x286b33['dialCheckDuplicateType']=_0x499008[_0xa55c('0x3a')][_0xa55c('0x8b')]?_0x499008[_0xa55c('0x3a')][_0xa55c('0x8b')]:_0x286b33[_0xa55c('0x8b')];switch(_0x286b33[_0xa55c('0x8b')]){case _0xa55c('0x8c'):_0x185c5b=squel[_0xa55c('0x8d')]()[_0xa55c('0x8e')](_0xa55c('0x8f'))[_0xa55c('0x90')]([_0xa55c('0x91'),_0xa55c('0x92'),'ContactId',_0xa55c('0x93'),_0xa55c('0x55'),'createdAt',_0xa55c('0x46')],squel[_0xa55c('0x72')]()[_0xa55c('0x94')]('phone',_0xa55c('0x91'))[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27','scheduledAt')[_0xa55c('0x94')]('id',_0xa55c('0x95'))['field'](_0x5e83e9[_0xa55c('0x96')]['toString'](),_0xa55c('0x93'))[_0xa55c('0x94')](_0x499008[_0xa55c('0x2d')]['id'][_0xa55c('0x78')](),_0xa55c('0x55'))[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27',_0xa55c('0x45'))[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27',_0xa55c('0x46'))[_0xa55c('0x97')](_0xa55c('0x98'))[_0xa55c('0x50')](_0xa55c('0x99'))[_0xa55c('0x50')](_0xa55c('0x9a'),_0x5e83e9[_0xa55c('0x96')]['toString']())[_0xa55c('0x50')]('phone\x20IS\x20NOT\x20NULL')[_0xa55c('0x50')](_0xa55c('0x9b'),squel[_0xa55c('0x72')]()['field'](_0xa55c('0x9c'))[_0xa55c('0x97')](_0xa55c('0x9d'))[_0xa55c('0x50')]('VoiceQueueId\x20=\x20?',_0x499008['params']['id'][_0xa55c('0x78')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xa55c('0x72')]()[_0xa55c('0x94')]('COALESCE(phone,\x27\x27)')['from']('cm_hopper')[_0xa55c('0x50')](_0xa55c('0x76'),_0x499008['params']['id'][_0xa55c('0x78')]())))[_0xa55c('0x78')]();break;case _0xa55c('0x9e'):_0x185c5b=squel[_0xa55c('0x8d')]()[_0xa55c('0x8e')](_0xa55c('0x8f'))[_0xa55c('0x90')]([_0xa55c('0x91'),_0xa55c('0x92'),_0xa55c('0x95'),_0xa55c('0x93'),_0xa55c('0x55'),'createdAt',_0xa55c('0x46')],squel[_0xa55c('0x72')]()[_0xa55c('0x94')](_0xa55c('0x91'),_0xa55c('0x91'))[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27',_0xa55c('0x92'))[_0xa55c('0x94')]('id',_0xa55c('0x95'))[_0xa55c('0x94')](_0x5e83e9['CmListId']['toString'](),_0xa55c('0x93'))[_0xa55c('0x94')](_0x499008[_0xa55c('0x2d')]['id'][_0xa55c('0x78')](),_0xa55c('0x55'))['field']('\x27'+_0x3e3208+'\x27',_0xa55c('0x45'))['field']('\x27'+_0x3e3208+'\x27','updatedAt')[_0xa55c('0x97')](_0xa55c('0x98'))[_0xa55c('0x50')](_0xa55c('0x99'))['where'](_0xa55c('0x9a'),_0x5e83e9[_0xa55c('0x96')][_0xa55c('0x78')]())[_0xa55c('0x50')]('phone\x20IS\x20NOT\x20NULL')[_0xa55c('0x50')](_0xa55c('0x9b'),squel[_0xa55c('0x72')]()[_0xa55c('0x94')](_0xa55c('0x9f'))[_0xa55c('0x97')](_0xa55c('0x8f'))[_0xa55c('0x50')](_0xa55c('0x76'),_0x499008[_0xa55c('0x2d')]['id']['toString']())))[_0xa55c('0x78')]();break;default:_0x185c5b=squel[_0xa55c('0x8d')]()[_0xa55c('0x8e')](_0xa55c('0x8f'))[_0xa55c('0x90')]([_0xa55c('0x91'),_0xa55c('0x92'),_0xa55c('0x95'),_0xa55c('0x93'),'VoiceQueueId',_0xa55c('0x45'),'updatedAt'],squel[_0xa55c('0x72')]()[_0xa55c('0x94')](_0xa55c('0x91'),_0xa55c('0x91'))[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27',_0xa55c('0x92'))[_0xa55c('0x94')]('id',_0xa55c('0x95'))[_0xa55c('0x94')](_0x5e83e9['CmListId']['toString'](),_0xa55c('0x93'))['field'](_0x499008[_0xa55c('0x2d')]['id'][_0xa55c('0x78')](),_0xa55c('0x55'))[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27','createdAt')[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27','updatedAt')[_0xa55c('0x97')](_0xa55c('0x98'))[_0xa55c('0x50')](_0xa55c('0x99'))[_0xa55c('0x50')](_0xa55c('0x9a'),_0x5e83e9[_0xa55c('0x96')][_0xa55c('0x78')]())[_0xa55c('0x50')]('phone\x20IS\x20NOT\x20NULL'))[_0xa55c('0x78')]();}_0x2511fe[_0xa55c('0xa0')](db[_0xa55c('0x64')]['query'](_0x185c5b));}return BPromise[_0xa55c('0x7c')](_0x2511fe);}})[_0xa55c('0x14')](function(){var _0x4457e9=[];var _0x456cb9=squel[_0xa55c('0x8d')]()[_0xa55c('0x8e')](_0xa55c('0xa1'))[_0xa55c('0x90')]([_0xa55c('0xa2'),_0xa55c('0x91'),'OrderBy',_0xa55c('0x45'),_0xa55c('0x46')],squel[_0xa55c('0x72')]()[_0xa55c('0x94')](_0xa55c('0xa3'))['field']('ci.item')['field']('ci.OrderBy+1')[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27','createdAt')[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27',_0xa55c('0x46'))[_0xa55c('0x97')](_0xa55c('0xa4'),'ci')[_0xa55c('0x74')](_0xa55c('0x8f'),'h',_0xa55c('0xa5'))[_0xa55c('0x50')](_0xa55c('0xa6'),_0x3e3208)[_0xa55c('0x50')](_0xa55c('0xa7'),'PHONE'))[_0xa55c('0x78')]();_0x4457e9[_0xa55c('0xa0')](db[_0xa55c('0x64')]['query'](_0x456cb9));return BPromise['all'](_0x4457e9);})['then'](function(){return _0x1e19d6;})[_0xa55c('0x14')](respondWithResult(_0x4ef239,null))[_0xa55c('0x2c')](handleError(_0x4ef239,null));};exports[_0xa55c('0xa8')]=function(_0x27cd1b,_0x3ed3a5){return db[_0xa55c('0x26')][_0xa55c('0x38')]({'where':{'id':_0x27cd1b[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x3ed3a5,null))[_0xa55c('0x14')](function(_0x3def57){if(_0x3def57){return _0x3def57[_0xa55c('0xa8')](_0x27cd1b[_0xa55c('0x2a')][_0xa55c('0x82')]);}})[_0xa55c('0x14')](function(_0x4f5f1a){if(_0x4f5f1a){return db[_0xa55c('0x4a')]['destroy']({'where':{'ListId':_0x27cd1b[_0xa55c('0x2a')][_0xa55c('0x82')],'VoiceQueueId':_0x27cd1b[_0xa55c('0x2d')]['id']}})['then'](function(){return _0x4f5f1a;});}})['then'](respondWithStatusCode(_0x3ed3a5,null))[_0xa55c('0x2c')](handleError(_0x3ed3a5,null));};exports[_0xa55c('0xa9')]=function(_0x30af02,_0x5ebd8a){var _0x2420da={};var _0x2a4b78={};var _0x1e4c2d;var _0x2bf777;return db[_0xa55c('0x26')][_0xa55c('0x49')]({'where':{'id':_0x30af02[_0xa55c('0x2d')]['id']}})['then'](handleEntityNotFound(_0x5ebd8a,null))[_0xa55c('0x14')](function(_0x266b12){if(_0x266b12){_0x1e4c2d=_0x266b12;_0x2a4b78[_0xa55c('0x2e')]=_['keys'](db[_0xa55c('0x89')]['rawAttributes']);_0x2a4b78[_0xa55c('0x2a')]=_[_0xa55c('0x2f')](_0x30af02['query']);_0x2a4b78[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x2a4b78[_0xa55c('0x2e')],_0x2a4b78['query']);_0x2420da[_0xa55c('0x33')]=_[_0xa55c('0x32')](_0x2a4b78['model'],qs['fields'](_0x30af02[_0xa55c('0x2a')][_0xa55c('0x34')]));_0x2420da[_0xa55c('0x33')]=_0x2420da[_0xa55c('0x33')][_0xa55c('0x35')]?_0x2420da['attributes']:_0x2a4b78[_0xa55c('0x2e')];_0x2420da['order']=qs['sort'](_0x30af02[_0xa55c('0x2a')][_0xa55c('0x4f')]);_0x2420da['where']=qs[_0xa55c('0x31')](_['pick'](_0x30af02[_0xa55c('0x2a')],_0x2a4b78[_0xa55c('0x31')]));if(_0x30af02['query'][_0xa55c('0x1a')]){_0x2420da[_0xa55c('0x50')]=_['merge'](_0x2420da[_0xa55c('0x50')],{'$or':_['map'](_0x2420da['attributes'],function(_0x37273b){var _0x1cd529={};_0x1cd529[_0x37273b]={'$like':'%'+_0x30af02[_0xa55c('0x2a')][_0xa55c('0x1a')]+'%'};return _0x1cd529;})});}_0x2420da=_[_0xa55c('0x43')]({},_0x2420da,_0x30af02[_0xa55c('0x37')]);return _0x1e4c2d[_0xa55c('0xa9')](_0x2420da);}})['then'](function(_0x27e791){if(_0x27e791){_0x2bf777=_0x27e791[_0xa55c('0x35')];if(!_0x30af02['query'][_0xa55c('0x4b')](_0xa55c('0x4c'))){_0x2420da['limit']=qs[_0xa55c('0x4d')](_0x30af02[_0xa55c('0x2a')][_0xa55c('0x4d')]);_0x2420da[_0xa55c('0x10')]=qs['offset'](_0x30af02[_0xa55c('0x2a')][_0xa55c('0x10')]);}return _0x1e4c2d[_0xa55c('0xa9')](_0x2420da);}})[_0xa55c('0x14')](function(_0x365331){if(_0x365331){return _0x365331?{'count':_0x2bf777,'rows':_0x365331}:null;}})[_0xa55c('0x14')](respondWithResult(_0x5ebd8a,null))['catch'](handleError(_0x5ebd8a,null));};exports[_0xa55c('0xaa')]=function(_0x4d7cd6,_0x1ca9bd){var _0x2bf932;return db['VoiceQueue']['find']({'where':{'id':_0x4d7cd6[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x1ca9bd,null))[_0xa55c('0x14')](function(_0x3c9d2b){if(_0x3c9d2b){return _0x3c9d2b[_0xa55c('0xaa')](_0x4d7cd6[_0xa55c('0x3a')][_0xa55c('0x82')],_['omit'](_0x4d7cd6[_0xa55c('0x3a')],[_0xa55c('0x82'),'id'])||{});}return null;})[_0xa55c('0x83')](function(_0x158b01){var _0x19f576;_0x2bf932=_0x158b01||[];var _0x10da4b=[];if(_0x158b01){for(var _0x3320ab=0x0;_0x3320ab<_0x158b01[_0xa55c('0x35')];_0x3320ab+=0x1){var _0x298cf5=_0x158b01[_0x3320ab][_0xa55c('0x16')]({'plain':!![]});_0x19f576=squel[_0xa55c('0x8d')]()[_0xa55c('0x8e')](_0xa55c('0xab'))['fromQuery']([_0xa55c('0x91'),'ContactId',_0xa55c('0x93'),_0xa55c('0x55'),'createdAt',_0xa55c('0x46')],squel[_0xa55c('0x72')]()[_0xa55c('0x94')](_0xa55c('0x91'),_0xa55c('0x91'))['field']('id',_0xa55c('0x95'))[_0xa55c('0x94')](_0x298cf5[_0xa55c('0x96')]['toString'](),'ListId')['field'](_0x4d7cd6[_0xa55c('0x2d')]['id'][_0xa55c('0x78')](),'VoiceQueueId')[_0xa55c('0x94')](_0xa55c('0xac'),_0xa55c('0x45'))[_0xa55c('0x94')](_0xa55c('0xac'),'updatedAt')[_0xa55c('0x97')](_0xa55c('0x98'))[_0xa55c('0x50')](_0xa55c('0x99'))[_0xa55c('0x50')]('ListId\x20=\x20?',_0x298cf5['CmListId'][_0xa55c('0x78')]())[_0xa55c('0x50')](_0xa55c('0xad')))['toString']();_0x10da4b[_0xa55c('0xa0')](db[_0xa55c('0x64')][_0xa55c('0x2a')](_0x19f576));}return BPromise[_0xa55c('0x7c')](_0x10da4b);}})[_0xa55c('0x14')](function(){return _0x2bf932;})[_0xa55c('0x14')](respondWithResult(_0x1ca9bd,null))[_0xa55c('0x2c')](handleError(_0x1ca9bd,null));};exports[_0xa55c('0xae')]=function(_0x23862a,_0xb432d1){return db['VoiceQueue'][_0xa55c('0x38')]({'where':{'id':_0x23862a[_0xa55c('0x2d')]['id']}})['then'](handleEntityNotFound(_0xb432d1,null))[_0xa55c('0x14')](function(_0x5bc270){if(_0x5bc270){return _0x5bc270[_0xa55c('0xae')](_0x23862a[_0xa55c('0x2a')][_0xa55c('0x82')]);}})[_0xa55c('0x14')](function(_0x543b4a){if(_0x543b4a){return db[_0xa55c('0x59')]['destroy']({'where':{'ListId':_0x23862a[_0xa55c('0x2a')][_0xa55c('0x82')],'VoiceQueueId':_0x23862a[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](function(){return _0x543b4a;});}})[_0xa55c('0x14')](respondWithStatusCode(_0xb432d1,null))['catch'](handleError(_0xb432d1,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index d75b475..5f36cc0 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 _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 +var _0xf683=['../../mysqldb','VoiceQueue','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x6b1b77,_0x3fae2a){var _0x363e55=function(_0x16f99a){while(--_0x16f99a){_0x6b1b77['push'](_0x6b1b77['shift']());}};_0x363e55(++_0x3fae2a);}(_0xf683,0x188));var _0x3f68=function(_0x2d2ed8,_0xf57b77){_0x2d2ed8=_0x2d2ed8-0x0;var _0x426bcf=_0xf683[_0x2d2ed8];return _0x426bcf;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x3f68('0x0'))['db'][_0x3f68('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x3f68('0x2')](0x0);var events={'afterCreate':_0x3f68('0x3'),'afterUpdate':_0x3f68('0x4'),'afterDestroy':'remove'};function emitEvent(_0xa0b531){return function(_0x428f47,_0x16784d,_0x18e498){VoiceQueueEvents[_0x3f68('0x5')](_0xa0b531+':'+_0x428f47['id'],_0x428f47);VoiceQueueEvents['emit'](_0xa0b531,_0x428f47);_0x18e498(null);};}for(var e in events){if(events[_0x3f68('0x6')](e)){var event=events[e];VoiceQueue[_0x3f68('0x7')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 563bcda..2c14886 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 _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 +var _0x008c=['define','voice_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports'];(function(_0x206711,_0x4125b4){var _0x4fe02b=function(_0x27dc45){while(--_0x27dc45){_0x206711['push'](_0x206711['shift']());}};_0x4fe02b(++_0x4125b4);}(_0x008c,0x188));var _0xc008=function(_0x4145ed,_0x1965e3){_0x4145ed=_0x4145ed-0x0;var _0x2294a6=_0x008c[_0x4145ed];return _0x2294a6;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('VoiceQueue',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 2e028eb..5ef14eb 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 _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 +var _0x5821=['register','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVoiceQueue','VoiceQueue','options','raw','where','attributes','limit','include','map','model','debug','ShowVoiceQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./voiceQueue.socket'];(function(_0x2998c2,_0x1ab775){var _0x4c154c=function(_0x8f3c96){while(--_0x8f3c96){_0x2998c2['push'](_0x2998c2['shift']());}};_0x4c154c(++_0x1ab775);}(_0x5821,0x159));var _0x1582=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x5821[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x1582('0x0'));var util=require(_0x1582('0x1'));var moment=require(_0x1582('0x2'));var BPromise=require(_0x1582('0x3'));var rs=require(_0x1582('0x4'));var fs=require('fs');var Redis=require(_0x1582('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1582('0x6'))(_0x1582('0x7'));var config=require(_0x1582('0x8'));var jayson=require(_0x1582('0x9'));var client=jayson[_0x1582('0xa')][_0x1582('0xb')]({'port':0x232a});config[_0x1582('0xc')]=_[_0x1582('0xd')](config[_0x1582('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1582('0xc')]));require(_0x1582('0xe'))[_0x1582('0xf')](socket);function respondWithRpcPromise(_0x4012ad,_0x322ec0,_0x100ba8){return new BPromise(function(_0x474aec,_0x41ac33){return client[_0x1582('0x10')](_0x4012ad,_0x100ba8)[_0x1582('0x11')](function(_0x37ba74){logger[_0x1582('0x12')](_0x1582('0x13'),_0x322ec0,_0x1582('0x14'));logger['debug'](_0x1582('0x15'),_0x322ec0,'request\x20sent',JSON[_0x1582('0x16')](_0x37ba74));if(_0x37ba74[_0x1582('0x17')]){if(_0x37ba74['error']['code']===0x1f4){logger[_0x1582('0x17')](_0x1582('0x13'),_0x322ec0,_0x37ba74['error'][_0x1582('0x18')]);return _0x41ac33(_0x37ba74[_0x1582('0x17')]['message']);}logger['error'](_0x1582('0x13'),_0x322ec0,_0x37ba74['error'][_0x1582('0x18')]);return _0x474aec(_0x37ba74[_0x1582('0x17')]['message']);}else{logger[_0x1582('0x12')](_0x1582('0x13'),_0x322ec0,_0x1582('0x14'));_0x474aec(_0x37ba74[_0x1582('0x19')][_0x1582('0x18')]);}})[_0x1582('0x1a')](function(_0x2e048a){logger[_0x1582('0x17')](_0x1582('0x13'),_0x322ec0,_0x2e048a);_0x41ac33(_0x2e048a);});});}exports[_0x1582('0x1b')]=function(_0x18ad6a){var _0x5c912=this;return new Promise(function(_0x622345,_0xe3bfc3){return db[_0x1582('0x1c')]['findAll']({'raw':_0x18ad6a[_0x1582('0x1d')]?_0x18ad6a[_0x1582('0x1d')][_0x1582('0x1e')]===undefined?!![]:![]:!![],'where':_0x18ad6a[_0x1582('0x1d')]?_0x18ad6a[_0x1582('0x1d')][_0x1582('0x1f')]||null:null,'attributes':_0x18ad6a[_0x1582('0x1d')]?_0x18ad6a['options'][_0x1582('0x20')]||null:null,'limit':_0x18ad6a[_0x1582('0x1d')]?_0x18ad6a[_0x1582('0x1d')][_0x1582('0x21')]||null:null,'include':_0x18ad6a[_0x1582('0x1d')]?_0x18ad6a['options'][_0x1582('0x22')]?_[_0x1582('0x23')](_0x18ad6a[_0x1582('0x1d')]['include'],function(_0x88c51f){return{'model':db[_0x88c51f[_0x1582('0x24')]],'as':_0x88c51f['as'],'attributes':_0x88c51f['attributes'],'include':_0x88c51f['include']?_[_0x1582('0x23')](_0x88c51f[_0x1582('0x22')],function(_0x5f4729){return{'model':db[_0x5f4729[_0x1582('0x24')]],'as':_0x5f4729['as'],'attributes':_0x5f4729[_0x1582('0x20')],'include':_0x5f4729[_0x1582('0x22')]?_[_0x1582('0x23')](_0x5f4729[_0x1582('0x22')],function(_0x21e181){return{'model':db[_0x21e181['model']],'as':_0x21e181['as'],'attributes':_0x21e181['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x540a10){logger['info'](_0x1582('0x1b'),_0x18ad6a);logger[_0x1582('0x25')](_0x1582('0x1b'),_0x18ad6a,JSON[_0x1582('0x16')](_0x540a10));_0x622345(_0x540a10);})['catch'](function(_0x244dcb){logger[_0x1582('0x17')](_0x1582('0x1b'),_0x244dcb['message'],_0x18ad6a);_0xe3bfc3(_0x5c912[_0x1582('0x17')](0x1f4,_0x244dcb['message']));});});};exports[_0x1582('0x26')]=function(_0x38c5cc){var _0x27f168=this;return new Promise(function(_0x4822b3,_0x475b04){return db[_0x1582('0x1c')][_0x1582('0x27')]({'raw':_0x38c5cc[_0x1582('0x1d')]?_0x38c5cc[_0x1582('0x1d')][_0x1582('0x1e')]===undefined?!![]:![]:!![],'where':_0x38c5cc['options']?_0x38c5cc['options'][_0x1582('0x1f')]||null:null,'attributes':_0x38c5cc[_0x1582('0x1d')]?_0x38c5cc['options'][_0x1582('0x20')]||null:null,'include':_0x38c5cc[_0x1582('0x1d')]?_0x38c5cc['options'][_0x1582('0x22')]?_['map'](_0x38c5cc['options']['include'],function(_0x45b2c4){return{'model':db[_0x45b2c4[_0x1582('0x24')]],'as':_0x45b2c4['as'],'attributes':_0x45b2c4[_0x1582('0x20')],'include':_0x45b2c4[_0x1582('0x22')]?_[_0x1582('0x23')](_0x45b2c4[_0x1582('0x22')],function(_0x1bc64b){return{'model':db[_0x1bc64b[_0x1582('0x24')]],'as':_0x1bc64b['as'],'attributes':_0x1bc64b[_0x1582('0x20')],'include':_0x1bc64b[_0x1582('0x22')]?_[_0x1582('0x23')](_0x1bc64b['include'],function(_0x319f21){return{'model':db[_0x319f21[_0x1582('0x24')]],'as':_0x319f21['as'],'attributes':_0x319f21[_0x1582('0x20')]};}):[]};}):[]};}):[]:[]})[_0x1582('0x11')](function(_0x55babc){logger['info']('ShowVoiceQueue',_0x38c5cc);logger[_0x1582('0x25')](_0x1582('0x26'),_0x38c5cc,JSON['stringify'](_0x55babc));_0x4822b3(_0x55babc);})[_0x1582('0x1a')](function(_0x403a02){logger[_0x1582('0x17')](_0x1582('0x26'),_0x403a02[_0x1582('0x18')],_0x38c5cc);_0x475b04(_0x27f168[_0x1582('0x17')](0x1f4,_0x403a02['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 6ce6e39..ce50cd5 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 _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 +var _0x6f01=['length','voiceQueue:','./voiceQueue.events','remove','update','emit','removeListener','register'];(function(_0x508d74,_0x217644){var _0x30c7fa=function(_0x43096f){while(--_0x43096f){_0x508d74['push'](_0x508d74['shift']());}};_0x30c7fa(++_0x217644);}(_0x6f01,0x102));var _0x16f0=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6f01[_0x2dafbe];return _0x58a45a;};'use strict';var VoiceQueueEvents=require(_0x16f0('0x0'));var events=['save',_0x16f0('0x1'),_0x16f0('0x2')];function createListener(_0x490199,_0x26bdc5){return function(_0x195d4c){_0x26bdc5[_0x16f0('0x3')](_0x490199,_0x195d4c);};}function removeListener(_0x497ebd,_0x5a2c16){return function(){VoiceQueueEvents[_0x16f0('0x4')](_0x497ebd,_0x5a2c16);};}exports[_0x16f0('0x5')]=function(_0x4c8be2){for(var _0x4fbf2e=0x0,_0x5811e7=events[_0x16f0('0x6')];_0x4fbf2e<_0x5811e7;_0x4fbf2e++){var _0x24cbd8=events[_0x4fbf2e];var _0x59a413=createListener(_0x16f0('0x7')+_0x24cbd8,_0x4c8be2);VoiceQueueEvents['on'](_0x24cbd8,_0x59a413);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 760efb8..aa9bb1b 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 _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 +var _0x5344=['/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','/index','getVoiceQueuesReport','show','post','create','update','delete'];(function(_0x665bc5,_0x2300aa){var _0x33cc93=function(_0x4eb25d){while(--_0x4eb25d){_0x665bc5['push'](_0x665bc5['shift']());}};_0x33cc93(++_0x2300aa);}(_0x5344,0x1b8));var _0x4534=function(_0x4d5ba9,_0x2cb975){_0x4d5ba9=_0x4d5ba9-0x0;var _0x28968a=_0x5344[_0x4d5ba9];return _0x28968a;};'use strict';var multer=require(_0x4534('0x0'));var util=require(_0x4534('0x1'));var path=require(_0x4534('0x2'));var timeout=require(_0x4534('0x3'));var express=require(_0x4534('0x4'));var router=express[_0x4534('0x5')]();var fs_extra=require(_0x4534('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4534('0x7'));router[_0x4534('0x8')]('/',auth[_0x4534('0x9')](),controller[_0x4534('0xa')]);router[_0x4534('0x8')](_0x4534('0xb'),auth[_0x4534('0x9')](),controller[_0x4534('0xc')]);router[_0x4534('0x8')](_0x4534('0xd'),auth[_0x4534('0x9')](),controller[_0x4534('0xe')]);router[_0x4534('0x8')]('/:id',auth[_0x4534('0x9')](),controller[_0x4534('0xf')]);router[_0x4534('0x10')]('/',auth['isAuthenticated'](),controller[_0x4534('0x11')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x4534('0x12')]);router[_0x4534('0x13')](_0x4534('0x14'),auth['isAuthenticated'](),controller[_0x4534('0x15')]);module[_0x4534('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 2d95ff4..2e2078c 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 _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 +var _0x4459=['queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','seconds','setDataValue'];(function(_0x551e1e,_0xe449d3){var _0x2e03f6=function(_0x19b24f){while(--_0x19b24f){_0x551e1e['push'](_0x551e1e['shift']());}};_0x2e03f6(++_0xe449d3);}(_0x4459,0xb0));var _0x9445=function(_0x73bc9,_0x223084){_0x73bc9=_0x73bc9-0x0;var _0x1d83f0=_0x4459[_0x73bc9];return _0x1d83f0;};'use strict';var Sequelize=require(_0x9445('0x0'));var moment=require(_0x9445('0x1'));module[_0x9445('0x2')]={'type':{'type':Sequelize[_0x9445('0x3')]},'uniqueid':{'type':Sequelize[_0x9445('0x3')]},'calleridnum':{'type':Sequelize[_0x9445('0x3')]},'calleridname':{'type':Sequelize[_0x9445('0x3')]},'queue':{'type':Sequelize[_0x9445('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x9445('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x9445('0x4')],'set':function(_0x2a7ee7){var _0x70a6c4=moment(_0x2a7ee7);var _0x401c9b=moment(this[_0x9445('0x5')](_0x9445('0x6')))[_0x9445('0x7')](_0x9445('0x8'));var _0x36900f=_0x70a6c4['diff'](_0x401c9b,_0x9445('0x9'));this[_0x9445('0xa')](_0x9445('0xb'),_0x2a7ee7);this[_0x9445('0xa')](_0x9445('0xc'),_0x36900f||null);}},'position':{'type':Sequelize[_0x9445('0xd')]},'count':{'type':Sequelize[_0x9445('0xd')]},'queuecallerabandon':{'type':Sequelize[_0x9445('0xe')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x9445('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x9445('0xe')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x9445('0x4')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0x9445('0x3')],'comment':_0x9445('0xf')},'originalposition':{'type':Sequelize[_0x9445('0xd')]},'channel':{'type':Sequelize[_0x9445('0x3')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x9445('0x3')]},'accountcode':{'type':Sequelize[_0x9445('0x3')]},'context':{'type':Sequelize[_0x9445('0x3')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x9445('0xd')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x9445('0x10')},'transferexten':{'type':Sequelize[_0x9445('0x3')]},'transferuniqueid':{'type':Sequelize[_0x9445('0x3')]},'disposition':{'type':Sequelize[_0x9445('0x3')]},'secondDisposition':{'type':Sequelize[_0x9445('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'note':{'type':Sequelize[_0x9445('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 2265962..fd63108 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 _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 +var _0x6caf=['filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','create','body','update','find','destroy','describe','nolimit','options','getVoiceQueuesReport','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','then','end','sendStatus','error','stack','name','send','index','VoiceQueueReport','rawAttributes','fieldName','type','key','model','map','query','keys'];(function(_0x5180c3,_0x4b35f7){var _0x55c975=function(_0x4746cb){while(--_0x4746cb){_0x5180c3['push'](_0x5180c3['shift']());}};_0x55c975(++_0x4b35f7);}(_0x6caf,0x10f));var _0xf6ca=function(_0x28f32c,_0x4cc342){_0x28f32c=_0x28f32c-0x0;var _0x355402=_0x6caf[_0x28f32c];return _0x355402;};'use strict';var emlformat=require(_0xf6ca('0x0'));var rimraf=require(_0xf6ca('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf6ca('0x2'));var moment=require(_0xf6ca('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf6ca('0x4'));var util=require(_0xf6ca('0x5'));var path=require(_0xf6ca('0x6'));var sox=require(_0xf6ca('0x7'));var csv=require(_0xf6ca('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xf6ca('0x9'));var jsforce=require(_0xf6ca('0xa'));var deskjs=require(_0xf6ca('0xb'));var toCsv=require('to-csv');var querystring=require(_0xf6ca('0xc'));var Papa=require(_0xf6ca('0xd'));var Redis=require(_0xf6ca('0xe'));var authService=require(_0xf6ca('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf6ca('0x10'));var logger=require('../../config/logger')(_0xf6ca('0x11'));var utils=require(_0xf6ca('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf6ca('0x13'))['db'];config[_0xf6ca('0x14')]=_[_0xf6ca('0x15')](config[_0xf6ca('0x14')],{'host':_0xf6ca('0x16'),'port':0x18eb});var socket=require(_0xf6ca('0x17'))(new Redis(config[_0xf6ca('0x14')]));require(_0xf6ca('0x18'))[_0xf6ca('0x19')](socket);function respondWithStatusCode(_0x405b14,_0x80ed8a){_0x80ed8a=_0x80ed8a||0xcc;return function(_0x15d750){if(_0x15d750){return _0x405b14['sendStatus'](_0x80ed8a);}return _0x405b14[_0xf6ca('0x1a')](_0x80ed8a)['end']();};}function respondWithResult(_0x591d80,_0x1270cd){_0x1270cd=_0x1270cd||0xc8;return function(_0x5b5fda){if(_0x5b5fda){return _0x591d80[_0xf6ca('0x1a')](_0x1270cd)['json'](_0x5b5fda);}};}function respondWithFilteredResult(_0x35fc8b,_0x1eb7f4){return function(_0x2bbc82){if(_0x2bbc82){var _0xcbeb9f=typeof _0x1eb7f4[_0xf6ca('0x1b')]===_0xf6ca('0x1c')&&typeof _0x1eb7f4[_0xf6ca('0x1d')]===_0xf6ca('0x1c');var _0x5868be=_0x2bbc82['count'];var _0x44d27c=_0xcbeb9f?0x0:_0x1eb7f4[_0xf6ca('0x1b')];var _0xd77baa=_0xcbeb9f?_0x2bbc82[_0xf6ca('0x1e')]:_0x1eb7f4[_0xf6ca('0x1b')]+_0x1eb7f4['limit'];var _0x50827a;if(_0xd77baa>=_0x5868be){_0xd77baa=_0x5868be;_0x50827a=0xc8;}else{_0x50827a=0xce;}_0x35fc8b[_0xf6ca('0x1a')](_0x50827a);return _0x35fc8b['set'](_0xf6ca('0x1f'),_0x44d27c+'-'+_0xd77baa+'/'+_0x5868be)[_0xf6ca('0x20')](_0x2bbc82);}return null;};}function patchUpdates(_0x52d739){return function(_0x51c942){try{jsonpatch[_0xf6ca('0x21')](_0x51c942,_0x52d739,!![]);}catch(_0x1879ac){return BPromise[_0xf6ca('0x22')](_0x1879ac);}return _0x51c942[_0xf6ca('0x23')]();};}function saveUpdates(_0x56e642,_0x4f7d1f){return function(_0x41ffbf){if(_0x41ffbf){return _0x41ffbf['update'](_0x56e642)[_0xf6ca('0x24')](function(_0x2be453){return _0x2be453;});}return null;};}function removeEntity(_0x155a7d,_0x3058dc){return function(_0x55cf72){if(_0x55cf72){return _0x55cf72['destroy']()[_0xf6ca('0x24')](function(){_0x155a7d[_0xf6ca('0x1a')](0xcc)[_0xf6ca('0x25')]();});}};}function handleEntityNotFound(_0x4e833e,_0x12cfcf){return function(_0x5e16db){if(!_0x5e16db){_0x4e833e[_0xf6ca('0x26')](0x194);}return _0x5e16db;};}function handleError(_0x46aa40,_0x17b95c){_0x17b95c=_0x17b95c||0x1f4;return function(_0x3819a8){logger[_0xf6ca('0x27')](_0x3819a8[_0xf6ca('0x28')]);if(_0x3819a8[_0xf6ca('0x29')]){delete _0x3819a8['name'];}_0x46aa40[_0xf6ca('0x1a')](_0x17b95c)[_0xf6ca('0x2a')](_0x3819a8);};}exports[_0xf6ca('0x2b')]=function(_0x1a8591,_0x5c52bb){var _0x42fb92={},_0x48398b={},_0x4bce57={'count':0x0,'rows':[]};var _0x270943=_['map'](db[_0xf6ca('0x2c')][_0xf6ca('0x2d')],function(_0xc87e5b){return{'name':_0xc87e5b[_0xf6ca('0x2e')],'type':_0xc87e5b[_0xf6ca('0x2f')][_0xf6ca('0x30')]};});_0x48398b[_0xf6ca('0x31')]=_[_0xf6ca('0x32')](_0x270943,_0xf6ca('0x29'));_0x48398b[_0xf6ca('0x33')]=_[_0xf6ca('0x34')](_0x1a8591[_0xf6ca('0x33')]);_0x48398b[_0xf6ca('0x35')]=_[_0xf6ca('0x36')](_0x48398b[_0xf6ca('0x31')],_0x48398b['query']);_0x42fb92[_0xf6ca('0x37')]=_[_0xf6ca('0x36')](_0x48398b[_0xf6ca('0x31')],qs[_0xf6ca('0x38')](_0x1a8591[_0xf6ca('0x33')][_0xf6ca('0x38')]));_0x42fb92['attributes']=_0x42fb92[_0xf6ca('0x37')][_0xf6ca('0x39')]?_0x42fb92[_0xf6ca('0x37')]:_0x48398b[_0xf6ca('0x31')];if(!_0x1a8591[_0xf6ca('0x33')][_0xf6ca('0x3a')]('nolimit')){_0x42fb92['limit']=qs[_0xf6ca('0x1d')](_0x1a8591[_0xf6ca('0x33')][_0xf6ca('0x1d')]);_0x42fb92[_0xf6ca('0x1b')]=qs[_0xf6ca('0x1b')](_0x1a8591[_0xf6ca('0x33')]['offset']);}_0x42fb92[_0xf6ca('0x3b')]=qs[_0xf6ca('0x3c')](_0x1a8591[_0xf6ca('0x33')][_0xf6ca('0x3c')]);_0x42fb92[_0xf6ca('0x3d')]=qs[_0xf6ca('0x35')](_[_0xf6ca('0x3e')](_0x1a8591['query'],_0x48398b[_0xf6ca('0x35')]),_0x270943);if(_0x1a8591[_0xf6ca('0x33')][_0xf6ca('0x3f')]){_0x42fb92[_0xf6ca('0x3d')]=_[_0xf6ca('0x40')](_0x42fb92[_0xf6ca('0x3d')],{'$or':_[_0xf6ca('0x32')](_0x270943,function(_0x1ea947){if(_0x1ea947[_0xf6ca('0x2f')]!=='VIRTUAL'){var _0xff6605={};_0xff6605[_0x1ea947[_0xf6ca('0x29')]]={'$like':'%'+_0x1a8591['query'][_0xf6ca('0x3f')]+'%'};return _0xff6605;}})});}_0x42fb92=_[_0xf6ca('0x40')]({},_0x42fb92,_0x1a8591['options']);var _0x2f9f29={'where':_0x42fb92[_0xf6ca('0x3d')]};return db['VoiceQueueReport'][_0xf6ca('0x1e')](_0x2f9f29)[_0xf6ca('0x24')](function(_0x4e2700){_0x4bce57[_0xf6ca('0x1e')]=_0x4e2700;if(_0x1a8591[_0xf6ca('0x33')][_0xf6ca('0x41')]){_0x42fb92[_0xf6ca('0x42')]=[{'all':!![]}];}return db[_0xf6ca('0x2c')][_0xf6ca('0x43')](_0x42fb92);})[_0xf6ca('0x24')](function(_0x14e83d){_0x4bce57[_0xf6ca('0x44')]=_0x14e83d;return _0x4bce57;})[_0xf6ca('0x24')](respondWithFilteredResult(_0x5c52bb,_0x42fb92))[_0xf6ca('0x45')](handleError(_0x5c52bb,null));};exports[_0xf6ca('0x46')]=function(_0x44a278,_0x3f9202){var _0x56eb82={'raw':![],'where':{'id':_0x44a278[_0xf6ca('0x47')]['id']}},_0x39b551={};_0x39b551[_0xf6ca('0x31')]=_['keys'](db[_0xf6ca('0x2c')]['rawAttributes']);_0x39b551[_0xf6ca('0x33')]=_['keys'](_0x44a278['query']);_0x39b551[_0xf6ca('0x35')]=_[_0xf6ca('0x36')](_0x39b551['model'],_0x39b551[_0xf6ca('0x33')]);_0x56eb82[_0xf6ca('0x37')]=_[_0xf6ca('0x36')](_0x39b551[_0xf6ca('0x31')],qs[_0xf6ca('0x38')](_0x44a278[_0xf6ca('0x33')][_0xf6ca('0x38')]));_0x56eb82[_0xf6ca('0x37')]=_0x56eb82[_0xf6ca('0x37')]['length']?_0x56eb82[_0xf6ca('0x37')]:_0x39b551[_0xf6ca('0x31')];if(_0x44a278[_0xf6ca('0x33')]['includeAll']){_0x56eb82[_0xf6ca('0x42')]=[{'all':!![]}];}_0x56eb82=_[_0xf6ca('0x40')]({},_0x56eb82,_0x44a278['options']);return db['VoiceQueueReport']['find'](_0x56eb82)[_0xf6ca('0x24')](handleEntityNotFound(_0x3f9202,null))[_0xf6ca('0x24')](respondWithResult(_0x3f9202,null))[_0xf6ca('0x45')](handleError(_0x3f9202,null));};exports['create']=function(_0x36ed2f,_0x3df987){return db[_0xf6ca('0x2c')][_0xf6ca('0x48')](_0x36ed2f[_0xf6ca('0x49')],{})[_0xf6ca('0x24')](respondWithResult(_0x3df987,0xc9))['catch'](handleError(_0x3df987,null));};exports[_0xf6ca('0x4a')]=function(_0x31c713,_0x4c4e76){if(_0x31c713[_0xf6ca('0x49')]['id']){delete _0x31c713[_0xf6ca('0x49')]['id'];}return db['VoiceQueueReport'][_0xf6ca('0x4b')]({'where':{'id':_0x31c713['params']['id']}})[_0xf6ca('0x24')](handleEntityNotFound(_0x4c4e76,null))[_0xf6ca('0x24')](saveUpdates(_0x31c713[_0xf6ca('0x49')],null))[_0xf6ca('0x24')](respondWithResult(_0x4c4e76,null))[_0xf6ca('0x45')](handleError(_0x4c4e76,null));};exports[_0xf6ca('0x4c')]=function(_0x5e719f,_0x517456){return db[_0xf6ca('0x2c')][_0xf6ca('0x4b')]({'where':{'id':_0x5e719f[_0xf6ca('0x47')]['id']}})[_0xf6ca('0x24')](handleEntityNotFound(_0x517456,null))[_0xf6ca('0x24')](removeEntity(_0x517456,null))[_0xf6ca('0x45')](handleError(_0x517456,null));};exports[_0xf6ca('0x4d')]=function(_0x2bec98,_0x40aa72){return db[_0xf6ca('0x2c')]['describe']()[_0xf6ca('0x24')](respondWithResult(_0x40aa72,null))['catch'](handleError(_0x40aa72,null));};exports['getVoiceQueuesReport']=function(_0x2f1a2d,_0x27bec2){var _0x5b1173={},_0x4f7842={},_0x45024b={'count':0x0,'rows':[]};_0x4f7842[_0xf6ca('0x31')]=_[_0xf6ca('0x34')](db[_0xf6ca('0x2c')][_0xf6ca('0x2d')]);_0x4f7842[_0xf6ca('0x33')]=_['keys'](_0x2f1a2d[_0xf6ca('0x33')]);_0x4f7842[_0xf6ca('0x35')]=_[_0xf6ca('0x36')](_0x4f7842[_0xf6ca('0x31')],_0x4f7842[_0xf6ca('0x33')]);_0x5b1173[_0xf6ca('0x37')]=_[_0xf6ca('0x36')](_0x4f7842[_0xf6ca('0x31')],qs[_0xf6ca('0x38')](_0x2f1a2d[_0xf6ca('0x33')][_0xf6ca('0x38')]));_0x5b1173[_0xf6ca('0x37')]=_0x5b1173[_0xf6ca('0x37')][_0xf6ca('0x39')]?_0x5b1173[_0xf6ca('0x37')]:_0x4f7842[_0xf6ca('0x31')];if(!_0x2f1a2d['query'][_0xf6ca('0x3a')](_0xf6ca('0x4e'))){_0x5b1173[_0xf6ca('0x1d')]=qs[_0xf6ca('0x1d')](_0x2f1a2d[_0xf6ca('0x33')][_0xf6ca('0x1d')]);_0x5b1173['offset']=qs[_0xf6ca('0x1b')](_0x2f1a2d[_0xf6ca('0x33')][_0xf6ca('0x1b')]);}_0x5b1173[_0xf6ca('0x3b')]=qs['sort'](_0x2f1a2d[_0xf6ca('0x33')]['sort']);_0x5b1173[_0xf6ca('0x3d')]=qs[_0xf6ca('0x35')](_[_0xf6ca('0x3e')](_0x2f1a2d['query'],_0x4f7842['filters']));if(_0x2f1a2d[_0xf6ca('0x33')][_0xf6ca('0x3f')]){_0x5b1173[_0xf6ca('0x3d')]=_[_0xf6ca('0x40')](_0x5b1173[_0xf6ca('0x3d')],{'$or':_[_0xf6ca('0x32')](_0x5b1173['attributes'],function(_0x51de41){var _0x402053={};_0x402053[_0x51de41]={'$like':'%'+_0x2f1a2d[_0xf6ca('0x33')][_0xf6ca('0x3f')]+'%'};return _0x402053;})});}_0x5b1173=_[_0xf6ca('0x40')]({},_0x5b1173,_0x2f1a2d[_0xf6ca('0x4f')]);var _0x32c1d5={'where':_0x5b1173[_0xf6ca('0x3d')]};return db['VoiceQueueReport'][_0xf6ca('0x1e')](_0x32c1d5)[_0xf6ca('0x24')](function(_0x43b731){_0x45024b[_0xf6ca('0x1e')]=_0x43b731;if(_0x2f1a2d[_0xf6ca('0x33')][_0xf6ca('0x41')]){_0x5b1173[_0xf6ca('0x42')]=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0x5b1173);})[_0xf6ca('0x24')](function(_0x7b3889){_0x45024b[_0xf6ca('0x44')]=_0x7b3889;return _0x45024b;})[_0xf6ca('0x24')](respondWithFilteredResult(_0x27bec2,_0x5b1173,_0xf6ca('0x50')))[_0xf6ca('0x45')](handleError(_0x27bec2,null,_0xf6ca('0x50')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index e51dca6..ffe206f 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 _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 +var _0xc453=['update','remove','emit','hook','exports','../../mysqldb','VoiceQueueReport','setMaxListeners','save'];(function(_0x38029a,_0x4526fa){var _0x3f5047=function(_0x44f00a){while(--_0x44f00a){_0x38029a['push'](_0x38029a['shift']());}};_0x3f5047(++_0x4526fa);}(_0xc453,0x1e2));var _0x3c45=function(_0x5f259a,_0x17d242){_0x5f259a=_0x5f259a-0x0;var _0x272c43=_0xc453[_0x5f259a];return _0x272c43;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0x3c45('0x0'))['db'][_0x3c45('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x3c45('0x2')](0x0);var events={'afterCreate':_0x3c45('0x3'),'afterUpdate':_0x3c45('0x4'),'afterDestroy':_0x3c45('0x5')};function emitEvent(_0x183197){return function(_0x3051cf,_0x36b340,_0x1f7e30){VoiceQueueReportEvents['emit'](_0x183197+':'+_0x3051cf['id'],_0x3051cf);VoiceQueueReportEvents[_0x3c45('0x6')](_0x183197,_0x3051cf);_0x1f7e30(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x3c45('0x7')](e,emitEvent(event));}}module[_0x3c45('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 9f6adbd..be6d0b0 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 _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 +var _0x571f=['VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash','api','bluebird','path','rimraf'];(function(_0x4420e4,_0x43f82f){var _0x44bc99=function(_0x27b9c2){while(--_0x27b9c2){_0x4420e4['push'](_0x4420e4['shift']());}};_0x44bc99(++_0x43f82f);}(_0x571f,0x94));var _0xf571=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x571f[_0x3054be];return _0x3df150;};'use strict';var _=require(_0xf571('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf571('0x1'));var moment=require('moment');var BPromise=require(_0xf571('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf571('0x3'));var rimraf=require(_0xf571('0x4'));var config=require('../../config/environment');var attributes=require('./voiceQueueReport.attributes');module['exports']=function(_0x364c34,_0x86911d){return _0x364c34['define'](_0xf571('0x5'),attributes,{'tableName':_0xf571('0x6'),'paranoid':![],'indexes':[{'fields':[_0xf571('0x7')]},{'fields':[_0xf571('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 1d7eab0..8384480 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 _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 +var _0xe2c3=['include','map','model','GetVoiceQueueReport','stringify','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','VoiceQueueReport','options','raw','where','attributes','limit'];(function(_0xa0d372,_0x5aeed5){var _0x16a57f=function(_0x422dbf){while(--_0x422dbf){_0xa0d372['push'](_0xa0d372['shift']());}};_0x16a57f(++_0x5aeed5);}(_0xe2c3,0x1e3));var _0x3e2c=function(_0x1261c2,_0x3ef819){_0x1261c2=_0x1261c2-0x0;var _0x3aabd2=_0xe2c3[_0x1261c2];return _0x3aabd2;};'use strict';var _=require('lodash');var util=require(_0x3e2c('0x0'));var moment=require(_0x3e2c('0x1'));var BPromise=require(_0x3e2c('0x2'));var rs=require(_0x3e2c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3e2c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3e2c('0x5'))(_0x3e2c('0x6'));var config=require(_0x3e2c('0x7'));var jayson=require(_0x3e2c('0x8'));var client=jayson[_0x3e2c('0x9')][_0x3e2c('0xa')]({'port':0x232a});config[_0x3e2c('0xb')]=_['defaults'](config['redis'],{'host':_0x3e2c('0xc'),'port':0x18eb});var socket=require(_0x3e2c('0xd'))(new Redis(config['redis']));require(_0x3e2c('0xe'))[_0x3e2c('0xf')](socket);function respondWithRpcPromise(_0x56b654,_0x28039a,_0xc7f5be){return new BPromise(function(_0x43ea62,_0x2be57d){return client[_0x3e2c('0x10')](_0x56b654,_0xc7f5be)[_0x3e2c('0x11')](function(_0x2dfc54){logger[_0x3e2c('0x12')](_0x3e2c('0x13'),_0x28039a,_0x3e2c('0x14'));logger[_0x3e2c('0x15')](_0x3e2c('0x16'),_0x28039a,'request\x20sent',JSON['stringify'](_0x2dfc54));if(_0x2dfc54[_0x3e2c('0x17')]){if(_0x2dfc54[_0x3e2c('0x17')]['code']===0x1f4){logger[_0x3e2c('0x17')](_0x3e2c('0x13'),_0x28039a,_0x2dfc54[_0x3e2c('0x17')][_0x3e2c('0x18')]);return _0x2be57d(_0x2dfc54['error'][_0x3e2c('0x18')]);}logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x28039a,_0x2dfc54['error'][_0x3e2c('0x18')]);return _0x43ea62(_0x2dfc54['error'][_0x3e2c('0x18')]);}else{logger[_0x3e2c('0x12')](_0x3e2c('0x13'),_0x28039a,_0x3e2c('0x14'));_0x43ea62(_0x2dfc54[_0x3e2c('0x19')][_0x3e2c('0x18')]);}})[_0x3e2c('0x1a')](function(_0x18ed1c){logger[_0x3e2c('0x17')](_0x3e2c('0x13'),_0x28039a,_0x18ed1c);_0x2be57d(_0x18ed1c);});});}exports['GetVoiceQueueReport']=function(_0xfa3080){var _0x8ce72c=this;return new Promise(function(_0x4fd559,_0x1bd969){return db[_0x3e2c('0x1b')]['findAll']({'raw':_0xfa3080[_0x3e2c('0x1c')]?_0xfa3080['options'][_0x3e2c('0x1d')]===undefined?!![]:![]:!![],'where':_0xfa3080[_0x3e2c('0x1c')]?_0xfa3080[_0x3e2c('0x1c')][_0x3e2c('0x1e')]||null:null,'attributes':_0xfa3080[_0x3e2c('0x1c')]?_0xfa3080[_0x3e2c('0x1c')][_0x3e2c('0x1f')]||null:null,'limit':_0xfa3080[_0x3e2c('0x1c')]?_0xfa3080[_0x3e2c('0x1c')][_0x3e2c('0x20')]||null:null,'include':_0xfa3080['options']?_0xfa3080[_0x3e2c('0x1c')][_0x3e2c('0x21')]?_[_0x3e2c('0x22')](_0xfa3080[_0x3e2c('0x1c')][_0x3e2c('0x21')],function(_0x1abf89){return{'model':db[_0x1abf89[_0x3e2c('0x23')]],'as':_0x1abf89['as'],'attributes':_0x1abf89[_0x3e2c('0x1f')],'include':_0x1abf89[_0x3e2c('0x21')]?_[_0x3e2c('0x22')](_0x1abf89[_0x3e2c('0x21')],function(_0x648107){return{'model':db[_0x648107[_0x3e2c('0x23')]],'as':_0x648107['as'],'attributes':_0x648107[_0x3e2c('0x1f')],'include':_0x648107[_0x3e2c('0x21')]?_[_0x3e2c('0x22')](_0x648107[_0x3e2c('0x21')],function(_0x387f66){return{'model':db[_0x387f66[_0x3e2c('0x23')]],'as':_0x387f66['as'],'attributes':_0x387f66['attributes']};}):[]};}):[]};}):[]:[]})[_0x3e2c('0x11')](function(_0x202beb){logger[_0x3e2c('0x12')](_0x3e2c('0x24'),_0xfa3080);logger[_0x3e2c('0x15')](_0x3e2c('0x24'),_0xfa3080,JSON[_0x3e2c('0x25')](_0x202beb));_0x4fd559(_0x202beb);})[_0x3e2c('0x1a')](function(_0x39cb98){logger[_0x3e2c('0x17')](_0x3e2c('0x24'),_0x39cb98[_0x3e2c('0x18')],_0xfa3080);_0x1bd969(_0x8ce72c[_0x3e2c('0x17')](0x1f4,_0x39cb98[_0x3e2c('0x18')]));});});};exports[_0x3e2c('0x26')]=function(_0xbae642){var _0x4ed39c=this;return new Promise(function(_0x40ebdf,_0x144446){return db[_0x3e2c('0x1b')][_0x3e2c('0x27')](_0xbae642[_0x3e2c('0x28')],{'raw':_0xbae642[_0x3e2c('0x1c')]?_0xbae642['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x626c09){logger['info']('CreateVoiceQueueReport',_0xbae642);logger[_0x3e2c('0x15')](_0x3e2c('0x26'),_0xbae642,JSON[_0x3e2c('0x25')](_0x626c09));_0x40ebdf(_0x626c09);})[_0x3e2c('0x1a')](function(_0x3732c3){logger[_0x3e2c('0x17')](_0x3e2c('0x26'),_0x3732c3[_0x3e2c('0x18')],_0xbae642);_0x144446(_0x4ed39c[_0x3e2c('0x17')](0x1f4,_0x3732c3['message']));});});};exports[_0x3e2c('0x29')]=function(_0x1c823b){var _0x129c02=this;return new Promise(function(_0x159529,_0x44d8aa){return db[_0x3e2c('0x1b')][_0x3e2c('0x2a')](_0x1c823b[_0x3e2c('0x28')],{'raw':_0x1c823b['options']?_0x1c823b[_0x3e2c('0x1c')][_0x3e2c('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c823b[_0x3e2c('0x1c')]?_0x1c823b[_0x3e2c('0x1c')]['where']||null:null,'attributes':_0x1c823b[_0x3e2c('0x1c')]?_0x1c823b['options'][_0x3e2c('0x1f')]||null:null,'limit':_0x1c823b[_0x3e2c('0x1c')]?_0x1c823b[_0x3e2c('0x1c')][_0x3e2c('0x20')]||null:null})[_0x3e2c('0x11')](function(_0x5d4c19){logger['info'](_0x3e2c('0x29'),_0x1c823b);logger['debug']('UpdateVoiceQueueReport',_0x1c823b,JSON[_0x3e2c('0x25')](_0x5d4c19));_0x159529(_0x5d4c19);})[_0x3e2c('0x1a')](function(_0x2decbf){logger[_0x3e2c('0x17')](_0x3e2c('0x29'),_0x2decbf[_0x3e2c('0x18')],_0x1c823b);_0x44d8aa(_0x129c02[_0x3e2c('0x17')](0x1f4,_0x2decbf['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index fc0d3ed..afdf81e 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 _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 +var _0xcdd0=['voiceQueueReport:','./voiceQueueReport.events','save','remove','update','removeListener','register','length'];(function(_0x499210,_0x325b29){var _0x2e153d=function(_0x951263){while(--_0x951263){_0x499210['push'](_0x499210['shift']());}};_0x2e153d(++_0x325b29);}(_0xcdd0,0xd9));var _0x0cdd=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xcdd0[_0x2d8fc2];return _0x3a9e53;};'use strict';var VoiceQueueReportEvents=require(_0x0cdd('0x0'));var events=[_0x0cdd('0x1'),_0x0cdd('0x2'),_0x0cdd('0x3')];function createListener(_0x526217,_0x167a54){return function(_0x5b97f9){_0x167a54['emit'](_0x526217,_0x5b97f9);};}function removeListener(_0x2ff2d3,_0x586e63){return function(){VoiceQueueReportEvents[_0x0cdd('0x4')](_0x2ff2d3,_0x586e63);};}exports[_0x0cdd('0x5')]=function(_0xe80a73){for(var _0x5ca0f9=0x0,_0x27126f=events[_0x0cdd('0x6')];_0x5ca0f9<_0x27126f;_0x5ca0f9++){var _0xd69bd8=events[_0x5ca0f9];var _0x2587d4=createListener(_0x0cdd('0x7')+_0xd69bd8,_0xe80a73);VoiceQueueReportEvents['on'](_0xd69bd8,_0x2587d4);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 832e5fd..5fbbe2f 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 _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 +var _0x0076=['/:id','post','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x0076,0x1e2));var _0x6007=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x0076[_0x4f9b18];return _0x29f20c;};'use strict';var multer=require(_0x6007('0x0'));var util=require(_0x6007('0x1'));var path=require('path');var timeout=require(_0x6007('0x2'));var express=require(_0x6007('0x3'));var router=express[_0x6007('0x4')]();var fs_extra=require(_0x6007('0x5'));var auth=require(_0x6007('0x6'));var interaction=require(_0x6007('0x7'));var config=require(_0x6007('0x8'));var controller=require('./voiceQueuesLog.controller');router['get']('/',auth[_0x6007('0x9')](),controller[_0x6007('0xa')]);router[_0x6007('0xb')](_0x6007('0xc'),auth[_0x6007('0x9')](),controller['show']);router[_0x6007('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6007('0xe')](_0x6007('0xc'),auth['isAuthenticated'](),controller[_0x6007('0xf')]);router[_0x6007('0x10')](_0x6007('0xc'),auth[_0x6007('0x9')](),controller[_0x6007('0x11')]);module[_0x6007('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 2e2efbd..7e7835c 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 _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 +var _0x61e1=['exports','STRING','DATE','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize'];(function(_0xa3b7a4,_0x3a6e35){var _0x23ce3e=function(_0x239a42){while(--_0x239a42){_0xa3b7a4['push'](_0xa3b7a4['shift']());}};_0x23ce3e(++_0x3a6e35);}(_0x61e1,0x191));var _0x161e=function(_0x3b45d7,_0x1763fb){_0x3b45d7=_0x3b45d7-0x0;var _0x2f29dc=_0x61e1[_0x3b45d7];return _0x2f29dc;};'use strict';var Sequelize=require(_0x161e('0x0'));var moment=require('moment');module[_0x161e('0x1')]={'time':{'type':Sequelize[_0x161e('0x2')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x161e('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x161e('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x161e('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x161e('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x161e('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x161e('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x161e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0x161e('0x4')](_0x161e('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index cf6a3c2..14f47f7 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 _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 +var _0xae22=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','then','error','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','rimraf','zip-dir','fast-json-patch','moment','path','sox'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0xae22,0x8e));var _0x2ae2=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xae22[_0x187ee1];return _0x388160;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2ae2('0x0'));var zipdir=require(_0x2ae2('0x1'));var jsonpatch=require(_0x2ae2('0x2'));var rp=require('request-promise');var moment=require(_0x2ae2('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x2ae2('0x4'));var sox=require(_0x2ae2('0x5'));var csv=require(_0x2ae2('0x6'));var ejs=require(_0x2ae2('0x7'));var fs=require('fs');var fs_extra=require(_0x2ae2('0x8'));var _=require(_0x2ae2('0x9'));var squel=require(_0x2ae2('0xa'));var crypto=require(_0x2ae2('0xb'));var jsforce=require(_0x2ae2('0xc'));var deskjs=require(_0x2ae2('0xd'));var toCsv=require(_0x2ae2('0x6'));var querystring=require(_0x2ae2('0xe'));var Papa=require(_0x2ae2('0xf'));var Redis=require(_0x2ae2('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x2ae2('0x11'));var as=require(_0x2ae2('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2ae2('0x13'))(_0x2ae2('0x14'));var utils=require('../../config/utils');var config=require(_0x2ae2('0x15'));var licenseUtil=require(_0x2ae2('0x16'));var db=require(_0x2ae2('0x17'))['db'];function respondWithStatusCode(_0x4eb301,_0x5e5eb8){_0x5e5eb8=_0x5e5eb8||0xcc;return function(_0x5a19e4){if(_0x5a19e4){return _0x4eb301[_0x2ae2('0x18')](_0x5e5eb8);}return _0x4eb301[_0x2ae2('0x19')](_0x5e5eb8)[_0x2ae2('0x1a')]();};}function respondWithResult(_0x125ddb,_0x3b6c10){_0x3b6c10=_0x3b6c10||0xc8;return function(_0x1c2ac9){if(_0x1c2ac9){return _0x125ddb[_0x2ae2('0x19')](_0x3b6c10)[_0x2ae2('0x1b')](_0x1c2ac9);}};}function respondWithFilteredResult(_0x513773,_0x531457){return function(_0x2457aa){if(_0x2457aa){var _0x2accfe=typeof _0x531457[_0x2ae2('0x1c')]===_0x2ae2('0x1d')&&typeof _0x531457['limit']===_0x2ae2('0x1d');var _0x4664bb=_0x2457aa[_0x2ae2('0x1e')];var _0x272a1a=_0x2accfe?0x0:_0x531457[_0x2ae2('0x1c')];var _0x537f24=_0x2accfe?_0x2457aa[_0x2ae2('0x1e')]:_0x531457['offset']+_0x531457[_0x2ae2('0x1f')];var _0x4f2ec9;if(_0x537f24>=_0x4664bb){_0x537f24=_0x4664bb;_0x4f2ec9=0xc8;}else{_0x4f2ec9=0xce;}_0x513773['status'](_0x4f2ec9);return _0x513773[_0x2ae2('0x20')](_0x2ae2('0x21'),_0x272a1a+'-'+_0x537f24+'/'+_0x4664bb)[_0x2ae2('0x1b')](_0x2457aa);}return null;};}function patchUpdates(_0x11cd1d){return function(_0x2e7b0f){try{jsonpatch['apply'](_0x2e7b0f,_0x11cd1d,!![]);}catch(_0x27660d){return BPromise[_0x2ae2('0x22')](_0x27660d);}return _0x2e7b0f[_0x2ae2('0x23')]();};}function saveUpdates(_0x1a2781,_0x4f3899){return function(_0x10522e){if(_0x10522e){return _0x10522e[_0x2ae2('0x24')](_0x1a2781)['then'](function(_0x45c560){return _0x45c560;});}return null;};}function removeEntity(_0xd2d79d,_0xdc20cd){return function(_0x2e1b32){if(_0x2e1b32){return _0x2e1b32[_0x2ae2('0x25')]()[_0x2ae2('0x26')](function(){_0xd2d79d[_0x2ae2('0x19')](0xcc)[_0x2ae2('0x1a')]();});}};}function handleEntityNotFound(_0x46cab0,_0x12c1a4){return function(_0x419221){if(!_0x419221){_0x46cab0[_0x2ae2('0x18')](0x194);}return _0x419221;};}function handleError(_0x35749d,_0x11651f){_0x11651f=_0x11651f||0x1f4;return function(_0x26f45f){logger[_0x2ae2('0x27')](_0x26f45f[_0x2ae2('0x28')]);if(_0x26f45f[_0x2ae2('0x29')]){delete _0x26f45f['name'];}_0x35749d[_0x2ae2('0x19')](_0x11651f)[_0x2ae2('0x2a')](_0x26f45f);};}exports[_0x2ae2('0x2b')]=function(_0x5a1bae,_0x44a2a6){var _0x55172e={},_0x4510e0={},_0x199a6d={'count':0x0,'rows':[]};var _0x206862=_[_0x2ae2('0x2c')](db[_0x2ae2('0x2d')][_0x2ae2('0x2e')],function(_0x2a06c2){return{'name':_0x2a06c2[_0x2ae2('0x2f')],'type':_0x2a06c2[_0x2ae2('0x30')]['key']};});_0x4510e0[_0x2ae2('0x31')]=_['map'](_0x206862,'name');_0x4510e0[_0x2ae2('0x32')]=_['keys'](_0x5a1bae[_0x2ae2('0x32')]);_0x4510e0[_0x2ae2('0x33')]=_[_0x2ae2('0x34')](_0x4510e0[_0x2ae2('0x31')],_0x4510e0['query']);_0x55172e[_0x2ae2('0x35')]=_[_0x2ae2('0x34')](_0x4510e0['model'],qs['fields'](_0x5a1bae[_0x2ae2('0x32')][_0x2ae2('0x36')]));_0x55172e['attributes']=_0x55172e[_0x2ae2('0x35')][_0x2ae2('0x37')]?_0x55172e[_0x2ae2('0x35')]:_0x4510e0[_0x2ae2('0x31')];if(!_0x5a1bae[_0x2ae2('0x32')][_0x2ae2('0x38')]('nolimit')){_0x55172e[_0x2ae2('0x1f')]=qs[_0x2ae2('0x1f')](_0x5a1bae[_0x2ae2('0x32')][_0x2ae2('0x1f')]);_0x55172e[_0x2ae2('0x1c')]=qs[_0x2ae2('0x1c')](_0x5a1bae[_0x2ae2('0x32')][_0x2ae2('0x1c')]);}_0x55172e[_0x2ae2('0x39')]=qs['sort'](_0x5a1bae[_0x2ae2('0x32')]['sort']);_0x55172e[_0x2ae2('0x3a')]=qs['filters'](_[_0x2ae2('0x3b')](_0x5a1bae['query'],_0x4510e0[_0x2ae2('0x33')]),_0x206862);if(_0x5a1bae[_0x2ae2('0x32')][_0x2ae2('0x3c')]){_0x55172e['where']=_[_0x2ae2('0x3d')](_0x55172e['where'],{'$or':_['map'](_0x206862,function(_0x349eb9){if(_0x349eb9['type']!==_0x2ae2('0x3e')){var _0x529954={};_0x529954[_0x349eb9[_0x2ae2('0x29')]]={'$like':'%'+_0x5a1bae[_0x2ae2('0x32')][_0x2ae2('0x3c')]+'%'};return _0x529954;}})});}_0x55172e=_[_0x2ae2('0x3d')]({},_0x55172e,_0x5a1bae[_0x2ae2('0x3f')]);var _0x13f013={'where':_0x55172e[_0x2ae2('0x3a')]};return db[_0x2ae2('0x2d')][_0x2ae2('0x1e')](_0x13f013)[_0x2ae2('0x26')](function(_0x370b0d){_0x199a6d[_0x2ae2('0x1e')]=_0x370b0d;if(_0x5a1bae['query'][_0x2ae2('0x40')]){_0x55172e[_0x2ae2('0x41')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0x2ae2('0x42')](_0x55172e);})[_0x2ae2('0x26')](function(_0x150963){_0x199a6d['rows']=_0x150963;return _0x199a6d;})[_0x2ae2('0x26')](respondWithFilteredResult(_0x44a2a6,_0x55172e))[_0x2ae2('0x43')](handleError(_0x44a2a6,null));};exports[_0x2ae2('0x44')]=function(_0x37cef1,_0x55e779){var _0x4d8c88={'raw':!![],'where':{'id':_0x37cef1[_0x2ae2('0x45')]['id']}},_0x5cfafa={};_0x5cfafa[_0x2ae2('0x31')]=_[_0x2ae2('0x46')](db[_0x2ae2('0x2d')]['rawAttributes']);_0x5cfafa[_0x2ae2('0x32')]=_['keys'](_0x37cef1[_0x2ae2('0x32')]);_0x5cfafa['filters']=_[_0x2ae2('0x34')](_0x5cfafa[_0x2ae2('0x31')],_0x5cfafa['query']);_0x4d8c88[_0x2ae2('0x35')]=_[_0x2ae2('0x34')](_0x5cfafa['model'],qs[_0x2ae2('0x36')](_0x37cef1[_0x2ae2('0x32')]['fields']));_0x4d8c88['attributes']=_0x4d8c88['attributes']['length']?_0x4d8c88['attributes']:_0x5cfafa[_0x2ae2('0x31')];if(_0x37cef1[_0x2ae2('0x32')][_0x2ae2('0x40')]){_0x4d8c88[_0x2ae2('0x41')]=[{'all':!![]}];}_0x4d8c88=_[_0x2ae2('0x3d')]({},_0x4d8c88,_0x37cef1['options']);return db[_0x2ae2('0x2d')][_0x2ae2('0x47')](_0x4d8c88)[_0x2ae2('0x26')](handleEntityNotFound(_0x55e779,null))[_0x2ae2('0x26')](respondWithResult(_0x55e779,null))[_0x2ae2('0x43')](handleError(_0x55e779,null));};exports[_0x2ae2('0x48')]=function(_0x585288,_0x44863a){return db[_0x2ae2('0x2d')]['create'](_0x585288[_0x2ae2('0x49')],{})['then'](respondWithResult(_0x44863a,0xc9))[_0x2ae2('0x43')](handleError(_0x44863a,null));};exports[_0x2ae2('0x24')]=function(_0x3d485b,_0xb04094){if(_0x3d485b[_0x2ae2('0x49')]['id']){delete _0x3d485b['body']['id'];}return db[_0x2ae2('0x2d')]['find']({'where':{'id':_0x3d485b['params']['id']}})[_0x2ae2('0x26')](handleEntityNotFound(_0xb04094,null))[_0x2ae2('0x26')](saveUpdates(_0x3d485b['body'],null))[_0x2ae2('0x26')](respondWithResult(_0xb04094,null))[_0x2ae2('0x43')](handleError(_0xb04094,null));};exports[_0x2ae2('0x25')]=function(_0x4b5286,_0x575b0e){return db['VoiceQueuesLog'][_0x2ae2('0x47')]({'where':{'id':_0x4b5286[_0x2ae2('0x45')]['id']}})['then'](handleEntityNotFound(_0x575b0e,null))[_0x2ae2('0x26')](removeEntity(_0x575b0e,null))[_0x2ae2('0x43')](handleError(_0x575b0e,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 29d39ea..e8ec81b 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 _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 +var _0x963a=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','util'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x963a,0xbe));var _0xa963=function(_0x28d24f,_0x2d5d4a){_0x28d24f=_0x28d24f-0x0;var _0x3aa28c=_0x963a[_0x28d24f];return _0x3aa28c;};'use strict';var _=require(_0xa963('0x0'));var util=require(_0xa963('0x1'));var logger=require(_0xa963('0x2'))(_0xa963('0x3'));var moment=require(_0xa963('0x4'));var BPromise=require(_0xa963('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa963('0x6'));var rimraf=require(_0xa963('0x7'));var config=require(_0xa963('0x8'));var attributes=require(_0xa963('0x9'));module['exports']=function(_0x34110d,_0x4c9765){return _0x34110d[_0xa963('0xa')](_0xa963('0xb'),attributes,{'tableName':_0xa963('0xc'),'paranoid':![],'indexes':[{'name':_0xa963('0xd'),'fields':[_0xa963('0xe'),_0xa963('0xf')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 353ca38..36ee75a 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 _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 +var _0xfa7a=['request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceQueuesLog,\x20%s,\x20%s','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x438d85,_0x35ca07){var _0x2d4d89=function(_0x3cc562){while(--_0x3cc562){_0x438d85['push'](_0x438d85['shift']());}};_0x2d4d89(++_0x35ca07);}(_0xfa7a,0x1ed));var _0xafa7=function(_0x5bf9f5,_0xf8ebfd){_0x5bf9f5=_0x5bf9f5-0x0;var _0x150415=_0xfa7a[_0x5bf9f5];return _0x150415;};'use strict';var _=require(_0xafa7('0x0'));var util=require(_0xafa7('0x1'));var moment=require(_0xafa7('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xafa7('0x3'));var db=require(_0xafa7('0x4'))['db'];var utils=require(_0xafa7('0x5'));var logger=require(_0xafa7('0x6'))('rpc');var config=require(_0xafa7('0x7'));var jayson=require(_0xafa7('0x8'));var client=jayson[_0xafa7('0x9')][_0xafa7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2fc26e,_0x91c971,_0x1d8552){return new BPromise(function(_0x41103b,_0x5a9b0c){return client[_0xafa7('0xb')](_0x2fc26e,_0x1d8552)['then'](function(_0x42f79b){logger[_0xafa7('0xc')]('VoiceQueuesLog,\x20%s,\x20%s',_0x91c971,_0xafa7('0xd'));logger[_0xafa7('0xe')](_0xafa7('0xf'),_0x91c971,_0xafa7('0xd'),JSON[_0xafa7('0x10')](_0x42f79b));if(_0x42f79b[_0xafa7('0x11')]){if(_0x42f79b[_0xafa7('0x11')][_0xafa7('0x12')]===0x1f4){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x91c971,_0x42f79b[_0xafa7('0x11')]['message']);return _0x5a9b0c(_0x42f79b[_0xafa7('0x11')][_0xafa7('0x13')]);}logger['error'](_0xafa7('0x14'),_0x91c971,_0x42f79b['error'][_0xafa7('0x13')]);return _0x41103b(_0x42f79b['error'][_0xafa7('0x13')]);}else{logger[_0xafa7('0xc')]('VoiceQueuesLog,\x20%s,\x20%s',_0x91c971,_0xafa7('0xd'));_0x41103b(_0x42f79b['result']['message']);}})[_0xafa7('0x15')](function(_0x58c121){logger[_0xafa7('0x11')]('VoiceQueuesLog,\x20%s,\x20%s',_0x91c971,_0x58c121);_0x5a9b0c(_0x58c121);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 40599bd..5473d1f 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 _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 +var _0xe619=['post','create','/:id/transcribe','runTranscribe','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/download','download','/:id/downloads','downloads','downloadTranscribe'];(function(_0x7b6e31,_0x35b606){var _0x53e962=function(_0x1fc72e){while(--_0x1fc72e){_0x7b6e31['push'](_0x7b6e31['shift']());}};_0x53e962(++_0x35b606);}(_0xe619,0x1e4));var _0x9e61=function(_0x25e905,_0x42f080){_0x25e905=_0x25e905-0x0;var _0x4d1f16=_0xe619[_0x25e905];return _0x4d1f16;};'use strict';var multer=require(_0x9e61('0x0'));var util=require(_0x9e61('0x1'));var path=require(_0x9e61('0x2'));var timeout=require(_0x9e61('0x3'));var express=require('express');var router=express[_0x9e61('0x4')]();var fs_extra=require(_0x9e61('0x5'));var auth=require(_0x9e61('0x6'));var interaction=require(_0x9e61('0x7'));var config=require('../../config/environment');var controller=require('./voiceRecording.controller');router[_0x9e61('0x8')]('/',auth['isAuthenticated'](),controller[_0x9e61('0x9')]);router[_0x9e61('0x8')](_0x9e61('0xa'),auth[_0x9e61('0xb')](),controller[_0x9e61('0xc')]);router[_0x9e61('0x8')](_0x9e61('0xd'),auth[_0x9e61('0xb')](),controller[_0x9e61('0xe')]);router[_0x9e61('0x8')](_0x9e61('0xf'),auth[_0x9e61('0xb')](),controller[_0x9e61('0x10')]);router['get'](_0x9e61('0x11'),controller[_0x9e61('0x12')]);router['get']('/:id/transcribe',auth[_0x9e61('0xb')](),controller[_0x9e61('0x13')]);router[_0x9e61('0x14')]('/',auth[_0x9e61('0xb')](),controller[_0x9e61('0x15')]);router[_0x9e61('0x14')](_0x9e61('0x16'),auth['isAuthenticated'](),controller[_0x9e61('0x17')]);router[_0x9e61('0x18')](_0x9e61('0xd'),auth[_0x9e61('0xb')](),controller[_0x9e61('0x19')]);router['delete'](_0x9e61('0xd'),auth[_0x9e61('0xb')](),controller[_0x9e61('0x1a')]);module[_0x9e61('0x1b')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 17362ac..bc025df 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(_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 +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(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'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 b1bff0c..3e42faa 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 _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 +var _0x4dc3=['lodash','crypto','jsforce','querystring','papaparse','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','destroy','then','end','error','stack','name','index','VoiceRecording','rawAttributes','type','key','model','differenceBy','map','format','query','fields','attributes','nolimit','order','sort','where','filters','pick','filter','merge','options','include','rows','show','keys','intersection','length','includeAll','catch','create','body','params','describe','download','../../components/encryptor','uniqueid','find','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','send','Not\x20found','downloads','sequelize','col','$and','push','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','TranscriptionJob','TranscriptionJobName','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data2','data1','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','transcribeStatus','NEW','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','mustache','path','sox','to-csv','ejs'];(function(_0x47a40b,_0x443ecf){var _0x19610c=function(_0x4b8ce1){while(--_0x4b8ce1){_0x47a40b['push'](_0x47a40b['shift']());}};_0x19610c(++_0x443ecf);}(_0x4dc3,0x1c7));var _0x34dc=function(_0x406e46,_0x5799cb){_0x406e46=_0x406e46-0x0;var _0x4a3742=_0x4dc3[_0x406e46];return _0x4a3742;};'use strict';var emlformat=require(_0x34dc('0x0'));var rimraf=require(_0x34dc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x34dc('0x2'));var util=require('util');var path=require(_0x34dc('0x3'));var sox=require(_0x34dc('0x4'));var csv=require(_0x34dc('0x5'));var ejs=require(_0x34dc('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x34dc('0x7'));var squel=require('squel');var crypto=require(_0x34dc('0x8'));var jsforce=require(_0x34dc('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x34dc('0xa'));var Papa=require(_0x34dc('0xb'));var AWS=require('aws-sdk');var uuidv4=require(_0x34dc('0xc'));var Redis=require(_0x34dc('0xd'));var authService=require(_0x34dc('0xe'));var qs=require(_0x34dc('0xf'));var as=require(_0x34dc('0x10'));var hardwareService=require(_0x34dc('0x11'));var logger=require(_0x34dc('0x12'))(_0x34dc('0x13'));var utils=require(_0x34dc('0x14'));var config=require(_0x34dc('0x15'));var licenseUtil=require(_0x34dc('0x16'));var db=require(_0x34dc('0x17'))['db'];function respondWithStatusCode(_0x4f306d,_0x43e807){_0x43e807=_0x43e807||0xcc;return function(_0x5a8123){if(_0x5a8123){return _0x4f306d[_0x34dc('0x18')](_0x43e807);}return _0x4f306d[_0x34dc('0x19')](_0x43e807)['end']();};}function respondWithResult(_0x26a2c7,_0x20e9be){_0x20e9be=_0x20e9be||0xc8;return function(_0x5b893b){if(_0x5b893b){return _0x26a2c7[_0x34dc('0x19')](_0x20e9be)[_0x34dc('0x1a')](_0x5b893b);}};}function respondWithFilteredResult(_0x464fd8,_0x4ebefa){return function(_0x813bb9){if(_0x813bb9){var _0x2f64df=typeof _0x4ebefa[_0x34dc('0x1b')]==='undefined'&&typeof _0x4ebefa[_0x34dc('0x1c')]===_0x34dc('0x1d');var _0x39216e=_0x813bb9[_0x34dc('0x1e')];var _0x407dbb=_0x2f64df?0x0:_0x4ebefa['offset'];var _0x1fbb73=_0x2f64df?_0x813bb9['count']:_0x4ebefa[_0x34dc('0x1b')]+_0x4ebefa['limit'];var _0x10eede;if(_0x1fbb73>=_0x39216e){_0x1fbb73=_0x39216e;_0x10eede=0xc8;}else{_0x10eede=0xce;}_0x464fd8[_0x34dc('0x19')](_0x10eede);return _0x464fd8[_0x34dc('0x1f')](_0x34dc('0x20'),_0x407dbb+'-'+_0x1fbb73+'/'+_0x39216e)[_0x34dc('0x1a')](_0x813bb9);}return null;};}function patchUpdates(_0x15ca3f){return function(_0x95cef3){try{jsonpatch[_0x34dc('0x21')](_0x95cef3,_0x15ca3f,!![]);}catch(_0x8d2d5f){return BPromise[_0x34dc('0x22')](_0x8d2d5f);}return _0x95cef3['save']();};}function saveUpdates(_0x29f5bb,_0x39bbf4){return function(_0x266aee){if(_0x266aee){return _0x266aee[_0x34dc('0x23')](_0x29f5bb)['then'](function(_0x3ae928){return _0x3ae928;});}return null;};}function removeEntity(_0x1ef5ec,_0xb8b8f6){return function(_0x3bb4b8){if(_0x3bb4b8){return _0x3bb4b8[_0x34dc('0x24')]()[_0x34dc('0x25')](function(){_0x1ef5ec['status'](0xcc)[_0x34dc('0x26')]();});}};}function handleEntityNotFound(_0x434ab0,_0xce4afd){return function(_0x4ae680){if(!_0x4ae680){_0x434ab0[_0x34dc('0x18')](0x194);}return _0x4ae680;};}function handleError(_0x21d9c4,_0x4baf05){_0x4baf05=_0x4baf05||0x1f4;return function(_0x48b617){logger[_0x34dc('0x27')](_0x48b617[_0x34dc('0x28')]);if(_0x48b617[_0x34dc('0x29')]){delete _0x48b617[_0x34dc('0x29')];}_0x21d9c4[_0x34dc('0x19')](_0x4baf05)['send'](_0x48b617);};}exports[_0x34dc('0x2a')]=function(_0x2222a6,_0x293b10){var _0x1816c6={},_0x2c681c={},_0x289821={'count':0x0,'rows':[]};var _0x380d2e=_['map'](db[_0x34dc('0x2b')][_0x34dc('0x2c')],function(_0x19a7d1){return{'name':_0x19a7d1['fieldName'],'type':_0x19a7d1[_0x34dc('0x2d')][_0x34dc('0x2e')]};});_0x2c681c[_0x34dc('0x2f')]=_[_0x34dc('0x30')](_[_0x34dc('0x31')](_0x380d2e,_0x34dc('0x29')),[_0x34dc('0x32')]);_0x2c681c[_0x34dc('0x33')]=_['keys'](_0x2222a6['query']);_0x2c681c['filters']=_['intersection'](_0x2c681c['model'],_0x2c681c[_0x34dc('0x33')]);_0x1816c6['attributes']=_['intersection'](_0x2c681c[_0x34dc('0x2f')],qs[_0x34dc('0x34')](_0x2222a6['query'][_0x34dc('0x34')]));_0x1816c6[_0x34dc('0x35')]=_0x1816c6[_0x34dc('0x35')]['length']?_0x1816c6[_0x34dc('0x35')]:_0x2c681c[_0x34dc('0x2f')];if(!_0x2222a6[_0x34dc('0x33')]['hasOwnProperty'](_0x34dc('0x36'))){_0x1816c6['limit']=qs[_0x34dc('0x1c')](_0x2222a6[_0x34dc('0x33')][_0x34dc('0x1c')]);_0x1816c6[_0x34dc('0x1b')]=qs[_0x34dc('0x1b')](_0x2222a6[_0x34dc('0x33')][_0x34dc('0x1b')]);}_0x1816c6[_0x34dc('0x37')]=qs[_0x34dc('0x38')](_0x2222a6[_0x34dc('0x33')]['sort']);_0x1816c6[_0x34dc('0x39')]=qs[_0x34dc('0x3a')](_[_0x34dc('0x3b')](_0x2222a6['query'],_0x2c681c[_0x34dc('0x3a')]),_0x380d2e);if(_0x2222a6[_0x34dc('0x33')][_0x34dc('0x3c')]){_0x1816c6[_0x34dc('0x39')]=_[_0x34dc('0x3d')](_0x1816c6['where'],{'$or':_[_0x34dc('0x31')](_0x380d2e,function(_0x377155){if(_0x377155[_0x34dc('0x2d')]!=='VIRTUAL'){var _0x470da1={};_0x470da1[_0x377155[_0x34dc('0x29')]]={'$like':'%'+_0x2222a6['query'][_0x34dc('0x3c')]+'%'};return _0x470da1;}})});}_0x1816c6=_[_0x34dc('0x3d')]({},_0x1816c6,_0x2222a6[_0x34dc('0x3e')]);var _0x5298bf={'where':_0x1816c6[_0x34dc('0x39')]};return db[_0x34dc('0x2b')][_0x34dc('0x1e')](_0x5298bf)[_0x34dc('0x25')](function(_0x41323b){_0x289821[_0x34dc('0x1e')]=_0x41323b;if(_0x2222a6['query']['includeAll']){_0x1816c6[_0x34dc('0x3f')]=[{'all':!![]}];}return db[_0x34dc('0x2b')]['findAll'](_0x1816c6);})[_0x34dc('0x25')](function(_0x2578bf){_0x289821[_0x34dc('0x40')]=_0x2578bf;return _0x289821;})[_0x34dc('0x25')](respondWithFilteredResult(_0x293b10,_0x1816c6))['catch'](handleError(_0x293b10,null));};exports[_0x34dc('0x41')]=function(_0xe18c2a,_0x3ff9c5){var _0xc23c3c={'raw':![],'where':{'id':_0xe18c2a['params']['id']}},_0x523d1e={};_0x523d1e['model']=_[_0x34dc('0x42')](db['VoiceRecording'][_0x34dc('0x2c')]);_0x523d1e[_0x34dc('0x33')]=_[_0x34dc('0x42')](_0xe18c2a[_0x34dc('0x33')]);_0x523d1e[_0x34dc('0x3a')]=_[_0x34dc('0x43')](_0x523d1e[_0x34dc('0x2f')],_0x523d1e['query']);_0xc23c3c['attributes']=_[_0x34dc('0x43')](_0x523d1e[_0x34dc('0x2f')],qs[_0x34dc('0x34')](_0xe18c2a['query']['fields']));_0xc23c3c['attributes']=_0xc23c3c[_0x34dc('0x35')][_0x34dc('0x44')]?_0xc23c3c[_0x34dc('0x35')]:_0x523d1e['model'];if(_0xe18c2a[_0x34dc('0x33')][_0x34dc('0x45')]){_0xc23c3c[_0x34dc('0x3f')]=[{'all':!![]}];}_0xc23c3c=_[_0x34dc('0x3d')]({},_0xc23c3c,_0xe18c2a['options']);return db[_0x34dc('0x2b')]['find'](_0xc23c3c)[_0x34dc('0x25')](handleEntityNotFound(_0x3ff9c5,null))['then'](respondWithResult(_0x3ff9c5,null))[_0x34dc('0x46')](handleError(_0x3ff9c5,null));};exports[_0x34dc('0x47')]=function(_0x2c9e50,_0x3ad9b0){return db[_0x34dc('0x2b')]['create'](_0x2c9e50['body'],{})[_0x34dc('0x25')](respondWithResult(_0x3ad9b0,0xc9))['catch'](handleError(_0x3ad9b0,null));};exports['update']=function(_0x227cd9,_0x2b3187){if(_0x227cd9[_0x34dc('0x48')]['id']){delete _0x227cd9['body']['id'];}return db[_0x34dc('0x2b')]['find']({'where':{'id':_0x227cd9[_0x34dc('0x49')]['id']}})['then'](handleEntityNotFound(_0x2b3187,null))[_0x34dc('0x25')](saveUpdates(_0x227cd9[_0x34dc('0x48')],null))[_0x34dc('0x25')](respondWithResult(_0x2b3187,null))[_0x34dc('0x46')](handleError(_0x2b3187,null));};exports[_0x34dc('0x4a')]=function(_0x24a2ce,_0xd75f76){return db[_0x34dc('0x2b')][_0x34dc('0x4a')]()['then'](respondWithResult(_0xd75f76,null))['catch'](handleError(_0xd75f76,null));};exports[_0x34dc('0x4b')]=function(_0x179b61,_0x5a20ea,_0x42188c){var _0x4601db=require(_0x34dc('0x4c'));var _0x5b597f=![];var _0x2833b8={};if(_0x179b61[_0x34dc('0x33')][_0x34dc('0x2d')]&&_0x179b61[_0x34dc('0x33')]['type']===_0x34dc('0x4d')){_0x2833b8[_0x34dc('0x4d')]=_0x179b61[_0x34dc('0x49')]['id'];}else{_0x2833b8['id']=_0x179b61[_0x34dc('0x49')]['id'];}return db[_0x34dc('0x2b')][_0x34dc('0x4e')]({'where':_0x2833b8,'attributes':['id',_0x34dc('0x4f')],'raw':!![]})[_0x34dc('0x25')](handleEntityNotFound(_0x5a20ea,null))[_0x34dc('0x25')](function(_0x3b2e36){if(_0x3b2e36){var _0x2bfee0=_0x3b2e36['value'];var _0x1caf0a=util[_0x34dc('0x32')](_0x34dc('0x50'),_0x2bfee0);if(fs[_0x34dc('0x51')](_0x1caf0a)){_0x5b597f=!![];return _0x4601db[_0x34dc('0x52')](_0x1caf0a,_0x2bfee0,config[_0x34dc('0x53')][_0x34dc('0x54')])['then'](function(){return _0x3b2e36;});}return _0x3b2e36;}})[_0x34dc('0x25')](function(_0x1a5f76){if(_0x1a5f76){var _0x1996c2=_0x1a5f76[_0x34dc('0x4f')];if(!fs[_0x34dc('0x51')](_0x1996c2)){throw new db[(_0x34dc('0x55'))][(_0x34dc('0x56'))](_0x34dc('0x57'));}if(_0x1a5f76[_0x34dc('0x58')]){return _0x5a20ea[_0x34dc('0x4b')](_0x1996c2,_0x1a5f76[_0x34dc('0x58')]+path[_0x34dc('0x59')](_0x1996c2),function(){if(_0x5b597f){fs[_0x34dc('0x5a')](_0x1996c2);}});}else{return _0x5a20ea[_0x34dc('0x4b')](_0x1996c2,function(_0x78befb){if(_0x5b597f){fs[_0x34dc('0x5a')](_0x1996c2);}});}}})[_0x34dc('0x46')](function(_0x1e20ac){if(_0x1e20ac[_0x34dc('0x5b')]===_0x34dc('0x57')){_0x5a20ea['status'](0x194)[_0x34dc('0x5c')](_0x34dc('0x5d'));}else{return handleError(_0x5a20ea,null);}});};exports[_0x34dc('0x5e')]=function(_0x4bd20a,_0x232584,_0x15ac77){var _0x50000c=require('../../components/encryptor');var _0x24383b=![];var _0xc508={'$and':[db['sequelize'][_0x34dc('0x39')](db[_0x34dc('0x5f')]['fn']('MD5',db[_0x34dc('0x5f')][_0x34dc('0x60')]('uniqueid')),_0x4bd20a[_0x34dc('0x33')]['token'])]};if(_0x4bd20a['query'][_0x34dc('0x2d')]&&_0x4bd20a[_0x34dc('0x33')][_0x34dc('0x2d')]===_0x34dc('0x4d')){_0xc508[_0x34dc('0x61')][_0x34dc('0x62')]({'uniqueid':_0x4bd20a[_0x34dc('0x49')]['id']});}else{_0xc508[_0x34dc('0x61')]['push']({'id':_0x4bd20a[_0x34dc('0x49')]['id']});}return db['VoiceRecording']['find']({'where':_0xc508,'attributes':['id','value'],'raw':!![]})[_0x34dc('0x25')](handleEntityNotFound(_0x232584,null))['then'](function(_0x4762a6){if(_0x4762a6){var _0x1d9495=util[_0x34dc('0x32')](_0x34dc('0x50'),_0x4762a6[_0x34dc('0x4f')]);if(fs[_0x34dc('0x51')](_0x1d9495)){_0x24383b=!![];return _0x50000c[_0x34dc('0x52')](_0x1d9495,_0x4762a6['value'],config[_0x34dc('0x53')]['recording'])[_0x34dc('0x25')](function(){return _0x4762a6;});}return _0x4762a6;}})['then'](function(_0x2cf696){if(_0x2cf696){if(!fs[_0x34dc('0x51')](_0x2cf696[_0x34dc('0x4f')])){throw new db[(_0x34dc('0x55'))][(_0x34dc('0x56'))]('VoiceRecording\x20not\x20found');}if(_0x2cf696[_0x34dc('0x58')]){return _0x232584['download'](_0x2cf696[_0x34dc('0x4f')],_0x2cf696[_0x34dc('0x58')]+path[_0x34dc('0x59')](_0x2cf696[_0x34dc('0x4f')]),function(){if(_0x24383b){fs[_0x34dc('0x5a')](_0x2cf696[_0x34dc('0x4f')]);}});}else{return _0x232584[_0x34dc('0x4b')](_0x2cf696[_0x34dc('0x4f')],function(_0x223332){if(_0x24383b){fs[_0x34dc('0x5a')](_0x2cf696['value']);}});}}})[_0x34dc('0x46')](handleError(_0x232584,null));};exports[_0x34dc('0x24')]=function(_0x70cf2e,_0x15df2c){return db[_0x34dc('0x2b')][_0x34dc('0x4e')]({'where':{'id':_0x70cf2e[_0x34dc('0x49')]['id']}})['then'](function(_0x34190e){if(_[_0x34dc('0x63')](_0x34190e)){throw new ReferenceError(_0x34dc('0x64'));}return _0x34190e;})['then'](function(_0x92ad99){var _0x5f2baa=_0x92ad99[_0x34dc('0x4f')];logger[_0x34dc('0x65')](_0x34dc('0x66'),_0x5f2baa);if(!_[_0x34dc('0x63')](_0x92ad99[_0x34dc('0x4f')])&&fs['existsSync'](_0x5f2baa)){logger[_0x34dc('0x65')](_0x34dc('0x67')+_0x5f2baa+_0x34dc('0x68'));fs['unlinkSync'](_0x5f2baa);}_0x5f2baa=_0x5f2baa+_0x34dc('0x69');if(!_[_0x34dc('0x63')](_0x92ad99['value'])&&fs[_0x34dc('0x51')](_0x5f2baa)){logger[_0x34dc('0x65')](_0x34dc('0x67')+_0x5f2baa+_0x34dc('0x68'));fs[_0x34dc('0x6a')](_0x5f2baa);}return _0x92ad99;})[_0x34dc('0x25')](function(_0x551f86){if(!_0x551f86)throw new InternalError();return _0x551f86[_0x34dc('0x24')]();})[_0x34dc('0x25')](function(){_0x15df2c['status'](0xcc)[_0x34dc('0x26')]();})[_0x34dc('0x46')](handleError(_0x15df2c,null));};function getBucketslist(_0x474528,_0x440a86,_0x34cc1c){return new Promise(function(_0x394ced,_0x3ce741){var _0x27b3b4=new AWS['S3']({'accessKeyId':_0x440a86,'secretAccessKey':_0x474528,'region':_0x34cc1c});_0x27b3b4[_0x34dc('0x6b')]({},function(_0x340b7a,_0x4aeb46){if(_0x340b7a){return _0x3ce741(_0x340b7a);}else{return _0x394ced(_0x4aeb46);}});});}function createBucket(_0x2f22ab,_0x4bfd86,_0x3406b1,_0x1f3389){return new Promise(function(_0x4b0546,_0x46297d){var _0x40f9db=new AWS['S3']({'accessKeyId':_0x4bfd86,'secretAccessKey':_0x2f22ab,'region':_0x3406b1});_0x40f9db[_0x34dc('0x6c')]({'Bucket':_0x1f3389},function(_0x3026d1,_0x3c090d){if(_0x3026d1){return _0x46297d(_0x3026d1);}else{return _0x4b0546(_0x3c090d);}});});}function uploadFile(_0xcc31ef,_0x434b7f,_0x5028e3,_0x2c9b45,_0x21bdad,_0x3fa4f2){return new Promise(function(_0x19365b,_0x2820e7){var _0xe58bc8=new AWS['S3']({'accessKeyId':_0x434b7f,'secretAccessKey':_0xcc31ef,'region':_0x5028e3});_0xe58bc8[_0x34dc('0x6d')]({'Bucket':_0x2c9b45,'Key':_0x21bdad,'Body':_0x3fa4f2},function(_0x2f97ad,_0x43690c){if(_0x2f97ad){return _0x2820e7(_0x2f97ad);}else{return _0x19365b(_0x43690c);}});});}function startTranscribe(_0x4db75d,_0x8bff8c,_0x5d55b3,_0x41321b,_0x875842,_0x7853f2){return new Promise(function(_0x16858f,_0x660fd7){var _0x185703=new AWS[(_0x34dc('0x6e'))]({'accessKeyId':_0x8bff8c,'secretAccessKey':_0x4db75d,'region':_0x5d55b3});_0x185703[_0x34dc('0x6f')]({'TranscriptionJobName':_0x41321b,'LanguageCode':_0x875842,'Media':{'MediaFileUri':_0x7853f2}},function(_0x18cfec,_0x2b676d){if(_0x18cfec){return _0x660fd7(_0x18cfec);}else{return _0x16858f(_0x2b676d);}});});}function transcribe(_0x6e6628,_0x2ef653,_0x20e0a5,_0x398e02,_0x274f6b,_0x5bc1c3,_0x20eb18){return new Promise(function(_0x1f3c6d,_0x56c2ff){var _0x6d4bb7={};logger['info'](util[_0x34dc('0x32')](_0x34dc('0x70'),_0x6e6628,_0x274f6b));return uploadFile(_0x2ef653,_0x20e0a5,_0x398e02,_0x274f6b,path[_0x34dc('0x71')](_0x5bc1c3),fs[_0x34dc('0x72')](_0x5bc1c3))[_0x34dc('0x25')](function(_0x2e169a){logger[_0x34dc('0x65')](util[_0x34dc('0x32')](_0x34dc('0x73'),_0x6e6628,_0x274f6b,_0x2e169a[_0x34dc('0x74')]));_0x6d4bb7[_0x34dc('0x75')]=_0x2e169a[_0x34dc('0x76')];_0x6d4bb7[_0x34dc('0x77')]=_0x2e169a[_0x34dc('0x74')];logger[_0x34dc('0x65')](util[_0x34dc('0x32')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x6e6628));return startTranscribe(_0x2ef653,_0x20e0a5,_0x398e02,uuidv4(),_0x20eb18,_0x2e169a[_0x34dc('0x74')]);})['then'](function(_0x4057dd){logger[_0x34dc('0x65')](util[_0x34dc('0x32')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x6e6628,_0x4057dd[_0x34dc('0x78')][_0x34dc('0x79')]));_0x6d4bb7['transcribeName']=_0x4057dd['TranscriptionJob']['TranscriptionJobName'];_0x6d4bb7['transcribeStatus']=_0x4057dd[_0x34dc('0x78')][_0x34dc('0x7a')];return _0x1f3c6d(_0x6d4bb7);})[_0x34dc('0x46')](function(_0x2a357f){return _0x56c2ff(_0x2a357f);});});}exports[_0x34dc('0x7b')]=function(_0x2f04dc,_0x56dff9,_0x74e394){var _0x10589b;var _0x1c4250;var _0x1f63ab;var _0x4cd8d7=require('../../components/encryptor');return db[_0x34dc('0x2b')][_0x34dc('0x7c')]({'where':{'id':_0x2f04dc['params']['id']}})['then'](function(_0x4fb33b){if(_0x4fb33b){var _0x489522=util[_0x34dc('0x32')](_0x34dc('0x50'),_0x4fb33b[_0x34dc('0x4f')]);if(fs[_0x34dc('0x51')](_0x489522)){cypher=!![];return _0x4cd8d7[_0x34dc('0x52')](_0x489522,_0x4fb33b[_0x34dc('0x4f')],config[_0x34dc('0x53')]['recording'])['then'](function(){return _0x4fb33b;});}return _0x4fb33b;}})['then'](function(_0xa21fd1){if(!_0xa21fd1){throw new db[(_0x34dc('0x55'))]['ValidationError'](_0x34dc('0x7d'));}_0x1c4250=_0xa21fd1;return db[_0x34dc('0x7e')][_0x34dc('0x7c')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x56dff9,null))[_0x34dc('0x25')](function(_0x26ace3){if(_0x26ace3){_0x10589b=_0x26ace3;if(!_0x10589b['transcribe']||!_0x10589b[_0x34dc('0x7f')]||!_0x10589b[_0x34dc('0x80')]||!_0x10589b[_0x34dc('0x81')]||!_0x10589b[_0x34dc('0x75')]){throw new db[(_0x34dc('0x55'))]['ValidationError'](_0x34dc('0x82'));}if(_0x2f04dc[_0x34dc('0x48')][_0x34dc('0x83')]&&(!_0x10589b[_0x34dc('0x84')]||!_0x10589b[_0x34dc('0x85')]||!_0x10589b[_0x34dc('0x86')]||!_0x10589b[_0x34dc('0x81')]||!_0x10589b[_0x34dc('0x75')])){throw new db[(_0x34dc('0x55'))][(_0x34dc('0x56'))](_0x34dc('0x87'));}return db[_0x34dc('0x88')][_0x34dc('0x7c')]({'where':{'id':_0x10589b[_0x34dc('0x7f')]}});}})[_0x34dc('0x25')](function(_0x38c799){if(!_0x38c799){throw new db[(_0x34dc('0x55'))]['ValidationError'](_0x34dc('0x89'));}if(!_0x38c799['data1']||!_0x38c799[_0x34dc('0x8a')]){throw new db['Sequelize'][(_0x34dc('0x56'))]('Cloud\x20Provider\x20not\x20configured');}_0x1f63ab=_0x38c799;return getBucketslist(_0x1f63ab[_0x34dc('0x8b')],_0x1f63ab['data2'],_0x10589b[_0x34dc('0x80')]);})[_0x34dc('0x25')](function(_0x5b5dd6){if(_0x5b5dd6&&_0x5b5dd6[_0x34dc('0x8c')]){var _0x17ff48=_['find'](_0x5b5dd6[_0x34dc('0x8c')],function(_0x410b72){return _0x410b72['Name']===_0x10589b[_0x34dc('0x75')];});if(!_0x17ff48){logger[_0x34dc('0x65')](util['format'](_0x34dc('0x8d'),_0x2f04dc[_0x34dc('0x49')]['id'],_0x10589b[_0x34dc('0x75')]));return createBucket(_0x1f63ab[_0x34dc('0x8b')],_0x1f63ab[_0x34dc('0x8a')],_0x10589b[_0x34dc('0x80')],_0x10589b[_0x34dc('0x75')]);}logger[_0x34dc('0x65')](util[_0x34dc('0x32')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x2f04dc['params']['id'],_0x10589b[_0x34dc('0x75')]));return;}})[_0x34dc('0x25')](function(_0x5c9da4){if(_0x1c4250[_0x34dc('0x8e')]===_0x34dc('0x8f')){return transcribe(_0x2f04dc['params']['id'],_0x1f63ab[_0x34dc('0x8b')],_0x1f63ab[_0x34dc('0x8a')],_0x10589b[_0x34dc('0x80')],_0x10589b[_0x34dc('0x75')],_0x1c4250[_0x34dc('0x4f')],_0x10589b[_0x34dc('0x81')]);}else{logger[_0x34dc('0x65')](util['format']('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x2f04dc[_0x34dc('0x49')]['id']));return{'transcribeStatus':_0x34dc('0x90')};}})[_0x34dc('0x25')](function(_0x1ffc1e){if(_0x1ffc1e){_0x1ffc1e[_0x34dc('0x91')]=_0x2f04dc['body'][_0x34dc('0x83')];return _0x1c4250[_0x34dc('0x92')](_0x1ffc1e);}})['then'](respondWithResult(_0x56dff9,null))[_0x34dc('0x46')](handleError(_0x56dff9,null));};function writeFile(_0x35db79,_0x27c6a9){return new Promise(function(_0x1e05cb,_0x3aa962){fs[_0x34dc('0x93')](_0x27c6a9,_0x35db79,function(_0x53ff10,_0x7621f1){if(_0x53ff10){return _0x3aa962(_0x53ff10);}else{return _0x1e05cb(_0x7621f1);}});});}exports[_0x34dc('0x94')]=function(_0x26cd33,_0x2ec454,_0x34a6d0){return db[_0x34dc('0x2b')][_0x34dc('0x7c')]({'where':{'id':_0x26cd33[_0x34dc('0x49')]['id']}})['then'](handleEntityNotFound(_0x2ec454))[_0x34dc('0x25')](function(_0x58f3a0){if(_0x58f3a0&&_0x58f3a0[_0x34dc('0x95')]){var _0x2458d8=_0x58f3a0['fileText'];var _0x394437=config[_0x34dc('0x96')]+_0x34dc('0x97')+_0x58f3a0['id']+_0x34dc('0x98');if(fs[_0x34dc('0x51')](_0x394437)){return _0x394437;}return writeFile(_0x2458d8,_0x394437)[_0x34dc('0x25')](function(){return _0x394437;});}else{throw new db['Sequelize'][(_0x34dc('0x56'))](_0x34dc('0x99'));}})[_0x34dc('0x25')](function(_0x24a532){return _0x2ec454[_0x34dc('0x4b')](_0x24a532);})[_0x34dc('0x46')](handleError(_0x2ec454));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index abb6425..12e2ef4 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 _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 +var _0x1b32=['transcribeStatus','exports','define','VoiceRecording','voice_recordings','uniqueid'];(function(_0x3979d3,_0x2994b3){var _0x60d445=function(_0x3eeace){while(--_0x3eeace){_0x3979d3['push'](_0x3979d3['shift']());}};_0x60d445(++_0x2994b3);}(_0x1b32,0x85));var _0x21b3=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x1b32[_0x2c91e9];return _0x13f0ff;};'use strict';var attributes=require('./voiceRecording.attributes');module[_0x21b3('0x0')]=function(_0xd03c78,_0x22122d){return _0xd03c78[_0x21b3('0x1')](_0x21b3('0x2'),attributes,{'tableName':_0x21b3('0x3'),'paranoid':![],'indexes':[{'name':_0x21b3('0x4'),'fields':[_0x21b3('0x4')]},{'name':_0x21b3('0x5'),'fields':[_0x21b3('0x5')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index e28c4af..e53f314 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 _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 +var _0x056b=['format','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateVoiceRecording','VoiceRecording','update','options','raw','where','limit','then','debug','CreateVoiceRecording','../../components/encryptor','findOne','body','callRecordingEncryption','existsSync','value'];(function(_0x1e91b2,_0x1ceb8b){var _0x404d7b=function(_0x1b530d){while(--_0x1b530d){_0x1e91b2['push'](_0x1e91b2['shift']());}};_0x404d7b(++_0x1ceb8b);}(_0x056b,0xb6));var _0xb056=function(_0x2d9f8f,_0x40bc79){_0x2d9f8f=_0x2d9f8f-0x0;var _0x240df4=_0x056b[_0x2d9f8f];return _0x240df4;};'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')]('VoiceRecording,\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')]('VoiceRecording,\x20%s,\x20%s',_0x3eae69,_0xb056('0xe'));_0x80daf1(_0x37a86d[_0xb056('0x14')][_0xb056('0x13')]);}})[_0xb056('0x15')](function(_0x5a4ef1){logger[_0xb056('0x11')]('VoiceRecording,\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?!![]:![]:!![],'individualHooks':!![],'where':_0x311eb9[_0xb056('0x19')]?_0x311eb9[_0xb056('0x19')][_0xb056('0x1b')]||null:null,'attributes':_0x311eb9['options']?_0x311eb9[_0xb056('0x19')]['attributes']||null:null,'limit':_0x311eb9[_0xb056('0x19')]?_0x311eb9['options'][_0xb056('0x1c')]||null:null})[_0xb056('0x1d')](function(_0x1de11b){logger[_0xb056('0xc')](_0xb056('0x16'),_0x311eb9);logger[_0xb056('0x1e')]('UpdateVoiceRecording',_0x311eb9,JSON[_0xb056('0x10')](_0x1de11b));_0x29c77e(_0x1de11b);})[_0xb056('0x15')](function(_0x341544){logger[_0xb056('0x11')]('UpdateVoiceRecording',_0x341544[_0xb056('0x13')],_0x311eb9);_0x4c57e6(_0x48e140[_0xb056('0x11')](0x1f4,_0x341544['message']));});});};exports[_0xb056('0x1f')]=function(_0x265782){var _0x2ae873=this;return new Promise(function(_0x1d2c66,_0x20a6c6){var _0x4024d7=require(_0xb056('0x20'));var _0x2042f1;return db['Setting'][_0xb056('0x21')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0xb056('0x1d')](function(_0x9c6f4a){_0x2042f1=_0x9c6f4a;return db[_0xb056('0x17')]['create'](_0x265782[_0xb056('0x22')]);})[_0xb056('0x1d')](function(_0x4ba5f8){if(_0x2042f1[_0xb056('0x23')]&&fs[_0xb056('0x24')](_0x4ba5f8[_0xb056('0x25')])){var _0x1fad05=util[_0xb056('0x26')]('%s.cypher',_0x4ba5f8[_0xb056('0x25')]);return _0x4024d7[_0xb056('0x27')](_0x4ba5f8[_0xb056('0x25')],_0x1fad05,config[_0xb056('0x28')][_0xb056('0x29')])['then'](function(){fs[_0xb056('0x2a')](_0x4ba5f8[_0xb056('0x25')]);logger[_0xb056('0xc')](_0xb056('0x2b'));return _0x4ba5f8;});}return _0x4ba5f8;})[_0xb056('0x1d')](function(_0x3b6b09){logger[_0xb056('0xc')](_0xb056('0x1f'),_0x265782);logger['debug'](_0xb056('0x1f'),_0x265782,JSON['stringify'](_0x3b6b09));_0x1d2c66(_0x3b6b09);})[_0xb056('0x15')](function(_0x4dffe5){logger['error'](_0xb056('0x1f'),_0x4dffe5[_0xb056('0x13')],_0x265782);_0x20a6c6(_0x2ae873[_0xb056('0x11')](0x1f4,_0x4dffe5[_0xb056('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index a9e83a0..0f66d96 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 _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 +var _0x79c4=['./voiceTransferReport.controller','isAuthenticated','index','/describe','get','/:id','show','post','create','put','update','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x2b9461,_0x59880d){var _0x46f606=function(_0x3e2a51){while(--_0x3e2a51){_0x2b9461['push'](_0x2b9461['shift']());}};_0x46f606(++_0x59880d);}(_0x79c4,0xa4));var _0x479c=function(_0x156515,_0x236b61){_0x156515=_0x156515-0x0;var _0xe34878=_0x79c4[_0x156515];return _0xe34878;};'use strict';var multer=require(_0x479c('0x0'));var util=require(_0x479c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x479c('0x2'));var router=express[_0x479c('0x3')]();var fs_extra=require(_0x479c('0x4'));var auth=require(_0x479c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x479c('0x6'));var controller=require(_0x479c('0x7'));router['get']('/',auth[_0x479c('0x8')](),controller[_0x479c('0x9')]);router['get'](_0x479c('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x479c('0xb')](_0x479c('0xc'),auth[_0x479c('0x8')](),controller[_0x479c('0xd')]);router[_0x479c('0xe')]('/',auth[_0x479c('0x8')](),controller[_0x479c('0xf')]);router[_0x479c('0x10')]('/:id',auth[_0x479c('0x8')](),controller[_0x479c('0x11')]);router['delete'](_0x479c('0xc'),auth[_0x479c('0x8')](),controller['destroy']);module[_0x479c('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index de210cc..70ba05f 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 _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 +var _0x578b=['blind','attended','STRING','ENUM','Yes','sequelize','moment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x578b,0x132));var _0xb578=function(_0x5844c3,_0x13fc8c){_0x5844c3=_0x5844c3-0x0;var _0x3a4d56=_0x578b[_0x5844c3];return _0x3a4d56;};'use strict';var Sequelize=require(_0xb578('0x0'));var moment=require(_0xb578('0x1'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xb578('0x2'),_0xb578('0x3'))},'result':{'type':Sequelize[_0xb578('0x4')]},'transfererchannel':{'type':Sequelize[_0xb578('0x4')]},'transferercalleridnum':{'type':Sequelize[_0xb578('0x4')]},'transferercalleridname':{'type':Sequelize[_0xb578('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0xb578('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0xb578('0x4')]},'transfereraccountcode':{'type':Sequelize[_0xb578('0x4')]},'transferercontext':{'type':Sequelize[_0xb578('0x4')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0xb578('0x4')]},'transfereechannel':{'type':Sequelize[_0xb578('0x4')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0xb578('0x4')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0xb578('0x4')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0xb578('0x4')]},'transfereelinkedid':{'type':Sequelize[_0xb578('0x4')]},'isexternal':{'type':Sequelize[_0xb578('0x5')](_0xb578('0x6'),'No')},'context':{'type':Sequelize[_0xb578('0x4')]},'extension':{'type':Sequelize[_0xb578('0x4')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 08e6253..70d6975 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 _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 +var _0x7110=['where','merge','filter','options','includeAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','index','map','VoiceTransferReport','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort'];(function(_0x337dbd,_0x410fc8){var _0xe368bd=function(_0x53f4d4){while(--_0x53f4d4){_0x337dbd['push'](_0x337dbd['shift']());}};_0xe368bd(++_0x410fc8);}(_0x7110,0xe2));var _0x0711=function(_0x4d7d06,_0x37c6b3){_0x4d7d06=_0x4d7d06-0x0;var _0x540d67=_0x7110[_0x4d7d06];return _0x540d67;};'use strict';var emlformat=require(_0x0711('0x0'));var rimraf=require(_0x0711('0x1'));var zipdir=require(_0x0711('0x2'));var jsonpatch=require(_0x0711('0x3'));var rp=require(_0x0711('0x4'));var moment=require(_0x0711('0x5'));var BPromise=require(_0x0711('0x6'));var Mustache=require(_0x0711('0x7'));var util=require(_0x0711('0x8'));var path=require(_0x0711('0x9'));var sox=require(_0x0711('0xa'));var csv=require('to-csv');var ejs=require(_0x0711('0xb'));var fs=require('fs');var fs_extra=require(_0x0711('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x0711('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0711('0xe'));var querystring=require(_0x0711('0xf'));var Papa=require('papaparse');var Redis=require(_0x0711('0x10'));var authService=require(_0x0711('0x11'));var qs=require(_0x0711('0x12'));var as=require(_0x0711('0x13'));var hardwareService=require(_0x0711('0x14'));var logger=require('../../config/logger')(_0x0711('0x15'));var utils=require(_0x0711('0x16'));var config=require(_0x0711('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0711('0x18'))['db'];function respondWithStatusCode(_0x3f7e19,_0x4ee296){_0x4ee296=_0x4ee296||0xcc;return function(_0x38a471){if(_0x38a471){return _0x3f7e19['sendStatus'](_0x4ee296);}return _0x3f7e19[_0x0711('0x19')](_0x4ee296)[_0x0711('0x1a')]();};}function respondWithResult(_0x2f979a,_0x5d4f34){_0x5d4f34=_0x5d4f34||0xc8;return function(_0x48e253){if(_0x48e253){return _0x2f979a[_0x0711('0x19')](_0x5d4f34)['json'](_0x48e253);}};}function respondWithFilteredResult(_0x226260,_0x40feae){return function(_0x379fba){if(_0x379fba){var _0x110831=typeof _0x40feae['offset']==='undefined'&&typeof _0x40feae[_0x0711('0x1b')]==='undefined';var _0x28b4a7=_0x379fba[_0x0711('0x1c')];var _0x51e816=_0x110831?0x0:_0x40feae[_0x0711('0x1d')];var _0x270b5d=_0x110831?_0x379fba[_0x0711('0x1c')]:_0x40feae[_0x0711('0x1d')]+_0x40feae[_0x0711('0x1b')];var _0x3a53e2;if(_0x270b5d>=_0x28b4a7){_0x270b5d=_0x28b4a7;_0x3a53e2=0xc8;}else{_0x3a53e2=0xce;}_0x226260['status'](_0x3a53e2);return _0x226260[_0x0711('0x1e')](_0x0711('0x1f'),_0x51e816+'-'+_0x270b5d+'/'+_0x28b4a7)['json'](_0x379fba);}return null;};}function patchUpdates(_0x5031d6){return function(_0x1c687a){try{jsonpatch[_0x0711('0x20')](_0x1c687a,_0x5031d6,!![]);}catch(_0x2d8525){return BPromise[_0x0711('0x21')](_0x2d8525);}return _0x1c687a[_0x0711('0x22')]();};}function saveUpdates(_0x2742da,_0x103f59){return function(_0x226303){if(_0x226303){return _0x226303[_0x0711('0x23')](_0x2742da)['then'](function(_0x28597f){return _0x28597f;});}return null;};}function removeEntity(_0xab33aa,_0x59d31c){return function(_0xac88c1){if(_0xac88c1){return _0xac88c1[_0x0711('0x24')]()[_0x0711('0x25')](function(){_0xab33aa[_0x0711('0x19')](0xcc)[_0x0711('0x1a')]();});}};}function handleEntityNotFound(_0x333672,_0x124ef6){return function(_0x50b68c){if(!_0x50b68c){_0x333672['sendStatus'](0x194);}return _0x50b68c;};}function handleError(_0x4376ba,_0x418121){_0x418121=_0x418121||0x1f4;return function(_0x3c38d5){logger[_0x0711('0x26')](_0x3c38d5[_0x0711('0x27')]);if(_0x3c38d5[_0x0711('0x28')]){delete _0x3c38d5[_0x0711('0x28')];}_0x4376ba[_0x0711('0x19')](_0x418121)['send'](_0x3c38d5);};}exports[_0x0711('0x29')]=function(_0x1d5760,_0x2d5a57){var _0x49c9a4={},_0x25ac57={},_0x832f3d={'count':0x0,'rows':[]};var _0x141128=_[_0x0711('0x2a')](db[_0x0711('0x2b')][_0x0711('0x2c')],function(_0x223659){return{'name':_0x223659[_0x0711('0x2d')],'type':_0x223659['type'][_0x0711('0x2e')]};});_0x25ac57[_0x0711('0x2f')]=_[_0x0711('0x2a')](_0x141128,_0x0711('0x28'));_0x25ac57['query']=_[_0x0711('0x30')](_0x1d5760[_0x0711('0x31')]);_0x25ac57[_0x0711('0x32')]=_[_0x0711('0x33')](_0x25ac57[_0x0711('0x2f')],_0x25ac57[_0x0711('0x31')]);_0x49c9a4[_0x0711('0x34')]=_[_0x0711('0x33')](_0x25ac57[_0x0711('0x2f')],qs[_0x0711('0x35')](_0x1d5760[_0x0711('0x31')][_0x0711('0x35')]));_0x49c9a4[_0x0711('0x34')]=_0x49c9a4[_0x0711('0x34')][_0x0711('0x36')]?_0x49c9a4[_0x0711('0x34')]:_0x25ac57['model'];if(!_0x1d5760[_0x0711('0x31')]['hasOwnProperty'](_0x0711('0x37'))){_0x49c9a4[_0x0711('0x1b')]=qs[_0x0711('0x1b')](_0x1d5760[_0x0711('0x31')][_0x0711('0x1b')]);_0x49c9a4[_0x0711('0x1d')]=qs[_0x0711('0x1d')](_0x1d5760[_0x0711('0x31')][_0x0711('0x1d')]);}_0x49c9a4[_0x0711('0x38')]=qs[_0x0711('0x39')](_0x1d5760[_0x0711('0x31')]['sort']);_0x49c9a4[_0x0711('0x3a')]=qs[_0x0711('0x32')](_['pick'](_0x1d5760[_0x0711('0x31')],_0x25ac57['filters']),_0x141128);if(_0x1d5760[_0x0711('0x31')]['filter']){_0x49c9a4[_0x0711('0x3a')]=_[_0x0711('0x3b')](_0x49c9a4[_0x0711('0x3a')],{'$or':_[_0x0711('0x2a')](_0x141128,function(_0xdba081){if(_0xdba081['type']!=='VIRTUAL'){var _0x1eebf4={};_0x1eebf4[_0xdba081[_0x0711('0x28')]]={'$like':'%'+_0x1d5760[_0x0711('0x31')][_0x0711('0x3c')]+'%'};return _0x1eebf4;}})});}_0x49c9a4=_['merge']({},_0x49c9a4,_0x1d5760[_0x0711('0x3d')]);var _0x4c471b={'where':_0x49c9a4[_0x0711('0x3a')]};return db['VoiceTransferReport'][_0x0711('0x1c')](_0x4c471b)[_0x0711('0x25')](function(_0x5c94bf){_0x832f3d[_0x0711('0x1c')]=_0x5c94bf;if(_0x1d5760['query'][_0x0711('0x3e')]){_0x49c9a4['include']=[{'all':!![]}];}return db['VoiceTransferReport']['findAll'](_0x49c9a4);})['then'](function(_0x4a241d){_0x832f3d[_0x0711('0x3f')]=_0x4a241d;return _0x832f3d;})[_0x0711('0x25')](respondWithFilteredResult(_0x2d5a57,_0x49c9a4))[_0x0711('0x40')](handleError(_0x2d5a57,null));};exports[_0x0711('0x41')]=function(_0x21e684,_0x28590e){var _0xa8d12d={'raw':!![],'where':{'id':_0x21e684[_0x0711('0x42')]['id']}},_0x4d997c={};_0x4d997c['model']=_['keys'](db[_0x0711('0x2b')][_0x0711('0x2c')]);_0x4d997c['query']=_[_0x0711('0x30')](_0x21e684['query']);_0x4d997c[_0x0711('0x32')]=_[_0x0711('0x33')](_0x4d997c[_0x0711('0x2f')],_0x4d997c['query']);_0xa8d12d['attributes']=_['intersection'](_0x4d997c[_0x0711('0x2f')],qs[_0x0711('0x35')](_0x21e684['query'][_0x0711('0x35')]));_0xa8d12d[_0x0711('0x34')]=_0xa8d12d[_0x0711('0x34')][_0x0711('0x36')]?_0xa8d12d[_0x0711('0x34')]:_0x4d997c[_0x0711('0x2f')];if(_0x21e684[_0x0711('0x31')]['includeAll']){_0xa8d12d['include']=[{'all':!![]}];}_0xa8d12d=_[_0x0711('0x3b')]({},_0xa8d12d,_0x21e684[_0x0711('0x3d')]);return db[_0x0711('0x2b')][_0x0711('0x43')](_0xa8d12d)['then'](handleEntityNotFound(_0x28590e,null))[_0x0711('0x25')](respondWithResult(_0x28590e,null))[_0x0711('0x40')](handleError(_0x28590e,null));};exports[_0x0711('0x44')]=function(_0x22a207,_0x322652){return db[_0x0711('0x2b')][_0x0711('0x44')](_0x22a207[_0x0711('0x45')],{})['then'](respondWithResult(_0x322652,0xc9))[_0x0711('0x40')](handleError(_0x322652,null));};exports[_0x0711('0x23')]=function(_0x260a72,_0x4f71a9){if(_0x260a72[_0x0711('0x45')]['id']){delete _0x260a72[_0x0711('0x45')]['id'];}return db[_0x0711('0x2b')][_0x0711('0x43')]({'where':{'id':_0x260a72[_0x0711('0x42')]['id']}})['then'](handleEntityNotFound(_0x4f71a9,null))[_0x0711('0x25')](saveUpdates(_0x260a72['body'],null))[_0x0711('0x25')](respondWithResult(_0x4f71a9,null))[_0x0711('0x40')](handleError(_0x4f71a9,null));};exports[_0x0711('0x24')]=function(_0x35bc93,_0xc2d293){return db['VoiceTransferReport'][_0x0711('0x43')]({'where':{'id':_0x35bc93[_0x0711('0x42')]['id']}})[_0x0711('0x25')](handleEntityNotFound(_0xc2d293,null))[_0x0711('0x25')](removeEntity(_0xc2d293,null))[_0x0711('0x40')](handleError(_0xc2d293,null));};exports[_0x0711('0x46')]=function(_0x467558,_0x28268c){return db['VoiceTransferReport'][_0x0711('0x46')]()[_0x0711('0x25')](respondWithResult(_0x28268c,null))[_0x0711('0x40')](handleError(_0x28268c,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 884b85c..7fa2ad4 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 _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 +var _0x7bc7=['request-promise','path','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1dad8e,_0x2b2f18){var _0x1a7022=function(_0x4c5207){while(--_0x4c5207){_0x1dad8e['push'](_0x1dad8e['shift']());}};_0x1a7022(++_0x2b2f18);}(_0x7bc7,0x81));var _0x77bc=function(_0x4b4eea,_0xea45c2){_0x4b4eea=_0x4b4eea-0x0;var _0x27d453=_0x7bc7[_0x4b4eea];return _0x27d453;};'use strict';var _=require(_0x77bc('0x0'));var util=require(_0x77bc('0x1'));var logger=require(_0x77bc('0x2'))(_0x77bc('0x3'));var moment=require(_0x77bc('0x4'));var BPromise=require(_0x77bc('0x5'));var rp=require(_0x77bc('0x6'));var fs=require('fs');var path=require(_0x77bc('0x7'));var rimraf=require(_0x77bc('0x8'));var config=require(_0x77bc('0x9'));var attributes=require(_0x77bc('0xa'));module[_0x77bc('0xb')]=function(_0x295159,_0x3770d4){return _0x295159[_0x77bc('0xc')](_0x77bc('0xd'),attributes,{'tableName':_0x77bc('0xe'),'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 aecd746..5d1b125 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 _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 +var _0xe165=['then','info','VoiceTransferReport,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','CreateVoiceTransferReport','VoiceTransferReport','body','options','raw','debug','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request'];(function(_0x52aece,_0x887e22){var _0x504870=function(_0x42f5be){while(--_0x42f5be){_0x52aece['push'](_0x52aece['shift']());}};_0x504870(++_0x887e22);}(_0xe165,0x1ea));var _0x5e16=function(_0xb7c9d4,_0x10cc81){_0xb7c9d4=_0xb7c9d4-0x0;var _0x2ad97c=_0xe165[_0xb7c9d4];return _0x2ad97c;};'use strict';var _=require('lodash');var util=require(_0x5e16('0x0'));var moment=require('moment');var BPromise=require(_0x5e16('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5e16('0x2'));var db=require(_0x5e16('0x3'))['db'];var utils=require(_0x5e16('0x4'));var logger=require(_0x5e16('0x5'))(_0x5e16('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5e16('0x7')][_0x5e16('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x22c4ce,_0xae4bf6,_0x50ab6b){return new BPromise(function(_0x1ab3e4,_0x1d9f0e){return client[_0x5e16('0x9')](_0x22c4ce,_0x50ab6b)[_0x5e16('0xa')](function(_0x293ecb){logger[_0x5e16('0xb')](_0x5e16('0xc'),_0xae4bf6,'request\x20sent');logger['debug']('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0xae4bf6,'request\x20sent',JSON[_0x5e16('0xd')](_0x293ecb));if(_0x293ecb['error']){if(_0x293ecb[_0x5e16('0xe')]['code']===0x1f4){logger['error'](_0x5e16('0xc'),_0xae4bf6,_0x293ecb[_0x5e16('0xe')][_0x5e16('0xf')]);return _0x1d9f0e(_0x293ecb[_0x5e16('0xe')][_0x5e16('0xf')]);}logger[_0x5e16('0xe')]('VoiceTransferReport,\x20%s,\x20%s',_0xae4bf6,_0x293ecb[_0x5e16('0xe')][_0x5e16('0xf')]);return _0x1ab3e4(_0x293ecb['error'][_0x5e16('0xf')]);}else{logger['info'](_0x5e16('0xc'),_0xae4bf6,_0x5e16('0x10'));_0x1ab3e4(_0x293ecb[_0x5e16('0x11')][_0x5e16('0xf')]);}})[_0x5e16('0x12')](function(_0x8db9e0){logger[_0x5e16('0xe')]('VoiceTransferReport,\x20%s,\x20%s',_0xae4bf6,_0x8db9e0);_0x1d9f0e(_0x8db9e0);});});}exports[_0x5e16('0x13')]=function(_0x3be666){var _0x245425=this;return new Promise(function(_0x13a901,_0x13e897){return db[_0x5e16('0x14')]['create'](_0x3be666[_0x5e16('0x15')],{'raw':_0x3be666[_0x5e16('0x16')]?_0x3be666[_0x5e16('0x16')][_0x5e16('0x17')]===undefined?!![]:![]:!![]})[_0x5e16('0xa')](function(_0x518efc){logger['info'](_0x5e16('0x13'),_0x3be666);logger[_0x5e16('0x18')]('CreateVoiceTransferReport',_0x3be666,JSON['stringify'](_0x518efc));_0x13a901(_0x518efc);})['catch'](function(_0x1e1587){logger[_0x5e16('0xe')](_0x5e16('0x13'),_0x1e1587['message'],_0x3be666);_0x13e897(_0x245425[_0x5e16('0xe')](0x1f4,_0x1e1587[_0x5e16('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 838ef5f..0642852 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 _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 +var _0xbec5=['exports','express','Router','./webbar.controller','post','/originate','isAuthenticated','isWebrtcLicence','/hangup','hangup','/answer','answer','/hold','/unhold','unhold','/calls','calls','/transfer','transfer'];(function(_0x45c8f5,_0x18b017){var _0x248f5b=function(_0x1570bb){while(--_0x1570bb){_0x45c8f5['push'](_0x45c8f5['shift']());}};_0x248f5b(++_0x18b017);}(_0xbec5,0xe5));var _0x5bec=function(_0x1e9424,_0x191cba){_0x1e9424=_0x1e9424-0x0;var _0x1bd96c=_0xbec5[_0x1e9424];return _0x1bd96c;};'use strict';var express=require(_0x5bec('0x0'));var router=express[_0x5bec('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x5bec('0x2'));router[_0x5bec('0x3')](_0x5bec('0x4'),auth[_0x5bec('0x5')](),auth[_0x5bec('0x6')](),controller['originate']);router[_0x5bec('0x3')](_0x5bec('0x7'),auth[_0x5bec('0x5')](),auth['isWebrtcLicence'](),controller[_0x5bec('0x8')]);router[_0x5bec('0x3')](_0x5bec('0x9'),auth[_0x5bec('0x5')](),auth[_0x5bec('0x6')](),controller[_0x5bec('0xa')]);router[_0x5bec('0x3')](_0x5bec('0xb'),auth['isAuthenticated'](),auth[_0x5bec('0x6')](),controller['hold']);router[_0x5bec('0x3')](_0x5bec('0xc'),auth[_0x5bec('0x5')](),auth['isWebrtcLicence'](),controller[_0x5bec('0xd')]);router[_0x5bec('0x3')](_0x5bec('0xe'),auth['isAuthenticated'](),auth[_0x5bec('0x6')](),controller[_0x5bec('0xf')]);router['post'](_0x5bec('0x10'),auth[_0x5bec('0x5')](),auth[_0x5bec('0x6')](),controller[_0x5bec('0x11')]);module[_0x5bec('0x12')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index c69f731..d6adc18 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 _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 +var _0xcea2=['result','catch','findOne','agent','all','rows','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callNumber','callbackUrl','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','hold\x20executed!','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls\x20fired:','VoiceChannels','filter','UserId','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','../../mysqldb','util','bluebird','jayson/promise','http','../../config/logger','webbarapi','redis','localhost','socket.io-emitter','validate','number','string','callNumber\x20is\x20required','userId\x20is\x20required','info','stringify','emit','log','handleError:','error','stack','name','status','NotFound','then','code','message'];(function(_0x2316a6,_0x2e3640){var _0x57346d=function(_0x495726){while(--_0x495726){_0x2316a6['push'](_0x2316a6['shift']());}};_0x57346d(++_0x2e3640);}(_0xcea2,0x15a));var _0x2cea=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xcea2[_0x2be8c2];return _0x97f531;};'use strict';var path=require(_0x2cea('0x0'));var fs=require('fs');var _=require('lodash');var db=require(_0x2cea('0x1'))['db'];var config=require('../../config/environment');var util=require(_0x2cea('0x2'));var BPromise=require(_0x2cea('0x3'));var jayson=require(_0x2cea('0x4'));var amiClient=jayson['client'][_0x2cea('0x5')]({'port':0x232a});var logger=require(_0x2cea('0x6'))(_0x2cea('0x7'));var Redis=require('ioredis');config[_0x2cea('0x8')]=_['defaults'](config[_0x2cea('0x8')],{'host':_0x2cea('0x9'),'port':0x18eb});var io=require(_0x2cea('0xa'))(new Redis(config[_0x2cea('0x8')]));var Schema=require(_0x2cea('0xb'));var originateValidation=new Schema({'userId':{'type':_0x2cea('0xc'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0x2cea('0xd'),'required':[!![],_0x2cea('0xe')]},'callerId':{'type':_0x2cea('0xd')},'callbackUrl':{'type':_0x2cea('0xd')}});var hangupValidation=new Schema({'userId':{'type':_0x2cea('0xc'),'required':[!![],_0x2cea('0xf')]},'sessionId':{'type':_0x2cea('0xd'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x2cea('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0x2cea('0xc'),'required':[!![],_0x2cea('0xf')]},'sessionId':{'type':'string','required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0x2cea('0xd'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0x2cea('0xc'),'required':[!![],_0x2cea('0xf')]},'sessionId':{'type':_0x2cea('0xd'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0x2cea('0xc'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0x2cea('0xc'),'required':[!![],_0x2cea('0xf')]}});function emit(_0x981e3f,_0x17322c,_0x232dad){logger[_0x2cea('0x10')](_0x981e3f,_0x17322c,JSON[_0x2cea('0x11')](_0x232dad));io['to'](_0x981e3f)[_0x2cea('0x12')](_0x17322c,_0x232dad);}function handleError(_0x5eee09){return function(_0x19927a){console[_0x2cea('0x13')](_0x2cea('0x14'),_0x19927a,_0x19927a instanceof RangeError);logger[_0x2cea('0x15')](_0x19927a[_0x2cea('0x16')]);if(_0x19927a instanceof RangeError){if(_0x19927a[_0x2cea('0x17')]){delete _0x19927a['name'];}_0x5eee09[_0x2cea('0x18')](0x194)['send'](_0x19927a);}else{if(_0x19927a[_0x2cea('0x17')]){delete _0x19927a[_0x2cea('0x17')];}_0x5eee09[_0x2cea('0x18')](0x1f4)['send'](_0x19927a);}};}function checkError(){return function(_0x46a112){if(!_0x46a112){throw new RangeError(_0x2cea('0x19'));}return _0x46a112;};}function respondWithRpcPromise(_0x210d7e,_0x1b389b){return new BPromise(function(_0x3246bc,_0x3f6f0e){var _0x10f13a=amiClient;return _0x10f13a['request'](_0x210d7e,_0x1b389b)[_0x2cea('0x1a')](function(_0x5e5b46){if(_0x5e5b46[_0x2cea('0x15')]){if(_0x5e5b46['error'][_0x2cea('0x1b')]===0x1f4){return _0x3f6f0e(_0x5e5b46[_0x2cea('0x15')]['message']);}return _0x3246bc(_0x5e5b46[_0x2cea('0x15')][_0x2cea('0x1c')]);}else{_0x3246bc(_0x5e5b46[_0x2cea('0x1d')]);}})[_0x2cea('0x1e')](function(_0x3f3ee0){_0x3f6f0e(_0x3f3ee0);});});}function getAgent(_0x79529b){return db['User'][_0x2cea('0x1f')]({'where':{'id':_0x79529b,'role':_0x2cea('0x20')}})[_0x2cea('0x1a')](checkError());}function getAgentCheckSession(_0x32af98,_0x46ef5a){return new BPromise(function(_0x3ea40c,_0xe99cca){var _0x2741cb=respondWithRpcPromise('VoiceChannels');var _0xff69ad=getAgent(_0x32af98);Promise[_0x2cea('0x21')]([_0x2741cb,_0xff69ad])['then'](function(_0xfeb8bd){var _0xc398c5=_0xfeb8bd[0x0];var _0x271b2f=_0xfeb8bd[0x1];var _0x16cf9f=_['filter'](_0xc398c5[_0x2cea('0x22')],function(_0x128934){return _0x128934['UserId']==_0x271b2f['id']&&_0x128934[_0x2cea('0x23')]==_0x46ef5a;});if(_0x16cf9f[_0x2cea('0x24')]==0x1){_0x3ea40c(_0x271b2f);}else{_0xe99cca(new RangeError(_0x2cea('0x25')+_0x46ef5a+_0x2cea('0x26')));}});});}exports[_0x2cea('0x27')]=function(_0x35b37e,_0x10e7c5){logger[_0x2cea('0x10')](_0x2cea('0x28'),_0x35b37e[_0x2cea('0x29')]);var _0x107472=originateValidation['validate'](_0x35b37e[_0x2cea('0x29')]);if(_0x107472[_0x2cea('0x24')]>0x0){return _0x10e7c5[_0x2cea('0x18')](0x190)[_0x2cea('0x2a')](_0x107472);}var _0x5a0061=_0x35b37e['body'][_0x2cea('0x2b')];var _0x1451f2=_0x35b37e['body'][_0x2cea('0x2c')];var _0x49d851=_0x35b37e[_0x2cea('0x29')]['callerId'];var _0x510d66=_0x35b37e['body'][_0x2cea('0x2d')];return getAgent(_0x5a0061)[_0x2cea('0x1a')](function(_0x5d254d){logger[_0x2cea('0x10')](_0x2cea('0x2e'),_0x5d254d['name']);emit(util[_0x2cea('0x2f')](_0x2cea('0x30'),_0x5d254d[_0x2cea('0x17')]),_0x2cea('0x31'),{'callNumber':_0x1451f2,'callerId':_0x49d851,'callbackUrl':_0x510d66});return _0x10e7c5[_0x2cea('0x18')](0xc8)['json']({'error':![],'message':_0x2cea('0x32')});})[_0x2cea('0x1e')](handleError(_0x10e7c5));};exports['hangup']=function(_0x53c088,_0x1913a2){logger['info']('hangup\x20fired:',_0x53c088['body']);var _0x50f632=hangupValidation[_0x2cea('0xb')](_0x53c088[_0x2cea('0x29')]);if(_0x50f632['length']>0x0){return _0x1913a2[_0x2cea('0x18')](0x190)[_0x2cea('0x2a')](_0x50f632);}var _0x249aaa=_0x53c088['body'][_0x2cea('0x2b')];var _0xcc11b6=_0x53c088[_0x2cea('0x29')][_0x2cea('0x23')];return getAgent(_0x249aaa)[_0x2cea('0x1a')](function(_0x2cb62b){logger[_0x2cea('0x10')](_0x2cea('0x2e'),_0x2cb62b[_0x2cea('0x17')]);emit(util[_0x2cea('0x2f')](_0x2cea('0x30'),_0x2cb62b[_0x2cea('0x17')]),_0x2cea('0x33'),{'sessionId':_0xcc11b6});return _0x1913a2[_0x2cea('0x18')](0xc8)[_0x2cea('0x2a')]({'error':![],'message':_0x2cea('0x34')});})[_0x2cea('0x1e')](handleError(_0x1913a2));};exports[_0x2cea('0x35')]=function(_0x49fcfa,_0x294057){logger['info'](_0x2cea('0x36'),_0x49fcfa[_0x2cea('0x29')]);var _0x22ce6b=answerValidation[_0x2cea('0xb')](_0x49fcfa[_0x2cea('0x29')]);if(_0x22ce6b[_0x2cea('0x24')]>0x0){return _0x294057[_0x2cea('0x18')](0x190)[_0x2cea('0x2a')](_0x22ce6b);}var _0x608740=_0x49fcfa[_0x2cea('0x29')]['userId'];var _0x515494=_0x49fcfa[_0x2cea('0x29')][_0x2cea('0x23')];return getAgent(_0x608740)['then'](function(_0x2d22db){logger['info'](_0x2cea('0x2e'),_0x2d22db['name']);emit(util[_0x2cea('0x2f')](_0x2cea('0x30'),_0x2d22db[_0x2cea('0x17')]),_0x2cea('0x37'),{'sessionId':_0x515494});return _0x294057[_0x2cea('0x18')](0xc8)[_0x2cea('0x2a')]({'error':![],'message':_0x2cea('0x38')});})[_0x2cea('0x1e')](handleError(_0x294057));};exports[_0x2cea('0x39')]=function(_0x1ce60a,_0x5a55ed){logger[_0x2cea('0x10')](_0x2cea('0x3a'),_0x1ce60a[_0x2cea('0x29')]);var _0x348baf=holdValidation['validate'](_0x1ce60a['body']);if(_0x348baf[_0x2cea('0x24')]>0x0){return _0x5a55ed[_0x2cea('0x18')](0x190)[_0x2cea('0x2a')](_0x348baf);}var _0x510e0f=_0x1ce60a[_0x2cea('0x29')][_0x2cea('0x2b')];var _0x4223d8=_0x1ce60a[_0x2cea('0x29')]['sessionId'];return getAgent(_0x510e0f)[_0x2cea('0x1a')](function(_0x526e92){logger['info'](_0x2cea('0x2e'),_0x526e92[_0x2cea('0x17')]);emit(util[_0x2cea('0x2f')](_0x2cea('0x30'),_0x526e92['name']),'webbar:hold',{'sessionId':_0x4223d8});return _0x5a55ed[_0x2cea('0x18')](0xc8)[_0x2cea('0x2a')]({'error':![],'message':_0x2cea('0x3b')});})[_0x2cea('0x1e')](handleError(_0x5a55ed));};exports['unhold']=function(_0x4ec462,_0x5d7cb6){logger[_0x2cea('0x10')](_0x2cea('0x3c'),_0x4ec462[_0x2cea('0x29')]);var _0x25dc12=unholdValidation[_0x2cea('0xb')](_0x4ec462[_0x2cea('0x29')]);if(_0x25dc12[_0x2cea('0x24')]>0x0){return _0x5d7cb6['status'](0x190)[_0x2cea('0x2a')](_0x25dc12);}var _0x39937e=_0x4ec462[_0x2cea('0x29')]['userId'];var _0x103f18=_0x4ec462['body'][_0x2cea('0x23')];return getAgent(_0x39937e)[_0x2cea('0x1a')](function(_0x21851a){logger[_0x2cea('0x10')](_0x2cea('0x2e'),_0x21851a[_0x2cea('0x17')]);emit(util[_0x2cea('0x2f')](_0x2cea('0x30'),_0x21851a['name']),_0x2cea('0x3d'),{'sessionId':_0x103f18});return _0x5d7cb6['status'](0xc8)[_0x2cea('0x2a')]({'error':![],'message':_0x2cea('0x3e')});})[_0x2cea('0x1e')](handleError(_0x5d7cb6));};exports['calls']=function(_0x3b27f4,_0x4c4db6){logger['info'](_0x2cea('0x3f'),_0x4c4db6[_0x2cea('0x29')]);var _0x28e720=callsValidation[_0x2cea('0xb')](_0x3b27f4[_0x2cea('0x29')]);if(_0x28e720['length']>0x0){return _0x4c4db6['status'](0x190)[_0x2cea('0x2a')](_0x28e720);}var _0x160755=_0x3b27f4[_0x2cea('0x29')][_0x2cea('0x2b')];var _0x526269=respondWithRpcPromise(_0x2cea('0x40'));var _0x5ae31b=getAgent(_0x160755);return Promise[_0x2cea('0x21')]([_0x526269,_0x5ae31b])[_0x2cea('0x1a')](function(_0x35d64b){var _0x3f06d1=_0x35d64b[0x0];var _0x221c16=_0x35d64b[0x1];var _0x50adbe=_[_0x2cea('0x41')](_0x3f06d1[_0x2cea('0x22')],function(_0x2c6dd4){return _0x2c6dd4[_0x2cea('0x42')]==_0x221c16['id'];});return _0x4c4db6[_0x2cea('0x18')](0xc8)['json']({'count':_0x50adbe[_0x2cea('0x24')],'rows':_0x50adbe});})[_0x2cea('0x1e')](handleError(_0x4c4db6));};exports['conference']=function(_0x548912,_0x820317){logger[_0x2cea('0x10')](_0x2cea('0x43'),_0x548912['body']);var _0x5806b8=conferenceValidation[_0x2cea('0xb')](_0x548912[_0x2cea('0x29')]);if(_0x5806b8['length']>0x0){return _0x820317[_0x2cea('0x18')](0x190)[_0x2cea('0x2a')](_0x5806b8);}var _0x589682=_0x548912[_0x2cea('0x29')][_0x2cea('0x2b')];return getAgent(_0x589682)[_0x2cea('0x1a')](function(_0x42881c){logger[_0x2cea('0x10')]('entityFound:',_0x42881c[_0x2cea('0x17')]);emit(util[_0x2cea('0x2f')]('user:%s',_0x42881c[_0x2cea('0x17')]),_0x2cea('0x44'));return _0x820317[_0x2cea('0x18')](0xc8)[_0x2cea('0x2a')]({'error':![],'message':_0x2cea('0x45')});})[_0x2cea('0x1e')](handleError(_0x820317));};exports[_0x2cea('0x46')]=function(_0xb9ef65,_0x3708c8){logger[_0x2cea('0x10')](_0x2cea('0x47'),_0xb9ef65[_0x2cea('0x29')]);var _0x400459=transferValidation['validate'](_0xb9ef65['body']);if(_0x400459[_0x2cea('0x24')]>0x0){return _0x3708c8[_0x2cea('0x18')](0x190)[_0x2cea('0x2a')](_0x400459);}var _0x104051=_0xb9ef65[_0x2cea('0x29')][_0x2cea('0x2b')];var _0x354c42=_0xb9ef65['body']['sessionId'];var _0x1dfeaf=_0xb9ef65[_0x2cea('0x29')][_0x2cea('0x48')];return getAgent(_0x104051)['then'](function(_0x4e00b6){logger['info'](_0x2cea('0x2e'),_0x4e00b6[_0x2cea('0x17')]);emit(util['format']('user:%s',_0x4e00b6[_0x2cea('0x17')]),_0x2cea('0x49'),{'sessionId':_0x354c42,'transferNumber':_0x1dfeaf});return _0x3708c8[_0x2cea('0x18')](0xc8)[_0x2cea('0x2a')]({'error':![],'message':_0x2cea('0x4a')});})[_0x2cea('0x1e')](handleError(_0x3708c8));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index dd19d69..9842ec3 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 _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 +var _0x091d=['post','create','addDisposition','addAnswer','/:id/users','addApplications','/:id/notify','notify','send','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications'];(function(_0x4d1001,_0xc3c5c3){var _0x2a5d10=function(_0x30c18a){while(--_0x30c18a){_0x4d1001['push'](_0x4d1001['shift']());}};_0x2a5d10(++_0xc3c5c3);}(_0x091d,0x125));var _0xd091=function(_0x1ac721,_0x556a17){_0x1ac721=_0x1ac721-0x0;var _0x375c66=_0x091d[_0x1ac721];return _0x375c66;};'use strict';var multer=require(_0xd091('0x0'));var util=require(_0xd091('0x1'));var path=require(_0xd091('0x2'));var timeout=require(_0xd091('0x3'));var express=require(_0xd091('0x4'));var router=express[_0xd091('0x5')]();var fs_extra=require(_0xd091('0x6'));var auth=require(_0xd091('0x7'));var interaction=require(_0xd091('0x8'));var config=require(_0xd091('0x9'));var controller=require(_0xd091('0xa'));router[_0xd091('0xb')]('/',auth[_0xd091('0xc')](),controller[_0xd091('0xd')]);router[_0xd091('0xb')]('/describe',auth[_0xd091('0xc')](),controller['describe']);router['get'](_0xd091('0xe'),auth[_0xd091('0xc')](),controller[_0xd091('0xf')]);router[_0xd091('0xb')](_0xd091('0x10'),auth[_0xd091('0xc')](),controller[_0xd091('0x11')]);router[_0xd091('0xb')](_0xd091('0x12'),auth['isAuthenticated'](),controller[_0xd091('0x13')]);router[_0xd091('0xb')]('/:id/users',auth[_0xd091('0xc')](),controller['getAgents']);router[_0xd091('0xb')](_0xd091('0x14'),auth[_0xd091('0xc')](),controller[_0xd091('0x15')]);router[_0xd091('0x16')]('/',auth[_0xd091('0xc')](),controller[_0xd091('0x17')]);router[_0xd091('0x16')](_0xd091('0x10'),auth[_0xd091('0xc')](),controller[_0xd091('0x18')]);router[_0xd091('0x16')](_0xd091('0x12'),auth[_0xd091('0xc')](),controller[_0xd091('0x19')]);router['post'](_0xd091('0x1a'),auth[_0xd091('0xc')](),controller['addAgents']);router['post']('/:id/applications',auth[_0xd091('0xc')](),controller[_0xd091('0x1b')]);router[_0xd091('0x16')](_0xd091('0x1c'),controller[_0xd091('0x1d')]);router[_0xd091('0x16')]('/:id/send',auth[_0xd091('0xc')](),controller[_0xd091('0x1e')]);router[_0xd091('0x1f')]('/:id',auth[_0xd091('0xc')](),controller[_0xd091('0x20')]);router[_0xd091('0x21')](_0xd091('0xe'),auth['isAuthenticated'](),controller[_0xd091('0x22')]);router[_0xd091('0x21')]('/:id/dispositions',auth['isAuthenticated'](),controller['removeDispositions']);router[_0xd091('0x21')]('/:id/canned_answers',auth[_0xd091('0xc')](),controller['removeAnswers']);router[_0xd091('0x21')](_0xd091('0x1a'),auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index c92d7fa..afeae5c 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 _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 +var _0xac1d=['sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING'];(function(_0x52a505,_0x5dec98){var _0x1fc95e=function(_0xdc7744){while(--_0xdc7744){_0x52a505['push'](_0x52a505['shift']());}};_0x1fc95e(++_0x5dec98);}(_0xac1d,0x141));var _0xdac1=function(_0x1a4fb8,_0x103dd9){_0x1a4fb8=_0x1a4fb8-0x0;var _0x4bfe93=_0xac1d[_0x1a4fb8];return _0x4bfe93;};'use strict';var Sequelize=require(_0xdac1('0x0'));var rs=require('randomstring');module[_0xdac1('0x1')]={'name':{'type':Sequelize[_0xdac1('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0xdac1('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xdac1('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xdac1('0x2')]},'type':{'type':Sequelize['ENUM']('twilio',_0xdac1('0x3'))},'accountSid':{'type':Sequelize[_0xdac1('0x2')]},'baseUrl':{'type':Sequelize[_0xdac1('0x2')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xdac1('0x4')],'defaultValue':function(){return _0xdac1('0x5');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xdac1('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xdac1('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xdac1('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xdac1('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xdac1('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xdac1('0x7')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xdac1('0x6')],'defaultValue':![],'comment':_0xdac1('0x8'),'set':function(_0x2e1143){if(!_0x2e1143){this[_0xdac1('0x9')](_0xdac1('0xa'),null);}this['setDataValue'](_0xdac1('0xb'),_0x2e1143);}},'description':{'type':Sequelize[_0xdac1('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 8cd0b7c..3e6bea1 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 _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 +var _0x605f=['receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','WhatsappInteraction','out','WhatsappMessage','Messages','dataValues','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappAccount.socket','jayson/promise','http','request','then','info','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','destroy','get','UserProfileResource','name','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','include','findAll','rows','show','params','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','WhatsappAccounts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addAgents','spread','userWhatsappAccount:save','removeAgents','isArray','emit','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','getApplications','whatsapp','Applications','account','sinch','statuses','state','update','timestamp','applications','orderBy','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','replace','whatsapp:','Body','MessageSid','from','notifications','message_id','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','omit','contact','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','messageId','UserId','agent','waitForTheAssignedAgent','queueId','WhatsappQueue','unshift','queue','Start','startRouting'];(function(_0x4dcdbd,_0xc56f3a){var _0x2916aa=function(_0x547941){while(--_0x547941){_0x4dcdbd['push'](_0x4dcdbd['shift']());}};_0x2916aa(++_0xc56f3a);}(_0x605f,0x1a6));var _0xf605=function(_0x3e2f67,_0x9cb2c6){_0x3e2f67=_0x3e2f67-0x0;var _0x313667=_0x605f[_0x3e2f67];return _0x313667;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf605('0x0'));var zipdir=require(_0xf605('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf605('0x2'));var moment=require(_0xf605('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf605('0x4'));var util=require(_0xf605('0x5'));var path=require('path');var sox=require(_0xf605('0x6'));var csv=require(_0xf605('0x7'));var ejs=require(_0xf605('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf605('0x9'));var squel=require(_0xf605('0xa'));var crypto=require(_0xf605('0xb'));var jsforce=require(_0xf605('0xc'));var deskjs=require(_0xf605('0xd'));var toCsv=require('to-csv');var querystring=require(_0xf605('0xe'));var Papa=require(_0xf605('0xf'));var Redis=require(_0xf605('0x10'));var authService=require(_0xf605('0x11'));var qs=require(_0xf605('0x12'));var as=require(_0xf605('0x13'));var hardwareService=require(_0xf605('0x14'));var logger=require(_0xf605('0x15'))('api');var utils=require(_0xf605('0x16'));var config=require(_0xf605('0x17'));var licenseUtil=require(_0xf605('0x18'));var db=require(_0xf605('0x19'))['db'];config[_0xf605('0x1a')]=_[_0xf605('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xf605('0x1c'))(new Redis(config[_0xf605('0x1a')]));require(_0xf605('0x1d'))['register'](socket);var jayson=require(_0xf605('0x1e'));var client=jayson['client'][_0xf605('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x94112c,_0x1146b0,_0x1ed500,_0x2162cf){return new BPromise(function(_0x116514,_0x3178b5){var _0x2dea28=_0x2162cf||client;return _0x2dea28[_0xf605('0x20')](_0x94112c,_0x1ed500)[_0xf605('0x21')](function(_0x61b695){logger[_0xf605('0x22')]('WhatsappAccount,\x20%s,\x20%s',_0x1146b0,'request\x20sent');logger['debug'](_0xf605('0x23'),_0x1146b0,_0xf605('0x24'),JSON[_0xf605('0x25')](_0x61b695));if(_0x61b695[_0xf605('0x26')]){if(_0x61b695[_0xf605('0x26')][_0xf605('0x27')]===0x1f4){logger[_0xf605('0x26')](_0xf605('0x28'),_0x1146b0,_0x61b695[_0xf605('0x26')][_0xf605('0x29')]);return _0x3178b5(_0x61b695[_0xf605('0x26')]['message']);}logger[_0xf605('0x26')]('WhatsappAccount,\x20%s,\x20%s',_0x1146b0,_0x61b695[_0xf605('0x26')]['message']);return _0x116514(_0x61b695[_0xf605('0x26')]['message']);}else{logger[_0xf605('0x22')](_0xf605('0x28'),_0x1146b0,_0xf605('0x24'));_0x116514(_0x61b695[_0xf605('0x2a')][_0xf605('0x29')]);}})[_0xf605('0x2b')](function(_0x5ad86d){logger[_0xf605('0x26')](_0xf605('0x28'),_0x1146b0,_0x5ad86d);_0x3178b5(_0x5ad86d);});});}function respondWithStatusCode(_0x5864a4,_0x51367b){_0x51367b=_0x51367b||0xcc;return function(_0x329376){if(_0x329376){return _0x5864a4[_0xf605('0x2c')](_0x51367b);}return _0x5864a4[_0xf605('0x2d')](_0x51367b)[_0xf605('0x2e')]();};}function respondWithResult(_0x3745b4,_0x35c299){_0x35c299=_0x35c299||0xc8;return function(_0x459b89){if(_0x459b89){return _0x3745b4['status'](_0x35c299)[_0xf605('0x2f')](_0x459b89);}};}function respondWithFilteredResult(_0x28691c,_0x2b41a3){return function(_0x54ea52){if(_0x54ea52){var _0x5f43fa=typeof _0x2b41a3['offset']===_0xf605('0x30')&&typeof _0x2b41a3[_0xf605('0x31')]===_0xf605('0x30');var _0x2a0809=_0x54ea52[_0xf605('0x32')];var _0x73aeb4=_0x5f43fa?0x0:_0x2b41a3[_0xf605('0x33')];var _0x355733=_0x5f43fa?_0x54ea52[_0xf605('0x32')]:_0x2b41a3['offset']+_0x2b41a3[_0xf605('0x31')];var _0x5dbd02;if(_0x355733>=_0x2a0809){_0x355733=_0x2a0809;_0x5dbd02=0xc8;}else{_0x5dbd02=0xce;}_0x28691c[_0xf605('0x2d')](_0x5dbd02);return _0x28691c[_0xf605('0x34')](_0xf605('0x35'),_0x73aeb4+'-'+_0x355733+'/'+_0x2a0809)[_0xf605('0x2f')](_0x54ea52);}return null;};}function patchUpdates(_0x5c93de){return function(_0x27ab47){try{jsonpatch[_0xf605('0x36')](_0x27ab47,_0x5c93de,!![]);}catch(_0x6d5120){return BPromise[_0xf605('0x37')](_0x6d5120);}return _0x27ab47[_0xf605('0x38')]();};}function saveUpdates(_0x22f032,_0x4e12d3){return function(_0xf5612e){if(_0xf5612e){return _0xf5612e['update'](_0x22f032)[_0xf605('0x21')](function(_0x5d9f57){return _0x5d9f57;});}return null;};}function removeEntity(_0x5924ce,_0x278dcb){return function(_0x4cfbb7){if(_0x4cfbb7){return _0x4cfbb7[_0xf605('0x39')]()['then'](function(){var _0x49d6ba=_0x4cfbb7[_0xf605('0x3a')]({'plain':!![]});var _0x234300='WhatsappAccounts';return db[_0xf605('0x3b')][_0xf605('0x39')]({'where':{'type':_0x234300,'resourceId':_0x49d6ba['id']}})[_0xf605('0x21')](function(){return _0x4cfbb7;});})[_0xf605('0x21')](function(){_0x5924ce[_0xf605('0x2d')](0xcc)[_0xf605('0x2e')]();});}};}function handleEntityNotFound(_0x2a0aa3,_0x556d11){return function(_0xe3b337){if(!_0xe3b337){_0x2a0aa3[_0xf605('0x2c')](0x194);}return _0xe3b337;};}function handleError(_0x592ede,_0x207a7e){_0x207a7e=_0x207a7e||0x1f4;return function(_0x886ce3){logger[_0xf605('0x26')](_0x886ce3['stack']);if(_0x886ce3[_0xf605('0x3c')]){delete _0x886ce3[_0xf605('0x3c')];}_0x592ede['status'](_0x207a7e)[_0xf605('0x3d')](_0x886ce3);};}exports[_0xf605('0x3e')]=function(_0x117ef3,_0x45f9e0){var _0x51cd96={'include':[{'model':db[_0xf605('0x3f')],'as':_0xf605('0x40')}]},_0x35a6d0={},_0x2701e8={'count':0x0,'rows':[]};var _0x41dce5=_[_0xf605('0x41')](db[_0xf605('0x42')][_0xf605('0x43')],function(_0x119808){return{'name':_0x119808[_0xf605('0x44')],'type':_0x119808['type'][_0xf605('0x45')]};});_0x35a6d0[_0xf605('0x46')]=_[_0xf605('0x41')](_0x41dce5,_0xf605('0x3c'));_0x35a6d0[_0xf605('0x47')]=_[_0xf605('0x48')](_0x117ef3[_0xf605('0x47')]);_0x35a6d0['filters']=_[_0xf605('0x49')](_0x35a6d0[_0xf605('0x46')],_0x35a6d0[_0xf605('0x47')]);_0x51cd96[_0xf605('0x4a')]=_['intersection'](_0x35a6d0[_0xf605('0x46')],qs[_0xf605('0x4b')](_0x117ef3[_0xf605('0x47')][_0xf605('0x4b')]));_0x51cd96[_0xf605('0x4a')]=_0x51cd96[_0xf605('0x4a')][_0xf605('0x4c')]?_0x51cd96[_0xf605('0x4a')]:_0x35a6d0[_0xf605('0x46')];if(!_0x117ef3[_0xf605('0x47')][_0xf605('0x4d')](_0xf605('0x4e'))){_0x51cd96['limit']=qs['limit'](_0x117ef3[_0xf605('0x47')][_0xf605('0x31')]);_0x51cd96[_0xf605('0x33')]=qs[_0xf605('0x33')](_0x117ef3[_0xf605('0x47')][_0xf605('0x33')]);}_0x51cd96[_0xf605('0x4f')]=qs['sort'](_0x117ef3['query'][_0xf605('0x50')]);_0x51cd96['where']=qs[_0xf605('0x51')](_[_0xf605('0x52')](_0x117ef3[_0xf605('0x47')],_0x35a6d0[_0xf605('0x51')]),_0x41dce5);if(_0x117ef3[_0xf605('0x47')][_0xf605('0x53')]){_0x51cd96[_0xf605('0x54')]=_[_0xf605('0x55')](_0x51cd96[_0xf605('0x54')],{'$or':_[_0xf605('0x41')](_0x41dce5,function(_0x2e1814){if(_0x2e1814[_0xf605('0x56')]!==_0xf605('0x57')){var _0x335857={};_0x335857[_0x2e1814[_0xf605('0x3c')]]={'$like':'%'+_0x117ef3[_0xf605('0x47')][_0xf605('0x53')]+'%'};return _0x335857;}})});}_0x51cd96=_['merge']({},_0x51cd96,_0x117ef3[_0xf605('0x58')]);var _0x57a232={'where':_0x51cd96[_0xf605('0x54')]};return db[_0xf605('0x42')][_0xf605('0x32')](_0x57a232)[_0xf605('0x21')](function(_0x46805a){_0x2701e8['count']=_0x46805a;if(_0x117ef3[_0xf605('0x47')]['includeAll']){_0x51cd96[_0xf605('0x59')]=[{'all':!![]}];}return db['WhatsappAccount'][_0xf605('0x5a')](_0x51cd96);})[_0xf605('0x21')](function(_0x235748){_0x2701e8[_0xf605('0x5b')]=_0x235748;return _0x2701e8;})[_0xf605('0x21')](respondWithFilteredResult(_0x45f9e0,_0x51cd96))[_0xf605('0x2b')](handleError(_0x45f9e0,null));};exports[_0xf605('0x5c')]=function(_0x2ff1c5,_0x5311a7){var _0x32366e={'raw':![],'where':{'id':_0x2ff1c5[_0xf605('0x5d')]['id']},'include':[{'model':db[_0xf605('0x3f')],'as':_0xf605('0x40')}]},_0x13aee8={};_0x13aee8[_0xf605('0x46')]=_[_0xf605('0x48')](db[_0xf605('0x42')]['rawAttributes']);_0x13aee8[_0xf605('0x47')]=_[_0xf605('0x48')](_0x2ff1c5[_0xf605('0x47')]);_0x13aee8[_0xf605('0x51')]=_[_0xf605('0x49')](_0x13aee8['model'],_0x13aee8[_0xf605('0x47')]);_0x32366e[_0xf605('0x4a')]=_[_0xf605('0x49')](_0x13aee8[_0xf605('0x46')],qs[_0xf605('0x4b')](_0x2ff1c5[_0xf605('0x47')]['fields']));_0x32366e[_0xf605('0x4a')]=_0x32366e[_0xf605('0x4a')][_0xf605('0x4c')]?_0x32366e[_0xf605('0x4a')]:_0x13aee8[_0xf605('0x46')];if(_0x2ff1c5[_0xf605('0x47')][_0xf605('0x5e')]){_0x32366e['include']=[{'all':!![]}];}_0x32366e=_[_0xf605('0x55')]({},_0x32366e,_0x2ff1c5[_0xf605('0x58')]);return db[_0xf605('0x42')][_0xf605('0x5f')](_0x32366e)[_0xf605('0x21')](handleEntityNotFound(_0x5311a7,null))[_0xf605('0x21')](respondWithResult(_0x5311a7,null))['catch'](handleError(_0x5311a7,null));};exports[_0xf605('0x60')]=function(_0xe6518a,_0x3a384d){return db[_0xf605('0x42')]['create'](_0xe6518a[_0xf605('0x61')],{})[_0xf605('0x21')](function(_0x50ec6a){var _0x379dab=_0xe6518a['user'][_0xf605('0x3a')]({'plain':!![]});if(!_0x379dab)throw new Error(_0xf605('0x62'));if(_0x379dab['role']===_0xf605('0x63')){var _0x3ec1bc=_0x50ec6a[_0xf605('0x3a')]({'plain':!![]});var _0x5a0e22=_0xf605('0x64');return db['UserProfileSection']['find']({'where':{'name':_0x5a0e22,'userProfileId':_0x379dab[_0xf605('0x65')]},'raw':!![]})[_0xf605('0x21')](function(_0x361f15){if(_0x361f15&&_0x361f15[_0xf605('0x66')]===0x0){return db[_0xf605('0x3b')][_0xf605('0x60')]({'name':_0x3ec1bc['name'],'resourceId':_0x3ec1bc['id'],'type':_0x361f15['name'],'sectionId':_0x361f15['id']},{})[_0xf605('0x21')](function(){return _0x50ec6a;});}else{return _0x50ec6a;}})[_0xf605('0x2b')](function(_0x3b76ee){logger[_0xf605('0x26')](_0xf605('0x67'),_0x3b76ee);throw _0x3b76ee;});}return _0x50ec6a;})['then'](respondWithResult(_0x3a384d,0xc9))['catch'](handleError(_0x3a384d,null));};exports['update']=function(_0x56852a,_0x3a3271){if(_0x56852a[_0xf605('0x61')]['id']){delete _0x56852a[_0xf605('0x61')]['id'];}return db[_0xf605('0x42')][_0xf605('0x5f')]({'where':{'id':_0x56852a[_0xf605('0x5d')]['id']},'include':[{'model':db[_0xf605('0x3f')],'as':_0xf605('0x40')}]})['then'](handleEntityNotFound(_0x3a3271,null))[_0xf605('0x21')](saveUpdates(_0x56852a[_0xf605('0x61')],null))['then'](respondWithResult(_0x3a3271,null))[_0xf605('0x2b')](handleError(_0x3a3271,null));};exports[_0xf605('0x39')]=function(_0x220e02,_0x36d4cf){return db[_0xf605('0x42')]['find']({'where':{'id':_0x220e02[_0xf605('0x5d')]['id']}})['then'](handleEntityNotFound(_0x36d4cf,null))['then'](removeEntity(_0x36d4cf,null))[_0xf605('0x2b')](handleError(_0x36d4cf,null));};exports[_0xf605('0x68')]=function(_0xc9ec2c,_0x4a1c00){return db[_0xf605('0x42')][_0xf605('0x68')]()[_0xf605('0x21')](respondWithResult(_0x4a1c00,null))[_0xf605('0x2b')](handleError(_0x4a1c00,null));};exports[_0xf605('0x69')]=function(_0x1bd788,_0x206166,_0x230439){if(_0x1bd788[_0xf605('0x61')]['id']){delete _0x1bd788[_0xf605('0x61')]['id'];}return db[_0xf605('0x42')][_0xf605('0x5f')]({'where':{'id':_0x1bd788[_0xf605('0x5d')]['id']}})[_0xf605('0x21')](handleEntityNotFound(_0x206166,null))[_0xf605('0x21')](function(_0x12b977){if(_0x12b977){_0x1bd788['body'][_0xf605('0x6a')]=_0x12b977['id'];return db[_0xf605('0x6b')][_0xf605('0x60')](_0x1bd788['body']);}})['then'](respondWithResult(_0x206166,null))['catch'](handleError(_0x206166,null));};exports[_0xf605('0x6c')]=function(_0x1a61f1,_0x131d54,_0x56f4d1){var _0x329916={'raw':![],'where':{}};var _0x1c2855={};var _0x50e7c4={'count':0x0,'rows':[]};return db[_0xf605('0x42')][_0xf605('0x6d')]({'where':{'id':_0x1a61f1[_0xf605('0x5d')]['id']}})[_0xf605('0x21')](handleEntityNotFound(_0x131d54,null))[_0xf605('0x21')](function(_0x38848d){if(_0x38848d){_0x1c2855[_0xf605('0x46')]=_[_0xf605('0x48')](db[_0xf605('0x6b')]['rawAttributes']);_0x1c2855['query']=_[_0xf605('0x48')](_0x1a61f1[_0xf605('0x47')]);_0x1c2855[_0xf605('0x51')]=_[_0xf605('0x49')](_0x1c2855[_0xf605('0x46')],_0x1c2855[_0xf605('0x47')]);_0x329916[_0xf605('0x4a')]=_['intersection'](_0x1c2855[_0xf605('0x46')],qs[_0xf605('0x4b')](_0x1a61f1['query'][_0xf605('0x4b')]));_0x329916[_0xf605('0x4a')]=_0x329916[_0xf605('0x4a')][_0xf605('0x4c')]?_0x329916[_0xf605('0x4a')]:_0x1c2855[_0xf605('0x46')];if(!_0x1a61f1[_0xf605('0x47')]['hasOwnProperty'](_0xf605('0x4e'))){_0x329916['limit']=qs[_0xf605('0x31')](_0x1a61f1[_0xf605('0x47')][_0xf605('0x31')]);_0x329916[_0xf605('0x33')]=qs[_0xf605('0x33')](_0x1a61f1[_0xf605('0x47')]['offset']);}_0x329916[_0xf605('0x4f')]=qs[_0xf605('0x50')](_0x1a61f1['query'][_0xf605('0x50')]);_0x329916[_0xf605('0x54')]=qs[_0xf605('0x51')](_[_0xf605('0x52')](_0x1a61f1[_0xf605('0x47')],_0x1c2855[_0xf605('0x51')]));_0x329916[_0xf605('0x54')][_0xf605('0x6a')]=_0x38848d['id'];if(_0x1a61f1[_0xf605('0x47')][_0xf605('0x53')]){_0x329916[_0xf605('0x54')]=_[_0xf605('0x55')](_0x329916[_0xf605('0x54')],{'$or':_[_0xf605('0x41')](_0x329916[_0xf605('0x4a')],function(_0x1fc54a){var _0x1602ef={};_0x1602ef[_0x1fc54a]={'$like':'%'+_0x1a61f1[_0xf605('0x47')][_0xf605('0x53')]+'%'};return _0x1602ef;})});}_0x329916=_[_0xf605('0x55')]({},_0x329916,_0x1a61f1[_0xf605('0x58')]);return db[_0xf605('0x6b')][_0xf605('0x32')]({'where':_0x329916[_0xf605('0x54')]})[_0xf605('0x21')](function(_0x2173ea){_0x50e7c4['count']=_0x2173ea;if(_0x1a61f1[_0xf605('0x47')][_0xf605('0x5e')]){_0x329916[_0xf605('0x59')]=[{'all':!![]}];}return db[_0xf605('0x6b')][_0xf605('0x5a')](_0x329916);})[_0xf605('0x21')](function(_0x5e7d4b){_0x50e7c4[_0xf605('0x5b')]=_0x5e7d4b;return _0x50e7c4;});}})['then'](respondWithFilteredResult(_0x131d54,_0x329916))[_0xf605('0x2b')](handleError(_0x131d54,null));};exports[_0xf605('0x6e')]=function(_0x1dfbab,_0x2120f5,_0x243c74){return db[_0xf605('0x42')][_0xf605('0x5f')]({'where':{'id':_0x1dfbab['params']['id']}})[_0xf605('0x21')](handleEntityNotFound(_0x2120f5,null))[_0xf605('0x21')](function(_0x1688c3){if(_0x1688c3){return _0x1688c3[_0xf605('0x6e')](_0x1dfbab[_0xf605('0x47')][_0xf605('0x6f')]);}})[_0xf605('0x21')](respondWithStatusCode(_0x2120f5,null))[_0xf605('0x2b')](handleError(_0x2120f5,null));};exports[_0xf605('0x70')]=function(_0x55a2fd,_0x1aa7aa,_0x5a5c67){if(_0x55a2fd[_0xf605('0x61')]['id']){delete _0x55a2fd[_0xf605('0x61')]['id'];}return db[_0xf605('0x42')]['find']({'where':{'id':_0x55a2fd[_0xf605('0x5d')]['id']}})[_0xf605('0x21')](handleEntityNotFound(_0x1aa7aa,null))[_0xf605('0x21')](function(_0x25ec4f){if(_0x25ec4f){_0x55a2fd['body'][_0xf605('0x6a')]=_0x25ec4f['id'];return db[_0xf605('0x71')][_0xf605('0x60')](_0x55a2fd[_0xf605('0x61')]);}})[_0xf605('0x21')](respondWithResult(_0x1aa7aa,null))[_0xf605('0x2b')](handleError(_0x1aa7aa,null));};exports['getAnswers']=function(_0x202a36,_0x515a44,_0xa70444){var _0x10aa8c={'raw':![],'where':{}};var _0x13a0d7={};var _0x47b548={'count':0x0,'rows':[]};return db[_0xf605('0x42')][_0xf605('0x6d')]({'where':{'id':_0x202a36[_0xf605('0x5d')]['id']}})[_0xf605('0x21')](handleEntityNotFound(_0x515a44,null))[_0xf605('0x21')](function(_0x429db5){if(_0x429db5){_0x13a0d7[_0xf605('0x46')]=_['keys'](db[_0xf605('0x71')]['rawAttributes']);_0x13a0d7[_0xf605('0x47')]=_[_0xf605('0x48')](_0x202a36[_0xf605('0x47')]);_0x13a0d7[_0xf605('0x51')]=_[_0xf605('0x49')](_0x13a0d7[_0xf605('0x46')],_0x13a0d7[_0xf605('0x47')]);_0x10aa8c[_0xf605('0x4a')]=_[_0xf605('0x49')](_0x13a0d7[_0xf605('0x46')],qs[_0xf605('0x4b')](_0x202a36[_0xf605('0x47')][_0xf605('0x4b')]));_0x10aa8c[_0xf605('0x4a')]=_0x10aa8c[_0xf605('0x4a')][_0xf605('0x4c')]?_0x10aa8c[_0xf605('0x4a')]:_0x13a0d7[_0xf605('0x46')];if(!_0x202a36[_0xf605('0x47')]['hasOwnProperty']('nolimit')){_0x10aa8c[_0xf605('0x31')]=qs['limit'](_0x202a36[_0xf605('0x47')][_0xf605('0x31')]);_0x10aa8c['offset']=qs['offset'](_0x202a36[_0xf605('0x47')][_0xf605('0x33')]);}_0x10aa8c[_0xf605('0x4f')]=qs[_0xf605('0x50')](_0x202a36[_0xf605('0x47')][_0xf605('0x50')]);_0x10aa8c['where']=qs[_0xf605('0x51')](_[_0xf605('0x52')](_0x202a36[_0xf605('0x47')],_0x13a0d7['filters']));_0x10aa8c['where']['WhatsappAccountId']=_0x429db5['id'];if(_0x202a36[_0xf605('0x47')][_0xf605('0x53')]){_0x10aa8c['where']=_['merge'](_0x10aa8c[_0xf605('0x54')],{'$or':_['map'](_0x10aa8c[_0xf605('0x4a')],function(_0x1fea36){var _0x209888={};_0x209888[_0x1fea36]={'$like':'%'+_0x202a36['query'][_0xf605('0x53')]+'%'};return _0x209888;})});}_0x10aa8c=_['merge']({},_0x10aa8c,_0x202a36[_0xf605('0x58')]);return db[_0xf605('0x71')][_0xf605('0x32')]({'where':_0x10aa8c['where']})[_0xf605('0x21')](function(_0x4db247){_0x47b548['count']=_0x4db247;if(_0x202a36[_0xf605('0x47')]['includeAll']){_0x10aa8c[_0xf605('0x59')]=[{'all':!![]}];}return db[_0xf605('0x71')][_0xf605('0x5a')](_0x10aa8c);})[_0xf605('0x21')](function(_0x5bacac){_0x47b548[_0xf605('0x5b')]=_0x5bacac;return _0x47b548;});}})[_0xf605('0x21')](respondWithFilteredResult(_0x515a44,_0x10aa8c))[_0xf605('0x2b')](handleError(_0x515a44,null));};exports[_0xf605('0x72')]=function(_0x527ff1,_0x5a8842,_0x2bd50a){return db[_0xf605('0x42')][_0xf605('0x5f')]({'where':{'id':_0x527ff1[_0xf605('0x5d')]['id']}})[_0xf605('0x21')](handleEntityNotFound(_0x5a8842,null))[_0xf605('0x21')](function(_0x3f294c){if(_0x3f294c){return _0x3f294c[_0xf605('0x72')](_0x527ff1[_0xf605('0x47')][_0xf605('0x6f')]);}})[_0xf605('0x21')](respondWithStatusCode(_0x5a8842,null))[_0xf605('0x2b')](handleError(_0x5a8842,null));};exports[_0xf605('0x73')]=function(_0x59d67a,_0x44b2ed,_0x211ec7){return db['WhatsappAccount'][_0xf605('0x5f')]({'where':{'id':_0x59d67a[_0xf605('0x5d')]['id']}})[_0xf605('0x21')](handleEntityNotFound(_0x44b2ed,null))[_0xf605('0x21')](function(_0x3636e0){if(_0x3636e0){return _0x3636e0[_0xf605('0x73')](_0x59d67a[_0xf605('0x61')][_0xf605('0x6f')],_['omit'](_0x59d67a['body'],[_0xf605('0x6f'),'id'])||{})[_0xf605('0x74')](function(_0xa8bf5a){for(var _0xd9e342=0x0;_0xd9e342<_0x59d67a['body'][_0xf605('0x6f')][_0xf605('0x4c')];_0xd9e342+=0x1){socket['emit'](_0xf605('0x75'),{'UserId':Number(_0x59d67a[_0xf605('0x61')]['ids'][_0xd9e342]),'WhatsappAccountId':Number(_0x59d67a[_0xf605('0x5d')]['id'])});}return _0xa8bf5a;});}})['then'](respondWithResult(_0x44b2ed,null))['catch'](handleError(_0x44b2ed,null));};exports[_0xf605('0x76')]=function(_0x9144bb,_0xc6d68d,_0x575949){return db[_0xf605('0x42')][_0xf605('0x5f')]({'where':{'id':_0x9144bb[_0xf605('0x5d')]['id']}})['then'](handleEntityNotFound(_0xc6d68d,null))[_0xf605('0x21')](function(_0x9c5554){if(_0x9c5554){return _0x9c5554[_0xf605('0x76')](_0x9144bb[_0xf605('0x47')]['ids'])[_0xf605('0x21')](function(){if(_[_0xf605('0x77')](_0x9144bb[_0xf605('0x47')][_0xf605('0x6f')])){for(var _0xbc15fc=0x0;_0xbc15fc<_0x9144bb[_0xf605('0x47')][_0xf605('0x6f')]['length'];_0xbc15fc+=0x1){socket[_0xf605('0x78')]('userWhatsappAccount:remove',{'UserId':Number(_0x9144bb[_0xf605('0x47')][_0xf605('0x6f')][_0xbc15fc]),'WhatsappAccountId':Number(_0x9144bb[_0xf605('0x5d')]['id'])});}}else{socket[_0xf605('0x78')](_0xf605('0x79'),{'UserId':Number(_0x9144bb['query']['ids']),'WhatsappAccountId':Number(_0x9144bb[_0xf605('0x5d')]['id'])});}});}})['then'](respondWithStatusCode(_0xc6d68d,null))[_0xf605('0x2b')](handleError(_0xc6d68d,null));};exports[_0xf605('0x7a')]=function(_0x109445,_0x571f11,_0x377acf){var _0x423039={};var _0x435c82={};var _0x3507fb;var _0xe2e82;return db[_0xf605('0x42')][_0xf605('0x6d')]({'where':{'id':_0x109445['params']['id']}})[_0xf605('0x21')](handleEntityNotFound(_0x571f11,null))['then'](function(_0x29084a){if(_0x29084a){_0x3507fb=_0x29084a;_0x435c82[_0xf605('0x46')]=_['keys'](db[_0xf605('0x7b')][_0xf605('0x43')]);_0x435c82['query']=_[_0xf605('0x48')](_0x109445['query']);_0x435c82[_0xf605('0x51')]=_[_0xf605('0x49')](_0x435c82[_0xf605('0x46')],_0x435c82['query']);_0x423039[_0xf605('0x4a')]=_[_0xf605('0x49')](_0x435c82['model'],qs['fields'](_0x109445[_0xf605('0x47')]['fields']));_0x423039[_0xf605('0x4a')]=_0x423039[_0xf605('0x4a')][_0xf605('0x4c')]?_0x423039[_0xf605('0x4a')]:_0x435c82[_0xf605('0x46')];_0x423039['order']=qs[_0xf605('0x50')](_0x109445[_0xf605('0x47')][_0xf605('0x50')]);_0x423039[_0xf605('0x54')]=qs[_0xf605('0x51')](_['pick'](_0x109445[_0xf605('0x47')],_0x435c82['filters']));if(_0x109445[_0xf605('0x47')]['filter']){_0x423039[_0xf605('0x54')]=_[_0xf605('0x55')](_0x423039[_0xf605('0x54')],{'$or':_[_0xf605('0x41')](_0x423039[_0xf605('0x4a')],function(_0x5b392d){var _0x57157d={};_0x57157d[_0x5b392d]={'$like':'%'+_0x109445[_0xf605('0x47')][_0xf605('0x53')]+'%'};return _0x57157d;})});}_0x423039=_[_0xf605('0x55')]({},_0x423039,_0x109445[_0xf605('0x58')]);return _0x3507fb[_0xf605('0x7a')](_0x423039);}})['then'](function(_0x2ac4c2){if(_0x2ac4c2){_0xe2e82=_0x2ac4c2[_0xf605('0x4c')];if(!_0x109445['query']['hasOwnProperty']('nolimit')){_0x423039[_0xf605('0x31')]=qs[_0xf605('0x31')](_0x109445['query'][_0xf605('0x31')]);_0x423039['offset']=qs['offset'](_0x109445[_0xf605('0x47')][_0xf605('0x33')]);}return _0x3507fb['getAgents'](_0x423039);}})[_0xf605('0x21')](function(_0x1fb3cd){if(_0x1fb3cd){return _0x1fb3cd?{'count':_0xe2e82,'rows':_0x1fb3cd}:null;}})[_0xf605('0x21')](respondWithResult(_0x571f11,null))[_0xf605('0x2b')](handleError(_0x571f11,null));};exports[_0xf605('0x7c')]=function(_0x1df99e,_0x286a3e){var _0x4b7506=_0x1df99e[_0xf605('0x5d')]['id'];var _0x67fbb0=_0x1df99e[_0xf605('0x61')];var _0x442beb=0xc8;var _0x19cca4=null;return db[_0xf605('0x7d')][_0xf605('0x7e')]({'isolationLevel':db[_0xf605('0x7d')][_0xf605('0x7f')][_0xf605('0x80')][_0xf605('0x81')]},function(_0x52a175){return db[_0xf605('0x42')][_0xf605('0x6d')]({'where':{'id':_0x4b7506},'transaction':_0x52a175})[_0xf605('0x21')](function(_0x537193){if(_0x537193){return db[_0xf605('0x82')][_0xf605('0x39')]({'where':{'WhatsappAccountId':_0x4b7506},'transaction':_0x52a175})['then'](function(){var _0x329ab5=_[_0xf605('0x41')](_0x67fbb0,function(_0x41e1ba){_0x41e1ba[_0xf605('0x6a')]=_0x4b7506;return _0x41e1ba;});return db[_0xf605('0x82')][_0xf605('0x83')](_0x329ab5,{'transaction':_0x52a175});});}else{_0x442beb=0x194;_0x19cca4=[];}});})[_0xf605('0x21')](function(){if(_0x442beb!==0x194){return db['WhatsappApplication'][_0xf605('0x84')]({'where':{'WhatsappAccountId':_0x4b7506},'order':'priority'})['then'](function(_0x1b4c8f){_0x19cca4=_0x1b4c8f;});}})[_0xf605('0x2b')](function(_0x318bc2){_0x442beb=0x1f4;logger['error'](_0x318bc2['stack']);if(_0x318bc2[_0xf605('0x3c')]){delete _0x318bc2[_0xf605('0x3c')];}_0x19cca4=_0x318bc2;})['finally'](function(){if(_0x19cca4===null){_0x286a3e[_0xf605('0x2c')](_0x442beb);}else{if(_0x442beb===0x1f4){_0x286a3e[_0xf605('0x2d')](_0x442beb)[_0xf605('0x3d')](_0x19cca4);}else{_0x286a3e[_0xf605('0x2d')](_0x442beb)[_0xf605('0x2f')](_0x19cca4);}}});};exports[_0xf605('0x85')]=function(_0x136076,_0x53d852,_0x548c9d){var _0x444471={};var _0x41b87a={};var _0x2bac65;var _0x1f4cf2;return db[_0xf605('0x42')]['findOne']({'where':{'id':_0x136076[_0xf605('0x5d')]['id']}})['then'](handleEntityNotFound(_0x53d852,null))[_0xf605('0x21')](function(_0x28956f){if(_0x28956f){_0x2bac65=_0x28956f;_0x41b87a[_0xf605('0x46')]=_[_0xf605('0x48')](db[_0xf605('0x82')][_0xf605('0x43')]);_0x41b87a[_0xf605('0x47')]=_[_0xf605('0x48')](_0x136076[_0xf605('0x47')]);_0x41b87a[_0xf605('0x51')]=_['intersection'](_0x41b87a[_0xf605('0x46')],_0x41b87a[_0xf605('0x47')]);_0x444471[_0xf605('0x4a')]=_[_0xf605('0x49')](_0x41b87a[_0xf605('0x46')],qs[_0xf605('0x4b')](_0x136076[_0xf605('0x47')][_0xf605('0x4b')]));_0x444471['attributes']=_0x444471[_0xf605('0x4a')]['length']?_0x444471[_0xf605('0x4a')]:_0x41b87a[_0xf605('0x46')];_0x444471['order']=qs['sort'](_0x136076[_0xf605('0x47')][_0xf605('0x50')]);_0x444471[_0xf605('0x54')]=qs[_0xf605('0x51')](_[_0xf605('0x52')](_0x136076[_0xf605('0x47')],_0x41b87a[_0xf605('0x51')]));if(_0x136076[_0xf605('0x47')][_0xf605('0x53')]){_0x444471[_0xf605('0x54')]=_[_0xf605('0x55')](_0x444471[_0xf605('0x54')],{'$or':_['map'](_0x444471[_0xf605('0x4a')],function(_0x31a198){var _0x2a2f24={};_0x2a2f24[_0x31a198]={'$like':'%'+_0x136076[_0xf605('0x47')]['filter']+'%'};return _0x2a2f24;})});}_0x444471=_[_0xf605('0x55')]({},_0x444471,_0x136076[_0xf605('0x58')]);return _0x2bac65[_0xf605('0x85')](_0x444471);}})['then'](function(_0x356e44){if(_0x356e44){_0x1f4cf2=_0x356e44[_0xf605('0x4c')];if(!_0x136076[_0xf605('0x47')][_0xf605('0x4d')]('nolimit')){_0x444471[_0xf605('0x31')]=qs[_0xf605('0x31')](_0x136076[_0xf605('0x47')][_0xf605('0x31')]);_0x444471['offset']=qs[_0xf605('0x33')](_0x136076[_0xf605('0x47')][_0xf605('0x33')]);}return _0x2bac65[_0xf605('0x85')](_0x444471);}})[_0xf605('0x21')](function(_0x4c4885){if(_0x4c4885){return _0x4c4885?{'count':_0x1f4cf2,'rows':_0x4c4885}:null;}})['then'](respondWithResult(_0x53d852,null))[_0xf605('0x2b')](handleError(_0x53d852,null));};exports['notify']=function(_0x3bf266,_0x281b36,_0x449ade){var _0x162597={'channel':_0xf605('0x86')};var _0x3cafc8=[];var _0x49deb1=[];var _0x1edcaa={};return db[_0xf605('0x42')][_0xf605('0x5f')]({'where':{'id':_0x3bf266['params']['id']},'include':[{'model':db[_0xf605('0x82')],'as':_0xf605('0x87')}]})['then'](handleEntityNotFound(_0x281b36,null))[_0xf605('0x21')](function(_0x4f12dd){_0x162597[_0xf605('0x88')]=_0x4f12dd;if(_0x162597[_0xf605('0x88')]&&_0x162597[_0xf605('0x88')][_0xf605('0x56')]===_0xf605('0x89')&&_0x3bf266[_0xf605('0x61')][_0xf605('0x8a')]){if(_0x3bf266['body'][_0xf605('0x8a')][_0xf605('0x4c')]===0x0)return;if(_0x3bf266['body'][_0xf605('0x8a')][0x0][_0xf605('0x8b')]!=='read')return;return db['WhatsappMessage'][_0xf605('0x8c')]({'read':!![],'readAt':_0x3bf266[_0xf605('0x61')][_0xf605('0x8a')][0x0][_0xf605('0x8d')]},{'where':{'messageId':_0x3bf266[_0xf605('0x61')][_0xf605('0x8a')][0x0]['message_id']},'individualHooks':!![]})[_0xf605('0x21')](function(_0x1447df){return _0x281b36[_0xf605('0x2d')](0xc8)[_0xf605('0x2f')](_0x1447df);});}_0x162597[_0xf605('0x8e')]=_[_0xf605('0x8f')](_0x4f12dd['Applications'],['priority'],['asc']);if(_0x162597[_0xf605('0x88')][_0xf605('0x87')]){delete _0x162597[_0xf605('0x88')][_0xf605('0x87')];}return db[_0xf605('0x90')][_0xf605('0x68')]()[_0xf605('0x21')](function(_0x144a75){if(!_0x144a75){throw new db['Sequelize'][(_0xf605('0x91'))](_0xf605('0x92'));}_0x3cafc8=_[_0xf605('0x93')](_[_0xf605('0x48')](_0x144a75),[_0xf605('0x94'),_0xf605('0x95')]);_0x49deb1=_['difference'](_[_0xf605('0x48')](_0x144a75),[_0xf605('0x94'),_0xf605('0x95'),_0xf605('0x96'),_0xf605('0x97')]);_0x162597['body']={'mapKey':'mobile'};if(_0x162597['account']&&_0x162597[_0xf605('0x88')][_0xf605('0x56')]==='twilio'){_0x162597['body']['from']=_0x3bf266[_0xf605('0x61')]['From'][_0xf605('0x98')](_0xf605('0x99'),'');_0x162597[_0xf605('0x61')][_0xf605('0x61')]=_0x3bf266[_0xf605('0x61')][_0xf605('0x9a')];_0x162597[_0xf605('0x61')]['messageId']=_0x3bf266[_0xf605('0x61')][_0xf605('0x9b')];}if(_0x162597[_0xf605('0x88')]&&_0x162597[_0xf605('0x88')][_0xf605('0x56')]==='sinch'){_0x162597['body'][_0xf605('0x9c')]=_0x3bf266[_0xf605('0x61')][_0xf605('0x9d')][0x0]['from'];_0x162597[_0xf605('0x61')][_0xf605('0x61')]=_0x3bf266[_0xf605('0x61')][_0xf605('0x9d')][0x0][_0xf605('0x29')][_0xf605('0x61')];_0x162597[_0xf605('0x61')]['messageId']=_0x3bf266[_0xf605('0x61')][_0xf605('0x9d')][0x0][_0xf605('0x9e')];}if(_0x162597[_0xf605('0x61')]['id']){delete _0x162597[_0xf605('0x61')]['id'];}if(_[_0xf605('0x9f')](_0x162597[_0xf605('0x61')][_0xf605('0x9c')])){throw new db[(_0xf605('0xa0'))][(_0xf605('0x91'))](_0xf605('0xa1'));}if(_['isNil'](_0x162597[_0xf605('0x61')][_0xf605('0x61')])||_0x162597[_0xf605('0x61')][_0xf605('0x61')]===''){throw new db['Sequelize']['ValidationError'](_0xf605('0xa2'));}if(_[_0xf605('0x9f')](_0x162597[_0xf605('0x61')][_0xf605('0xa3')])){throw new db['Sequelize'][(_0xf605('0x91'))](_0xf605('0xa4')+_0x49deb1);}if(!_[_0xf605('0xa5')](_0x49deb1,_0x162597[_0xf605('0x61')][_0xf605('0xa3')])){throw new db['Sequelize']['ValidationError'](_0xf605('0xa6')+_0x49deb1);}_0x1edcaa[_0x162597[_0xf605('0x61')]['mapKey']]=_0x162597['body'][_0xf605('0x9c')];return db[_0xf605('0xa7')]['find']({'where':{'id':_0x162597['account'][_0xf605('0x97')]},'include':[{'model':db['CmContact'],'as':_0xf605('0xa8'),'where':_0x1edcaa,'limit':0x1,'order':[[_0xf605('0x95'),_0xf605('0xa9')]]}]});})[_0xf605('0x21')](handleEntityNotFound(_0x281b36,null))[_0xf605('0x21')](function(_0x3c0f8c){if(_0x3c0f8c){_0x162597[_0xf605('0xaa')]=_[_0xf605('0xab')](_0x3c0f8c,[_0xf605('0xa8')]);if(_0x3c0f8c[_0xf605('0xa8')][_0xf605('0x4c')]){return _0x3c0f8c[_0xf605('0xa8')][0x0];}var _0x5eafa6=_[_0xf605('0x1b')](_0x162597[_0xf605('0x61')],{'firstName':_0x162597[_0xf605('0x61')]['from'],'ListId':_0x3c0f8c['id']});_0x5eafa6[_0x162597[_0xf605('0x61')][_0xf605('0xa3')]]=_0x162597[_0xf605('0x61')][_0xf605('0x9c')];return db[_0xf605('0x90')][_0xf605('0x60')](_0x5eafa6,{'fields':_0x3cafc8,'raw':!![]});}})['then'](handleEntityNotFound(_0x281b36,null))[_0xf605('0x21')](function(_0xc2bdab){if(_0xc2bdab){_0x162597[_0xf605('0xac')]=_0xc2bdab;var _0x30b638={'ContactId':_0xc2bdab['id'],'phone':_0x162597[_0xf605('0x61')]['from'],'WhatsappAccountId':_0x3bf266[_0xf605('0x5d')]['id']};var _0x208627={'ContactId':_0xc2bdab['id'],'WhatsappAccountId':_0x3bf266[_0xf605('0x5d')]['id'],'closed':![]};return db['WhatsappInteraction'][_0xf605('0x5f')]({'where':_0x208627})[_0xf605('0x21')](function(_0x81446a){if(_0x81446a){return[_0x81446a,![]];}return db['WhatsappInteraction'][_0xf605('0x60')](_0x30b638)[_0xf605('0x21')](function(_0x1a1f35){return[_0x1a1f35,!![]];});});}})[_0xf605('0x74')](function(_0x34c8b3,_0x219b60){_0x162597[_0xf605('0xad')]=_0x34c8b3[_0xf605('0x3a')]({'plain':!![]});_0x162597[_0xf605('0xad')][_0xf605('0xae')]=![];if(_0x219b60){if(_0x162597[_0xf605('0x88')][_0xf605('0xaf')]){_0x162597[_0xf605('0x8e')][_0xf605('0xb0')]({'id':0x0,'priority':_0x162597[_0xf605('0x8e')][_0xf605('0x4c')]+0x1,'app':_0xf605('0xb1'),'appdata':_0xf605('0xb2'),'interval':_0xf605('0xb3')});}_0x162597['interaction'][_0xf605('0xae')]=!![];}return db['WhatsappMessage']['create']({'phone':_0x162597[_0xf605('0x61')]['from'],'messageId':_0x162597[_0xf605('0x61')][_0xf605('0xb4')],'body':_0x162597[_0xf605('0x61')][_0xf605('0x61')],'WhatsappAccountId':_0x3bf266[_0xf605('0x5d')]['id'],'WhatsappInteractionId':_0x34c8b3['id'],'direction':'in','ContactId':_0x34c8b3['ContactId'],'AttachmentId':_0x162597[_0xf605('0x61')]['AttachmentId']});})[_0xf605('0x21')](function(_0x2c7d4e){_0x162597['message']=_0x2c7d4e;if(!_0x162597['interaction'][_0xf605('0xb5')])return;return db[_0xf605('0x7b')][_0xf605('0x5f')]({'attributes':['id',_0xf605('0x3c')],'where':{'id':_0x162597[_0xf605('0xad')][_0xf605('0xb5')]}});})['then'](function(_0x3f9b0d){if(_0x3f9b0d){_0x162597[_0xf605('0x8e')]['unshift']({'id':0x0,'priority':0x0,'app':_0xf605('0xb6'),'appdata':_0x3f9b0d[_0xf605('0x3c')]+','+(_0x162597[_0xf605('0x88')][_0xf605('0xb7')]||0xa),'interval':_0xf605('0xb3')});}if(!_0x162597['interaction'][_0xf605('0xb8')])return;return db[_0xf605('0xb9')][_0xf605('0x5f')]({'attributes':['id',_0xf605('0x3c')],'where':{'id':_0x162597[_0xf605('0xad')][_0xf605('0xb8')]}});})[_0xf605('0x21')](function(_0x37a948){if(_0x37a948){_0x162597[_0xf605('0x8e')][_0xf605('0xba')]({'id':0x0,'priority':0x1,'app':_0xf605('0xbb'),'appdata':_0x37a948[_0xf605('0x3c')]+','+(_0x162597['account']['waitForTheAssignedQueue']||0x12c),'interval':_0xf605('0xb3')});}return respondWithRpcPromise(_0xf605('0xbc'),_0xf605('0xbd'),_0x162597);})[_0xf605('0x21')](function(_0x348f28){if(_0x348f28){var _0x480182=0xc8;var _0x55f5a4=_0xf605('0xbe');logger[_0xf605('0x22')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x55f5a4,_0x480182,_0xf605('0xbf'));logger['debug'](_0xf605('0xc0'),_0x55f5a4,_0x480182,_0xf605('0xbf'),JSON[_0xf605('0x25')](_0x348f28));if(_0x162597['account'][_0xf605('0x56')]===_0xf605('0xc1')){return _0x281b36['status'](_0x480182)[_0xf605('0x34')](_0xf605('0xc2'),_0xf605('0xc3'))[_0xf605('0x3d')](_0xf605('0xc4'));}else{return _0x281b36[_0xf605('0x2d')](_0x480182)[_0xf605('0x2f')](_0x348f28);}}});})[_0xf605('0x2b')](handleError(_0x281b36,null));};exports['send']=function(_0x1924b9,_0x1971fa,_0x3cfd86){var _0x422834,_0x336143,_0x47d077;if(_[_0xf605('0x9f')](_0x1924b9[_0xf605('0x61')]['body'])||_0x1924b9[_0xf605('0x61')]['body']===''){throw new db[(_0xf605('0xa0'))][(_0xf605('0x91'))](_0xf605('0xa2'));}if(_['isNil'](_0x1924b9[_0xf605('0x61')]['to'])){throw new db[(_0xf605('0xa0'))]['ValidationError'](_0xf605('0xc5'));}_0x422834=_0x1924b9[_0xf605('0x61')]['to'];return db['WhatsappAccount'][_0xf605('0x5f')]({'where':{'id':_0x1924b9[_0xf605('0x5d')]['id']},'include':[{'model':db[_0xf605('0xa7')],'as':_0xf605('0xc6'),'include':[{'model':db[_0xf605('0x90')],'as':_0xf605('0xa8'),'where':{'mobile':_0x422834},'limit':0x1,'order':[[_0xf605('0x95'),_0xf605('0xa9')]]}]}]})[_0xf605('0x21')](handleEntityNotFound(_0x1971fa,null))['then'](function(_0x580450){if(_0x580450&&_0x580450[_0xf605('0xc6')]){_0x336143=_0x580450[_0xf605('0x3a')]({'plain':!![]});if(_0x336143[_0xf605('0xc6')]&&_0x336143[_0xf605('0xc6')][_0xf605('0xa8')]['length']){return _0x336143[_0xf605('0xc6')][_0xf605('0xa8')][0x0];}return db[_0xf605('0x90')][_0xf605('0x60')](_[_0xf605('0x1b')](_0x1924b9[_0xf605('0x61')],{'firstName':_0x422834,'mobile':_0x422834,'phone':_0x422834,'ListId':_0x336143['ListId']}));}})[_0xf605('0x21')](handleEntityNotFound(_0x1971fa,null))[_0xf605('0x21')](function(_0x34b95c){if(_0x34b95c){_0x47d077=_0x34b95c;return db[_0xf605('0xc7')]['find']({'where':{'ContactId':_0x47d077['id'],'closed':![],'WhatsappAccountId':_0x336143['id']}})[_0xf605('0x21')](function(_0xd917d0){if(_0xd917d0){return[_0xd917d0,![]];}return db[_0xf605('0xc7')]['create']({'UserId':_0x1924b9[_0xf605('0x63')]['id'],'ContactId':_0x47d077['id'],'WhatsappAccountId':_0x336143['id'],'phone':_0x422834,'firstMsgDirection':_0xf605('0xc8'),'Messages':[_[_0xf605('0x55')](_0x1924b9[_0xf605('0x61')],{'read':![],'body':_0x1924b9['body']['body'],'phone':_0x422834,'WhatsappAccountId':_0x336143['id'],'UserId':_0x1924b9[_0xf605('0x63')]['id'],'ContactId':_0x47d077['id']})]},{'include':[{'model':db[_0xf605('0xc9')],'as':_0xf605('0xca')}]})['then'](function(_0x44f9e2){return[_0x44f9e2,!![]];});});}})[_0xf605('0x74')](function(_0x32e19,_0x21c100){if(_0x21c100){return _0x32e19;}return db['WhatsappMessage'][_0xf605('0x60')](_[_0xf605('0x55')](_0x1924b9[_0xf605('0x61')],{'read':![],'body':_0x1924b9[_0xf605('0x61')]['body'],'phone':_0x422834,'WhatsappAccountId':_0x336143['id'],'WhatsappInteractionId':_0x32e19['id'],'UserId':_0x1924b9[_0xf605('0x63')]['id'],'ContactId':_0x47d077['id']}))[_0xf605('0x21')](function(_0x26b59e){_0x32e19['dataValues']['Messages']=[];_0x32e19[_0xf605('0xcb')]['Messages'][_0xf605('0xb0')](_0x26b59e[_0xf605('0xcb')]);return _0x32e19;});})[_0xf605('0x21')](respondWithResult(_0x1971fa,null))[_0xf605('0x2b')](handleError(_0x1971fa,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 2b99ae9..73de129 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 _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 +var _0x5bdc=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x224077,_0xeffd6b){var _0xf36f81=function(_0x56502b){while(--_0x56502b){_0x224077['push'](_0x224077['shift']());}};_0xf36f81(++_0xeffd6b);}(_0x5bdc,0x185));var _0xc5bd=function(_0x39fb5f,_0xf76675){_0x39fb5f=_0x39fb5f-0x0;var _0x1ead94=_0x5bdc[_0x39fb5f];return _0x1ead94;};'use strict';var EventEmitter=require(_0xc5bd('0x0'));var WhatsappAccount=require(_0xc5bd('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xc5bd('0x2')](0x0);var events={'afterCreate':_0xc5bd('0x3'),'afterUpdate':_0xc5bd('0x4'),'afterDestroy':_0xc5bd('0x5')};function emitEvent(_0x2f2212){return function(_0x3779b5,_0x43b881,_0x5d0870){WhatsappAccountEvents[_0xc5bd('0x6')](_0x2f2212+':'+_0x3779b5['id'],_0x3779b5);WhatsappAccountEvents['emit'](_0x2f2212,_0x3779b5);_0x5d0870(null);};}for(var e in events){if(events[_0xc5bd('0x7')](e)){var event=events[e];WhatsappAccount[_0xc5bd('0x8')](e,emitEvent(event));}}module[_0xc5bd('0x9')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index fcd9c4c..60b0537 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 _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 +var _0x5feb=['./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash','util','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x145877,_0x4de116){var _0x2d5897=function(_0x270dae){while(--_0x270dae){_0x145877['push'](_0x145877['shift']());}};_0x2d5897(++_0x4de116);}(_0x5feb,0xa1));var _0xb5fe=function(_0x5b2809,_0x48b226){_0x5b2809=_0x5b2809-0x0;var _0x572dee=_0x5feb[_0x5b2809];return _0x572dee;};'use strict';var _=require(_0xb5fe('0x0'));var util=require(_0xb5fe('0x1'));var logger=require('../../config/logger')(_0xb5fe('0x2'));var moment=require(_0xb5fe('0x3'));var BPromise=require(_0xb5fe('0x4'));var rp=require(_0xb5fe('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb5fe('0x6'));var attributes=require(_0xb5fe('0x7'));module[_0xb5fe('0x8')]=function(_0x3e4bb8,_0xf18c0){return _0x3e4bb8[_0xb5fe('0x9')](_0xb5fe('0xa'),attributes,{'tableName':_0xb5fe('0xb'),'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 e2aafcf..b8caa8d 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 _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 +var _0x3b99=['model','include','ShowWhatsappAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./whatsappAccount.socket','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','find','options','raw','where','attributes','map'];(function(_0x7aec9e,_0x19eee1){var _0x577696=function(_0x32b681){while(--_0x32b681){_0x7aec9e['push'](_0x7aec9e['shift']());}};_0x577696(++_0x19eee1);}(_0x3b99,0x161));var _0x93b9=function(_0x33b7bb,_0xe2a9b4){_0x33b7bb=_0x33b7bb-0x0;var _0x134c40=_0x3b99[_0x33b7bb];return _0x134c40;};'use strict';var _=require(_0x93b9('0x0'));var util=require(_0x93b9('0x1'));var moment=require(_0x93b9('0x2'));var BPromise=require(_0x93b9('0x3'));var rs=require(_0x93b9('0x4'));var fs=require('fs');var Redis=require(_0x93b9('0x5'));var db=require(_0x93b9('0x6'))['db'];var utils=require(_0x93b9('0x7'));var logger=require('../../config/logger')(_0x93b9('0x8'));var config=require(_0x93b9('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x93b9('0xa')]({'port':0x232a});config[_0x93b9('0xb')]=_['defaults'](config[_0x93b9('0xb')],{'host':_0x93b9('0xc'),'port':0x18eb});var socket=require(_0x93b9('0xd'))(new Redis(config[_0x93b9('0xb')]));require(_0x93b9('0xe'))['register'](socket);function respondWithRpcPromise(_0x2d6bff,_0x53dfa2,_0x354971){return new BPromise(function(_0x32840b,_0x53bdf5){return client['request'](_0x2d6bff,_0x354971)[_0x93b9('0xf')](function(_0x55dc7d){logger[_0x93b9('0x10')](_0x93b9('0x11'),_0x53dfa2,_0x93b9('0x12'));logger[_0x93b9('0x13')](_0x93b9('0x14'),_0x53dfa2,'request\x20sent',JSON[_0x93b9('0x15')](_0x55dc7d));if(_0x55dc7d[_0x93b9('0x16')]){if(_0x55dc7d[_0x93b9('0x16')][_0x93b9('0x17')]===0x1f4){logger[_0x93b9('0x16')](_0x93b9('0x11'),_0x53dfa2,_0x55dc7d[_0x93b9('0x16')][_0x93b9('0x18')]);return _0x53bdf5(_0x55dc7d[_0x93b9('0x16')][_0x93b9('0x18')]);}logger['error'](_0x93b9('0x11'),_0x53dfa2,_0x55dc7d[_0x93b9('0x16')]['message']);return _0x32840b(_0x55dc7d[_0x93b9('0x16')][_0x93b9('0x18')]);}else{logger[_0x93b9('0x10')](_0x93b9('0x11'),_0x53dfa2,_0x93b9('0x12'));_0x32840b(_0x55dc7d['result'][_0x93b9('0x18')]);}})[_0x93b9('0x19')](function(_0x30978e){logger[_0x93b9('0x16')](_0x93b9('0x11'),_0x53dfa2,_0x30978e);_0x53bdf5(_0x30978e);});});}exports['ShowWhatsappAccount']=function(_0x3b77dc){var _0x2878bb=this;return new Promise(function(_0x2448e7,_0x1011bc){return db['WhatsappAccount'][_0x93b9('0x1a')]({'raw':_0x3b77dc['options']?_0x3b77dc[_0x93b9('0x1b')][_0x93b9('0x1c')]===undefined?!![]:![]:!![],'where':_0x3b77dc[_0x93b9('0x1b')]?_0x3b77dc[_0x93b9('0x1b')][_0x93b9('0x1d')]||null:null,'attributes':_0x3b77dc['options']?_0x3b77dc['options'][_0x93b9('0x1e')]||null:null,'include':_0x3b77dc['options']?_0x3b77dc[_0x93b9('0x1b')]['include']?_[_0x93b9('0x1f')](_0x3b77dc['options']['include'],function(_0x60ec93){return{'model':db[_0x60ec93[_0x93b9('0x20')]],'as':_0x60ec93['as'],'attributes':_0x60ec93[_0x93b9('0x1e')],'include':_0x60ec93[_0x93b9('0x21')]?_[_0x93b9('0x1f')](_0x60ec93[_0x93b9('0x21')],function(_0x4fc1ce){return{'model':db[_0x4fc1ce['model']],'as':_0x4fc1ce['as'],'attributes':_0x4fc1ce['attributes'],'include':_0x4fc1ce[_0x93b9('0x21')]?_[_0x93b9('0x1f')](_0x4fc1ce[_0x93b9('0x21')],function(_0xfa4de7){return{'model':db[_0xfa4de7[_0x93b9('0x20')]],'as':_0xfa4de7['as'],'attributes':_0xfa4de7['attributes']};}):[]};}):[]};}):[]:[]})[_0x93b9('0xf')](function(_0x5549d8){logger['info'](_0x93b9('0x22'),_0x3b77dc);logger['debug'](_0x93b9('0x22'),_0x3b77dc,JSON[_0x93b9('0x15')](_0x5549d8));_0x2448e7(_0x5549d8);})[_0x93b9('0x19')](function(_0xb6aaad){logger[_0x93b9('0x16')]('ShowWhatsappAccount',_0xb6aaad['message'],_0x3b77dc);_0x1011bc(_0x2878bb['error'](0x1f4,_0xb6aaad[_0x93b9('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 406d4d6..a5c7b8f 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 _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 +var _0x8bf3=['remove','removeListener','register','length','save'];(function(_0x9c8f69,_0x48a927){var _0x209163=function(_0x4b737b){while(--_0x4b737b){_0x9c8f69['push'](_0x9c8f69['shift']());}};_0x209163(++_0x48a927);}(_0x8bf3,0x185));var _0x38bf=function(_0x57dbe7,_0x43d15d){_0x57dbe7=_0x57dbe7-0x0;var _0xdc351c=_0x8bf3[_0x57dbe7];return _0xdc351c;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0x38bf('0x0'),_0x38bf('0x1'),'update'];function createListener(_0x4f0267,_0x3f9b5f){return function(_0x513fdc){_0x3f9b5f['emit'](_0x4f0267,_0x513fdc);};}function removeListener(_0x3e0b13,_0x2d8641){return function(){WhatsappAccountEvents[_0x38bf('0x2')](_0x3e0b13,_0x2d8641);};}exports[_0x38bf('0x3')]=function(_0x48af20){for(var _0x14606e=0x0,_0x531900=events[_0x38bf('0x4')];_0x14606e<_0x531900;_0x14606e++){var _0x41338c=events[_0x14606e];var _0x266d0c=createListener('whatsappAccount:'+_0x41338c,_0x48af20);WhatsappAccountEvents['on'](_0x41338c,_0x266d0c);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 315c572..95b53cf 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 _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 +var _0x5f6c=['update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','isAuthenticated','index','/:id','put'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x5f6c,0x18b));var _0xc5f6=function(_0x956444,_0x49050c){_0x956444=_0x956444-0x0;var _0xe1709f=_0x5f6c[_0x956444];return _0xe1709f;};'use strict';var multer=require(_0xc5f6('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc5f6('0x1'));var express=require(_0xc5f6('0x2'));var router=express[_0xc5f6('0x3')]();var fs_extra=require(_0xc5f6('0x4'));var auth=require(_0xc5f6('0x5'));var interaction=require(_0xc5f6('0x6'));var config=require(_0xc5f6('0x7'));var controller=require(_0xc5f6('0x8'));router['get']('/',auth[_0xc5f6('0x9')](),controller[_0xc5f6('0xa')]);router['get'](_0xc5f6('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xc5f6('0x9')](),controller['create']);router[_0xc5f6('0xc')](_0xc5f6('0xb'),auth[_0xc5f6('0x9')](),controller[_0xc5f6('0xd')]);router[_0xc5f6('0xe')](_0xc5f6('0xb'),auth[_0xc5f6('0x9')](),controller[_0xc5f6('0xf')]);module[_0xc5f6('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index dc2507e..ab8b01d 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 _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 +var _0x8df6=['STRING','noop','*,*,*,*','exports','INTEGER'];(function(_0x48f29a,_0x1f9f1a){var _0x467232=function(_0xf1ae7e){while(--_0xf1ae7e){_0x48f29a['push'](_0x48f29a['shift']());}};_0x467232(++_0x1f9f1a);}(_0x8df6,0x67));var _0x68df=function(_0x35dfc7,_0x8aa196){_0x35dfc7=_0x35dfc7-0x0;var _0x2c7922=_0x8df6[_0x35dfc7];return _0x2c7922;};'use strict';var Sequelize=require('sequelize');module[_0x68df('0x0')]={'priority':{'type':Sequelize[_0x68df('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x68df('0x2')],'allowNull':![],'defaultValue':_0x68df('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x68df('0x2')]},'interval':{'type':Sequelize[_0x68df('0x2')],'defaultValue':_0x68df('0x4')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index a3ec942..3cfd18f 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 _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 +var _0x0a1c=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','model','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','includeAll','findAll','rows','catch','show','params','keys','find','create','body','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x162ed0,_0x5c92b3){var _0x3212b9=function(_0x3b0850){while(--_0x3b0850){_0x162ed0['push'](_0x162ed0['shift']());}};_0x3212b9(++_0x5c92b3);}(_0x0a1c,0xd2));var _0xc0a1=function(_0x590b61,_0x4c4335){_0x590b61=_0x590b61-0x0;var _0x1a14dc=_0x0a1c[_0x590b61];return _0x1a14dc;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc0a1('0x0'));var jsonpatch=require(_0xc0a1('0x1'));var rp=require(_0xc0a1('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc0a1('0x3'));var util=require(_0xc0a1('0x4'));var path=require(_0xc0a1('0x5'));var sox=require(_0xc0a1('0x6'));var csv=require(_0xc0a1('0x7'));var ejs=require(_0xc0a1('0x8'));var fs=require('fs');var fs_extra=require(_0xc0a1('0x9'));var _=require(_0xc0a1('0xa'));var squel=require(_0xc0a1('0xb'));var crypto=require(_0xc0a1('0xc'));var jsforce=require(_0xc0a1('0xd'));var deskjs=require(_0xc0a1('0xe'));var toCsv=require(_0xc0a1('0x7'));var querystring=require(_0xc0a1('0xf'));var Papa=require(_0xc0a1('0x10'));var Redis=require(_0xc0a1('0x11'));var authService=require(_0xc0a1('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xc0a1('0x13'));var hardwareService=require(_0xc0a1('0x14'));var logger=require(_0xc0a1('0x15'))('api');var utils=require(_0xc0a1('0x16'));var config=require(_0xc0a1('0x17'));var licenseUtil=require(_0xc0a1('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1565f4,_0x138338){_0x138338=_0x138338||0xcc;return function(_0x4969b9){if(_0x4969b9){return _0x1565f4[_0xc0a1('0x19')](_0x138338);}return _0x1565f4[_0xc0a1('0x1a')](_0x138338)[_0xc0a1('0x1b')]();};}function respondWithResult(_0x395ade,_0x32c3b9){_0x32c3b9=_0x32c3b9||0xc8;return function(_0x517689){if(_0x517689){return _0x395ade['status'](_0x32c3b9)[_0xc0a1('0x1c')](_0x517689);}};}function respondWithFilteredResult(_0x3f5ce8,_0x49a97c){return function(_0x5a3e1d){if(_0x5a3e1d){var _0x8aa354=typeof _0x49a97c[_0xc0a1('0x1d')]==='undefined'&&typeof _0x49a97c[_0xc0a1('0x1e')]===_0xc0a1('0x1f');var _0x27ad22=_0x5a3e1d[_0xc0a1('0x20')];var _0x234067=_0x8aa354?0x0:_0x49a97c[_0xc0a1('0x1d')];var _0x36620e=_0x8aa354?_0x5a3e1d[_0xc0a1('0x20')]:_0x49a97c[_0xc0a1('0x1d')]+_0x49a97c[_0xc0a1('0x1e')];var _0x1e02aa;if(_0x36620e>=_0x27ad22){_0x36620e=_0x27ad22;_0x1e02aa=0xc8;}else{_0x1e02aa=0xce;}_0x3f5ce8[_0xc0a1('0x1a')](_0x1e02aa);return _0x3f5ce8[_0xc0a1('0x21')](_0xc0a1('0x22'),_0x234067+'-'+_0x36620e+'/'+_0x27ad22)[_0xc0a1('0x1c')](_0x5a3e1d);}return null;};}function patchUpdates(_0x3e8940){return function(_0x563987){try{jsonpatch[_0xc0a1('0x23')](_0x563987,_0x3e8940,!![]);}catch(_0x4f0f02){return BPromise[_0xc0a1('0x24')](_0x4f0f02);}return _0x563987[_0xc0a1('0x25')]();};}function saveUpdates(_0x19e24b,_0x316f1a){return function(_0x40eaa4){if(_0x40eaa4){return _0x40eaa4['update'](_0x19e24b)[_0xc0a1('0x26')](function(_0x1ae706){return _0x1ae706;});}return null;};}function removeEntity(_0x247179,_0x3e7997){return function(_0xb78441){if(_0xb78441){return _0xb78441[_0xc0a1('0x27')]()[_0xc0a1('0x26')](function(){_0x247179[_0xc0a1('0x1a')](0xcc)[_0xc0a1('0x1b')]();});}};}function handleEntityNotFound(_0x161bff,_0x5d9925){return function(_0x569816){if(!_0x569816){_0x161bff[_0xc0a1('0x19')](0x194);}return _0x569816;};}function handleError(_0xcd9b89,_0x5b5d13){_0x5b5d13=_0x5b5d13||0x1f4;return function(_0x52ba51){logger[_0xc0a1('0x28')](_0x52ba51[_0xc0a1('0x29')]);if(_0x52ba51['name']){delete _0x52ba51[_0xc0a1('0x2a')];}_0xcd9b89[_0xc0a1('0x1a')](_0x5b5d13)[_0xc0a1('0x2b')](_0x52ba51);};}exports[_0xc0a1('0x2c')]=function(_0x8f4588,_0x1814ac){var _0x114f76={},_0x2bc99f={},_0x4b4c93={'count':0x0,'rows':[]};var _0x26604b=_[_0xc0a1('0x2d')](db[_0xc0a1('0x2e')][_0xc0a1('0x2f')],function(_0x254c32){return{'name':_0x254c32[_0xc0a1('0x30')],'type':_0x254c32['type']['key']};});_0x2bc99f[_0xc0a1('0x31')]=_[_0xc0a1('0x2d')](_0x26604b,'name');_0x2bc99f[_0xc0a1('0x32')]=_['keys'](_0x8f4588[_0xc0a1('0x32')]);_0x2bc99f['filters']=_[_0xc0a1('0x33')](_0x2bc99f[_0xc0a1('0x31')],_0x2bc99f[_0xc0a1('0x32')]);_0x114f76['attributes']=_[_0xc0a1('0x33')](_0x2bc99f['model'],qs[_0xc0a1('0x34')](_0x8f4588[_0xc0a1('0x32')]['fields']));_0x114f76[_0xc0a1('0x35')]=_0x114f76[_0xc0a1('0x35')][_0xc0a1('0x36')]?_0x114f76[_0xc0a1('0x35')]:_0x2bc99f[_0xc0a1('0x31')];if(!_0x8f4588[_0xc0a1('0x32')]['hasOwnProperty'](_0xc0a1('0x37'))){_0x114f76[_0xc0a1('0x1e')]=qs[_0xc0a1('0x1e')](_0x8f4588[_0xc0a1('0x32')][_0xc0a1('0x1e')]);_0x114f76[_0xc0a1('0x1d')]=qs['offset'](_0x8f4588['query'][_0xc0a1('0x1d')]);}_0x114f76[_0xc0a1('0x38')]=qs[_0xc0a1('0x39')](_0x8f4588['query']['sort']);_0x114f76[_0xc0a1('0x3a')]=qs[_0xc0a1('0x3b')](_[_0xc0a1('0x3c')](_0x8f4588['query'],_0x2bc99f[_0xc0a1('0x3b')]),_0x26604b);if(_0x8f4588[_0xc0a1('0x32')]['filter']){_0x114f76[_0xc0a1('0x3a')]=_[_0xc0a1('0x3d')](_0x114f76['where'],{'$or':_[_0xc0a1('0x2d')](_0x26604b,function(_0x32f40b){if(_0x32f40b[_0xc0a1('0x3e')]!==_0xc0a1('0x3f')){var _0x442c1c={};_0x442c1c[_0x32f40b[_0xc0a1('0x2a')]]={'$like':'%'+_0x8f4588[_0xc0a1('0x32')][_0xc0a1('0x40')]+'%'};return _0x442c1c;}})});}_0x114f76=_['merge']({},_0x114f76,_0x8f4588['options']);var _0x300df9={'where':_0x114f76[_0xc0a1('0x3a')]};return db['WhatsappApplication'][_0xc0a1('0x20')](_0x300df9)[_0xc0a1('0x26')](function(_0x273b64){_0x4b4c93[_0xc0a1('0x20')]=_0x273b64;if(_0x8f4588[_0xc0a1('0x32')][_0xc0a1('0x41')]){_0x114f76['include']=[{'all':!![]}];}return db[_0xc0a1('0x2e')][_0xc0a1('0x42')](_0x114f76);})['then'](function(_0x289501){_0x4b4c93[_0xc0a1('0x43')]=_0x289501;return _0x4b4c93;})[_0xc0a1('0x26')](respondWithFilteredResult(_0x1814ac,_0x114f76))[_0xc0a1('0x44')](handleError(_0x1814ac,null));};exports[_0xc0a1('0x45')]=function(_0x1b58ec,_0x41d73d){var _0x4d9b35={'raw':!![],'where':{'id':_0x1b58ec[_0xc0a1('0x46')]['id']}},_0x542fb3={};_0x542fb3['model']=_[_0xc0a1('0x47')](db['WhatsappApplication']['rawAttributes']);_0x542fb3[_0xc0a1('0x32')]=_[_0xc0a1('0x47')](_0x1b58ec[_0xc0a1('0x32')]);_0x542fb3[_0xc0a1('0x3b')]=_[_0xc0a1('0x33')](_0x542fb3[_0xc0a1('0x31')],_0x542fb3[_0xc0a1('0x32')]);_0x4d9b35[_0xc0a1('0x35')]=_[_0xc0a1('0x33')](_0x542fb3[_0xc0a1('0x31')],qs[_0xc0a1('0x34')](_0x1b58ec[_0xc0a1('0x32')][_0xc0a1('0x34')]));_0x4d9b35[_0xc0a1('0x35')]=_0x4d9b35[_0xc0a1('0x35')][_0xc0a1('0x36')]?_0x4d9b35['attributes']:_0x542fb3[_0xc0a1('0x31')];if(_0x1b58ec[_0xc0a1('0x32')]['includeAll']){_0x4d9b35['include']=[{'all':!![]}];}_0x4d9b35=_[_0xc0a1('0x3d')]({},_0x4d9b35,_0x1b58ec['options']);return db[_0xc0a1('0x2e')][_0xc0a1('0x48')](_0x4d9b35)[_0xc0a1('0x26')](handleEntityNotFound(_0x41d73d,null))['then'](respondWithResult(_0x41d73d,null))[_0xc0a1('0x44')](handleError(_0x41d73d,null));};exports[_0xc0a1('0x49')]=function(_0x5b1244,_0x934f6d){return db[_0xc0a1('0x2e')]['create'](_0x5b1244['body'],{})[_0xc0a1('0x26')](respondWithResult(_0x934f6d,0xc9))[_0xc0a1('0x44')](handleError(_0x934f6d,null));};exports['update']=function(_0x437380,_0x216a82){if(_0x437380[_0xc0a1('0x4a')]['id']){delete _0x437380[_0xc0a1('0x4a')]['id'];}return db['WhatsappApplication']['find']({'where':{'id':_0x437380[_0xc0a1('0x46')]['id']}})['then'](handleEntityNotFound(_0x216a82,null))[_0xc0a1('0x26')](saveUpdates(_0x437380['body'],null))[_0xc0a1('0x26')](respondWithResult(_0x216a82,null))['catch'](handleError(_0x216a82,null));};exports[_0xc0a1('0x27')]=function(_0x280bbc,_0x5b5069){return db[_0xc0a1('0x2e')][_0xc0a1('0x48')]({'where':{'id':_0x280bbc[_0xc0a1('0x46')]['id']}})[_0xc0a1('0x26')](handleEntityNotFound(_0x5b5069,null))[_0xc0a1('0x26')](removeEntity(_0x5b5069,null))['catch'](handleError(_0x5b5069,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 3dd5a9e..de265cb 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 _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 +var _0xf767=['utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./whatsappApplication.attributes','define','WhatsappApplication','whatsapp_applications'];(function(_0x515e13,_0x3fabd7){var _0x1dd659=function(_0xc76ee7){while(--_0xc76ee7){_0x515e13['push'](_0x515e13['shift']());}};_0x1dd659(++_0x3fabd7);}(_0xf767,0x76));var _0x7f76=function(_0x51ac09,_0x383098){_0x51ac09=_0x51ac09-0x0;var _0x3f827d=_0xf767[_0x51ac09];return _0x3f827d;};'use strict';var _=require('lodash');var util=require(_0x7f76('0x0'));var logger=require(_0x7f76('0x1'))(_0x7f76('0x2'));var moment=require(_0x7f76('0x3'));var BPromise=require(_0x7f76('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7f76('0x5'));var rimraf=require(_0x7f76('0x6'));var config=require(_0x7f76('0x7'));var attributes=require(_0x7f76('0x8'));module['exports']=function(_0x23c243,_0x2f2588){return _0x23c243[_0x7f76('0x9')](_0x7f76('0xa'),attributes,{'tableName':_0x7f76('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x7f76('0xc')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 95b5ff9..31cbd44 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 _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 +var _0x9a19=['catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x3e6d5d,_0x264c7a){var _0x238923=function(_0x201b19){while(--_0x201b19){_0x3e6d5d['push'](_0x3e6d5d['shift']());}};_0x238923(++_0x264c7a);}(_0x9a19,0x114));var _0x99a1=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0x9a19[_0x82129b];return _0x2ae5dc;};'use strict';var _=require(_0x99a1('0x0'));var util=require(_0x99a1('0x1'));var moment=require(_0x99a1('0x2'));var BPromise=require('bluebird');var rs=require(_0x99a1('0x3'));var fs=require('fs');var Redis=require(_0x99a1('0x4'));var db=require(_0x99a1('0x5'))['db'];var utils=require(_0x99a1('0x6'));var logger=require(_0x99a1('0x7'))(_0x99a1('0x8'));var config=require(_0x99a1('0x9'));var jayson=require(_0x99a1('0xa'));var client=jayson[_0x99a1('0xb')][_0x99a1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x65045d,_0x523b9e,_0x4d2a5c){return new BPromise(function(_0x5aa6c2,_0x56f50){return client[_0x99a1('0xd')](_0x65045d,_0x4d2a5c)['then'](function(_0x5874fc){logger[_0x99a1('0xe')](_0x99a1('0xf'),_0x523b9e,_0x99a1('0x10'));logger[_0x99a1('0x11')](_0x99a1('0x12'),_0x523b9e,'request\x20sent',JSON[_0x99a1('0x13')](_0x5874fc));if(_0x5874fc[_0x99a1('0x14')]){if(_0x5874fc[_0x99a1('0x14')][_0x99a1('0x15')]===0x1f4){logger[_0x99a1('0x14')](_0x99a1('0xf'),_0x523b9e,_0x5874fc[_0x99a1('0x14')][_0x99a1('0x16')]);return _0x56f50(_0x5874fc[_0x99a1('0x14')][_0x99a1('0x16')]);}logger[_0x99a1('0x14')](_0x99a1('0xf'),_0x523b9e,_0x5874fc[_0x99a1('0x14')][_0x99a1('0x16')]);return _0x5aa6c2(_0x5874fc[_0x99a1('0x14')]['message']);}else{logger[_0x99a1('0xe')](_0x99a1('0xf'),_0x523b9e,_0x99a1('0x10'));_0x5aa6c2(_0x5874fc[_0x99a1('0x17')][_0x99a1('0x16')]);}})[_0x99a1('0x18')](function(_0x1ca878){logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x523b9e,_0x1ca878);_0x56f50(_0x1ca878);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index e92950e..80e445f 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 _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 +var _0xa630=['/:id/messages','getMessages','/:id/download','download','post','create','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','update','delete','whatsappinteraction:destroy','destroy','/:id/tags','multer','util','express','fs-extra','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x4f3492,_0x15770f){var _0x25852b=function(_0x1360e0){while(--_0x1360e0){_0x4f3492['push'](_0x4f3492['shift']());}};_0x25852b(++_0x15770f);}(_0xa630,0xbe));var _0x0a63=function(_0x552700,_0x14cab2){_0x552700=_0x552700-0x0;var _0x2ca280=_0xa630[_0x552700];return _0x2ca280;};'use strict';var multer=require(_0x0a63('0x0'));var util=require(_0x0a63('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0a63('0x2'));var router=express['Router']();var fs_extra=require(_0x0a63('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x0a63('0x4'));var config=require(_0x0a63('0x5'));var controller=require(_0x0a63('0x6'));router[_0x0a63('0x7')]('/',auth[_0x0a63('0x8')](),controller['index']);router[_0x0a63('0x7')](_0x0a63('0x9'),auth[_0x0a63('0x8')](),controller[_0x0a63('0xa')]);router[_0x0a63('0x7')](_0x0a63('0xb'),auth['isAuthenticated'](),controller[_0x0a63('0xc')]);router[_0x0a63('0x7')](_0x0a63('0xd'),auth[_0x0a63('0x8')](),controller[_0x0a63('0xe')]);router[_0x0a63('0x7')](_0x0a63('0xf'),auth[_0x0a63('0x8')](),controller[_0x0a63('0x10')]);router[_0x0a63('0x11')]('/',auth['isAuthenticated'](),controller[_0x0a63('0x12')]);router[_0x0a63('0x11')](_0x0a63('0xd'),auth[_0x0a63('0x8')](),controller['addMessage']);router[_0x0a63('0x11')]('/:id/tags',auth[_0x0a63('0x8')](),interaction[_0x0a63('0x13')](_0x0a63('0x14'),_0x0a63('0x15')),controller[_0x0a63('0x16')]);router[_0x0a63('0x17')](_0x0a63('0xb'),auth[_0x0a63('0x8')](),interaction['tracked'](_0x0a63('0x14'),'whatsappinteraction:update'),controller[_0x0a63('0x18')]);router[_0x0a63('0x19')](_0x0a63('0xb'),auth[_0x0a63('0x8')](),interaction[_0x0a63('0x13')](_0x0a63('0x14'),_0x0a63('0x1a')),controller[_0x0a63('0x1b')]);router[_0x0a63('0x19')](_0x0a63('0x1c'),auth[_0x0a63('0x8')](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 9be9be3..f6e137a 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 _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 +var _0x72fa=['sequelize','moment','BOOLEAN','DATE','STRING','ENUM','out','INTEGER'];(function(_0x380ba0,_0x461452){var _0x253b63=function(_0xa0a820){while(--_0xa0a820){_0x380ba0['push'](_0x380ba0['shift']());}};_0x253b63(++_0x461452);}(_0x72fa,0x78));var _0xa72f=function(_0x2bc8e0,_0x38204a){_0x2bc8e0=_0x2bc8e0-0x0;var _0xca8f97=_0x72fa[_0x2bc8e0];return _0xca8f97;};'use strict';var Sequelize=require(_0xa72f('0x0'));var moment=require(_0xa72f('0x1'));module['exports']={'closed':{'type':Sequelize[_0xa72f('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa72f('0x3')]},'disposition':{'type':Sequelize[_0xa72f('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xa72f('0x4')]},'phone':{'type':Sequelize[_0xa72f('0x4')]},'read1stAt':{'type':Sequelize[_0xa72f('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xa72f('0x5')]('in',_0xa72f('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa72f('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xa72f('0x5')]('in',_0xa72f('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xa72f('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xa72f('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 5363828..d2c6a0a 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 _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 +var _0x652e=['fields','length','includeAll','include','merge','find','create','body','catch','destroy','params','describe','addMessage','WhatsappMessage','ids','omit','hasOwnProperty','order','sort','where','pick','WhatsappInteractionId','map','filter','$gte','split','format','rows','Tag','color','emit','whatsappInteractionTags:save','removeTags','download','join','root','files','tmp','server','User','fullname','CmContact','attachments','Attachment','Messages','secret','read','WhatsappAccount','Account','push','Owner','mkdirSync','Whatsapp','N.A.','createdAt','YYYY-MM-DD\x20HH:mm:ss','toString','closed','closedAt','disposition','basename','createReadStream','pipe','createWriteStream','direction','out','System','firstName','lastName','value','renderFile','views','.pdf','createPdfFromHTML','log','err','unlinkSync','rimraf','moment','bluebird','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/environment','redis','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','then','error','stack','name','send','index','WhatsappInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','query','show','keys','filters','model','attributes','intersection'];(function(_0x55f5aa,_0x428b64){var _0x2a5ca4=function(_0x3a0d89){while(--_0x3a0d89){_0x55f5aa['push'](_0x55f5aa['shift']());}};_0x2a5ca4(++_0x428b64);}(_0x652e,0xc8));var _0xe652=function(_0x16be5f,_0x2c0111){_0x16be5f=_0x16be5f-0x0;var _0x236203=_0x652e[_0x16be5f];return _0x236203;};'use strict';var rimraf=require(_0xe652('0x0'));var zipdir=require('zip-dir');var moment=require(_0xe652('0x1'));var BPromise=require(_0xe652('0x2'));var util=require('util');var path=require(_0xe652('0x3'));var ejs=require(_0xe652('0x4'));var fs=require('fs');var _=require(_0xe652('0x5'));var Redis=require(_0xe652('0x6'));var interaction=require(_0xe652('0x7'));var qs=require(_0xe652('0x8'));var pdf=require(_0xe652('0x9'));var logger=require(_0xe652('0xa'))('api');var config=require(_0xe652('0xb'));var db=require('../../mysqldb')['db'];config[_0xe652('0xc')]=_['defaults'](config[_0xe652('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xe652('0xd'))(new Redis(config[_0xe652('0xc')]));require(_0xe652('0xe'))[_0xe652('0xf')](socket);function respondWithStatusCode(_0x109993,_0x16e354){_0x16e354=_0x16e354||0xcc;return function(_0x24c0e0){if(_0x24c0e0){return _0x109993[_0xe652('0x10')](_0x16e354);}return _0x109993[_0xe652('0x11')](_0x16e354)[_0xe652('0x12')]();};}function respondWithResult(_0x637e3,_0x55f613){_0x55f613=_0x55f613||0xc8;return function(_0x37d0ac){if(_0x37d0ac){return _0x637e3['status'](_0x55f613)[_0xe652('0x13')](_0x37d0ac);}};}function respondWithFilteredResult(_0x498d59,_0x9b319e){return function(_0x7927bb){if(_0x7927bb){var _0x419604=typeof _0x9b319e[_0xe652('0x14')]===_0xe652('0x15')&&typeof _0x9b319e[_0xe652('0x16')]===_0xe652('0x15');var _0x2040b7=_0x7927bb['count'];var _0x33cffe=_0x419604?0x0:_0x9b319e[_0xe652('0x14')];var _0xe9fa51=_0x419604?_0x7927bb[_0xe652('0x17')]:_0x9b319e[_0xe652('0x14')]+_0x9b319e[_0xe652('0x16')];var _0x4ebeca;if(_0xe9fa51>=_0x2040b7){_0xe9fa51=_0x2040b7;_0x4ebeca=0xc8;}else{_0x4ebeca=0xce;}_0x498d59[_0xe652('0x11')](_0x4ebeca);return _0x498d59['set'](_0xe652('0x18'),_0x33cffe+'-'+_0xe9fa51+'/'+_0x2040b7)[_0xe652('0x13')](_0x7927bb);}return null;};}function saveUpdates(_0x4ea040){return function(_0x1cecec){if(_0x1cecec){return _0x1cecec[_0xe652('0x19')](_0x4ea040)['then'](function(_0x10a31d){return _0x10a31d;});}return null;};}function removeEntity(_0x18db70){return function(_0x3006fd){if(_0x3006fd){return _0x3006fd['destroy']()[_0xe652('0x1a')](function(){_0x18db70[_0xe652('0x11')](0xcc)[_0xe652('0x12')]();});}};}function handleEntityNotFound(_0x23cadd){return function(_0x198c8d){if(!_0x198c8d){_0x23cadd[_0xe652('0x10')](0x194);}return _0x198c8d;};}function handleError(_0x212112,_0x1b035f){_0x1b035f=_0x1b035f||0x1f4;return function(_0x2fddd9){logger[_0xe652('0x1b')](_0x2fddd9[_0xe652('0x1c')]);if(_0x2fddd9['name']){delete _0x2fddd9[_0xe652('0x1d')];}_0x212112[_0xe652('0x11')](_0x1b035f)[_0xe652('0x1e')](_0x2fddd9);};}exports[_0xe652('0x1f')]=function(_0x1b51a7,_0x5192a6){var _0x41bc90={};var _0x45e14c=_['map'](db[_0xe652('0x20')][_0xe652('0x21')],function(_0x43cbf){return{'name':_0x43cbf[_0xe652('0x22')],'type':_0x43cbf[_0xe652('0x23')][_0xe652('0x24')]};});_0x41bc90=qs[_0xe652('0x25')](_0x45e14c,_0x1b51a7);return interaction[_0xe652('0x26')]('whatsapp',_0x1b51a7[_0xe652('0x27')],_0x1b51a7['user'],_0x41bc90,_0x45e14c)[_0xe652('0x1a')](respondWithFilteredResult(_0x5192a6,_0x41bc90))['catch'](handleError(_0x5192a6,null));};exports[_0xe652('0x28')]=function(_0x42a4b2,_0x424513){var _0x778c6d={'raw':![],'where':{'id':_0x42a4b2['params']['id']}},_0x291f92={};_0x291f92['model']=_[_0xe652('0x29')](db[_0xe652('0x20')][_0xe652('0x21')]);_0x291f92[_0xe652('0x27')]=_[_0xe652('0x29')](_0x42a4b2[_0xe652('0x27')]);_0x291f92[_0xe652('0x2a')]=_['intersection'](_0x291f92[_0xe652('0x2b')],_0x291f92[_0xe652('0x27')]);_0x778c6d[_0xe652('0x2c')]=_[_0xe652('0x2d')](_0x291f92[_0xe652('0x2b')],qs[_0xe652('0x2e')](_0x42a4b2[_0xe652('0x27')]['fields']));_0x778c6d[_0xe652('0x2c')]=_0x778c6d[_0xe652('0x2c')][_0xe652('0x2f')]?_0x778c6d[_0xe652('0x2c')]:_0x291f92[_0xe652('0x2b')];if(_0x42a4b2['query'][_0xe652('0x30')]){_0x778c6d[_0xe652('0x31')]=[{'all':!![]}];}_0x778c6d=_[_0xe652('0x32')]({},_0x778c6d,_0x42a4b2['options']);return db['WhatsappInteraction'][_0xe652('0x33')](_0x778c6d)[_0xe652('0x1a')](handleEntityNotFound(_0x424513,null))['then'](respondWithResult(_0x424513,null))['catch'](handleError(_0x424513,null));};exports[_0xe652('0x34')]=function(_0x2e8fb8,_0x101be8){return db[_0xe652('0x20')][_0xe652('0x34')](_0x2e8fb8['body'],{})[_0xe652('0x1a')](respondWithResult(_0x101be8,0xc9))['catch'](handleError(_0x101be8,null));};exports[_0xe652('0x19')]=function(_0x415c61,_0xd214b){if(_0x415c61[_0xe652('0x35')]['id']){delete _0x415c61[_0xe652('0x35')]['id'];}return db['WhatsappInteraction'][_0xe652('0x33')]({'where':{'id':_0x415c61['params']['id']}})[_0xe652('0x1a')](handleEntityNotFound(_0xd214b,null))[_0xe652('0x1a')](saveUpdates(_0x415c61['body'],null))['then'](respondWithResult(_0xd214b,null))[_0xe652('0x36')](handleError(_0xd214b,null));};exports[_0xe652('0x37')]=function(_0x36d98a,_0x4d1d2e){return db['WhatsappInteraction'][_0xe652('0x33')]({'where':{'id':_0x36d98a[_0xe652('0x38')]['id']}})[_0xe652('0x1a')](handleEntityNotFound(_0x4d1d2e,null))[_0xe652('0x1a')](removeEntity(_0x4d1d2e,null))[_0xe652('0x36')](handleError(_0x4d1d2e,null));};exports[_0xe652('0x39')]=function(_0x45af17,_0xb4bed8){return db[_0xe652('0x20')][_0xe652('0x39')]()[_0xe652('0x1a')](respondWithResult(_0xb4bed8,null))[_0xe652('0x36')](handleError(_0xb4bed8,null));};exports[_0xe652('0x3a')]=function(_0x21ca50,_0x5254c2){return db[_0xe652('0x3b')][_0xe652('0x33')]({'where':{'id':_0x21ca50[_0xe652('0x38')]['id']}})['then'](handleEntityNotFound(_0x5254c2,null))[_0xe652('0x1a')](function(_0x1c83d2){if(_0x1c83d2){return _0x1c83d2[_0xe652('0x3a')](_0x21ca50[_0xe652('0x35')][_0xe652('0x3c')],_[_0xe652('0x3d')](_0x21ca50[_0xe652('0x35')],[_0xe652('0x3c'),'id'])||{});}})[_0xe652('0x1a')](respondWithResult(_0x5254c2,null))[_0xe652('0x36')](handleError(_0x5254c2,null));};exports['getMessages']=function(_0x24119d,_0xdbcfce){var _0x326bcc={'raw':![],'where':{}};var _0x1e06dc={};var _0x481dcb={'count':0x0,'rows':[]};return db['WhatsappInteraction']['findOne']({'where':{'id':_0x24119d[_0xe652('0x38')]['id']}})['then'](handleEntityNotFound(_0xdbcfce,null))[_0xe652('0x1a')](function(_0x3a6d01){if(_0x3a6d01){_0x1e06dc[_0xe652('0x2b')]=_['keys'](db[_0xe652('0x3b')][_0xe652('0x21')]);_0x1e06dc[_0xe652('0x27')]=_[_0xe652('0x29')](_0x24119d[_0xe652('0x27')]);_0x1e06dc['filters']=_[_0xe652('0x2d')](_0x1e06dc['model'],_0x1e06dc[_0xe652('0x27')]);_0x326bcc[_0xe652('0x2c')]=_[_0xe652('0x2d')](_0x1e06dc[_0xe652('0x2b')],qs[_0xe652('0x2e')](_0x24119d['query'][_0xe652('0x2e')]));_0x326bcc['attributes']=_0x326bcc[_0xe652('0x2c')]['length']?_0x326bcc[_0xe652('0x2c')]:_0x1e06dc['model'];if(!_0x24119d[_0xe652('0x27')][_0xe652('0x3e')]('nolimit')){_0x326bcc[_0xe652('0x16')]=qs[_0xe652('0x16')](_0x24119d['query'][_0xe652('0x16')]);_0x326bcc[_0xe652('0x14')]=qs[_0xe652('0x14')](_0x24119d['query'][_0xe652('0x14')]);}_0x326bcc[_0xe652('0x3f')]=qs['sort'](_0x24119d[_0xe652('0x27')][_0xe652('0x40')]);_0x326bcc[_0xe652('0x41')]=qs[_0xe652('0x2a')](_[_0xe652('0x42')](_0x24119d[_0xe652('0x27')],_0x1e06dc[_0xe652('0x2a')]));_0x326bcc[_0xe652('0x41')][_0xe652('0x43')]=_0x3a6d01['id'];if(_0x24119d[_0xe652('0x27')]['filter']){_0x326bcc['where']=_[_0xe652('0x32')](_0x326bcc['where'],{'$or':_[_0xe652('0x44')](_0x326bcc[_0xe652('0x2c')],function(_0x25eeef){var _0x5158a3={};_0x5158a3[_0x25eeef]={'$like':'%'+_0x24119d['query'][_0xe652('0x45')]+'%'};return _0x5158a3;})});}if(_0x24119d[_0xe652('0x27')][_0xe652('0x46')]){var _0xdd0cfd=_0x24119d[_0xe652('0x27')][_0xe652('0x46')][_0xe652('0x47')](',');var _0x254d3a={};_0x254d3a[_0xdd0cfd[0x0]]={'$gte':moment(_0xdd0cfd[0x1])[_0xe652('0x48')]('YYYY-MM-DD\x20HH:mm:ss')};_0x326bcc[_0xe652('0x41')]=_[_0xe652('0x32')](_0x326bcc['where'],_0x254d3a);}_0x326bcc=_[_0xe652('0x32')]({},_0x326bcc,_0x24119d['options']);return db[_0xe652('0x3b')]['count']({'where':_0x326bcc['where']})[_0xe652('0x1a')](function(_0x2e3693){_0x481dcb['count']=_0x2e3693;if(_0x24119d[_0xe652('0x27')][_0xe652('0x30')]){_0x326bcc[_0xe652('0x31')]=[{'all':!![]}];}return db[_0xe652('0x3b')][_0xe652('0x26')](_0x326bcc);})[_0xe652('0x1a')](function(_0x28e0f9){_0x481dcb[_0xe652('0x49')]=_0x28e0f9;return _0x481dcb;});}})[_0xe652('0x1a')](respondWithFilteredResult(_0xdbcfce,_0x326bcc))[_0xe652('0x36')](handleError(_0xdbcfce,null));};exports['addTags']=function(_0x3c9654,_0x1e890e){return db[_0xe652('0x20')]['find']({'where':{'id':_0x3c9654['params']['id']}})[_0xe652('0x1a')](handleEntityNotFound(_0x1e890e,null))[_0xe652('0x1a')](function(_0x452377){if(_0x452377){return _0x452377['setTags'](_0x3c9654[_0xe652('0x35')][_0xe652('0x3c')],_[_0xe652('0x3d')](_0x3c9654[_0xe652('0x35')],['ids','id'])||{})['spread'](function(){return db[_0xe652('0x4a')][_0xe652('0x26')]({'attributes':['id',_0xe652('0x1d'),_0xe652('0x4b')],'where':{'id':_0x3c9654[_0xe652('0x35')]['ids']}});})[_0xe652('0x1a')](function(_0x612430){socket[_0xe652('0x4c')](_0xe652('0x4d'),{'id':Number(_0x3c9654[_0xe652('0x38')]['id']),'tags':_0x612430||[]});return{'id':Number(_0x3c9654[_0xe652('0x38')]['id']),'tags':_0x612430||[]};});}})['then'](respondWithResult(_0x1e890e,null))[_0xe652('0x36')](handleError(_0x1e890e,null));};exports[_0xe652('0x4e')]=function(_0x3458a4,_0x46d482){return db['WhatsappInteraction'][_0xe652('0x33')]({'where':{'id':_0x3458a4[_0xe652('0x38')]['id']}})[_0xe652('0x1a')](handleEntityNotFound(_0x46d482,null))[_0xe652('0x1a')](function(_0xf0145){if(_0xf0145){return _0xf0145[_0xe652('0x4e')](_0x3458a4[_0xe652('0x27')]['ids']);}})[_0xe652('0x1a')](respondWithStatusCode(_0x46d482,null))[_0xe652('0x36')](handleError(_0x46d482,null));};exports[_0xe652('0x4f')]=function(_0x5a608e,_0x1a5ed5){var _0x22acfa=moment()['unix']()['toString']();var _0x8bf76e=path[_0xe652('0x50')](config[_0xe652('0x51')],'server',_0xe652('0x52'),_0xe652('0x53'));var _0x3cd196=path[_0xe652('0x50')](config['root'],_0xe652('0x54'),_0xe652('0x52'),'attachments');var _0x56a43c=path['join'](_0x8bf76e,_0x22acfa);var _0x46b2f6=util[_0xe652('0x48')]('transcript-%d-%s.zip',_0x5a608e[_0xe652('0x38')]['id'],_0x22acfa);var _0xb51b17=path[_0xe652('0x50')](_0x8bf76e,_0x46b2f6);var _0x388a6d=[];_0x388a6d['push']({'model':db[_0xe652('0x55')],'as':_0xe652('0x55'),'attributes':['id',_0xe652('0x56')],'raw':!![]});_0x388a6d['push']({'model':db[_0xe652('0x57')],'as':'Contact','attributes':['id','firstName','lastName'],'raw':!![]});if(_0x5a608e[_0xe652('0x27')][_0xe652('0x58')]){_0x388a6d['push']({'model':db[_0xe652('0x59')],'as':_0xe652('0x59'),'raw':!![]});}var _0x2483da=[{'model':db[_0xe652('0x3b')],'as':_0xe652('0x5a'),'attributes':['id',_0xe652('0x35'),'createdAt','direction',_0xe652('0x5b'),_0xe652('0x5c')],'include':_0x388a6d}];_0x2483da['push']({'model':db[_0xe652('0x5d')],'as':_0xe652('0x5e'),'attributes':['id',_0xe652('0x1d')]});_0x2483da[_0xe652('0x5f')]({'model':db[_0xe652('0x55')],'as':_0xe652('0x60'),'attributes':['id',_0xe652('0x56')]});return db['WhatsappInteraction']['find']({'where':{'id':_0x5a608e[_0xe652('0x38')]['id']},'include':_0x2483da})['then'](handleEntityNotFound(_0x1a5ed5,null))[_0xe652('0x1a')](function(_0x4bf459){if(_0x4bf459){var _0x22bb5b=_0x4bf459['get']({'plain':!![]});fs[_0xe652('0x61')](_0x56a43c);var _0x1c5727={'channel':_0xe652('0x62'),'account':_0x22bb5b[_0xe652('0x5e')][_0xe652('0x1d')],'agent':_0x22bb5b[_0xe652('0x60')]?_0x22bb5b[_0xe652('0x60')][_0xe652('0x56')]:_0xe652('0x63'),'createdAt':moment(_0x22bb5b[_0xe652('0x64')])[_0xe652('0x48')](_0xe652('0x65'))[_0xe652('0x66')](),'closedAt':_0x22bb5b[_0xe652('0x67')]?moment(_0x22bb5b[_0xe652('0x68')])['format'](_0xe652('0x65'))[_0xe652('0x66')]():'','disposition':_0x22bb5b[_0xe652('0x69')],'messages':_(_0x22bb5b[_0xe652('0x5a')])[_0xe652('0x45')]({'secret':![]})[_0xe652('0x44')](function(_0x127192){if(_0x127192[_0xe652('0x59')]){var _0x280e89=path[_0xe652('0x50')](_0x3cd196,_0x127192[_0xe652('0x59')][_0xe652('0x6a')]);if(fs['existsSync'](_0x280e89)){fs[_0xe652('0x6b')](_0x280e89)[_0xe652('0x6c')](fs[_0xe652('0x6d')](path['join'](_0x56a43c,_0x127192[_0xe652('0x59')]['basename'])));}}return{'date':moment(_0x127192[_0xe652('0x64')])[_0xe652('0x48')](_0xe652('0x65'))[_0xe652('0x66')](),'sender':_0x127192[_0xe652('0x6e')]===_0xe652('0x6f')?_0x127192[_0xe652('0x55')]?_0x127192[_0xe652('0x55')][_0xe652('0x56')]:_0xe652('0x70'):_0x127192['Contact'][_0xe652('0x71')]+(_0x127192['Contact']['lastName']?'\x20'+_0x127192['Contact'][_0xe652('0x72')]:''),'body':_0x127192[_0xe652('0x59')]?_0x127192['Attachment'][_0xe652('0x6a')]:_0x127192[_0xe652('0x35')],'direction':_0x127192[_0xe652('0x6e')]===_0xe652('0x6f')?'A':'C','secret':_0x127192[_0xe652('0x5b')],'read':_0x127192[_0xe652('0x5c')],'attachment':_0x127192['Attachment']};})[_0xe652('0x73')]()};return ejs[_0xe652('0x74')](path[_0xe652('0x50')](config[_0xe652('0x51')],_0xe652('0x54'),_0xe652('0x75'),'downloadInteraction.ejs'),{'interaction':_0x1c5727})[_0xe652('0x1a')](function(_0x2eb8bf){var _0x2ff52f=path[_0xe652('0x50')](_0x56a43c,'transcript-'+_0x22bb5b['id']+'-'+_0x22acfa+_0xe652('0x76'));var _0xb1f9e0={'path':_0x2ff52f,'channel':_0xe652('0x62'),'interactionId':_0x22bb5b['id']};return pdf[_0xe652('0x77')](_0x2eb8bf,_0xb1f9e0);})['then'](function(){return new BPromise(function(_0x133685,_0x1abbe3){zipdir(_0x56a43c,{'saveTo':_0xb51b17},function(_0xf05fe6,_0x128b21){if(_0xf05fe6)return _0x1abbe3(_0xf05fe6);return _0x133685(_0x128b21);});})[_0xe652('0x1a')](function(){return new BPromise(function(_0x5e206c,_0x49356b){rimraf(_0x56a43c,function(_0xdb34dc){if(_0xdb34dc)_0x49356b(_0xdb34dc);return _0x5e206c();});});})[_0xe652('0x1a')](function(){return _0x1a5ed5['download'](_0xb51b17,_0x46b2f6,function(_0x2ed1df){if(_0x2ed1df){console[_0xe652('0x78')](_0xe652('0x79'),_0x2ed1df);}else{fs[_0xe652('0x7a')](_0xb51b17);}});});});}else{return _0x1a5ed5[_0xe652('0x10')](0xc8);}})['catch'](handleError(_0x1a5ed5,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index de9f3fe..c0ae898 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 _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 +var _0x7cda=['then','unreadMessages','length','emit','hasOwnProperty','hook','../../mysqldb','WhatsappInteraction','setMaxListeners','save','remove','getUsers','setDataValue','map','findAll'];(function(_0x8ae802,_0x1ec8fe){var _0x48c022=function(_0xf128e8){while(--_0xf128e8){_0x8ae802['push'](_0x8ae802['shift']());}};_0x48c022(++_0x1ec8fe);}(_0x7cda,0xf6));var _0xa7cd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7cda[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0xa7cd('0x0'))['db'][_0xa7cd('0x1')];var WhatsappMessage=require(_0xa7cd('0x0'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xa7cd('0x2')](0x0);var events={'afterCreate':_0xa7cd('0x3'),'afterUpdate':'update','afterDestroy':_0xa7cd('0x4')};function emitEvent(_0xdb8470){return function(_0x5560e0,_0x37990d,_0x5f20a2){_0x5560e0[_0xa7cd('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x596ad6){_0x5560e0[_0xa7cd('0x6')]('Users',_0x596ad6[_0xa7cd('0x7')](function(_0x205075){return{'id':_0x205075['id']};}));return WhatsappMessage[_0xa7cd('0x8')]({'where':{'WhatsappInteractionId':_0x5560e0['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa7cd('0x9')](function(_0x31879f){_0x5560e0[_0xa7cd('0x6')](_0xa7cd('0xa'),_0x31879f[_0xa7cd('0xb')]);WhatsappInteractionEvents[_0xa7cd('0xc')](_0xdb8470+':'+_0x5560e0['id'],_0x5560e0);WhatsappInteractionEvents['emit'](_0xdb8470,_0x5560e0);_0x5f20a2(null);})['catch'](_0x5f20a2(null));};}for(var e in events){if(events[_0xa7cd('0xd')](e)){var event=events[e];WhatsappInteraction[_0xa7cd('0xe')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 246d7d3..a97d647 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 _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 +var _0xff22=['exports','define','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xff22,0x135));var _0x2ff2=function(_0x295038,_0x5a03a7){_0x295038=_0x295038-0x0;var _0x75d3e8=_0xff22[_0x295038];return _0x75d3e8;};'use strict';var _=require(_0x2ff2('0x0'));var util=require(_0x2ff2('0x1'));var logger=require(_0x2ff2('0x2'))(_0x2ff2('0x3'));var moment=require(_0x2ff2('0x4'));var BPromise=require(_0x2ff2('0x5'));var rp=require(_0x2ff2('0x6'));var fs=require('fs');var path=require(_0x2ff2('0x7'));var rimraf=require(_0x2ff2('0x8'));var config=require(_0x2ff2('0x9'));var attributes=require(_0x2ff2('0xa'));module[_0x2ff2('0xb')]=function(_0x1c6b28,_0xb542c0){return _0x1c6b28[_0x2ff2('0xc')](_0x2ff2('0xd'),attributes,{'tableName':_0x2ff2('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x519093,_0x2ed486,_0x179ee8){if(_0x519093[_0x2ff2('0xf')](_0x2ff2('0x10'))){_0x519093[_0x2ff2('0x11')]=moment()[_0x2ff2('0x12')](_0x2ff2('0x13'));}_0x179ee8(null,_0x519093);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 1a097ff..e9dffb8 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 _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 +var _0x79a3=['WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','error','message','result','body','options','raw','where','limit','UpdateWhatsappInteraction','stringify','AddTagsToWhatsappInteraction','WhatsappInteraction','find','omit','ids','spread','AddTags','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','then','info'];(function(_0xa1e9cc,_0x21d997){var _0x3cbf6c=function(_0x4dd22d){while(--_0x4dd22d){_0xa1e9cc['push'](_0xa1e9cc['shift']());}};_0x3cbf6c(++_0x21d997);}(_0x79a3,0x174));var _0x379a=function(_0x15e927,_0x346938){_0x15e927=_0x15e927-0x0;var _0x331a0d=_0x79a3[_0x15e927];return _0x331a0d;};'use strict';var _=require('lodash');var util=require(_0x379a('0x0'));var moment=require(_0x379a('0x1'));var BPromise=require(_0x379a('0x2'));var rs=require(_0x379a('0x3'));var fs=require('fs');var Redis=require(_0x379a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x379a('0x5'));var logger=require(_0x379a('0x6'))(_0x379a('0x7'));var config=require('../../config/environment');var jayson=require(_0x379a('0x8'));var client=jayson[_0x379a('0x9')][_0x379a('0xa')]({'port':0x232a});config[_0x379a('0xb')]=_[_0x379a('0xc')](config[_0x379a('0xb')],{'host':_0x379a('0xd'),'port':0x18eb});var socket=require(_0x379a('0xe'))(new Redis(config[_0x379a('0xb')]));require('./whatsappInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x12934d,_0x5357bc,_0x15dc9a){return new BPromise(function(_0x218f34,_0x464711){return client[_0x379a('0xf')](_0x12934d,_0x15dc9a)[_0x379a('0x10')](function(_0x49f3f5){logger[_0x379a('0x11')](_0x379a('0x12'),_0x5357bc,_0x379a('0x13'));logger[_0x379a('0x14')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x5357bc,_0x379a('0x13'),JSON['stringify'](_0x49f3f5));if(_0x49f3f5[_0x379a('0x15')]){if(_0x49f3f5[_0x379a('0x15')]['code']===0x1f4){logger[_0x379a('0x15')](_0x379a('0x12'),_0x5357bc,_0x49f3f5[_0x379a('0x15')]['message']);return _0x464711(_0x49f3f5[_0x379a('0x15')][_0x379a('0x16')]);}logger['error'](_0x379a('0x12'),_0x5357bc,_0x49f3f5[_0x379a('0x15')][_0x379a('0x16')]);return _0x218f34(_0x49f3f5['error'][_0x379a('0x16')]);}else{logger[_0x379a('0x11')](_0x379a('0x12'),_0x5357bc,_0x379a('0x13'));_0x218f34(_0x49f3f5[_0x379a('0x17')][_0x379a('0x16')]);}})['catch'](function(_0x5785b){logger[_0x379a('0x15')](_0x379a('0x12'),_0x5357bc,_0x5785b);_0x464711(_0x5785b);});});}exports['UpdateWhatsappInteraction']=function(_0x3f0053){var _0x20b1ae=this;return new Promise(function(_0x449437,_0x532ea2){return db['WhatsappInteraction']['update'](_0x3f0053[_0x379a('0x18')],{'raw':_0x3f0053[_0x379a('0x19')]?_0x3f0053[_0x379a('0x19')][_0x379a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f0053['options']?_0x3f0053[_0x379a('0x19')][_0x379a('0x1b')]||null:null,'attributes':_0x3f0053[_0x379a('0x19')]?_0x3f0053['options']['attributes']||null:null,'limit':_0x3f0053[_0x379a('0x19')]?_0x3f0053['options'][_0x379a('0x1c')]||null:null})['then'](function(_0x58210a){logger[_0x379a('0x11')]('UpdateWhatsappInteraction',_0x3f0053);logger['debug'](_0x379a('0x1d'),_0x3f0053,JSON[_0x379a('0x1e')](_0x58210a));_0x449437(_0x58210a);})['catch'](function(_0x47afea){logger[_0x379a('0x15')](_0x379a('0x1d'),_0x47afea['message'],_0x3f0053);_0x532ea2(_0x20b1ae[_0x379a('0x15')](0x1f4,_0x47afea['message']));});});};exports[_0x379a('0x1f')]=function(_0x5bb103){return new Promise(function(_0x22f125,_0x3e6118){return db[_0x379a('0x20')][_0x379a('0x21')]({'where':_0x5bb103['options']?_0x5bb103[_0x379a('0x19')][_0x379a('0x1b')]||null:null})[_0x379a('0x10')](function(_0x5afe4c){if(_0x5afe4c){return _0x5afe4c['addTags'](_0x5bb103[_0x379a('0x18')]['ids'],_[_0x379a('0x22')](_0x5bb103[_0x379a('0x18')],[_0x379a('0x23'),'id'])||{});}})[_0x379a('0x24')](function(_0x4a705f){logger[_0x379a('0x11')](_0x379a('0x25'),_0x5bb103);logger[_0x379a('0x14')](_0x379a('0x25'),_0x5bb103,JSON['stringify'](_0x4a705f));_0x22f125(_0x4a705f);})[_0x379a('0x26')](function(_0x3c9434){logger['error']('AddTags',_0x3c9434['message'],_0x5bb103);_0x3e6118(_this[_0x379a('0x15')](0x1f4,_0x3c9434[_0x379a('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 2c48db7..f7e37eb 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 _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 +var _0xbd15=['./whatsappInteraction.events','save','remove','update','emit','register'];(function(_0x2994d4,_0x364c48){var _0x1c7c5d=function(_0x20180f){while(--_0x20180f){_0x2994d4['push'](_0x2994d4['shift']());}};_0x1c7c5d(++_0x364c48);}(_0xbd15,0x66));var _0x5bd1=function(_0x6d6a66,_0x2924af){_0x6d6a66=_0x6d6a66-0x0;var _0x11eb6e=_0xbd15[_0x6d6a66];return _0x11eb6e;};'use strict';var WhatsappInteractionEvents=require(_0x5bd1('0x0'));var events=[_0x5bd1('0x1'),_0x5bd1('0x2'),_0x5bd1('0x3')];function createListener(_0x3b0117,_0x32ab1){return function(_0x2be532){_0x32ab1[_0x5bd1('0x4')](_0x3b0117,_0x2be532);};}function removeListener(_0x12be1e,_0x419db4){return function(){WhatsappInteractionEvents['removeListener'](_0x12be1e,_0x419db4);};}exports[_0x5bd1('0x5')]=function(_0x2db80a){for(var _0x1cec44=0x0,_0x55b770=events['length'];_0x1cec44<_0x55b770;_0x1cec44++){var _0x24a6f1=events[_0x1cec44];var _0x5a149e=createListener('whatsappInteraction:'+_0x24a6f1,_0x2db80a);WhatsappInteractionEvents['on'](_0x24a6f1,_0x5a149e);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 28ebbb8..3197db6 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 _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 +var _0x3a28=['reject','destroy','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','/describe','isAuthenticated','describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','put','/:id/accept','accept','/:id/reject'];(function(_0x2e41e2,_0x4e7250){var _0x2844d6=function(_0x28ce24){while(--_0x28ce24){_0x2e41e2['push'](_0x2e41e2['shift']());}};_0x2844d6(++_0x4e7250);}(_0x3a28,0x6a));var _0x83a2=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x3a28[_0x1e7b16];return _0x37fadc;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x83a2('0x0'));var express=require(_0x83a2('0x1'));var router=express[_0x83a2('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x83a2('0x3'));var interaction=require(_0x83a2('0x4'));var config=require(_0x83a2('0x5'));var controller=require(_0x83a2('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x83a2('0x7')](_0x83a2('0x8'),auth[_0x83a2('0x9')](),controller[_0x83a2('0xa')]);router['get'](_0x83a2('0xb'),auth[_0x83a2('0x9')](),controller[_0x83a2('0xc')]);router[_0x83a2('0xd')]('/',auth[_0x83a2('0x9')](),interaction[_0x83a2('0xe')](_0x83a2('0xf'),_0x83a2('0x10')),controller[_0x83a2('0x11')]);router[_0x83a2('0xd')](_0x83a2('0x12'),controller[_0x83a2('0x13')]);router[_0x83a2('0x14')](_0x83a2('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x83a2('0x14')](_0x83a2('0x15'),auth[_0x83a2('0x9')](),controller[_0x83a2('0x16')]);router[_0x83a2('0x14')](_0x83a2('0x17'),auth['isAuthenticated'](),controller[_0x83a2('0x18')]);router['delete'](_0x83a2('0xb'),auth[_0x83a2('0x9')](),controller[_0x83a2('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 44a393d..311404a 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 _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 +var _0xbbdb=['out','STRING','DATE','sequelize','exports','TEXT','BOOLEAN','ENUM'];(function(_0x16a223,_0x31b6e8){var _0x5ded66=function(_0x25eb5f){while(--_0x25eb5f){_0x16a223['push'](_0x16a223['shift']());}};_0x5ded66(++_0x31b6e8);}(_0xbbdb,0x18b));var _0xbbbd=function(_0x218972,_0x1f9794){_0x218972=_0x218972-0x0;var _0x1bb1a8=_0xbbdb[_0x218972];return _0x1bb1a8;};'use strict';var Sequelize=require(_0xbbbd('0x0'));module[_0xbbbd('0x1')]={'body':{'type':Sequelize[_0xbbbd('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xbbbd('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xbbbd('0x4')]('in',_0xbbbd('0x5')),'defaultValue':_0xbbbd('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xbbbd('0x6')](0xbe)},'phone':{'type':Sequelize[_0xbbbd('0x6')]},'readAt':{'type':Sequelize[_0xbbbd('0x7')]},'secret':{'type':Sequelize[_0xbbbd('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xbbbd('0x6')]},'providerResponse':{'type':Sequelize[_0xbbbd('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 7b7250a..fd354d3 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 _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 +var _0x536c=['hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','include','rows','show','params','includeAll','find','create','body','whatsapp-interactions','accept','whatsapp','read','readAt','format','UserId','agent','get','WhatsappInteraction','WhatsappInteractionId','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','interaction','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','contact','User','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','role','stringify','null','RejectMessage','rejectMessage','sequelize','SELECT','fullname','rejectmessage','WhatsappAccount','WhatsappAccountId','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','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','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','register','http','request','then','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','message','WhatsappMessage,\x20%s,\x20%s','info','result','catch','sendStatus','end','status','json','limit','undefined','offset','count','apply','reject','update','destroy','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','model','keys','filters','intersection','query','attributes','fields','length'];(function(_0x954791,_0x1c4e46){var _0x2f42cb=function(_0x24d692){while(--_0x24d692){_0x954791['push'](_0x954791['shift']());}};_0x2f42cb(++_0x1c4e46);}(_0x536c,0x150));var _0xc536=function(_0x34783c,_0x2bce23){_0x34783c=_0x34783c-0x0;var _0x59bd0e=_0x536c[_0x34783c];return _0x59bd0e;};'use strict';var emlformat=require(_0xc536('0x0'));var rimraf=require(_0xc536('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc536('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc536('0x3'));var Mustache=require(_0xc536('0x4'));var util=require(_0xc536('0x5'));var path=require(_0xc536('0x6'));var sox=require(_0xc536('0x7'));var csv=require(_0xc536('0x8'));var ejs=require(_0xc536('0x9'));var fs=require('fs');var fs_extra=require(_0xc536('0xa'));var _=require(_0xc536('0xb'));var squel=require(_0xc536('0xc'));var crypto=require(_0xc536('0xd'));var jsforce=require(_0xc536('0xe'));var deskjs=require(_0xc536('0xf'));var toCsv=require(_0xc536('0x8'));var querystring=require(_0xc536('0x10'));var Papa=require(_0xc536('0x11'));var Redis=require(_0xc536('0x12'));var authService=require(_0xc536('0x13'));var qs=require(_0xc536('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc536('0x15'));var logger=require(_0xc536('0x16'))(_0xc536('0x17'));var utils=require(_0xc536('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xc536('0x19'));var db=require(_0xc536('0x1a'))['db'];config[_0xc536('0x1b')]=_[_0xc536('0x1c')](config[_0xc536('0x1b')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc536('0x1b')]));require('./whatsappMessage.socket')[_0xc536('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xc536('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0xc536('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x4d0cd9,_0x4017d0,_0x4a542e,_0x459b7f){return new BPromise(function(_0x692f5d,_0x470fa9){var _0x3812ab=_0x459b7f||client;return _0x3812ab[_0xc536('0x1f')](_0x4d0cd9,_0x4a542e)[_0xc536('0x20')](function(_0x431100){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x4017d0,_0xc536('0x21'));logger['debug'](_0xc536('0x22'),_0x4017d0,_0xc536('0x21'),JSON['stringify'](_0x431100));if(_0x431100[_0xc536('0x23')]){if(_0x431100[_0xc536('0x23')]['code']===0x1f4){logger[_0xc536('0x23')]('WhatsappMessage,\x20%s,\x20%s',_0x4017d0,_0x431100[_0xc536('0x23')]['message']);return _0x470fa9(_0x431100[_0xc536('0x23')][_0xc536('0x24')]);}logger['error'](_0xc536('0x25'),_0x4017d0,_0x431100[_0xc536('0x23')][_0xc536('0x24')]);return _0x692f5d(_0x431100[_0xc536('0x23')][_0xc536('0x24')]);}else{logger[_0xc536('0x26')](_0xc536('0x25'),_0x4017d0,_0xc536('0x21'));_0x692f5d(_0x431100[_0xc536('0x27')][_0xc536('0x24')]);}})[_0xc536('0x28')](function(_0x4eb797){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x4017d0,_0x4eb797);_0x470fa9(_0x4eb797);});});}function respondWithStatusCode(_0x13e911,_0x3ea6af){_0x3ea6af=_0x3ea6af||0xcc;return function(_0x899e92){if(_0x899e92){return _0x13e911[_0xc536('0x29')](_0x3ea6af);}return _0x13e911['status'](_0x3ea6af)[_0xc536('0x2a')]();};}function respondWithResult(_0x4ce51f,_0x1a7e8e){_0x1a7e8e=_0x1a7e8e||0xc8;return function(_0x5e7e45){if(_0x5e7e45){return _0x4ce51f[_0xc536('0x2b')](_0x1a7e8e)[_0xc536('0x2c')](_0x5e7e45);}};}function respondWithFilteredResult(_0x3c2853,_0x4eda55){return function(_0x38d8ce){if(_0x38d8ce){var _0x47fa10=typeof _0x4eda55['offset']==='undefined'&&typeof _0x4eda55[_0xc536('0x2d')]===_0xc536('0x2e');var _0x2f4dca=_0x38d8ce['count'];var _0x2114c8=_0x47fa10?0x0:_0x4eda55[_0xc536('0x2f')];var _0x1e3768=_0x47fa10?_0x38d8ce[_0xc536('0x30')]:_0x4eda55['offset']+_0x4eda55[_0xc536('0x2d')];var _0x14d5eb;if(_0x1e3768>=_0x2f4dca){_0x1e3768=_0x2f4dca;_0x14d5eb=0xc8;}else{_0x14d5eb=0xce;}_0x3c2853[_0xc536('0x2b')](_0x14d5eb);return _0x3c2853['set']('Content-Range',_0x2114c8+'-'+_0x1e3768+'/'+_0x2f4dca)[_0xc536('0x2c')](_0x38d8ce);}return null;};}function patchUpdates(_0x5a75b9){return function(_0x42a314){try{jsonpatch[_0xc536('0x31')](_0x42a314,_0x5a75b9,!![]);}catch(_0x4708b1){return BPromise[_0xc536('0x32')](_0x4708b1);}return _0x42a314['save']();};}function saveUpdates(_0x5a64bf,_0x942988){return function(_0xdf8c1f){if(_0xdf8c1f){return _0xdf8c1f[_0xc536('0x33')](_0x5a64bf)[_0xc536('0x20')](function(_0x3652e3){return _0x3652e3;});}return null;};}function removeEntity(_0x33b0c8,_0x5c5448){return function(_0x1f4775){if(_0x1f4775){return _0x1f4775[_0xc536('0x34')]()[_0xc536('0x20')](function(){_0x33b0c8[_0xc536('0x2b')](0xcc)[_0xc536('0x2a')]();});}};}function handleEntityNotFound(_0x5d50ef,_0xb57bb5){return function(_0x54e49c){if(!_0x54e49c){_0x5d50ef['sendStatus'](0x194);}return _0x54e49c;};}function handleError(_0x14321b,_0x4b7792){_0x4b7792=_0x4b7792||0x1f4;return function(_0x445fed){logger[_0xc536('0x23')](_0x445fed['stack']);if(_0x445fed[_0xc536('0x35')]){delete _0x445fed[_0xc536('0x35')];}_0x14321b[_0xc536('0x2b')](_0x4b7792)[_0xc536('0x36')](_0x445fed);};}exports[_0xc536('0x37')]=function(_0x17ef07,_0x8324a2){var _0x44a0ad={},_0x5f291d={},_0x33f054={'count':0x0,'rows':[]};var _0x438ecd=_[_0xc536('0x38')](db[_0xc536('0x39')][_0xc536('0x3a')],function(_0x41b797){return{'name':_0x41b797[_0xc536('0x3b')],'type':_0x41b797[_0xc536('0x3c')]['key']};});_0x5f291d[_0xc536('0x3d')]=_['map'](_0x438ecd,_0xc536('0x35'));_0x5f291d['query']=_[_0xc536('0x3e')](_0x17ef07['query']);_0x5f291d[_0xc536('0x3f')]=_[_0xc536('0x40')](_0x5f291d[_0xc536('0x3d')],_0x5f291d[_0xc536('0x41')]);_0x44a0ad[_0xc536('0x42')]=_[_0xc536('0x40')](_0x5f291d[_0xc536('0x3d')],qs['fields'](_0x17ef07[_0xc536('0x41')][_0xc536('0x43')]));_0x44a0ad[_0xc536('0x42')]=_0x44a0ad[_0xc536('0x42')][_0xc536('0x44')]?_0x44a0ad[_0xc536('0x42')]:_0x5f291d[_0xc536('0x3d')];if(!_0x17ef07[_0xc536('0x41')][_0xc536('0x45')](_0xc536('0x46'))){_0x44a0ad['limit']=qs[_0xc536('0x2d')](_0x17ef07[_0xc536('0x41')][_0xc536('0x2d')]);_0x44a0ad[_0xc536('0x2f')]=qs[_0xc536('0x2f')](_0x17ef07[_0xc536('0x41')]['offset']);}_0x44a0ad['order']=qs[_0xc536('0x47')](_0x17ef07['query'][_0xc536('0x47')]);_0x44a0ad[_0xc536('0x48')]=qs[_0xc536('0x3f')](_['pick'](_0x17ef07[_0xc536('0x41')],_0x5f291d[_0xc536('0x3f')]),_0x438ecd);if(_0x17ef07[_0xc536('0x41')]['filter']){_0x44a0ad['where']=_[_0xc536('0x49')](_0x44a0ad['where'],{'$or':_[_0xc536('0x38')](_0x438ecd,function(_0x31654c){if(_0x31654c[_0xc536('0x3c')]!==_0xc536('0x4a')){var _0x20cefb={};_0x20cefb[_0x31654c['name']]={'$like':'%'+_0x17ef07[_0xc536('0x41')][_0xc536('0x4b')]+'%'};return _0x20cefb;}})});}_0x44a0ad=_[_0xc536('0x49')]({},_0x44a0ad,_0x17ef07[_0xc536('0x4c')]);var _0x3e94c0={'where':_0x44a0ad[_0xc536('0x48')]};return db[_0xc536('0x39')][_0xc536('0x30')](_0x3e94c0)['then'](function(_0x247e3b){_0x33f054[_0xc536('0x30')]=_0x247e3b;if(_0x17ef07[_0xc536('0x41')]['includeAll']){_0x44a0ad[_0xc536('0x4d')]=[{'all':!![]}];}return db['WhatsappMessage']['findAll'](_0x44a0ad);})[_0xc536('0x20')](function(_0x205cc8){_0x33f054[_0xc536('0x4e')]=_0x205cc8;return _0x33f054;})[_0xc536('0x20')](respondWithFilteredResult(_0x8324a2,_0x44a0ad))[_0xc536('0x28')](handleError(_0x8324a2,null));};exports[_0xc536('0x4f')]=function(_0x3bbe72,_0xf4c1){var _0x49fa87={'raw':!![],'where':{'id':_0x3bbe72[_0xc536('0x50')]['id']}},_0x4c9dd6={};_0x4c9dd6[_0xc536('0x3d')]=_[_0xc536('0x3e')](db[_0xc536('0x39')][_0xc536('0x3a')]);_0x4c9dd6[_0xc536('0x41')]=_['keys'](_0x3bbe72[_0xc536('0x41')]);_0x4c9dd6[_0xc536('0x3f')]=_['intersection'](_0x4c9dd6[_0xc536('0x3d')],_0x4c9dd6[_0xc536('0x41')]);_0x49fa87['attributes']=_[_0xc536('0x40')](_0x4c9dd6[_0xc536('0x3d')],qs[_0xc536('0x43')](_0x3bbe72[_0xc536('0x41')][_0xc536('0x43')]));_0x49fa87[_0xc536('0x42')]=_0x49fa87[_0xc536('0x42')][_0xc536('0x44')]?_0x49fa87[_0xc536('0x42')]:_0x4c9dd6['model'];if(_0x3bbe72[_0xc536('0x41')][_0xc536('0x51')]){_0x49fa87[_0xc536('0x4d')]=[{'all':!![]}];}_0x49fa87=_[_0xc536('0x49')]({},_0x49fa87,_0x3bbe72[_0xc536('0x4c')]);return db[_0xc536('0x39')][_0xc536('0x52')](_0x49fa87)['then'](handleEntityNotFound(_0xf4c1,null))[_0xc536('0x20')](respondWithResult(_0xf4c1,null))[_0xc536('0x28')](handleError(_0xf4c1,null));};exports['create']=function(_0x14d834,_0x2afb81){return db['WhatsappMessage'][_0xc536('0x53')](_0x14d834[_0xc536('0x54')],{})[_0xc536('0x20')](respondWithResult(_0x2afb81,0xc9))[_0xc536('0x28')](handleError(_0x2afb81,null));};exports['update']=function(_0x37eda4,_0x4effd7){if(_0x37eda4[_0xc536('0x54')]['id']){delete _0x37eda4[_0xc536('0x54')]['id'];}return db[_0xc536('0x39')][_0xc536('0x52')]({'where':{'id':_0x37eda4[_0xc536('0x50')]['id']}})[_0xc536('0x20')](handleEntityNotFound(_0x4effd7,null))[_0xc536('0x20')](saveUpdates(_0x37eda4[_0xc536('0x54')],null))[_0xc536('0x20')](respondWithResult(_0x4effd7,null))[_0xc536('0x28')](handleError(_0x4effd7,null));};exports['destroy']=function(_0x44cbf3,_0x5210b2){return db['WhatsappMessage'][_0xc536('0x52')]({'where':{'id':_0x44cbf3[_0xc536('0x50')]['id']}})[_0xc536('0x20')](handleEntityNotFound(_0x5210b2,null))[_0xc536('0x20')](removeEntity(_0x5210b2,null))['catch'](handleError(_0x5210b2,null));};exports['describe']=function(_0x48541a,_0x329a82){return db[_0xc536('0x39')]['describe']()[_0xc536('0x20')](respondWithResult(_0x329a82,null))[_0xc536('0x28')](handleError(_0x329a82,null));};var interaction_log=require('../../config/logger')(_0xc536('0x55'));exports[_0xc536('0x56')]=function(_0x2406ba,_0x40d90a,_0x3a4158){var _0x42ac00={'agent':{},'channel':_0xc536('0x57')};if(_0x2406ba[_0xc536('0x54')]['id']){delete _0x2406ba[_0xc536('0x54')]['id'];}_0x2406ba[_0xc536('0x54')][_0xc536('0x58')]=!![];_0x2406ba[_0xc536('0x54')][_0xc536('0x59')]=moment()[_0xc536('0x5a')]('YYYY-MM-DD\x20HH:mm:ss');_0x2406ba[_0xc536('0x54')][_0xc536('0x5b')]=_0x2406ba[_0xc536('0x54')][_0xc536('0x5b')]||_0x2406ba['user']['id'];_0x42ac00[_0xc536('0x5c')]['id']=_0x2406ba[_0xc536('0x54')][_0xc536('0x5b')];return db[_0xc536('0x39')][_0xc536('0x52')]({'where':{'id':_0x2406ba[_0xc536('0x50')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x40d90a,null))[_0xc536('0x20')](saveUpdates(_0x2406ba['body'],null))[_0xc536('0x20')](function(_0x16a646){if(_0x16a646){_0x42ac00[_0xc536('0x24')]=_0x16a646[_0xc536('0x5d')]({'plain':!![]});return db[_0xc536('0x5e')][_0xc536('0x52')]({'where':{'id':_0x16a646[_0xc536('0x5f')]}});}return null;})[_0xc536('0x20')](handleEntityNotFound(_0x40d90a,null))[_0xc536('0x20')](function(_0x27bee4){if(_0x27bee4){return _0x27bee4[_0xc536('0x33')]({'UserId':_0x2406ba[_0xc536('0x54')]['UserId'],'read1stAt':_['isNil'](_0x27bee4['read1stAt'])?moment()[_0xc536('0x5a')](_0xc536('0x60')):undefined});}return null;})[_0xc536('0x20')](function(_0x3b0353){if(_0x3b0353){_0x42ac00['interaction']=_0x3b0353[_0xc536('0x5d')]({'plain':!![]});interaction_log[_0xc536('0x26')](_0xc536('0x61'),_0x2406ba['user']['id'],_0x2406ba[_0xc536('0x62')]['name'],_0x2406ba[_0xc536('0x62')]['role'],_0x42ac00[_0xc536('0x63')]['id'],_0x2406ba[_0xc536('0x54')]?JSON['stringify'](_0x2406ba[_0xc536('0x54')]):'null');return respondWithRpcPromise('AcceptMessage',_0xc536('0x64'),_0x42ac00);}return null;})[_0xc536('0x20')](function(_0x4216f3){var _0x535b5d=_0xc536('0x65')+_0x4216f3['message'][_0xc536('0x66')];return db['sequelize'][_0xc536('0x41')](_0x535b5d,{'type':db[_0xc536('0x67')][_0xc536('0x68')]['SELECT'],'raw':!![]})[_0xc536('0x20')](function(_0x586ec8){return _0x586ec8;});})['then'](function(_0x210b5b){if(_0x210b5b){_0x42ac00[_0xc536('0x24')][_0xc536('0x69')]=_0x210b5b[0x0];if(!_0x2406ba[_0xc536('0x54')]['UserId'])return;return db[_0xc536('0x6a')][_0xc536('0x52')]({'where':{'id':_0x2406ba[_0xc536('0x54')][_0xc536('0x5b')],'role':'agent'},'attributes':['id',_0xc536('0x35'),'fullname',_0xc536('0x6b'),_0xc536('0x6c')],'raw':!![]});}return null;})[_0xc536('0x20')](function(_0x3128c3){if(!_0x3128c3)return null;_0x42ac00[_0xc536('0x24')][_0xc536('0x5c')]=_0x3128c3;return _0x42ac00;})['then'](function(_0x2b808f){if(_0x2b808f){if(_0x2406ba[_0xc536('0x54')][_0xc536('0x6d')]){_0x42ac00[_0xc536('0x24')][_0xc536('0x6e')]=util['format'](_0xc536('0x6f'),_0x2406ba[_0xc536('0x62')][_0xc536('0x35')]);_0x42ac00[_0xc536('0x24')][_0xc536('0x70')]=_0x42ac00[_0xc536('0x70')];_0x42ac00[_0xc536('0x24')][_0xc536('0x71')]=_0x42ac00[_0xc536('0x70')];_0x42ac00[_0xc536('0x24')][_0xc536('0x72')]=_0xc536('0x56');return respondWithRpcPromise(_0xc536('0x73'),'EventManager',{'event':_0xc536('0x74'),'message':_0x42ac00[_0xc536('0x24')]},client9002)[_0xc536('0x20')](function(){return _0x42ac00;});}return _0x42ac00;}return null;})['then'](respondWithResult(_0x40d90a,null))[_0xc536('0x28')](handleError(_0x40d90a,null));};var interaction_log=require(_0xc536('0x16'))('whatsapp-interactions');exports['reject']=function(_0xf85cf8,_0x24c8c9,_0x44a4ad){var _0x30f6bc={'agent':{},'channel':_0xc536('0x57')};if(_0xf85cf8[_0xc536('0x54')]['id']){delete _0xf85cf8[_0xc536('0x54')]['id'];}_0xf85cf8['body'][_0xc536('0x5b')]=_0xf85cf8[_0xc536('0x54')][_0xc536('0x5b')]||_0xf85cf8[_0xc536('0x62')]['id'];_0x30f6bc[_0xc536('0x5c')]['id']=_0xf85cf8[_0xc536('0x54')][_0xc536('0x5b')];return db[_0xc536('0x39')][_0xc536('0x52')]({'where':{'id':_0xf85cf8[_0xc536('0x50')]['id'],'UserId':null}})[_0xc536('0x20')](handleEntityNotFound(_0x24c8c9,null))[_0xc536('0x20')](function(_0x253aea){if(_0x253aea){_0x30f6bc[_0xc536('0x24')]=_0x253aea[_0xc536('0x5d')]({'plain':!![]});return db[_0xc536('0x5e')][_0xc536('0x52')]({'where':{'id':_0x253aea['WhatsappInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x24c8c9,null))['then'](function(_0x95183){if(_0x95183){_0x30f6bc[_0xc536('0x63')]=_0x95183['get']({'plain':!![]});interaction_log[_0xc536('0x26')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xf85cf8['user']['id'],_0xf85cf8[_0xc536('0x62')]['name'],_0xf85cf8[_0xc536('0x62')][_0xc536('0x75')],_0x30f6bc['interaction']['id'],_0xf85cf8[_0xc536('0x54')]?JSON[_0xc536('0x76')](_0xf85cf8['body']):_0xc536('0x77'));return respondWithRpcPromise(_0xc536('0x78'),_0xc536('0x79'),_0x30f6bc);}return null;})['then'](function(_0x29f5cd){var _0x46cdf3=_0xc536('0x65')+_0x29f5cd[_0xc536('0x24')]['ContactId'];return db[_0xc536('0x7a')][_0xc536('0x41')](_0x46cdf3,{'type':db[_0xc536('0x67')][_0xc536('0x68')][_0xc536('0x7b')],'raw':!![]})[_0xc536('0x20')](function(_0x1c5a1e){return _0x1c5a1e;});})['then'](function(_0x713000){if(_0x713000){_0x30f6bc['message'][_0xc536('0x69')]=_0x713000[0x0];if(!_0xf85cf8[_0xc536('0x54')][_0xc536('0x5b')])return;return db[_0xc536('0x6a')][_0xc536('0x52')]({'where':{'id':_0xf85cf8['body'][_0xc536('0x5b')],'role':_0xc536('0x5c')},'attributes':['id',_0xc536('0x35'),_0xc536('0x7c'),_0xc536('0x6b'),_0xc536('0x6c')],'raw':!![]});}return null;})[_0xc536('0x20')](function(_0x54746e){if(!_0x54746e)return null;_0x30f6bc['message']['agent']=_0x54746e;return _0x30f6bc;})[_0xc536('0x20')](function(_0x2cf1af){if(_0x2cf1af){_0x2cf1af['message'][_0xc536('0x6e')]=util[_0xc536('0x5a')](_0xc536('0x6f'),_0xf85cf8[_0xc536('0x62')][_0xc536('0x35')]);_0x2cf1af[_0xc536('0x24')]['channel']=_0x30f6bc['channel'];_0x2cf1af[_0xc536('0x24')][_0xc536('0x71')]=_0x30f6bc[_0xc536('0x70')];_0x2cf1af[_0xc536('0x24')]['event']=_0xc536('0x32');respondWithRpcPromise('EventManager',_0xc536('0x73'),{'event':_0xc536('0x7d'),'message':_0x2cf1af[_0xc536('0x24')]},client9002);return _0x30f6bc;}return null;})[_0xc536('0x20')](respondWithResult(_0x24c8c9,null))['catch'](handleError(_0x24c8c9,null));};exports[_0xc536('0x2b')]=function(_0x40f4b6,_0x56f6c2,_0x152a9e){if(_0x40f4b6[_0xc536('0x54')]['id']){delete _0x40f4b6['body']['id'];}var _0x218ecf;return db[_0xc536('0x39')][_0xc536('0x52')]({'where':{'id':_0x40f4b6[_0xc536('0x50')]['id']}})[_0xc536('0x20')](handleEntityNotFound(_0x56f6c2,null))['then'](function(_0x47d0cf){if(_0x47d0cf){_0x218ecf=_0x47d0cf;return db[_0xc536('0x7e')][_0xc536('0x52')]({'where':{'id':_0x47d0cf[_0xc536('0x7f')]}});}})[_0xc536('0x20')](handleEntityNotFound(_0x56f6c2,null))[_0xc536('0x20')](function(_0x35918f){if(_0x35918f){logger['debug']('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0xc536('0x2b'),_0xc536('0x80'),_0x35918f[_0xc536('0x3c')],util[_0xc536('0x81')](_0x40f4b6[_0xc536('0x54')],{'showHidden':![],'depth':null}));switch(_0x35918f[_0xc536('0x3c')]){case'twilio':if(_0x40f4b6['body'][_0xc536('0x82')]&&_0x40f4b6[_0xc536('0x54')]['MessageSid']===_0x218ecf[_0xc536('0x83')]&&_0x40f4b6[_0xc536('0x54')]['MessageStatus']&&_0x40f4b6[_0xc536('0x54')][_0xc536('0x84')]===_0xc536('0x58')){return _0x218ecf[_0xc536('0x33')]({'read':!![]});}else{logger['error'](_0xc536('0x85'),'status',_0xc536('0x86'),util['inspect'](_0x40f4b6[_0xc536('0x54')],{'showHidden':![],'depth':null}));}break;}return _0x218ecf;}})[_0xc536('0x20')](respondWithResult(_0x56f6c2,null))['catch'](handleError(_0x56f6c2,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index b69c793..079fb42 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 _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 +var _0x98e5=['setMaxListeners','save','remove','emit','hook','exports'];(function(_0x27ce4f,_0x1a4ac7){var _0x2ae5b1=function(_0xc676c0){while(--_0xc676c0){_0x27ce4f['push'](_0x27ce4f['shift']());}};_0x2ae5b1(++_0x1a4ac7);}(_0x98e5,0x8a));var _0x598e=function(_0x531adc,_0x11312f){_0x531adc=_0x531adc-0x0;var _0xcb04b6=_0x98e5[_0x531adc];return _0xcb04b6;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x598e('0x0')](0x0);var events={'afterCreate':_0x598e('0x1'),'afterUpdate':'update','afterDestroy':_0x598e('0x2')};function emitEvent(_0xc090ec){return function(_0x5cc274,_0x3af01f,_0x5a876c){WhatsappMessageEvents['emit'](_0xc090ec+':'+_0x5cc274['id'],_0x5cc274);WhatsappMessageEvents[_0x598e('0x3')](_0xc090ec,_0x5cc274);_0x5a876c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage[_0x598e('0x4')](e,emitEvent(event));}}module[_0x598e('0x5')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 2825d5a..9cc5275 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 _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 +var _0xafc6=['api','moment','bluebird','request-promise','node-fetch','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','body','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','WhatsappInteractionId','then','update','createdAt','error','find','WhatsappAccountId','type','accountSid','authToken','create','phone','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/','text','Bearer\x20','application/json','message_id','statuses','catch','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x445f1d,_0x4672ce){var _0x1b1708=function(_0x394e68){while(--_0x394e68){_0x445f1d['push'](_0x445f1d['shift']());}};_0x1b1708(++_0x4672ce);}(_0xafc6,0xf9));var _0x6afc=function(_0x1a7846,_0x59723e){_0x1a7846=_0x1a7846-0x0;var _0x48049=_0xafc6[_0x1a7846];return _0x48049;};'use strict';var _=require(_0x6afc('0x0'));var util=require(_0x6afc('0x1'));var logger=require(_0x6afc('0x2'))(_0x6afc('0x3'));var moment=require(_0x6afc('0x4'));var BPromise=require(_0x6afc('0x5'));var rp=require(_0x6afc('0x6'));var fetch=require(_0x6afc('0x7'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6afc('0x8'));var config=require(_0x6afc('0x9'));var attributes=require(_0x6afc('0xa'));module[_0x6afc('0xb')]=function(_0x183d9c,_0x5ef905){return _0x183d9c[_0x6afc('0xc')](_0x6afc('0xd'),attributes,{'tableName':_0x6afc('0xe'),'paranoid':![],'indexes':[{'name':_0x6afc('0xf'),'fields':[_0x6afc('0xf')]},{'name':'fti_whatsapp_messages','fields':[_0x6afc('0x10')],'type':_0x6afc('0x11')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5b68d6,_0x4dc0ab,_0x51454f){var _0x3d687e=_0x183d9c['models'];var _0x2e7155=_0x5b68d6[_0x6afc('0x12')]({'plain':!![]});if(_0x2e7155[_0x6afc('0x13')][_0x6afc('0x14')]()==='in'||_0x2e7155[_0x6afc('0x13')][_0x6afc('0x14')]()===_0x6afc('0x15')&&!_0x2e7155[_0x6afc('0x16')]&&!_[_0x6afc('0x17')](_0x2e7155[_0x6afc('0x18')])){_0x3d687e[_0x6afc('0x19')]['findOne']({'where':{'id':_0x2e7155[_0x6afc('0x1a')]}})[_0x6afc('0x1b')](function(_0x906d){if(_0x906d){_0x906d[_0x6afc('0x1c')]({'lastMsgAt':_0x2e7155[_0x6afc('0x1d')],'lastMsgDirection':_0x2e7155[_0x6afc('0x13')][_0x6afc('0x14')]()});}})['catch'](function(_0x15eb4b){console[_0x6afc('0x1e')](_0x15eb4b);});}if(_0x2e7155['direction']==='out'&&!_0x2e7155[_0x6afc('0x16')]){var _0x52553a;_0x3d687e['WhatsappAccount'][_0x6afc('0x1f')]({'where':{'id':_0x2e7155[_0x6afc('0x20')]},'raw':!![]})[_0x6afc('0x1b')](function(_0x1ed261){_0x52553a=_0x1ed261;if(_0x52553a&&_0x52553a[_0x6afc('0x21')]){switch(_0x52553a[_0x6afc('0x21')]){case'twilio':var _0xd08f0e=require('twilio');if(_0x52553a[_0x6afc('0x22')]&&_0x52553a['authToken']&&_0x52553a['phone']){var _0x34af92=new _0xd08f0e(_0x52553a['accountSid'],_0x52553a[_0x6afc('0x23')]);_0x34af92['messages'][_0x6afc('0x24')]({'body':_0x2e7155['body'],'to':'whatsapp:'+_0x2e7155[_0x6afc('0x25')],'from':_0x6afc('0x26')+_0x52553a[_0x6afc('0x25')],'statusCallback':_0x52553a[_0x6afc('0x27')]+_0x6afc('0x28')+_0x2e7155['id']+_0x6afc('0x29')+_0x52553a[_0x6afc('0x2a')]})['then'](function(_0x3f27af){if(_0x3f27af['sid']){return _0x5b68d6[_0x6afc('0x1c')]({'messageId':_0x3f27af[_0x6afc('0x2b')]});}})['catch'](function(_0xfee0e1){logger[_0x6afc('0x1e')](_0x6afc('0x2c'),_0x6afc('0x2d'),_0x6afc('0x2e'),util[_0x6afc('0x2f')](_0xfee0e1,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x6afc('0x2c'),'afterCreate',_0x6afc('0x2e'),_0x6afc('0x30'));}break;case _0x6afc('0x31'):var _0x11b795=_0x52553a[_0x6afc('0x22')];var _0x745e8f=_0x52553a[_0x6afc('0x23')];var _0x23d85e=_0x52553a[_0x6afc('0x32')]+_0x6afc('0x33')+_0x11b795+_0x6afc('0x34');var _0x2173e5={'to':[_0x2e7155[_0x6afc('0x25')]],'message':{'type':_0x6afc('0x35'),'text':_0x2e7155[_0x6afc('0x10')]}};var _0x3647d0={'method':'POST','uri':_0x23d85e,'headers':{'Authorization':_0x6afc('0x36')+_0x745e8f,'Content-Type':_0x6afc('0x37')},'body':_0x2173e5,'json':!![]};rp(_0x3647d0)[_0x6afc('0x1b')](function(_0x10150c){if(_0x10150c['statuses'][0x0][_0x6afc('0x38')]){return _0x5b68d6['update']({'messageId':_0x10150c[_0x6afc('0x39')][0x0]['message_id']});}})[_0x6afc('0x3a')](function(_0x3ebb48){logger['err'](_0x6afc('0x3b'),_0x3ebb48);});break;}}})[_0x6afc('0x3c')](function(){_0x51454f();});}else{_0x51454f();}}},'charset':_0x6afc('0x3d'),'collate':_0x6afc('0x3e')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 57c2628..6421a1e 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 _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 +var _0x87e1=['rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','body','options','raw','CreateWhatsappMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x369ff2,_0x466a61){var _0xb53a59=function(_0x61bcf2){while(--_0x61bcf2){_0x369ff2['push'](_0x369ff2['shift']());}};_0xb53a59(++_0x466a61);}(_0x87e1,0x101));var _0x187e=function(_0x3b3362,_0x202631){_0x3b3362=_0x3b3362-0x0;var _0x223f5b=_0x87e1[_0x3b3362];return _0x223f5b;};'use strict';var _=require(_0x187e('0x0'));var util=require(_0x187e('0x1'));var moment=require(_0x187e('0x2'));var BPromise=require(_0x187e('0x3'));var rs=require(_0x187e('0x4'));var fs=require('fs');var Redis=require(_0x187e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x187e('0x6'));var logger=require('../../config/logger')(_0x187e('0x7'));var config=require(_0x187e('0x8'));var jayson=require(_0x187e('0x9'));var client=jayson[_0x187e('0xa')]['http']({'port':0x232a});config[_0x187e('0xb')]=_[_0x187e('0xc')](config[_0x187e('0xb')],{'host':_0x187e('0xd'),'port':0x18eb});var socket=require(_0x187e('0xe'))(new Redis(config[_0x187e('0xb')]));require(_0x187e('0xf'))[_0x187e('0x10')](socket);function respondWithRpcPromise(_0x161a62,_0xe47e25,_0x197cf7){return new BPromise(function(_0x47edf8,_0x5d3815){return client[_0x187e('0x11')](_0x161a62,_0x197cf7)[_0x187e('0x12')](function(_0x5ccf1d){logger[_0x187e('0x13')](_0x187e('0x14'),_0xe47e25,_0x187e('0x15'));logger[_0x187e('0x16')](_0x187e('0x17'),_0xe47e25,_0x187e('0x15'),JSON[_0x187e('0x18')](_0x5ccf1d));if(_0x5ccf1d[_0x187e('0x19')]){if(_0x5ccf1d['error'][_0x187e('0x1a')]===0x1f4){logger[_0x187e('0x19')]('WhatsappMessage,\x20%s,\x20%s',_0xe47e25,_0x5ccf1d[_0x187e('0x19')]['message']);return _0x5d3815(_0x5ccf1d['error'][_0x187e('0x1b')]);}logger[_0x187e('0x19')](_0x187e('0x14'),_0xe47e25,_0x5ccf1d['error'][_0x187e('0x1b')]);return _0x47edf8(_0x5ccf1d[_0x187e('0x19')][_0x187e('0x1b')]);}else{logger['info'](_0x187e('0x14'),_0xe47e25,_0x187e('0x15'));_0x47edf8(_0x5ccf1d['result'][_0x187e('0x1b')]);}})[_0x187e('0x1c')](function(_0x2a8372){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0xe47e25,_0x2a8372);_0x5d3815(_0x2a8372);});});}exports['CreateWhatsappMessage']=function(_0x4ac6ea){var _0x2cea02=this;return new Promise(function(_0x1b7086,_0x44ce7b){return db['WhatsappMessage']['create'](_0x4ac6ea[_0x187e('0x1d')],{'raw':_0x4ac6ea[_0x187e('0x1e')]?_0x4ac6ea[_0x187e('0x1e')][_0x187e('0x1f')]===undefined?!![]:![]:!![]})[_0x187e('0x12')](function(_0x394ae6){logger[_0x187e('0x13')]('CreateWhatsappMessage',_0x4ac6ea);logger['debug'](_0x187e('0x20'),_0x4ac6ea,JSON['stringify'](_0x394ae6));_0x1b7086(_0x394ae6);})[_0x187e('0x1c')](function(_0x2ff980){logger[_0x187e('0x19')](_0x187e('0x20'),_0x2ff980[_0x187e('0x1b')],_0x4ac6ea);_0x44ce7b(_0x2cea02[_0x187e('0x19')](0x1f4,_0x2ff980[_0x187e('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 6ff1429..8692fd2 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 _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 +var _0xa967=['emit','removeListener','register','length','whatsappMessage:','./whatsappMessage.events','remove','update'];(function(_0x5214fd,_0x238b9d){var _0x4c22f8=function(_0x53b8bf){while(--_0x53b8bf){_0x5214fd['push'](_0x5214fd['shift']());}};_0x4c22f8(++_0x238b9d);}(_0xa967,0xed));var _0x7a96=function(_0x4edf2f,_0x306bcf){_0x4edf2f=_0x4edf2f-0x0;var _0x5cc213=_0xa967[_0x4edf2f];return _0x5cc213;};'use strict';var WhatsappMessageEvents=require(_0x7a96('0x0'));var events=['save',_0x7a96('0x1'),_0x7a96('0x2')];function createListener(_0x47567f,_0x565daf){return function(_0x3af71b){_0x565daf[_0x7a96('0x3')](_0x47567f,_0x3af71b);};}function removeListener(_0x3c3c05,_0x274139){return function(){WhatsappMessageEvents[_0x7a96('0x4')](_0x3c3c05,_0x274139);};}exports[_0x7a96('0x5')]=function(_0x314c1d){for(var _0x3322d6=0x0,_0x2d5968=events[_0x7a96('0x6')];_0x3322d6<_0x2d5968;_0x3322d6++){var _0x5e0c67=events[_0x3322d6];var _0x522fab=createListener(_0x7a96('0x7')+_0x5e0c67,_0x314c1d);WhatsappMessageEvents['on'](_0x5e0c67,_0x522fab);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 43efe27..6276bcd 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 _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 +var _0x3ef7=['/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','/:id/members','getMembers','getTeams'];(function(_0x399240,_0x5bebdb){var _0x487837=function(_0x3ded72){while(--_0x3ded72){_0x399240['push'](_0x399240['shift']());}};_0x487837(++_0x5bebdb);}(_0x3ef7,0xa2));var _0x73ef=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3ef7[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x73ef('0x0'));var util=require('util');var path=require(_0x73ef('0x1'));var timeout=require(_0x73ef('0x2'));var express=require(_0x73ef('0x3'));var router=express[_0x73ef('0x4')]();var fs_extra=require(_0x73ef('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x73ef('0x6'));var config=require(_0x73ef('0x7'));var controller=require(_0x73ef('0x8'));router[_0x73ef('0x9')]('/',auth['isAuthenticated'](),controller[_0x73ef('0xa')]);router[_0x73ef('0x9')](_0x73ef('0xb'),auth[_0x73ef('0xc')](),controller[_0x73ef('0xd')]);router['get'](_0x73ef('0xe'),auth[_0x73ef('0xc')](),controller['show']);router[_0x73ef('0x9')](_0x73ef('0xf'),auth[_0x73ef('0xc')](),controller[_0x73ef('0x10')]);router[_0x73ef('0x9')]('/:id/teams',auth[_0x73ef('0xc')](),controller[_0x73ef('0x11')]);router[_0x73ef('0x9')](_0x73ef('0x12'),auth[_0x73ef('0xc')](),controller[_0x73ef('0x13')]);router[_0x73ef('0x14')]('/',auth[_0x73ef('0xc')](),controller[_0x73ef('0x15')]);router[_0x73ef('0x14')](_0x73ef('0x16'),auth[_0x73ef('0xc')](),controller[_0x73ef('0x17')]);router['post'](_0x73ef('0x12'),auth['isAuthenticated'](),controller[_0x73ef('0x18')]);router[_0x73ef('0x19')](_0x73ef('0xe'),auth['isAuthenticated'](),controller[_0x73ef('0x1a')]);router[_0x73ef('0x1b')]('/:id',auth[_0x73ef('0xc')](),controller[_0x73ef('0x1c')]);router[_0x73ef('0x1b')](_0x73ef('0x16'),auth[_0x73ef('0xc')](),controller['removeTeams']);router[_0x73ef('0x1b')]('/:id/users',auth[_0x73ef('0xc')](),controller['removeAgents']);module[_0x73ef('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index d6dfaaf..c096393 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 _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 +var _0x7d13=['beepall','roundrobin','STRING','exports','name','ENUM','rrmemory'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x7d13,0x6c));var _0x37d1=function(_0x40b66c,_0x5c1d58){_0x40b66c=_0x40b66c-0x0;var _0x159671=_0x7d13[_0x40b66c];return _0x159671;};'use strict';var Sequelize=require('sequelize');module[_0x37d1('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x37d1('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x37d1('0x2')](_0x37d1('0x3'),_0x37d1('0x4'),_0x37d1('0x5'))},'description':{'type':Sequelize[_0x37d1('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 90229aa..1336386 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 _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 +var _0xca90=['toString','SELECT','every','TeamId','all','union','value','removeAgents','forEach','userWhatsappQueue:remove','addAgents','spread','isArray','getAgents','pick','bluebird','util','squel','ioredis','../../components/parsers/qs','../../config/logger','api','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','undefined','count','offset','limit','set','Content-Range','json','update','destroy','get','UserProfileResource','then','end','error','stack','send','index','WhatsappQueue','fieldName','type','key','getOptions','where','include','query','findAll','rows','catch','show','params','model','rawAttributes','keys','filters','intersection','attributes','fields','includeAll','merge','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','WhatsappQueues','UserProfileSection','userProfileId','autoAssociation','name','describe','getMembers','findOne','UserWhatsappQueue','length','nolimit','order','sort','map','filter','options','User','findAndCountAll','UserId','whatsappPause','format','%s/%s','SIP','updatedAt','getTeams','hasOwnProperty','addTeams','ids','Team','Agents','voicePause','interface','transaction','each','findOrCreate','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','sequelize'];(function(_0x16954c,_0x2f3051){var _0x93e220=function(_0x539dd1){while(--_0x539dd1){_0x16954c['push'](_0x16954c['shift']());}};_0x93e220(++_0x2f3051);}(_0xca90,0x89));var _0x0ca9=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xca90[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require(_0x0ca9('0x0'));var util=require(_0x0ca9('0x1'));var _=require('lodash');var squel=require(_0x0ca9('0x2'));var Redis=require(_0x0ca9('0x3'));var qs=require(_0x0ca9('0x4'));var logger=require(_0x0ca9('0x5'))(_0x0ca9('0x6'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x0ca9('0x7')]=_[_0x0ca9('0x8')](config[_0x0ca9('0x7')],{'host':_0x0ca9('0x9'),'port':0x18eb});var socket=require(_0x0ca9('0xa'))(new Redis(config[_0x0ca9('0x7')]));require('./whatsappQueue.socket')[_0x0ca9('0xb')](socket);function respondWithStatusCode(_0x27aacc,_0x213df9){_0x213df9=_0x213df9||0xcc;return function(_0x23d042){if(_0x23d042){return _0x27aacc[_0x0ca9('0xc')](_0x213df9);}return _0x27aacc[_0x0ca9('0xd')](_0x213df9)['end']();};}function respondWithResult(_0x46344b,_0x21e30b){_0x21e30b=_0x21e30b||0xc8;return function(_0x51cfa8){if(_0x51cfa8){return _0x46344b[_0x0ca9('0xd')](_0x21e30b)['json'](_0x51cfa8);}};}function respondWithFilteredResult(_0x45a9ea,_0x187d9e){return function(_0x469bf4){if(_0x469bf4){var _0x36e5c4=typeof _0x187d9e['offset']==='undefined'&&typeof _0x187d9e['limit']===_0x0ca9('0xe');var _0x5824ab=_0x469bf4[_0x0ca9('0xf')];var _0x175cd9=_0x36e5c4?0x0:_0x187d9e[_0x0ca9('0x10')];var _0x3741e5=_0x36e5c4?_0x469bf4[_0x0ca9('0xf')]:_0x187d9e[_0x0ca9('0x10')]+_0x187d9e[_0x0ca9('0x11')];var _0x125060;if(_0x3741e5>=_0x5824ab){_0x3741e5=_0x5824ab;_0x125060=0xc8;}else{_0x125060=0xce;}_0x45a9ea[_0x0ca9('0xd')](_0x125060);return _0x45a9ea[_0x0ca9('0x12')](_0x0ca9('0x13'),_0x175cd9+'-'+_0x3741e5+'/'+_0x5824ab)[_0x0ca9('0x14')](_0x469bf4);}return null;};}function saveUpdates(_0x1f4082){return function(_0xd5bc30){if(_0xd5bc30){return _0xd5bc30[_0x0ca9('0x15')](_0x1f4082)['then'](function(_0xeae51d){return _0xeae51d;});}return null;};}function removeEntity(_0x373849){return function(_0x5e8d8b){if(_0x5e8d8b){return _0x5e8d8b[_0x0ca9('0x16')]()['then'](function(){var _0x2699de=_0x5e8d8b[_0x0ca9('0x17')]({'plain':!![]});var _0x1881d7='WhatsappQueues';return db[_0x0ca9('0x18')][_0x0ca9('0x16')]({'where':{'type':_0x1881d7,'resourceId':_0x2699de['id']}})[_0x0ca9('0x19')](function(){return _0x5e8d8b;});})[_0x0ca9('0x19')](function(){_0x373849[_0x0ca9('0xd')](0xcc)[_0x0ca9('0x1a')]();});}};}function handleEntityNotFound(_0xdc6947){return function(_0x25c79b){if(!_0x25c79b){_0xdc6947[_0x0ca9('0xc')](0x194);}return _0x25c79b;};}function handleError(_0x20c5b5,_0x15afed){_0x15afed=_0x15afed||0x1f4;return function(_0x537dd7){logger[_0x0ca9('0x1b')](_0x537dd7[_0x0ca9('0x1c')]);if(_0x537dd7['name']){delete _0x537dd7['name'];}_0x20c5b5['status'](_0x15afed)[_0x0ca9('0x1d')](_0x537dd7);};}exports[_0x0ca9('0x1e')]=function(_0x3c6d9a,_0x5b8b88){var _0x4296bb={};var _0x7ba656={'count':0x0,'rows':[]};var _0x3cf933=_['map'](db[_0x0ca9('0x1f')]['rawAttributes'],function(_0x4301a1){return{'name':_0x4301a1[_0x0ca9('0x20')],'type':_0x4301a1[_0x0ca9('0x21')][_0x0ca9('0x22')]};});_0x4296bb=qs[_0x0ca9('0x23')](_0x3cf933,_0x3c6d9a);var _0x386a56={'where':_0x4296bb[_0x0ca9('0x24')]};return db[_0x0ca9('0x1f')]['count'](_0x386a56)[_0x0ca9('0x19')](function(_0x367611){_0x7ba656['count']=_0x367611;_0x4296bb[_0x0ca9('0x25')]=qs[_0x0ca9('0x25')](_0x3c6d9a[_0x0ca9('0x26')]);return db['WhatsappQueue'][_0x0ca9('0x27')](_0x4296bb);})['then'](function(_0x2f71ce){_0x7ba656[_0x0ca9('0x28')]=_0x2f71ce;return _0x7ba656;})[_0x0ca9('0x19')](respondWithFilteredResult(_0x5b8b88,_0x4296bb))[_0x0ca9('0x29')](handleError(_0x5b8b88,null));};exports[_0x0ca9('0x2a')]=function(_0x4f161c,_0x4c6fb1){var _0x34c1d7={'raw':!![],'where':{'id':_0x4f161c[_0x0ca9('0x2b')]['id']}},_0x10e019={};_0x10e019[_0x0ca9('0x2c')]=_['keys'](db[_0x0ca9('0x1f')][_0x0ca9('0x2d')]);_0x10e019[_0x0ca9('0x26')]=_[_0x0ca9('0x2e')](_0x4f161c['query']);_0x10e019[_0x0ca9('0x2f')]=_[_0x0ca9('0x30')](_0x10e019[_0x0ca9('0x2c')],_0x10e019[_0x0ca9('0x26')]);_0x34c1d7[_0x0ca9('0x31')]=_['intersection'](_0x10e019[_0x0ca9('0x2c')],qs['fields'](_0x4f161c[_0x0ca9('0x26')][_0x0ca9('0x32')]));_0x34c1d7[_0x0ca9('0x31')]=_0x34c1d7[_0x0ca9('0x31')]['length']?_0x34c1d7['attributes']:_0x10e019['model'];if(_0x4f161c['query'][_0x0ca9('0x33')]){_0x34c1d7[_0x0ca9('0x25')]=[{'all':!![]}];}_0x34c1d7=_[_0x0ca9('0x34')]({},_0x34c1d7,_0x4f161c['options']);return db[_0x0ca9('0x1f')][_0x0ca9('0x35')](_0x34c1d7)[_0x0ca9('0x19')](handleEntityNotFound(_0x4c6fb1,null))[_0x0ca9('0x19')](respondWithResult(_0x4c6fb1,null))[_0x0ca9('0x29')](handleError(_0x4c6fb1,null));};exports[_0x0ca9('0x36')]=function(_0x48738a,_0x10067c){return db[_0x0ca9('0x1f')]['create'](_0x48738a[_0x0ca9('0x37')],{})[_0x0ca9('0x19')](function(_0x10ecaa){var _0x367f83=_0x48738a['user'][_0x0ca9('0x17')]({'plain':!![]});if(!_0x367f83)throw new Error(_0x0ca9('0x38'));if(_0x367f83['role']===_0x0ca9('0x39')){var _0x3b670=_0x10ecaa[_0x0ca9('0x17')]({'plain':!![]});var _0x2f7f50=_0x0ca9('0x3a');return db[_0x0ca9('0x3b')][_0x0ca9('0x35')]({'where':{'name':_0x2f7f50,'userProfileId':_0x367f83[_0x0ca9('0x3c')]},'raw':!![]})[_0x0ca9('0x19')](function(_0x54c7ce){if(_0x54c7ce&&_0x54c7ce[_0x0ca9('0x3d')]===0x0){return db[_0x0ca9('0x18')][_0x0ca9('0x36')]({'name':_0x3b670[_0x0ca9('0x3e')],'resourceId':_0x3b670['id'],'type':_0x54c7ce[_0x0ca9('0x3e')],'sectionId':_0x54c7ce['id']},{})[_0x0ca9('0x19')](function(){return _0x10ecaa;});}else{return _0x10ecaa;}})[_0x0ca9('0x29')](function(_0x19b8cd){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x19b8cd);throw _0x19b8cd;});}return _0x10ecaa;})[_0x0ca9('0x19')](respondWithResult(_0x10067c,0xc9))[_0x0ca9('0x29')](handleError(_0x10067c,null));};exports['update']=function(_0x1e302c,_0x67c2eb){if(_0x1e302c[_0x0ca9('0x37')]['id']){delete _0x1e302c[_0x0ca9('0x37')]['id'];}return db[_0x0ca9('0x1f')]['find']({'where':{'id':_0x1e302c[_0x0ca9('0x2b')]['id']}})[_0x0ca9('0x19')](handleEntityNotFound(_0x67c2eb,null))['then'](saveUpdates(_0x1e302c[_0x0ca9('0x37')],null))[_0x0ca9('0x19')](respondWithResult(_0x67c2eb,null))[_0x0ca9('0x29')](handleError(_0x67c2eb,null));};exports[_0x0ca9('0x16')]=function(_0x1a4ab8,_0x10e54e){return db[_0x0ca9('0x1f')][_0x0ca9('0x35')]({'where':{'id':_0x1a4ab8['params']['id']}})[_0x0ca9('0x19')](handleEntityNotFound(_0x10e54e,null))['then'](removeEntity(_0x10e54e,null))[_0x0ca9('0x29')](handleError(_0x10e54e,null));};exports[_0x0ca9('0x3f')]=function(_0x3059b9,_0x52d171){return db[_0x0ca9('0x1f')][_0x0ca9('0x3f')]()['then'](respondWithResult(_0x52d171,null))['catch'](handleError(_0x52d171,null));};exports[_0x0ca9('0x40')]=function(_0x26b8c2,_0x9561bc){var _0x46fe10={'raw':!![],'where':{}},_0x42aa48={},_0x4bdae0;return db['WhatsappQueue'][_0x0ca9('0x41')]({'where':{'id':_0x26b8c2[_0x0ca9('0x2b')]['id']}})[_0x0ca9('0x19')](handleEntityNotFound(_0x9561bc,null))[_0x0ca9('0x19')](function(_0x3d1d2b){if(_0x3d1d2b){_0x4bdae0=_0x3d1d2b[_0x0ca9('0x17')]({'plain':!![]});_0x42aa48[_0x0ca9('0x2c')]=_[_0x0ca9('0x2e')](db[_0x0ca9('0x42')][_0x0ca9('0x2d')]);_0x42aa48[_0x0ca9('0x26')]=_[_0x0ca9('0x2e')](_0x26b8c2['query']);_0x42aa48[_0x0ca9('0x2f')]=_[_0x0ca9('0x30')](_0x42aa48['model'],_0x42aa48[_0x0ca9('0x26')]);_0x46fe10[_0x0ca9('0x31')]=_[_0x0ca9('0x30')](_0x42aa48['model'],qs['fields'](_0x26b8c2[_0x0ca9('0x26')][_0x0ca9('0x32')]));_0x46fe10[_0x0ca9('0x31')]=_0x46fe10['attributes'][_0x0ca9('0x43')]?_0x46fe10['attributes']:_0x42aa48[_0x0ca9('0x2c')];if(!_0x26b8c2['query']['hasOwnProperty'](_0x0ca9('0x44'))){_0x46fe10['limit']=qs[_0x0ca9('0x11')](_0x26b8c2[_0x0ca9('0x26')]['limit']);_0x46fe10['offset']=qs[_0x0ca9('0x10')](_0x26b8c2[_0x0ca9('0x26')][_0x0ca9('0x10')]);}_0x46fe10[_0x0ca9('0x45')]=qs[_0x0ca9('0x46')](_0x26b8c2[_0x0ca9('0x26')][_0x0ca9('0x46')]);_0x46fe10[_0x0ca9('0x24')]=qs[_0x0ca9('0x2f')](_['pick'](_0x26b8c2[_0x0ca9('0x26')],_0x42aa48[_0x0ca9('0x2f')]));_0x46fe10['where']['WhatsappQueueId']=_0x3d1d2b['id'];if(_0x26b8c2[_0x0ca9('0x26')]['filter']){_0x46fe10[_0x0ca9('0x24')]=_[_0x0ca9('0x34')](_0x46fe10[_0x0ca9('0x24')],{'$or':_[_0x0ca9('0x47')](_0x46fe10[_0x0ca9('0x31')],function(_0x1a1a9c){var _0x2f9bc3={};_0x2f9bc3[_0x1a1a9c]={'$like':'%'+_0x26b8c2[_0x0ca9('0x26')][_0x0ca9('0x48')]+'%'};return _0x2f9bc3;})});}_0x46fe10=_['merge']({},_0x46fe10,_0x26b8c2[_0x0ca9('0x49')]);return db[_0x0ca9('0x42')][_0x0ca9('0x27')](_0x46fe10);}})['then'](function(_0x37a707){if(_0x37a707){return db[_0x0ca9('0x4a')][_0x0ca9('0x4b')]({'where':{'id':_[_0x0ca9('0x47')](_0x37a707,_0x0ca9('0x4c')),'role':'agent'},'attributes':['id',_0x0ca9('0x3e'),_0x0ca9('0x4d'),'updatedAt','createdAt']});}})[_0x0ca9('0x19')](function(_0x2c1b28){if(_0x2c1b28){return{'count':_0x2c1b28[_0x0ca9('0xf')],'rows':_['map'](_0x2c1b28[_0x0ca9('0x28')],function(_0x51da69){return{'membername':_0x51da69[_0x0ca9('0x3e')],'UserId':_0x51da69['id'],'queue_name':_0x4bdae0[_0x0ca9('0x3e')],'WhatsappQueueId':_0x4bdae0['id'],'interface':util[_0x0ca9('0x4e')](_0x0ca9('0x4f'),_0x0ca9('0x50'),_0x51da69['name']),'penalty':0x0,'paused':_0x51da69['whatsappPause'],'createdAt':_0x51da69['createdAt'],'updatedAt':_0x51da69[_0x0ca9('0x51')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x9561bc,_0x46fe10))['catch'](handleError(_0x9561bc,null));};exports[_0x0ca9('0x52')]=function(_0x17bb56,_0x2e0c4c){var _0x30a33f={};var _0x512097={};var _0x3b1f7a;var _0x5371ec;return db[_0x0ca9('0x1f')][_0x0ca9('0x41')]({'where':{'id':_0x17bb56['params']['id']}})[_0x0ca9('0x19')](handleEntityNotFound(_0x2e0c4c,null))[_0x0ca9('0x19')](function(_0x382740){if(_0x382740){_0x3b1f7a=_0x382740;_0x512097[_0x0ca9('0x2c')]=_[_0x0ca9('0x2e')](db['Team'][_0x0ca9('0x2d')]);_0x512097[_0x0ca9('0x26')]=_[_0x0ca9('0x2e')](_0x17bb56['query']);_0x512097[_0x0ca9('0x2f')]=_[_0x0ca9('0x30')](_0x512097[_0x0ca9('0x2c')],_0x512097[_0x0ca9('0x26')]);_0x30a33f[_0x0ca9('0x31')]=_[_0x0ca9('0x30')](_0x512097['model'],qs[_0x0ca9('0x32')](_0x17bb56['query'][_0x0ca9('0x32')]));_0x30a33f[_0x0ca9('0x31')]=_0x30a33f[_0x0ca9('0x31')][_0x0ca9('0x43')]?_0x30a33f[_0x0ca9('0x31')]:_0x512097[_0x0ca9('0x2c')];_0x30a33f[_0x0ca9('0x45')]=qs[_0x0ca9('0x46')](_0x17bb56[_0x0ca9('0x26')]['sort']);_0x30a33f[_0x0ca9('0x24')]=qs['filters'](_['pick'](_0x17bb56[_0x0ca9('0x26')],_0x512097[_0x0ca9('0x2f')]));if(_0x17bb56[_0x0ca9('0x26')]['filter']){_0x30a33f[_0x0ca9('0x24')]=_[_0x0ca9('0x34')](_0x30a33f[_0x0ca9('0x24')],{'$or':_[_0x0ca9('0x47')](_0x30a33f[_0x0ca9('0x31')],function(_0x5b9dcf){var _0x2eae1b={};_0x2eae1b[_0x5b9dcf]={'$like':'%'+_0x17bb56[_0x0ca9('0x26')]['filter']+'%'};return _0x2eae1b;})});}_0x30a33f=_[_0x0ca9('0x34')]({},_0x30a33f,_0x17bb56['options']);return _0x3b1f7a[_0x0ca9('0x52')](_0x30a33f);}})[_0x0ca9('0x19')](function(_0x198577){if(_0x198577){_0x5371ec=_0x198577['length'];if(!_0x17bb56[_0x0ca9('0x26')][_0x0ca9('0x53')](_0x0ca9('0x44'))){_0x30a33f[_0x0ca9('0x11')]=qs['limit'](_0x17bb56[_0x0ca9('0x26')][_0x0ca9('0x11')]);_0x30a33f['offset']=qs[_0x0ca9('0x10')](_0x17bb56[_0x0ca9('0x26')][_0x0ca9('0x10')]);}return _0x3b1f7a[_0x0ca9('0x52')](_0x30a33f);}})[_0x0ca9('0x19')](function(_0x3501c2){if(_0x3501c2){return _0x3501c2?{'count':_0x5371ec,'rows':_0x3501c2}:null;}})[_0x0ca9('0x19')](respondWithResult(_0x2e0c4c,null))['catch'](handleError(_0x2e0c4c,null));};exports[_0x0ca9('0x54')]=function(_0x5a6b2c,_0x303ac1){var _0x3d0576=_0x5a6b2c[_0x0ca9('0x37')][_0x0ca9('0x55')];return db[_0x0ca9('0x56')][_0x0ca9('0x27')]({'where':{'id':_0x3d0576},'attributes':['id'],'include':[{'model':db[_0x0ca9('0x4a')],'as':_0x0ca9('0x57'),'attributes':['id',_0x0ca9('0x3e'),'online',_0x0ca9('0x58'),_0x0ca9('0x59')],'raw':!![]}]})[_0x0ca9('0x19')](function(_0x4f434b){if(_0x4f434b){var _0x5fae47=_['flatMap'](_0x4f434b,function(_0x5e9abe){var _0xcb1142=_0x5e9abe[_0x0ca9('0x17')]({'plain':!![]});return _0xcb1142['Agents'];});return db[_0x0ca9('0x1f')][_0x0ca9('0x35')]({'where':{'id':_0x5a6b2c[_0x0ca9('0x2b')]['id']}})['then'](function(_0x17f0bc){return db['sequelize'][_0x0ca9('0x5a')](function(_0x438c67){return _0x17f0bc[_0x0ca9('0x54')](_0x3d0576,{'transaction':_0x438c67})[_0x0ca9('0x19')](function(){return BPromise[_0x0ca9('0x5b')](_0x5fae47,function(_0x522b28){return db[_0x0ca9('0x42')][_0x0ca9('0x5c')]({'where':{'UserId':_0x522b28['id'],'WhatsappQueueId':_0x5a6b2c[_0x0ca9('0x2b')]['id']},'transaction':_0x438c67});});})['then'](function(){_0x5fae47['forEach'](function(_0x316ff6){socket[_0x0ca9('0x5d')](_0x0ca9('0x5e'),{'UserId':_0x316ff6['id'],'WhatsappQueueId':_0x17f0bc['id']});});});});});}})[_0x0ca9('0x19')](respondWithStatusCode(_0x303ac1,null))[_0x0ca9('0x29')](handleError(_0x303ac1,null));};exports[_0x0ca9('0x5f')]=function(_0x281a72,_0x37864d){return db[_0x0ca9('0x56')][_0x0ca9('0x27')]({'where':{'id':_0x281a72[_0x0ca9('0x26')]['ids']},'attributes':['id'],'include':[{'model':db[_0x0ca9('0x4a')],'as':_0x0ca9('0x57'),'attributes':['id'],'raw':!![]}]})[_0x0ca9('0x19')](handleEntityNotFound(_0x37864d,null))['then'](function(_0x1035bb){var _0x257879=_[_0x0ca9('0x47')](_0x1035bb,'id');var _0xd19c54=[];var _0x1e811f=[];var _0x21a766=squel[_0x0ca9('0x60')]();_0x21a766[_0x0ca9('0x61')](_0x0ca9('0x62'))[_0x0ca9('0x63')]('team_has_whatsapp_queues','tq')[_0x0ca9('0x64')](_0x0ca9('0x65'),'ut',_0x0ca9('0x66'))[_0x0ca9('0x24')](_0x0ca9('0x67'),_0x281a72['params']['id']);for(var _0x410115=0x0;_0x410115<_0x1035bb['length'];_0x410115+=0x1){let _0x1b64a5=_0x1035bb[_0x410115];for(var _0x5f0b70=0x0;_0x5f0b70<_0x1b64a5[_0x0ca9('0x57')][_0x0ca9('0x43')];_0x5f0b70+=0x1){let _0x358d02=_0x1b64a5[_0x0ca9('0x57')][_0x5f0b70];var _0x13ccfb=_0x21a766[_0x0ca9('0x68')]();_0x13ccfb[_0x0ca9('0x24')](_0x0ca9('0x69'),_0x358d02['id']);_0x1e811f['push'](db[_0x0ca9('0x6a')][_0x0ca9('0x26')](_0x13ccfb[_0x0ca9('0x6b')](),{'type':db[_0x0ca9('0x6a')]['QueryTypes'][_0x0ca9('0x6c')]})[_0x0ca9('0x19')](function(_0x10dd0f){if(_0x10dd0f[_0x0ca9('0x43')]===0x1){return _0x358d02['id'];}else{var _0x629bd7=_[_0x0ca9('0x6d')](_['map'](_0x10dd0f,_0x0ca9('0x6e')),function(_0x325596){return _['includes'](_0x257879,_0x325596);});if(_0x629bd7){return _0x358d02['id'];}}}));}}return BPromise[_0x0ca9('0x6f')](_0x1e811f)['then'](function(_0x358b98){_0xd19c54=_(_0xd19c54)[_0x0ca9('0x70')](_0x358b98)['compact']()[_0x0ca9('0x71')]();return db[_0x0ca9('0x1f')]['find']({'where':{'id':_0x281a72[_0x0ca9('0x2b')]['id']}})['then'](function(_0x599bd5){return db[_0x0ca9('0x6a')][_0x0ca9('0x5a')](function(_0x489b7c){return _0x599bd5['removeTeams'](_0x281a72['query']['ids'],{'transaction':_0x489b7c})[_0x0ca9('0x19')](function(){if(!_['isEmpty'](_0xd19c54)){return _0x599bd5[_0x0ca9('0x72')](_0xd19c54,{'transaction':_0x489b7c});}})['then'](function(){_0xd19c54[_0x0ca9('0x73')](function(_0x1dfcef){socket[_0x0ca9('0x5d')](_0x0ca9('0x74'),{'UserId':_0x1dfcef,'WhatsappQueueId':_0x599bd5['id']});});});});});});})[_0x0ca9('0x19')](respondWithStatusCode(_0x37864d,null))[_0x0ca9('0x29')](handleError(_0x37864d,null));};exports[_0x0ca9('0x75')]=function(_0x30ddc2,_0x5d4ea8){return db['WhatsappQueue'][_0x0ca9('0x35')]({'where':{'id':_0x30ddc2[_0x0ca9('0x2b')]['id']}})[_0x0ca9('0x19')](handleEntityNotFound(_0x5d4ea8,null))[_0x0ca9('0x19')](function(_0x1f003e){if(_0x1f003e){return _0x1f003e[_0x0ca9('0x75')](_0x30ddc2[_0x0ca9('0x37')][_0x0ca9('0x55')],_['omit'](_0x30ddc2[_0x0ca9('0x37')],[_0x0ca9('0x55'),'id'])||{})[_0x0ca9('0x76')](function(_0x7a6573){for(var _0x583f4b=0x0;_0x583f4b<_0x30ddc2[_0x0ca9('0x37')][_0x0ca9('0x55')][_0x0ca9('0x43')];_0x583f4b+=0x1){socket[_0x0ca9('0x5d')](_0x0ca9('0x5e'),{'UserId':Number(_0x30ddc2[_0x0ca9('0x37')][_0x0ca9('0x55')][_0x583f4b]),'WhatsappQueueId':Number(_0x30ddc2[_0x0ca9('0x2b')]['id'])});}return _0x7a6573;});}})[_0x0ca9('0x19')](respondWithResult(_0x5d4ea8,null))[_0x0ca9('0x29')](handleError(_0x5d4ea8,null));};exports['removeAgents']=function(_0x11d78f,_0x224cfd){return db[_0x0ca9('0x1f')][_0x0ca9('0x35')]({'where':{'id':_0x11d78f['params']['id']}})[_0x0ca9('0x19')](handleEntityNotFound(_0x224cfd,null))[_0x0ca9('0x19')](function(_0x555a1d){if(_0x555a1d){return _0x555a1d[_0x0ca9('0x72')](_0x11d78f[_0x0ca9('0x26')][_0x0ca9('0x55')])['then'](function(){if(_[_0x0ca9('0x77')](_0x11d78f[_0x0ca9('0x26')][_0x0ca9('0x55')])){for(var _0x35a817=0x0;_0x35a817<_0x11d78f['query'][_0x0ca9('0x55')][_0x0ca9('0x43')];_0x35a817+=0x1){socket[_0x0ca9('0x5d')](_0x0ca9('0x74'),{'UserId':Number(_0x11d78f['query'][_0x0ca9('0x55')][_0x35a817]),'WhatsappQueueId':Number(_0x11d78f[_0x0ca9('0x2b')]['id'])});}}else{socket[_0x0ca9('0x5d')](_0x0ca9('0x74'),{'UserId':Number(_0x11d78f[_0x0ca9('0x26')][_0x0ca9('0x55')]),'WhatsappQueueId':Number(_0x11d78f[_0x0ca9('0x2b')]['id'])});}});}})['then'](respondWithStatusCode(_0x224cfd,null))['catch'](handleError(_0x224cfd,null));};exports[_0x0ca9('0x78')]=function(_0x504708,_0x43bc89){var _0x47f45a={};var _0x1e34f3={};var _0x35c561;var _0x236857;return db[_0x0ca9('0x1f')]['findOne']({'where':{'id':_0x504708[_0x0ca9('0x2b')]['id']}})['then'](handleEntityNotFound(_0x43bc89,null))[_0x0ca9('0x19')](function(_0x8c44b0){if(_0x8c44b0){_0x35c561=_0x8c44b0;_0x1e34f3['model']=_[_0x0ca9('0x2e')](db[_0x0ca9('0x4a')][_0x0ca9('0x2d')]);_0x1e34f3[_0x0ca9('0x26')]=_[_0x0ca9('0x2e')](_0x504708[_0x0ca9('0x26')]);_0x1e34f3['filters']=_[_0x0ca9('0x30')](_0x1e34f3[_0x0ca9('0x2c')],_0x1e34f3[_0x0ca9('0x26')]);_0x47f45a[_0x0ca9('0x31')]=_['intersection'](_0x1e34f3[_0x0ca9('0x2c')],qs['fields'](_0x504708['query'][_0x0ca9('0x32')]));_0x47f45a[_0x0ca9('0x31')]=_0x47f45a[_0x0ca9('0x31')]['length']?_0x47f45a[_0x0ca9('0x31')]:_0x1e34f3['model'];_0x47f45a[_0x0ca9('0x45')]=qs[_0x0ca9('0x46')](_0x504708['query'][_0x0ca9('0x46')]);_0x47f45a[_0x0ca9('0x24')]=qs[_0x0ca9('0x2f')](_[_0x0ca9('0x79')](_0x504708[_0x0ca9('0x26')],_0x1e34f3[_0x0ca9('0x2f')]));if(_0x504708[_0x0ca9('0x26')][_0x0ca9('0x48')]){_0x47f45a[_0x0ca9('0x24')]=_[_0x0ca9('0x34')](_0x47f45a['where'],{'$or':_['map'](_0x47f45a[_0x0ca9('0x31')],function(_0x4a5bff){var _0x194573={};_0x194573[_0x4a5bff]={'$like':'%'+_0x504708[_0x0ca9('0x26')][_0x0ca9('0x48')]+'%'};return _0x194573;})});}_0x47f45a=_[_0x0ca9('0x34')]({},_0x47f45a,_0x504708['options']);return _0x35c561[_0x0ca9('0x78')](_0x47f45a);}})[_0x0ca9('0x19')](function(_0xa38cef){if(_0xa38cef){_0x236857=_0xa38cef[_0x0ca9('0x43')];if(!_0x504708[_0x0ca9('0x26')][_0x0ca9('0x53')]('nolimit')){_0x47f45a[_0x0ca9('0x11')]=qs[_0x0ca9('0x11')](_0x504708[_0x0ca9('0x26')][_0x0ca9('0x11')]);_0x47f45a['offset']=qs['offset'](_0x504708['query'][_0x0ca9('0x10')]);}return _0x35c561[_0x0ca9('0x78')](_0x47f45a);}})[_0x0ca9('0x19')](function(_0x30a8b6){if(_0x30a8b6){return _0x30a8b6?{'count':_0x236857,'rows':_0x30a8b6}:null;}})[_0x0ca9('0x19')](respondWithResult(_0x43bc89,null))[_0x0ca9('0x29')](handleError(_0x43bc89,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 4c4c7a6..7637d46 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 _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 +var _0xcc8b=['../../mysqldb','WhatsappQueue','save','remove','emit','hook','exports','events'];(function(_0xee2616,_0x33d39b){var _0x50fed8=function(_0x5eb727){while(--_0x5eb727){_0xee2616['push'](_0xee2616['shift']());}};_0x50fed8(++_0x33d39b);}(_0xcc8b,0x1b7));var _0xbcc8=function(_0x43f566,_0x31b49c){_0x43f566=_0x43f566-0x0;var _0x2b7a90=_0xcc8b[_0x43f566];return _0x2b7a90;};'use strict';var EventEmitter=require(_0xbcc8('0x0'));var WhatsappQueue=require(_0xbcc8('0x1'))['db'][_0xbcc8('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbcc8('0x3'),'afterUpdate':'update','afterDestroy':_0xbcc8('0x4')};function emitEvent(_0x2d748e){return function(_0x538819,_0x466ba8,_0x189385){WhatsappQueueEvents[_0xbcc8('0x5')](_0x2d748e+':'+_0x538819['id'],_0x538819);WhatsappQueueEvents[_0xbcc8('0x5')](_0x2d748e,_0x538819);_0x189385(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0xbcc8('0x6')](e,emitEvent(event));}}module[_0xbcc8('0x7')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 1f13bfa..a0c80b3 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 _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 +var _0x9c20=['bluebird','path','rimraf','../../config/environment','exports','define','whatsapp_queues','api','moment'];(function(_0x1db112,_0x1d053e){var _0xc7d458=function(_0x28a6e9){while(--_0x28a6e9){_0x1db112['push'](_0x1db112['shift']());}};_0xc7d458(++_0x1d053e);}(_0x9c20,0x19c));var _0x09c2=function(_0x4baa7c,_0x336990){_0x4baa7c=_0x4baa7c-0x0;var _0x364957=_0x9c20[_0x4baa7c];return _0x364957;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x09c2('0x0'));var moment=require(_0x09c2('0x1'));var BPromise=require(_0x09c2('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x09c2('0x3'));var rimraf=require(_0x09c2('0x4'));var config=require(_0x09c2('0x5'));var attributes=require('./whatsappQueue.attributes');module[_0x09c2('0x6')]=function(_0x2b30ff,_0x22cf0b){return _0x2b30ff[_0x09c2('0x7')]('WhatsappQueue',attributes,{'tableName':_0x09c2('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index 2f1276d..696ef0c 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 _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 +var _0xbe95=['limit','include','model','map','ShowWhatsappQueue','find','where','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','localhost','./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','attributes'];(function(_0x5ba100,_0x282a18){var _0x3b050d=function(_0x2a1260){while(--_0x2a1260){_0x5ba100['push'](_0x5ba100['shift']());}};_0x3b050d(++_0x282a18);}(_0xbe95,0x1b4));var _0x5be9=function(_0x3e5019,_0x2c726e){_0x3e5019=_0x3e5019-0x0;var _0x1a83e5=_0xbe95[_0x3e5019];return _0x1a83e5;};'use strict';var _=require('lodash');var util=require(_0x5be9('0x0'));var moment=require(_0x5be9('0x1'));var BPromise=require(_0x5be9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5be9('0x3'));var db=require(_0x5be9('0x4'))['db'];var utils=require(_0x5be9('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x5be9('0x6'));var jayson=require(_0x5be9('0x7'));var client=jayson[_0x5be9('0x8')][_0x5be9('0x9')]({'port':0x232a});config[_0x5be9('0xa')]=_['defaults'](config[_0x5be9('0xa')],{'host':_0x5be9('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5be9('0xa')]));require(_0x5be9('0xc'))[_0x5be9('0xd')](socket);function respondWithRpcPromise(_0x3aa6cd,_0x5b02d6,_0x200a34){return new BPromise(function(_0x539c9f,_0x42cbcf){return client[_0x5be9('0xe')](_0x3aa6cd,_0x200a34)[_0x5be9('0xf')](function(_0x5c6d86){logger[_0x5be9('0x10')](_0x5be9('0x11'),_0x5b02d6,_0x5be9('0x12'));logger[_0x5be9('0x13')](_0x5be9('0x14'),_0x5b02d6,_0x5be9('0x12'),JSON[_0x5be9('0x15')](_0x5c6d86));if(_0x5c6d86[_0x5be9('0x16')]){if(_0x5c6d86['error'][_0x5be9('0x17')]===0x1f4){logger[_0x5be9('0x16')](_0x5be9('0x11'),_0x5b02d6,_0x5c6d86['error'][_0x5be9('0x18')]);return _0x42cbcf(_0x5c6d86[_0x5be9('0x16')][_0x5be9('0x18')]);}logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x5b02d6,_0x5c6d86[_0x5be9('0x16')][_0x5be9('0x18')]);return _0x539c9f(_0x5c6d86[_0x5be9('0x16')]['message']);}else{logger[_0x5be9('0x10')](_0x5be9('0x11'),_0x5b02d6,_0x5be9('0x12'));_0x539c9f(_0x5c6d86['result'][_0x5be9('0x18')]);}})[_0x5be9('0x19')](function(_0x37e476){logger['error'](_0x5be9('0x11'),_0x5b02d6,_0x37e476);_0x42cbcf(_0x37e476);});});}exports[_0x5be9('0x1a')]=function(_0x52f3bb){var _0x35ba03=this;return new Promise(function(_0xa97335,_0x802e84){return db[_0x5be9('0x1b')][_0x5be9('0x1c')]({'raw':_0x52f3bb[_0x5be9('0x1d')]?_0x52f3bb[_0x5be9('0x1d')][_0x5be9('0x1e')]===undefined?!![]:![]:!![],'where':_0x52f3bb[_0x5be9('0x1d')]?_0x52f3bb[_0x5be9('0x1d')]['where']||null:null,'attributes':_0x52f3bb[_0x5be9('0x1d')]?_0x52f3bb['options'][_0x5be9('0x1f')]||null:null,'limit':_0x52f3bb[_0x5be9('0x1d')]?_0x52f3bb[_0x5be9('0x1d')][_0x5be9('0x20')]||null:null,'include':_0x52f3bb[_0x5be9('0x1d')]?_0x52f3bb[_0x5be9('0x1d')][_0x5be9('0x21')]?_['map'](_0x52f3bb[_0x5be9('0x1d')]['include'],function(_0x34cd05){return{'model':db[_0x34cd05[_0x5be9('0x22')]],'as':_0x34cd05['as'],'attributes':_0x34cd05[_0x5be9('0x1f')],'include':_0x34cd05[_0x5be9('0x21')]?_['map'](_0x34cd05['include'],function(_0x12c035){return{'model':db[_0x12c035['model']],'as':_0x12c035['as'],'attributes':_0x12c035[_0x5be9('0x1f')],'include':_0x12c035[_0x5be9('0x21')]?_[_0x5be9('0x23')](_0x12c035[_0x5be9('0x21')],function(_0x17d813){return{'model':db[_0x17d813['model']],'as':_0x17d813['as'],'attributes':_0x17d813['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3786b9){logger[_0x5be9('0x10')](_0x5be9('0x1a'),_0x52f3bb);logger[_0x5be9('0x13')]('GetWhatsappQueue',_0x52f3bb,JSON['stringify'](_0x3786b9));_0xa97335(_0x3786b9);})[_0x5be9('0x19')](function(_0x2d9e1f){logger[_0x5be9('0x16')]('GetWhatsappQueue',_0x2d9e1f[_0x5be9('0x18')],_0x52f3bb);_0x802e84(_0x35ba03[_0x5be9('0x16')](0x1f4,_0x2d9e1f[_0x5be9('0x18')]));});});};exports[_0x5be9('0x24')]=function(_0x279136){var _0x128c6f=this;return new Promise(function(_0x40c75e,_0x4ef720){return db['WhatsappQueue'][_0x5be9('0x25')]({'raw':_0x279136[_0x5be9('0x1d')]?_0x279136['options'][_0x5be9('0x1e')]===undefined?!![]:![]:!![],'where':_0x279136[_0x5be9('0x1d')]?_0x279136[_0x5be9('0x1d')][_0x5be9('0x26')]||null:null,'attributes':_0x279136[_0x5be9('0x1d')]?_0x279136['options']['attributes']||null:null,'include':_0x279136['options']?_0x279136[_0x5be9('0x1d')]['include']?_[_0x5be9('0x23')](_0x279136[_0x5be9('0x1d')][_0x5be9('0x21')],function(_0x5f210e){return{'model':db[_0x5f210e[_0x5be9('0x22')]],'as':_0x5f210e['as'],'attributes':_0x5f210e[_0x5be9('0x1f')],'include':_0x5f210e[_0x5be9('0x21')]?_[_0x5be9('0x23')](_0x5f210e[_0x5be9('0x21')],function(_0x4eb657){return{'model':db[_0x4eb657['model']],'as':_0x4eb657['as'],'attributes':_0x4eb657['attributes'],'include':_0x4eb657[_0x5be9('0x21')]?_[_0x5be9('0x23')](_0x4eb657[_0x5be9('0x21')],function(_0x3c32d2){return{'model':db[_0x3c32d2[_0x5be9('0x22')]],'as':_0x3c32d2['as'],'attributes':_0x3c32d2['attributes']};}):[]};}):[]};}):[]:[]})[_0x5be9('0xf')](function(_0x5b9de2){logger[_0x5be9('0x10')](_0x5be9('0x24'),_0x279136);logger['debug'](_0x5be9('0x24'),_0x279136,JSON['stringify'](_0x5b9de2));_0x40c75e(_0x5b9de2);})['catch'](function(_0x5b760f){logger[_0x5be9('0x16')](_0x5be9('0x24'),_0x5b760f[_0x5be9('0x18')],_0x279136);_0x4ef720(_0x128c6f[_0x5be9('0x16')](0x1f4,_0x5b760f['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index ff7898d..ce72e32 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 _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 +var _0x8bb6=['whatsappQueue:','save','update','emit','register'];(function(_0x4262c2,_0x2941d0){var _0x5d98ea=function(_0x4cd222){while(--_0x4cd222){_0x4262c2['push'](_0x4262c2['shift']());}};_0x5d98ea(++_0x2941d0);}(_0x8bb6,0x141));var _0x68bb=function(_0x9acbfe,_0x8a60ed){_0x9acbfe=_0x9acbfe-0x0;var _0x136eba=_0x8bb6[_0x9acbfe];return _0x136eba;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x68bb('0x0'),'remove',_0x68bb('0x1')];function createListener(_0x36facd,_0x30c935){return function(_0x3cea2d){_0x30c935[_0x68bb('0x2')](_0x36facd,_0x3cea2d);};}function removeListener(_0x1d51e8,_0x574a57){return function(){WhatsappQueueEvents['removeListener'](_0x1d51e8,_0x574a57);};}exports[_0x68bb('0x3')]=function(_0x49812f){for(var _0x336b2c=0x0,_0x16e503=events['length'];_0x336b2c<_0x16e503;_0x336b2c++){var _0x5c3b3e=events[_0x336b2c];var _0x42487a=createListener(_0x68bb('0x4')+_0x5c3b3e,_0x49812f);WhatsappQueueEvents['on'](_0x5c3b3e,_0x42487a);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 46ec1cc..fddbc24 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 _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 +var _0x3a50=['exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','destroy'];(function(_0xb72cc8,_0x3b7aa3){var _0x75cfb3=function(_0x51217a){while(--_0x51217a){_0xb72cc8['push'](_0xb72cc8['shift']());}};_0x75cfb3(++_0x3b7aa3);}(_0x3a50,0x1b6));var _0x03a5=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x3a50[_0x46e363];return _0x3fb059;};'use strict';var multer=require('multer');var util=require(_0x03a5('0x0'));var path=require(_0x03a5('0x1'));var timeout=require(_0x03a5('0x2'));var express=require(_0x03a5('0x3'));var router=express['Router']();var fs_extra=require(_0x03a5('0x4'));var auth=require(_0x03a5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x03a5('0x6'));var controller=require(_0x03a5('0x7'));router[_0x03a5('0x8')]('/',auth[_0x03a5('0x9')](),controller[_0x03a5('0xa')]);router[_0x03a5('0x8')](_0x03a5('0xb'),auth[_0x03a5('0x9')](),controller[_0x03a5('0xc')]);router[_0x03a5('0x8')](_0x03a5('0xd'),auth['isAuthenticated'](),controller[_0x03a5('0xe')]);router[_0x03a5('0xf')]('/',auth[_0x03a5('0x9')](),controller['create']);router[_0x03a5('0x10')](_0x03a5('0xd'),auth[_0x03a5('0x9')](),controller['update']);router['delete'](_0x03a5('0xd'),auth['isAuthenticated'](),controller[_0x03a5('0x11')]);module[_0x03a5('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 9cda4c2..bb5ba02 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','STRING','DATE','sequelize'];(function(_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 +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x430483,_0x403724){var _0x240456=function(_0xc8508c){while(--_0xc8508c){_0x430483['push'](_0x430483['shift']());}};_0x240456(++_0x403724);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index f05c2ee..6baa77f 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 _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 +var _0x4b17=['save','update','then','destroy','end','error','stack','name','send','index','map','WhatsappQueueReport','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','include','findAll','rows','show','params','rawAttributes','options','find','catch','create','body','describe','eml-format','zip-dir','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','limit','undefined','count','status','set','Content-Range','apply'];(function(_0x1cccad,_0x126651){var _0x172089=function(_0x38731f){while(--_0x38731f){_0x1cccad['push'](_0x1cccad['shift']());}};_0x172089(++_0x126651);}(_0x4b17,0x10f));var _0x74b1=function(_0x3ff4a3,_0xa5bfa6){_0x3ff4a3=_0x3ff4a3-0x0;var _0x38676f=_0x4b17[_0x3ff4a3];return _0x38676f;};'use strict';var emlformat=require(_0x74b1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x74b1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x74b1('0x2'));var moment=require(_0x74b1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x74b1('0x4'));var util=require('util');var path=require('path');var sox=require(_0x74b1('0x5'));var csv=require(_0x74b1('0x6'));var ejs=require(_0x74b1('0x7'));var fs=require('fs');var fs_extra=require(_0x74b1('0x8'));var _=require(_0x74b1('0x9'));var squel=require(_0x74b1('0xa'));var crypto=require(_0x74b1('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x74b1('0xc'));var toCsv=require(_0x74b1('0x6'));var querystring=require(_0x74b1('0xd'));var Papa=require(_0x74b1('0xe'));var Redis=require(_0x74b1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x74b1('0x10'));var as=require(_0x74b1('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x74b1('0x12'))(_0x74b1('0x13'));var utils=require(_0x74b1('0x14'));var config=require(_0x74b1('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x74b1('0x16'))['db'];function respondWithStatusCode(_0x5cfe85,_0x5f2865){_0x5f2865=_0x5f2865||0xcc;return function(_0x239d04){if(_0x239d04){return _0x5cfe85[_0x74b1('0x17')](_0x5f2865);}return _0x5cfe85['status'](_0x5f2865)['end']();};}function respondWithResult(_0x500ce2,_0x86390){_0x86390=_0x86390||0xc8;return function(_0x5c12eb){if(_0x5c12eb){return _0x500ce2['status'](_0x86390)[_0x74b1('0x18')](_0x5c12eb);}};}function respondWithFilteredResult(_0x12a2c0,_0x3779c5){return function(_0x420662){if(_0x420662){var _0x16b147=typeof _0x3779c5[_0x74b1('0x19')]==='undefined'&&typeof _0x3779c5[_0x74b1('0x1a')]===_0x74b1('0x1b');var _0x1a0851=_0x420662[_0x74b1('0x1c')];var _0xde2736=_0x16b147?0x0:_0x3779c5[_0x74b1('0x19')];var _0x1ab838=_0x16b147?_0x420662['count']:_0x3779c5[_0x74b1('0x19')]+_0x3779c5[_0x74b1('0x1a')];var _0x524ece;if(_0x1ab838>=_0x1a0851){_0x1ab838=_0x1a0851;_0x524ece=0xc8;}else{_0x524ece=0xce;}_0x12a2c0[_0x74b1('0x1d')](_0x524ece);return _0x12a2c0[_0x74b1('0x1e')](_0x74b1('0x1f'),_0xde2736+'-'+_0x1ab838+'/'+_0x1a0851)[_0x74b1('0x18')](_0x420662);}return null;};}function patchUpdates(_0x13bb44){return function(_0x33fee9){try{jsonpatch[_0x74b1('0x20')](_0x33fee9,_0x13bb44,!![]);}catch(_0xaac5f7){return BPromise['reject'](_0xaac5f7);}return _0x33fee9[_0x74b1('0x21')]();};}function saveUpdates(_0x4f1ec9,_0x5da0f7){return function(_0x481bf2){if(_0x481bf2){return _0x481bf2[_0x74b1('0x22')](_0x4f1ec9)[_0x74b1('0x23')](function(_0x405a22){return _0x405a22;});}return null;};}function removeEntity(_0x44bf7e,_0x563781){return function(_0x4ee88b){if(_0x4ee88b){return _0x4ee88b[_0x74b1('0x24')]()['then'](function(){_0x44bf7e[_0x74b1('0x1d')](0xcc)[_0x74b1('0x25')]();});}};}function handleEntityNotFound(_0xb5af0,_0x14a651){return function(_0x3239d8){if(!_0x3239d8){_0xb5af0[_0x74b1('0x17')](0x194);}return _0x3239d8;};}function handleError(_0x115918,_0x33fa8e){_0x33fa8e=_0x33fa8e||0x1f4;return function(_0x4c7f05){logger[_0x74b1('0x26')](_0x4c7f05[_0x74b1('0x27')]);if(_0x4c7f05[_0x74b1('0x28')]){delete _0x4c7f05['name'];}_0x115918[_0x74b1('0x1d')](_0x33fa8e)[_0x74b1('0x29')](_0x4c7f05);};}exports[_0x74b1('0x2a')]=function(_0x1b011a,_0x26d9f1){var _0x273ff1={},_0x436eda={},_0x3ce043={'count':0x0,'rows':[]};var _0x4fbe3d=_[_0x74b1('0x2b')](db[_0x74b1('0x2c')]['rawAttributes'],function(_0x543b5){return{'name':_0x543b5[_0x74b1('0x2d')],'type':_0x543b5[_0x74b1('0x2e')]['key']};});_0x436eda[_0x74b1('0x2f')]=_[_0x74b1('0x2b')](_0x4fbe3d,'name');_0x436eda[_0x74b1('0x30')]=_[_0x74b1('0x31')](_0x1b011a[_0x74b1('0x30')]);_0x436eda[_0x74b1('0x32')]=_[_0x74b1('0x33')](_0x436eda[_0x74b1('0x2f')],_0x436eda[_0x74b1('0x30')]);_0x273ff1[_0x74b1('0x34')]=_['intersection'](_0x436eda[_0x74b1('0x2f')],qs['fields'](_0x1b011a['query'][_0x74b1('0x35')]));_0x273ff1['attributes']=_0x273ff1['attributes'][_0x74b1('0x36')]?_0x273ff1[_0x74b1('0x34')]:_0x436eda[_0x74b1('0x2f')];if(!_0x1b011a[_0x74b1('0x30')][_0x74b1('0x37')](_0x74b1('0x38'))){_0x273ff1[_0x74b1('0x1a')]=qs[_0x74b1('0x1a')](_0x1b011a['query']['limit']);_0x273ff1['offset']=qs[_0x74b1('0x19')](_0x1b011a['query']['offset']);}_0x273ff1[_0x74b1('0x39')]=qs[_0x74b1('0x3a')](_0x1b011a[_0x74b1('0x30')]['sort']);_0x273ff1[_0x74b1('0x3b')]=qs['filters'](_[_0x74b1('0x3c')](_0x1b011a[_0x74b1('0x30')],_0x436eda['filters']),_0x4fbe3d);if(_0x1b011a['query'][_0x74b1('0x3d')]){_0x273ff1[_0x74b1('0x3b')]=_['merge'](_0x273ff1['where'],{'$or':_[_0x74b1('0x2b')](_0x4fbe3d,function(_0x5298f6){if(_0x5298f6[_0x74b1('0x2e')]!==_0x74b1('0x3e')){var _0x15e695={};_0x15e695[_0x5298f6[_0x74b1('0x28')]]={'$like':'%'+_0x1b011a[_0x74b1('0x30')]['filter']+'%'};return _0x15e695;}})});}_0x273ff1=_[_0x74b1('0x3f')]({},_0x273ff1,_0x1b011a['options']);var _0x41a78b={'where':_0x273ff1['where']};return db[_0x74b1('0x2c')]['count'](_0x41a78b)['then'](function(_0xcdb873){_0x3ce043[_0x74b1('0x1c')]=_0xcdb873;if(_0x1b011a[_0x74b1('0x30')]['includeAll']){_0x273ff1[_0x74b1('0x40')]=[{'all':!![]}];}return db[_0x74b1('0x2c')][_0x74b1('0x41')](_0x273ff1);})['then'](function(_0xfecdc){_0x3ce043[_0x74b1('0x42')]=_0xfecdc;return _0x3ce043;})['then'](respondWithFilteredResult(_0x26d9f1,_0x273ff1))['catch'](handleError(_0x26d9f1,null));};exports[_0x74b1('0x43')]=function(_0x2dcaf6,_0x416c8d){var _0x444870={'raw':!![],'where':{'id':_0x2dcaf6[_0x74b1('0x44')]['id']}},_0x1d9f5b={};_0x1d9f5b[_0x74b1('0x2f')]=_['keys'](db[_0x74b1('0x2c')][_0x74b1('0x45')]);_0x1d9f5b[_0x74b1('0x30')]=_[_0x74b1('0x31')](_0x2dcaf6[_0x74b1('0x30')]);_0x1d9f5b['filters']=_[_0x74b1('0x33')](_0x1d9f5b[_0x74b1('0x2f')],_0x1d9f5b['query']);_0x444870['attributes']=_[_0x74b1('0x33')](_0x1d9f5b[_0x74b1('0x2f')],qs['fields'](_0x2dcaf6[_0x74b1('0x30')][_0x74b1('0x35')]));_0x444870[_0x74b1('0x34')]=_0x444870[_0x74b1('0x34')][_0x74b1('0x36')]?_0x444870[_0x74b1('0x34')]:_0x1d9f5b[_0x74b1('0x2f')];if(_0x2dcaf6['query']['includeAll']){_0x444870['include']=[{'all':!![]}];}_0x444870=_[_0x74b1('0x3f')]({},_0x444870,_0x2dcaf6[_0x74b1('0x46')]);return db[_0x74b1('0x2c')][_0x74b1('0x47')](_0x444870)[_0x74b1('0x23')](handleEntityNotFound(_0x416c8d,null))['then'](respondWithResult(_0x416c8d,null))[_0x74b1('0x48')](handleError(_0x416c8d,null));};exports[_0x74b1('0x49')]=function(_0x18687c,_0x33c215){return db[_0x74b1('0x2c')][_0x74b1('0x49')](_0x18687c[_0x74b1('0x4a')],{})[_0x74b1('0x23')](respondWithResult(_0x33c215,0xc9))[_0x74b1('0x48')](handleError(_0x33c215,null));};exports[_0x74b1('0x22')]=function(_0x186516,_0x3038f9){if(_0x186516['body']['id']){delete _0x186516[_0x74b1('0x4a')]['id'];}return db[_0x74b1('0x2c')]['find']({'where':{'id':_0x186516[_0x74b1('0x44')]['id']}})['then'](handleEntityNotFound(_0x3038f9,null))[_0x74b1('0x23')](saveUpdates(_0x186516[_0x74b1('0x4a')],null))['then'](respondWithResult(_0x3038f9,null))[_0x74b1('0x48')](handleError(_0x3038f9,null));};exports[_0x74b1('0x24')]=function(_0x326b98,_0x549f03){return db[_0x74b1('0x2c')][_0x74b1('0x47')]({'where':{'id':_0x326b98[_0x74b1('0x44')]['id']}})[_0x74b1('0x23')](handleEntityNotFound(_0x549f03,null))[_0x74b1('0x23')](removeEntity(_0x549f03,null))['catch'](handleError(_0x549f03,null));};exports[_0x74b1('0x4b')]=function(_0x594411,_0x11bfca){return db[_0x74b1('0x2c')]['describe']()[_0x74b1('0x23')](respondWithResult(_0x11bfca,null))[_0x74b1('0x48')](handleError(_0x11bfca,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index c1f9f4f..40e4f52 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 _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 +var _0xc865=['bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','util','../../config/logger','api','moment'];(function(_0x3a4326,_0x10d7fe){var _0x4bed24=function(_0x137993){while(--_0x137993){_0x3a4326['push'](_0x3a4326['shift']());}};_0x4bed24(++_0x10d7fe);}(_0xc865,0x104));var _0x5c86=function(_0x5d1160,_0x47dade){_0x5d1160=_0x5d1160-0x0;var _0x3ce7d3=_0xc865[_0x5d1160];return _0x3ce7d3;};'use strict';var _=require('lodash');var util=require(_0x5c86('0x0'));var logger=require(_0x5c86('0x1'))(_0x5c86('0x2'));var moment=require(_0x5c86('0x3'));var BPromise=require(_0x5c86('0x4'));var rp=require(_0x5c86('0x5'));var fs=require('fs');var path=require(_0x5c86('0x6'));var rimraf=require(_0x5c86('0x7'));var config=require(_0x5c86('0x8'));var attributes=require(_0x5c86('0x9'));module[_0x5c86('0xa')]=function(_0x1962ba,_0x283899){return _0x1962ba[_0x5c86('0xb')]('WhatsappQueueReport',attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index f1b697f..7af8423 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 _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 +var _0xb5a3=['message','CreateWhatsappQueueReport','WhatsappQueueReport','create','options','raw','then','catch','update','where','attributes','UpdateWhatsappQueueReport','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','info','WhatsappQueueReport,\x20%s,\x20%s','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x2c825a,_0x3eabac){var _0x418b31=function(_0x29035e){while(--_0x29035e){_0x2c825a['push'](_0x2c825a['shift']());}};_0x418b31(++_0x3eabac);}(_0xb5a3,0x111));var _0x3b5a=function(_0x3cec8c,_0x3f6c1d){_0x3cec8c=_0x3cec8c-0x0;var _0x38032e=_0xb5a3[_0x3cec8c];return _0x38032e;};'use strict';var _=require('lodash');var util=require(_0x3b5a('0x0'));var moment=require('moment');var BPromise=require(_0x3b5a('0x1'));var rs=require(_0x3b5a('0x2'));var fs=require('fs');var Redis=require(_0x3b5a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3b5a('0x4'));var logger=require(_0x3b5a('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3b5a('0x6'));var client=jayson[_0x3b5a('0x7')][_0x3b5a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2240dd,_0x237180,_0x7ae494){return new BPromise(function(_0x3a4dd8,_0x4a595f){return client['request'](_0x2240dd,_0x7ae494)['then'](function(_0x1856f5){logger[_0x3b5a('0x9')](_0x3b5a('0xa'),_0x237180,'request\x20sent');logger[_0x3b5a('0xb')](_0x3b5a('0xc'),_0x237180,_0x3b5a('0xd'),JSON[_0x3b5a('0xe')](_0x1856f5));if(_0x1856f5['error']){if(_0x1856f5[_0x3b5a('0xf')][_0x3b5a('0x10')]===0x1f4){logger['error'](_0x3b5a('0xa'),_0x237180,_0x1856f5['error'][_0x3b5a('0x11')]);return _0x4a595f(_0x1856f5['error']['message']);}logger[_0x3b5a('0xf')](_0x3b5a('0xa'),_0x237180,_0x1856f5[_0x3b5a('0xf')][_0x3b5a('0x11')]);return _0x3a4dd8(_0x1856f5[_0x3b5a('0xf')]['message']);}else{logger[_0x3b5a('0x9')](_0x3b5a('0xa'),_0x237180,_0x3b5a('0xd'));_0x3a4dd8(_0x1856f5['result'][_0x3b5a('0x11')]);}})['catch'](function(_0x39dc3b){logger[_0x3b5a('0xf')]('WhatsappQueueReport,\x20%s,\x20%s',_0x237180,_0x39dc3b);_0x4a595f(_0x39dc3b);});});}exports[_0x3b5a('0x12')]=function(_0x45799c){var _0x11ffb5=this;return new Promise(function(_0xde6386,_0x4f0015){return db[_0x3b5a('0x13')][_0x3b5a('0x14')](_0x45799c['body'],{'raw':_0x45799c[_0x3b5a('0x15')]?_0x45799c[_0x3b5a('0x15')][_0x3b5a('0x16')]===undefined?!![]:![]:!![]})[_0x3b5a('0x17')](function(_0x1bd7b2){logger['info'](_0x3b5a('0x12'),_0x45799c);logger[_0x3b5a('0xb')](_0x3b5a('0x12'),_0x45799c,JSON[_0x3b5a('0xe')](_0x1bd7b2));_0xde6386(_0x1bd7b2);})[_0x3b5a('0x18')](function(_0x20ef4c){logger['error']('CreateWhatsappQueueReport',_0x20ef4c['message'],_0x45799c);_0x4f0015(_0x11ffb5[_0x3b5a('0xf')](0x1f4,_0x20ef4c['message']));});});};exports['UpdateWhatsappQueueReport']=function(_0x339a03){var _0x12b3c9=this;return new Promise(function(_0x1279ec,_0x167274){return db[_0x3b5a('0x13')][_0x3b5a('0x19')](_0x339a03['body'],{'raw':_0x339a03[_0x3b5a('0x15')]?_0x339a03['options'][_0x3b5a('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x339a03[_0x3b5a('0x15')]?_0x339a03[_0x3b5a('0x15')][_0x3b5a('0x1a')]||null:null,'attributes':_0x339a03[_0x3b5a('0x15')]?_0x339a03[_0x3b5a('0x15')][_0x3b5a('0x1b')]||null:null,'limit':_0x339a03[_0x3b5a('0x15')]?_0x339a03[_0x3b5a('0x15')]['limit']||null:null})[_0x3b5a('0x17')](function(_0x945aed){logger[_0x3b5a('0x9')](_0x3b5a('0x1c'),_0x339a03);logger['debug'](_0x3b5a('0x1c'),_0x339a03,JSON[_0x3b5a('0xe')](_0x945aed));_0x1279ec(_0x945aed);})[_0x3b5a('0x18')](function(_0x1a25db){logger['error'](_0x3b5a('0x1c'),_0x1a25db[_0x3b5a('0x11')],_0x339a03);_0x167274(_0x12b3c9['error'](0x1f4,_0x1a25db['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 8cb7c32..c5e5583 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 _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 +var _0x5e81=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','describe','post','create','put','/:id','delete','destroy','exports','multer'];(function(_0x1bd85d,_0xdc683f){var _0xd40669=function(_0x318648){while(--_0x318648){_0x1bd85d['push'](_0x1bd85d['shift']());}};_0xd40669(++_0xdc683f);}(_0x5e81,0x68));var _0x15e8=function(_0x50be8d,_0x34275b){_0x50be8d=_0x50be8d-0x0;var _0x5e6cce=_0x5e81[_0x50be8d];return _0x5e6cce;};'use strict';var multer=require(_0x15e8('0x0'));var util=require('util');var path=require(_0x15e8('0x1'));var timeout=require(_0x15e8('0x2'));var express=require(_0x15e8('0x3'));var router=express[_0x15e8('0x4')]();var fs_extra=require(_0x15e8('0x5'));var auth=require(_0x15e8('0x6'));var interaction=require(_0x15e8('0x7'));var config=require(_0x15e8('0x8'));var controller=require(_0x15e8('0x9'));router[_0x15e8('0xa')]('/',auth[_0x15e8('0xb')](),controller[_0x15e8('0xc')]);router[_0x15e8('0xa')]('/describe',auth[_0x15e8('0xb')](),controller[_0x15e8('0xd')]);router[_0x15e8('0xa')]('/:id',auth[_0x15e8('0xb')](),controller['show']);router[_0x15e8('0xe')]('/',auth[_0x15e8('0xb')](),controller[_0x15e8('0xf')]);router[_0x15e8('0x10')](_0x15e8('0x11'),auth[_0x15e8('0xb')](),controller['update']);router[_0x15e8('0x12')](_0x15e8('0x11'),auth[_0x15e8('0xb')](),controller[_0x15e8('0x13')]);module[_0x15e8('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 6843df7..de94689 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 _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 +var _0x8caf=['queue','exports','STRING','ENUM','account','agent'];(function(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0x8caf,0x1ab));var _0xf8ca=function(_0x3f22e8,_0x37732a){_0x3f22e8=_0x3f22e8-0x0;var _0x368a7e=_0x8caf[_0x3f22e8];return _0x368a7e;};'use strict';var Sequelize=require('sequelize');module[_0xf8ca('0x0')]={'uniqueid':{'type':Sequelize[_0xf8ca('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xf8ca('0x2')](_0xf8ca('0x3'),_0xf8ca('0x4'),_0xf8ca('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 29626bf..0215e4c 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 _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 +var _0x58a0=['error','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','intersection','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','save','update','then','destroy'];(function(_0x4429e0,_0xee6f1f){var _0x51a5b3=function(_0x16eb11){while(--_0x16eb11){_0x4429e0['push'](_0x4429e0['shift']());}};_0x51a5b3(++_0xee6f1f);}(_0x58a0,0x6e));var _0x058a=function(_0x311f44,_0x1d7f5b){_0x311f44=_0x311f44-0x0;var _0x46f1e6=_0x58a0[_0x311f44];return _0x46f1e6;};'use strict';var emlformat=require(_0x058a('0x0'));var rimraf=require(_0x058a('0x1'));var zipdir=require(_0x058a('0x2'));var jsonpatch=require(_0x058a('0x3'));var rp=require(_0x058a('0x4'));var moment=require('moment');var BPromise=require(_0x058a('0x5'));var Mustache=require(_0x058a('0x6'));var util=require(_0x058a('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x058a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x058a('0x9'));var _=require(_0x058a('0xa'));var squel=require(_0x058a('0xb'));var crypto=require(_0x058a('0xc'));var jsforce=require(_0x058a('0xd'));var deskjs=require(_0x058a('0xe'));var toCsv=require(_0x058a('0x8'));var querystring=require(_0x058a('0xf'));var Papa=require(_0x058a('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x058a('0x11'));var hardwareService=require(_0x058a('0x12'));var logger=require(_0x058a('0x13'))(_0x058a('0x14'));var utils=require('../../config/utils');var config=require(_0x058a('0x15'));var licenseUtil=require(_0x058a('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x34edd6,_0x46a487){_0x46a487=_0x46a487||0xcc;return function(_0x5cc8a0){if(_0x5cc8a0){return _0x34edd6[_0x058a('0x17')](_0x46a487);}return _0x34edd6[_0x058a('0x18')](_0x46a487)[_0x058a('0x19')]();};}function respondWithResult(_0xb6215c,_0xfd42e8){_0xfd42e8=_0xfd42e8||0xc8;return function(_0x2de1a2){if(_0x2de1a2){return _0xb6215c[_0x058a('0x18')](_0xfd42e8)[_0x058a('0x1a')](_0x2de1a2);}};}function respondWithFilteredResult(_0x1dba4a,_0x87496b){return function(_0x188297){if(_0x188297){var _0x4e55b2=typeof _0x87496b['offset']==='undefined'&&typeof _0x87496b[_0x058a('0x1b')]===_0x058a('0x1c');var _0x4bc640=_0x188297[_0x058a('0x1d')];var _0x525eb9=_0x4e55b2?0x0:_0x87496b[_0x058a('0x1e')];var _0x4f454a=_0x4e55b2?_0x188297['count']:_0x87496b[_0x058a('0x1e')]+_0x87496b['limit'];var _0x2e5952;if(_0x4f454a>=_0x4bc640){_0x4f454a=_0x4bc640;_0x2e5952=0xc8;}else{_0x2e5952=0xce;}_0x1dba4a[_0x058a('0x18')](_0x2e5952);return _0x1dba4a[_0x058a('0x1f')](_0x058a('0x20'),_0x525eb9+'-'+_0x4f454a+'/'+_0x4bc640)[_0x058a('0x1a')](_0x188297);}return null;};}function patchUpdates(_0x2cd03a){return function(_0x29cf8f){try{jsonpatch[_0x058a('0x21')](_0x29cf8f,_0x2cd03a,!![]);}catch(_0x13a517){return BPromise['reject'](_0x13a517);}return _0x29cf8f[_0x058a('0x22')]();};}function saveUpdates(_0x5e0854,_0x23553e){return function(_0x21d868){if(_0x21d868){return _0x21d868[_0x058a('0x23')](_0x5e0854)[_0x058a('0x24')](function(_0x5ed693){return _0x5ed693;});}return null;};}function removeEntity(_0x48d419,_0x339f69){return function(_0x555c2c){if(_0x555c2c){return _0x555c2c[_0x058a('0x25')]()[_0x058a('0x24')](function(){_0x48d419[_0x058a('0x18')](0xcc)[_0x058a('0x19')]();});}};}function handleEntityNotFound(_0x200165,_0x252a69){return function(_0x4d7feb){if(!_0x4d7feb){_0x200165['sendStatus'](0x194);}return _0x4d7feb;};}function handleError(_0x4b8dae,_0x255997){_0x255997=_0x255997||0x1f4;return function(_0x5b760a){logger[_0x058a('0x26')](_0x5b760a['stack']);if(_0x5b760a[_0x058a('0x27')]){delete _0x5b760a['name'];}_0x4b8dae[_0x058a('0x18')](_0x255997)[_0x058a('0x28')](_0x5b760a);};}exports[_0x058a('0x29')]=function(_0x1f57c8,_0x23233f){var _0xe229ec={},_0x50c2ef={},_0x15036b={'count':0x0,'rows':[]};var _0x45bcc9=_[_0x058a('0x2a')](db[_0x058a('0x2b')][_0x058a('0x2c')],function(_0xdcc042){return{'name':_0xdcc042[_0x058a('0x2d')],'type':_0xdcc042[_0x058a('0x2e')][_0x058a('0x2f')]};});_0x50c2ef[_0x058a('0x30')]=_[_0x058a('0x2a')](_0x45bcc9,'name');_0x50c2ef[_0x058a('0x31')]=_[_0x058a('0x32')](_0x1f57c8[_0x058a('0x31')]);_0x50c2ef[_0x058a('0x33')]=_['intersection'](_0x50c2ef['model'],_0x50c2ef['query']);_0xe229ec['attributes']=_['intersection'](_0x50c2ef['model'],qs[_0x058a('0x34')](_0x1f57c8[_0x058a('0x31')][_0x058a('0x34')]));_0xe229ec[_0x058a('0x35')]=_0xe229ec['attributes'][_0x058a('0x36')]?_0xe229ec[_0x058a('0x35')]:_0x50c2ef[_0x058a('0x30')];if(!_0x1f57c8[_0x058a('0x31')][_0x058a('0x37')](_0x058a('0x38'))){_0xe229ec[_0x058a('0x1b')]=qs['limit'](_0x1f57c8[_0x058a('0x31')][_0x058a('0x1b')]);_0xe229ec[_0x058a('0x1e')]=qs[_0x058a('0x1e')](_0x1f57c8[_0x058a('0x31')]['offset']);}_0xe229ec[_0x058a('0x39')]=qs['sort'](_0x1f57c8[_0x058a('0x31')]['sort']);_0xe229ec[_0x058a('0x3a')]=qs['filters'](_[_0x058a('0x3b')](_0x1f57c8['query'],_0x50c2ef[_0x058a('0x33')]),_0x45bcc9);if(_0x1f57c8[_0x058a('0x31')]['filter']){_0xe229ec['where']=_[_0x058a('0x3c')](_0xe229ec[_0x058a('0x3a')],{'$or':_['map'](_0x45bcc9,function(_0x55aac7){if(_0x55aac7[_0x058a('0x2e')]!==_0x058a('0x3d')){var _0x3b54c4={};_0x3b54c4[_0x55aac7[_0x058a('0x27')]]={'$like':'%'+_0x1f57c8['query'][_0x058a('0x3e')]+'%'};return _0x3b54c4;}})});}_0xe229ec=_[_0x058a('0x3c')]({},_0xe229ec,_0x1f57c8[_0x058a('0x3f')]);var _0x105106={'where':_0xe229ec[_0x058a('0x3a')]};return db['WhatsappTransferReport'][_0x058a('0x1d')](_0x105106)[_0x058a('0x24')](function(_0x2199e3){_0x15036b[_0x058a('0x1d')]=_0x2199e3;if(_0x1f57c8[_0x058a('0x31')][_0x058a('0x40')]){_0xe229ec[_0x058a('0x41')]=[{'all':!![]}];}return db[_0x058a('0x2b')][_0x058a('0x42')](_0xe229ec);})[_0x058a('0x24')](function(_0x249708){_0x15036b[_0x058a('0x43')]=_0x249708;return _0x15036b;})['then'](respondWithFilteredResult(_0x23233f,_0xe229ec))[_0x058a('0x44')](handleError(_0x23233f,null));};exports['show']=function(_0x35bad4,_0x3cf246){var _0x1c78f4={'raw':!![],'where':{'id':_0x35bad4[_0x058a('0x45')]['id']}},_0x9cf9bf={};_0x9cf9bf[_0x058a('0x30')]=_['keys'](db[_0x058a('0x2b')][_0x058a('0x2c')]);_0x9cf9bf[_0x058a('0x31')]=_['keys'](_0x35bad4['query']);_0x9cf9bf[_0x058a('0x33')]=_[_0x058a('0x46')](_0x9cf9bf['model'],_0x9cf9bf[_0x058a('0x31')]);_0x1c78f4[_0x058a('0x35')]=_[_0x058a('0x46')](_0x9cf9bf[_0x058a('0x30')],qs[_0x058a('0x34')](_0x35bad4['query'][_0x058a('0x34')]));_0x1c78f4['attributes']=_0x1c78f4['attributes'][_0x058a('0x36')]?_0x1c78f4[_0x058a('0x35')]:_0x9cf9bf[_0x058a('0x30')];if(_0x35bad4[_0x058a('0x31')]['includeAll']){_0x1c78f4[_0x058a('0x41')]=[{'all':!![]}];}_0x1c78f4=_[_0x058a('0x3c')]({},_0x1c78f4,_0x35bad4[_0x058a('0x3f')]);return db[_0x058a('0x2b')]['find'](_0x1c78f4)[_0x058a('0x24')](handleEntityNotFound(_0x3cf246,null))['then'](respondWithResult(_0x3cf246,null))[_0x058a('0x44')](handleError(_0x3cf246,null));};exports[_0x058a('0x47')]=function(_0x3684af,_0x1f6329){return db[_0x058a('0x2b')][_0x058a('0x47')](_0x3684af[_0x058a('0x48')],{})[_0x058a('0x24')](respondWithResult(_0x1f6329,0xc9))['catch'](handleError(_0x1f6329,null));};exports[_0x058a('0x23')]=function(_0x13fc38,_0x4f0dae){if(_0x13fc38[_0x058a('0x48')]['id']){delete _0x13fc38[_0x058a('0x48')]['id'];}return db['WhatsappTransferReport'][_0x058a('0x49')]({'where':{'id':_0x13fc38[_0x058a('0x45')]['id']}})[_0x058a('0x24')](handleEntityNotFound(_0x4f0dae,null))['then'](saveUpdates(_0x13fc38[_0x058a('0x48')],null))[_0x058a('0x24')](respondWithResult(_0x4f0dae,null))[_0x058a('0x44')](handleError(_0x4f0dae,null));};exports[_0x058a('0x25')]=function(_0x217d53,_0x723062){return db[_0x058a('0x2b')][_0x058a('0x49')]({'where':{'id':_0x217d53[_0x058a('0x45')]['id']}})[_0x058a('0x24')](handleEntityNotFound(_0x723062,null))[_0x058a('0x24')](removeEntity(_0x723062,null))[_0x058a('0x44')](handleError(_0x723062,null));};exports['describe']=function(_0x31f376,_0x2d409d){return db[_0x058a('0x2b')]['describe']()['then'](respondWithResult(_0x2d409d,null))[_0x058a('0x44')](handleError(_0x2d409d,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index d6ae5c3..1cff8ce 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 _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 +var _0xda26=['bluebird','request-promise','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','util','../../config/logger','api'];(function(_0x281e5e,_0xf320e2){var _0x5a22d2=function(_0x405ff9){while(--_0x405ff9){_0x281e5e['push'](_0x281e5e['shift']());}};_0x5a22d2(++_0xf320e2);}(_0xda26,0x99));var _0x6da2=function(_0x43ffea,_0x53da70){_0x43ffea=_0x43ffea-0x0;var _0xd45dfa=_0xda26[_0x43ffea];return _0xd45dfa;};'use strict';var _=require('lodash');var util=require(_0x6da2('0x0'));var logger=require(_0x6da2('0x1'))(_0x6da2('0x2'));var moment=require('moment');var BPromise=require(_0x6da2('0x3'));var rp=require(_0x6da2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6da2('0x5'));var config=require(_0x6da2('0x6'));var attributes=require(_0x6da2('0x7'));module[_0x6da2('0x8')]=function(_0xaf0b87,_0x3d05a6){return _0xaf0b87[_0x6da2('0x9')](_0x6da2('0xa'),attributes,{'tableName':_0x6da2('0xb'),'paranoid':![],'indexes':[{'name':_0x6da2('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index e7cd7ce..fd1eb6e 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 _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 +var _0x0f36=['code','message','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/environment','jayson/promise','http','request','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3f88bc,_0xe38cf5){var _0x4df1c4=function(_0x111de1){while(--_0x111de1){_0x3f88bc['push'](_0x3f88bc['shift']());}};_0x4df1c4(++_0xe38cf5);}(_0x0f36,0xed));var _0x60f3=function(_0x294c1c,_0x567301){_0x294c1c=_0x294c1c-0x0;var _0x1e7943=_0x0f36[_0x294c1c];return _0x1e7943;};'use strict';var _=require(_0x60f3('0x0'));var util=require(_0x60f3('0x1'));var moment=require('moment');var BPromise=require(_0x60f3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x60f3('0x3'));var db=require(_0x60f3('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x60f3('0x5'));var jayson=require(_0x60f3('0x6'));var client=jayson['client'][_0x60f3('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x224afa,_0x363206,_0x30f36a){return new BPromise(function(_0x2ec647,_0x18b6ce){return client[_0x60f3('0x8')](_0x224afa,_0x30f36a)['then'](function(_0x482881){logger[_0x60f3('0x9')](_0x60f3('0xa'),_0x363206,_0x60f3('0xb'));logger['debug'](_0x60f3('0xc'),_0x363206,'request\x20sent',JSON[_0x60f3('0xd')](_0x482881));if(_0x482881[_0x60f3('0xe')]){if(_0x482881[_0x60f3('0xe')][_0x60f3('0xf')]===0x1f4){logger['error'](_0x60f3('0xa'),_0x363206,_0x482881['error'][_0x60f3('0x10')]);return _0x18b6ce(_0x482881[_0x60f3('0xe')]['message']);}logger['error']('WhatsappTransferReport,\x20%s,\x20%s',_0x363206,_0x482881['error'][_0x60f3('0x10')]);return _0x2ec647(_0x482881[_0x60f3('0xe')][_0x60f3('0x10')]);}else{logger[_0x60f3('0x9')](_0x60f3('0xa'),_0x363206,_0x60f3('0xb'));_0x2ec647(_0x482881['result']['message']);}})[_0x60f3('0x11')](function(_0x2540f1){logger['error'](_0x60f3('0xa'),_0x363206,_0x2540f1);_0x18b6ce(_0x2540f1);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 47d2423..39b9d7b 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0xf842=['seedDB','default','listen','info','start','filter','exitCode','length','map','pm2_env','name','Online\x20apps:','join','Offline\x20apps:','None','log','App\x20Ready!','catch','error','exit','lodash','./mysqldb','./config/seedDB','./config/license','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','sync','then'];(function(_0x35d4e9,_0x298c61){var _0x5c2770=function(_0x2f326a){while(--_0x2f326a){_0x35d4e9['push'](_0x35d4e9['shift']());}};_0x5c2770(++_0x298c61);}(_0xf842,0x172));var _0x2f84=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0xf842[_0x2d34d6];return _0x1d3d12;};'use strict';var _=require(_0x2f84('0x0'));var db=require(_0x2f84('0x1'))['db'];var seedDb=require(_0x2f84('0x2'));var checkLicense=require(_0x2f84('0x3'));var rpc=require('./rpc');var config=require(_0x2f84('0x4'));var logger=require(_0x2f84('0x5'))(_0x2f84('0x6'));var pm2=require(_0x2f84('0x7'));var pm2Config=require(_0x2f84('0x8'));var schedule=require('./config/schedule');var chat=require(_0x2f84('0x9'));var whatsapp=require(_0x2f84('0xa'));var transcribe=require(_0x2f84('0xb'));var provider=require('./config/schedule/cloud-provider');function main(){return db[_0x2f84('0xc')][_0x2f84('0xd')]()[_0x2f84('0xe')](function(){if(config[_0x2f84('0xf')]){return seedDb[_0x2f84('0x10')]();}})[_0x2f84('0xe')](function(){return checkLicense[_0x2f84('0x10')]();})[_0x2f84('0xe')](function(){return rpc[_0x2f84('0x11')]();})[_0x2f84('0xe')](function(_0x4edf3b){logger[_0x2f84('0x12')](_0x4edf3b);return chat['start']();})[_0x2f84('0xe')](function(){return whatsapp[_0x2f84('0x13')]();})[_0x2f84('0xe')](function(){return schedule[_0x2f84('0x13')]();})[_0x2f84('0xe')](function(){return transcribe[_0x2f84('0x13')]();})[_0x2f84('0xe')](function(){return provider[_0x2f84('0x13')]();})[_0x2f84('0xe')](function(_0x20e0d0){logger[_0x2f84('0x12')](_0x20e0d0);return pm2[_0x2f84('0x13')](pm2Config);})['then'](function(_0x489f51){var _0x50d906=_0x489f51[_0x2f84('0x14')](function(_0x4073d6){return typeof _0x4073d6[_0x2f84('0x15')]==='number'&&_0x4073d6[_0x2f84('0x15')]>=0x0;});if(_0x50d906[_0x2f84('0x16')]>0x0){throw new Error(_0x50d906[_0x2f84('0x16')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_[_0x2f84('0x17')](_0x50d906,function(_0xbe3e4f){return'\x22'+_0xbe3e4f[_0x2f84('0x18')][_0x2f84('0x19')]+'\x22';}));}logger['info'](_0x2f84('0x1a'),_['map'](_[_0x2f84('0x14')](_0x489f51,{'status':'online'}),'name')[_0x2f84('0x1b')]());logger[_0x2f84('0x12')](_0x2f84('0x1c'),_[_0x2f84('0x17')](_[_0x2f84('0x14')](_0x489f51,function(_0x4600af){return _0x4600af['status']!=='online';}),_0x2f84('0x19'))[_0x2f84('0x1b')]()||_0x2f84('0x1d'));console[_0x2f84('0x1e')](_0x2f84('0x1f'));})[_0x2f84('0x20')](function(_0x546447){console[_0x2f84('0x1e')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error!',_0x546447);logger[_0x2f84('0x21')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x546447);process[_0x2f84('0x22')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 9e9a20b..773bff9 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 _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 +var _0x8dc9=['isMiddleware','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','/dashboards/general','send','isNil','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','decryptString','split','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','ValidationError','updatePasswordsHistory','splice','unshift','encryptString','join','promisify','sign','secret','payload','options','verify','randomBytes','now','toString','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','lodash','jsonwebtoken','composable-middleware','basic-auth','crypto','bluebird','moment','secrets','session','role','name','internal','permissions','md5secret','voicePause','chatPause','mailPause','smsPause','pauseType','showWebBar','lastLoginAt','crudPermissions','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','interface','userProfileId','settingsEnabled','wssPort','downloadVoiceRecordings','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','openchannelAutoanswer','faxAutoanswer','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','isAuthenticated','user','ChatInteraction','findOne','params','closed','disposition','then','query','forceDownload','json','unmanaged','Unmanaged.','use','headers','authorization','startsWith','Basic','find','authenticate','pass','status','Wrong\x20credentials.','catch','Bearer','Unknown\x20authorization\x20format','apikey','getUuid','User','sub','blockDuration','apiKeyNonce','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','minutes','canUpdate','getLicense','update','Forbidden','isWebrtcLicence','webrtc'];(function(_0x10c6a5,_0x28851d){var _0x25b0d0=function(_0x614a4e){while(--_0x614a4e){_0x10c6a5['push'](_0x10c6a5['shift']());}};_0x25b0d0(++_0x28851d);}(_0x8dc9,0x129));var _0x98dc=function(_0x252d32,_0x5204db){_0x252d32=_0x252d32-0x0;var _0x3ae232=_0x8dc9[_0x252d32];return _0x3ae232;};'use strict';var db=require(_0x98dc('0x0'))['db'];var config=require(_0x98dc('0x1'));var hardwareConf=require(_0x98dc('0x2'));var licenseUtil=require('../../config/license/util');var encryptor=require('../encryptor');var _=require(_0x98dc('0x3'));var jwt=require(_0x98dc('0x4'));var expressJwt=require('express-jwt');var compose=require(_0x98dc('0x5'));var basicAuth=require(_0x98dc('0x6'));var crypto=require(_0x98dc('0x7'));var BPromise=require(_0x98dc('0x8'));var util=require('util');var moment=require(_0x98dc('0x9'));var validateJwt=expressJwt({'secret':config[_0x98dc('0xa')][_0x98dc('0xb')]});var userAttributes=['id',_0x98dc('0xc'),'fullname',_0x98dc('0xd'),_0x98dc('0xe'),'email','userpic',_0x98dc('0xf'),_0x98dc('0x10'),_0x98dc('0x11'),_0x98dc('0x12'),_0x98dc('0x13'),'faxPause',_0x98dc('0x14'),'openchannelPause',_0x98dc('0x15'),_0x98dc('0x16'),_0x98dc('0x17'),'lastPauseAt',_0x98dc('0x18'),'allowmessenger',_0x98dc('0x19'),_0x98dc('0x1a'),_0x98dc('0x1b'),_0x98dc('0x1c'),_0x98dc('0x1d'),_0x98dc('0x1e'),_0x98dc('0x1f'),_0x98dc('0x20'),_0x98dc('0x21'),_0x98dc('0x22'),_0x98dc('0x23'),'phoneBarRemoteControlPort','hotdesk',_0x98dc('0x24'),_0x98dc('0x25'),'privacyEnabled',_0x98dc('0x26'),_0x98dc('0x27'),_0x98dc('0x28'),'downloadOmnichannelInteractions',_0x98dc('0x29'),_0x98dc('0x2a'),_0x98dc('0x2b'),'chatAutoanswer',_0x98dc('0x2c'),_0x98dc('0x2d'),_0x98dc('0x2e'),_0x98dc('0x2f'),'smsAutoanswerDelay',_0x98dc('0x30'),'openchannelAutoanswerDelay',_0x98dc('0x31'),'faxAutoanswerDelay',_0x98dc('0x32'),_0x98dc('0x33'),_0x98dc('0x34')];exports['isChatInteractionAuthorized']=function(){return this[_0x98dc('0x35')](!![])['use'](function(_0x149704,_0x4d405e,_0xf1d427){if(_0x149704[_0x98dc('0x36')]){_0xf1d427();}else{return db[_0x98dc('0x37')][_0x98dc('0x38')]({'where':{'id':_0x149704[_0x98dc('0x39')]['id']},'attributes':['id',_0x98dc('0x3a'),_0x98dc('0x3b')],'raw':!![]})[_0x98dc('0x3c')](function(_0x1b07f0){if(_0x1b07f0&&_0x1b07f0[_0x98dc('0x3a')]&&!_0x149704[_0x98dc('0x3d')][_0x98dc('0x3e')]){return _0x4d405e['status'](_0x1b07f0[_0x98dc('0x3b')]==='unmanaged'?0x195:0x193)[_0x98dc('0x3f')]({'message':_0x1b07f0[_0x98dc('0x3b')]===_0x98dc('0x40')?_0x98dc('0x41'):'Forbidden.'});}else{_0xf1d427();}})['catch'](function(_0x4c3625){_0xf1d427(_0x4c3625);});}});};exports[_0x98dc('0x35')]=function isAuthenticated(_0x92029b){return compose()[_0x98dc('0x42')](function(_0x53eee8,_0x6c115,_0x51a087){var _0x554707;if(_0x53eee8[_0x98dc('0x43')][_0x98dc('0x44')]){if(_[_0x98dc('0x45')](_0x53eee8[_0x98dc('0x43')][_0x98dc('0x44')],_0x98dc('0x46'))){var _0x3f8683=basicAuth(_0x53eee8);db['User'][_0x98dc('0x47')]({'where':{'name':_0x3f8683[_0x98dc('0xd')]}})[_0x98dc('0x3c')](function(_0x268236){if(!_0x268236||!_0x268236[_0x98dc('0x48')](_0x3f8683[_0x98dc('0x49')])){return _0x6c115[_0x98dc('0x4a')](0x191)['json']({'message':_0x98dc('0x4b')});}_0x53eee8['user']={'id':_0x268236['id']};_0x51a087();})[_0x98dc('0x4c')](function(_0x2b523d){_0x51a087(_0x2b523d);});}else if(_[_0x98dc('0x45')](_0x53eee8[_0x98dc('0x43')]['authorization'],_0x98dc('0x4d'))){validateJwt(_0x53eee8,_0x6c115,_0x51a087);}else{if(_0x92029b){_0x51a087();}else{return _0x6c115[_0x98dc('0x4a')](0x193)[_0x98dc('0x3f')]({'message':_0x98dc('0x4e')});}}}else if(_0x53eee8['query'][_0x98dc('0x4f')]){try{var _0x2bd58c={'audience':hardwareConf[_0x98dc('0x50')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x53eee8[_0x98dc('0x3d')][_0x98dc('0x4f')],_0x2bd58c)[_0x98dc('0x3c')](function(_0x565432){return db[_0x98dc('0x51')][_0x98dc('0x47')]({'where':{'id':_0x565432[_0x98dc('0x52')]}})[_0x98dc('0x3c')](function(_0x5a8e89){_0x554707=_0x5a8e89;return db['Setting'][_0x98dc('0x38')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x98dc('0x53')],'raw':!![]});})[_0x98dc('0x3c')](function(_0x167a00){if(!_0x554707||!_['isEqual'](_0x554707[_0x98dc('0x54')],_0x565432['nonce'])){return _0x6c115[_0x98dc('0x4a')](0x191)[_0x98dc('0x3f')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x554707[_0x98dc('0x55')]){return _0x6c115[_0x98dc('0x4a')](0x191)[_0x98dc('0x3f')]({'message':_0x98dc('0x56')});}if(_0x554707[_0x98dc('0x57')]){if(_0x167a00['blockDuration']>0x0){if(moment(_0x554707[_0x98dc('0x58')])['add'](_0x167a00[_0x98dc('0x53')],_0x98dc('0x59'))>moment()){return _0x6c115[_0x98dc('0x4a')](0x191)[_0x98dc('0x3f')]({'message':_0x98dc('0x56')});}}else{return _0x6c115['status'](0x191)['json']({'message':_0x98dc('0x56')});}}_0x53eee8[_0x98dc('0x36')]={'id':_0x554707['id']};_0x51a087();});})[_0x98dc('0x4c')](function(){return _0x6c115[_0x98dc('0x4a')](0x191)[_0x98dc('0x3f')]({'message':_0x98dc('0x56')});});}catch(_0x711789){_0x51a087(_0x711789);}}else if(_0x92029b){_0x51a087();}else{return _0x6c115[_0x98dc('0x4a')](0x193)[_0x98dc('0x3f')]({'message':_0x98dc('0x4e')});}})[_0x98dc('0x42')](function(_0xef62e7,_0x17ee9e,_0x3dfcf2){if(_0xef62e7[_0x98dc('0x36')]){db[_0x98dc('0x51')][_0x98dc('0x47')]({'where':{'id':_0xef62e7[_0x98dc('0x36')]['id']},'attributes':userAttributes})[_0x98dc('0x3c')](function(_0x24d141){if(!_0x24d141){return _0x17ee9e['status'](0x194)[_0x98dc('0x3f')]({'message':'User\x20not\x20found.'});}_0xef62e7[_0x98dc('0x36')]=_0x24d141;_0x3dfcf2();})[_0x98dc('0x4c')](function(_0x3bf80f){_0x3dfcf2(_0x3bf80f);});}else if(_0x92029b){_0x3dfcf2();}else{return _0x17ee9e[_0x98dc('0x4a')](0x194)[_0x98dc('0x3f')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0x98dc('0x5a')]=function canUpdate(){return compose()['use'](function(_0x4b34e5,_0x386796,_0x269217){return licenseUtil[_0x98dc('0x5b')]()[_0x98dc('0x3c')](function(_0x33f0ee){if(_0x33f0ee[_0x98dc('0x5c')]){_0x269217();}else{return _0x386796['status'](0x193)[_0x98dc('0x3f')]({'message':_0x98dc('0x5d')});}})['catch'](function(_0x355f8a){_0x269217(_0x355f8a);});});};exports[_0x98dc('0x5e')]=function isWebrtcLicence(){return compose()[_0x98dc('0x42')](function(_0x40c0fa,_0x138850,_0x341935){return licenseUtil[_0x98dc('0x5b')]()['then'](function(_0xae5618){if(_0xae5618[_0x98dc('0x5f')]){_0x341935();}else{return _0x138850[_0x98dc('0x4a')](0x193)[_0x98dc('0x3f')]({'message':'Forbidden'});}})[_0x98dc('0x4c')](function(_0x1139a0){_0x341935(_0x1139a0);});});};exports[_0x98dc('0x60')]=function(_0x1da00a,_0x36c4bb,_0xd230df){_0x1da00a[_0x98dc('0x60')]=!![];return _0xd230df();};exports['signToken']=function signToken(_0x311048){return signJwt(_0x311048);};exports[_0x98dc('0x61')]=function(_0x34bab3,_0x3bab03){if(!_0x34bab3[_0x98dc('0x36')]){return _0x3bab03[_0x98dc('0x4a')](0x194)[_0x98dc('0x3f')]({'message':_0x98dc('0x62')});}var _0x21390e={'payload':{'id':_0x34bab3[_0x98dc('0x36')]['id'],'role':_0x34bab3[_0x98dc('0x36')][_0x98dc('0xc')]},'options':{'expiresIn':0x15180}};return signJwt(_0x21390e)[_0x98dc('0x3c')](function(_0x31964a){_0x3bab03[_0x98dc('0x63')](_0x98dc('0x64'),_0x31964a);_0x3bab03['redirect'](_0x98dc('0x65'));})[_0x98dc('0x4c')](function(_0x9cd51a){return _0x3bab03[_0x98dc('0x4a')](0x1f4)[_0x98dc('0x66')](_0x9cd51a);});};exports['retrieveApiKey']=function(_0x1bba68){if(_[_0x98dc('0x67')](_0x1bba68[_0x98dc('0x54')])||_[_0x98dc('0x67')](_0x1bba68[_0x98dc('0x68')])){return null;}else{return createJwt(_0x1bba68);}};exports['generateApiKey']=function(_0x3c691a){_0x3c691a[_0x98dc('0x54')]=generateNonce();_0x3c691a[_0x98dc('0x68')]=generateIssuedAt();return createJwt(_0x3c691a);};exports[_0x98dc('0x69')]=function(_0x2ab361,_0x33ddf2){var _0x7980e1=_0x2ab361[_0x98dc('0x3d')]['apikey'];if(_0x7980e1){var _0x17b98d={'nonce':_0x33ddf2[_0x98dc('0x54')],'iat':_0x33ddf2[_0x98dc('0x68')],'audience':hardwareConf[_0x98dc('0x50')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x7980e1,_0x17b98d)[_0x98dc('0x3c')](function(){return generateApiKey(_0x33ddf2);});}else{throw{'message':_0x98dc('0x6a')};}};exports[_0x98dc('0x6b')]=function(_0x29c2a4){var _0x25c404=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x25c404[_0x98dc('0x6c')](_0x29c2a4))throw new db['Sequelize']['ValidationError'](_0x98dc('0x6d'));return;};exports['validatePasswordHistory']=function(_0x216cf5,_0x5ca1de,_0x37e75d){var _0x4f24e8=encryptor[_0x98dc('0x6e')](_0x5ca1de)[_0x98dc('0x6f')](',');for(var _0x4a7f02=0x0;_0x4a7f02<_0x37e75d;_0x4a7f02++){if(!_0x4f24e8[_0x4a7f02])break;if(_0x216cf5[_0x98dc('0x70')]()===_0x4f24e8[_0x4a7f02][_0x98dc('0x70')]()){var _0xb714b9=util['format']('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x37e75d);if(_0x37e75d===0x1){_0xb714b9=_0x98dc('0x71');}throw new db[(_0x98dc('0x72'))][(_0x98dc('0x73'))](_0xb714b9);}}return;};exports[_0x98dc('0x74')]=function(_0x447264,_0x29698f){var _0x4c9ddb=_0x29698f?encryptor[_0x98dc('0x6e')](_0x29698f)[_0x98dc('0x6f')](','):[];if(_0x4c9ddb['length']===0x5){_0x4c9ddb[_0x98dc('0x75')](-0x1,0x1);}_0x4c9ddb[_0x98dc('0x76')](_0x447264);return encryptor[_0x98dc('0x77')](_0x4c9ddb[_0x98dc('0x78')](','));};function signJwt(_0x5e1ae7){var _0x4d39d1=BPromise[_0x98dc('0x79')](jwt[_0x98dc('0x7a')],{'context':jwt});var _0x3563c6=_0x5e1ae7[_0x98dc('0x7b')]||config[_0x98dc('0xa')][_0x98dc('0xb')];return new BPromise(function(_0xbb67eb,_0x582393){_0x4d39d1(_0x5e1ae7[_0x98dc('0x7c')],_0x3563c6,_0x5e1ae7[_0x98dc('0x7d')])[_0x98dc('0x3c')](function(_0x192505){_0xbb67eb(_0x192505);})['catch'](function(_0x1398d7){_0x582393(_0x1398d7);});});}function verifyJwt(_0x1111f2,_0x3dd5ee,_0x35d1ef){var _0x50a8f1=BPromise[_0x98dc('0x79')](jwt[_0x98dc('0x7e')],{'context':jwt});var _0x8e5a3c=_0x35d1ef||config[_0x98dc('0xa')][_0x98dc('0xb')];return new BPromise(function(_0x1c6f30,_0x1613cc){_0x50a8f1(_0x1111f2,_0x8e5a3c,_0x3dd5ee)[_0x98dc('0x3c')](function(_0x62d4a9){_0x1c6f30(_0x62d4a9);})[_0x98dc('0x4c')](function(_0x4523bf){_0x1613cc(_0x4523bf);});});}function generateNonce(){return crypto[_0x98dc('0x7f')](0x10)['toString']('hex');}function generateIssuedAt(){return Math['floor'](Date[_0x98dc('0x80')]()/0x3e8)[_0x98dc('0x81')]();}function createJwt(_0x55a5b2){var _0x17fd8f={'payload':{'iat':_0x55a5b2['apiKeyIat'],'nonce':_0x55a5b2['apiKeyNonce']},'options':{'algorithm':_0x98dc('0x82'),'subject':_0x55a5b2['id']['toString'](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0x98dc('0x50')]()}};return signJwt(_0x17fd8f)[_0x98dc('0x3c')](function(_0x4877f6){return{'iat':_0x55a5b2[_0x98dc('0x68')],'nonce':_0x55a5b2[_0x98dc('0x54')],'token':_0x4877f6};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 371f310..7d6ab5e 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 _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 +var _0x61ed=['cf_','map','slice','all','length','fieldType','type','catch','lodash','./sql-utils','../../mysqldb','findAll','skipContactsQuery','resolve','getContactsSubquery','search','parseAdvancedSearchFilter','then','where','default','fields','user','tags','skip','checkListsRestrictions','tag','countFilteredContacts','count','User','buildContactsQuery','clause','getFilteredContacts','rows','CmContact','describe','keys','filter','startsWith'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x61ed,0x7a));var _0xd61e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x61ed[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xd61e('0x0'));var sqlUtils=require(_0xd61e('0x1'));var db=require(_0xd61e('0x2'))['db'];exports[_0xd61e('0x3')]=function(_0x26c96d,_0x1c8f75,_0x4f8306,_0x3435a2){var _0x50fd46={'count':0x0,'rows':[]};var _0x38b0e5=sqlUtils[_0xd61e('0x4')](_0x1c8f75,_0x26c96d);if(_0x38b0e5){return Promise[_0xd61e('0x5')](_0x50fd46);}var _0x198f1b=sqlUtils[_0xd61e('0x6')]();var _0x37156e={};var _0x35a1a0=![];var _0x526cc6=![];return Promise[_0xd61e('0x5')]()['then'](function(){if(_0x26c96d[_0xd61e('0x7')]){return sqlUtils[_0xd61e('0x8')](_0x26c96d[_0xd61e('0x7')],_0x3435a2);}else{return sqlUtils['parseQueryParameters'](_0x26c96d,_0x3435a2);}})[_0xd61e('0x9')](function(_0x4b1ae3){_0x198f1b[_0xd61e('0xa')](_0x4b1ae3[_0xd61e('0xb')]);_0x198f1b['where'](_0x4b1ae3[_0xd61e('0xc')]);_0x198f1b[_0xd61e('0xa')](_0x4b1ae3['filter']);_0x198f1b[_0xd61e('0xa')](_0x4b1ae3[_0xd61e('0xd')]['clause']);_0x37156e=_0x4b1ae3[_0xd61e('0xe')];_0x526cc6=_0x4b1ae3['user'][_0xd61e('0xf')];return sqlUtils[_0xd61e('0x10')](_0x1c8f75,_0x26c96d,_0x526cc6);})[_0xd61e('0x9')](function(_0x2d9991){_0x198f1b['where'](_0x2d9991);var _0x51a91f=_0x26c96d[_0xd61e('0x7')]?_0x37156e['ids']:_0x26c96d[_0xd61e('0x11')];_0x35a1a0=_0x51a91f?!![]:![];return sqlUtils[_0xd61e('0x12')](_0x198f1b,_0x51a91f);})[_0xd61e('0x9')](function(_0x1f7fef){_0x50fd46[_0xd61e('0x13')]=_0x1f7fef;if(_0x50fd46[_0xd61e('0x13')]===0x0){return;}if(_0x26c96d[_0xd61e('0x14')]){_0x526cc6=!![];}return sqlUtils[_0xd61e('0x15')](_0x198f1b,_0x26c96d['fields'],_0x4f8306,_0x35a1a0,_0x37156e[_0xd61e('0x16')],_0x526cc6);})['then'](function(_0x1a01e4){if(!_0x1a01e4){return[];}return sqlUtils[_0xd61e('0x17')](_0x1a01e4,_0x26c96d,_0x4f8306);})[_0xd61e('0x9')](function(_0x3d3b0a){_0x50fd46[_0xd61e('0x18')]=_0x3d3b0a;return _0x50fd46;})['catch'](function(_0x150f54){throw _0x150f54;});};exports['describe']=function(){var _0x50353a={};var _0x48805a=[];return db[_0xd61e('0x19')][_0xd61e('0x1a')]()[_0xd61e('0x9')](function(_0x2ef9ad){_0x50353a=_0x2ef9ad;var _0x329da5=Object[_0xd61e('0x1b')](_0x50353a)[_0xd61e('0x1c')](function(_0x3f194e){return _[_0xd61e('0x1d')](_0x3f194e,_0xd61e('0x1e'))?_0x3f194e:undefined;});var _0x4a9553=_0x329da5[_0xd61e('0x1f')](function(_0x8d5510){return db['CmCustomField']['findOne']({'where':{'id':_0x8d5510[_0xd61e('0x20')](0x3)},'raw':!![]});});return Promise[_0xd61e('0x21')](_0x4a9553);})[_0xd61e('0x9')](function(_0x46175f){for(var _0x3c5847=0x0;_0x3c5847<_0x46175f[_0xd61e('0x22')];_0x3c5847++){if(_0x46175f[_0x3c5847]){var _0x5069cf=_0xd61e('0x1e')+_0x46175f[_0x3c5847]['id'];_0x50353a[_0x5069cf][_0xd61e('0x23')]=_0x46175f[_0x3c5847][_0xd61e('0x24')];}}_0x48805a=_[_0xd61e('0x1f')](Object[_0xd61e('0x1b')](_0x50353a),function(_0x5d82d8){return{'name':_0x5d82d8,'type':_0x50353a[_0x5d82d8][_0xd61e('0x24')]};});return _0x48805a;})[_0xd61e('0x25')](function(_0x131db2){throw _0x131db2;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 61a66d5..8fea10d 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 _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 +var _0xe39a=['text','value','start','end','Tag','map','tags','and','ids','User','user','skip','keys','some','compact','Contact','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','uc.UserId\x20=\x20?','\x20=\x20?','then','tag','clause','filter','resolve','search','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','attributes','group','c.id','limit','offset','subqry.id','having','order','DESC','subqry.','findAll','color','Sequelize','QueryTypes','SELECT','sequelize','query','toString','Tags','TagIds','COUNT(*)','where','t.id\x20IN\x20?','lodash','squel','../parsers/qs','../../mysqldb','role','agent','ListId','true','select','from','c.deletedAt\x20IS\x20NULL','subqry','left_join','uc.CmContactId\x20=\x20','cm_contact_has_tags','ct.CmContactId\x20=\x20','.id','tools_tags','firstName','lastName','phone','mobile','fax','email','CompanyId','createdAt','push','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','name','dateOfBirth','fieldType','datetime','castTo','buildExpression'];(function(_0x29e7f2,_0x22eff1){var _0x224079=function(_0x506002){while(--_0x506002){_0x29e7f2['push'](_0x29e7f2['shift']());}};_0x224079(++_0x22eff1);}(_0xe39a,0x1db));var _0xae39=function(_0x59531e,_0x5cde3d){_0x59531e=_0x59531e-0x0;var _0x24cdab=_0xe39a[_0x59531e];return _0x24cdab;};'use strict';var _=require(_0xae39('0x0'));var squel=require(_0xae39('0x1'));var as=require('../parsers/advancedSearch');var qs=require(_0xae39('0x2'));var utils=require('../interaction/utils');var db=require(_0xae39('0x3'))['db'];function skipContactsQuery(_0x4493ab,_0x45e815){var _0x36426e=![];if(_0x4493ab[_0xae39('0x4')]===_0xae39('0x5')&&!_0x45e815['search']&&!_0x45e815[_0xae39('0x6')]&&_0x45e815['autocomplete']!==_0xae39('0x7')){_0x36426e=!![];}return _0x36426e;}function getContactsSubquery(){return squel[_0xae39('0x8')]()[_0xae39('0x9')]('cm_contacts','c')['where'](_0xae39('0xa'));}function applyJoinClauses(_0x3856cf,_0x291de8){var _0x324258=_0x291de8?'c':_0xae39('0xb');_0x3856cf[_0xae39('0xc')]('cm_user_has_contacts','uc',_0xae39('0xd')+_0x324258+'.id')['left_join'](_0xae39('0xe'),'ct',_0xae39('0xf')+_0x324258+_0xae39('0x10'))[_0xae39('0xc')](_0xae39('0x11'),'t','t.id\x20=\x20ct.TagId');return _0x3856cf;}function addFieldsToQuery(_0x8ee1bf,_0x4a1d55,_0x2c9746,_0x53a84b,_0x54b832){var _0x3b43ae=_0x54b832?'c':_0xae39('0xb');if(!_0x4a1d55){_0x4a1d55=['id',_0xae39('0x12'),_0xae39('0x13'),_0xae39('0x14'),_0xae39('0x15'),_0xae39('0x16'),_0xae39('0x17'),_0xae39('0x6'),_0xae39('0x18'),_0xae39('0x19'),'updatedAt','deletedAt','TagIds'];}else if(!_0x4a1d55['includes']('id')){_0x4a1d55[_0xae39('0x1a')]('id');}var _0x10733a=_0x2c9746&&_0x54b832||!_0x2c9746&&!_0x54b832;if(_0x53a84b){_0x10733a=_0x53a84b&&_0x54b832||!_0x53a84b&&!_0x54b832;}_0x4a1d55[_0xae39('0x1b')](function(_0x77197f){if(_0x77197f==='TagIds'){if(_0x10733a){_0x8ee1bf[_0xae39('0x1c')](_0xae39('0x1d'),_0x77197f);}else if(_0x2c9746||_0x53a84b){_0x8ee1bf[_0xae39('0x1c')](_0x3b43ae+'.'+_0x77197f);}}else{_0x8ee1bf[_0xae39('0x1c')](_0x3b43ae+'.'+_0x77197f);}});return _0x8ee1bf;}function getSqlClauses(){var _0x3f2cf0={'default':squel[_0xae39('0x1e')](),'fields':squel[_0xae39('0x1e')](),'filter':squel['expr'](),'tags':{'clause':squel[_0xae39('0x1e')](),'ids':null},'user':{'clause':squel[_0xae39('0x1e')](),'skip':![]}};return _0x3f2cf0;}function parseTagParameter(_0x5130a6){var _0x174cc2=squel['expr']();if(_0x5130a6){var _0x519a29=utils[_0xae39('0x1f')](_0x5130a6);_0x519a29[_0xae39('0x1b')](function(_0x3d06ae){_0x174cc2['or'](_0xae39('0x20'),'%,'+_0x3d06ae+',%');});}return _0x174cc2;}function parseSearchFilter(_0x5d237b){var _0xf39c63=squel[_0xae39('0x1e')]();if(_0x5d237b){var _0x65ceb2=_0x5d237b[_0xae39('0x21')]('\x5c','\x5c\x5c')[_0xae39('0x21')](/'/g,'\x27\x27');if(_0x65ceb2[_0xae39('0x22')]('\x20')[_0xae39('0x23')]>0x1){_0xf39c63['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x65ceb2,!![]),null);}else{if(qs[_0xae39('0x24')](_0x65ceb2)){_0xf39c63['or'](_0xae39('0x25'),_0x65ceb2+'%');_0xf39c63['or'](_0xae39('0x26'),_0x65ceb2+'%');_0xf39c63['or'](_0xae39('0x27'),_0x65ceb2+'%');_0xf39c63['or'](_0xae39('0x28'),_0x65ceb2+'%');}else if(qs[_0xae39('0x29')](_0x65ceb2)){_0xf39c63['or'](_0xae39('0x2a'),_0x65ceb2+'%');}else{_0xf39c63['or'](_0xae39('0x2b'),'%'+_0x65ceb2+'%');_0xf39c63['or'](_0xae39('0x2c'),'%'+_0x65ceb2+'%');_0xf39c63['or'](_0xae39('0x2a'),'%'+_0x65ceb2+'%');}}}return _0xf39c63;}function parseAdvancedSearchFilter(_0x41ca6e,_0x4e2711){var _0xb0ad6f=getSqlClauses();var _0x49f253=as[_0xae39('0x2d')](_0x41ca6e);var _0x1603e6=_0x49f253[_0xae39('0x2e')];for(var _0x47d536=0x0;_0x47d536<_0x49f253['conditions'][_0xae39('0x23')];_0x47d536++){var _0x53bffa=_0x49f253[_0xae39('0x2f')][_0x47d536];var _0x5d9840='c';var _0x28c581=_[_0xae39('0x30')](_0x4e2711,[_0xae39('0x31'),_0x53bffa[_0xae39('0x1c')]]);if(_0x28c581){if(_0x53bffa[_0xae39('0x1c')]===_0xae39('0x32')||_0x28c581[_0xae39('0x33')]===_0xae39('0x34')){_0x53bffa[_0xae39('0x35')]='DATE';}var _0x46578a=as[_0xae39('0x36')](_0x5d9840,_0x28c581['type'],_0x53bffa);_0xb0ad6f['default'][_0x1603e6](_0x46578a[_0xae39('0x37')],_0x46578a[_0xae39('0x38')][_0xae39('0x39')],_0x46578a[_0xae39('0x38')][_0xae39('0x3a')]);}else{if(_0x53bffa[_0xae39('0x1c')]===_0xae39('0x3b')){var _0x490402=_0x53bffa['value'][_0xae39('0x22')](',')[_0xae39('0x3c')](function(_0x1efb16){return Number(_0x1efb16);});var _0x5b7c5f=parseTagParameter(_0x490402);_0xb0ad6f[_0xae39('0x3d')]['clause'][_0xae39('0x3e')](_0x5b7c5f);_0xb0ad6f[_0xae39('0x3d')][_0xae39('0x3f')]=_0x490402;}else if(_0x53bffa[_0xae39('0x1c')]===_0xae39('0x40')){_0xb0ad6f[_0xae39('0x41')]['clause'][_0xae39('0x3e')]('uc.UserId\x20=\x20?',_0x53bffa[_0xae39('0x38')]);_0xb0ad6f[_0xae39('0x41')][_0xae39('0x42')]=!![];}}}return _0xb0ad6f;}function parseModelFields(_0x58f7ea,_0x4f2177){var _0x510117=squel[_0xae39('0x1e')]();var _0x17f826=_(_0x58f7ea)[_0xae39('0x43')]()['map'](function(_0x1ae212){return _[_0xae39('0x44')](_0x4f2177,[_0xae39('0x31'),_0x1ae212])?_0x1ae212:undefined;})[_0xae39('0x45')]()[_0xae39('0x38')]();if(_0x58f7ea[_0xae39('0x46')]){_0x17f826['push'](_0xae39('0x46'));}if(_0x58f7ea['User']){_0x17f826[_0xae39('0x1a')]('User');}if(_0x17f826[_0xae39('0x23')]>0x0){_0x17f826[_0xae39('0x1b')](function(_0x3bb14e){if(_0x3bb14e===_0xae39('0x6')){_0x510117[_0xae39('0x3e')]('c.ListId\x20IN\x20?',[][_0xae39('0x47')](_0x58f7ea[_0x3bb14e]));}else if(_0x3bb14e===_0xae39('0x46')){var _0x1bfaca='%'+_0x58f7ea[_0x3bb14e]+'%';_0x510117[_0xae39('0x3e')](_0xae39('0x48'),_0x1bfaca);}else if(_0x3bb14e===_0xae39('0x40')){_0x510117[_0xae39('0x3e')](_0xae39('0x49'),_0x58f7ea[_0x3bb14e]);}else{_0x510117[_0xae39('0x3e')]('c.'+_0x3bb14e+_0xae39('0x4a'),_0x58f7ea[_0x3bb14e]);}});}return _0x510117;}function parseQueryParameters(_0x4c05a8,_0x4b0b0c){var _0x58dab0=getSqlClauses();return Promise['resolve']()[_0xae39('0x4b')](function(){return parseModelFields(_0x4c05a8,_0x4b0b0c);})[_0xae39('0x4b')](function(_0x166c2e){_0x58dab0['fields']['and'](_0x166c2e);return parseTagParameter(_0x4c05a8[_0xae39('0x4c')]);})[_0xae39('0x4b')](function(_0x111f20){_0x58dab0[_0xae39('0x3d')][_0xae39('0x4d')][_0xae39('0x3e')](_0x111f20);return parseSearchFilter(_0x4c05a8[_0xae39('0x4e')]);})[_0xae39('0x4b')](function(_0x1f1614){_0x58dab0[_0xae39('0x4e')]=_0x1f1614;return _0x58dab0;});}function checkListsRestrictions(_0x22bfb3,_0x283c2b,_0x14a737){var _0x3273dc=squel['expr']();return Promise[_0xae39('0x4f')]()[_0xae39('0x4b')](function(){if(_0x283c2b[_0xae39('0x50')]&&_0x22bfb3[_0xae39('0x4')]===_0xae39('0x5')&&!_0x14a737){return _0x22bfb3['getLists']({'attributes':['id'],'raw':!![]});}})['then'](function(_0x43ae21){if(_0x43ae21){if(_0x43ae21[_0xae39('0x23')]===0x0){_0x3273dc[_0xae39('0x3e')](_0xae39('0x51'));}else{_0x3273dc['and'](_0xae39('0x52'),_[_0xae39('0x3c')](_0x43ae21,'id'));}}})[_0xae39('0x4b')](function(){return _0x3273dc;});}function buildContactsQuery(_0x4659f4,_0x85c39e,_0x1eb88d,_0x1fb288,_0x2dbe8f,_0x321392){if(_0x85c39e){_0x85c39e=_0x1eb88d[_0xae39('0x53')];}_0x4659f4=addFieldsToQuery(_0x4659f4,_0x85c39e,_0x1fb288,_0x321392,!![]);var _0x1f6d50=squel[_0xae39('0x8')]();_0x1f6d50=addFieldsToQuery(_0x1f6d50,_0x85c39e,_0x1fb288,_0x321392,![]);if(_0x1fb288||_0x321392){_0x4659f4=applyJoinClauses(_0x4659f4,!![]);_0x4659f4[_0xae39('0x54')](_0xae39('0x55'));if(_0x1eb88d[_0xae39('0x56')]){_0x1f6d50[_0xae39('0x56')](_0x1eb88d['limit']);}if(_0x1eb88d[_0xae39('0x57')]){_0x1f6d50[_0xae39('0x57')](_0x1eb88d[_0xae39('0x57')]);}}else{_0x1f6d50=applyJoinClauses(_0x1f6d50,![]);_0x1f6d50[_0xae39('0x54')](_0xae39('0x58'));if(_0x1eb88d[_0xae39('0x56')]){_0x4659f4[_0xae39('0x56')](_0x1eb88d[_0xae39('0x56')]);}if(_0x1eb88d[_0xae39('0x57')]){_0x4659f4[_0xae39('0x57')](_0x1eb88d[_0xae39('0x57')]);}}_0x1f6d50[_0xae39('0x59')](_0x2dbe8f);if(_0x1eb88d[_0xae39('0x5a')]){_0x1eb88d[_0xae39('0x5a')]['forEach'](function(_0x3ba214){_0x4659f4[_0xae39('0x5a')]('c.'+_0x3ba214[0x0],_0x3ba214[0x1]===_0xae39('0x5b')?![]:!![]);_0x1f6d50[_0xae39('0x5a')](_0xae39('0x5c')+_0x3ba214[0x0],_0x3ba214[0x1]===_0xae39('0x5b')?![]:!![]);});}_0x1f6d50[_0xae39('0x9')](_0x4659f4,_0xae39('0xb'));return _0x1f6d50;}function getFilteredContacts(_0x1502d2){var _0x3d8dd4=[];return db[_0xae39('0x3b')][_0xae39('0x5d')]({'attributes':['id',_0xae39('0x31'),_0xae39('0x5e')],'raw':!![]})[_0xae39('0x4b')](function(_0x29ec57){_0x3d8dd4=_['keyBy'](_0x29ec57,'id');var _0x30991f={'type':db[_0xae39('0x5f')][_0xae39('0x60')][_0xae39('0x61')],'model':db['CmContact'],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xae39('0x62')][_0xae39('0x63')](_0x1502d2[_0xae39('0x64')](),_0x30991f);})['then'](function(_0x2e7432){_0x2e7432[_0xae39('0x1b')](function(_0x3fe76f){if(_0x3fe76f['TagIds']){_0x3fe76f[_0xae39('0x65')]=[];_0x3fe76f[_0xae39('0x66')][_0xae39('0x22')](',')[_0xae39('0x1b')](function(_0x32ee42){_0x3fe76f[_0xae39('0x65')][_0xae39('0x1a')](_0x3d8dd4[_0x32ee42]);});}delete _0x3fe76f[_0xae39('0x66')];});return _0x2e7432;});}function countFilteredContacts(_0x4a1174,_0x2be307){var _0x2a5c11=_0x4a1174['clone']();_0x2a5c11['field'](_0xae39('0x67'));_0x2a5c11=applyJoinClauses(_0x2a5c11,!![]);_0x4a1174[_0xae39('0x54')]('c.id');var _0x37afcf=utils[_0xae39('0x1f')](_0x2be307);if(!_['isEmpty'](_0x37afcf)){_0x2a5c11[_0xae39('0x68')](_0xae39('0x69'),_0x37afcf);}var _0x18f276={'type':db[_0xae39('0x5f')][_0xae39('0x60')][_0xae39('0x61')],'raw':!![]};return db[_0xae39('0x62')][_0xae39('0x63')](_0x2a5c11['toString'](),_0x18f276)[_0xae39('0x4b')](function(_0x630aba){return _0x630aba[0x0][_0xae39('0x67')];});}module['exports']={'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 cad3dad..0aae1a6 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 _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 +var _0xaa24=['decryptFile','createDecipher','encryptString','secret','createCipher','utf8','base64','decryptString','crypto','bluebird','lodash','../../config/logger','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','indexOf','hasOwnProperty','encryptFile','createWriteStream','data','update','write','end','final','binary','close','unlink'];(function(_0x46a38b,_0x16ffb5){var _0x346e75=function(_0x34f8d0){while(--_0x34f8d0){_0x46a38b['push'](_0x46a38b['shift']());}};_0x346e75(++_0x16ffb5);}(_0xaa24,0x1dc));var _0x4aa2=function(_0x4a5019,_0x1d1fa9){_0x4a5019=_0x4a5019-0x0;var _0x5d622a=_0xaa24[_0x4a5019];return _0x5d622a;};'use strict';var crypto=require(_0x4aa2('0x0'));var fs=require('fs');var BPromise=require(_0x4aa2('0x1'));var _=require(_0x4aa2('0x2'));var config=require('../../config/environment');var logger=require(_0x4aa2('0x3'))(_0x4aa2('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x4aa2('0x5')][_0x4aa2('0x6')],'algorithm':_0x4aa2('0x7')};const fileOptions={'algorithm':_0x4aa2('0x8')};if(config[_0x4aa2('0x9')]&&config[_0x4aa2('0x9')][_0x4aa2('0xa')]){var isSupported=isAlgorithmSupported(config[_0x4aa2('0x9')][_0x4aa2('0xa')]);if(isSupported){fileOptions[_0x4aa2('0xa')]=config[_0x4aa2('0x9')][_0x4aa2('0xa')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x4aa2('0xb')](',\x20');logger[_0x4aa2('0xc')](config['encrypt'][_0x4aa2('0xa')],_0x4aa2('0xd'),supportedAlgorithms);}}function isASupportedCipher(_0x1d8a67){return AES_SUPPORTED_RX[_0x4aa2('0xe')](_0x1d8a67);}function getSupportedCiphers(){return crypto[_0x4aa2('0xf')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x24df3c){return getSupportedCiphers()[_0x4aa2('0x10')](_0x24df3c)>-0x1;}function combineOptions(_0x2c2571){var _0x183a48={};for(var _0x5c983b in fileOptions){if(fileOptions[_0x4aa2('0x11')](_0x5c983b)){_0x183a48[_0x5c983b]=fileOptions[_0x5c983b];}}if(_0x2c2571){for(var _0x3214b3 in _0x2c2571){if(_0x2c2571[_0x4aa2('0x11')](_0x3214b3)){_0x183a48[_0x3214b3]=_0x2c2571[_0x3214b3];}}}return _0x183a48;}exports[_0x4aa2('0x12')]=function(_0x536f22,_0xe1cd00,_0x1cccd7,_0x364438){return new BPromise(function(_0x3bf00b,_0x3ca47f){_0x364438=combineOptions(_0x364438);var _0x3ff5d2=new Buffer(_0x1cccd7);var _0x20fcd4=fs['createReadStream'](_0x536f22);var _0x4d2981=fs[_0x4aa2('0x13')](_0xe1cd00);var _0xc2e76=crypto['createCipher'](_0x364438[_0x4aa2('0xa')],_0x3ff5d2);_0x20fcd4['on'](_0x4aa2('0x14'),function(_0x322400){var _0x210a43=new Buffer(_0xc2e76[_0x4aa2('0x15')](_0x322400),'binary');_0x4d2981[_0x4aa2('0x16')](_0x210a43);});_0x20fcd4['on'](_0x4aa2('0x17'),function(){try{var _0x3748bd=new Buffer(_0xc2e76[_0x4aa2('0x18')](_0x4aa2('0x19')),_0x4aa2('0x19'));_0x4d2981[_0x4aa2('0x16')](_0x3748bd);_0x4d2981[_0x4aa2('0x17')]();_0x4d2981['on'](_0x4aa2('0x1a'),function(){return _0x3bf00b(_0xe1cd00);});}catch(_0x2e375d){fs[_0x4aa2('0x1b')](_0xe1cd00);return _0x3ca47f(_0x2e375d);}});});};exports[_0x4aa2('0x1c')]=function(_0x494f13,_0x262fe5,_0x5df041,_0xab0f39){return new BPromise(function(_0x2996d2,_0x47a70a){_0xab0f39=combineOptions(_0xab0f39);var _0x2ada47=new Buffer(_0x5df041);var _0x2ecae4=fs['createReadStream'](_0x494f13);var _0x4fc4d7=fs[_0x4aa2('0x13')](_0x262fe5);var _0x1258a9=crypto[_0x4aa2('0x1d')](_0xab0f39[_0x4aa2('0xa')],_0x2ada47);_0x2ecae4['on']('data',function(_0xb7d0d){var _0x520b26=new Buffer(_0x1258a9[_0x4aa2('0x15')](_0xb7d0d),_0x4aa2('0x19'));_0x4fc4d7['write'](_0x520b26);});_0x2ecae4['on']('end',function(){try{var _0xa8832a=new Buffer(_0x1258a9[_0x4aa2('0x18')](_0x4aa2('0x19')),_0x4aa2('0x19'));_0x4fc4d7[_0x4aa2('0x16')](_0xa8832a);_0x4fc4d7[_0x4aa2('0x17')]();_0x4fc4d7['on'](_0x4aa2('0x1a'),function(){return _0x2996d2(_0x262fe5);});}catch(_0x4da12a){fs[_0x4aa2('0x1b')](_0x262fe5);return _0x47a70a(_0x4da12a);}});});};exports[_0x4aa2('0x1e')]=function(_0x3d84e2,_0x15e4b,_0x4fa0b3){var _0x3f72f8=_0x4fa0b3||stringOptions['algorithm'];var _0x551bcf=_0x15e4b||stringOptions[_0x4aa2('0x1f')];var _0x61a3de=crypto[_0x4aa2('0x20')](_0x3f72f8,_0x551bcf);var _0x293a10=_0x61a3de[_0x4aa2('0x15')](_0x3d84e2,_0x4aa2('0x21'),_0x4aa2('0x22'));_0x293a10+=_0x61a3de[_0x4aa2('0x18')](_0x4aa2('0x22'));return _0x293a10;};exports[_0x4aa2('0x23')]=function(_0x4a538b,_0xdcb153,_0x46b283){var _0x32a4a3=_0x46b283||stringOptions[_0x4aa2('0xa')];var _0x175e93=_0xdcb153||stringOptions[_0x4aa2('0x1f')];var _0x19ced9=crypto[_0x4aa2('0x1d')](_0x32a4a3,_0x175e93);var _0x539cdd=_0x19ced9[_0x4aa2('0x15')](_0x4a538b,_0x4aa2('0x22'),_0x4aa2('0x21'));_0x539cdd+=_0x19ced9[_0x4aa2('0x18')](_0x4aa2('0x21'));return _0x539cdd;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index af41acd..30ea0c3 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 _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 +var _0xe740=['isInteger','forEach','push','format','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','basename','.csv','existsSync','join','mkdirSync','%s%d.%s','csv','writeFileSync','%s.%s','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','path','lodash','bluebird','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','num','Empty','length','range'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe740,0x142));var _0x0e74=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0xe740[_0x87b0ff];return _0x3bc0b2;};'use strict';var util=require('util');var path=require(_0x0e74('0x0'));var _=require(_0x0e74('0x1'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0x0e74('0x2'));var zipdir=require('zip-dir');var rimraf=require(_0x0e74('0x3'));var db=require(_0x0e74('0x4'))['db'];var dbH=require(_0x0e74('0x4'))[_0x0e74('0x5')];var logger=require(_0x0e74('0x6'))(_0x0e74('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x0e74('0x8')][0x2]);var QUERY=process[_0x0e74('0x8')][0x3];var PATH=process[_0x0e74('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x224e75,_0x244900){var _0x2d221f={'status':_0x224e75};var _0x37d328={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x244900){_0x2d221f[_0x0e74('0x9')]=_0x244900;}return db[_0x0e74('0xa')][_0x0e74('0xb')](_0x2d221f,_0x37d328);}function main(){var _0x46c656=0x1388;var _0x30eb96;logger[_0x0e74('0xc')](util['format'](_0x0e74('0xd'),EXTRACTED_REPORT_ID,_0x0e74('0xe')));return db[_0x0e74('0xf')][_0x0e74('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x0e74('0x11'),_0x0e74('0x12')]})[_0x0e74('0x13')](function(_0x431c44){if(_0x431c44){_0x30eb96=_0x431c44;_0x46c656=_0x30eb96[_0x0e74('0x12')]||0x1388;}})['then'](function(){return dbH[_0x0e74('0x14')][_0x0e74('0x15')](util['format'](_0x0e74('0x16'),QUERY),{'type':dbH[_0x0e74('0x14')][_0x0e74('0x17')]['SELECT']});})[_0x0e74('0x13')](function(_0x49e488){if(!_0x49e488[0x0][_0x0e74('0x18')]){return analyticExtractedReport(_0x0e74('0x19'));}var _0x240629=[];var _0x24e769=0x0;if(_0x30eb96[_0x0e74('0x11')]){if(_0x49e488&&_0x49e488[_0x0e74('0x1a')]){var _0x110f22=_[_0x0e74('0x1b')](_0x49e488[0x0][_0x0e74('0x18')]/_0x46c656);var _0x2788a2=Number[_0x0e74('0x1c')](_0x49e488[0x0][_0x0e74('0x18')]/_0x46c656)?_0x49e488[0x0][_0x0e74('0x18')]%_0x46c656:0x0;_0x110f22[_0x0e74('0x1d')](function(_0x1746c9){if(_0x1746c9>0x0){_0x24e769+=_0x46c656;}_0x240629[_0x0e74('0x1e')](dbH[_0x0e74('0x14')][_0x0e74('0x15')](util[_0x0e74('0x1f')](_0x0e74('0x20'),QUERY,_0x46c656,_0x24e769),{'type':dbH[_0x0e74('0x14')]['QueryTypes'][_0x0e74('0x21')]}));});if(_0x2788a2>0x0){_0x24e769+=_0x46c656;_0x240629[_0x0e74('0x1e')](dbH[_0x0e74('0x14')][_0x0e74('0x15')](util[_0x0e74('0x1f')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x2788a2,_0x24e769),{'type':dbH[_0x0e74('0x14')]['QueryTypes'][_0x0e74('0x21')]}));}}}else{_0x240629['push'](dbH[_0x0e74('0x14')][_0x0e74('0x15')](QUERY,{'type':dbH[_0x0e74('0x14')][_0x0e74('0x17')][_0x0e74('0x21')]}));}var _0x459dec=path[_0x0e74('0x22')](PATH);var _0x386570=path[_0x0e74('0x23')](PATH,_0x0e74('0x24'));var _0x5ca95f=_0x30eb96[_0x0e74('0x11')]&&_0x240629[_0x0e74('0x1a')]>0x1;var _0x22c867=[];if(!fs[_0x0e74('0x25')](path[_0x0e74('0x26')](_0x459dec,_0x386570))&&_0x5ca95f){fs[_0x0e74('0x27')](path['join'](_0x459dec,_0x386570));}return BPromise['each'](_0x240629,function(_0x46b55e){_0x22c867[_0x0e74('0x1e')](_0x46b55e);})[_0x0e74('0x13')](function(){for(var _0x2b77db=0x0;_0x2b77db<_0x22c867[_0x0e74('0x1a')];_0x2b77db+=0x1){var _0x29db07;var _0x551f6e=_0x22c867[_0x2b77db];if(_0x5ca95f){_0x29db07=path[_0x0e74('0x26')](_0x459dec,_0x386570,util[_0x0e74('0x1f')](_0x0e74('0x28'),_0x386570,_0x2b77db,_0x0e74('0x29')));}else{_0x29db07=path[_0x0e74('0x26')](_0x459dec,util[_0x0e74('0x1f')]('%s.%s',_0x386570,_0x0e74('0x29')));}fs[_0x0e74('0x2a')](_0x29db07,csv(_0x551f6e));}})[_0x0e74('0x13')](function(){if(_0x5ca95f){return new Promise(function(_0x570bc4){zipdir(path[_0x0e74('0x26')](_0x459dec,_0x386570),{'saveTo':path[_0x0e74('0x26')](_0x459dec,util['format'](_0x0e74('0x2b'),_0x386570,'zip'))},function(_0x5415ae,_0x4fa47a){rimraf(path[_0x0e74('0x26')](_0x459dec,_0x386570),function(){});_0x570bc4('zip\x20finished');});});}})['then'](function(){logger[_0x0e74('0xc')](util[_0x0e74('0x1f')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x0e74('0xe')));return analyticExtractedReport('Completed',_0x5ca95f?util[_0x0e74('0x1f')](_0x0e74('0x2b'),_0x386570,_0x5ca95f?_0x0e74('0x2c'):_0x0e74('0x29')):null);});})[_0x0e74('0x2d')](function(_0x1466c1){logger[_0x0e74('0xc')](util['format'](_0x0e74('0x2e'),EXTRACTED_REPORT_ID,'CSV'),util[_0x0e74('0x2f')](_0x1466c1,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x0e74('0x30')](function(){process[_0x0e74('0x31')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 974b47f..00c7df7 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 _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 +var _0x8d42=['/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','channel','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','catch','util','path','moment','html-to-pdfmake','zip-dir','rimraf','jsdom','../../mysqldb','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','tableHeader','pick','fill','length','auto','body','concat','chunk','keys','push','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','format','header','pageBreak','before','margin','\x20/\x20','footer','Arial','num','Empty','find','split','splitSizePdf','then','range','forEach','query','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','QueryTypes','SELECT','dirname','basename','existsSync','join','mkdirSync','each','flatten','createPdfKitDocument','%s%d.%s','%s.%s','pdf','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','/fonts/arial-regular.ttf'];(function(_0x2a1d7e,_0x20d9c4){var _0x4236fd=function(_0x5ab8a3){while(--_0x5ab8a3){_0x2a1d7e['push'](_0x2a1d7e['shift']());}};_0x4236fd(++_0x20d9c4);}(_0x8d42,0x10f));var _0x28d4=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0x8d42[_0x20c9b2];return _0x2c6030;};'use strict';var _=require('lodash');var fs=require('fs');var util=require(_0x28d4('0x0'));var path=require(_0x28d4('0x1'));var moment=require(_0x28d4('0x2'));var htmlToPdfmake=require(_0x28d4('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0x28d4('0x4'));var rimraf=require(_0x28d4('0x5'));var JSDOM=require(_0x28d4('0x6'))['JSDOM'];var window=new JSDOM('')['window'];var BPromise=require('bluebird');var db=require(_0x28d4('0x7'))['db'];var dbH=require(_0x28d4('0x7'))['dbH'];var logger=require('../../config/logger')(_0x28d4('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x28d4('0x9')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x28d4('0x9')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0x28d4('0xa');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x5ad23d,_0x3db63e){var _0x94ce7={'status':_0x5ad23d};var _0x133726={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3db63e){_0x94ce7[_0x28d4('0xb')]=_0x3db63e;}return db[_0x28d4('0xc')][_0x28d4('0xd')](_0x94ce7,_0x133726);}function getHeaders(_0x203308){return _[_0x28d4('0xe')](_0x203308,function(_0x21f5a9){return{'text':_0x21f5a9,'style':_0x28d4('0xf')};});}function getRows(_0x2a9217,_0x16c945){return _[_0x28d4('0xe')](_0x16c945,function(_0x3bf0cb){return _(_0x3bf0cb)[_0x28d4('0x10')](_0x2a9217)[_0x28d4('0xe')](function(_0x43d894){return _0x43d894?_['toString'](_0x43d894):'';})['value']();});}function createTable(_0x534809,_0x15eb40){var _0x1a3db5={'widths':_[_0x28d4('0x11')](Array(_0x534809[_0x28d4('0x12')]),0x91),'heights':function(_0x36d9c1){return _0x36d9c1===0x0?_0x28d4('0x13'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x24389d=getHeaders(_0x534809);_0x1a3db5[_0x28d4('0x14')]['push'](_0x24389d);var _0x3e5689=getRows(_0x534809,_0x15eb40);_0x1a3db5[_0x28d4('0x14')]=_0x1a3db5[_0x28d4('0x14')][_0x28d4('0x15')](_0x3e5689);return _0x1a3db5;}function createTables(_0x329039){var _0x52f960=[];var _0x37c58=_[_0x28d4('0x16')](Object[_0x28d4('0x17')](_0x329039[0x0]),0x5);_0x37c58['forEach'](function(_0x1a0871){_0x52f960[_0x28d4('0x18')](createTable(_0x1a0871,_0x329039));});return _0x52f960;}function getPDFDocDefinition(_0x1d84cd){var _0x124cf3=util['format'](_0x28d4('0x19'),NAME,EXTRACTED_REPORT[_0x28d4('0x1a')],moment(EXTRACTED_REPORT[_0x28d4('0x1b')])[_0x28d4('0x1c')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0x28d4('0x1c')](FORMAT));var _0x2a619c=[];for(var _0xc280e8=0x0;_0xc280e8<_0x1d84cd['length'];_0xc280e8++){var _0x1ec52b=[];if(_0xc280e8===0x0){_0x1ec52b[_0x28d4('0x18')]({'text':_0x124cf3,'style':_0x28d4('0x1d')});}var _0x1b272e={'table':_0x1d84cd[_0xc280e8]};if(_0xc280e8>0x0){_0x1b272e[_0x28d4('0x1e')]=_0x28d4('0x1f');_0x1b272e[_0x28d4('0x20')]=[0x0,0x46,0x0,0x0];}_0x1ec52b[_0x28d4('0x18')](_0x1b272e);_0x2a619c[_0x28d4('0x18')](_0x1ec52b);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x2a619c,'footer':function(_0x321f8d,_0x433a41){return{'text':_0x321f8d['toString']()+_0x28d4('0x21')+_0x433a41,'style':_0x28d4('0x22')};},'defaultStyle':{'font':_0x28d4('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x7e1f95){var _0x152e1b=0x1388;var _0x36a469;if(!_0x7e1f95[0x0][_0x28d4('0x24')]){return analyticExtractedReport(_0x28d4('0x25'));}return db['Setting'][_0x28d4('0x26')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x28d4('0x27'),_0x28d4('0x28')]})[_0x28d4('0x29')](function(_0x126705){if(_0x126705){_0x36a469=_0x126705;_0x152e1b=_0x36a469[_0x28d4('0x28')]||0x3e8;}})['then'](function(){var _0x4e69a6=[];var _0x21b553=0x0;if(_0x36a469[_0x28d4('0x27')]){if(_0x7e1f95&&_0x7e1f95[_0x28d4('0x12')]){var _0x373fc6=_[_0x28d4('0x2a')](_0x7e1f95[0x0][_0x28d4('0x24')]/_0x152e1b);var _0x3eaef0=Number['isInteger'](_0x7e1f95[0x0]['num']/_0x152e1b)?_0x7e1f95[0x0][_0x28d4('0x24')]%_0x152e1b:0x0;_0x373fc6[_0x28d4('0x2b')](function(_0x3ae9fe){if(_0x3ae9fe>0x0){_0x21b553+=_0x152e1b;}_0x4e69a6[_0x28d4('0x18')](dbH['sequelize'][_0x28d4('0x2c')](util[_0x28d4('0x1c')](_0x28d4('0x2d'),QUERY,_0x152e1b,_0x21b553),{'type':dbH[_0x28d4('0x2e')][_0x28d4('0x2f')][_0x28d4('0x30')]}));});if(_0x3eaef0>0x0){_0x21b553+=_0x152e1b;_0x4e69a6['push'](dbH[_0x28d4('0x2e')][_0x28d4('0x2c')](util[_0x28d4('0x1c')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x3eaef0,_0x21b553),{'type':dbH['sequelize'][_0x28d4('0x2f')][_0x28d4('0x30')]}));}}}else{_0x4e69a6[_0x28d4('0x18')](dbH['sequelize'][_0x28d4('0x2c')](QUERY,{'type':dbH[_0x28d4('0x2e')][_0x28d4('0x2f')]['SELECT']}));}var _0x532a1b=path[_0x28d4('0x31')](PATH);var _0x481c40=path[_0x28d4('0x32')](PATH,'.pdf');var _0x5c310a=_0x36a469[_0x28d4('0x27')]&&_0x4e69a6[_0x28d4('0x12')]>0x1;var _0x37f16e=[];if(!fs[_0x28d4('0x33')](path[_0x28d4('0x34')](_0x532a1b,_0x481c40))&&_0x5c310a){fs[_0x28d4('0x35')](path[_0x28d4('0x34')](_0x532a1b,_0x481c40));}return BPromise[_0x28d4('0x36')](_0x4e69a6,function(_0x102dd3){_0x37f16e[_0x28d4('0x18')](_0x102dd3);})[_0x28d4('0x29')](function(){var _0x57ac4b=[];for(var _0x204090=0x0;_0x204090<_0x37f16e[_0x28d4('0x12')];_0x204090+=0x1){var _0x38ce4=_0x37f16e[_0x204090];var _0x4004c6=createTables(_[_0x28d4('0x37')](_0x38ce4));var _0x447dc9;var _0x41e4d2=getPDFDocDefinition(_0x4004c6);var _0x1636a7=getPDFPrinter();var _0x50e76e=_0x1636a7[_0x28d4('0x38')](_0x41e4d2);if(_0x5c310a){_0x447dc9=path[_0x28d4('0x34')](_0x532a1b,_0x481c40,util[_0x28d4('0x1c')](_0x28d4('0x39'),_0x481c40,_0x204090,'pdf'));}else{_0x447dc9=path[_0x28d4('0x34')](_0x532a1b,util[_0x28d4('0x1c')](_0x28d4('0x3a'),_0x481c40,_0x28d4('0x3b')));}_0x57ac4b['push'](writePDFDocument(_0x50e76e,_0x447dc9));}return Promise['all'](_0x57ac4b);})['then'](function(){if(_0x5c310a){return new Promise(function(_0xf65876){zipdir(path['join'](_0x532a1b,_0x481c40),{'saveTo':path[_0x28d4('0x34')](_0x532a1b,util['format'](_0x28d4('0x3a'),_0x481c40,_0x28d4('0x3c')))},function(){rimraf(path['join'](_0x532a1b,_0x481c40),function(){});_0xf65876(_0x28d4('0x3d'));});});}})[_0x28d4('0x29')](function(){if(!_0x5c310a)return;rimraf(path['join'](_0x532a1b,_0x481c40),function(){});})[_0x28d4('0x29')](function(){logger[_0x28d4('0x3e')](util[_0x28d4('0x1c')](_0x28d4('0x3f'),EXTRACTED_REPORT_ID,_0x28d4('0x40')));return analyticExtractedReport(_0x28d4('0x41'),_0x5c310a?util['format'](_0x28d4('0x3a'),_0x481c40,_0x5c310a?_0x28d4('0x3c'):_0x28d4('0x3b')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x28d4('0x3e')](util[_0x28d4('0x1c')](_0x28d4('0x42'),EXTRACTED_REPORT_ID,_0x28d4('0x40')));return db[_0x28d4('0xc')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0x28d4('0x29')](function(_0x111299){EXTRACTED_REPORT=_0x111299;return dbH['sequelize'][_0x28d4('0x2c')](util[_0x28d4('0x1c')](_0x28d4('0x43'),QUERY),{'type':dbH['sequelize']['QueryTypes'][_0x28d4('0x30')]});})[_0x28d4('0x29')](extractReport)['catch'](function(_0x20309d){logger[_0x28d4('0x3e')](util[_0x28d4('0x1c')](_0x28d4('0x44'),EXTRACTED_REPORT_ID,_0x28d4('0x40')),util['inspect'](_0x20309d,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x28d4('0x45'));})[_0x28d4('0x46')](function(){process[_0x28d4('0x47')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x18e33c=new PdfPrinter({'Arial':{'normal':__dirname+_0x28d4('0x48'),'bold':__dirname+_0x28d4('0x49'),'italics':__dirname+_0x28d4('0x4a'),'bolditalics':__dirname+_0x28d4('0x4b')}});return _0x18e33c;}function getPDFDocDefinitionFromHTML(_0xdab44f,_0x50b7ef){var _0x2c9901=util['format']('%s\x20#%d',_0x50b7ef[_0x28d4('0x4c')],_0x50b7ef[_0x28d4('0x4d')]);var _0x5eea9e=moment()[_0x28d4('0x1c')](_0x28d4('0x4e'))['toString']();var _0x23ff4e=htmlToPdfmake(_0xdab44f,{'window':window,'tableAutoSize':!![]});return{'content':[_0x23ff4e],'defaultStyle':{'font':_0x28d4('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x28d4('0x4f'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':'center','margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0x28d4('0x50'),'style':_0x28d4('0x1d')}];},'footer':function(_0x1494b5,_0x4c461d){return[{'text':util['format'](_0x28d4('0x51'),_0x2c9901,_0x1494b5,_0x4c461d,_0x5eea9e),'style':_0x28d4('0x22')}];}};}function writePDFDocument(_0x1fca2c,_0x12a6fa){return new Promise(function(_0x14cd66,_0x3b5583){var _0x55995b=_0x1fca2c[_0x28d4('0x52')](fs[_0x28d4('0x53')](_0x12a6fa));_0x55995b['on'](_0x28d4('0x54'),function(){_0x14cd66(_0x28d4('0x54'));});_0x55995b['on']('error',function(_0x537b6e){_0x3b5583(_0x537b6e);});_0x1fca2c['end']();});}exports['createPdfFromHTML']=function(_0x39179c,_0x5ecf94){var _0x500c4f=getPDFPrinter();var _0x37cb16=getPDFDocDefinitionFromHTML(_0x39179c,_0x5ecf94);var _0xda4854=_0x500c4f[_0x28d4('0x38')](_0x37cb16);return writePDFDocument(_0xda4854,_0x5ecf94[_0x28d4('0x1')])[_0x28d4('0x55')](function(_0x3b6c1d){throw _0x3b6c1d;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 6a16fd9..9b6d3e5 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 _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 +var _0x6200=['SELECT','num','Empty','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','.xlsx','length','existsSync','join','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip\x20finished','Completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','util','path','json2xls','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','savename','info','format','XLSX','find','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes'];(function(_0x170cbb,_0x9093e){var _0x39fae4=function(_0x120b6b){while(--_0x120b6b){_0x170cbb['push'](_0x170cbb['shift']());}};_0x39fae4(++_0x9093e);}(_0x6200,0x192));var _0x0620=function(_0x8c2e44,_0x21c70c){_0x8c2e44=_0x8c2e44-0x0;var _0x1fc661=_0x6200[_0x8c2e44];return _0x1fc661;};'use strict';var util=require(_0x0620('0x0'));var path=require(_0x0620('0x1'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0x0620('0x2'));var BPromise=require('bluebird');var zipdir=require(_0x0620('0x3'));var rimraf=require(_0x0620('0x4'));var db=require(_0x0620('0x5'))['db'];var dbH=require(_0x0620('0x5'))[_0x0620('0x6')];var logger=require('../../config/logger')(_0x0620('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x0620('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x0620('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x4aa728,_0x2caed7){var _0xf54af={'status':_0x4aa728};var _0x4728ce={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2caed7){_0xf54af[_0x0620('0x9')]=_0x2caed7;}return db['AnalyticExtractedReport']['update'](_0xf54af,_0x4728ce);}function main(){var _0x56aa72=0x1388;var _0xb0f8e6;logger[_0x0620('0xa')](util[_0x0620('0xb')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x0620('0xc')));return db['Setting'][_0x0620('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x0620('0xe'),_0x0620('0xf')]})['then'](function(_0x558eab){if(_0x558eab){_0xb0f8e6=_0x558eab;_0x56aa72=_0xb0f8e6[_0x0620('0xf')]||0x1388;}})[_0x0620('0x10')](function(){return dbH[_0x0620('0x11')][_0x0620('0x12')](util[_0x0620('0xb')](_0x0620('0x13'),QUERY),{'type':dbH[_0x0620('0x11')][_0x0620('0x14')][_0x0620('0x15')]});})[_0x0620('0x10')](function(_0x19a09a){if(!_0x19a09a[0x0][_0x0620('0x16')]){return analyticExtractedReport(_0x0620('0x17'));}var _0x1a57a2=[];var _0x18fec2=0x0;if(_0xb0f8e6[_0x0620('0xe')]){if(_0x19a09a&&_0x19a09a['length']){var _0x111422=_['range'](_0x19a09a[0x0]['num']/_0x56aa72);var _0x5b2d81=Number[_0x0620('0x18')](_0x19a09a[0x0][_0x0620('0x16')]/_0x56aa72)?_0x19a09a[0x0][_0x0620('0x16')]%_0x56aa72:0x0;_0x111422[_0x0620('0x19')](function(_0x2f7b24){if(_0x2f7b24>0x0){_0x18fec2+=_0x56aa72;}_0x1a57a2[_0x0620('0x1a')](dbH[_0x0620('0x11')]['query'](util['format'](_0x0620('0x1b'),QUERY,_0x56aa72,_0x18fec2),{'type':dbH[_0x0620('0x11')][_0x0620('0x14')][_0x0620('0x15')]}));});if(_0x5b2d81>0x0){_0x18fec2+=_0x56aa72;_0x1a57a2['push'](dbH[_0x0620('0x11')]['query'](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x5b2d81,_0x18fec2),{'type':dbH['sequelize'][_0x0620('0x14')][_0x0620('0x15')]}));}}}else{_0x1a57a2[_0x0620('0x1a')](dbH['sequelize']['query'](QUERY,{'type':dbH['sequelize'][_0x0620('0x14')]['SELECT']}));}var _0x4bbdc0=path[_0x0620('0x1c')](PATH);var _0x397295=path['basename'](PATH,_0x0620('0x1d'));var _0x3a2f29=_0xb0f8e6[_0x0620('0xe')]&&_0x1a57a2[_0x0620('0x1e')]>0x1;var _0x388d5c=[];if(!fs[_0x0620('0x1f')](path[_0x0620('0x20')](_0x4bbdc0,_0x397295))&&_0x3a2f29){fs['mkdirSync'](path[_0x0620('0x20')](_0x4bbdc0,_0x397295));}return BPromise[_0x0620('0x21')](_0x1a57a2,function(_0x2ba47e){_0x388d5c['push'](_0x2ba47e);})[_0x0620('0x10')](function(){for(var _0x270133=0x0;_0x270133<_0x388d5c[_0x0620('0x1e')];_0x270133+=0x1){var _0x198d07;var _0x22d756=_0x388d5c[_0x270133];if(_0x3a2f29){_0x198d07=path['join'](_0x4bbdc0,_0x397295,util['format'](_0x0620('0x22'),_0x397295,_0x270133,_0x0620('0x23')));}else{_0x198d07=path[_0x0620('0x20')](_0x4bbdc0,util['format'](_0x0620('0x24'),_0x397295,'xlsx'));}fs[_0x0620('0x25')](_0x198d07,json2xls(_0x22d756),_0x0620('0x26'));}})[_0x0620('0x10')](function(){if(_0x3a2f29){return new Promise(function(_0x434c51){zipdir(path[_0x0620('0x20')](_0x4bbdc0,_0x397295),{'saveTo':path[_0x0620('0x20')](_0x4bbdc0,util['format'](_0x0620('0x24'),_0x397295,'zip'))},function(_0x2a8b74,_0x3192f){rimraf(path['join'](_0x4bbdc0,_0x397295),function(){});_0x434c51(_0x0620('0x27'));});});}})[_0x0620('0x10')](function(){logger[_0x0620('0xa')](util[_0x0620('0xb')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x0620('0xc')));return analyticExtractedReport(_0x0620('0x28'),_0x3a2f29?util['format'](_0x0620('0x24'),_0x397295,_0x3a2f29?_0x0620('0x29'):_0x0620('0x23')):null);});})[_0x0620('0x2a')](function(_0x1c4232){logger[_0x0620('0xa')](util[_0x0620('0xb')](_0x0620('0x2b'),EXTRACTED_REPORT_ID,_0x0620('0xc')),util['inspect'](_0x1c4232,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x0620('0x2c'));})[_0x0620('0x2d')](function(){process[_0x0620('0x2e')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 60f3f45..21f66b4 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 _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 +var _0xe03f=['updatedAt','interval','*,*,*,*','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','Hangup','concat','transaction','destroy','sortBy','catch','error','rewrite','lodash','util','models','Interval','findAll','then','intervals','VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','find','push','type','Set','CDR(type)=%s','context','VoiceExtensionId','inbound','CDR(routeid)=','outbound','extension','CDR(destination)=','cutdigits','${EXTEN}','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-PROGRESS=0','length','toLowerCase','createdAt'];(function(_0x384c31,_0x376d4a){var _0x2bd574=function(_0x4791ce){while(--_0x4791ce){_0x384c31['push'](_0x384c31['shift']());}};_0x2bd574(++_0x376d4a);}(_0xe03f,0x1d1));var _0xfe03=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe03f[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xfe03('0x0'));var util=require(_0xfe03('0x1'));function rewrite(_0x345c50,_0x3565a7){var _0xc95356=this;return _0x345c50[_0xfe03('0x2')][_0xfe03('0x3')][_0xfe03('0x4')]({'raw':!![]})[_0xfe03('0x5')](function(_0x671695){_0xc95356[_0xfe03('0x6')]=_0x671695;return _0x345c50[_0xfe03('0x2')][_0xfe03('0x7')][_0xfe03('0x4')]({'where':{'IntervalId':_0x3565a7[_0xfe03('0x8')]},'raw':!![]});})[_0xfe03('0x5')](function(_0x36e75a){return _0x345c50[_0xfe03('0x2')][_0xfe03('0x7')][_0xfe03('0x4')]({'where':{'exten':{'$in':_[_0xfe03('0x9')](_[_0xfe03('0xa')](_0x36e75a,_0xfe03('0xb')))}},'order':[{'raw':_0xfe03('0xc')}],'raw':!![]});})[_0xfe03('0x5')](function(_0x505bb7){var _0x493839=_['filter'](_0x505bb7,{'priority':'1'});var _0x117d8e=_[_0xfe03('0xd')](_0x505bb7,{'isApp':0x1});var _0xbe0c13=_[_0xfe03('0xe')](_0x117d8e,_0xfe03('0xb'));var _0x49bcc7=[_0xfe03('0xf'),_0xfe03('0x10')];var _0x175ea4=[];var _0x455370=[];for(var _0x1a950f in _0xbe0c13){if(_0xbe0c13[_0xfe03('0x11')](_0x1a950f)){_0xc95356[_0xfe03('0x12')]=0x2;_0xc95356[_0xfe03('0x13')]=[];_0xc95356['extension']=_[_0xfe03('0x14')](_0x493839,{'exten':_0xbe0c13[_0x1a950f][0x0][_0xfe03('0xb')]});_0xc95356[_0xfe03('0x13')][_0xfe03('0x15')]({'type':_0xbe0c13[_0x1a950f][0x0][_0xfe03('0x16')],'app':_0xfe03('0x17'),'appdata':util['format'](_0xfe03('0x18'),_0xbe0c13[_0x1a950f][0x0][_0xfe03('0x16')]),'context':_0xbe0c13[_0x1a950f][0x0][_0xfe03('0x19')],'exten':_0xbe0c13[_0x1a950f][0x0][_0xfe03('0xb')],'priority':_0xc95356[_0xfe03('0x12')]++,'VoiceExtensionId':_0xbe0c13[_0x1a950f][0x0][_0xfe03('0x1a')]});if(_0xbe0c13[_0x1a950f][0x0][_0xfe03('0x16')]===_0xfe03('0x1b')){_0xc95356[_0xfe03('0x13')][_0xfe03('0x15')]({'type':_0xbe0c13[_0x1a950f][0x0]['type'],'app':_0xfe03('0x17'),'appdata':_0xfe03('0x1c')+_0xbe0c13[_0x1a950f][0x0]['VoiceExtensionId'],'context':_0xbe0c13[_0x1a950f][0x0][_0xfe03('0x19')],'exten':_0xbe0c13[_0x1a950f][0x0][_0xfe03('0xb')],'priority':_0xc95356[_0xfe03('0x12')]++,'VoiceExtensionId':_0xbe0c13[_0x1a950f][0x0][_0xfe03('0x1a')]});}else if(_0xbe0c13[_0x1a950f][0x0][_0xfe03('0x16')]===_0xfe03('0x1d')){if(_0xc95356[_0xfe03('0x1e')]){_0xc95356[_0xfe03('0x13')][_0xfe03('0x15')]({'type':_0xbe0c13[_0x1a950f][0x0][_0xfe03('0x16')],'app':_0xfe03('0x17'),'appdata':_0xfe03('0x1f')+(_0xc95356['extension'][_0xfe03('0x20')]?'${EXTEN:'+_0xc95356[_0xfe03('0x1e')][_0xfe03('0x20')]+'}':_0xfe03('0x21')),'context':_0xbe0c13[_0x1a950f][0x0][_0xfe03('0x19')],'exten':_0xbe0c13[_0x1a950f][0x0][_0xfe03('0xb')],'priority':_0xc95356[_0xfe03('0x12')]++,'VoiceExtensionId':_0xbe0c13[_0x1a950f][0x0]['VoiceExtensionId']});}_0xc95356[_0xfe03('0x13')][_0xfe03('0x15')]({'type':_0xbe0c13[_0x1a950f][0x0][_0xfe03('0x16')],'app':_0xfe03('0x17'),'appdata':_0xfe03('0x1c')+_0xbe0c13[_0x1a950f][0x0][_0xfe03('0x1a')],'context':_0xbe0c13[_0x1a950f][0x0]['context'],'exten':_0xbe0c13[_0x1a950f][0x0]['exten'],'priority':_0xc95356[_0xfe03('0x12')]++,'VoiceExtensionId':_0xbe0c13[_0x1a950f][0x0][_0xfe03('0x1a')]});var _0xdf02e6=_0xc95356[_0xfe03('0x12')]++;_0xc95356['extensions'][_0xfe03('0x15')]({'type':_0xbe0c13[_0x1a950f][0x0][_0xfe03('0x16')],'app':_0xfe03('0x22'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0xdf02e6+0x2)+_0xfe03('0x23')+(_0xdf02e6+0x1)+')','context':_0xbe0c13[_0x1a950f][0x0]['context'],'exten':_0xbe0c13[_0x1a950f][0x0][_0xfe03('0xb')],'priority':_0xdf02e6,'VoiceExtensionId':_0xbe0c13[_0x1a950f][0x0][_0xfe03('0x1a')]});if(_0xc95356[_0xfe03('0x1e')]){_0xc95356['extensions'][_0xfe03('0x15')]({'type':_0xbe0c13[_0x1a950f][0x0][_0xfe03('0x16')],'app':_0xfe03('0x17'),'appdata':_0xc95356['extension']['cutdigits']?_0xfe03('0x24')+_0xc95356[_0xfe03('0x1e')]['cutdigits']+'}':_0xfe03('0x25'),'context':_0xbe0c13[_0x1a950f][0x0][_0xfe03('0x19')],'exten':_0xbe0c13[_0x1a950f][0x0]['exten'],'priority':_0xc95356['priority']++,'VoiceExtensionId':_0xbe0c13[_0x1a950f][0x0][_0xfe03('0x1a')]});}_0xc95356[_0xfe03('0x13')]['push']({'type':_0xbe0c13[_0x1a950f][0x0][_0xfe03('0x16')],'app':_0xfe03('0x17'),'appdata':_0xfe03('0x26')+_0xbe0c13[_0x1a950f][0x0][_0xfe03('0x1a')],'context':_0xbe0c13[_0x1a950f][0x0]['context'],'exten':_0xbe0c13[_0x1a950f][0x0][_0xfe03('0xb')],'priority':_0xc95356['priority']++,'VoiceExtensionId':_0xbe0c13[_0x1a950f][0x0][_0xfe03('0x1a')]});if(_0xc95356[_0xfe03('0x1e')]&&_0xc95356[_0xfe03('0x1e')][_0xfe03('0x11')](_0xfe03('0x27'))&&_0xc95356['extension'][_0xfe03('0x27')]!=='none'){_0xc95356[_0xfe03('0x13')][_0xfe03('0x15')]({'type':_0xbe0c13[_0x1a950f][0x0][_0xfe03('0x16')],'app':_0xfe03('0x17'),'appdata':_0xfe03('0x28'),'context':_0xbe0c13[_0x1a950f][0x0][_0xfe03('0x19')],'exten':_0xbe0c13[_0x1a950f][0x0][_0xfe03('0xb')],'priority':_0xc95356[_0xfe03('0x12')]++,'VoiceExtensionId':_0xbe0c13[_0x1a950f][0x0][_0xfe03('0x1a')]});_0xc95356[_0xfe03('0x13')][_0xfe03('0x15')]({'type':_0xbe0c13[_0x1a950f][0x0][_0xfe03('0x16')],'app':_0xfe03('0x17'),'appdata':_0xfe03('0x29')+_0xc95356['extension'][_0xfe03('0x27')]||'wav','context':_0xbe0c13[_0x1a950f][0x0][_0xfe03('0x19')],'exten':_0xbe0c13[_0x1a950f][0x0][_0xfe03('0xb')],'priority':_0xc95356[_0xfe03('0x12')]++,'VoiceExtensionId':_0xbe0c13[_0x1a950f][0x0][_0xfe03('0x1a')]});}}_0xc95356[_0xfe03('0x13')][_0xfe03('0x15')]({'type':_0xbe0c13[_0x1a950f][0x0][_0xfe03('0x16')],'app':_0xfe03('0x17'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0xbe0c13[_0x1a950f][0x0][_0xfe03('0x19')],'exten':_0xbe0c13[_0x1a950f][0x0][_0xfe03('0xb')],'priority':_0xc95356['priority']++,'VoiceExtensionId':_0xbe0c13[_0x1a950f][0x0][_0xfe03('0x1a')]});_0xc95356[_0xfe03('0x13')][_0xfe03('0x15')]({'type':_0xbe0c13[_0x1a950f][0x0]['type'],'app':'Set','appdata':_0xfe03('0x2a'),'context':_0xbe0c13[_0x1a950f][0x0][_0xfe03('0x19')],'exten':_0xbe0c13[_0x1a950f][0x0]['exten'],'priority':_0xc95356[_0xfe03('0x12')]++,'VoiceExtensionId':_0xbe0c13[_0x1a950f][0x0][_0xfe03('0x1a')]});_0xc95356[_0xfe03('0x13')]['push']({'type':_0xbe0c13[_0x1a950f][0x0][_0xfe03('0x16')],'app':_0xfe03('0x17'),'appdata':'MONITOR_OPTIONS=ab','context':_0xbe0c13[_0x1a950f][0x0]['context'],'exten':_0xbe0c13[_0x1a950f][0x0][_0xfe03('0xb')],'priority':_0xc95356[_0xfe03('0x12')]++,'VoiceExtensionId':_0xbe0c13[_0x1a950f][0x0]['VoiceExtensionId']});for(var _0x25639e=0x0,_0x23e057=0x0;_0x25639e<_0xbe0c13[_0x1a950f][_0xfe03('0x2b')];_0x25639e+=0x1,_0x23e057=0x0){var _0x5b4687=_0xbe0c13[_0x1a950f][_0x25639e];if(_0x5b4687[_0xfe03('0x16')]){_0x5b4687[_0xfe03('0x16')]=_0x5b4687[_0xfe03('0x16')][_0xfe03('0x2c')]();}var _0x4a83e9=[];var _0xccf732=[];delete _0x5b4687['id'];delete _0x5b4687[_0xfe03('0x2d')];delete _0x5b4687[_0xfe03('0x2e')];var _0x3d34da=_0x5b4687[_0xfe03('0x2f')]!==_0xfe03('0x30')?[_0x5b4687[_0xfe03('0x2f')]]:_0x5b4687[_0xfe03('0x8')]?_[_0xfe03('0xa')](_[_0xfe03('0xd')](_0xc95356[_0xfe03('0x6')],{'IntervalId':_0x5b4687[_0xfe03('0x8')]}),_0xfe03('0x2f')):[];if(_0x5b4687[_0xfe03('0x11')](_0xfe03('0x31'))){if(_0x5b4687[_0xfe03('0x31')]&&_0x5b4687[_0xfe03('0x31')]!=='--'){_0x4a83e9['push']({'type':_0x5b4687[_0xfe03('0x16')],'app':_0xfe03('0x17'),'appdata':_0xfe03('0x32')+_0x5b4687[_0xfe03('0x31')],'context':_0x5b4687[_0xfe03('0x19')],'exten':_0x5b4687[_0xfe03('0xb')],'priority':_0x3d34da[_0xfe03('0x2b')]+_0xc95356['priority']+_0x23e057++,'VoiceExtensionId':_0x5b4687['VoiceExtensionId']});}}if(_0x5b4687['type']===_0xfe03('0x1d')&&_0x5b4687[_0xfe03('0x11')]('callerID')){if(_0x5b4687[_0xfe03('0x33')]){_0x4a83e9[_0xfe03('0x15')]({'type':_0x5b4687[_0xfe03('0x16')],'app':'ExecIf','appdata':_0xfe03('0x34')+_0x5b4687[_0xfe03('0x33')]+')','context':_0x5b4687['context'],'exten':_0x5b4687['exten'],'priority':_0x3d34da[_0xfe03('0x2b')]+_0xc95356[_0xfe03('0x12')]+_0x23e057++,'VoiceExtensionId':_0x5b4687[_0xfe03('0x1a')]});}else{_0x4a83e9[_0xfe03('0x15')]({'type':_0x5b4687[_0xfe03('0x16')],'app':'ExecIf','appdata':_0xfe03('0x35'),'context':_0x5b4687[_0xfe03('0x19')],'exten':_0x5b4687[_0xfe03('0xb')],'priority':_0x3d34da[_0xfe03('0x2b')]+_0xc95356[_0xfe03('0x12')]+_0x23e057++,'VoiceExtensionId':_0x5b4687[_0xfe03('0x1a')]});}}if(_0x5b4687[_0xfe03('0x11')](_0xfe03('0x36'))){if(_0x49bcc7[_0xfe03('0x37')](_0x5b4687[_0xfe03('0x38')]['toLowerCase']())>=0x0&&_0x5b4687[_0xfe03('0x39')]!=='custom'){if(_0x5b4687['answer']){_0x4a83e9[_0xfe03('0x15')]({'type':_0x5b4687[_0xfe03('0x16')],'app':_0xfe03('0x22'),'appdata':_0xfe03('0x3a'),'context':_0x5b4687[_0xfe03('0x19')],'exten':_0x5b4687['exten'],'priority':_0x3d34da[_0xfe03('0x2b')]+_0xc95356[_0xfe03('0x12')]+_0x23e057++,'VoiceExtensionId':_0x5b4687[_0xfe03('0x1a')]});_0x4a83e9[_0xfe03('0x15')]({'type':_0x5b4687[_0xfe03('0x16')],'app':_0xfe03('0x17'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x5b4687['context'],'exten':_0x5b4687[_0xfe03('0xb')],'priority':_0x3d34da[_0xfe03('0x2b')]+_0xc95356[_0xfe03('0x12')]+_0x23e057++,'VoiceExtensionId':_0x5b4687['VoiceExtensionId']});}else{_0x4a83e9[_0xfe03('0x15')]({'type':_0x5b4687[_0xfe03('0x16')],'app':_0xfe03('0x22'),'appdata':_0xfe03('0x3b'),'context':_0x5b4687['context'],'exten':_0x5b4687[_0xfe03('0xb')],'priority':_0x3d34da['length']+_0xc95356[_0xfe03('0x12')]+_0x23e057++,'VoiceExtensionId':_0x5b4687['VoiceExtensionId']});_0x4a83e9[_0xfe03('0x15')]({'type':_0x5b4687[_0xfe03('0x16')],'app':_0xfe03('0x17'),'appdata':_0xfe03('0x3c'),'context':_0x5b4687[_0xfe03('0x19')],'exten':_0x5b4687[_0xfe03('0xb')],'priority':_0x3d34da[_0xfe03('0x2b')]+_0xc95356['priority']+_0x23e057++,'VoiceExtensionId':_0x5b4687[_0xfe03('0x1a')]});}}}for(var _0x182255=0x0;_0x182255<_0x3d34da[_0xfe03('0x2b')];_0x182255+=0x1){var _0xad6862=_0xc95356[_0xfe03('0x12')]+_0x3d34da[_0xfe03('0x2b')];var _0x3e14db=_0x182255===_0x3d34da[_0xfe03('0x2b')]-0x1?_0xc95356[_0xfe03('0x12')]+_0x4a83e9[_0xfe03('0x2b')]+_0xccf732[_0xfe03('0x2b')]+0x2:_0xc95356['priority']+_0x182255+0x1;_0x4a83e9[_0xfe03('0x3d')](_0x182255,0x0,{'type':_0x5b4687[_0xfe03('0x16')],'app':_0xfe03('0x3e'),'appdata':_0x3d34da[_0x182255]+'?'+_0x5b4687[_0xfe03('0x19')]+_0xfe03('0x3f')+_0xad6862+':'+_0x5b4687[_0xfe03('0x19')]+_0xfe03('0x3f')+_0x3e14db,'exten':_0x5b4687[_0xfe03('0xb')],'context':_0x5b4687[_0xfe03('0x19')],'priority':_0xc95356[_0xfe03('0x12')]+_0x182255,'VoiceExtensionId':_0xbe0c13[_0x1a950f][0x0][_0xfe03('0x1a')]});}_0x5b4687[_0xfe03('0x12')]=_0x4a83e9['length']?_[_0xfe03('0x40')](_0x4a83e9)['priority']+0x1:_0xc95356[_0xfe03('0x12')];_0xc95356[_0xfe03('0x12')]=(_0xccf732[_0xfe03('0x2b')]?_[_0xfe03('0x40')](_0xccf732)[_0xfe03('0x12')]:_0x5b4687['priority'])+0x1;_0xc95356[_0xfe03('0x13')]=_['concat'](_0xc95356[_0xfe03('0x13')],_0x4a83e9,[_0x5b4687],_0xccf732);}_0xc95356[_0xfe03('0x13')][_0xfe03('0x15')]({'type':_0xbe0c13[_0x1a950f][0x0]['type'],'app':_0xfe03('0x41'),'exten':_0xbe0c13[_0x1a950f][0x0][_0xfe03('0xb')],'context':_0xbe0c13[_0x1a950f][0x0][_0xfe03('0x19')],'priority':_0xc95356[_0xfe03('0x12')],'VoiceExtensionId':_0xbe0c13[_0x1a950f][0x0][_0xfe03('0x1a')]});_0x175ea4['push'](_0xbe0c13[_0x1a950f][0x0][_0xfe03('0x1a')]);_0x455370=_[_0xfe03('0x42')](_0x455370,_0xc95356[_0xfe03('0x13')]);}}return _0x345c50[_0xfe03('0x43')](function(_0x6ceff9){return _0x345c50[_0xfe03('0x2')]['VoiceExtension'][_0xfe03('0x44')]({'where':{'VoiceExtensionId':{'$in':_0x175ea4}},'transaction':_0x6ceff9})['then'](function(_0x378116){return _0x345c50[_0xfe03('0x2')][_0xfe03('0x7')]['bulkCreate'](_[_0xfe03('0x45')](_0x455370,'priority'),{'transaction':_0x6ceff9});});});})[_0xfe03('0x46')](function(_0x274b23){console[_0xfe03('0x47')](_0x274b23);});}exports[_0xfe03('0x48')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 3c8dfec..2419815 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 _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 +var _0xd1cc=['CmList','get','Campaign','always','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','stringify','emit','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','info','CSV\x20import\x20process\x20stopped!','createReadStream','parse','pause','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','papaparse','ioredis','../../../config/environment','../../../config/logger','api','redis','defaults','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','split','contact','index','test','isNil','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','join','hasOwnProperty','data','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','push','catch','Error\x20while\x20creating\x20contact:\x20','message','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','toString','where','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','from','\x20=\x20?','cm_contacts','deletedAt\x20IS\x20NULL','id\x20IN\x20?','calleridnum','cm_hopper_final','str','VoiceQueue','findAll','outbound','dialCheckDuplicateType','Lists','sequelize','VoiceQueueId','query','all'];(function(_0xe3201b,_0x100ecc){var _0x2e053e=function(_0x183cca){while(--_0x183cca){_0xe3201b['push'](_0xe3201b['shift']());}};_0x2e053e(++_0x100ecc);}(_0xd1cc,0xf1));var _0xcd1c=function(_0x2860ee,_0x50be6b){_0x2860ee=_0x2860ee-0x0;var _0x12ee22=_0xd1cc[_0x2860ee];return _0x12ee22;};'use strict';var BPromise=require(_0xcd1c('0x0'));var util=require(_0xcd1c('0x1'));var _=require(_0xcd1c('0x2'));var fs=require('fs');var squel=require(_0xcd1c('0x3'));var Papa=require(_0xcd1c('0x4'));var Redis=require(_0xcd1c('0x5'));var db=require('../../../mysqldb')['db'];var config=require(_0xcd1c('0x6'));var logger=require(_0xcd1c('0x7'))(_0xcd1c('0x8'));config[_0xcd1c('0x9')]=_[_0xcd1c('0xa')](config[_0xcd1c('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xcd1c('0xb'))(new Redis(config[_0xcd1c('0x9')]));require(_0xcd1c('0xc'))[_0xcd1c('0xd')](socket);try{if(!process[_0xcd1c('0xe')][0x2]||process[_0xcd1c('0xe')][0x2]===_0xcd1c('0xf')||process['argv'][0x2]===_0xcd1c('0x10')){throw new Error(_0xcd1c('0x11'));}var FILEPATH=process[_0xcd1c('0xe')][0x2];if(!process[_0xcd1c('0xe')][0x3]||process['argv'][0x3]===_0xcd1c('0xf')||process[_0xcd1c('0xe')][0x3]===_0xcd1c('0x10')||!process[_0xcd1c('0xe')][0x4]||process[_0xcd1c('0xe')][0x4]==='undefined'||process[_0xcd1c('0xe')][0x4]===_0xcd1c('0x10')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_['zipObject'](process[_0xcd1c('0xe')][0x3]['split'](','),process[_0xcd1c('0xe')][0x4][_0xcd1c('0x12')](','));if(!process[_0xcd1c('0xe')][0x5]||process[_0xcd1c('0xe')][0x5]==='undefined'||process[_0xcd1c('0xe')][0x5]===_0xcd1c('0x10')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0xcd1c('0xe')][0x5];var COMPANYID=process[_0xcd1c('0xe')][0x6]&&process[_0xcd1c('0xe')][0x6]!==_0xcd1c('0xf')&&process[_0xcd1c('0xe')][0x6]!==_0xcd1c('0x10')?process[_0xcd1c('0xe')][0x6]:null;var DUPLICATES=process[_0xcd1c('0xe')][0x7]&&process[_0xcd1c('0xe')][0x7]!==_0xcd1c('0xf')&&process[_0xcd1c('0xe')][0x7]!==_0xcd1c('0x10')?process[_0xcd1c('0xe')][0x7]:null;if(!process[_0xcd1c('0xe')][0x8]||process['argv'][0x8]===_0xcd1c('0xf')||process['argv'][0x8]===_0xcd1c('0x10')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0xcd1c('0xe')][0x8];}catch(_0x5694e0){logger['error'](_0x5694e0);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(_0x2b4159,_0x5d8a5c,_0x3f8e8d,_0x354ae0){var _0x138bf4={'message':_0x5d8a5c};_0x138bf4[_0x2b4159]=!![];if(_0x3f8e8d){_0x138bf4[_0xcd1c('0x13')]=_0x3f8e8d;}if(_0x354ae0){_0x138bf4[_0xcd1c('0x14')]=_0x354ae0;}return _0x138bf4;}function isEmail(_0x28224c){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))*$/[_0xcd1c('0x15')](_0x28224c);}function checkRow(_0x53ef0b,_0x2b0d35,_0x4676fb){return new BPromise(function(_0x4bad14,_0x306406){if(_[_0xcd1c('0x16')](_0x53ef0b)){return _0x306406(handleCheckRowError(_0xcd1c('0x17'),_0xcd1c('0x18'),null,_0x4676fb));}if(_0x53ef0b[_0xcd1c('0x19')]&&_0x53ef0b['errors'][_0xcd1c('0x1a')]){var _0x585aac=_[_0xcd1c('0x1b')](_0x53ef0b['errors'],'message')[_0xcd1c('0x1c')](';');return _0x306406(handleCheckRowError(_0xcd1c('0x17'),_0x585aac,null,_0x4676fb));}var _0xc6c448={};for(var _0x44fdb0 in FIELDS){if(FIELDS[_0xcd1c('0x1d')](_0x44fdb0)&&FIELDS[_0x44fdb0]){_0xc6c448[_0x44fdb0]=_0x53ef0b[_0xcd1c('0x1e')][0x0][FIELDS[_0x44fdb0]]||_0x53ef0b[_0xcd1c('0x1e')][0x0]['\ufeff'+FIELDS[_0x44fdb0]];}}if(!_0xc6c448['firstName']){return _0x306406(handleCheckRowError(_0xcd1c('0x17'),_0xcd1c('0x1f'),null,_0x4676fb));}if(!_0xc6c448[_0xcd1c('0x20')]){return _0x306406(handleCheckRowError(_0xcd1c('0x17'),_0xcd1c('0x21'),null,_0x4676fb));}if(_0xc6c448['birthDate']){var _0x1a90e6=moment(_0xc6c448[_0xcd1c('0x22')],_0xcd1c('0x23'));if(!_0x1a90e6['isValid']()){return _0x306406(handleCheckRowError('error','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x4676fb));}}if(_0xc6c448[_0xcd1c('0x24')]){if(!isEmail(_0xc6c448[_0xcd1c('0x24')])){return _0x306406(handleCheckRowError(_0xcd1c('0x17'),_0xcd1c('0x25'),null,_0x4676fb));}}_0xc6c448[_0xcd1c('0x26')]=LISTID;_0xc6c448[_0xcd1c('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xcd1c('0x1a')]&&_0x2b0d35){var _0x68ee0d={};for(var _0x2f92e8=0x0,_0x1f20f2=DUPLICATES[_0xcd1c('0x1a')];_0x2f92e8<_0x1f20f2;_0x2f92e8+=0x1){_0x68ee0d[DUPLICATES[_0x2f92e8]]=_0xc6c448[DUPLICATES[_0x2f92e8]];}var _0x2fc6ce=_['find'](_0x2b0d35,_0x68ee0d);if(_0x2fc6ce){return _0x306406(handleCheckRowError(_0xcd1c('0x28'),_0xcd1c('0x29'),_0x2fc6ce,_0x4676fb));}}return db[_0xcd1c('0x2a')][_0xcd1c('0x2b')](_0xc6c448,{'raw':!![],'hooks':![],'fields':_[_0xcd1c('0x2c')](_0xc6c448)})[_0xcd1c('0x2d')](function(_0x2d3991){if(DUPLICATES&&DUPLICATES[_0xcd1c('0x1a')]&&_0x2b0d35){_0x2b0d35[_0xcd1c('0x2e')](_['pick'](_0xc6c448,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x2d3991['id'];return _0x4bad14();})[_0xcd1c('0x2f')](function(_0x5b2062){return _0x306406(handleCheckRowError(_0xcd1c('0x17'),_0xcd1c('0x30')+(_0x5b2062[_0xcd1c('0x31')]||JSON['stringify'](_0x5b2062)),null,_0x4676fb));});});}function checkHopper(){function _0x50835b(){return function(_0x1d643b){logger['error'](_0xcd1c('0x32'),_0xcd1c('0x33'),util[_0xcd1c('0x34')](_0x1d643b,{'showHidden':![],'depth':null}));};}var _0x518fda=function(_0x364d17,_0x1f4998){var _0x5eb1ba=squel[_0xcd1c('0x35')]()[_0xcd1c('0x36')](_0xcd1c('0x37'))[_0xcd1c('0x38')]([_0xcd1c('0x20'),_0xcd1c('0x39'),_0xcd1c('0x3a'),_0xcd1c('0x26'),_0x1f4998,_0xcd1c('0x3b'),_0xcd1c('0x3c')],squel[_0xcd1c('0x3d')]()[_0xcd1c('0x3e')](_0xcd1c('0x20'),_0xcd1c('0x20'))['field'](_0xcd1c('0x3f'),_0xcd1c('0x39'))[_0xcd1c('0x3e')]('id',_0xcd1c('0x3a'))['field'](LISTID['toString'](),'ListId')[_0xcd1c('0x3e')](_0x364d17['id'][_0xcd1c('0x40')](),_0x1f4998)['field']('NOW()',_0xcd1c('0x3b'))[_0xcd1c('0x3e')](_0xcd1c('0x3f'),'updatedAt')['from']('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0xcd1c('0x41')](_0xcd1c('0x42'),LISTID[_0xcd1c('0x40')]())[_0xcd1c('0x41')](_0xcd1c('0x43'))[_0xcd1c('0x41')](_0xcd1c('0x44'),squel[_0xcd1c('0x3d')]()['field'](_0xcd1c('0x20'))[_0xcd1c('0x45')](_0xcd1c('0x37'))[_0xcd1c('0x41')](_0x1f4998+_0xcd1c('0x46'),_0x364d17['id'][_0xcd1c('0x40')]())))[_0xcd1c('0x40')]();return _0x5eb1ba;};var _0xfdc2a=function(_0x5aa25e,_0x213555){var _0x433909=squel[_0xcd1c('0x35')]()[_0xcd1c('0x36')](_0xcd1c('0x37'))[_0xcd1c('0x38')](['phone',_0xcd1c('0x39'),'ContactId',_0xcd1c('0x26'),_0x213555,'createdAt',_0xcd1c('0x3c')],squel[_0xcd1c('0x3d')]()[_0xcd1c('0x3e')]('phone',_0xcd1c('0x20'))[_0xcd1c('0x3e')](_0xcd1c('0x3f'),'scheduledAt')['field']('id',_0xcd1c('0x3a'))[_0xcd1c('0x3e')](LISTID[_0xcd1c('0x40')](),_0xcd1c('0x26'))[_0xcd1c('0x3e')](_0x5aa25e['id']['toString'](),_0x213555)['field'](_0xcd1c('0x3f'),_0xcd1c('0x3b'))[_0xcd1c('0x3e')](_0xcd1c('0x3f'),_0xcd1c('0x3c'))[_0xcd1c('0x45')](_0xcd1c('0x47'))[_0xcd1c('0x41')](_0xcd1c('0x48'))[_0xcd1c('0x41')]('ListId\x20=\x20?',LISTID[_0xcd1c('0x40')]())['where'](_0xcd1c('0x49'),squel['str'](hopperContacts))['where'](_0xcd1c('0x43'))[_0xcd1c('0x41')](_0xcd1c('0x44'),squel[_0xcd1c('0x3d')]()[_0xcd1c('0x3e')](_0xcd1c('0x4a'))[_0xcd1c('0x45')](_0xcd1c('0x4b'))[_0xcd1c('0x41')](_0x213555+_0xcd1c('0x46'),_0x5aa25e['id'][_0xcd1c('0x40')]()))['where'](_0xcd1c('0x44'),squel['select']()[_0xcd1c('0x3e')](_0xcd1c('0x20'))[_0xcd1c('0x45')]('cm_hopper')[_0xcd1c('0x41')](_0x213555+_0xcd1c('0x46'),_0x5aa25e['id'][_0xcd1c('0x40')]())))[_0xcd1c('0x40')]();return _0x433909;};function _0x533718(_0x27374e,_0x44c9d0){var _0x3ffda6=squel[_0xcd1c('0x35')]()[_0xcd1c('0x36')]('cm_hopper')[_0xcd1c('0x38')](['phone',_0xcd1c('0x39'),_0xcd1c('0x3a'),_0xcd1c('0x26'),_0x44c9d0,_0xcd1c('0x3b'),_0xcd1c('0x3c')],squel['select']()[_0xcd1c('0x3e')](_0xcd1c('0x20'),_0xcd1c('0x20'))[_0xcd1c('0x3e')]('NOW()',_0xcd1c('0x39'))[_0xcd1c('0x3e')]('id',_0xcd1c('0x3a'))['field'](LISTID[_0xcd1c('0x40')](),'ListId')[_0xcd1c('0x3e')](_0x27374e['id'][_0xcd1c('0x40')](),_0x44c9d0)[_0xcd1c('0x3e')](_0xcd1c('0x3f'),_0xcd1c('0x3b'))['field'](_0xcd1c('0x3f'),_0xcd1c('0x3c'))[_0xcd1c('0x45')](_0xcd1c('0x47'))[_0xcd1c('0x41')]('deletedAt\x20IS\x20NULL')[_0xcd1c('0x41')](_0xcd1c('0x42'),LISTID[_0xcd1c('0x40')]())['where'](_0xcd1c('0x49'),squel['str'](hopperContacts))['where'](_0xcd1c('0x43')))['toString']();return _0x3ffda6;}function _0x4de49b(_0x212a2b,_0x1d3c9c){var _0x3e25cc=squel[_0xcd1c('0x35')]()[_0xcd1c('0x36')]('cm_hopper_black')['fromQuery'](['phone',_0xcd1c('0x3a'),_0xcd1c('0x26'),_0x1d3c9c,_0xcd1c('0x3b'),'updatedAt'],squel[_0xcd1c('0x3d')]()['field'](_0xcd1c('0x20'),_0xcd1c('0x20'))[_0xcd1c('0x3e')]('id','ContactId')['field'](LISTID[_0xcd1c('0x40')](),_0xcd1c('0x26'))[_0xcd1c('0x3e')](_0x212a2b['id'][_0xcd1c('0x40')](),_0x1d3c9c)[_0xcd1c('0x3e')]('NOW()',_0xcd1c('0x3b'))[_0xcd1c('0x3e')](_0xcd1c('0x3f'),_0xcd1c('0x3c'))[_0xcd1c('0x45')](_0xcd1c('0x47'))[_0xcd1c('0x41')]('deletedAt\x20IS\x20NULL')[_0xcd1c('0x41')](_0xcd1c('0x42'),LISTID[_0xcd1c('0x40')]())[_0xcd1c('0x41')](_0xcd1c('0x49'),squel[_0xcd1c('0x4c')](hopperContacts))['where'](_0xcd1c('0x43')))[_0xcd1c('0x40')]();return _0x3e25cc;}return db[_0xcd1c('0x4d')][_0xcd1c('0x4e')]({'where':{'type':_0xcd1c('0x4f')},'attributes':['id',_0xcd1c('0x50')],'include':[{'model':db['CmList'],'as':_0xcd1c('0x51'),'where':{'id':LISTID}}]})[_0xcd1c('0x2d')](function(_0x588fd8){var _0x10d5d7=[];if(_0x588fd8){var _0x34164d;for(var _0x3a68cd=0x0,_0x3a8adb;_0x3a68cd<_0x588fd8[_0xcd1c('0x1a')];_0x3a68cd+=0x1){_0x3a8adb=_0x588fd8[_0x3a68cd]['get']({'plain':!![]});switch(_0x3a8adb['dialCheckDuplicateType']){case'always':_0x10d5d7[_0xcd1c('0x2e')](db[_0xcd1c('0x52')]['query'](_0xfdc2a(_0x3a8adb,_0xcd1c('0x53')))['then'](function(){})['catch'](_0x50835b()));break;case'onlyIfOpen':_0x10d5d7[_0xcd1c('0x2e')](db[_0xcd1c('0x52')][_0xcd1c('0x54')](_0x518fda(_0x3a8adb,_0xcd1c('0x53')))[_0xcd1c('0x2d')](function(){})['catch'](_0x50835b()));break;default:_0x10d5d7[_0xcd1c('0x2e')](db[_0xcd1c('0x52')][_0xcd1c('0x54')](_0x533718(_0x3a8adb,_0xcd1c('0x53')))[_0xcd1c('0x2d')](function(){})[_0xcd1c('0x2f')](_0x50835b()));}}}return _0x10d5d7;})[_0xcd1c('0x55')]()[_0xcd1c('0x2d')](function(){return db[_0xcd1c('0x4d')][_0xcd1c('0x4e')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0xcd1c('0x56')],'as':'BlackLists','where':{'id':LISTID}}]})[_0xcd1c('0x2d')](function(_0x25dd55){var _0x2d4eca=[];if(_0x25dd55){var _0xf5d132;for(var _0xc23b28=0x0,_0x26c2e9;_0xc23b28<_0x25dd55[_0xcd1c('0x1a')];_0xc23b28+=0x1){_0x26c2e9=_0x25dd55[_0xc23b28][_0xcd1c('0x57')]({'plain':!![]});_0x2d4eca[_0xcd1c('0x2e')](db['sequelize'][_0xcd1c('0x54')](_0x4de49b(_0x26c2e9,'VoiceQueueId'))[_0xcd1c('0x2d')](function(){})[_0xcd1c('0x2f')](_0x50835b()));}}return _0x2d4eca;})[_0xcd1c('0x55')]();})['then'](function(){return db[_0xcd1c('0x58')][_0xcd1c('0x4e')]({'attributes':['id',_0xcd1c('0x50')],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})[_0xcd1c('0x2d')](function(_0x42b385){var _0x395769=[];if(_0x42b385){for(var _0xfd5ad=0x0,_0x213b41;_0xfd5ad<_0x42b385[_0xcd1c('0x1a')];_0xfd5ad+=0x1){_0x213b41=_0x42b385[_0xfd5ad]['get']({'plain':!![]});switch(_0x213b41[_0xcd1c('0x50')]){case _0xcd1c('0x59'):_0x395769[_0xcd1c('0x2e')](db[_0xcd1c('0x52')]['query'](_0xfdc2a(_0x213b41,_0xcd1c('0x5a')))[_0xcd1c('0x2d')](function(){})[_0xcd1c('0x2f')](_0x50835b()));break;case'onlyIfOpen':_0x395769['push'](db['sequelize']['query'](_0x518fda(_0x213b41,'CampaignId'))['then'](function(){})[_0xcd1c('0x2f')](_0x50835b()));break;default:_0x395769[_0xcd1c('0x2e')](db[_0xcd1c('0x52')][_0xcd1c('0x54')](_0x533718(_0x213b41,'CampaignId'))[_0xcd1c('0x2d')](function(){})[_0xcd1c('0x2f')](_0x50835b()));}}}return _0x395769;})[_0xcd1c('0x55')]();})['then'](function(){return db[_0xcd1c('0x58')][_0xcd1c('0x4e')]({'attributes':['id'],'include':[{'model':db[_0xcd1c('0x56')],'as':'BlackLists','where':{'id':LISTID}}]})[_0xcd1c('0x2d')](function(_0x352b6c){var _0x5b8596=[];if(_0x352b6c){for(var _0x137ebf=0x0,_0x2f7b7c;_0x137ebf<_0x352b6c['length'];_0x137ebf+=0x1){_0x2f7b7c=_0x352b6c[_0x137ebf][_0xcd1c('0x57')]({'plain':!![]});_0x5b8596[_0xcd1c('0x2e')](db[_0xcd1c('0x52')][_0xcd1c('0x54')](_0x4de49b(_0x2f7b7c,_0xcd1c('0x5a')))[_0xcd1c('0x2d')](function(){})[_0xcd1c('0x2f')](_0x50835b()));}}return _0x5b8596;})[_0xcd1c('0x55')]();})[_0xcd1c('0x2f')](function(_0x32b2aa){logger['error'](_0xcd1c('0x5b'),_0xcd1c('0x5c'),_0x32b2aa[_0xcd1c('0x31')]);});}var processPromises=function(_0x44ee01){return BPromise['all'](promises)[_0xcd1c('0x2d')](function(_0x2268f7){})[_0xcd1c('0x2f')](function(_0x35c1c9){logger[_0xcd1c('0x17')](_0xcd1c('0x5d'),JSON[_0xcd1c('0x5e')](_0x35c1c9));})['finally'](function(){socket[_0xcd1c('0x5f')](_0xcd1c('0x60')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x44ee01){return _0x44ee01[_0xcd1c('0x61')]();}});};var endCsv=function(){return BPromise[_0xcd1c('0x62')]()[_0xcd1c('0x2d')](function(){if(hopperContacts){return checkHopper();}})[_0xcd1c('0x2d')](function(){socket[_0xcd1c('0x5f')](_0xcd1c('0x60')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xcd1c('0x63')](FILEPATH);}catch(_0x32ace1){logger[_0xcd1c('0x17')](_0xcd1c('0x64'),JSON[_0xcd1c('0x5e')](_0x32ace1));}finally{process['exit'](0x0);}});};process['on'](_0xcd1c('0x65'),function(){logger[_0xcd1c('0x66')](_0xcd1c('0x67'));endCsv();});function main(){return BPromise[_0xcd1c('0x62')]()[_0xcd1c('0x2d')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xcd1c('0x12')](',');return db['CmContact'][_0xcd1c('0x4e')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x38a077){var _0x44edee=fs[_0xcd1c('0x68')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xcd1c('0x69')](_0x44edee,{'header':!![],'skipEmptyLines':!![],'step':function(_0x35ac5e,_0x3ab537){total+=0x1;var _0x34fd2e=total;promises[_0xcd1c('0x2e')](checkRow(_0x35ac5e,_0x38a077,_0x34fd2e)[_0xcd1c('0x2d')](function(){success+=0x1;})[_0xcd1c('0x2f')](function(_0x37f27a){if(_0x37f27a[_0xcd1c('0x17')]){errors+=0x1;delete _0x37f27a[_0xcd1c('0x17')];}else if(_0x37f27a[_0xcd1c('0x28')]){duplicates+=0x1;delete _0x37f27a[_0xcd1c('0x28')];}rows[_0xcd1c('0x2e')](_0x37f27a);}));if(total%0xc8===0x0){_0x3ab537[_0xcd1c('0x6a')]();return processPromises(_0x3ab537);}},'complete':function(){return processPromises()[_0xcd1c('0x2d')](function(){logger[_0xcd1c('0x66')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x44fe52,_0x4fb22c){logger['info'](_0xcd1c('0x6b'),JSON[_0xcd1c('0x5e')](_0x44fe52));endCsv();}});})['catch'](function(_0x1ea08f){logger[_0xcd1c('0x17')](_0xcd1c('0x6c'),JSON[_0xcd1c('0x5e')](_0x1ea08f));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 3821cf2..cb1086b 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 _0x576e=['push','all','split','isNil','filter','CmContactHasItem','findOne','update','create','PHONE','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ListId','createdAt','priority','UserId','recallme','from','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.ListId','ContactId','updatedAt','fields','.CmListId','select','cm_hopper_black','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.priority','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','CmHopperId','OrderBy','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId','scheduledAt',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','errors','code','sequelize','query','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','voice_queues.id','voice_queues.dialTimezone','voice_queues_has_cm_lists','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','utcOffset','set','offset','stringify','send','start','binding','clone','socket_timestamp','server/files/tmp','.csv','ContactItemType','name','_description','writeFileSync','parse','createReadStream','data','hasOwnProperty','replace','isValid','isNaN','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','trim','find','itemTypeId','appendFileSync','emit','contact:import:','Abort\x20parser','abort','step','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','duplicates','DROP\x20TABLE\x20','contactId','orderBy','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','finish','affectedRows','unlink','exit','complete','argv','arguments\x20\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','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','lodash','papaparse','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','select','field','phone','from','join','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','AdditionalPhones','push','all','length','then','isNil','split','CmContactHasItem','findOne','update','create','PHONE','cm_contacts.phone','cm_contacts.ListId','cm_contacts.createdAt'];(function(_0x311fd4,_0x2fc056){var _0x2a7835=function(_0x4945e7){while(--_0x4945e7){_0x311fd4['push'](_0x311fd4['shift']());}};_0x2a7835(++_0x2fc056);}(_0xf621,0x143));var _0x1f62=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xf621[_0x12d033];return _0x3b4e80;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x1f62('0x0'));var Papa=require(_0x1f62('0x1'));var util=require('util');var BPromise=require(_0x1f62('0x2'));var moment=require(_0x1f62('0x3'));var squel=require(_0x1f62('0x4'));var Redis=require(_0x1f62('0x5'));var db=require(_0x1f62('0x6'))['db'];var config=require(_0x1f62('0x7'));var shared=require(_0x1f62('0x8'));var logger=require(_0x1f62('0x9'))(_0x1f62('0xa'));config['redis']=_['defaults'](config[_0x1f62('0xb')],{'host':_0x1f62('0xc'),'port':0x18eb});var socket=require(_0x1f62('0xd'))(new Redis(config[_0x1f62('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x1f62('0xe')](_0x1f62('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x1f62('0xe')](_0x1f62('0xf'));function isEmail(_0x3ac88f){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'](_0x3ac88f);}function selectNotIn(_0x27a37c,_0x231340,_0x57fd86,_0x1e2cdd,_0x5a98cc){return squel[_0x1f62('0x10')]()[_0x1f62('0x11')](_0x1f62('0x12'))[_0x1f62('0x13')](_0x1e2cdd)[_0x1f62('0x14')](_0x231340,null,_0x231340+'.id\x20=\x20'+_0x1e2cdd+'.'+_0x57fd86)[_0x1f62('0x15')](_0x1e2cdd+'.'+_0x57fd86+_0x1f62('0x16')+_0x27a37c+'.'+_0x57fd86)[_0x1f62('0x15')](_0x231340+_0x1f62('0x17')+_0x5a98cc[_0x1f62('0x14')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x17d4f6,_0x350192){promisesAdditionalPhones=[];return db[_0x1f62('0x18')][_0x1f62('0x19')]({'raw':!![],'attributes':['id',_0x1f62('0x1a')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})['then'](function(_0x54081a){if(_0x54081a!==null){var _0x3bfaa2=[];for(var _0x564dd5=0x0;_0x564dd5<_0x54081a['length'];_0x564dd5++){var _0x289b5e=_0x54081a[_0x564dd5];_0x3bfaa2[_0x1f62('0x1b')](insertAdditionalPhones(_0x289b5e));}}Promise[_0x1f62('0x1c')](_0x3bfaa2)['then'](function(){_0x17d4f6({'val':0x1});});});});}function insertAdditionalPhones(_0xf2bc58){return new Promise(function(_0x167dbb,_0x32111a){var _0x21e05a=_0xf2bc58['AdditionalPhones'];var _0x851840=_0x21e05a['split'](';');var _0x382fc8=[];orderBy=0x0;for(var _0x565862=0x0;_0x565862<_0x851840[_0x1f62('0x1d')];_0x565862++){_0x382fc8[_0x1f62('0x1b')](splitAdditionalPhone(_0xf2bc58['id'],_0x851840[_0x565862]));}Promise[_0x1f62('0x1c')](_0x382fc8)[_0x1f62('0x1e')](function(){_0x167dbb({'val':_0x851840[_0x1f62('0x1d')]});});});}function splitAdditionalPhone(_0x22cbe8,_0x429a7c){return new Promise(function(_0x5b0d45,_0xd57fbc){var _0x58afb5=_0x429a7c['split'](':');var _0x16fac3=_0x58afb5[0x0];var _0x437e7d=_0x58afb5[0x1];if(!_[_0x1f62('0x1f')](_0x437e7d)){var _0x446ba3=_0x437e7d[_0x1f62('0x20')]('|');var _0x292dd5=[];for(var _0x1e3eae=0x0;_0x1e3eae<_0x446ba3[_0x1f62('0x1d')];_0x1e3eae++){if(_0x446ba3[_0x1e3eae]!==''){var _0x4508c6=_['filter'](promisesAdditionalPhones,{'contactId':_0x22cbe8,'phone':_0x446ba3[_0x1e3eae]});if(_0x4508c6[_0x1f62('0x1d')]==0x0){orderBy++;promisesAdditionalPhones[_0x1f62('0x1b')]({'contactId':_0x22cbe8,'contactTypeId':_0x16fac3,'phone':_0x446ba3[_0x1e3eae],'orderBy':orderBy});}}}_0x5b0d45({'ok':0x1});}else _0x5b0d45({'res':0x0});});}function createAdditionalPhone(_0x4e0b6d,_0x2bf822,_0x5b05d8,_0x410ac1){var _0x41b450='';var _0x2757ed='';var _0x338295=_0x5b05d8['split']('§');_0x41b450=_0x338295[0x0];if(_0x338295[_0x1f62('0x1d')]==0x2)_0x2757ed=_0x338295[0x1];return new Promise(function(_0x4c7cad,_0x297093){return db[_0x1f62('0x21')][_0x1f62('0x22')]({'where':{'CmContactId':_0x4e0b6d,'item':_0x41b450}})[_0x1f62('0x1e')](function(_0x587193){if(_0x587193){return db[_0x1f62('0x21')][_0x1f62('0x23')]({'ItemTypeId':_0x2bf822,'description':_0x2757ed,'OrderBy':_0x410ac1},{'where':{'CmContactId':_0x4e0b6d,'item':_0x41b450}})[_0x1f62('0x1e')](function(_0x37c397){_0x4c7cad({'res':'updated'});});}else{return db[_0x1f62('0x21')][_0x1f62('0x24')]({'CmContactId':_0x4e0b6d,'item':_0x41b450,'description':_0x2757ed,'ItemTypeId':_0x2bf822,'OrderBy':_0x410ac1,'ItemClass':_0x1f62('0x25')})[_0x1f62('0x1e')](function(_0x1ff711){_0x4c7cad({'res':'inserted'});});}});});}function insertCmHopper(_0x3d8148,_0x2f3d3b,_0x55517c,_0x4904e6,_0x471a80){var _0x4ff4db=[_0x1f62('0x26'),'cm_contacts.scheduledat','cm_contacts.id',_0x1f62('0x27'),_0x2f3d3b+'.'+_0x4904e6,_0x1f62('0x28'),_0x1f62('0x29'),_0x1f62('0x2a'),_0x1f62('0x2b'),'\x22'+_0x471a80+'\x22'];return squel['insert']()[_0x1f62('0x2c')](_0x1f62('0x2d'))[_0x1f62('0x2e')]([_0x1f62('0x12'),_0x1f62('0x2f'),_0x1f62('0x30'),'ListId',_0x4904e6,_0x1f62('0x31'),_0x1f62('0x32'),_0x1f62('0x33'),'UserId',_0x1f62('0x34')],squel[_0x1f62('0x10')]()[_0x1f62('0x35')](_0x4ff4db)[_0x1f62('0x13')](_0x2f3d3b)['join'](_0x1f62('0x36'),null,'cm_contacts.ListId\x20=\x20'+_0x2f3d3b+_0x1f62('0x37'))[_0x1f62('0x14')](_0x55517c,null,_0x55517c+_0x1f62('0x38')+_0x2f3d3b+'.'+_0x4904e6)['where'](_0x2f3d3b+'.CmListId\x20=\x20?',_0x3d8148)[_0x1f62('0x15')](_0x1f62('0x39'),NOW)[_0x1f62('0x15')](_0x1f62('0x3a'),selectNotIn(_0x2f3d3b,_0x55517c,_0x4904e6,_0x1f62('0x2d'),[_0x1f62('0x3b'),_0x1f62('0x3c')]))[_0x1f62('0x15')](_0x1f62('0x3a'),selectNotIn(_0x2f3d3b,_0x55517c,_0x4904e6,_0x1f62('0x2d'),['\x22always\x22'])))[_0x1f62('0x3d')]();}function insertCmHopperBlack(_0x42a053,_0x554787,_0x345a13,_0xa82dd5){var _0x195e23=[_0x1f62('0x26'),'cm_contacts.id',_0x1f62('0x27'),_0x554787+'.'+_0xa82dd5,_0x1f62('0x28'),_0x1f62('0x29')];return squel[_0x1f62('0x3e')]()[_0x1f62('0x2c')]('cm_hopper_black')['fromQuery'](['phone',_0x1f62('0x30'),_0x1f62('0x3f'),_0xa82dd5,'createdAt',_0x1f62('0x32')],squel[_0x1f62('0x10')]()[_0x1f62('0x35')](_0x195e23)['from'](_0x554787)['join'](_0x1f62('0x36'),null,_0x1f62('0x40')+_0x554787+_0x1f62('0x37'))['join'](_0x345a13,null,_0x345a13+_0x1f62('0x38')+_0x554787+'.'+_0xa82dd5)[_0x1f62('0x15')](_0x554787+_0x1f62('0x41'),_0x42a053)[_0x1f62('0x15')](_0x1f62('0x39'),NOW)[_0x1f62('0x15')](_0x1f62('0x3a'),squel[_0x1f62('0x10')]()[_0x1f62('0x11')](_0x1f62('0x12'))[_0x1f62('0x13')]('cm_hopper_black')['where'](_0x1f62('0x42'),_0x42a053)[_0x1f62('0x15')](_0xa82dd5+_0x1f62('0x16')+_0x554787+'.'+_0xa82dd5)))[_0x1f62('0x3d')]();}function insertTzCmHopper(_0x4965de,_0x4f5408,_0x924e78,_0x2e085a,_0x3adfc9,_0x5717e6){var _0x297777=[_0x1f62('0x26'),_0x1f62('0x43')+_0x5717e6+'.offset-cm_contacts.utcOffset\x20minute)',_0x1f62('0x44'),'cm_contacts.ListId',_0x4f5408+'.'+_0x2e085a,'cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority',_0x1f62('0x2b'),'\x22'+_0x3adfc9+'\x22'];var _0x2da802=squel[_0x1f62('0x3e')]()[_0x1f62('0x2c')](_0x1f62('0x2d'))[_0x1f62('0x2e')]([_0x1f62('0x12'),'scheduledat',_0x1f62('0x30'),'ListId',_0x2e085a,'createdAt',_0x1f62('0x32'),'priority',_0x1f62('0x45'),'recallme'],squel[_0x1f62('0x10')]()[_0x1f62('0x35')](_0x297777)[_0x1f62('0x13')](_0x4f5408)[_0x1f62('0x14')](_0x1f62('0x36'),null,'cm_contacts.ListId\x20=\x20'+_0x4f5408+'.CmListId')['join'](_0x924e78,null,_0x924e78+_0x1f62('0x38')+_0x4f5408+'.'+_0x2e085a)[_0x1f62('0x14')](_0x5717e6,null,_0x5717e6+'.id\x20=\x20'+_0x4f5408+'.'+_0x2e085a)[_0x1f62('0x15')](_0x4f5408+_0x1f62('0x41'),_0x4965de)[_0x1f62('0x15')](_0x1f62('0x39'),NOW)[_0x1f62('0x15')](_0x1f62('0x3a'),selectNotIn(_0x4f5408,_0x924e78,_0x2e085a,_0x1f62('0x2d'),['\x22always\x22',_0x1f62('0x3c')]))['where'](_0x1f62('0x3a'),selectNotIn(_0x4f5408,_0x924e78,_0x2e085a,_0x1f62('0x2d'),[_0x1f62('0x3b')])))[_0x1f62('0x3d')]();return _0x2da802;}function insertTzCmHopperBlack(_0xf1136b,_0x2eacb4,_0x4caac9,_0x5354c8){var _0x492264=[_0x1f62('0x26'),_0x1f62('0x44'),_0x1f62('0x27'),_0x2eacb4+'.'+_0x5354c8,_0x1f62('0x28'),'cm_contacts.updatedAt'];return squel['insert']()[_0x1f62('0x2c')](_0x1f62('0x46'))[_0x1f62('0x2e')](['phone',_0x1f62('0x30'),_0x1f62('0x3f'),_0x5354c8,_0x1f62('0x31'),_0x1f62('0x32')],squel[_0x1f62('0x10')]()[_0x1f62('0x35')](_0x492264)[_0x1f62('0x13')](_0x2eacb4)[_0x1f62('0x14')](_0x1f62('0x36'),null,'cm_contacts.ListId\x20=\x20'+_0x2eacb4+'.CmListId')[_0x1f62('0x14')](_0x4caac9,null,_0x4caac9+'.id\x20=\x20'+_0x2eacb4+'.'+_0x5354c8)[_0x1f62('0x15')](_0x2eacb4+_0x1f62('0x41'),_0xf1136b)['where'](_0x1f62('0x39'),NOW)[_0x1f62('0x15')](_0x1f62('0x3a'),squel[_0x1f62('0x10')]()['field'](_0x1f62('0x12'))[_0x1f62('0x13')]('cm_hopper_black')['where'](_0x1f62('0x42'),_0xf1136b)['where'](_0x5354c8+_0x1f62('0x16')+_0x2eacb4+'.'+_0x5354c8)))[_0x1f62('0x3d')]();}function insertCmHopperAdditionalPhones(_0x2c7b17){var _0x31dca2=['cm_hopper.id',_0x1f62('0x47'),_0x1f62('0x48'),_0x1f62('0x49'),_0x1f62('0x4a')];return squel[_0x1f62('0x3e')]()[_0x1f62('0x2c')](_0x1f62('0x4b'))[_0x1f62('0x2e')]([_0x1f62('0x4c'),_0x1f62('0x12'),_0x1f62('0x4d'),_0x1f62('0x31'),_0x1f62('0x32')],squel['select']()['fields'](_0x31dca2)['from']('cm_hopper')['join'](_0x1f62('0x36'),null,_0x1f62('0x4e'))[_0x1f62('0x14')]('cm_contact_has_items',null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0x1f62('0x15')](_0x1f62('0x4f'),_0x2c7b17)[_0x1f62('0x15')](_0x1f62('0x39'),NOW))[_0x1f62('0x3d')]();}function insertCmContact(_0x39e3c4,_0x40b305,_0x51b6d4,_0x22b81b){var _0x12fb7d=_[_0x1f62('0x50')](_[_0x1f62('0x51')](_0x22b81b),['ListId',_0x1f62('0x52'),'createdAt',_0x1f62('0x32'),'scheduledAt']);return squel['insert']()[_0x1f62('0x2c')](_0x1f62('0x36'))[_0x1f62('0x2e')](_0x12fb7d,squel['select']()[_0x1f62('0x35')](_0x12fb7d)[_0x1f62('0x13')](_0x40b305)[_0x1f62('0x15')]('('+_0x51b6d4['join'](',')+_0x1f62('0x53'),squel[_0x1f62('0x10')]()['fields'](_0x51b6d4)[_0x1f62('0x13')](_0x1f62('0x36'))[_0x1f62('0x15')]('ListId\x20=\x20?',_0x39e3c4)[_0x1f62('0x15')](_0x1f62('0x54')))[_0x1f62('0x15')](_0x1f62('0x55'),squel['select']()[_0x1f62('0x11')]('MIN(id)',_0x1f62('0x56'))[_0x1f62('0x13')](_0x40b305)[_0x1f62('0x57')](_0x51b6d4[_0x1f62('0x14')](','))))[_0x1f62('0x3d')]();}function handleStop(){logger[_0x1f62('0x58')](_0x1f62('0x59'));stopped=!![];}function handleUncaughtException(_0x58f2ca){logger['error'](_0x58f2ca[_0x1f62('0x5a')]);process[_0x1f62('0x5b')](0x1);}function handleError(_0x3f3fdd,_0x5438d5){stats[_0x1f62('0x5c')][_0x1f62('0x1b')]({'name':_0x5438d5[_0x1f62('0x5d')],'message':_0x5438d5['message'],'row':_0x3f3fdd});}function handleQuery(_0xb3da3b){logger[_0x1f62('0x58')](_0xb3da3b);return db[_0x1f62('0x5e')][_0x1f62('0x5f')](_0xb3da3b)[_0x1f62('0x60')](function(_0x2985ba){results[_0x1f62('0x1b')](_0x2985ba);})[_0x1f62('0x61')](function(_0x96cbbc){logger[_0x1f62('0x62')](_0x96cbbc[_0x1f62('0x5a')]);});}function updateTzCampaigns(_0x3a1d10){return new Promise(function(_0x2b8895,_0x5a69cd){var _0x269b45=squel['select']()['fields']([_0x1f62('0x63'),'campaigns.dialTimezone'])['from'](_0x1f62('0x64'))[_0x1f62('0x14')](_0x1f62('0x65'),null,'campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId')[_0x1f62('0x15')](_0x1f62('0x66')+_0x3a1d10);db[_0x1f62('0x5e')][_0x1f62('0x5f')](_0x269b45[_0x1f62('0x3d')]())['spread'](function(_0x2b6b87){var _0x5eeba6=[];for(var _0x470a60=0x0;_0x470a60<_0x2b6b87['length'];_0x470a60++){_0x5eeba6[_0x1f62('0x1b')](getTimezoneData(_0x2b6b87[_0x470a60],tmp_campaigns));}BPromise['all'](_0x5eeba6)[_0x1f62('0x1e')](function(){_0x2b8895({'val':0x1});});})[_0x1f62('0x61')](function(_0x24ae86){logger[_0x1f62('0x62')](_0x24ae86[_0x1f62('0x5a')]);_0x2b8895({'val':0x0});});});}function updateTzVoiceQueues(_0x2fef25){return new Promise(function(_0x544734,_0x3c82ae){var _0x3b240d=squel[_0x1f62('0x10')]()[_0x1f62('0x35')]([_0x1f62('0x67'),_0x1f62('0x68')])['from'](_0x1f62('0x69'))[_0x1f62('0x14')](_0x1f62('0x6a'),null,_0x1f62('0x6b'))[_0x1f62('0x15')](_0x1f62('0x6c')+_0x2fef25);db['sequelize'][_0x1f62('0x5f')](_0x3b240d[_0x1f62('0x3d')]())['spread'](function(_0x562a64){var _0x57f51b=[];for(var _0x115220=0x0;_0x115220<_0x562a64[_0x1f62('0x1d')];_0x115220++){_0x57f51b[_0x1f62('0x1b')](getTimezoneData(_0x562a64[_0x115220],tmp_voice_queues));}BPromise['all'](_0x57f51b)[_0x1f62('0x1e')](function(){_0x544734({'val':0x1});});})[_0x1f62('0x61')](function(_0x57b1e9){logger[_0x1f62('0x62')](_0x57b1e9[_0x1f62('0x5a')]);_0x544734({'val':0x0});});});}function getTimezoneData(_0x5b2ca2,_0x124ff5){return new Promise(function(_0x3e6c4d,_0x1deaa6){var _0x470006=shared[_0x1f62('0x6d')];var _0x532a1d=_0x470006[_0x5b2ca2['dialTimezone']];if(_['isNil'](_0x532a1d)){_0x3e6c4d({'ret':0x1});}else{var _0x4958d5=_0x532a1d['utcOffset'];var _0x258bd4=squel[_0x1f62('0x3e')]()['into'](_0x124ff5)['set']('id',_0x5b2ca2['id'])['set'](_0x1f62('0x6e'),_0x4958d5)[_0x1f62('0x6f')](_0x1f62('0x70'),_0x5b2ca2[_0x1f62('0x70')])[_0x1f62('0x3d')]();return db[_0x1f62('0x5e')][_0x1f62('0x5f')](_0x258bd4)['spread'](function(_0x28d9b8){_0x3e6c4d({'ret':0x1});})[_0x1f62('0x61')](function(_0x5e210f){logger[_0x1f62('0x62')](_0x5e210f[_0x1f62('0x5a')]);_0x1deaa6({'ret':0x1});});}});}function handleTZQuery(_0x35c280){logger['info'](_0x35c280);return db[_0x1f62('0x5e')][_0x1f62('0x5f')](_0x35c280)[_0x1f62('0x60')](function(_0x68d3bb){})[_0x1f62('0x61')](function(_0x2215d8){logger[_0x1f62('0x62')](_0x2215d8[_0x1f62('0x5a')]);});}function main(_0x93fea8,_0x4f36f1,_0x102f64,_0x306745){logger[_0x1f62('0x58')]('main',_0x93fea8,JSON['stringify'](_0x4f36f1));process[_0x1f62('0x71')](_0x1f62('0x72'));var _0x67261d=_0x4f36f1[_0x1f62('0x73')];var _0x24d650=_[_0x1f62('0x74')](_0x67261d);var _0x4c207f=_0x4f36f1[_0x1f62('0x75')];var _0x581410=path[_0x1f62('0x14')](config[_0x1f62('0x76')],_0x1f62('0x77'),_0x4c207f+'.csv');hasTZ=_[_0x1f62('0x51')](_0x67261d)[_0x1f62('0x78')](_0x1f62('0x70'));var _0x14a638=_[_0x1f62('0x51')](_0x67261d)['join']();logger[_0x1f62('0x58')]('header',_0x14a638);db[_0x1f62('0x79')][_0x1f62('0x19')]({'raw':!![],'attributes':['id',_0x1f62('0x7a')]})['then'](function(_0x258170){for(var _0x2899ac=0x0;_0x2899ac<_0x258170[_0x1f62('0x1d')];_0x2899ac++){if(_0x258170[_0x2899ac]['name']in _0x67261d){contactItemTypes['push'](_0x258170[_0x2899ac]);delete _0x24d650[_0x258170[_0x2899ac][_0x1f62('0x7a')]];hasAdditionalPhones=!![];}for(var _0x193d8f in _0x67261d){if(_0x258170[_0x2899ac]['name']+'_description'===_0x193d8f){phoneDescriptions[_0x1f62('0x1b')]({'itemTypeId':_0x258170[_0x2899ac]['id'],'description':_0x193d8f});delete _0x24d650[_0x193d8f];}}}if(hasAdditionalPhones)_0x24d650[_0x1f62('0x1a')]='';var _0x50080c=_[_0x1f62('0x51')](_0x24d650)[_0x1f62('0x14')]();logger[_0x1f62('0x58')](_0x1f62('0x7b'),_0x50080c);fs['writeFileSync'](_0x581410,_0x50080c+'\x0a');Papa[_0x1f62('0x7c')](fs[_0x1f62('0x7d')](_0x93fea8),{'header':!![],'skipEmptyLines':!![],'step':function(_0x5334bb,_0xa05129){try{for(var _0x55a4db=0x0,_0xd35af7=[];_0x55a4db<_0x5334bb['data'][_0x1f62('0x1d')];_0x55a4db++){stats['rows']+=0x1;if(_0x5334bb[_0x1f62('0x5c')][_0x55a4db]){handleError(_0x5334bb[_0x1f62('0x7e')][_0x55a4db],_0x5334bb['errors'][_0x55a4db]);}else{var _0x1e192a=[];var _0x14ab8a=[];var _0x2fc61a={};for(var _0x446400 in _0x67261d){let _0x129a12=contactItemTypes['find'](_0x5b08ad=>_0x5b08ad[_0x1f62('0x7a')]===_0x446400);let _0x4dc944=contactItemTypes[_0x1f62('0x7f')](_0xe6beb1=>_0xe6beb1[_0x1f62('0x7a')]+_0x1f62('0x80')===_0x446400);if(_[_0x1f62('0x1f')](_0x129a12)&&_['isNil'](_0x4dc944)){if(_0x67261d[_0x1f62('0x81')](_0x446400)){if(_0x5334bb[_0x1f62('0x7e')][_0x55a4db][_0x67261d[_0x446400]]){var _0x16a5f9=_[_0x1f62('0x82')](_0x5334bb[_0x1f62('0x7e')][_0x55a4db][_0x67261d[_0x446400]]['replace'](/"/g,'\x27'));switch(_0x446400){case'scheduledat':var _0x55a8d1=moment(_0x16a5f9,_0x1f62('0xf'),!![]);if(_0x55a8d1[_0x1f62('0x83')]()){_0xd35af7[_0x1f62('0x1b')]('\x22'+_0x16a5f9+'\x22');}else{_0x1e192a['push'](_0x1f62('0x84'));}break;case _0x1f62('0x33'):var _0xdb771c=parseInt(_0x16a5f9);_0x16a5f9=_[_0x1f62('0x85')](_0xdb771c)||_0xdb771c<0x0||_0xdb771c>0x4?_0x306745?0x3:0x2:_0xdb771c;_0xd35af7[_0x1f62('0x1b')]('\x22'+_0x16a5f9+'\x22');break;case'UserId':var _0x544487=parseInt(_0x16a5f9);if(_[_0x1f62('0x86')](_0x544487)&&_['includes'](_0x102f64,_0x544487)){_0xd35af7['push']('\x22'+_0x544487+'\x22');}else{_0x1e192a[_0x1f62('0x1b')](_0x1f62('0x87'));}break;case _0x1f62('0x88'):if(isEmail(_0x16a5f9)){_0xd35af7['push']('\x22'+_0x16a5f9+'\x22');}else{_0x1e192a['push']('email\x20wrong\x20format');}break;case _0x1f62('0x89'):var _0x5bf431=moment(_0x16a5f9,_0x1f62('0x8a'),!![]);if(_0x5bf431[_0x1f62('0x83')]()){_0xd35af7['push']('\x22'+_0x16a5f9+'\x22');}else{_0x1e192a['push'](_0x1f62('0x8b'));}break;case'dialTimezone':var _0x4f2491=shared[_0x1f62('0x6d')];var _0x278560=_0x4f2491[_0x16a5f9];if(!_[_0x1f62('0x1f')](_0x278560)){var _0x3b8385=_0x278560[_0x1f62('0x8c')];_0xd35af7[_0x1f62('0x1b')]('\x22'+_0x16a5f9+'\x22');_0xd35af7[_0x1f62('0x1b')]('\x22'+_0x3b8385+'\x22');}break;default:_0xd35af7[_0x1f62('0x1b')]('\x22'+_0x16a5f9+'\x22');}}else{switch(_0x446400){case _0x1f62('0x8d'):case _0x1f62('0x12'):_0x1e192a[_0x1f62('0x1b')](_0x446400+_0x1f62('0x8e'));break;default:_0xd35af7[_0x1f62('0x1b')]('\x22\x22');}}}}else{var _0x3a47ce='';if(!_[_0x1f62('0x1f')](_0x129a12)){if(!_0x2fc61a['hasOwnProperty'](_0x129a12['id'])){if(!_[_0x1f62('0x1f')](_0x5334bb[_0x1f62('0x7e')][_0x55a4db][_0x67261d[_0x446400]])){var _0x16a5f9=_[_0x1f62('0x82')](_0x5334bb[_0x1f62('0x7e')][_0x55a4db][_0x67261d[_0x446400]]['replace'](/"/g,'\x27'));var _0x37137c=phoneDescriptions['find'](_0x26847a=>_0x26847a[_0x1f62('0x8f')]===_0x129a12['id']);if(!_[_0x1f62('0x1f')](_0x37137c)){var _0x30a860=_[_0x1f62('0x82')](_0x5334bb['data'][_0x55a4db][_0x67261d[_0x37137c[_0x1f62('0x90')]]][_0x1f62('0x91')](/"/g,'\x27'));if(!_[_0x1f62('0x1f')](_0x30a860))_0x16a5f9=_0x16a5f9+'§'+_0x30a860;}if(_0x3a47ce=='')_0x3a47ce=_0x16a5f9;else _0x3a47ce+='|'+_0x16a5f9;}_0x14ab8a['push'](_0x129a12['id']+':'+_0x3a47ce);_0x2fc61a[_0x129a12['id']]=0x1;}}}}if(hasAdditionalPhones){_0xd35af7[_0x1f62('0x1b')]('\x22'+_0x14ab8a['join'](';')+'\x22');}if(_0x1e192a[_0x1f62('0x1d')]){handleError(_0x5334bb['data'][_0x55a4db],{'code':'SystemRow','message':_0x1e192a['join']()});}else{fs[_0x1f62('0x92')](_0x581410,_0xd35af7[_0x1f62('0x14')]()+'\x0a');}_0xd35af7=[];}if(!(stats[_0x1f62('0x93')]%0xc8)){socket['emit'](_0x1f62('0x94')+_0x4c207f,stats);stats[_0x1f62('0x5c')]=[];}}if(stopped){logger[_0x1f62('0x58')](_0x1f62('0x95'));_0xa05129[_0x1f62('0x96')]();}}catch(_0xd51882){handleError(_0x5334bb['data'][_0x55a4db],{'code':'SystemError','message':_0xd51882['message']});logger[_0x1f62('0x62')](_0x1f62('0x97'),_0xd51882[_0x1f62('0x5a')]);}},'complete':function(){try{var _0x455741=[];var _0x154f57=[];var _0x3e7673=_0x1f62('0x36');if(_0x4f36f1[_0x1f62('0x98')]&&_0x4f36f1[_0x1f62('0x98')]['length']){_0x3e7673=_0x1f62('0x99')+_0x4c207f;_0x455741['push'](_0x1f62('0x9a')+_0x3e7673+_0x1f62('0x9b'));}tmp_campaigns='campaigns_'+_0x4c207f;tmp_voice_queues='voice_queues_'+_0x4c207f;_0x154f57[_0x1f62('0x1b')](_0x1f62('0x9a')+tmp_campaigns+_0x1f62('0x9c'));_0x154f57['push']('CREATE\x20TABLE\x20'+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0x1f62('0x9d')](_0x154f57,handleTZQuery)[_0x1f62('0x1e')](function(_0x351eb4){updateTzCampaigns(_0x4f36f1[_0x1f62('0x3f')])[_0x1f62('0x1e')](function(_0x2e5298){updateTzVoiceQueues(_0x4f36f1[_0x1f62('0x3f')])[_0x1f62('0x1e')](function(_0x516572){if(hasTZ)_0x50080c=_0x50080c['replace'](_0x1f62('0x70'),_0x1f62('0x9e'));var _0x3c3541=util[_0x1f62('0xe')](_0x1f62('0x9f'),_0x581410,_0x3e7673,_0x50080c,_0x4f36f1[_0x1f62('0x3f')],_0x4f36f1['CompanyId']||null,NOW,NOW);if(_['isNil'](_0x67261d[_0x1f62('0x2f')])){_0x3c3541+=_0x1f62('0xa0');}_0x455741[_0x1f62('0x1b')](_0x3c3541);if(_0x4f36f1[_0x1f62('0x98')]&&_0x4f36f1[_0x1f62('0x98')]['length']){_0x455741['push'](insertCmContact(_0x4f36f1[_0x1f62('0x3f')],_0x3e7673,_0x4f36f1['duplicates'],_0x67261d));_0x455741['push'](_0x1f62('0xa1')+_0x3e7673+';');}BPromise[_0x1f62('0x9d')](_0x455741,handleQuery)[_0x1f62('0x1e')](function(_0x1f2473){BPromise[_0x1f62('0x1c')]([handleAdditionalPhones()])[_0x1f62('0x1e')](function(){_0x455741=[];for(var _0x2ee090=0x0;_0x2ee090\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\x20','server/files/tmp','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','ioredis','../../../config/environment','import','redis','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','select','field','from','.id\x20=\x20','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','join','sequelize','query','select\x20*\x20from\x20','spread','isNil','push','message','split','length','all','then','filter','CmContactHasItem','findOne','update','create','PHONE','inserted','CmContact','CmHopper','phone','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','ContactId','ListId','createdAt','updatedAt','UserId','recallme','fields','cm_contacts','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','cm_hopper_black','cm_contacts.ListId\x20=\x20','ListId\x20=\x20?','\x20=\x20?','toString','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy'];(function(_0x1c1509,_0x2dfa81){var _0xf11b7=function(_0x17949e){while(--_0x17949e){_0x1c1509['push'](_0x1c1509['shift']());}};_0xf11b7(++_0x2dfa81);}(_0x0135,0x188));var _0x5013=function(_0x46b78f,_0x3f4db9){_0x46b78f=_0x46b78f-0x0;var _0x182af1=_0x0135[_0x46b78f];return _0x182af1;};'use strict';var fs=require('fs');var path=require(_0x5013('0x0'));var _=require(_0x5013('0x1'));var Papa=require(_0x5013('0x2'));var util=require(_0x5013('0x3'));var BPromise=require('bluebird');var moment=require('moment');var squel=require('squel');var Redis=require(_0x5013('0x4'));var db=require('../../../mysqldb')['db'];var config=require(_0x5013('0x5'));var logger=require('../../../config/logger')(_0x5013('0x6'));config[_0x5013('0x7')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5013('0x8'))(new Redis(config[_0x5013('0x7')]));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()[_0x5013('0x9')](_0x5013('0xa'));var tempTableName=_0x5013('0xb')+moment()[_0x5013('0x9')]('YYYYMMDDHHmmss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x5cbc18){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'](_0x5cbc18);}function selectNotIn(_0x4455d9,_0x3890de,_0x1f80ea,_0x5be768,_0x4a6e85){return squel[_0x5013('0xc')]()[_0x5013('0xd')]('phone')[_0x5013('0xe')](_0x5be768)['join'](_0x3890de,null,_0x3890de+_0x5013('0xf')+_0x5be768+'.'+_0x1f80ea)['where'](_0x5be768+'.'+_0x1f80ea+_0x5013('0x10')+_0x4455d9+'.'+_0x1f80ea)[_0x5013('0x11')](_0x3890de+_0x5013('0x12')+_0x4a6e85[_0x5013('0x13')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x3bdf65,_0x80ba72){promisesAdditionalPhones=[];promisesContact=[];return db[_0x5013('0x14')][_0x5013('0x15')](_0x5013('0x16')+tempTableName)[_0x5013('0x17')](function(_0x10442f){if(_0x10442f!==null){var _0x54771c=[];for(var _0x1a9edd=0x0;_0x1a9edd<_0x10442f['length'];_0x1a9edd++){var _0x2c6433=_0x10442f[_0x1a9edd];if(!_['isNil'](_0x2c6433['phone'])){if(!_[_0x5013('0x18')](_0x2c6433['AdditionalPhones']))_0x54771c[_0x5013('0x19')](insertAdditionalPhones(_0x2c6433));promisesContact[_0x5013('0x19')]({'contact':_0x2c6433});}}}Promise['all'](_0x54771c)['then'](function(){_0x3bdf65({'val':0x1});});})['catch'](function(_0x1a51e1){logger['error'](_0x1a51e1[_0x5013('0x1a')]);});});}function insertAdditionalPhones(_0x514b4d){return new Promise(function(_0x2972cd,_0x20dfc9){var _0x807b2d=_0x514b4d['AdditionalPhones'];if(_[_0x5013('0x18')](_0x807b2d))_0x20dfc9({'val':0x0});else{var _0x43e151=_0x807b2d[_0x5013('0x1b')](';');var _0x2c98d1=[];orderBy=0x0;for(var _0x3f7d0d=0x0;_0x3f7d0d<_0x43e151[_0x5013('0x1c')];_0x3f7d0d++){_0x2c98d1[_0x5013('0x19')](splitAdditionalPhone(_0x514b4d['id'],_0x43e151[_0x3f7d0d]));}Promise[_0x5013('0x1d')](_0x2c98d1)[_0x5013('0x1e')](function(){_0x2972cd({'val':_0x43e151[_0x5013('0x1c')]});});}});}function splitAdditionalPhone(_0x4efc48,_0x2450fe){return new Promise(function(_0x443eac,_0x1b3c38){var _0x1fc88a=_0x2450fe[_0x5013('0x1b')](':');var _0x3e5090=_0x1fc88a[0x0];var _0x2f78fd=_0x1fc88a[0x1];if(_0x2f78fd!==''){var _0x39e900=_0x2f78fd[_0x5013('0x1b')]('|');var _0xc8d411=[];for(var _0x42a2e7=0x0;_0x42a2e7<_0x39e900[_0x5013('0x1c')];_0x42a2e7++){if(_0x39e900[_0x42a2e7]!==''){var _0x383f51=_[_0x5013('0x1f')](promisesAdditionalPhones,{'contactId':_0x4efc48,'phone':_0x39e900[_0x42a2e7]});if(_0x383f51[_0x5013('0x1c')]==0x0){orderBy++;promisesAdditionalPhones[_0x5013('0x19')]({'contactId':_0x4efc48,'contactTypeId':_0x3e5090,'phone':_0x39e900[_0x42a2e7],'orderBy':orderBy});}}}_0x443eac({'ok':0x1});}else _0x443eac({'res':0x0});});}function createAdditionalPhone(_0x2bee7c,_0x14d4a5,_0x2744d6,_0x10fab9){var _0xb4a163='';var _0xc533ad='';var _0x5b5383=_0x2744d6[_0x5013('0x1b')]('§');_0xb4a163=_0x5b5383[0x0];if(_0x5b5383[_0x5013('0x1c')]==0x2)_0xc533ad=_0x5b5383[0x1];return new Promise(function(_0x3429c4,_0x58005e){return db[_0x5013('0x20')][_0x5013('0x21')]({'where':{'CmContactId':_0x2bee7c,'item':_0xb4a163}})['then'](function(_0xf0bb84){if(_0xf0bb84){return db['CmContactHasItem'][_0x5013('0x22')]({'ItemTypeId':_0x14d4a5,'description':_0xc533ad,'OrderBy':_0x10fab9},{'where':{'CmContactId':_0x2bee7c,'item':_0xb4a163}})[_0x5013('0x1e')](function(_0x4c3e11){_0x3429c4({'res':'updated'});});}else{return db[_0x5013('0x20')][_0x5013('0x23')]({'CmContactId':_0x2bee7c,'item':_0xb4a163,'ItemTypeId':_0x14d4a5,'description':_0xc533ad,'OrderBy':_0x10fab9,'ItemClass':_0x5013('0x24')})['then'](function(_0x39bba8){_0x3429c4({'res':_0x5013('0x25')});});}});});}function updateContact(_0x1bdf4c){return new Promise(function(_0x13eaad,_0x56df99){var _0x202453=_0x1bdf4c['id'];delete _0x1bdf4c['id'];return db[_0x5013('0x26')][_0x5013('0x22')](_0x1bdf4c,{'where':{'id':_0x202453}})[_0x5013('0x1e')](function(_0x1327dc){updatedRows+=0x1;return db[_0x5013('0x27')][_0x5013('0x22')]({'phone':_0x1bdf4c[_0x5013('0x28')]},{'where':{'ContactId':_0x202453}})[_0x5013('0x1e')](function(_0x38a7c2){_0x13eaad({'ret':'OK'});});});});}function insertCmHopper(_0x2b2619,_0x3c093a,_0x5b85b8,_0x2919ce,_0xd51028){var _0x932fe9=[_0x5013('0x29'),_0x5013('0x2a'),_0x5013('0x2b'),_0x5013('0x2c'),_0x3c093a+'.'+_0x2919ce,_0x5013('0x2d'),_0x5013('0x2e'),_0x5013('0x2f'),_0x5013('0x30'),'\x22'+_0xd51028+'\x22'];return squel[_0x5013('0x31')]()[_0x5013('0x32')](_0x5013('0x33'))[_0x5013('0x34')]([_0x5013('0x28'),'scheduledat',_0x5013('0x35'),_0x5013('0x36'),_0x2919ce,_0x5013('0x37'),_0x5013('0x38'),'priority',_0x5013('0x39'),_0x5013('0x3a')],squel[_0x5013('0xc')]()[_0x5013('0x3b')](_0x932fe9)[_0x5013('0xe')](_0x3c093a)[_0x5013('0x13')](_0x5013('0x3c'),null,'cm_contacts.ListId\x20=\x20'+_0x3c093a+_0x5013('0x3d'))[_0x5013('0x13')](_0x5b85b8,null,_0x5b85b8+'.id\x20=\x20'+_0x3c093a+'.'+_0x2919ce)['where'](_0x3c093a+_0x5013('0x3e'),_0x2b2619)[_0x5013('0x11')](_0x5013('0x3f'),NOW)['where'](_0x5013('0x40'),selectNotIn(_0x3c093a,_0x5b85b8,_0x2919ce,_0x5013('0x33'),[_0x5013('0x41'),'\x22onlyIfOpen\x22']))['where'](_0x5013('0x40'),selectNotIn(_0x3c093a,_0x5b85b8,_0x2919ce,_0x5013('0x33'),[_0x5013('0x41')])))['toString']();}function insertCmHopperBlack(_0x5df739,_0x4fbe42,_0x2bb30b,_0x8f3fc5){var _0x52e787=['cm_contacts.phone',_0x5013('0x2b'),_0x5013('0x2c'),_0x4fbe42+'.'+_0x8f3fc5,_0x5013('0x2d'),'cm_contacts.updatedAt'];return squel[_0x5013('0x31')]()['into'](_0x5013('0x42'))[_0x5013('0x34')]([_0x5013('0x28'),'ContactId','ListId',_0x8f3fc5,_0x5013('0x37'),_0x5013('0x38')],squel['select']()[_0x5013('0x3b')](_0x52e787)[_0x5013('0xe')](_0x4fbe42)[_0x5013('0x13')](_0x5013('0x3c'),null,_0x5013('0x43')+_0x4fbe42+'.CmListId')[_0x5013('0x13')](_0x2bb30b,null,_0x2bb30b+_0x5013('0xf')+_0x4fbe42+'.'+_0x8f3fc5)[_0x5013('0x11')](_0x4fbe42+'.CmListId\x20=\x20?',_0x5df739)[_0x5013('0x11')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x5013('0x11')](_0x5013('0x40'),squel['select']()[_0x5013('0xd')]('phone')[_0x5013('0xe')](_0x5013('0x42'))[_0x5013('0x11')](_0x5013('0x44'),_0x5df739)[_0x5013('0x11')](_0x8f3fc5+_0x5013('0x45'),_0x4fbe42+'.'+_0x8f3fc5)))[_0x5013('0x46')]();}function insertCmHopperAdditionalPhones(_0x53845d){var _0x4f4836=[_0x5013('0x47'),_0x5013('0x48'),_0x5013('0x49'),_0x5013('0x4a'),_0x5013('0x4b')];return squel[_0x5013('0x31')]()[_0x5013('0x32')](_0x5013('0x4c'))['fromQuery']([_0x5013('0x4d'),'phone',_0x5013('0x4e'),_0x5013('0x37'),_0x5013('0x38')],squel['select']()[_0x5013('0x3b')](_0x4f4836)[_0x5013('0xe')](_0x5013('0x33'))[_0x5013('0x13')](_0x5013('0x3c'),null,_0x5013('0x4f'))['join'](_0x5013('0x50'),null,_0x5013('0x51'))[_0x5013('0x11')]('cm_hopper.ListId\x20=\x20?',_0x53845d)[_0x5013('0x11')](_0x5013('0x3f'),NOW))[_0x5013('0x46')]();}function insertCmContact(_0x522541,_0x37260a,_0x382cf0,_0x28dbe){var _0x204778=_[_0x5013('0x52')](_[_0x5013('0x53')](_0x28dbe),[_0x5013('0x36'),'CompanyId',_0x5013('0x37'),'updatedAt']);return squel[_0x5013('0x31')]()[_0x5013('0x32')]('cm_contacts')['fromQuery'](_0x204778,squel[_0x5013('0xc')]()[_0x5013('0x3b')](_0x204778)[_0x5013('0xe')](_0x37260a)[_0x5013('0x11')]('('+_0x382cf0[_0x5013('0x13')](',')+')\x20NOT\x20IN\x20?',squel[_0x5013('0xc')]()[_0x5013('0x3b')](_0x382cf0)['from']('cm_contacts')[_0x5013('0x11')](_0x5013('0x44'),_0x522541))[_0x5013('0x11')]('id\x20IN\x20?',squel[_0x5013('0xc')]()[_0x5013('0xd')](_0x5013('0x54'),_0x5013('0x55'))[_0x5013('0xe')](_0x37260a)[_0x5013('0x56')](_0x382cf0['join'](','))))[_0x5013('0x46')]();}function handleStop(){logger[_0x5013('0x57')](_0x5013('0x58'));stopped=!![];}function handleUncaughtException(_0x6342e9){logger['error'](_0x6342e9[_0x5013('0x1a')]);process[_0x5013('0x59')](0x1);}function handleError(_0x12ec06,_0x36d247){stats[_0x5013('0x5a')][_0x5013('0x19')]({'name':_0x36d247[_0x5013('0x5b')],'message':_0x36d247['message'],'row':_0x12ec06});}function handleQuery(_0x2ddf90){logger[_0x5013('0x57')](_0x2ddf90);return db[_0x5013('0x14')]['query'](_0x2ddf90)[_0x5013('0x17')](function(_0x1501b6){results[_0x5013('0x19')](_0x1501b6);})[_0x5013('0x5c')](function(_0xb2e79){logger[_0x5013('0x5d')](_0xb2e79['message']);});}function main(_0x2b3ad7,_0x5e42e6,_0x4e1c88,_0x136a1f){logger[_0x5013('0x57')]('main',_0x2b3ad7,JSON['stringify'](_0x5e42e6));process[_0x5013('0x5e')](_0x5013('0x5f'));var _0x22a441=_0x5e42e6[_0x5013('0x60')];var _0xcfde31=_[_0x5013('0x61')](_0x22a441);var _0x1f356a=_0x5e42e6[_0x5013('0x62')];var _0x2f2146=path[_0x5013('0x13')](config[_0x5013('0x63')],'server/files/tmp',_0x1f356a+_0x5013('0x64'));logger[_0x5013('0x57')]('body',_0x5e42e6);db[_0x5013('0x65')]['findAll']({'raw':!![],'attributes':['id',_0x5013('0x66')]})[_0x5013('0x1e')](function(_0x26c532){for(var _0x1b745d=0x0;_0x1b745d<_0x26c532[_0x5013('0x1c')];_0x1b745d++){if(_0x26c532[_0x1b745d][_0x5013('0x66')]in _0x22a441){contactItemTypes[_0x5013('0x19')](_0x26c532[_0x1b745d]);delete _0xcfde31[_0x26c532[_0x1b745d][_0x5013('0x66')]];hasAdditionalPhones=!![];}for(var _0x3913cd in _0x22a441){if(_0x26c532[_0x1b745d]['name']+_0x5013('0x67')===_0x3913cd){phoneDescriptions['push']({'itemTypeId':_0x26c532[_0x1b745d]['id'],'description':_0x3913cd});delete _0xcfde31[_0x3913cd];}}}if(hasAdditionalPhones)_0xcfde31[_0x5013('0x68')]='';var _0x3f247d=_[_0x5013('0x53')](_0xcfde31)[_0x5013('0x13')]();logger[_0x5013('0x57')](_0x5013('0x69'),_0x3f247d);fs[_0x5013('0x6a')](_0x2f2146,_0x3f247d+'\x0a');Papa[_0x5013('0x6b')](fs[_0x5013('0x6c')](_0x2b3ad7),{'header':!![],'skipEmptyLines':!![],'step':function(_0x277bf3,_0x42a9a2){try{for(var _0x5b3c7a=0x0,_0x2cc1bd=[];_0x5b3c7a<_0x277bf3[_0x5013('0x6d')][_0x5013('0x1c')];_0x5b3c7a++){stats[_0x5013('0x6e')]+=0x1;if(_0x277bf3[_0x5013('0x5a')][_0x5b3c7a]){handleError(_0x277bf3[_0x5013('0x6d')][_0x5b3c7a],_0x277bf3[_0x5013('0x5a')][_0x5b3c7a]);}else{var _0x205c82=[];var _0x4ef8a6=[];var _0x46647b={};for(var _0x5d709c in _0x22a441){let _0x2cc177=contactItemTypes[_0x5013('0x6f')](_0x1dd846=>_0x1dd846['name']===_0x5d709c);let _0x185eac=contactItemTypes[_0x5013('0x6f')](_0x56cc92=>_0x56cc92['name']+_0x5013('0x67')===_0x5d709c);if(_[_0x5013('0x18')](_0x2cc177)&&_[_0x5013('0x18')](_0x185eac)){if(_0x22a441[_0x5013('0x70')](_0x5d709c)){if(_0x277bf3[_0x5013('0x6d')][_0x5b3c7a][_0x22a441[_0x5d709c]]){var _0xb7ff36=_[_0x5013('0x71')](_0x277bf3[_0x5013('0x6d')][_0x5b3c7a][_0x22a441[_0x5d709c]]['replace'](/"/g,'\x27'));switch(_0x5d709c){case _0x5013('0x72'):var _0x466bb4=moment(_0xb7ff36,_0x5013('0xa'),!![]);if(_0x466bb4[_0x5013('0x73')]()){_0x2cc1bd[_0x5013('0x19')]('\x22'+_0xb7ff36+'\x22');}else{_0x205c82[_0x5013('0x19')](_0x5013('0x74'));}break;case'priority':var _0x550563=parseInt(_0xb7ff36);_0xb7ff36=_['isNaN'](_0x550563)||_0x550563<0x0||_0x550563>0x4?_0x136a1f?0x3:0x2:_0x550563;_0x2cc1bd[_0x5013('0x19')]('\x22'+_0xb7ff36+'\x22');break;case _0x5013('0x39'):var _0x6d65b9=parseInt(_0xb7ff36);if(_[_0x5013('0x75')](_0x6d65b9)&&_[_0x5013('0x76')](_0x4e1c88,_0x6d65b9)){_0x2cc1bd['push']('\x22'+_0x6d65b9+'\x22');}else{_0x205c82['push'](_0x5013('0x77'));}break;case _0x5013('0x78'):if(isEmail(_0xb7ff36)){_0x2cc1bd[_0x5013('0x19')]('\x22'+_0xb7ff36+'\x22');}else{_0x205c82['push']('email\x20wrong\x20format');}break;case _0x5013('0x79'):var _0x2fb407=moment(_0xb7ff36,_0x5013('0x7a'),!![]);if(_0x2fb407[_0x5013('0x73')]()){_0x2cc1bd[_0x5013('0x19')]('\x22'+_0xb7ff36+'\x22');}else{_0x205c82[_0x5013('0x19')](_0x5013('0x7b'));}break;default:_0x2cc1bd[_0x5013('0x19')]('\x22'+_0xb7ff36+'\x22');}}else{switch(_0x5d709c){case _0x5013('0x7c'):case _0x5013('0x28'):_0x205c82['push'](_0x5d709c+_0x5013('0x7d'));break;default:_0x2cc1bd[_0x5013('0x19')]('\x22\x22');}}}}else{var _0x36bed9='';if(!_['isNil'](_0x2cc177)){if(!_0x46647b[_0x5013('0x70')](_0x2cc177['id'])){for(var _0x55a6fe=0x0;_0x55a6fe<_0x22a441[_0x5d709c]['length'];_0x55a6fe++){var _0xb7ff36=_[_0x5013('0x71')](_0x277bf3[_0x5013('0x6d')][_0x5b3c7a][_0x22a441[_0x5d709c][_0x55a6fe]]['replace'](/"/g,'\x27'));var _0x2a84d0=phoneDescriptions[_0x5013('0x6f')](_0x51733c=>_0x51733c[_0x5013('0x7e')]===_0x2cc177['id']);if(!_[_0x5013('0x18')](_0x2a84d0)){var _0x598611=_[_0x5013('0x71')](_0x277bf3[_0x5013('0x6d')][_0x5b3c7a][_0x22a441[_0x2a84d0[_0x5013('0x7f')]][0x0]][_0x5013('0x80')](/"/g,'\x27'));if(!_[_0x5013('0x18')](_0x598611))_0xb7ff36=_0xb7ff36+'§'+_0x598611;}if(_0x36bed9=='')_0x36bed9=_0xb7ff36;else _0x36bed9+='|'+_0xb7ff36;}_0x4ef8a6[_0x5013('0x19')](_0x2cc177['id']+':'+_0x36bed9);_0x46647b[_0x2cc177['id']]=0x1;}}}}if(hasAdditionalPhones){_0x2cc1bd['push']('\x22'+_0x4ef8a6[_0x5013('0x13')](';')+'\x22');}if(_0x205c82['length']){handleError(_0x277bf3['data'][_0x5b3c7a],{'code':_0x5013('0x81'),'message':_0x205c82['join']()});}else{fs['appendFileSync'](_0x2f2146,_0x2cc1bd[_0x5013('0x13')]()+'\x0a');}_0x2cc1bd=[];}if(!(stats[_0x5013('0x6e')]%0xc8)){socket['emit']('contact:import:'+_0x1f356a,stats);stats['errors']=[];}}if(stopped){logger[_0x5013('0x57')](_0x5013('0x82'));_0x42a9a2[_0x5013('0x83')]();}}catch(_0x58a601){handleError(_0x277bf3[_0x5013('0x6d')][_0x5b3c7a],{'code':'SystemError','message':_0x58a601[_0x5013('0x1a')]});logger['error'](_0x5013('0x84'),_0x58a601[_0x5013('0x1a')]);}},'complete':function(){try{var _0x70caf3=[];var _0x5e7c0d=tempTableName;_0x70caf3[_0x5013('0x19')](_0x5013('0x85')+_0x5e7c0d+_0x5013('0x86'));logger[_0x5013('0x57')]('CIS\x20len',contactItemTypes[_0x5013('0x1c')]);var _0x3da073=util[_0x5013('0x9')](_0x5013('0x87'),_0x2f2146,_0x5e7c0d,_0x3f247d,_0x5e42e6[_0x5013('0x36')],_0x5e42e6[_0x5013('0x88')]||null,NOW,NOW);if(_[_0x5013('0x18')](_0x22a441['scheduledat'])){_0x3da073+=',\x20scheduledAt\x20=\x20NOW()';}_0x70caf3[_0x5013('0x19')](_0x3da073);BPromise['each'](_0x70caf3,handleQuery)[_0x5013('0x1e')](function(_0x3f0692){BPromise[_0x5013('0x1d')]([handleAdditionalPhones()])['then'](function(){_0x70caf3=[];for(var _0x50a318=0x0;_0x50a318\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 +var _0xc98f=['$substring','split','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','Tag','tags','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','text','body','keys','some','concat','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','resolve','then','fields','read','clause','filter','capitalize','chat','Accounts','agent','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.secondDisposition','i.disposition','i.substatus','closed','shift','join','Interaction','Sequelize','QueryTypes','SELECT','sequelize','query','toString','keyBy','merge','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','i.id','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.subject','i.UserId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','limit','offset','groupBy','Setting','findOne','enableEmailPreview','all','clone','COUNT(*)','isEmpty','exports','../parsers/advancedSearch','../parsers/qs','updateInteraction','getAccountFK','role','search','select','field','name','getInteractionFK','_interactions','u.id','u.fullname','from','left_join','users','length','where','ui.','\x20IN\x20?','map','interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','messages','interactionsTags','\x20=\x20i.id','tools_tags','expr','getSelectedTags','forEach','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','isNumeric','sms','whatsapp','includes','i.phone\x20LIKE\x20?','fax','i.fax\x20LIKE\x20?','i.from\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','mail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','conditions','find','type','value','start','end','unreadMessages','and','operator'];(function(_0xd1e166,_0xe8fc79){var _0x4a7544=function(_0x36403b){while(--_0x36403b){_0xd1e166['push'](_0xd1e166['shift']());}};_0x4a7544(++_0xe8fc79);}(_0xc98f,0x189));var _0xfc98=function(_0x427345,_0x4aae84){_0x427345=_0x427345-0x0;var _0x36575a=_0xc98f[_0x427345];return _0x36575a;};'use strict';var _=require('lodash');var squel=require('squel');var as=require(_0xfc98('0x0'));var qs=require(_0xfc98('0x1'));var updateInteraction=require('./update-interaction')[_0xfc98('0x2')];var utils=require('./utils');var db=require('../../mysqldb')['db'];function skipInteractionsQuery(_0xe48bf2,_0x271b9f,_0x2331b3){var _0x1b5411=![];var _0x499c17=utils[_0xfc98('0x3')](_0xe48bf2);if(_0x271b9f[_0xfc98('0x4')]==='agent'&&!_0x2331b3[_0xfc98('0x5')]&&!_0x2331b3[_0x499c17]){_0x1b5411=!![];}return _0x1b5411;}function getTagsQuery(){return squel[_0xfc98('0x6')]()['field']('id')[_0xfc98('0x7')](_0xfc98('0x8'))['field']('color')['from']('tools_tags');}function getUsersQuery(_0x5d5e8,_0x8c4c71){var _0x3c80ef=utils[_0xfc98('0x9')](_0x5d5e8);var _0x30ec6b='user_has_'+_0x5d5e8+_0xfc98('0xa');var _0x553bf3=squel[_0xfc98('0x6')]()[_0xfc98('0x7')](_0xfc98('0xb'))[_0xfc98('0x7')](_0xfc98('0xc'))[_0xfc98('0x7')]('ui.'+_0x3c80ef)[_0xfc98('0xd')](_0x30ec6b,'ui')[_0xfc98('0xe')](_0xfc98('0xf'),'u','u.id\x20=\x20ui.UserId');if(_0x8c4c71[_0xfc98('0x10')]>0x0){_0x553bf3[_0xfc98('0x11')](_0xfc98('0x12')+_0x3c80ef+_0xfc98('0x13'),_[_0xfc98('0x14')](_0x8c4c71,'id'));}return _0x553bf3;}function getInteractionsQuery(_0x35f218){var _0xd7500d=utils['getInteractionsTables'](_0x35f218);var _0x2c2912=utils['getAccountFK'](_0x35f218);var _0x2b9a47=utils[_0xfc98('0x9')](_0x35f218);return squel[_0xfc98('0x6')]()['from'](_0xd7500d[_0xfc98('0x15')],'i')[_0xfc98('0xe')]('cm_contacts','c',_0xfc98('0x16'))[_0xfc98('0xe')](_0xfc98('0xf'),'o',_0xfc98('0x17'))[_0xfc98('0xe')](_0xd7500d[_0xfc98('0x18')],'a',_0xfc98('0x19')+_0x2c2912)[_0xfc98('0xe')](_0xd7500d[_0xfc98('0x1a')],'me','me.'+_0x2b9a47+'\x20=\x20i.id')['left_join'](_0xd7500d[_0xfc98('0x1b')],'it','it.'+_0x2b9a47+_0xfc98('0x1c'))[_0xfc98('0xe')](_0xfc98('0x1d'),'t','t.id\x20=\x20it.TagId');}function getSqlClauses(){var _0x53a7cd={'body':squel[_0xfc98('0x1e')](),'contact':squel[_0xfc98('0x1e')](),'default':squel[_0xfc98('0x1e')](),'fields':squel['expr'](),'filter':squel['expr'](),'read':squel['expr'](),'tags':{'clause':squel['expr'](),'ids':null},'user':squel[_0xfc98('0x1e')]()};return _0x53a7cd;}function parseTagParameter(_0xa3636){var _0x512ba0=squel[_0xfc98('0x1e')]();if(_0xa3636){var _0x280200=utils[_0xfc98('0x1f')](_0xa3636);_0x280200[_0xfc98('0x20')](function(_0x4af428){_0x512ba0['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4af428+',%');});}return _0x512ba0;}function parseReadParameter(_0x274096){var _0x17525d='';if(_0x274096){_0x17525d=_0xfc98('0x21');if(_0x274096==='1'){_0x17525d=_0x17525d[_0xfc98('0x22')](_0xfc98('0x23'),'=');}else{_0x17525d=_0x17525d[_0xfc98('0x22')](_0xfc98('0x23'),'>');}}return _0x17525d;}function parseSearchFilter(_0x46c2b0,_0x8b2d1a){var _0x4752f9=squel[_0xfc98('0x1e')]();if(_0x8b2d1a){var _0x22f5ef=_0x8b2d1a[_0xfc98('0x22')]('\x5c','\x5c\x5c')[_0xfc98('0x22')](/'/g,'\x27\x27');if(qs[_0xfc98('0x24')](_0x22f5ef)){_0x4752f9['or']('i.id\x20LIKE\x20?',_0x22f5ef+'%');if([_0xfc98('0x25'),_0xfc98('0x26')][_0xfc98('0x27')](_0x46c2b0)){_0x4752f9['or'](_0xfc98('0x28'),_0x22f5ef+'%');}else if(_0x46c2b0===_0xfc98('0x29')){_0x4752f9['or'](_0xfc98('0x2a'),_0x22f5ef+'%');}else if(_0x46c2b0==='openchannel'){_0x4752f9['or'](_0xfc98('0x2b'),_0x22f5ef+'%');}}else if(_0x46c2b0==='mail'&&qs[_0xfc98('0x2c')](_0x22f5ef)){_0x4752f9['or'](_0xfc98('0x2d'),_0x22f5ef+'%');}else{if(_0x46c2b0===_0xfc98('0x2e')){_0x4752f9['or'](_0xfc98('0x2f'),qs['getFullTextValue'](_0x22f5ef,!![]))['or'](_0xfc98('0x30'),qs[_0xfc98('0x31')](_0x22f5ef));}else if(_0x46c2b0!=='fax'){_0x4752f9['or'](_0xfc98('0x32'),qs['getFullTextValue'](_0x22f5ef));}_0x4752f9['or'](_0xfc98('0x33'),qs[_0xfc98('0x31')](_0x22f5ef,!![]),null);}}return _0x4752f9;}function parseAdvancedSearchFilter(_0x31ba08,_0x5c7a23){var _0x2f496d=getSqlClauses();var _0x2bc0bd=as[_0xfc98('0x34')](_0x31ba08);var _0x348e18=_0x2bc0bd[_0xfc98('0x35')];for(var _0x49a13e=0x0;_0x49a13e<_0x2bc0bd[_0xfc98('0x36')]['length'];_0x49a13e++){var _0x333a13=_0x2bc0bd['conditions'][_0x49a13e];var _0x2caedb='i';var _0x33a393=_[_0xfc98('0x37')](_0x5c7a23,[_0xfc98('0x8'),_0x333a13[_0xfc98('0x7')]]);if(_0x33a393){var _0x13b0b4=as['buildExpression'](_0x2caedb,_0x33a393[_0xfc98('0x38')],_0x333a13);_0x2f496d['default'][_0x348e18](_0x13b0b4['text'],_0x13b0b4[_0xfc98('0x39')][_0xfc98('0x3a')],_0x13b0b4['value'][_0xfc98('0x3b')]);}else{switch(_0x333a13['field']){case _0xfc98('0x3c'):var _0x379637=parseReadParameter(_0x333a13[_0xfc98('0x39')]);_0x2f496d['read'][_0xfc98('0x3d')](_0x379637);break;case'Contact':if(_0x333a13[_0xfc98('0x3e')]===_0xfc98('0x3f')){if(_0x333a13[_0xfc98('0x39')][_0xfc98('0x40')]('\x20')[_0xfc98('0x10')]>0x1){_0x2f496d['contact'][_0x348e18]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xfc98('0x31')](_0x333a13[_0xfc98('0x39')],!![]),null);}else{var _0x233b8f='%'+_0x333a13['value']+'%';_0x2f496d[_0xfc98('0x41')][_0x348e18](_0xfc98('0x42'),_0x233b8f,_0x233b8f,_0x233b8f);}}else{_0x33a393=_['find'](_0x5c7a23,[_0xfc98('0x8'),'ContactId']);_0x333a13['field']=_0xfc98('0x43');_0x13b0b4=as['buildExpression'](_0x2caedb,_0x33a393[_0xfc98('0x38')],_0x333a13);_0x2f496d[_0xfc98('0x41')][_0x348e18](_0x13b0b4['text'],_0x13b0b4[_0xfc98('0x39')][_0xfc98('0x3a')],_0x13b0b4['value'][_0xfc98('0x3b')]);}break;case _0xfc98('0x44'):var _0x34adc7=_0x333a13[_0xfc98('0x39')][_0xfc98('0x40')](',')[_0xfc98('0x14')](function(_0x588841){return Number(_0x588841);});var _0x40cccd=parseTagParameter(_0x34adc7);_0x2f496d['tags']['clause']['and'](_0x40cccd);_0x2f496d[_0xfc98('0x45')]['ids']=_0x34adc7;break;case'User':if(_0x333a13[_0xfc98('0x3e')]==='$substring'){_0x2f496d[_0xfc98('0x46')][_0x348e18](_0xfc98('0x47'),'%'+_0x333a13[_0xfc98('0x39')]+'%',null);}else{_0x33a393=_[_0xfc98('0x37')](_0x5c7a23,[_0xfc98('0x8'),_0xfc98('0x48')]);_0x333a13[_0xfc98('0x7')]='UserId';_0x13b0b4=as[_0xfc98('0x49')](_0x2caedb,_0x33a393[_0xfc98('0x38')],_0x333a13);_0x2f496d['user'][_0x348e18](_0x13b0b4[_0xfc98('0x4a')],_0x13b0b4[_0xfc98('0x39')][_0xfc98('0x3a')],_0x13b0b4[_0xfc98('0x39')]['end']);}break;case _0xfc98('0x4b'):case'plainBody':_0x13b0b4=as[_0xfc98('0x49')]('me',null,_0x333a13);_0x2f496d['body'][_0x348e18](_0x13b0b4[_0xfc98('0x4a')],_0x13b0b4[_0xfc98('0x39')][_0xfc98('0x3a')],_0x13b0b4[_0xfc98('0x39')][_0xfc98('0x3b')]);break;}}}return _0x2f496d;}function parseModelFields(_0x175f0a,_0x12f392,_0x423cca){var _0x3d36f1=utils[_0xfc98('0x3')](_0x175f0a);var _0x5b19ba=squel[_0xfc98('0x1e')]();var _0x415c96=_(_0x12f392)[_0xfc98('0x4c')]()['map'](function(_0x4c83a8){return _[_0xfc98('0x4d')](_0x423cca,[_0xfc98('0x8'),_0x4c83a8])?_0x4c83a8:undefined;})['compact']()[_0xfc98('0x39')]();if(_0x415c96[_0xfc98('0x10')]>0x0){_0x415c96[_0xfc98('0x20')](function(_0x4f4aa6){if(_0x4f4aa6===_0x3d36f1){_0x5b19ba['and']('i.'+_0x3d36f1+'\x20IN\x20?',[][_0xfc98('0x4e')](_0x12f392[_0x4f4aa6]));}else if(_0x4f4aa6==='createdAt'){var _0x1a046f=JSON[_0xfc98('0x4f')](_0x12f392[_0x4f4aa6])['$gte'];var _0x48d360=JSON[_0xfc98('0x4f')](_0x12f392[_0x4f4aa6])[_0xfc98('0x50')];_0x5b19ba['and'](_0xfc98('0x51'),_0x1a046f,_0x48d360);}else{if(_0x12f392[_0x4f4aa6]==='null'){_0x5b19ba[_0xfc98('0x3d')]('i.'+_0x4f4aa6+_0xfc98('0x52'));}else{_0x5b19ba[_0xfc98('0x3d')]('i.'+_0x4f4aa6+_0xfc98('0x53'),_0x12f392[_0x4f4aa6]);}}});}return _0x5b19ba;}function parseQueryParameters(_0xce7863,_0x10ebca,_0xe4f639){var _0x23a166=getSqlClauses();return Promise[_0xfc98('0x54')]()[_0xfc98('0x55')](function(){return parseModelFields(_0xce7863,_0x10ebca,_0xe4f639);})['then'](function(_0x22f2f0){_0x23a166[_0xfc98('0x56')][_0xfc98('0x3d')](_0x22f2f0);return parseReadParameter(_0x10ebca['read']);})['then'](function(_0x4a22d7){_0x23a166[_0xfc98('0x57')][_0xfc98('0x3d')](_0x4a22d7);return parseTagParameter(_0x10ebca['tag']);})[_0xfc98('0x55')](function(_0x3ecae5){_0x23a166[_0xfc98('0x45')][_0xfc98('0x58')][_0xfc98('0x3d')](_0x3ecae5);return parseSearchFilter(_0xce7863,_0x10ebca[_0xfc98('0x59')]);})[_0xfc98('0x55')](function(_0x1b26ae){_0x23a166[_0xfc98('0x59')]=_0x1b26ae;return _0x23a166;});}function checkAccountsRestrictions(_0x28633c,_0x2b2580,_0x44c01d){var _0x31fa0e=utils[_0xfc98('0x3')](_0x28633c);var _0x575795='get'+_[_0xfc98('0x5a')](_0x28633c)+(_0x28633c===_0xfc98('0x5b')?'Websites':_0xfc98('0x5c'));var _0x113beb=squel[_0xfc98('0x1e')]();return Promise[_0xfc98('0x54')]()['then'](function(){if(_0x44c01d['search']&&_0x2b2580[_0xfc98('0x4')]===_0xfc98('0x5d')){return _0x2b2580[_0x575795]({'attributes':['id'],'raw':!![]});}})[_0xfc98('0x55')](function(_0x4d1945){if(_0x4d1945){if(_0x4d1945[_0xfc98('0x10')]===0x0){_0x113beb['and']('i.'+_0x31fa0e+_0xfc98('0x52'));}else{_0x113beb[_0xfc98('0x3d')]('i.'+_0x31fa0e+_0xfc98('0x13'),_['map'](_0x4d1945,'id'));}}else if(!_0x44c01d[_0x31fa0e]){_0x113beb[_0xfc98('0x3d')]('i.'+_0x31fa0e+_0xfc98('0x5e'));}})['then'](function(){return _0x113beb;});}function getClosedOrderClause(_0x4b7fb8,_0x47a77c){var _0x43eb79='';var _0xaa03cb=[_0xfc98('0x5f'),_0xfc98('0x60'),_0xfc98('0x61')];if(_0x4b7fb8===_0xfc98('0x2e')){_0xaa03cb['unshift'](_0xfc98('0x62'));}if(_0x47a77c[_0xfc98('0x63')]==='0'&&_0x4b7fb8===_0xfc98('0x2e')){_0x43eb79=_0xfc98('0x62');}else{if(_0x47a77c[_0xfc98('0x63')]==='1'){_0xaa03cb[_0xfc98('0x64')]();}_0x43eb79='CONCAT_WS(\x27\x27,\x20'+_0xaa03cb[_0xfc98('0x65')](',\x20')+')';}return _0x43eb79;}function getFilteredInteractions(_0x4d3e26,_0x4b1c70,_0xf7d971,_0x5737aa){var _0x242c25=utils['getInteractionFK'](_0x4d3e26);var _0x1a25a8=_[_0xfc98('0x5a')](_0x4d3e26)+_0xfc98('0x66');var _0x47714b=[];var _0x1aa08a=getTagsQuery();var _0x33ffde={'type':db[_0xfc98('0x67')][_0xfc98('0x68')][_0xfc98('0x69')],'raw':!![]};var _0x510a4a=[];var _0x274a55=[];return db[_0xfc98('0x6a')][_0xfc98('0x6b')](_0x1aa08a[_0xfc98('0x6c')](),_0x33ffde)[_0xfc98('0x55')](function(_0xe01fd){_0x47714b=_[_0xfc98('0x6d')](_0xe01fd,'id');_0x33ffde=_[_0xfc98('0x6e')](_0x33ffde,{'model':db[_0x1a25a8],'mapToModel':!![],'nest':!![]});if(_0xf7d971[_0xfc98('0x56')]){_0x5737aa[_0xfc98('0x6f')]['forEach'](function(_0x344ebd){_0x4b1c70[_0xfc98('0x7')]('i.'+_0x344ebd);});}else{_0x4b1c70['field'](_0xfc98('0x70'),_0xfc98('0x3c'));_0x4b1c70[_0xfc98('0x7')](_0xfc98('0x71'),_0xfc98('0x72'));_0x4b1c70[_0xfc98('0x7')](_0xfc98('0x73'),_0xfc98('0x74'));if(_0x4d3e26===_0xfc98('0x2e')){_0x4b1c70[_0xfc98('0x7')](_0xfc98('0x75'),'Account.email');_0x4b1c70[_0xfc98('0x7')]('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x4b1c70[_0xfc98('0x7')](_0xfc98('0x76'));_0x4b1c70['field'](_0xfc98('0x77'));_0x4b1c70['field'](_0xfc98('0x78'));_0x4b1c70['field'](_0xfc98('0x79'));_0x4b1c70[_0xfc98('0x7')](_0xfc98('0x7a'));_0x4b1c70['field']('i.attach');_0x4b1c70[_0xfc98('0x7')]('i.lastMsgAt');_0x4b1c70[_0xfc98('0x7')]('i.lastMsgDirection');_0x4b1c70['field'](_0xfc98('0x7b'));_0x4b1c70[_0xfc98('0x7')](_0xfc98('0x61'));_0x4b1c70['field']('i.secondDisposition');_0x4b1c70[_0xfc98('0x7')](_0xfc98('0x5f'));_0x4b1c70[_0xfc98('0x7')](_0xfc98('0x62'));_0x4b1c70[_0xfc98('0x7')]('i.to');_0x4b1c70[_0xfc98('0x7')]('i.ContactId');_0x4b1c70['field']('i.MailAccountId');_0x4b1c70[_0xfc98('0x7')](_0xfc98('0x7c'));}else if(_0x4d3e26==='openchannel'){_0x4b1c70[_0xfc98('0x7')](_0xfc98('0x7d'),_0xfc98('0x7e'));}else{_0x4b1c70[_0xfc98('0x7')](_0xfc98('0x7f'),_0xfc98('0x7e'));}if(_0x4d3e26!==_0xfc98('0x2e')){_0x4b1c70[_0xfc98('0x7')]('i.*');}_0x4b1c70[_0xfc98('0x7')](_0xfc98('0x80'),'Contact.firstName');_0x4b1c70[_0xfc98('0x7')](_0xfc98('0x81'),_0xfc98('0x82'));_0x4b1c70[_0xfc98('0x7')](_0xfc98('0x83'),_0xfc98('0x84'));_0x4b1c70[_0xfc98('0x7')]('c.phone',_0xfc98('0x85'));_0x4b1c70['field'](_0xfc98('0x86'),_0xfc98('0x87'));_0x4b1c70['field']('c.fax','Contact.fax');_0x4b1c70[_0xfc98('0x7')](_0xfc98('0x88'),_0xfc98('0x89'));_0x4b1c70['field'](_0xfc98('0x8a'),_0xfc98('0x8b'));_0x4b1c70[_0xfc98('0x7')](_0xfc98('0x8c'),'TagIds');}if(_0x5737aa[_0xfc98('0x8d')]){_0x4b1c70[_0xfc98('0x8d')](_0x5737aa[_0xfc98('0x8d')]);}if(_0x5737aa['offset']){_0x4b1c70[_0xfc98('0x8e')](_0x5737aa[_0xfc98('0x8e')]);}return db[_0xfc98('0x6a')][_0xfc98('0x6b')](_0x4b1c70[_0xfc98('0x6c')](),_0x33ffde);})['then'](function(_0x2dc90d){_0x510a4a=_0x2dc90d;var _0x64e71c=getUsersQuery(_0x4d3e26,_0x510a4a);return db['sequelize'][_0xfc98('0x6b')](_0x64e71c[_0xfc98('0x6c')](),_0x33ffde);})[_0xfc98('0x55')](function(_0x437eb3){_0x274a55=_[_0xfc98('0x8f')](_0x437eb3,_0x242c25);if(_0x4d3e26===_0xfc98('0x2e')){return db[_0xfc98('0x90')][_0xfc98('0x91')]({'attributes':[_0xfc98('0x92')],'raw':!![]});}})[_0xfc98('0x55')](function(_0x7cfa11){var _0x99093c=_0x7cfa11?_0x7cfa11[_0xfc98('0x92')]:undefined;var _0x450cd8=_0x510a4a[_0xfc98('0x14')](function(_0x19ffa9){return updateInteraction(_0x19ffa9,_0x47714b,_0x274a55,_0x99093c);});return Promise[_0xfc98('0x93')](_0x450cd8);});}function countFilteredInteractions(_0x2c3197,_0xaef7a9){var _0x5b09d2=_0x2c3197[_0xfc98('0x94')]();_0x5b09d2[_0xfc98('0x7')](_0xfc98('0x95'));_0x5b09d2['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xfc98('0x3c'));var _0x1deb9=utils[_0xfc98('0x1f')](_0xaef7a9);if(!_[_0xfc98('0x96')](_0x1deb9)){_0x5b09d2[_0xfc98('0x11')]('t.id\x20IN\x20?',_0x1deb9);}var _0x5b8bef={'type':db['Sequelize']['QueryTypes'][_0xfc98('0x69')],'raw':!![]};return db[_0xfc98('0x6a')][_0xfc98('0x6b')](_0x5b09d2[_0xfc98('0x6c')](),_0x5b8bef);}module[_0xfc98('0x97')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file diff --git a/server/components/interaction/update-interaction.js b/server/components/interaction/update-interaction.js index a6d6e7b..d5aa4c8 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 _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 +var _0xf900=['-id','then','plainBody','trimStart','catch','Users','lodash','../../mysqldb','map','fullname','split','push','waiting','talking','answered','unmanaged','abandoned','UserId','disposition','MailMessage','findOne'];(function(_0x458205,_0xf5ac12){var _0x3be7c4=function(_0x272208){while(--_0x272208){_0x458205['push'](_0x458205['shift']());}};_0x3be7c4(++_0xf5ac12);}(_0xf900,0x117));var _0x0f90=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xf900[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x0f90('0x0'));var db=require(_0x0f90('0x1'))['db'];function getInteractionUsers(_0x1421f2,_0xdb9da){return new Promise(function(_0x2c61df,_0x2dfa37){try{var _0x4b1ab9=[];if(_0xdb9da[_0x1421f2]){_0x4b1ab9=_0xdb9da[_0x1421f2][_0x0f90('0x2')](function(_0xcbb848){return{'id':_0xcbb848['id'],'fullname':_0xcbb848[_0x0f90('0x3')]};});}return _0x2c61df(_0x4b1ab9);}catch(_0x41017d){_0x2dfa37(_0x41017d);}});}function getInteractionTags(_0x4f704a,_0x2ace2a){var _0x2542d6=[];if(_0x4f704a){_0x4f704a[_0x0f90('0x4')](',')['forEach'](function(_0x2a7541){_0x2542d6[_0x0f90('0x5')](_0x2ace2a[_0x2a7541]);});}return _0x2542d6;}function updateWaitingCounter(_0x1b818f){if(_0x1b818f['waiting']){_0x1b818f[_0x0f90('0x6')]-=0x1;}}function updateInteractionCounters(_0x33de10){_0x33de10[_0x0f90('0x6')]=0x0;_0x33de10[_0x0f90('0x7')]=0x0;_0x33de10[_0x0f90('0x8')]=0x0;_0x33de10[_0x0f90('0x9')]=0x0;_0x33de10['abandoned']=0x0;_0x33de10['total']=0x0;if(_0x33de10['closed']){if(_0x33de10['disposition']==='abandoned'){_0x33de10[_0x0f90('0xa')]+=0x1;updateWaitingCounter(_0x33de10);}if(_0x33de10[_0x0f90('0xb')]){_0x33de10[_0x0f90('0x8')]+=0x1;if(_0x33de10[_0x0f90('0x7')]){_0x33de10[_0x0f90('0x7')]-=0x1;}}else{if(_0x33de10[_0x0f90('0xc')]){_0x33de10['unmanaged']+=0x1;updateWaitingCounter(_0x33de10);}}}else{if(!_0x33de10[_0x0f90('0xb')]){_0x33de10[_0x0f90('0x6')]+=0x1;}if(_0x33de10['UserId']){_0x33de10['talking']+=0x1;updateWaitingCounter(_0x33de10);}}_0x33de10['total']+=0x1;return _0x33de10;}function getLastMessageText(_0x1f9d94){return db[_0x0f90('0xd')][_0x0f90('0xe')]({'where':{'$and':[{'MailInteractionId':_0x1f9d94['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x0f90('0xf'),'raw':!![]})[_0x0f90('0x10')](function(_0x1502dc){if(_0x1502dc&&_0x1502dc[_0x0f90('0x11')]){_0x1f9d94['lastMsgText']=_[_0x0f90('0x12')](_0x1502dc[_0x0f90('0x11')]);}return _0x1f9d94;})[_0x0f90('0x13')](function(_0x1d43dd){throw _0x1d43dd;});}exports['updateInteraction']=function(_0x5b2b0a,_0x444a20,_0x33b1e6,_0xc02013){return new Promise(function(_0x1c3edf,_0x39c72b){return getInteractionUsers(_0x5b2b0a['id'],_0x33b1e6)['then'](function(_0x1d41bc){_0x5b2b0a[_0x0f90('0x14')]=_0x1d41bc;return getInteractionTags(_0x5b2b0a['TagIds'],_0x444a20);})[_0x0f90('0x10')](function(_0x2469f9){_0x5b2b0a['Tags']=_0x2469f9;delete _0x5b2b0a['TagIds'];return updateInteractionCounters(_0x5b2b0a);})[_0x0f90('0x10')](function(_0x52ffbc){if(_0xc02013){return getLastMessageText(_0x52ffbc);}else{return _0x52ffbc;}})[_0x0f90('0x10')](function(_0x46c1d8){_0x1c3edf(_0x46c1d8);})[_0x0f90('0x13')](function(_0x1be04f){_0x39c72b(_0x1be04f);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index 21aae90..2c3326a 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 _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 +var _0xa74e=['user_has_','isArray','toLowerCase','toUpperCase','name','role','stringify','null','Interaction','then','info','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat','Website','Account','InteractionId','upperFirst','unknown','websites','accounts','_interactions','_interaction_has_tags','_messages'];(function(_0x292811,_0x249a37){var _0x168b24=function(_0xcab11e){while(--_0xcab11e){_0x292811['push'](_0x292811['shift']());}};_0x168b24(++_0x249a37);}(_0xa74e,0x184));var _0xea74=function(_0x2c52c9,_0x577ec8){_0x2c52c9=_0x2c52c9-0x0;var _0x4511f2=_0xa74e[_0x2c52c9];return _0x4511f2;};'use strict';var _=require(_0xea74('0x0'));var db=require(_0xea74('0x1'))['db'];var loggers={'openchannel':require(_0xea74('0x2'))(_0xea74('0x3')),'mail':require(_0xea74('0x2'))(_0xea74('0x4')),'fax':require(_0xea74('0x2'))(_0xea74('0x5')),'sms':require(_0xea74('0x2'))(_0xea74('0x6')),'chat':require('../../config/logger')('chat-interactions'),'whatsapp':require('../../config/logger')('whatsapp-interactions')};function getAccountFK(_0x4c1c55){return _['capitalize'](_0x4c1c55)+(_0x4c1c55===_0xea74('0x7')?_0xea74('0x8'):_0xea74('0x9'))+'Id';}function getInteractionFK(_0xdbeb83){return _['capitalize'](_0xdbeb83)+_0xea74('0xa');}function getInteractionId(_0x402427,_0x408cc4,_0x34bba7){if(_0x402427&&_0x402427[_['upperFirst'](_0x34bba7)+_0xea74('0xa')]){return _0x402427[_[_0xea74('0xb')](_0x34bba7)+_0xea74('0xa')];}else if(_0x402427&&_0x402427['id']){return _0x402427['id'];}else if(_0x408cc4&&_0x408cc4['id']){return _0x408cc4['id'];}else{return _0xea74('0xc');}}function getInteractionsTables(_0x35f313){return{'accounts':_0x35f313+'_'+(_0x35f313===_0xea74('0x7')?_0xea74('0xd'):_0xea74('0xe')),'interactions':_0x35f313+_0xea74('0xf'),'interactionsTags':_0x35f313+_0xea74('0x10'),'messages':_0x35f313+_0xea74('0x11'),'userInteractions':_0xea74('0x12')+_0x35f313+'_interactions'};}function getSelectedTags(_0x3c01f9){var _0x44a587=[];if(_0x3c01f9){_0x44a587=Array[_0xea74('0x13')](_0x3c01f9)?_0x3c01f9:[_0x3c01f9];}return _0x44a587;}function log(_0x5cc008,_0x550fde,_0x3bf5b4,_0x40ed23,_0x1bb609,_0x3c14ce){loggers[_0x1bb609[_0xea74('0x14')]()][_0x5cc008]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3c14ce[_0xea74('0x15')](),_0x550fde?_0x550fde['id']:null,_0x550fde?_0x550fde[_0xea74('0x16')]:null,_0x550fde?_0x550fde[_0xea74('0x17')]:null,getInteractionId(_0x3bf5b4,_0x40ed23,_0x1bb609),_0x3bf5b4?JSON[_0xea74('0x18')](_0x3bf5b4):_0xea74('0x19'));}function updateUser(_0x4e32f6,_0x25def8,_0x539089,_0x5701bb,_0x2e0f87){db[_[_0xea74('0xb')](_0x5701bb)+_0xea74('0x1a')]['findOne']({'where':{'id':getInteractionId(_0x25def8,_0x539089,_0x5701bb)}})[_0xea74('0x1b')](function(_0x195e5c){if(_0x195e5c){return _0x195e5c['update']({'UserId':_0x4e32f6?_0x4e32f6['id']:null});}})['then'](function(_0x142e5c){if(_0x142e5c){log(_0xea74('0x1c'),_0x4e32f6,_0x25def8,_0x539089,_0x5701bb,_0x2e0f87);}})['catch'](function(){log('error',_0x4e32f6,_0x25def8,_0x539089,_0x5701bb,_0x2e0f87);});}module['exports']={'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 d573d40..89e448e 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 _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 +var _0x25c3=['format','%s:%s:%s','update','base64','utf8','parse','License','then','count','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','User','admin','user','isUserLimit','crypto','util','composable-middleware','../../config/environment','data1','license','split','createDecipher','aes-256-ctr'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x25c3,0x15f));var _0x325c=function(_0x318f5c,_0x28970f){_0x318f5c=_0x318f5c-0x0;var _0x3f39bb=_0x25c3[_0x318f5c];return _0x3f39bb;};'use strict';var crypto=require(_0x325c('0x0'));var util=require(_0x325c('0x1'));var compose=require(_0x325c('0x2'));var db=require('../../mysqldb')['db'];var config=require(_0x325c('0x3'));function getValueFromLicense(_0x46cdc0,_0x1ef63d){if(_0x46cdc0&&_0x1ef63d){if(_0x1ef63d[_0x325c('0x4')]&&_0x1ef63d[_0x325c('0x5')]){var _0x4081f4=_0x1ef63d[_0x325c('0x4')];var _0x4969e1=_0x1ef63d[_0x325c('0x5')];var _0x2da930=_0x4081f4['split']('-')[0x4];var _0x38324f=_0x4081f4[_0x325c('0x6')]('-')[0x0];var _0x1bd6d8=crypto[_0x325c('0x7')](_0x325c('0x8'),util[_0x325c('0x9')](_0x325c('0xa'),_0x2da930,_0x4081f4,_0x38324f));var _0x155da9=_0x1bd6d8[_0x325c('0xb')](_0x4969e1,_0x325c('0xc'),_0x325c('0xd'));_0x155da9+=_0x1bd6d8['final'](_0x325c('0xd'));var _0xac9d36=JSON[_0x325c('0xe')](_0x155da9);return _0xac9d36['hasOwnProperty'](_0x46cdc0)?_0xac9d36[_0x46cdc0]:null;}}return null;}function isLimit(_0x5848fd,_0x4a0b41,_0x33cdb8,_0x16c141){var _0x59b758=_0x4a0b41;return compose()['use'](function(_0x3b27d2,_0x491af2,_0x28793a){return db[_0x325c('0xf')]['findOne']({'where':{'id':0x1},'raw':!![]})['then'](function(_0x16b936){var _0x2aa777=getValueFromLicense(_0x5848fd,_0x16b936);return _0x2aa777?_0x2aa777:_0x59b758;})[_0x325c('0x10')](function(_0x5b6c7c){_0x59b758=_0x5b6c7c;return _0x33cdb8[_0x325c('0x11')](_0x16c141);})[_0x325c('0x10')](function(_0x28b459){if(_0x28b459>=_0x59b758){return _0x491af2['status'](0x193)['json']({'message':util[_0x325c('0x9')](_0x325c('0x12'),_0x5848fd)});}_0x28793a();})['catch'](function(_0x1fc0bd){_0x28793a(_0x1fc0bd);});});}function isUserLimit(){return isLimit(_0x325c('0x13'),0x1,db[_0x325c('0x14')],{'where':{'$or':[{'role':_0x325c('0x15')},{'role':_0x325c('0x16')}]}});}exports[_0x325c('0x17')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 90602ca..2a43783 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 _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 +var _0x77f1=['$gt','add','format','castTo','CAST(','text','field','includes','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','NOT\x20IN\x20?','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','$lte','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','pop','utcOffset','hours','minutes','seconds','lodash','sqlOperator','startsWith','[$or]','and','[$and]','replace','split','length','slice','match','forEach','filter','indexOf','map','conditions','push','buildExpression','DATE','operator','$eq','$between','value'];(function(_0x1b3397,_0x35a196){var _0x5b0125=function(_0x1e39a5){while(--_0x1e39a5){_0x1b3397['push'](_0x1b3397['shift']());}};_0x5b0125(++_0x35a196);}(_0x77f1,0x127));var _0x177f=function(_0x40f140,_0x838efc){_0x40f140=_0x40f140-0x0;var _0x3b8096=_0x77f1[_0x40f140];return _0x3b8096;};'use strict';var _=require(_0x177f('0x0'));var moment=require('moment');exports['parseSearch']=function(_0x1fb721){var _0xe6e97d={'conditions':[]};_0xe6e97d[_0x177f('0x1')]=_[_0x177f('0x2')](_0x1fb721,_0x177f('0x3'))?'or':_0x177f('0x4');var _0x3e2167=_0x1fb721['replace'](_0x177f('0x5'),'')[_0x177f('0x6')](_0x177f('0x3'),'')[_0x177f('0x7')]('||');for(var _0x47e65e=0x0;_0x47e65e<_0x3e2167[_0x177f('0x8')];_0x47e65e++){var _0x19ea6e=_0x3e2167[_0x47e65e][_0x177f('0x7')](':=');var _0x177068=_0x19ea6e[0x0];var _0x36609b=_0x19ea6e[_0x177f('0x9')](0x1);_0x36609b['forEach'](function(_0x1a5a55){var _0x37d079=_0x1a5a55[_0x177f('0x7')]('[')['shift']();var _0x4a9a24=_0x1a5a55[_0x177f('0xa')](/\[(.*?)\]/g);_0x4a9a24[_0x177f('0xb')](function(_0x452861){var _0x143a24=_0x452861[_0x177f('0x7')]('[')[_0x177f('0xc')](function(_0x4c81d1){return _0x4c81d1[_0x177f('0xd')](']')>-0x1;})[_0x177f('0xe')](function(_0x16fc05){return _0x16fc05['split'](']')[0x0];})[0x0];_0xe6e97d[_0x177f('0xf')][_0x177f('0x10')]({'field':_0x177068,'operator':_0x37d079,'value':_0x143a24});});});}return _0xe6e97d;};exports[_0x177f('0x11')]=function(_0x40d3e2,_0x2fbf18,_0x236336){var _0x426eb8={};if(_0x2fbf18===_0x177f('0x12')){if(_0x236336[_0x177f('0x13')]===_0x177f('0x14')){_0x236336[_0x177f('0x13')]=_0x177f('0x15');_0x236336[_0x177f('0x16')]+=','+_0x236336['value'];}else if(_['includes']([_0x177f('0x17'),'$lte'],_0x236336['operator'])){_0x236336[_0x177f('0x16')]=moment(_0x236336['value'])[_0x177f('0x18')](0x1,'days')[_0x177f('0x19')]('YYYY-MM-DD');}}if(_0x236336[_0x177f('0x1a')]){_0x2fbf18=_0x236336[_0x177f('0x1a')];_0x426eb8['text']=_0x177f('0x1b')+_0x40d3e2+'.'+_0x236336['field']+'\x20AS\x20'+_0x236336['castTo']+')\x20'+parseOperator(_0x236336[_0x177f('0x13')]);}else{_0x426eb8[_0x177f('0x1c')]=_0x40d3e2+'.'+_0x236336[_0x177f('0x1d')]+'\x20'+parseOperator(_0x236336[_0x177f('0x13')]);}if(_[_0x177f('0x1e')]([_0x177f('0x1f'),_0x177f('0x20')],_0x236336['operator']))_0x426eb8[_0x177f('0x1c')]='('+_0x426eb8[_0x177f('0x1c')]+_0x177f('0x21')+_0x40d3e2+'.'+_0x236336[_0x177f('0x1d')]+_0x177f('0x22');_0x426eb8[_0x177f('0x16')]=parseValue(_0x2fbf18,_0x236336[_0x177f('0x13')],_0x236336[_0x177f('0x16')]);return _0x426eb8;};function parseOperator(_0xa1d058){var _0x1b63da;switch(_0xa1d058){case _0x177f('0x23'):_0x1b63da='IN\x20?';break;case _0x177f('0x20'):_0x1b63da=_0x177f('0x24');break;case _0x177f('0x14'):_0x1b63da='=\x20?';break;case _0x177f('0x1f'):_0x1b63da='<>\x20?';break;case'$substring':case _0x177f('0x25'):case _0x177f('0x26'):_0x1b63da=_0x177f('0x27');break;case _0x177f('0x28'):_0x1b63da=_0x177f('0x29');break;case _0x177f('0x17'):_0x1b63da='>\x20?';break;case _0x177f('0x2a'):_0x1b63da=_0x177f('0x2b');break;case _0x177f('0x2c'):_0x1b63da=_0x177f('0x2d');break;case'$between':_0x1b63da=_0x177f('0x2e');break;}return _0x1b63da;}function parseValue(_0x1111a0,_0x29b3b9,_0x2b2235){var _0x4218ee={'start':undefined,'end':undefined};switch(_0x29b3b9){case _0x177f('0x23'):case _0x177f('0x20'):_0x4218ee[_0x177f('0x2f')]=_0x2b2235[_0x177f('0x7')](',');break;case'$substring':_0x4218ee[_0x177f('0x2f')]='%'+_0x2b2235+'%';break;case _0x177f('0x25'):_0x4218ee[_0x177f('0x2f')]=_0x2b2235+'%';break;case _0x177f('0x26'):_0x4218ee['start']='%'+_0x2b2235;break;case _0x177f('0x15'):var _0x3623fb=_0x2b2235['split'](',');var _0x2b2235=_0x3623fb['shift']();var _0x56ee8d=_0x3623fb[_0x177f('0x30')]();if(_0x1111a0===_0x177f('0x12')){_0x2b2235=moment(_0x2b2235)['utcOffset'](0x0,!![])['format']();_0x56ee8d=moment(_0x56ee8d)[_0x177f('0x31')](0x0,!![])['add'](0x17,_0x177f('0x32'))[_0x177f('0x18')](0x3b,_0x177f('0x33'))['add'](0x3b,_0x177f('0x34'))['format']();}_0x4218ee={'start':_0x2b2235,'end':_0x56ee8d};break;default:_0x4218ee['start']=_0x2b2235;break;}return _0x4218ee;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 69c98a4..a56e6a2 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 _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 +var _0xb66b=['name','value','type','VIRTUAL','lower','merge','options','include','includeAll','push','sequelize','moment','../../mysqldb','parse','keys','includes','alias','fields','raw','split','filters','isEmpty','forOwn','find','DATE','isPlainObject','$gte','format','YYYY-MM-DD','$lte','utc','subtract','uniqueid','isArray','limit','offset','sort','map','indexOf','cast','col','priority','substr','DESC','unsigned','ASC','omit','length','isString','unset','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','\x22{EXPR}\x22','replace','{EXPR}','getOptions','query','$id','model','intersection','attributes','hasOwnProperty','nolimit','order','where','pick','filter','object','columns'];(function(_0x4e7eec,_0x13cd74){var _0x79b028=function(_0xd14b18){while(--_0xd14b18){_0x4e7eec['push'](_0x4e7eec['shift']());}};_0x79b028(++_0x13cd74);}(_0xb66b,0x9a));var _0xbb66=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb66b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var sequelize=require(_0xbb66('0x0'));var moment=require(_0xbb66('0x1'));var db=require(_0xbb66('0x2'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x2d7992){var _0x51a556=['ne'];try{var _0x1e2958=JSON[_0xbb66('0x3')](_0x2d7992);var _0x40c448=Object[_0xbb66('0x4')](_0x1e2958)[0x0];return _0x51a556[_0xbb66('0x5')](_0x40c448);}catch(_0x4aa6c9){return![];}}function getOperatorValue(_0x187e7f){var _0xdb3183=JSON[_0xbb66('0x3')](_0x187e7f);var _0x3e6ce1=Object[_0xbb66('0x4')](_0xdb3183)[0x0];var _0x5a3357=_0xdb3183[_0x3e6ce1];return{['$'+_0x3e6ce1]:_0x5a3357};}function parseIncludeModel(_0x5399b5){var _0x3f0269=JSON[_0xbb66('0x3')](_0x5399b5);return{'model':db[_0x3f0269['model']],'as':_0x3f0269[_0xbb66('0x6')],'attributes':_0x3f0269[_0xbb66('0x7')],'raw':_0x3f0269[_0xbb66('0x8')]};}exports[_0xbb66('0x7')]=function(_0x185fa7){var _0x7e51d0=null;if(_0x185fa7){_0x7e51d0=_0x185fa7[_0xbb66('0x9')](',');}return _0x7e51d0;};exports[_0xbb66('0xa')]=function(_0x23a8f0,_0x4ad91c){var _0x56726e={};if(!_[_0xbb66('0xb')](_0x23a8f0)){_[_0xbb66('0xc')](_0x23a8f0,function(_0x3b4923,_0x21bdba){try{if(_0x4ad91c){var _0x9241aa=_[_0xbb66('0xd')](_0x4ad91c,{'name':_0x21bdba})||{};if(hasSequelizeOperator(_0x3b4923)){_0x56726e[_0x21bdba]=getOperatorValue(_0x3b4923);}else if(_0x9241aa['type']===_0xbb66('0xe')&&_[_0xbb66('0xf')](_0x3b4923)){var _0x24b029=JSON['parse'](_0x3b4923);var _0x4e6f4e={'$gte':moment(moment(_0x24b029[_0xbb66('0x10')])[_0xbb66('0x11')](_0xbb66('0x12')))['utc']()[_0xbb66('0x11')](),'$lte':moment(moment(_0x24b029[_0xbb66('0x13')])[_0xbb66('0x11')](_0xbb66('0x12')))[_0xbb66('0x14')]()[_0xbb66('0x15')](0x1,'s')['format']()};_0x56726e[_0x21bdba]=_0x4e6f4e;}else if(_0x9241aa['name']===_0xbb66('0x16')){_0x56726e[_0x21bdba]=_0x3b4923;}else{_0x56726e[_0x21bdba]=_[_0xbb66('0x17')](_0x3b4923)?_0x3b4923:JSON[_0xbb66('0x3')](_0x3b4923);}}else{_0x56726e[_0x21bdba]=_[_0xbb66('0x17')](_0x3b4923)?_0x3b4923:JSON[_0xbb66('0x3')](_0x3b4923);}}catch(_0x29499f){_0x56726e[_0x21bdba]=_0x3b4923['split'](',');}});}return _0x56726e;};exports[_0xbb66('0x18')]=function(_0x1268ce){_0x1268ce=parseInt(_0x1268ce,0xa);if(!_0x1268ce||_0x1268ce<0x0){_0x1268ce=LIMIT_VALUE;}return _0x1268ce;};exports[_0xbb66('0x19')]=function(_0x2165d8){_0x2165d8=parseInt(_0x2165d8,0xa);if(!_0x2165d8||_0x2165d8<0x0){_0x2165d8=0x0;}return _0x2165d8;};exports[_0xbb66('0x1a')]=function(_0x53b0b2){var _0x5b9501,_0x90159a=null;if(_0x53b0b2){_0x5b9501=_0x53b0b2[_0xbb66('0x9')](',');_0x90159a=_[_0xbb66('0x1b')](_0x5b9501,function(_0x26a9c0){if(_0x26a9c0[_0xbb66('0x1c')]('-')===0x0){return[_0x26a9c0==='priority'?sequelize[_0xbb66('0x1d')](sequelize[_0xbb66('0x1e')](_0xbb66('0x1f')),'unsigned'):_0x26a9c0[_0xbb66('0x20')](0x1),_0xbb66('0x21')];}else{return[_0x26a9c0===_0xbb66('0x1f')?sequelize[_0xbb66('0x1d')](sequelize[_0xbb66('0x1e')](_0xbb66('0x1f')),_0xbb66('0x22')):_0x26a9c0,_0xbb66('0x23')];}});}return _0x90159a;};exports[_0xbb66('0x24')]=function(_0x203b40,_0xf9f34e){if(_['isEmpty'](_0x203b40)){return _0x203b40;}if(_[_0xbb66('0x17')](_0x203b40)){for(var _0x3dd0f9=0x0;_0x3dd0f9<_0x203b40[_0xbb66('0x25')];_0x3dd0f9+=0x1){_0x203b40[_0x3dd0f9]=this['omit'](_0x203b40[_0x3dd0f9],_0xf9f34e);}return _0x203b40;}if(!_['isObject'](_0x203b40)){return _0x203b40;}if(_[_0xbb66('0x26')](_0xf9f34e)){_0xf9f34e=[_0xf9f34e];}if(!_[_0xbb66('0x17')](_0xf9f34e)){return _0x203b40;}for(var _0x507acf=0x0;_0x507acf<_0xf9f34e[_0xbb66('0x25')];_0x507acf+=0x1){_[_0xbb66('0x27')](_0x203b40,_0xf9f34e[_0x507acf]);}for(var _0x32c843 in _0x203b40){if(_0x203b40['hasOwnProperty'](_0x32c843)){_0x203b40[_0x32c843]=this[_0xbb66('0x24')](_0x203b40[_0x32c843],_0xf9f34e);}}return _0x203b40;};exports[_0xbb66('0x28')]=function(_0x1ce773){return _0x1ce773[_0xbb66('0x29')](RegExp(_0xbb66('0x2a')))?!![]:![];};exports[_0xbb66('0x2b')]=function(_0x38ca83){return _0x38ca83[_0xbb66('0x29')](/^\S+@\S+$/)?!![]:![];};exports[_0xbb66('0x2c')]=function(_0x3e2af5,_0x1baad7){var _0x260980=[];var _0x2b3480=/[ `!@#$%^&*()_\-?~]/;var _0x2b7917=_0x1baad7?_0xbb66('0x2d'):'{EXPR}';_0x3e2af5['split'](/[ ,]+/)['forEach'](function(_0x4df97e){_0x4df97e=_0x4df97e[_0xbb66('0x2e')](/([^:]")"+/g,'$1');_0x4df97e='+'+_0x4df97e+'*';var _0x553242=_0x4df97e[_0xbb66('0x29')](_0x2b3480);if(_0x553242){_0x4df97e='\x22'+_0x4df97e+'\x22';}_0x260980['push'](_0x4df97e);});_0x2b7917=_0x2b7917[_0xbb66('0x2e')](_0xbb66('0x2f'),_0x260980['join']('\x20'));return _0x2b7917;};exports[_0xbb66('0x30')]=function(_0x2e0ff9,_0x41e8a6,_0x5d2c54){var _0xbbcd61={},_0x497043={};if(_0x41e8a6[_0xbb66('0x31')]['$id']){_0x41e8a6[_0xbb66('0x31')]['id']=_0x41e8a6[_0xbb66('0x31')][_0xbb66('0x32')];delete _0x41e8a6[_0xbb66('0x31')][_0xbb66('0x32')];}_0xbbcd61[_0xbb66('0x33')]=_[_0xbb66('0x1b')](_0x2e0ff9,'name');_0xbbcd61[_0xbb66('0x31')]=_[_0xbb66('0x4')](_0x41e8a6['query']);_0xbbcd61[_0xbb66('0xa')]=_[_0xbb66('0x34')](_0xbbcd61[_0xbb66('0x33')],_0xbbcd61[_0xbb66('0x31')]);_0x497043[_0xbb66('0x35')]=_['intersection'](_0xbbcd61[_0xbb66('0x33')],this['fields'](_0x41e8a6[_0xbb66('0x31')][_0xbb66('0x7')]));_0x497043[_0xbb66('0x35')]=_0x497043['attributes'][_0xbb66('0x25')]?_0x497043[_0xbb66('0x35')]:_0xbbcd61['model'];if(!_0x41e8a6['query'][_0xbb66('0x36')](_0xbb66('0x37'))){_0x497043[_0xbb66('0x18')]=this[_0xbb66('0x18')](_0x41e8a6[_0xbb66('0x31')]['limit']);_0x497043[_0xbb66('0x19')]=this[_0xbb66('0x19')](_0x41e8a6['query'][_0xbb66('0x19')]);}_0x497043[_0xbb66('0x38')]=this[_0xbb66('0x1a')](_0x41e8a6['query'][_0xbb66('0x1a')]);_0x497043[_0xbb66('0x39')]=this[_0xbb66('0xa')](_[_0xbb66('0x3a')](_0x41e8a6[_0xbb66('0x31')],_0xbbcd61[_0xbb66('0xa')]),_0x2e0ff9);if(_0x41e8a6[_0xbb66('0x31')][_0xbb66('0x3b')]){var _0x1e5c3d=_0x2e0ff9;var _0x2de4dd=_0x41e8a6[_0xbb66('0x31')]['filter'];if(typeof _0x2de4dd===_0xbb66('0x3c')){_0x1e5c3d=_[_0xbb66('0x3b')](_0x2e0ff9,function(_0x2ac3b8){return _[_0xbb66('0x5')](_0x2de4dd[_0xbb66('0x3d')],_0x2ac3b8[_0xbb66('0x3e')]);});_0x2de4dd=_0x2de4dd[_0xbb66('0x3f')];}_0x497043['where']=_['merge'](_0x497043[_0xbb66('0x39')],{'$or':_[_0xbb66('0x1b')](_0x1e5c3d,function(_0x5bdc0b){if(_0x5bdc0b[_0xbb66('0x40')]!==_0xbb66('0x41')){if(_0x5d2c54){return sequelize[_0xbb66('0x39')](sequelize['fn']('lower',sequelize[_0xbb66('0x1e')](_0x5bdc0b[_0xbb66('0x3e')])),{'$like':sequelize['fn'](_0xbb66('0x42'),'%'+_0x41e8a6[_0xbb66('0x31')][_0xbb66('0x3b')]+'%')});}else{var _0x2e25f0={};_0x2e25f0[_0x5bdc0b[_0xbb66('0x3e')]]={'$like':'%'+_0x41e8a6['query'][_0xbb66('0x3b')]+'%'};return _0x2e25f0;}}})});}_0x497043=_[_0xbb66('0x43')]({},_0x497043,_0x41e8a6[_0xbb66('0x44')]);return _0x497043;};exports[_0xbb66('0x45')]=function(_0x51a85f){var _0x517b8a=[];if(_0x51a85f[_0xbb66('0x46')]){_0x517b8a[_0xbb66('0x47')]({'all':!![]});}else if(_0x51a85f[_0xbb66('0x45')]){if(Array[_0xbb66('0x17')](_0x51a85f[_0xbb66('0x45')])){_0x517b8a=Object[_0xbb66('0x4')](_0x51a85f[_0xbb66('0x45')])[_0xbb66('0x1b')](function(_0x42077d){return parseIncludeModel(_0x51a85f[_0xbb66('0x45')][_0x42077d]);});}else{var _0x2c7235=parseIncludeModel(_0x51a85f['include']);_0x517b8a[_0xbb66('0x47')](_0x2c7235);}}return _0x517b8a;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 8018c38..c133eb9 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 _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 +var _0x7217=['onhold','getRealtimeAgentsQueryFields','lodash','../../mysqldb','client','http','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','every','filter','length','unknown','unavailable','ringing','isNil','voiceStatus','idle','pause','faxStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','request','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Agents','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','getRealtimeAgents','*pause','busy','getAgentStatus','isArray','startCase','Queue','map','then','getAgents','all','flatten','value','includes','getAgentIdsByStatus','resolve','findAll','name','fullname','pauseType','find','getSortedAgentsIdsByStatus','globalStatus','startsWith','ASC','getUpdatedSortOptions','fullname,internal','internal','substring','indexOf','validateSortParameter','DESC','toLowerCase','sortAgentsByStatus','userpic','lastLoginAt','lastPauseAt','address','openchannelCapacity','mailCapacity','smsCapacity','faxCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','routealias','online','pick','filterAgentAttributes','role','smsStatusTime','whatsappCapacity','chatCurrentCapacity','phoneBarEnableAutomaticScreenRecording'];(function(_0x5236c2,_0x400157){var _0x146250=function(_0x27e85b){while(--_0x27e85b){_0x5236c2['push'](_0x5236c2['shift']());}};_0x146250(++_0x400157);}(_0x7217,0x19e));var _0x7721=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x7217[_0x297fd3];return _0x2af381;};'use strict';var _=require(_0x7721('0x0'));var jayson=require('jayson/promise');var db=require(_0x7721('0x1'))['db'];var amiClient=jayson[_0x7721('0x2')][_0x7721('0x3')]({'port':0x232a});var routingClient=jayson[_0x7721('0x2')][_0x7721('0x3')]({'port':0x232c});function isAgentPaused(_0x4d6446,_0x5bf160){var _0x472a96=[_0x4d6446[_0x7721('0x4')],_0x4d6446[_0x7721('0x5')],_0x4d6446[_0x7721('0x6')],_0x4d6446[_0x7721('0x7')],_0x4d6446[_0x7721('0x8')],_0x4d6446[_0x7721('0x9')],_0x4d6446[_0x7721('0xa')]];if(!_0x5bf160)return _[_0x7721('0xb')](_0x472a96);var _0x2f99ed=_[_0x7721('0xc')](_0x472a96);return _0x2f99ed[_0x7721('0xd')]>0x0&&_0x2f99ed[_0x7721('0xd')]<_0x472a96[_0x7721('0xd')]?!![]:![];}function isIdle(_0x2c3986){return _0x2c3986==='idle'||_0x2c3986===_0x7721('0xe')||_0x2c3986===_0x7721('0xf')||_0x2c3986===_0x7721('0x10')||_[_0x7721('0x11')](_0x2c3986);}function isAgentIdle(_0xa8977c){if(_0xa8977c[_0x7721('0x12')]!==_0x7721('0x13')&&_0xa8977c[_0x7721('0x9')]){_0xa8977c['voiceStatus']=_0x7721('0x14');return![];}return _[_0x7721('0xb')]([_0xa8977c['chatStatus'],_0xa8977c[_0x7721('0x15')],_0xa8977c[_0x7721('0x16')],_0xa8977c[_0x7721('0x17')],_0xa8977c[_0x7721('0x18')],_0xa8977c['voiceStatus'],_0xa8977c[_0x7721('0x19')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x7721('0x1a')]('Agents',{})['then'](function(_0x4b183e){if(_0x4b183e[_0x7721('0x1b')]){throw new Error(_0x7721('0x1c'));}var _0x3cc909=_0x4b183e[_0x7721('0x1d')];return routingClient['request'](_0x7721('0x1e'),{})['then'](function(_0x3fc09e){if(_0x3fc09e['error']){throw new Error(_0x7721('0x1f'));}var _0x4e96fb=_0x3fc09e[_0x7721('0x1d')];return _[_0x7721('0x20')]({},_0x3cc909,_0x4e96fb);});})[_0x7721('0x21')](function(_0x40af90){throw _0x40af90;});}exports[_0x7721('0x22')]=getRealtimeAgents;function getAgentStatus(_0x413263){var _0x3b29ac=_0x7721('0xe');if(isAgentPaused(_0x413263))_0x3b29ac='pause';else if(isAgentPaused(_0x413263,!![]))_0x3b29ac=_0x7721('0x23');else if(isAgentIdle(_0x413263))_0x3b29ac=_0x7721('0x13');else _0x3b29ac=_0x7721('0x24');return _0x3b29ac;}exports[_0x7721('0x25')]=getAgentStatus;function getAgentIdsByQueues(_0x57140c,_0x28f5a6){var _0x512f31=_[_0x7721('0x26')](_0x57140c)?_0x57140c:[_0x57140c];var _0x288e3a=_[_0x7721('0x27')](_0x28f5a6)+_0x7721('0x28');var _0x121cc4=_[_0x7721('0x29')](_0x512f31,function(_0x2c6b7b){return db[_0x288e3a]['findOne']({'where':{'id':_0x2c6b7b}})[_0x7721('0x2a')](function(_0x1abedb){if(!_0x1abedb)return[];return _0x1abedb[_0x7721('0x2b')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x7721('0x2c')](_0x121cc4)[_0x7721('0x2a')](function(_0x16355a){var _0x424e05=_(_0x16355a)[_0x7721('0x2d')]()[_0x7721('0x29')]('id')['uniq']()[_0x7721('0x2e')]();return _0x424e05;});}exports['getAgentIdsByQueues']=getAgentIdsByQueues;function getAgentIdsByStatus(_0x499b87,_0x315202,_0x343c19){try{if(_0x315202[_0x7721('0xd')]>0x0){_0x499b87=_0x499b87[_0x7721('0xc')](function(_0x1ea4d){return _0x315202[_0x7721('0x2f')](_0x1ea4d['id']);});}var _0xd7d703=_0x499b87[_0x7721('0xc')](function(_0x5c54f0){var _0x471651=_0x7721('0x24');if(isAgentIdle(_0x5c54f0)){_0x471651='idle';}return _0x471651===_0x343c19;});return _['map'](_0xd7d703,'id');}catch(_0xfde9ec){throw _0xfde9ec;}}exports[_0x7721('0x30')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x48f329,_0x46f772,_0x4651b5){return Promise[_0x7721('0x31')]()['then'](function(){if(_0x46f772[_0x7721('0xd')]>0x0){_0x48f329=_0x48f329[_0x7721('0xc')](function(_0x1492d4){return _0x46f772[_0x7721('0x2f')](_0x1492d4['id']);});}return _0x48f329;})[_0x7721('0x2a')](function(){return db['User'][_0x7721('0x32')]({'attributes':['id',_0x7721('0x33'),_0x7721('0x34'),'chatPause',_0x7721('0x5'),_0x7721('0x6'),'openchannelPause',_0x7721('0x8'),'voicePause',_0x7721('0xa'),_0x7721('0x35')],'where':{'id':{'$in':_[_0x7721('0x29')](_0x48f329,'id')}},'raw':!![]});})[_0x7721('0x2a')](function(_0x1c84c0){return _0x1c84c0[_0x7721('0x29')](function(_0x2f1fe0){var _0x15545a=_[_0x7721('0x36')](_0x48f329,['id',_0x2f1fe0['id']]);var _0x3a2eb7=filterAgentAttributes(_0x15545a);_[_0x7721('0x20')](_0x2f1fe0,_0x3a2eb7);_0x2f1fe0['globalStatus']=getAgentStatus(_0x2f1fe0);return _0x2f1fe0;});})[_0x7721('0x2a')](function(_0x5e6663){var _0x212384=sortAgentsByStatus(_0x5e6663,_0x4651b5);return _[_0x7721('0x29')](_0x212384,'id');})[_0x7721('0x21')](function(_0x1d03de){throw _0x1d03de;});}exports[_0x7721('0x37')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x378ba5){var _0x482b70={'fields':[],'order':null};var _0x557c34=_0x378ba5['split'](',');_0x482b70['fields']=_[_0x7721('0xc')](_0x557c34,function(_0x1b3f8d){if(!_0x1b3f8d[_0x7721('0x2f')](_0x7721('0x38'))){return!![];}_0x482b70['order']=_[_0x7721('0x39')](_0x1b3f8d,'-')?'DESC':_0x7721('0x3a');return![];});return _0x482b70;}exports[_0x7721('0x3b')]=getUpdatedSortOptions;function validateSortParameter(_0x5a278e){if(!_0x5a278e){_0x5a278e=_0x7721('0x3c');}if(_0x5a278e[_0x7721('0x2f')]('fullname')&&!_0x5a278e['includes'](_0x7721('0x3d'))){var _0xfc4dc4=_0x5a278e[_0x7721('0x3e')](0x0,_0x5a278e[_0x7721('0x3f')]('fullname'));_0x5a278e+=','+_0xfc4dc4+_0x7721('0x3d');}return _0x5a278e;}exports[_0x7721('0x40')]=validateSortParameter;function sortAgentsByStatus(_0x40ce8c,_0x337abf){var _0x196051=_0x40ce8c['sort'](function(_0x490d4,_0x4a2c28){if(_0x490d4[_0x7721('0x38')]===_0x4a2c28['globalStatus']){if(_0x490d4[_0x7721('0x38')]===_0x7721('0x14')){if(_0x337abf===_0x7721('0x41')){return(_0x490d4['pauseType']||'')<(_0x4a2c28[_0x7721('0x35')]||'')||_0x490d4[_0x7721('0x34')][_0x7721('0x42')]()>_0x4a2c28['fullname'][_0x7721('0x42')]()?0x1:-0x1;}else{return(_0x490d4[_0x7721('0x35')]||'')<(_0x4a2c28[_0x7721('0x35')]||'')||_0x490d4[_0x7721('0x34')][_0x7721('0x42')]()>_0x4a2c28[_0x7721('0x34')][_0x7721('0x42')]()?-0x1:0x1;}}else{if(_0x337abf==='DESC'){return _0x490d4['fullname'][_0x7721('0x42')]()<_0x4a2c28[_0x7721('0x34')][_0x7721('0x42')]()?0x1:-0x1;}else{return _0x490d4[_0x7721('0x34')][_0x7721('0x42')]()<_0x4a2c28[_0x7721('0x34')][_0x7721('0x42')]()?-0x1:0x1;}}}else{if(_0x337abf===_0x7721('0x41')){return _0x490d4[_0x7721('0x38')]<_0x4a2c28[_0x7721('0x38')]?0x1:-0x1;}else{return _0x490d4['globalStatus']<_0x4a2c28['globalStatus']?-0x1:0x1;}}});return _0x196051;}exports[_0x7721('0x43')]=sortAgentsByStatus;function filterAgentAttributes(_0x6a4664){var _0x151f69=[_0x7721('0x44'),'online',_0x7721('0x45'),_0x7721('0x46'),'pauseType',_0x7721('0x46'),'internal',_0x7721('0x47'),'chatPause',_0x7721('0x7'),_0x7721('0x6'),_0x7721('0x8'),'whatsappPause',_0x7721('0x5'),_0x7721('0x9'),'chatCapacity',_0x7721('0x48'),_0x7721('0x49'),_0x7721('0x4a'),'whatsappCapacity',_0x7721('0x4b'),'chatCurrentCapacity',_0x7721('0x4c'),_0x7721('0x4d'),_0x7721('0x4e'),_0x7721('0x4f'),_0x7721('0x50'),_0x7721('0x51'),_0x7721('0x17'),_0x7721('0x16'),_0x7721('0x18'),_0x7721('0x19'),_0x7721('0x15'),_0x7721('0x12'),_0x7721('0x52'),_0x7721('0x53'),_0x7721('0x54'),'smsStatusTime',_0x7721('0x55'),_0x7721('0x56'),_0x7721('0x57'),_0x7721('0x58'),_0x7721('0x59'),_0x7721('0x5a'),_0x7721('0x5b'),'phoneBarEnableAutomaticScreenRecording',_0x7721('0x5c')];var _0x17036e=[_0x7721('0x4'),_0x7721('0x7'),_0x7721('0x6'),_0x7721('0x8'),_0x7721('0xa'),_0x7721('0x5'),_0x7721('0x9'),_0x7721('0x5d')];var _0x8eca10=_(_0x6a4664)['omit'](_0x17036e)[_0x7721('0x5e')](_0x151f69)[_0x7721('0x2e')]();return _0x8eca10;}exports[_0x7721('0x5f')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0x7721('0x33'),_0x7721('0x34'),_0x7721('0x60'),_0x7721('0x3d'),_0x7721('0x5d'),_0x7721('0x38'),_0x7721('0x44'),_0x7721('0x45'),_0x7721('0x35'),_0x7721('0x46'),_0x7721('0x5'),_0x7721('0x4'),'mailPause','openchannelPause','smsPause',_0x7721('0x9'),'whatsappPause','chatStatus','faxStatus','mailStatus',_0x7721('0x17'),_0x7721('0x18'),_0x7721('0x12'),'whatsappStatus',_0x7721('0x52'),'faxStatusTime','mailStatusTime','openchannelStatusTime',_0x7721('0x61'),'voiceStatusTime','whatsappStatusTime','chatCapacity',_0x7721('0x4b'),_0x7721('0x49'),_0x7721('0x48'),'smsCapacity',_0x7721('0x62'),_0x7721('0x63'),_0x7721('0x50'),_0x7721('0x4d'),_0x7721('0x4c'),_0x7721('0x4e'),_0x7721('0x4f'),_0x7721('0x5b'),_0x7721('0x64'),_0x7721('0x59'),_0x7721('0x65'),_0x7721('0x58'),_0x7721('0x5c'),_0x7721('0x5a')];}exports[_0x7721('0x66')]=getRealtimeAgentsQueryFields; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index e4f770f..63025c6 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 _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 +var _0x601d=['paused','busy','inUse','invalid','loggedInDb','notInUse','onHold','ringInUse','talking','unavailable','unknown','pTalking','originated','message','dialActive','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','startCase','Queues','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','inbound','concat','map','get','waiting','outbound','find','merge','pick','initializeQueues','lodash','http','available','loggedIn'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x601d,0x114));var _0xd601=function(_0x2bddba,_0x396fc5){_0x2bddba=_0x2bddba-0x0;var _0x382f21=_0x601d[_0x2bddba];return _0x382f21;};'use strict';var _=require(_0xd601('0x0'));var jayson=require('jayson/promise');var util=require('util');var amiClient=jayson['client'][_0xd601('0x1')]({'port':0x232a});var routingClient=jayson['client'][_0xd601('0x1')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0xd601('0x2'),_0xd601('0x3'),_0xd601('0x4'),'waiting'];var VOICE_QUEUE_ATTRIBUTES=[_0xd601('0x5'),_0xd601('0x6'),_0xd601('0x7'),_0xd601('0x8'),_0xd601('0x9'),_0xd601('0xa'),'ringing',_0xd601('0xb'),_0xd601('0xc'),_0xd601('0xd'),_0xd601('0xe')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0xd601('0xf'),_0xd601('0x10'),_0xd601('0x11'),'statusMessage',_0xd601('0x12'),'dialMethod','Trunk',_0xd601('0x13'),_0xd601('0x14'),_0xd601('0x15'),_0xd601('0x16'),_0xd601('0x17'),_0xd601('0x18'),_0xd601('0x19'),_0xd601('0x1a'),_0xd601('0x1b'),_0xd601('0x1c'),_0xd601('0x1d'),_0xd601('0x1e'),_0xd601('0x1f'),_0xd601('0x20'),_0xd601('0x21'),_0xd601('0x22')];function getRealtimeQueues(_0x11834f,_0x24a5da){var _0x53baea=_0x24a5da===_0xd601('0x23')?amiClient:routingClient;return _0x53baea[_0xd601('0x24')](_[_0xd601('0x25')](_0x24a5da)+_0xd601('0x26'),_0x11834f)[_0xd601('0x27')](function(_0x2c0d71){if(_0x2c0d71[_0xd601('0x28')])throw new Error(util[_0xd601('0x29')](_0xd601('0x2a'),_0x24a5da));return _0x2c0d71[_0xd601('0x2b')];})[_0xd601('0x2c')](function(_0x18b2e5){throw _0x18b2e5;});}exports[_0xd601('0x2d')]=getRealtimeQueues;function initializeQueues(_0x5b61d4,_0x399095,_0x5df6cd,_0x4c74e8){var _0x6efcb2=DEFAULT_QUEUE_ATTRIBUTES;if(_0x5df6cd===_0xd601('0x23')){if(_0x4c74e8===_0xd601('0x2e')){_0x6efcb2=_0x6efcb2[_0xd601('0x2f')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x4c74e8==='outbound'){_0x6efcb2=_0x6efcb2[_0xd601('0x2f')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x5b61d4[_0xd601('0x30')](function(_0x13d9c1){var _0x5544c6=_0x13d9c1[_0xd601('0x31')]({'plain':!![]});_0x5544c6[_0xd601('0x4')]=0x0;_0x5544c6[_0xd601('0x8')]=0x0;_0x5544c6[_0xd601('0x3')]=0x0;_0x5544c6['available']=0x0;_0x5544c6[_0xd601('0x32')]=0x0;if(_0x5df6cd==='voice'){_0x5544c6[_0xd601('0xc')]=0x0;_0x5544c6[_0xd601('0x5')]=0x0;if(_0x4c74e8===_0xd601('0x33')){_0x5544c6[_0xd601('0xf')]=0x0;_0x5544c6[_0xd601('0x10')]=0x0;}}var _0x2d466e=_[_0xd601('0x34')](_0x399095,['id',_0x5544c6['id']]);if(_0x2d466e){_[_0xd601('0x35')](_0x5544c6,_[_0xd601('0x36')](_0x2d466e,_0x6efcb2));}return _0x5544c6;});}exports[_0xd601('0x37')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 18743c6..db3e81c 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_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 +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(_0x297390,_0x4cba9c){var _0x4d7ffe=function(_0x14814a){while(--_0x14814a){_0x297390['push'](_0x297390['shift']());}};_0x4d7ffe(++_0x4cba9c);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 562bded..c44a6f5 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 _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 +var _0x9459=['ipAddress','substring','bimedia-machine-uuid','child_process','../environment','orderBy','keys','length','filter','family','concat','mac','address','127.0.0.1','map','join','createHash','md5','update','digest','hex','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','macAddress'];(function(_0x383dbb,_0x17d41b){var _0x6e8bde=function(_0x2740f1){while(--_0x2740f1){_0x383dbb['push'](_0x383dbb['shift']());}};_0x6e8bde(++_0x17d41b);}(_0x9459,0x16e));var _0x9945=function(_0x16de18,_0xc58756){_0x16de18=_0x16de18-0x0;var _0xd9dd78=_0x9459[_0x16de18];return _0xd9dd78;};'use strict';var _=require('lodash');var os=require('os');var crypto=require('crypto');var machine=require(_0x9945('0x0'));var exec=require(_0x9945('0x1'))['execSync'];var config=require(_0x9945('0x2'));function getInterfaces(){var _0x303291=[];var _0x565682=os['networkInterfaces']();var _0x974d87=_[_0x9945('0x3')](_[_0x9945('0x4')](_0x565682));for(var _0x55b815=0x0;_0x55b815<_0x974d87[_0x9945('0x5')];_0x55b815++){var _0x1167af=_0x565682[_0x974d87[_0x55b815]][_0x9945('0x6')](function(_0x194113){return _0x194113[_0x9945('0x7')]==='IPv4'&&_0x194113['internal']===![];});_0x303291=_0x303291[_0x9945('0x8')](_0x1167af);}return _0x303291;}function getFirstInterface(){var _0x2254f4=_['head'](getInterfaces());return{'macAddress':_0x2254f4&&_0x2254f4[_0x9945('0x9')]?_0x2254f4[_0x9945('0x9')]:'00:00:00:00:00:00','ipAddress':_0x2254f4&&_0x2254f4['address']?_0x2254f4[_0x9945('0xa')]:_0x9945('0xb')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x1f7b3a=_['orderBy'](os['cpus']()[_0x9945('0xc')](function(_0x1b5f5b){return _0x1b5f5b['model'];}))[_0x9945('0xd')](':');return crypto[_0x9945('0xe')](_0x9945('0xf'))[_0x9945('0x10')](_0x1f7b3a)[_0x9945('0x11')](_0x9945('0x12'));}exports['getUuid']=function(){var _0x2b4100=os['platform']();var _0x3f3d41=/[0-9a-f-]{36}/;if(config[_0x9945('0x13')]&&_0x3f3d41[_0x9945('0x14')](config[_0x9945('0x13')])){return config[_0x9945('0x13')];}else if(_0x2b4100===_0x9945('0x15')){return exec(_0x9945('0x16'),{'encoding':_0x9945('0x17')})[_0x9945('0x18')]('\x0d\x0a','');}else{var _0x1d87b4=getFirstInterface();var _0x29a1ec=getCPUhash();var _0x241d6f=_0x29a1ec+'|'+os['hostname']()+'|'+_0x1d87b4[_0x9945('0x19')]+'|'+_0x1d87b4[_0x9945('0x1a')];var _0xe28f7b=crypto['createHash'](_0x9945('0xf'))[_0x9945('0x10')](_0x241d6f)[_0x9945('0x11')]('hex');return _0xe28f7b['substring'](0x0,0x8)+'-'+_0xe28f7b[_0x9945('0x1b')](0x8,0xc)+'-'+_0xe28f7b['substring'](0xc,0x10)+'-'+_0xe28f7b['substring'](0x10,0x14)+'-'+_0xe28f7b[_0x9945('0x1b')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index ba43667..f1b4bab 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 _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 +var _0x6246=['bluebird','version','../logger','license','format','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','%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','message','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','error','moment'];(function(_0x4f91f5,_0x4b0282){var _0x3cee50=function(_0x225804){while(--_0x225804){_0x4f91f5['push'](_0x4f91f5['shift']());}};_0x3cee50(++_0x4b0282);}(_0x6246,0x6e));var _0x6624=function(_0x19f3e5,_0x1c099e){_0x19f3e5=_0x19f3e5-0x0;var _0x5cd24e=_0x6246[_0x19f3e5];return _0x5cd24e;};'use strict';var util=require('util');var moment=require(_0x6624('0x0'));var rp=require('request-promise');var BPromise=require(_0x6624('0x1'));var pkginfo=require('pkginfo')(module,_0x6624('0x2'));var db=require('../../mysqldb')['db'];var encryptor=require('../../components/encryptor');var hardware=require('./hardware');var logger=require(_0x6624('0x3'))(_0x6624('0x4'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x12ca82){return new BPromise(function(_0x1208a6,_0x141987){var _0x380a83=util[_0x6624('0x5')]('%s/api/servers/%s/check?version=%s',HOST,_0x12ca82,module[_0x6624('0x6')]['version']);if(oldToken){_0x380a83=util[_0x6624('0x5')](_0x6624('0x7'),HOST,_0x12ca82,module[_0x6624('0x6')][_0x6624('0x2')],oldToken);}var _0x2d629a={'uri':_0x380a83,'method':_0x6624('0x8'),'timeout':0xea60,'json':!![]};return rp(_0x2d629a)[_0x6624('0x9')](function(_0x5cc597){_0x1208a6(_0x5cc597);})[_0x6624('0xa')](function(_0x264afa){_0x141987(_0x264afa);});});}function manageLicense(_0x17bc70,_0x42761b){var _0x544537=_0x42761b[_0x6624('0xb')]({'plain':!![]});if(!isOldTokenSent&&_0x544537[_0x6624('0xc')]!==_0x17bc70&&!_0x544537[_0x6624('0xd')]){oldToken=_0x544537[_0x6624('0xc')];}httpRequest(_0x17bc70)[_0x6624('0x9')](function(_0x449627){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x449627[_0x6624('0xe')]){isOldTokenSent=![];if(!_0x544537[_0x6624('0x4')]&&_0x544537[_0x6624('0x4')]!=_0x449627[_0x6624('0x4')]||_0x544537['license']&&_0x544537[_0x6624('0xd')]){logger[_0x6624('0xf')](_0x6624('0x10'));}if(_0x544537['license']&&!_0x544537[_0x6624('0xd')]&&_0x544537[_0x6624('0x4')]!=_0x449627[_0x6624('0x4')]){logger[_0x6624('0xf')](_0x6624('0x11'));}if(_0x544537['license']&&!_0x544537['data2']&&_0x544537[_0x6624('0x4')]==_0x449627[_0x6624('0x4')]){return _0x42761b;}return _0x42761b[_0x6624('0x12')]({'data1':_0x17bc70,'data2':null,'license':_0x449627[_0x6624('0x4')]});}else{if(_0x449627[_0x6624('0x4')]||_0x544537[_0x6624('0x4')]){if(!_0x544537[_0x6624('0xd')]){if(_0x544537['data1']==_0x17bc70){GRAY_PERIOD_REASON=_0x6624('0x13');logger[_0x6624('0xf')](_0x6624('0x14'));}else{GRAY_PERIOD_REASON=_0x6624('0x15');logger[_0x6624('0xf')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x544537[_0x6624('0xc')],_0x17bc70);}logger['info'](_0x6624('0x16'),GRAY_PERIOD_REASON[_0x6624('0x17')](),moment()[_0x6624('0x5')](_0x6624('0x18')));return _0x42761b[_0x6624('0x12')]({'data2':encryptor[_0x6624('0x19')](moment()[_0x6624('0x5')](_0x6624('0x18')))});}else{if(moment()[_0x6624('0x1a')](encryptor[_0x6624('0x1b')](_0x544537['data2']),'days')>DAYS){logger[_0x6624('0xf')](_0x6624('0x1c'),moment()[_0x6624('0x5')](_0x6624('0x18')));isOldTokenSent=![];return _0x42761b[_0x6624('0x12')]({'data1':_0x17bc70,'data2':null,'license':null});}}}else{if(_0x544537[_0x6624('0xc')]!=_0x17bc70){logger[_0x6624('0xf')](_0x6624('0x1d'),_0x544537[_0x6624('0xc')],_0x17bc70);return _0x42761b[_0x6624('0x12')]({'data1':_0x17bc70,'data2':null,'license':null});}}}return _0x42761b;})[_0x6624('0x9')](function(_0x2e0f1){_0x42761b=_0x2e0f1;})['catch'](function(_0x3077a1){logger['error'](_0x3077a1[_0x6624('0x1e')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x6624('0x1f')](),_0x42761b);},TIME);});}function defaultLicense(){var _0x551709=hardware['getUuid']();if(_0x551709){return db[_0x6624('0x20')][_0x6624('0x21')]({'where':{'id':0x1},'defaults':{'data1':_0x551709}})[_0x6624('0x22')](function(_0x103b97,_0x2c30b5){logger[_0x6624('0xf')](_0x6624('0x23'),_0x551709);manageLicense(_0x551709,_0x103b97);})['catch'](function(_0x126ea0){logger[_0x6624('0x24')](_0x126ea0[_0x6624('0x1e')]);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index b176185..b293fc5 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 _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 +var _0x5035=['data1','license','License\x20key\x20value\x20not\x20found','split','decryptString','format','parse','demo','machineUuid','gray','days','grayReason','changed','disabled','message','role','sequelize','COUNT','col','count','admin','user','telephone','users','telephones','countBy','License\x20limit\x20reached\x20for\x20users','exports','lodash','bluebird','../../mysqldb','getUuid','Breaking\x20license','License','then','catch','uuid'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x5035,0x1d8));var _0x5503=function(_0x28459f,_0x393585){_0x28459f=_0x28459f-0x0;var _0x2aabb0=_0x5035[_0x28459f];return _0x2aabb0;};'use strict';var util=require('util');var _=require(_0x5503('0x0'));var moment=require('moment');var BPromise=require(_0x5503('0x1'));var hardware=require('./hardware');var encryptor=require('../../components/encryptor');var db=require(_0x5503('0x2'))['db'];const demoLicense={'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':![],'description':'Demo\x20license','machineUuid':hardware[_0x5503('0x3')](),'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':_0x5503('0x4'),'machineUuid':hardware[_0x5503('0x3')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x34f146){return new BPromise(function(_0x90ba8e,_0x519341){return db[_0x5503('0x5')]['find'](_['defaults'](_0x34f146,{'raw':!![],'where':{'id':0x1}}))[_0x5503('0x6')](function(_0x4baf2c){return checkLicense(_0x4baf2c,null);})[_0x5503('0x6')](function(_0x168170){_0x90ba8e(_0x168170);return;})[_0x5503('0x7')](function(_0x38ed02){_0x519341(_0x38ed02);});});}function checkLicense(_0x4226ee,_0x118c64){if(!_0x4226ee){demoLicense[_0x5503('0x8')]=_0x4226ee[_0x5503('0x9')];return demoLicense;}try{var _0x4f931d=_0x118c64||_0x4226ee[_0x5503('0xa')];if(_['isEmpty'](_0x4f931d)){throw new Error(_0x5503('0xb'));}var _0x56999d=_0x4226ee[_0x5503('0x9')];var _0x2737f4=_0x4226ee['data2'];var _0x54a0ae=_0x56999d[_0x5503('0xc')]('-')[0x4];var _0x8cab03=_0x56999d[_0x5503('0xc')]('-')[0x0];var _0x387b9e=encryptor[_0x5503('0xd')](_0x4f931d,util[_0x5503('0xe')]('%s:%s:%s',_0x54a0ae,_0x56999d,_0x8cab03));var _0x542255=JSON[_0x5503('0xf')](_0x387b9e);_0x542255[_0x5503('0x10')]=![];_0x542255['uuid']=_0x56999d;_0x542255[_0x5503('0x11')]=hardware[_0x5503('0x3')]();if(_0x2737f4){var _0x46ea25=encryptor[_0x5503('0xd')](_0x2737f4);_0x542255[_0x5503('0x12')]=_0x46ea25;_0x542255['deadline']=moment(_0x46ea25)['add'](0x7,_0x5503('0x13'))[_0x5503('0xe')]();_0x542255[_0x5503('0x14')]=_0x542255[_0x5503('0x8')]!=_0x542255[_0x5503('0x11')]?_0x5503('0x15'):_0x5503('0x16');}return _0x542255;}catch(_0x48ef68){breakingLicense[_0x5503('0x8')]=_0x4226ee[_0x5503('0x9')];breakingLicense[_0x5503('0x17')]=_0x48ef68['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x36e514,_0x57ee56){getLicense()[_0x5503('0x6')](function(_0x169056){return db['User']['findAll']({'attributes':[_0x5503('0x18'),[db[_0x5503('0x19')]['fn'](_0x5503('0x1a'),db[_0x5503('0x19')][_0x5503('0x1b')](_0x5503('0x18'))),_0x5503('0x1c')]],'group':_0x5503('0x18'),'where':{'role':{'$or':[_0x5503('0x1d'),_0x5503('0x1e'),_0x5503('0x1f')]}},'raw':!![]})[_0x5503('0x6')](function(_0x22e067){var _0x244daa={'user':_0x169056[_0x5503('0x20')]||0x0,'telephone':_0x169056[_0x5503('0x21')]||0x0};_0x22e067['forEach'](function(_0x3f73ea){var _0x34b834=_0x3f73ea['role']===_0x5503('0x1d')?_0x5503('0x1e'):_0x3f73ea[_0x5503('0x18')];_0x244daa[_0x34b834]-=_0x3f73ea['count'];if(_0x244daa[_0x34b834]<0x0)_0x244daa[_0x34b834]=0x0;});_0x36e514(_0x244daa);return;});})[_0x5503('0x7')](function(_0xf950f6){_0x57ee56(_0xf950f6);});});}function checkUserLimits(_0x3b3765){return new BPromise(function(_0x1f9750,_0x21ad1b){getLimits()['then'](function(_0x979ee5){var _0x352099=_['pick'](_[_0x5503('0x22')](_0x3b3765,'role'),[_0x5503('0x1d'),'user',_0x5503('0x1f')]);var _0x388289=(_0x352099[_0x5503('0x1d')]||0x0)+(_0x352099[_0x5503('0x1e')]||0x0);var _0x3886be=_0x352099['telephone']||0x0;if(_0x388289>_0x979ee5[_0x5503('0x1e')])return _0x21ad1b(_0x5503('0x23'));if(_0x3886be>_0x979ee5[_0x5503('0x1f')])return _0x21ad1b('License\x20limit\x20reached\x20for\x20telephones');return _0x1f9750();})[_0x5503('0x7')](function(_0x4ab8f7){_0x21ad1b(_0x4ab8f7);});});}module[_0x5503('0x24')]={'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 4292fa4..49206ef 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 _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 +var _0x25e7=['exports','http://localhost:9000','myappanuglar-secret','app-id','secret'];(function(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0x25e7,0x1d6));var _0x725e=function(_0x245728,_0x1e8ca4){_0x245728=_0x245728-0x0;var _0x1be470=_0x25e7[_0x245728];return _0x1be470;};'use strict';module[_0x725e('0x0')]={'DOMAIN':_0x725e('0x1'),'SESSION_SECRET':_0x725e('0x2'),'GOOGLE_ID':_0x725e('0x3'),'GOOGLE_SECRET':_0x725e('0x4'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 3a53b37..4544969 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0x0cb2=['exports','../utils/loggers'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x0cb2,0x17f));var _0x20cb=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0cb2[_0x20a584];return _0x4b41a8;};'use strict';var fileLogger=require(_0x20cb('0x0'))['fileLogger'];module[_0x20cb('0x1')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index f99475c..cafd298 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 _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 +var _0xfabe=['agi','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','../../config/environment','join','root','express','../../services/express/index.js','ami'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xfabe,0xb9));var _0xefab=function(_0x495417,_0x337944){_0x495417=_0x495417-0x0;var _0x418c9e=_0xfabe[_0x495417];return _0x418c9e;};'use strict';var path=require(_0xefab('0x0'));var cfg=require(_0xefab('0x1'));var env={'NODE_PATH':path['resolve'](path[_0xefab('0x2')](cfg[_0xefab('0x3')],'legacy-libs'))};var pm2config={'apps':[{'name':_0xefab('0x4'),'script':path[_0xefab('0x2')](__dirname,_0xefab('0x5')),'env':env},{'name':_0xefab('0x6'),'script':path[_0xefab('0x2')](__dirname,'../../services/ami/index.js'),'env':env},{'name':_0xefab('0x7'),'script':path[_0xefab('0x2')](__dirname,_0xefab('0x8')),'env':env},{'name':_0xefab('0x9'),'script':path[_0xefab('0x2')](__dirname,_0xefab('0xa')),'env':env},{'name':_0xefab('0xb'),'script':path[_0xefab('0x2')](__dirname,_0xefab('0xc')),'env':env},{'name':_0xefab('0xd'),'script':path[_0xefab('0x2')](__dirname,_0xefab('0xe')),'env':env}]};module[_0xefab('0xf')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 62e4c06..c2a6444 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 _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 +var _0xb6d6=['bluebird','./config','connect','connected','start','disconnect','stop','then','restart','list','describe','delete','dump','saved','pm2'];(function(_0x24f86d,_0x19103a){var _0xd92fb9=function(_0x5d45a8){while(--_0x5d45a8){_0x24f86d['push'](_0x24f86d['shift']());}};_0xd92fb9(++_0x19103a);}(_0xb6d6,0x185));var _0x6b6d=function(_0xed48f8,_0x2d9609){_0xed48f8=_0xed48f8-0x0;var _0x2cc350=_0xb6d6[_0xed48f8];return _0x2cc350;};'use strict';var pm2=require(_0x6b6d('0x0'));var BPromise=require(_0x6b6d('0x1'));var config=require(_0x6b6d('0x2'));function connect(){return new BPromise(function(_0x2f4c20,_0x62f96d){return pm2[_0x6b6d('0x3')](function(_0x3a1177){if(_0x3a1177){return _0x62f96d(_0x3a1177);}return _0x2f4c20(_0x6b6d('0x4'));});});};exports[_0x6b6d('0x5')]=function(_0x2fdb13){return connect()['then'](function(){return new BPromise(function(_0x5b583b,_0x4e7529){return pm2[_0x6b6d('0x5')](_0x2fdb13,function(_0x4b33a0,_0x1e2a82){if(_0x4b33a0){return _0x4e7529(_0x4b33a0);}pm2[_0x6b6d('0x6')]();return _0x5b583b(_0x1e2a82);});});});};exports[_0x6b6d('0x7')]=function(_0x3deacf){return connect()[_0x6b6d('0x8')](function(){return new BPromise(function(_0x5994e8,_0x211322){return pm2['stop'](_0x3deacf,function(_0x3686ec,_0x1215c5){if(_0x3686ec){return _0x211322(_0x3686ec);}pm2[_0x6b6d('0x6')]();return _0x5994e8(_0x1215c5);});});});};exports['restart']=function(_0x5becd4){return connect()[_0x6b6d('0x8')](function(){return new BPromise(function(_0x3dc357,_0x4544b1){return pm2[_0x6b6d('0x9')](_0x5becd4,function(_0x292ba1,_0x1a4fa8){if(_0x292ba1){return _0x4544b1(_0x292ba1);}pm2[_0x6b6d('0x6')]();return _0x3dc357(_0x1a4fa8);});});});};exports[_0x6b6d('0xa')]=function(){return connect()['then'](function(){return new BPromise(function(_0x2f9ebd,_0x130a91){return pm2['list'](function(_0x8cc019,_0x2d2bb7){if(_0x8cc019){return _0x130a91(_0x8cc019);}pm2['disconnect']();return _0x2f9ebd(_0x2d2bb7);});});});};exports[_0x6b6d('0xb')]=function(_0x2b4923){return connect()[_0x6b6d('0x8')](function(){return new BPromise(function(_0xd72b09,_0x914a7d){return pm2[_0x6b6d('0xb')](_0x2b4923,function(_0x22a935,_0x5dcc14){if(_0x22a935){return _0x914a7d(_0x22a935);}pm2[_0x6b6d('0x6')]();return _0xd72b09(_0x5dcc14);});});});};exports[_0x6b6d('0xc')]=function(_0x3b07ce){return connect()[_0x6b6d('0x8')](function(){return new BPromise(function(_0x61d109,_0x515d16){return pm2[_0x6b6d('0xc')](_0x3b07ce,function(_0x280d1b,_0x2ca880){if(_0x280d1b){return _0x515d16(_0x280d1b);}pm2[_0x6b6d('0x6')]();return _0x61d109(_0x2ca880);});});});};exports[_0x6b6d('0xd')]=function(){return connect()['then'](function(){return new BPromise(function(_0x46d1b9,_0xfe5ca1){return pm2['dump'](function(_0x1975ec){if(_0x1975ec){return _0xfe5ca1(_0x1975ec);}return _0x46d1b9(_0x6b6d('0xe'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 1b020dd..4c0a84e 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 _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 +var _0x496a=['format','YYYY-MM-DD\x20HH:mm:ss','length','info','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','start','lodash','moment','ioredis','util','../../config/environment','../logger','schedule','redis','defaults','localhost','socket.io-emitter','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','minutes','map','[CHAT]\x20Interactions\x20to\x20close:','join','system','timeout'];(function(_0x2d1971,_0x20b764){var _0x4d7759=function(_0x56a550){while(--_0x56a550){_0x2d1971['push'](_0x2d1971['shift']());}};_0x4d7759(++_0x20b764);}(_0x496a,0x155));var _0xa496=function(_0x57b482,_0x3624d4){_0x57b482=_0x57b482-0x0;var _0x32b6f9=_0x496a[_0x57b482];return _0x32b6f9;};'use strict';var _=require(_0xa496('0x0'));var moment=require(_0xa496('0x1'));var Redis=require(_0xa496('0x2'));var util=require(_0xa496('0x3'));var config=require(_0xa496('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0xa496('0x5'))(_0xa496('0x6'));config[_0xa496('0x7')]=_[_0xa496('0x8')](config[_0xa496('0x7')],{'host':_0xa496('0x9'),'port':0x18eb});var io=require(_0xa496('0xa'))(new Redis(config[_0xa496('0x7')]));function closeInteractions(){var _0x546a3f=0x0;var _0x573ffa=[];return db['Setting']['find']({'raw':!![],'attributes':['id',_0xa496('0xb')],'where':{'id':0x1}})[_0xa496('0xc')](function(_0x57c51b){_0x546a3f=_0x57c51b[_0xa496('0xb')];if(_0x546a3f){return db[_0xa496('0xd')][_0xa496('0xe')]({'raw':!![],'attributes':['id',_0xa496('0xf')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x57c51b['chatTimeout'],_0xa496('0x10'))}}});}else{return[];}})[_0xa496('0xc')](function(_0x541cc6){if(_0x541cc6&&_0x541cc6['length']){_0x573ffa=_[_0xa496('0x11')](_0x541cc6||[],'id');logger['info'](_0xa496('0x12'),_0x573ffa[_0xa496('0x13')]());return db[_0xa496('0xd')]['update']({'closeReason':_0xa496('0x14'),'disposition':_0xa496('0x15'),'closed':!![],'closedAt':moment()[_0xa496('0x16')](_0xa496('0x17'))},{'where':{'id':_0x573ffa}});}})[_0xa496('0xc')](function(){if(_0x573ffa&&_0x573ffa[_0xa496('0x18')]){logger[_0xa496('0x19')](_0xa496('0x1a'),_0x573ffa[_0xa496('0x13')]());for(var _0x5b9348=0x0;_0x5b9348<_0x573ffa[_0xa496('0x18')];_0x5b9348++){io[_0xa496('0x1b')](_0xa496('0x1c'),{'id':_0x573ffa[_0x5b9348],'closed':!![]});}}})[_0xa496('0x1d')](function(_0x452d46){logger[_0xa496('0x1e')](_0xa496('0x1f'),_0x452d46?util['inspect'](_0x452d46,{'showHidden':![],'depth':null}):'');});}exports[_0xa496('0x20')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index 1cb35d0..2dd9f64 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 _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 +var _0x52ee=['startAllRefreshIntervals','exports','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x52ee,0x71));var _0xe52e=function(_0x42ad6b,_0x39a94){_0x42ad6b=_0x42ad6b-0x0;var _0x442838=_0x52ee[_0x42ad6b];return _0x442838;};'use strict';function start(){var _0x559202=require(_0xe52e('0x0'));return _0x559202[_0xe52e('0x1')]();}module[_0xe52e('0x2')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 0190ca1..f9589d6 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 _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 +var _0x5b27=['isBetween','endAt','add','start','add\x20cron','exists','stop\x20cron','run','util','path','lodash','cron-job-manager','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','number','AnalyticExtractedReport','findOne','then','error','info','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','name','email','Smtp','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','zip','existsSync','Sent','message','attachments','text','stringify','status','Empty','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','Loading','Report\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Completed','Report\x20file\x20creation\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Failed','[handleSendEmail]\x20Unrecognized\x20status:','catch','error\x20mail','case\x20loading','currentAttempt','retryOptions','retries','operation','retry','job','data','stop','case\x20empty','case\x20failed','Unrecognized\x20status:','attempt','Job\x20ID\x20','\x20Attempt\x20#:\x27,\x20','dataValues','report\x20status:','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','exec\x20defaul\x20report\x20id:%s','DefaultReportId','runReport','CustomReportId','no\x20report\x20id','Schedule','CloudProvider','keys','map','keyBy','intersection','difference','length','toString','deleteJob','delete\x20cron','toRun','my\x20id','resolve','run\x20job','cron','active'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x5b27,0x1b8));var _0x75b2=function(_0x2f7725,_0x47a0bd){_0x2f7725=_0x2f7725-0x0;var _0x23f49c=_0x5b27[_0x2f7725];return _0x23f49c;};'use strict';var fs=require('fs');var util=require(_0x75b2('0x0'));var path=require(_0x75b2('0x1'));var _=require(_0x75b2('0x2'));var moment=require('moment');var CronJobManager=require(_0x75b2('0x3'));var jayson=require('jayson/promise');var BPromise=require(_0x75b2('0x4'));var logger=require(_0x75b2('0x5'))(_0x75b2('0x6'));var db=require(_0x75b2('0x7'))['db'];const retry=require('retry');var analyticCustomReportController=require(_0x75b2('0x8'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0x75b2('0x9')][_0x75b2('0xa')]({'port':0x232b});var manager=new CronJobManager();function getReportData(_0xdde1b0){return function(){const _0x5ec407={};if(typeof _0xdde1b0===_0x75b2('0xb')){_0x5ec407['id']=_0xdde1b0;}return db[_0x75b2('0xc')][_0x75b2('0xd')]({'where':_0x5ec407})[_0x75b2('0xe')](function(_0x242fdc){return _0x242fdc;})['catch'](function(_0x4077e8){logger[_0x75b2('0xf')](_0x4077e8);});};}function handleSendEmail(_0x207653,_0x95de91){return function(){logger[_0x75b2('0x10')](_0x75b2('0x11'),_0x207653['email']);var _0x4a1b53=!![];var _0x48f927=_0x207653[_0x75b2('0x12')][_0x75b2('0x13')]();var _0x2c5c8e={'account':_0x48f927,'message':{'from':util[_0x75b2('0x14')](_0x75b2('0x15'),_0x207653[_0x75b2('0x12')][_0x75b2('0x16')],_0x207653[_0x75b2('0x12')][_0x75b2('0x17')]||_0x207653[_0x75b2('0x12')][_0x75b2('0x18')][_0x75b2('0x19')]),'to':_0x207653[_0x75b2('0x17')],'cc':_0x207653['cc'],'bcc':_0x207653[_0x75b2('0x1a')],'subject':util[_0x75b2('0x14')](_0x75b2('0x1b'),_0x95de91[_0x75b2('0x16')],_0x207653['subtractNumber'],_0x207653[_0x75b2('0x1c')])}};var _0x2058ab=path[_0x75b2('0x1d')](__dirname,_0x75b2('0x1e'));var _0xe3a11f=_0x95de91[_0x75b2('0x1f')];var _0x4b5d73=util[_0x75b2('0x14')](_0x75b2('0x20'),path[_0x75b2('0x21')](_0x95de91['savename'],path[_0x75b2('0x22')](_0x95de91[_0x75b2('0x1f')])),_0x75b2('0x23'));var _0x436eb9=path[_0x75b2('0x1d')](_0x2058ab,_0xe3a11f);var _0x467c72=path[_0x75b2('0x1d')](_0x2058ab,_0x4b5d73);if(fs[_0x75b2('0x24')](_0x436eb9)){_0x95de91['status']=_0x75b2('0x25');_0x2c5c8e[_0x75b2('0x26')][_0x75b2('0x27')]=[{'filename':_0xe3a11f,'path':_0x436eb9}];_0x2c5c8e[_0x75b2('0x26')][_0x75b2('0x28')]=util[_0x75b2('0x14')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0x75b2('0x29')](_0x95de91,null,0x2));}else if(fs[_0x75b2('0x24')](_0x467c72)){_0x95de91[_0x75b2('0x2a')]=_0x75b2('0x25');_0x2c5c8e[_0x75b2('0x26')][_0x75b2('0x27')]=[{'filename':_0x4b5d73,'path':_0x467c72}];}else{if(_0x95de91[_0x75b2('0x2a')]===_0x75b2('0x2b')){_0x2c5c8e[_0x75b2('0x26')][_0x75b2('0x28')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x207653[_0x75b2('0x2c')]){_0x4a1b53=![];logger[_0x75b2('0x10')](_0x75b2('0x2d'));}}else if(_0x95de91[_0x75b2('0x2a')]===_0x75b2('0x2e')){_0x2c5c8e[_0x75b2('0x26')]['text']=_0x75b2('0x2f');}else if(_0x95de91[_0x75b2('0x2a')]===_0x75b2('0x30')){_0x2c5c8e['message'][_0x75b2('0x28')]=_0x75b2('0x31');}else if(_0x95de91['status']===_0x75b2('0x32')){_0x2c5c8e['message'][_0x75b2('0x28')]='Report\x20extraction\x20procedure\x20has\x20run\x20into\x20an\x20unexpected\x20error.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';}else{logger[_0x75b2('0xf')](_0x75b2('0x33'),_0x95de91['status']);}}if(_0x4a1b53){return client['request']('SendMail',_0x2c5c8e)[_0x75b2('0xe')](function(_0x165cbe){if(_0x165cbe[_0x75b2('0xf')]){return logger[_0x75b2('0xf')]('error\x20mail',JSON[_0x75b2('0x29')](_0x165cbe));}return logger[_0x75b2('0x10')]('email\x20sent');})[_0x75b2('0x34')](function(_0x51d1f0){return logger['error'](_0x75b2('0x35'),JSON[_0x75b2('0x29')](_0x51d1f0));});}};}function handleError(){return function(_0x318e0c){return logger[_0x75b2('0xf')](JSON[_0x75b2('0x29')](_0x318e0c));};}function loading(_0x2631f8){logger[_0x75b2('0x10')](_0x75b2('0x36'));if(_0x2631f8[_0x75b2('0x37')]===_0x2631f8[_0x75b2('0x38')][_0x75b2('0x39')]){handleSendEmail(_0x2631f8['job'],_0x2631f8['data']);_0x2631f8[_0x75b2('0x3a')]['stop']();}else{_0x2631f8[_0x75b2('0x3a')][_0x75b2('0x3b')]('still\x20loading');}}function completed(_0x3b2e4f){logger['info']('case\x20completed');handleSendEmail(_0x3b2e4f[_0x75b2('0x3c')],_0x3b2e4f[_0x75b2('0x3d')]);_0x3b2e4f[_0x75b2('0x3a')][_0x75b2('0x3e')]();}function empty(_0x5a484e){logger[_0x75b2('0x10')](_0x75b2('0x3f'));handleSendEmail(_0x5a484e[_0x75b2('0x3c')],_0x5a484e[_0x75b2('0x3d')]);_0x5a484e[_0x75b2('0x3a')][_0x75b2('0x3e')]();}function failed(_0x21d09c){logger[_0x75b2('0x10')](_0x75b2('0x40'));handleSendEmail(_0x21d09c['job'],_0x21d09c['data']);_0x21d09c[_0x75b2('0x3a')][_0x75b2('0x3e')]();}function urecognized(_0x13e1c1){logger[_0x75b2('0xf')](_0x75b2('0x41'),_0x13e1c1['entity']['dataValues'][_0x75b2('0x2a')]);_0x13e1c1[_0x75b2('0x3a')][_0x75b2('0x3e')]();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0x500801,_0x4672c4){const _0x538607={'retries':0xf,'factor':0x2,'minTimeout':0xa*0x3e8,'maxTimeout':0x3c*0x3c*0x3e8};const _0x157993=retry[_0x75b2('0x3a')](_0x538607);_0x157993[_0x75b2('0x42')](_0x12ce1b=>{logger[_0x75b2('0x10')](_0x75b2('0x43')+_0x500801['id']+_0x75b2('0x44')+_0x12ce1b);try{getReportData(_0x4672c4['id'])[_0x75b2('0xe')](function(_0x4ae677){_0x4672c4=_0x4ae677;logger['info']('report\x20status:',_0x4ae677['dataValues']['status']);if(!reportStatusStrategies[_0x4ae677[_0x75b2('0x45')][_0x75b2('0x2a')]]){logger[_0x75b2('0xf')](_0x75b2('0x46'),_0x4ae677[_0x75b2('0x45')][_0x75b2('0x2a')]);_0x157993[_0x75b2('0x3b')]();}reportStatusStrategies[_0x4ae677['dataValues'][_0x75b2('0x2a')]]({'operation':_0x157993,'currentAttempt':_0x12ce1b,'retryOptions':_0x538607,'job':_0x500801,'data':_0x4672c4,'entity':_0x4ae677});});}catch(_0x17323f){_0x157993['retry'](_0x17323f);}});}function handleResult(_0x2c48ea){return function(_0x262056){if(_0x2c48ea['sendMail']&&_0x2c48ea['MailAccount']&&_0x2c48ea[_0x75b2('0x12')][_0x75b2('0x18')]&&!_['isNil'](_0x2c48ea[_0x75b2('0x17')])){retryer(_0x2c48ea,_0x262056);}};}function handleJob(_0x45c85e){return function(){try{if(_[_0x75b2('0x47')](_0x45c85e[_0x75b2('0x48')])){return logger['info'](_0x75b2('0x49'));}if(_[_0x75b2('0x47')](_0x45c85e[_0x75b2('0x1c')])){return logger[_0x75b2('0x10')]('subtractUnit\x20null\x20or\x20undefined');}var _0x2ed5fa={'startDate':moment()[_0x75b2('0x4a')](_0x45c85e[_0x75b2('0x48')],_0x45c85e['subtractUnit'])[_0x75b2('0x14')](_0x75b2('0x4b')),'endDate':moment()[_0x75b2('0x14')](_0x75b2('0x4b')),'type':_0x75b2('0x4c'),'output':_0x45c85e[_0x75b2('0x4d')],'name':_0x45c85e['name']};if(!_[_0x75b2('0x47')](_0x45c85e['DefaultReportId'])){logger[_0x75b2('0x10')](_0x75b2('0x4e'),_0x45c85e[_0x75b2('0x4f')]);return analyticDefaultReportController[_0x75b2('0x50')]({'id':_0x45c85e[_0x75b2('0x4f')]},_0x2ed5fa)[_0x75b2('0xe')](handleResult(_0x45c85e))[_0x75b2('0x34')](handleError());}if(!_[_0x75b2('0x47')](_0x45c85e[_0x75b2('0x51')])){logger[_0x75b2('0x10')]('exec\x20custom\x20report\x20id:%s',_0x45c85e[_0x75b2('0x51')]);return analyticCustomReportController['runReport']({'id':_0x45c85e[_0x75b2('0x51')]},_0x2ed5fa)['then'](handleResult(_0x45c85e))[_0x75b2('0x34')](handleError());}}catch(_0x42e50d){logger['error'](JSON[_0x75b2('0x29')](_0x42e50d));}return logger['info'](_0x75b2('0x52'));};}function getJobs(_0x5c1393){var _0x10b18e={};if(_0x5c1393){_0x10b18e['id']=_0x5c1393;}return db[_0x75b2('0x53')]['findAll']({'where':_0x10b18e,'include':[{'model':db[_0x75b2('0x12')],'attributes':['id',_0x75b2('0x16'),'email'],'include':[{'model':db['MailServerOut'],'as':_0x75b2('0x18'),'include':[{'model':db[_0x75b2('0x54')],'as':_0x75b2('0x54')}]}]}]})['then'](function(_0x284af6){var _0x1dcde8=_[_0x75b2('0x55')](manager['jobs']);var _0x50af51=_[_0x75b2('0x56')](_0x284af6,function(_0x38aed7){return _0x38aed7['id']['toString']();});var _0xcdd630=_[_0x75b2('0x57')](_0x284af6,function(_0x228776){return _0x228776['id']['toString']();});var _0x24a612=_0x5c1393?_0x50af51:_['difference'](_0x50af51,_0x1dcde8);var _0x1f33be=_[_0x75b2('0x58')](_0x50af51,_0x1dcde8);var _0x5b1646=_[_0x75b2('0x59')](_0x1dcde8,_0x50af51);var _0x28afb7;var _0x5225de;for(_0x28afb7=0x0;_0x28afb7<_0x5b1646[_0x75b2('0x5a')]&&!_0x5c1393;_0x28afb7+=0x1){_0x5225de=_0x5b1646[_0x28afb7][_0x75b2('0x5b')]();if(manager['exists'](_0x5225de)){manager[_0x75b2('0x3e')](_0x5225de);manager[_0x75b2('0x5c')](_0x5225de);logger['info'](_0x75b2('0x5d'),_0x5225de);}}logger['info'](_0x75b2('0x5e'),JSON[_0x75b2('0x29')](_0x24a612));for(_0x28afb7=0x0;_0x28afb7<_0x24a612[_0x75b2('0x5a')];_0x28afb7+=0x1){_0x5225de=_0x24a612[_0x28afb7][_0x75b2('0x5b')]();logger[_0x75b2('0x10')]('index',_0x5225de);if(_0x5c1393){logger[_0x75b2('0x10')](_0x75b2('0x5f'),_0x5c1393);logger[_0x75b2('0x10')](JSON[_0x75b2('0x29')](_0xcdd630[_0x5225de]));BPromise[_0x75b2('0x60')]()[_0x75b2('0xe')](handleJob(_0xcdd630[_0x5225de]));logger['info'](_0x75b2('0x61'),_0xcdd630[_0x5225de][_0x75b2('0x16')],_0xcdd630[_0x5225de]['cron']);}else if(_0xcdd630[_0x5225de][_0x75b2('0x62')]&&_0xcdd630[_0x5225de][_0x75b2('0x63')]&&moment()[_0x75b2('0x64')](_0xcdd630[_0x5225de]['startAt'],_0xcdd630[_0x5225de][_0x75b2('0x65')])){manager[_0x75b2('0x66')](_0x5225de,_0xcdd630[_0x5225de][_0x75b2('0x62')],handleJob(_0xcdd630[_0x5225de]));manager[_0x75b2('0x67')](_0x5225de);logger[_0x75b2('0x10')](_0x75b2('0x68'),_0xcdd630[_0x5225de][_0x75b2('0x16')],_0xcdd630[_0x5225de]['cron']);}else if(manager[_0x75b2('0x69')](_0x5225de)){manager[_0x75b2('0x3e')](_0x5225de);manager[_0x75b2('0x5c')](_0x5225de);logger['info'](_0x75b2('0x6a'),_0xcdd630[_0x5225de][_0x75b2('0x16')],_0xcdd630[_0x5225de]['cron']);}}for(_0x28afb7=0x0,_0x5225de;_0x28afb7<_0x1f33be['length']&&!_0x5c1393;_0x28afb7+=0x1){_0x5225de=_0x1f33be[_0x28afb7][_0x75b2('0x5b')]();if(manager[_0x75b2('0x69')](_0x5225de)){if(_0xcdd630[_0x5225de][_0x75b2('0x62')]&&_0xcdd630[_0x5225de][_0x75b2('0x63')]&&moment()['isBetween'](_0xcdd630[_0x5225de]['startAt'],_0xcdd630[_0x5225de][_0x75b2('0x65')])){manager['update'](_0x5225de,_0xcdd630[_0x5225de][_0x75b2('0x62')],handleJob(_0xcdd630[_0x5225de]));logger[_0x75b2('0x10')]('update\x20cron',_0xcdd630[_0x5225de][_0x75b2('0x16')],_0xcdd630[_0x5225de][_0x75b2('0x62')]);}else{manager[_0x75b2('0x3e')](_0x5225de);manager[_0x75b2('0x5c')](_0x5225de);logger[_0x75b2('0x10')]('stop\x20cron',_0xcdd630[_0x5225de][_0x75b2('0x16')],_0xcdd630[_0x5225de][_0x75b2('0x62')]);}}}})[_0x75b2('0x34')](function(_0x8af19b){logger[_0x75b2('0xf')](JSON[_0x75b2('0x29')](_0x8af19b));});}exports[_0x75b2('0x6b')]=function(_0x1270c1){return getJobs(_0x1270c1);};exports[_0x75b2('0x67')]=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 34c065b..902d09f 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 _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 +var _0x0565=['sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','sentiment','bucket','Mixed','catch','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','forEach','push','all','name','start','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','Comprehend','detectSentiment','info','format','transcribeName','data1','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','results','transcripts','length','transcript','update','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis'];(function(_0x4bac96,_0x46c7bf){var _0xff0667=function(_0x758cf3){while(--_0x758cf3){_0x4bac96['push'](_0x4bac96['shift']());}};_0xff0667(++_0x46c7bf);}(_0x0565,0xf2));var _0x5056=function(_0x3305de,_0x16582f){_0x3305de=_0x3305de-0x0;var _0x3b5a84=_0x0565[_0x3305de];return _0x3b5a84;};var _=require(_0x5056('0x0'));var AWS=require(_0x5056('0x1'));var rp=require(_0x5056('0x2'));var util=require(_0x5056('0x3'));var BPromise=require(_0x5056('0x4'));var db=require(_0x5056('0x5'))['db'];var logger=require(_0x5056('0x6'))(_0x5056('0x7'));function getTranscriptionJob(_0x3657a8,_0x2b0883,_0x554040,_0x946e96){return new Promise(function(_0x105ea8,_0x1143df){var _0x22afb7=new AWS['TranscribeService']({'accessKeyId':_0x2b0883,'secretAccessKey':_0x3657a8,'region':_0x554040});_0x22afb7['getTranscriptionJob']({'TranscriptionJobName':_0x946e96},function(_0x38f74,_0x223c92){if(_0x38f74){return _0x1143df(_0x38f74);}else{return _0x105ea8(_0x223c92);}});});}function sentiment(_0x417065,_0x2e6f18,_0x2144a9,_0x68efb2,_0x1fa531){return new Promise(function(_0x332cd7,_0x5d2e60){var _0x78f7e4=new AWS[(_0x5056('0x8'))]({'accessKeyId':_0x2e6f18,'secretAccessKey':_0x417065,'region':_0x2144a9});_0x78f7e4[_0x5056('0x9')]({'Text':_0x68efb2,'LanguageCode':_0x1fa531['substring'](0x0,0x2)},function(_0x4c0255,_0x17f43e){if(_0x4c0255){return _0x5d2e60(_0x4c0255);}else{return _0x332cd7(_0x17f43e);}});});}function checkTranscribeJob(_0x504a47,_0x548bcf,_0x53e98a){var _0x2d44fb;return new BPromise(function(_0x4b183a,_0x3e523b){logger[_0x5056('0xa')](util[_0x5056('0xb')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x504a47['id'],_0x504a47[_0x5056('0xc')]));return getTranscriptionJob(_0x53e98a[_0x5056('0xd')],_0x53e98a[_0x5056('0xe')],_0x548bcf[_0x5056('0xf')],_0x504a47[_0x5056('0xc')])[_0x5056('0x10')](function(_0x4ac332){logger[_0x5056('0xa')](util['format'](_0x5056('0x11'),_0x504a47['id'],_0x504a47[_0x5056('0xc')],_0x4ac332[_0x5056('0x12')][_0x5056('0x13')]));if(!_0x504a47[_0x5056('0x14')]){switch(_0x4ac332['TranscriptionJob'][_0x5056('0x13')]){case _0x5056('0x15'):var _0x4f8fa7={'transcribeStatus':_0x4ac332['TranscriptionJob'][_0x5056('0x13')],'fileUri':_0x4ac332[_0x5056('0x12')][_0x5056('0x16')][_0x5056('0x17')]};logger[_0x5056('0xa')](util[_0x5056('0xb')](_0x5056('0x18'),_0x504a47['id']));return rp({'uri':_0x4ac332['TranscriptionJob'][_0x5056('0x16')][_0x5056('0x17')],'json':!![]})['then'](function(_0x271efc){logger[_0x5056('0xa')](util[_0x5056('0xb')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x504a47['id']));if(_0x271efc&&_0x271efc[_0x5056('0x19')]&&_0x271efc[_0x5056('0x19')]['transcripts']&&_0x271efc['results'][_0x5056('0x1a')][_0x5056('0x1b')]){_0x4f8fa7[_0x5056('0x14')]='';for(var _0x37f7b5=0x0;_0x37f7b5<_0x271efc['results'][_0x5056('0x1a')][_0x5056('0x1b')];_0x37f7b5++){_0x4f8fa7['fileText']+=_0x271efc[_0x5056('0x19')]['transcripts'][_0x37f7b5][_0x5056('0x1c')]+'';}}return _0x504a47[_0x5056('0x1d')](_0x4f8fa7);})[_0x5056('0x10')](function(){logger[_0x5056('0xa')](util[_0x5056('0xb')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x504a47['id']));if(!_0x504a47[_0x5056('0x1e')]){throw new db[(_0x5056('0x1f'))][(_0x5056('0x20'))](_0x5056('0x21'));}if(!_0x548bcf['sentiment']||!_0x548bcf[_0x5056('0x22')]||!_0x548bcf['sentimentRegion']||!_0x548bcf[_0x5056('0x23')]||!_0x548bcf['bucket']){throw new db['Sequelize']['ValidationError'](_0x5056('0x24'));}if(!_0x4f8fa7[_0x5056('0x14')]){throw new Error('Transcript\x20not\x20available');}if(_0x548bcf[_0x5056('0x22')]===_0x53e98a['id']){return _0x53e98a;}else{return db[_0x5056('0x25')][_0x5056('0x26')]({'where':{'id':_settings[_0x5056('0x22')]}});}})[_0x5056('0x10')](function(_0x2f796b){if(!_0x2f796b){throw new db[(_0x5056('0x1f'))][(_0x5056('0x20'))](_0x5056('0x27'));}if(!_0x2f796b[_0x5056('0xd')]||!_0x2f796b[_0x5056('0xe')]){throw new db['Sequelize']['ValidationError'](_0x5056('0x28'));}_0x2d44fb=_0x2f796b;logger[_0x5056('0xa')](util['format'](_0x5056('0x29'),_0x504a47['id']));return sentiment(_0x2d44fb[_0x5056('0xd')],_0x2d44fb['data2'],_0x548bcf[_0x5056('0x2a')],_0x4f8fa7[_0x5056('0x14')],_0x548bcf[_0x5056('0x23')]);})[_0x5056('0x10')](function(_0x33edfb){logger[_0x5056('0xa')](util[_0x5056('0xb')](_0x5056('0x2b'),_0x504a47['id']));return _0x504a47[_0x5056('0x1d')]({'sentiment':_0x33edfb[_0x5056('0x2c')],'sPositive':_0x33edfb[_0x5056('0x2d')][_0x5056('0x2e')],'sNegative':_0x33edfb[_0x5056('0x2d')][_0x5056('0x2f')],'sMixed':_0x33edfb[_0x5056('0x2d')]['Mixed'],'sNeutral':_0x33edfb[_0x5056('0x2d')]['Neutral']});})[_0x5056('0x10')](function(){logger[_0x5056('0xa')](util[_0x5056('0xb')](_0x5056('0x30'),_0x504a47['id']));_0x4b183a();});case'FAILED':return _0x504a47[_0x5056('0x1d')]({'transcribeStatus':_0x5056('0x31'),'failureReason':_0x4ac332['TranscriptionJob'][_0x5056('0x32')]})['then'](function(){logger[_0x5056('0xa')](util[_0x5056('0xb')](_0x5056('0x30'),_0x504a47['id']));_0x4b183a();});default:logger['info'](util[_0x5056('0xb')](_0x5056('0x33'),_0x504a47['id']));break;}}else{return BPromise[_0x5056('0x34')]()[_0x5056('0x10')](function(){if(!_0x504a47[_0x5056('0x1e')]){throw new db[(_0x5056('0x1f'))][(_0x5056('0x20'))](_0x5056('0x21'));}if(!_0x548bcf[_0x5056('0x35')]||!_0x548bcf[_0x5056('0x22')]||!_0x548bcf[_0x5056('0x2a')]||!_0x548bcf[_0x5056('0x23')]||!_0x548bcf[_0x5056('0x36')]){throw new db[(_0x5056('0x1f'))][(_0x5056('0x20'))](_0x5056('0x24'));}if(!_0x504a47['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x548bcf[_0x5056('0x22')]===_0x53e98a['id']){return _0x53e98a;}else{return db[_0x5056('0x25')][_0x5056('0x26')]({'where':{'id':_settings[_0x5056('0x22')]}});}})[_0x5056('0x10')](function(_0x1e2693){if(!_0x1e2693){throw new db[(_0x5056('0x1f'))][(_0x5056('0x20'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x1e2693['data1']||!_0x1e2693[_0x5056('0xe')]){throw new db[(_0x5056('0x1f'))][(_0x5056('0x20'))]('Cloud\x20Provider\x20not\x20configured');}_0x2d44fb=_0x1e2693;logger[_0x5056('0xa')](util['format'](_0x5056('0x29'),_0x504a47['id']));return sentiment(_0x2d44fb[_0x5056('0xd')],_0x2d44fb[_0x5056('0xe')],_0x548bcf[_0x5056('0x2a')],_0x504a47[_0x5056('0x14')],_0x548bcf[_0x5056('0x23')]);})['then'](function(_0x246114){logger[_0x5056('0xa')](util[_0x5056('0xb')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x504a47['id']));return _0x504a47['update']({'sentiment':_0x246114['Sentiment'],'sPositive':_0x246114['SentimentScore'][_0x5056('0x2e')],'sNegative':_0x246114[_0x5056('0x2d')][_0x5056('0x2f')],'sMixed':_0x246114[_0x5056('0x2d')][_0x5056('0x37')],'sNeutral':_0x246114['SentimentScore']['Neutral'],'transcribeStatus':_0x5056('0x15')});})[_0x5056('0x10')](function(){logger[_0x5056('0xa')](util[_0x5056('0xb')](_0x5056('0x30'),_0x504a47['id']));_0x4b183a();});}})[_0x5056('0x38')](function(_0xd726fe){if(_0xd726fe){if(!_0xd726fe['name']||_0xd726fe['name']!==_0x5056('0x39')){logger[_0x5056('0x3a')](util['format'](_0x5056('0x3b'),_0x504a47['id']),util[_0x5056('0x3c')](_0xd726fe,{'showHidden':![],'depth':null}));}}_0x4b183a();});});}function checkTranscribe(){var _0x4c2384;var _0x499259;var _0x83d8e4;return db[_0x5056('0x3d')]['findAll']({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x5056('0x10')](function(_0x1bb253){if(!_0x1bb253||!_0x1bb253['length']){throw new db['Sequelize'][(_0x5056('0x20'))](_0x5056('0x3e'));}_0x4c2384=_0x1bb253;return db[_0x5056('0x3f')][_0x5056('0x26')]({'where':{'id':0x1}});})[_0x5056('0x10')](function(_0xdf427c){if(!_0xdf427c){throw new db[(_0x5056('0x1f'))][(_0x5056('0x20'))](_0x5056('0x40'));}_0x499259=_0xdf427c;if(!_0x499259[_0x5056('0x7')]||!_0x499259[_0x5056('0x41')]||!_0x499259[_0x5056('0xf')]||!_0x499259[_0x5056('0x23')]||!_0x499259[_0x5056('0x36')]){throw new db[(_0x5056('0x1f'))]['ValidationError']('Transcribe\x20not\x20configured');}return db[_0x5056('0x25')][_0x5056('0x26')]({'where':{'id':_0x499259[_0x5056('0x41')]}});})[_0x5056('0x10')](function(_0x35776b){if(!_0x35776b){throw new db[(_0x5056('0x1f'))]['ValidationError'](_0x5056('0x27'));}if(!_0x35776b[_0x5056('0xd')]||!_0x35776b[_0x5056('0xe')]){throw new db[(_0x5056('0x1f'))][(_0x5056('0x20'))](_0x5056('0x28'));}_0x83d8e4=_0x35776b;var _0x26fe1c=[];_0x4c2384[_0x5056('0x42')](function(_0x3a0959){_0x26fe1c[_0x5056('0x43')](checkTranscribeJob(_0x3a0959,_0x499259,_0x83d8e4));});return BPromise[_0x5056('0x44')](_0x26fe1c);})[_0x5056('0x38')](function(_0x3b90b2){if(_0x3b90b2){if(!_0x3b90b2['name']||_0x3b90b2[_0x5056('0x45')]!==_0x5056('0x39')){logger[_0x5056('0x3a')](util['inspect'](_0x3b90b2,{'showHidden':![],'depth':null}));}}});}exports[_0x5056('0x46')]=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 60bc61d..55fd58a 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 _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 +var _0xc6a0=['error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','findAll','lastMsgAt','subtract','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','WhatsappInteraction','system','format','YYYY-MM-DD\x20HH:mm:ss','whatsappInteraction:update'];(function(_0xac7c93,_0x436cd0){var _0x1e1b2c=function(_0x4777bf){while(--_0x4777bf){_0xac7c93['push'](_0xac7c93['shift']());}};_0x1e1b2c(++_0x436cd0);}(_0xc6a0,0x170));var _0x0c6a=function(_0x180d78,_0x2dc735){_0x180d78=_0x180d78-0x0;var _0x10b5f4=_0xc6a0[_0x180d78];return _0x10b5f4;};'use strict';var _=require(_0x0c6a('0x0'));var moment=require(_0x0c6a('0x1'));var Redis=require(_0x0c6a('0x2'));var util=require('util');var config=require('../../config/environment');var db=require(_0x0c6a('0x3'))['db'];var logger=require(_0x0c6a('0x4'))(_0x0c6a('0x5'));config[_0x0c6a('0x6')]=_[_0x0c6a('0x7')](config[_0x0c6a('0x6')],{'host':_0x0c6a('0x8'),'port':0x18eb});var io=require(_0x0c6a('0x9'))(new Redis(config[_0x0c6a('0x6')]));function closeInteractions(){var _0x383d8c=[];return db['WhatsappInteraction'][_0x0c6a('0xa')]({'raw':!![],'attributes':['id',_0x0c6a('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x0c6a('0xc')](0x18,'hours')}}})[_0x0c6a('0xd')](function(_0x242f12){if(_0x242f12&&_0x242f12[_0x0c6a('0xe')]){_0x383d8c=_[_0x0c6a('0xf')](_0x242f12||[],'id');logger[_0x0c6a('0x10')](_0x0c6a('0x11'),_0x383d8c[_0x0c6a('0x12')]());return db[_0x0c6a('0x13')]['update']({'closeReason':_0x0c6a('0x14'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x0c6a('0x15')](_0x0c6a('0x16'))},{'where':{'id':_0x383d8c}});}})['then'](function(){if(_0x383d8c&&_0x383d8c[_0x0c6a('0xe')]){logger[_0x0c6a('0x10')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x383d8c['join']());for(var _0x5e1596=0x0;_0x5e1596<_0x383d8c[_0x0c6a('0xe')];_0x5e1596++){io['emit'](_0x0c6a('0x17'),{'id':_0x383d8c[_0x5e1596],'closed':!![]});}}})['catch'](function(_0x496d52){logger[_0x0c6a('0x18')](_0x0c6a('0x19'),_0x496d52?util[_0x0c6a('0x1a')](_0x496d52,{'showHidden':![],'depth':null}):'');});}exports[_0x0c6a('0x1b')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index b800900..18e3df6 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0xd10b=['innocenzo.biondo','now','Biondo','@xcally.com','CmContact','destroy','then','bulkCreate','log','finished\x20populating','contacts1','hopper1','catch','util','push','Innocenzo'];(function(_0x119a20,_0xf69ff4){var _0x384ac9=function(_0x2a3e65){while(--_0x2a3e65){_0x119a20['push'](_0x119a20['shift']());}};_0x384ac9(++_0xf69ff4);}(_0xd10b,0x6d));var _0xbd10=function(_0x30aa3d,_0x1c2d59){_0x30aa3d=_0x30aa3d-0x0;var _0x453da9=_0xd10b[_0x30aa3d];return _0x453da9;};'use strict';var util=require(_0xbd10('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xbd10('0x1')]({'id':i,'firstName':_0xbd10('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xbd10('0x3')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xbd10('0x1')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xbd10('0x4')](),'updatedAt':Date[_0xbd10('0x4')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0xbd10('0x2')+i,'lastName':_0xbd10('0x5')+i,'phone':0xf879fb460+i,'email':_0xbd10('0x3')+i+_0xbd10('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xbd10('0x1')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xbd10('0x4')](),'updatedAt':Date[_0xbd10('0x4')]()});}db[_0xbd10('0x7')][_0xbd10('0x8')]({'where':{}})[_0xbd10('0x9')](function(){return db[_0xbd10('0x7')][_0xbd10('0xa')](contacts);})[_0xbd10('0x9')](function(){console[_0xbd10('0xb')](_0xbd10('0xc'),_0xbd10('0xd'));return db['CmHopper'][_0xbd10('0x8')]({'where':{}});})[_0xbd10('0x9')](function(){return db['CmHopper'][_0xbd10('0xa')](hopper);})[_0xbd10('0x9')](function(){console[_0xbd10('0xb')](_0xbd10('0xc'),_0xbd10('0xe'));return db[_0xbd10('0x7')]['bulkCreate'](contacts2);})['then'](function(){console[_0xbd10('0xb')](_0xbd10('0xc'),'contacts2');return db['CmHopper']['bulkCreate'](hopper2);})[_0xbd10('0x9')](function(){console[_0xbd10('0xb')](_0xbd10('0xc'),'hopper2');})[_0xbd10('0xf')](function(_0x366e45){console['log'](_0x366e45);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 584f9e9..5e8adaf 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0x8c1f=['all','ulaw','yes','/etc/pki/tls/private/motion.key','actpass','bulkCreate','log','add\x20user','catch','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','udp','wss'];(function(_0x39dc37,_0x4d0109){var _0x12b3a2=function(_0x427d64){while(--_0x427d64){_0x39dc37['push'](_0x39dc37['shift']());}};_0x12b3a2(++_0x4d0109);}(_0x8c1f,0x17f));var _0xf8c1=function(_0x5e5c08,_0x1147a1){_0x5e5c08=_0x5e5c08-0x0;var _0x5c4d1b=_0x8c1f[_0x5e5c08];return _0x5c4d1b;};'use strict';var util=require('util');var db=require(_0xf8c1('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xf8c1('0x1')]({'name':util[_0xf8c1('0x2')](_0xf8c1('0x3'),'agent',i),'fullname':util['format'](_0xf8c1('0x3'),_0xf8c1('0x4'),i),'email':util[_0xf8c1('0x2')](_0xf8c1('0x5'),'agent',i),'role':_0xf8c1('0x4'),'password':'password','internal':0xfa0+i,'type':'friend','transport':[_0xf8c1('0x6'),'ws',_0xf8c1('0x7')],'disallow':[_0xf8c1('0x8')],'allow':[_0xf8c1('0x9')],'defaultuser':util[_0xf8c1('0x2')](_0xf8c1('0x3'),_0xf8c1('0x4'),i),'encryption':_0xf8c1('0xa'),'avpf':_0xf8c1('0xa'),'force_avp':_0xf8c1('0xa'),'icesupport':'yes','dtlsenable':'yes','dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0xf8c1('0xb'),'dtlssetup':_0xf8c1('0xc'),'callerid':util[_0xf8c1('0x2')]('\x22%s\x22\x20<%s>',util[_0xf8c1('0x2')](_0xf8c1('0x3'),'agent',i),0xfa0+i)});}db['User'][_0xf8c1('0xd')](users)['then'](function(){console[_0xf8c1('0xe')](_0xf8c1('0xf'));})[_0xf8c1('0x10')](function(_0x23cc93){console[_0xf8c1('0xe')](_0x23cc93);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index d7e4ca4..fb79b83 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0x8be3=['type','leave','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_whatsapp_interactions:remove','catch','join','default','connection','request','remotePort','connectedAt','log','SocketIO\x20','nsp','address','disconnect','DISCONNECTED','CONNECTED','util','bluebird','../mysqldb','name','User','role','agent','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','FaxQueues','SmsQueues','Telephones','IvrCampaigns','findAll','resourceId','map','where','telephone','Campaign','ivr','format','%s:queue:%s','Agents','length','find','userProfileId','handshake','query','ChatInteraction','ChatInteractions','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteractions','user:%s','admin','voice:inbound','voice:outbound','include','push','ChatQueue','FaxQueue','SmsQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','VoiceQueue','ChatQueues','MailQueues','MailQueue','OpenchannelQueues','WhatsappQueues','getVoiceQueues','getSmsQueues','voice','sms','mail','whatsapp','campaign:%s:%s'];(function(_0x80544e,_0x37a3f3){var _0x4f9b90=function(_0x4f95d6){while(--_0x4f95d6){_0x80544e['push'](_0x80544e['shift']());}};_0x4f9b90(++_0x37a3f3);}(_0x8be3,0xd1));var _0x38be=function(_0x490098,_0x279a7a){_0x490098=_0x490098-0x0;var _0xb645eb=_0x8be3[_0x490098];return _0xb645eb;};'use strict';var _=require('lodash');var util=require(_0x38be('0x0'));var BPromise=require(_0x38be('0x1'));var db=require(_0x38be('0x2'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x38be('0x3')],'include':[{'as':'Agents','model':db[_0x38be('0x4')],'attributes':['id',_0x38be('0x3'),_0x38be('0x5')],'raw':!![],'where':{'role':_0x38be('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x38be('0x3')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0x38be('0x3')]};var queryAgents={'raw':!![],'attributes':['id',_0x38be('0x3')],'where':{'role':_0x38be('0x6')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x38be('0x3'),'type'],'where':{'type':'ivr'}};function getAssociatedResources(_0x414780,_0x23d271,_0x456a9f){return db[_0x38be('0x7')][_0x38be('0x8')]({'where':{'name':_0x414780,'userProfileId':_0x23d271},'raw':!![]})[_0x38be('0x9')](function(_0x5c1a1a){if(_0x5c1a1a){if(_0x5c1a1a[_0x38be('0xa')]){switch(_0x414780){case _0x38be('0xb'):case'ChatQueues':case _0x38be('0xc'):case _0x38be('0xd'):case'MailQueues':case'OpenchannelQueues':case'WhatsappQueues':return db[_0x456a9f]['findAll'](queryQueues);case _0x38be('0xe'):return db[_0x456a9f]['findAll'](queryTelephones);case'Trunks':return db[_0x456a9f]['findAll'](queryTrunks);case _0x38be('0xf'):return db[_0x456a9f][_0x38be('0x10')](queryCampaigns);}}else{return db['UserProfileResource'][_0x38be('0x10')]({'attributes':[_0x38be('0x11')],'where':{'sectionId':_0x5c1a1a['id']},'raw':!![]})[_0x38be('0x9')](function(_0x50263e){if(_0x50263e){var _0x16cb31={'where':{'id':_[_0x38be('0x12')](_0x50263e,'resourceId')},'raw':!![]};switch(_0x456a9f){case _0x38be('0x4'):_0x16cb31[_0x38be('0x13')][_0x38be('0x5')]=_0x38be('0x14');break;case _0x38be('0x15'):_0x16cb31[_0x38be('0x13')]['type']=_0x38be('0x16');break;}return db[_0x456a9f][_0x38be('0x10')](_0x16cb31);}else{return[];}});}}else{return[];}})[_0x38be('0x9')](function(_0x545ab1){return _0x545ab1;});}function joinOrLeaveQueues(_0x262248,_0x10bd3e,_0x12f654,_0x9bc9b0){_0x262248[_0x10bd3e](util[_0x38be('0x17')](_0x38be('0x18'),_0x12f654,_0x9bc9b0[_0x38be('0x3')]));if(_0x9bc9b0[_0x38be('0x19')]){for(var _0x429023=0x0;_0x429023<_0x9bc9b0[_0x38be('0x19')][_0x38be('0x1a')];_0x429023+=0x1){_0x262248[_0x10bd3e](util[_0x38be('0x17')]('user:%s',_0x9bc9b0[_0x38be('0x19')][_0x429023][_0x38be('0x3')]));}}}function joinOrLeave(_0xddf97c,_0x1f375a,_0x3b8c88){var _0x57a901;if(_0xddf97c['handshake']['query']['id']){db['User'][_0x38be('0x1b')]({'attributes':['id','name',_0x38be('0x5'),_0x38be('0x1c')],'where':{'id':_0xddf97c[_0x38be('0x1d')][_0x38be('0x1e')]['id']},'include':[{'model':db[_0x38be('0x1f')],'as':_0x38be('0x20'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0x38be('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0x38be('0x22')],'as':_0x38be('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x38be('0x24')],'as':_0x38be('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x38be('0x26')],'as':_0x38be('0x27'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0x38be('0x28'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x28a828){if(_0x28a828){_0x57a901=_0x28a828;_0xddf97c[_0x1f375a](util['format'](_0x38be('0x29'),_0x28a828[_0x38be('0x3')]));var _0x1a704f=[];switch(_0x28a828['role']){case _0x38be('0x2a'):_0xddf97c[_0x1f375a](_0x38be('0x2b'));_0xddf97c[_0x1f375a](_0x38be('0x2c'));if(queryQueues['hasOwnProperty']('include')){delete queryQueues[_0x38be('0x2d')];}_0x1a704f['push'](db['VoiceQueue'][_0x38be('0x10')](queryQueues));_0x1a704f[_0x38be('0x2e')](db[_0x38be('0x2f')]['findAll'](queryQueues));_0x1a704f[_0x38be('0x2e')](db[_0x38be('0x30')][_0x38be('0x10')](queryQueues));_0x1a704f['push'](db[_0x38be('0x31')][_0x38be('0x10')](queryQueues));_0x1a704f[_0x38be('0x2e')](db['MailQueue'][_0x38be('0x10')](queryQueues));_0x1a704f[_0x38be('0x2e')](db[_0x38be('0x32')]['findAll'](queryQueues));_0x1a704f[_0x38be('0x2e')](db[_0x38be('0x33')][_0x38be('0x10')](queryQueues));_0x1a704f[_0x38be('0x2e')](db[_0x38be('0x4')][_0x38be('0x10')](queryTelephones));_0x1a704f[_0x38be('0x2e')](db[_0x38be('0x34')]['findAll'](queryTrunks));_0x1a704f[_0x38be('0x2e')](db[_0x38be('0x15')][_0x38be('0x10')](queryCampaigns));_0x1a704f[_0x38be('0x2e')](db['User']['findAll'](queryAgents));break;case _0x38be('0x35'):_0xddf97c[_0x1f375a](_0x38be('0x2b'));_0xddf97c[_0x1f375a](_0x38be('0x2c'));_0x1a704f['push'](getAssociatedResources(_0x38be('0xb'),_0x28a828[_0x38be('0x1c')],_0x38be('0x36')));_0x1a704f[_0x38be('0x2e')](getAssociatedResources(_0x38be('0x37'),_0x28a828[_0x38be('0x1c')],_0x38be('0x2f')));_0x1a704f['push'](getAssociatedResources(_0x38be('0xc'),_0x28a828['userProfileId'],_0x38be('0x30')));_0x1a704f[_0x38be('0x2e')](getAssociatedResources(_0x38be('0xd'),_0x28a828['userProfileId'],_0x38be('0x31')));_0x1a704f[_0x38be('0x2e')](getAssociatedResources(_0x38be('0x38'),_0x28a828[_0x38be('0x1c')],_0x38be('0x39')));_0x1a704f[_0x38be('0x2e')](getAssociatedResources(_0x38be('0x3a'),_0x28a828[_0x38be('0x1c')],_0x38be('0x32')));_0x1a704f[_0x38be('0x2e')](getAssociatedResources(_0x38be('0x3b'),_0x28a828['userProfileId'],_0x38be('0x33')));_0x1a704f['push'](getAssociatedResources(_0x38be('0xe'),_0x28a828[_0x38be('0x1c')],'User'));_0x1a704f[_0x38be('0x2e')](getAssociatedResources('Trunks',_0x28a828[_0x38be('0x1c')],'Trunk'));_0x1a704f[_0x38be('0x2e')](getAssociatedResources(_0x38be('0xf'),_0x28a828[_0x38be('0x1c')],_0x38be('0x15')));_0x1a704f[_0x38be('0x2e')](db[_0x38be('0x4')][_0x38be('0x10')](queryAgents));break;case _0x38be('0x6'):_0xddf97c[_0x1f375a](_0x38be('0x2b'));_0xddf97c[_0x1f375a](_0x38be('0x2c'));_0x1a704f[_0x38be('0x2e')](_0x28a828[_0x38be('0x3c')]({'attributes':['id',_0x38be('0x3')]}));_0x1a704f[_0x38be('0x2e')](_0x28a828['getChatQueues']({'attributes':['id',_0x38be('0x3')]}));_0x1a704f[_0x38be('0x2e')](_0x28a828['getFaxQueues']({'attributes':['id',_0x38be('0x3')]}));_0x1a704f[_0x38be('0x2e')](_0x28a828[_0x38be('0x3d')]({'attributes':['id',_0x38be('0x3')]}));_0x1a704f['push'](_0x28a828['getMailQueues']({'attributes':['id',_0x38be('0x3')]}));_0x1a704f['push'](_0x28a828['getOpenchannelQueues']({'attributes':['id',_0x38be('0x3')]}));_0x1a704f[_0x38be('0x2e')](_0x28a828['getWhatsappQueues']({'attributes':['id',_0x38be('0x3')]}));break;}return BPromise['all'](_0x1a704f);}})[_0x38be('0x9')](function(_0x2f752b){if(_0x2f752b&&_0x2f752b[_0x38be('0x1a')]){for(var _0x18bb5b=0x0;_0x18bb5b<_0x2f752b[_0x38be('0x1a')];_0x18bb5b+=0x1){for(var _0x5697ff=0x0;_0x5697ff<_0x2f752b[_0x18bb5b][_0x38be('0x1a')];_0x5697ff+=0x1){switch(_0x18bb5b){case 0x0:joinOrLeaveQueues(_0xddf97c,_0x1f375a,_0x38be('0x3e'),_0x2f752b[_0x18bb5b][_0x5697ff]);break;case 0x1:joinOrLeaveQueues(_0xddf97c,_0x1f375a,'chat',_0x2f752b[_0x18bb5b][_0x5697ff]);break;case 0x2:joinOrLeaveQueues(_0xddf97c,_0x1f375a,'fax',_0x2f752b[_0x18bb5b][_0x5697ff]);break;case 0x3:joinOrLeaveQueues(_0xddf97c,_0x1f375a,_0x38be('0x3f'),_0x2f752b[_0x18bb5b][_0x5697ff]);break;case 0x4:joinOrLeaveQueues(_0xddf97c,_0x1f375a,_0x38be('0x40'),_0x2f752b[_0x18bb5b][_0x5697ff]);break;case 0x5:joinOrLeaveQueues(_0xddf97c,_0x1f375a,'openchannel',_0x2f752b[_0x18bb5b][_0x5697ff]);break;case 0x6:joinOrLeaveQueues(_0xddf97c,_0x1f375a,_0x38be('0x41'),_0x2f752b[_0x18bb5b][_0x5697ff]);break;case 0x7:if(_0x57a901[_0x38be('0x5')]!=='agent')_0xddf97c[_0x1f375a](util['format']('telephone:%s',_0x2f752b[_0x18bb5b][_0x5697ff][_0x38be('0x3')]));break;case 0x8:if(_0x57a901[_0x38be('0x5')]!=='agent')_0xddf97c[_0x1f375a](util['format']('trunk:%s',_0x2f752b[_0x18bb5b][_0x5697ff][_0x38be('0x3')]));break;case 0x9:if(_0x57a901[_0x38be('0x5')]!=='agent')_0xddf97c[_0x1f375a](util[_0x38be('0x17')](_0x38be('0x42'),_0x2f752b[_0x18bb5b][_0x5697ff][_0x38be('0x43')],_0x2f752b[_0x18bb5b][_0x5697ff]['name']));break;case 0xa:_0xddf97c[_0x1f375a](util[_0x38be('0x17')](_0x38be('0x29'),_0x2f752b[_0x18bb5b][_0x5697ff]['name']));break;}}}}})['then'](function(){if(_0x1f375a===_0x38be('0x44')){var _0x46223f=_[_0x38be('0x12')](_0x57a901[_0x38be('0x20')],'id');return _0x57a901['removeChatInteractions'](_0x46223f)[_0x38be('0x9')](function(){for(var _0x4ab5a2=0x0;_0x4ab5a2<_0x46223f[_0x38be('0x1a')];_0x4ab5a2+=0x1){_0x3b8c88[_0x38be('0x45')](_0x38be('0x46'),{'ChatInteractionId':Number(_0x46223f[_0x4ab5a2]),'UserId':Number(_0x57a901['id'])});}});}})['then'](function(){if(_0x1f375a==='leave'){var _0xb175f1=_['map'](_0x57a901[_0x38be('0x21')],'id');return _0x57a901[_0x38be('0x47')](_0xb175f1)[_0x38be('0x9')](function(){for(var _0x424b56=0x0;_0x424b56<_0xb175f1[_0x38be('0x1a')];_0x424b56+=0x1){_0x3b8c88['emit'](_0x38be('0x48'),{'MailInteractionId':Number(_0xb175f1[_0x424b56]),'UserId':Number(_0x57a901['id'])});}});}})['then'](function(){if(_0x1f375a===_0x38be('0x44')){var _0x3a3734=_[_0x38be('0x12')](_0x57a901[_0x38be('0x23')],'id');return _0x57a901[_0x38be('0x49')](_0x3a3734)[_0x38be('0x9')](function(){for(var _0x49e435=0x0;_0x49e435<_0x3a3734[_0x38be('0x1a')];_0x49e435+=0x1){_0x3b8c88[_0x38be('0x45')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x3a3734[_0x49e435]),'UserId':Number(_0x57a901['id'])});}});}})['then'](function(){if(_0x1f375a===_0x38be('0x44')){var _0x28030c=_[_0x38be('0x12')](_0x57a901[_0x38be('0x25')],'id');return _0x57a901[_0x38be('0x4a')](_0x28030c)['then'](function(){for(var _0x1f08bc=0x0;_0x1f08bc<_0x28030c[_0x38be('0x1a')];_0x1f08bc+=0x1){_0x3b8c88[_0x38be('0x45')](_0x38be('0x4b'),{'SmsInteractionId':Number(_0x28030c[_0x1f08bc]),'UserId':Number(_0x57a901['id'])});}});}})[_0x38be('0x9')](function(){if(_0x1f375a===_0x38be('0x44')){var _0x264a2a=_['map'](_0x57a901[_0x38be('0x27')],'id');return _0x57a901[_0x38be('0x4c')](_0x264a2a)['then'](function(){for(var _0x2b152e=0x0;_0x2b152e<_0x264a2a[_0x38be('0x1a')];_0x2b152e+=0x1){_0x3b8c88[_0x38be('0x45')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x264a2a[_0x2b152e]),'UserId':Number(_0x57a901['id'])});}});}})[_0x38be('0x9')](function(){if(_0x1f375a===_0x38be('0x44')){var _0x4da96f=_[_0x38be('0x12')](_0x57a901[_0x38be('0x28')],'id');return _0x57a901['removeWhatsappInteractions'](_0x4da96f)[_0x38be('0x9')](function(){for(var _0x170597=0x0;_0x170597<_0x4da96f[_0x38be('0x1a')];_0x170597+=0x1){_0x3b8c88[_0x38be('0x45')](_0x38be('0x4d'),{'WhatsappInteractionId':Number(_0x4da96f[_0x170597]),'UserId':Number(_0x57a901['id'])});}});}})[_0x38be('0x4e')](function(_0x2b31fb){_0xddf97c['log'](_0x2b31fb);});}}function onDisconnect(_0x15c60d,_0x540a1d){joinOrLeave(_0x15c60d,'leave',_0x540a1d);}function onConnect(_0x6425a5){joinOrLeave(_0x6425a5,_0x38be('0x4f'));}exports[_0x38be('0x50')]=function(_0x58a318){_0x58a318['on'](_0x38be('0x51'),function(_0x1f09c7){_0x1f09c7['setMaxListeners'](0x0);_0x1f09c7['address']=_0x1f09c7[_0x38be('0x52')][_0x38be('0x51')]['remoteAddress']+':'+_0x1f09c7[_0x38be('0x52')][_0x38be('0x51')][_0x38be('0x53')];_0x1f09c7[_0x38be('0x54')]=new Date();_0x1f09c7[_0x38be('0x55')]=function(_0x5e2d34){console[_0x38be('0x55')](_0x38be('0x56')+_0x1f09c7[_0x38be('0x57')][_0x38be('0x3')]+'['+_0x1f09c7[_0x38be('0x58')]+']',_0x5e2d34);};_0x1f09c7['on'](_0x38be('0x59'),function(){onDisconnect(_0x1f09c7,_0x58a318);_0x1f09c7[_0x38be('0x55')](_0x38be('0x5a'));});onConnect(_0x1f09c7);_0x1f09c7[_0x38be('0x55')](_0x38be('0x5b'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 76eac60..04afae8 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 _0x75bd=['then','Trigger,\x20%s','error','catch','get','channel','motionChannel','event','direction','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','Sequelize','contact','UserId','interface','format','SIP/%s','agent','incomingmessage','outgoingmessage','offlineMessage','opened','QueryTypes','SELECT','name','closed','changed','substatus','User','find','fullname','internal','default','hasOwnProperty','model','hook','condition','util','jayson/promise','../logger','triggers','client','http','Chat','afterCreate','newinteraction','ChatInteraction','closedinteraction','ChatMessage','newmessage','ChatOfflineMessage','Sms','SmsInteraction','Whatsapp','WhatsappInteraction','afterUpdate','WhatsappMessage','Fax','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager'];(function(_0x5b93f6,_0x55ab63){var _0x356bac=function(_0x2ee0e2){while(--_0x2ee0e2){_0x5b93f6['push'](_0x5b93f6['shift']());}};_0x356bac(++_0x55ab63);}(_0x75bd,0x1cc));var _0xd75b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x75bd[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0xd75b('0x0'));var db=require('../../mysqldb')['db'];var jayson=require(_0xd75b('0x1'));var logger=require(_0xd75b('0x2'))(_0xd75b('0x3'));var client=jayson[_0xd75b('0x4')][_0xd75b('0x5')]({'port':0x232a});var triggers=[{'channel':_0xd75b('0x6'),'model':'ChatInteraction','event':_0xd75b('0x7'),'condition':_0xd75b('0x8'),'callback':afterCreate},{'channel':_0xd75b('0x6'),'model':_0xd75b('0x9'),'event':'afterUpdate','condition':_0xd75b('0xa'),'callback':afterUpdate},{'channel':_0xd75b('0x6'),'model':_0xd75b('0xb'),'event':_0xd75b('0x7'),'condition':_0xd75b('0xc'),'callback':afterCreateMessage},{'channel':_0xd75b('0x6'),'model':_0xd75b('0xd'),'event':_0xd75b('0x7'),'condition':_0xd75b('0xc'),'callback':afterCreateOfflineMessage},{'channel':_0xd75b('0xe'),'model':_0xd75b('0xf'),'event':'afterCreate','condition':_0xd75b('0x8'),'callback':afterCreate},{'channel':_0xd75b('0xe'),'model':_0xd75b('0xf'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':'Sms','model':'SmsMessage','event':_0xd75b('0x7'),'condition':_0xd75b('0xc'),'callback':afterCreateMessage},{'channel':_0xd75b('0x10'),'model':'WhatsappInteraction','event':_0xd75b('0x7'),'condition':_0xd75b('0x8'),'callback':afterCreate},{'channel':_0xd75b('0x10'),'model':_0xd75b('0x11'),'event':_0xd75b('0x12'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xd75b('0x10'),'model':_0xd75b('0x13'),'event':_0xd75b('0x7'),'condition':_0xd75b('0xc'),'callback':afterCreateMessage},{'channel':'Fax','model':'FaxInteraction','event':_0xd75b('0x7'),'condition':_0xd75b('0x8'),'callback':afterCreate},{'channel':_0xd75b('0x14'),'model':'FaxInteraction','event':_0xd75b('0x12'),'condition':_0xd75b('0xa'),'callback':afterUpdate},{'channel':_0xd75b('0x14'),'model':_0xd75b('0x15'),'event':_0xd75b('0x7'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0xd75b('0x16'),'model':_0xd75b('0x17'),'event':_0xd75b('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xd75b('0x16'),'model':'MailInteraction','event':_0xd75b('0x12'),'condition':_0xd75b('0xa'),'callback':afterUpdate},{'channel':'Mail','model':_0xd75b('0x18'),'event':_0xd75b('0x7'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0xd75b('0x19'),'model':_0xd75b('0x1a'),'event':_0xd75b('0x7'),'condition':_0xd75b('0x8'),'callback':afterCreate},{'channel':_0xd75b('0x19'),'model':_0xd75b('0x1a'),'event':_0xd75b('0x12'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Openchannel','model':_0xd75b('0x1b'),'event':'afterCreate','condition':_0xd75b('0xc'),'callback':afterCreateMessage}];function request(_0x51350b){return client[_0xd75b('0x1c')](_0xd75b('0x1d'),_0x51350b)[_0xd75b('0x1e')](function(_0x3b429a){logger['info'](_0xd75b('0x1f'),_0xd75b('0x1d'),_0x3b429a);if(_0x3b429a[_0xd75b('0x20')]){if(_0x3b429a[_0xd75b('0x20')]['code']===0x1f4){logger[_0xd75b('0x20')](_0xd75b('0x1f'),_0xd75b('0x1d'),_0x3b429a['error']);}}})[_0xd75b('0x21')](function(_0x5c21de){logger[_0xd75b('0x20')]('Trigger,\x20%s','EventManager',_0x5c21de);});}function afterCreateMessage(_0x401fc7){return function(_0xd08ea3){_0xd08ea3=_0xd08ea3[_0xd75b('0x22')]({'plain':!![]});_0xd08ea3[_0xd75b('0x23')]=_0x401fc7;_0xd08ea3[_0xd75b('0x24')]=_0x401fc7;_0xd08ea3[_0xd75b('0x25')]=_0xd08ea3[_0xd75b('0x26')];Promise['resolve']()[_0xd75b('0x1e')](function(){if(typeof _0xd08ea3[_0xd75b('0x27')]===_0xd75b('0x28'))return null;var _0x2c8644=_0xd75b('0x29')+_0xd08ea3[_0xd75b('0x27')];return db[_0xd75b('0x2a')][_0xd75b('0x2b')](_0x2c8644,{'type':db[_0xd75b('0x2c')]['QueryTypes']['SELECT'],'raw':!![]});})[_0xd75b('0x1e')](function(_0x532cbe){if(_0x532cbe){_0xd08ea3[_0xd75b('0x2d')]=_0x532cbe[0x0];}if(typeof _0xd08ea3[_0xd75b('0x2e')]===_0xd75b('0x28'))return;return getAgent(_0xd08ea3[_0xd75b('0x2e')]);})[_0xd75b('0x1e')](function(_0x228747){if(_0x228747){_0xd08ea3[_0xd75b('0x2f')]=util[_0xd75b('0x30')](_0xd75b('0x31'),_0x228747['name']);_0xd08ea3[_0xd75b('0x32')]=_0x228747;_0xd08ea3[_0xd75b('0x23')]=_0x401fc7;return request({'event':_0xd75b('0x33'),'message':_0xd08ea3});}else{return request({'event':_0xd75b('0x34'),'message':_0xd08ea3});}})['catch'](function(_0x5263e1){logger[_0xd75b('0x20')](_0xd75b('0x1f'),'AfterCreateMessage',_0x5263e1);});};}function afterCreateOfflineMessage(_0x28a5ed){return function(_0x5aa97b){_0x5aa97b=_0x5aa97b[_0xd75b('0x22')]({'plain':!![]});_0x5aa97b[_0xd75b('0x23')]=_0x28a5ed;_0x5aa97b[_0xd75b('0x24')]=_0x28a5ed;_0x5aa97b[_0xd75b('0x25')]=_0xd75b('0x35');return request({'event':_0x5aa97b[_0xd75b('0x25')],'message':_0x5aa97b});};}function afterCreate(_0xae8153,_0x22f71c){return function(_0x3b3055){_0x3b3055=_0x3b3055['get']({'plain':!![]});_0x3b3055[_0xd75b('0x23')]=_0xae8153;_0x3b3055[_0xd75b('0x24')]=_0xae8153;_0x3b3055[_0xd75b('0x25')]=_0xd75b('0x36');Promise['resolve']()[_0xd75b('0x1e')](function(){var _0x301213=_0xd75b('0x29')+_0x3b3055[_0xd75b('0x27')];return db[_0xd75b('0x2a')][_0xd75b('0x2b')](_0x301213,{'type':db[_0xd75b('0x2c')][_0xd75b('0x37')][_0xd75b('0x38')],'raw':!![]});})[_0xd75b('0x1e')](function(_0x5d447f){if(_0x5d447f){_0x3b3055[_0xd75b('0x2d')]=_0x5d447f[0x0];}if(typeof _0x3b3055[_0xd75b('0x2e')]===_0xd75b('0x28'))return;return getAgent(_0x3b3055[_0xd75b('0x2e')]);})[_0xd75b('0x1e')](function(_0x1ef119){if(_0x1ef119){_0x3b3055['interface']=util[_0xd75b('0x30')](_0xd75b('0x31'),_0x1ef119[_0xd75b('0x39')]);_0x3b3055[_0xd75b('0x32')]=_0x1ef119;}return request({'event':_0x22f71c,'message':_0x3b3055});})['catch'](function(_0x31939c){logger[_0xd75b('0x20')](_0xd75b('0x1f'),'AfterCreate',_0x31939c);});};}function afterUpdate(_0x393586){return function(_0x52f70b){var _0x169342=_0x52f70b['changed']('closed')&&_0x52f70b[_0xd75b('0x3a')];var _0x400c83=_0x52f70b[_0xd75b('0x3b')](_0xd75b('0x3c'));if(_0x169342||_0x400c83){var _0x56fb7a=_0x169342?_0xd75b('0xa'):_0xd75b('0x3c');var _0x3042c0=_0x52f70b[_0xd75b('0x22')]({'plain':!![]});_0x3042c0['channel']=_0x393586;_0x3042c0[_0xd75b('0x24')]=_0x393586;_0x3042c0[_0xd75b('0x25')]=_0x169342?_0xd75b('0x3a'):'substatus';var _0x3b7ae9=_0xd75b('0x29')+_0x3042c0[_0xd75b('0x27')];return db[_0xd75b('0x2a')][_0xd75b('0x2b')](_0x3b7ae9,{'type':db[_0xd75b('0x2c')][_0xd75b('0x37')][_0xd75b('0x38')],'raw':!![]})['then'](function(_0x13e4ed){if(_0x13e4ed){_0x3042c0[_0xd75b('0x2d')]=_0x13e4ed[0x0];}if(typeof _0x3042c0[_0xd75b('0x2e')]===_0xd75b('0x28'))return;return getAgent(_0x3042c0[_0xd75b('0x2e')]);})[_0xd75b('0x1e')](function(_0x2eff7d){if(_0x2eff7d){_0x3042c0[_0xd75b('0x2f')]=util['format'](_0xd75b('0x31'),_0x2eff7d['name']);_0x3042c0[_0xd75b('0x32')]=_0x2eff7d;}return request({'event':_0x56fb7a,'message':_0x3042c0});})[_0xd75b('0x21')](function(_0x19ca2f){logger[_0xd75b('0x20')](_0xd75b('0x1f'),'AfterUpdate',_0x19ca2f);});}};}function getAgent(_0x19c049){return db[_0xd75b('0x3d')][_0xd75b('0x3e')]({'where':{'id':_0x19c049},'attributes':['id',_0xd75b('0x39'),_0xd75b('0x3f'),'email',_0xd75b('0x40')],'raw':!![]})[_0xd75b('0x1e')](function(_0x3e3d47){return _0x3e3d47;});}exports[_0xd75b('0x41')]=function(){for(var _0x264f4a=0x0;_0x264f4a=_0x8e9eff[_0x0b63('0x15')]){throw Error(_0x0b63('0x16'));}_0x15df56(_0x5e80d9);})[_0x0b63('0x17')](function(_0x8b510){_0x405c96(_0x8b510);});});}; \ No newline at end of file +var _0x637a=['then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','../mysqldb','./license/util','voice','chat','whatsapp','openchannel','getChannels','toLowerCase','includes','clearBlockUser','updateAttributes','getLicense','role','agent','User','count'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x637a,0x164));var _0xa637=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x637a[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xa637('0x0'));var BPromise=require(_0xa637('0x1'));var db=require(_0xa637('0x2'))['db'];var util=require(_0xa637('0x3'));var channels=[_0xa637('0x4'),'mail',_0xa637('0x5'),'fax','sms',_0xa637('0x6'),_0xa637('0x7')];exports[_0xa637('0x8')]=function(){return channels;};exports['isValidChannel']=function(_0x3e1244){_0x3e1244=_0x3e1244[_0xa637('0x9')]();return _[_0xa637('0xa')](channels,_0x3e1244);};exports[_0xa637('0xb')]=function(_0x5b5bae,_0x4366fa,_0x13544f,_0x4d9366){var _0x325084={'loginAttempts':_0x4366fa,'blocked':_0x13544f};if(!_['isUndefined'](_0x4d9366)){_0x325084['blockedAt']=_0x4d9366;}return _0x5b5bae[_0xa637('0xc')](_0x325084);};exports[_0xa637('0xd')]=function(_0x33d355){return new BPromise(function(_0x5cdf71,_0x4fc74c){var _0x5f44a0=0x0;if(_0x33d355[_0xa637('0xe')]!==_0xa637('0xf')){_0x5cdf71(_0x33d355);}db[_0xa637('0x10')][_0xa637('0x11')]({'where':{'role':_0xa637('0xf'),'online':!![],'id':{'$ne':_0x33d355['id']}}})[_0xa637('0x12')](function(_0x453917){_0x5f44a0=_0x453917;return util['getLicense']();})[_0xa637('0x12')](function(_0x594a0b){if(_0x594a0b&&_0x594a0b[_0xa637('0x13')]&&_0x5f44a0>=_0x594a0b[_0xa637('0x13')]){throw Error(_0xa637('0x14'));}_0x5cdf71(_0x33d355);})[_0xa637('0x15')](function(_0x4a040b){_0x4fc74c(_0x4a040b);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 878a3b2..d6623b8 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0xffe3=['Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','code','details','Conflict','error','stack','status','send','exports','../config/logger','message','name','Bad\x20Request','inherits','Forbidden','Not\x20Found'];(function(_0x37f268,_0x5e9fab){var _0x4ecca0=function(_0x1c8d8b){while(--_0x1c8d8b){_0x37f268['push'](_0x37f268['shift']());}};_0x4ecca0(++_0x5e9fab);}(_0xffe3,0xd6));var _0x3ffe=function(_0x5c347f,_0x4f3912){_0x5c347f=_0x5c347f-0x0;var _0x3b72b7=_0xffe3[_0x5c347f];return _0x3b72b7;};'use strict';var util=require('util');var logger=require(_0x3ffe('0x0'))('api');var APIError=function(_0x1b1ed1,_0x44004b){this[_0x3ffe('0x1')]=_0x1b1ed1||'Internal\x20Server\x20Error';this[_0x3ffe('0x2')]=_0x44004b||'Error';util['inherits'](APIError,Error);};var APIBadRequestError=function(_0x1c0193){this['message']=_0x1c0193||_0x3ffe('0x3');this[_0x3ffe('0x2')]='Bad\x20Request';util[_0x3ffe('0x4')](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x5c351a){this['message']=_0x5c351a||'Forbidden';this[_0x3ffe('0x2')]=_0x3ffe('0x5');util[_0x3ffe('0x4')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x4a4af8){this[_0x3ffe('0x1')]=_0x4a4af8||'Entity\x20not\x20found';this[_0x3ffe('0x2')]=_0x3ffe('0x6');util[_0x3ffe('0x4')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x2a3762){this[_0x3ffe('0x1')]=_0x2a3762||_0x3ffe('0x7');this[_0x3ffe('0x2')]=_0x3ffe('0x8');this[_0x3ffe('0x9')]=0x193;this[_0x3ffe('0xa')]={'type':'OutOfInterval'};util[_0x3ffe('0x4')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x5935c2){this[_0x3ffe('0x1')]=_0x5935c2||'Resource\x20Conflict';this['name']='Conflict';util['inherits'](APIBadRequestError,APIError);};function getStatusCode(_0x11386f){switch(_0x11386f){case _0x3ffe('0x3'):return 0x190;case _0x3ffe('0x5'),_0x3ffe('0x8'):return 0x193;case _0x3ffe('0x6'):return 0x194;case _0x3ffe('0xb'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x49173b){if(_0x49173b===_0x3ffe('0x8'))return _0x49173b;return null;}function handleError(_0x4d2336){return function(_0x334c71){logger[_0x3ffe('0xc')](_0x334c71[_0x3ffe('0xd')]);var _0x589e75=getStatusCode(_0x334c71['name']);var _0x53c107=getCustomStatusMessage(_0x334c71['name']);if(_0x334c71[_0x3ffe('0x2')]){delete _0x334c71[_0x3ffe('0x2')];}if(_0x53c107){_0x4d2336['statusMessage']=_0x53c107;}return _0x4d2336[_0x3ffe('0xe')](_0x589e75)[_0x3ffe('0xf')](_0x334c71);};}module[_0x3ffe('0x10')]={'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 7f17b97..3a7c1da 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0xd8c1=['send','exports','404','status'];(function(_0x624739,_0xb543b2){var _0x3a7b98=function(_0x460be7){while(--_0x460be7){_0x624739['push'](_0x624739['shift']());}};_0x3a7b98(++_0xb543b2);}(_0xd8c1,0xc5));var _0x1d8c=function(_0x52b031,_0x118db2){_0x52b031=_0x52b031-0x0;var _0x25f706=_0xd8c1[_0x52b031];return _0x25f706;};'use strict';module[_0x1d8c('0x0')][0x194]=function pageNotFound(_0x4cfa56,_0x462dd4){var _0x108abf=_0x1d8c('0x1');var _0x359c7f=0x194;var _0x3e3aab={'status':_0x359c7f};_0x462dd4[_0x1d8c('0x2')](_0x3e3aab[_0x1d8c('0x2')]);_0x462dd4['render'](_0x108abf,{},function(_0x2b51f8,_0x3bf495){if(_0x2b51f8){return _0x462dd4['status'](_0x3e3aab[_0x1d8c('0x2')])['json'](_0x3e3aab);}_0x462dd4[_0x1d8c('0x3')](_0x3bf495);});}; \ No newline at end of file diff --git a/server/files/chat/iframe.ejs b/server/files/chat/iframe.ejs index ae77249..ae3ec99 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) { - console.warn(`Domain ${window.location.origin} can't load snippet for '{{{chatWebsiteAddressOrigin}}}'. Please check your website domain in the current XCALLY Chat Website settings.`); + window.alert(`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 deleted file mode 100644 index 026e442..0000000 --- a/server/migrations/2.6.29.js +++ /dev/null @@ -1,205 +0,0 @@ -'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 10b987a..8dc91b6 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0x7cc1=['../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperFinal/cmHopperFinal.model','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/pause/pause.model','Cdr','../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','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','Trigger','../api/trigger/trigger.model','../api/variable/variable.model','../api/integration/integration.model','IntegrationReport','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','VtigerAccount','VtigerConfiguration','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','SquareDetailsReport','../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','License','Campaign','../api/campaign/campaign.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','CmList','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','MailInteractionHasTag','../api/mailInteractionHasTag/mailInteractionHasTag.model','hasOne','VoiceMail','cascade','UserId','userSetting','hasMany','Recordings','VoiceQueuesRt','CmHopperFinal','HopperFinals','CmHopperHistory','OpenchannelInteractions','ChatInteractions','FaxInteractions','MailInteraction','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','CmHopper','SET\x20NULL','belongsTo','userProfileId','Groups','chat_group_has_users','belongsToMany','Lists','user_has_teams','user_has_chat_interactions','user_has_fax_interactions','SmsInteractions','user_has_sms_interactions','user_has_whatsapp_interactions','VoiceQueues','UserVoiceQueue','VoicePrefixes','MailQueue','ChatQueues','FaxQueue','FaxQueues','WhatsappQueues','cm_user_has_lists','ChatWebsites','user_has_chat_websites','MailAccount','MailAccounts','OpenchannelAccount','user_has_openchannel_accounts','SmsAccounts','user_has_whatsapp_accounts','SpiedAgents','VoiceContext','Applications','moh_has_sounds','Members','VoiceQueueId','HopperHistories','HopperBlacks','JscriptySessions','Trunk','TrunkId','Interval','IntervalId','Pause','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','TeamVoiceQueue','BlackLists','voice_queues_has_cm_blacklists','VoiceMailMessage','Messages','mailboxuser','mailbox','VoiceCallReport','AgentReports','uniqueid','Contact','ContactId','MailAccountId','CloudProviderId','restrict','Imap','Smtp','Dispositions','Answers','Interactions','List','ListId','TemplateId','user_has_mail_accounts','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tags','ThroughTags','user_has_mail_interactions','Interaction','ChatWebsiteId','ChatOfflineMessageId','TagId','Items','CannedAnswer','FaxAccountId','Exntensions','FaxMessage','FaxInteractionId','fax_interaction_has_tags','Users','AttachmentId','team_has_fax_queues','FaxQueueReport','SmsAccountId','SmsMessage','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','UserOpenchannelQueue','team_has_openchannel_queues','Queue','ChatQueueId','Website','chat_interaction_has_tags','ChatInteractionId','ChatOfflineMessage','Attachments','ChatGroupId','Contacts','CompanyId','CmContactId','Hoppers','Company','cm_user_has_contacts','cm_contact_has_tags','AdditionalPhones','CmHopperId','Agent','OwnerId','CampaignId','All','OneAll','Any','OneAny','Actions','ParentId','Intervals','Extensions','FaxApplications','SmsApplications','DefaultReportId','Mohs','sms_interaction_has_tags','ItemType','ItemTypeId','Hopper','AllCondition','TriggerAllId','AnyCondition','Fields','CustomReportId','MetricId','Configurations','AccountId','Subjects','Descriptions','DescriptionId','Subject','Description','Field','FieldId','Variable','VariableId','SugarcrmAccount','SugarcrmConfiguration','SubjectId','int_desk_configuration_has_tags','ZohoField','ZendeskConfiguration','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','ServicenowField','FreshsalesAccount','FromId','ToId','JscriptyQuestionReport','SessionId','JscriptyAnswerReport','ProjectId','team_has_mail_queues','MailQueues','OpenchannelQueues','team_has_whatsapp_queues','TrunkBackup','TrunkBackupId','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromAgent','ToUserId','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromAccount','FromUserId','ToAgent','ToChatQueueId','FaxTransferReport','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','HopperHistory','Queues','UserProfileSections','Resources','WhatsappAccountId','WhatsappInteractionId','whatsapp_interaction_has_tags','ToWhatsappAccountId','WhatsappQueueId','exports','../config/environment','sequelize','lodash','jstz','defaultsDeep','motion2','xcall','xC@LL1234','mysql','utf8mb4','utf8','utf8_general_ci','127.0.0.1','username','password','sequelizeHistory','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','VoiceMusicOnHold','VoiceQueue','VoiceRecording','../api/voiceRecording/voiceRecording.model','../api/screenRecording/screenRecording.model','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserChatQueue','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','../api/mailInteraction/mailInteraction.model','MailMessage','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','../api/smsMessage/smsMessage.model','SmsQueue','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup'];(function(_0x52dbb9,_0x59e414){var _0x3416ac=function(_0x569260){while(--_0x569260){_0x52dbb9['push'](_0x52dbb9['shift']());}};_0x3416ac(++_0x59e414);}(_0x7cc1,0x199));var _0x17cc=function(_0xf4db40,_0x20f182){_0xf4db40=_0xf4db40-0x0;var _0x28036c=_0x7cc1[_0xf4db40];return _0x28036c;};'use strict';var config=require(_0x17cc('0x0'));var Sequelize=require(_0x17cc('0x1'));var _=require(_0x17cc('0x2'));var jstz=require(_0x17cc('0x3'));var timezone=jstz['determine']();config[_0x17cc('0x1')]=_[_0x17cc('0x4')](config[_0x17cc('0x1')],{'database':_0x17cc('0x5'),'username':_0x17cc('0x6'),'password':_0x17cc('0x7'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x17cc('0x8'),'dialectOptions':{'charset':_0x17cc('0x9')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x17cc('0xa'),'collate':_0x17cc('0xb')}}});config['sequelizeHistory']=_['defaultsDeep'](config['sequelizeHistory'],{'database':_0x17cc('0x5'),'username':_0x17cc('0x6'),'password':_0x17cc('0x7'),'options':{'host':_0x17cc('0xc'),'port':0xcea,'dialect':_0x17cc('0x8'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x17cc('0x1')]['database'],config[_0x17cc('0x1')][_0x17cc('0xd')],config[_0x17cc('0x1')][_0x17cc('0xe')],config['sequelize']['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x17cc('0xf')]['database'],config[_0x17cc('0xf')]['username'],config['sequelizeHistory'][_0x17cc('0xe')],config[_0x17cc('0xf')]['options'])};db[_0x17cc('0x10')]=db['sequelize'][_0x17cc('0x11')](_0x17cc('0x12'));db[_0x17cc('0x13')]=db[_0x17cc('0x1')][_0x17cc('0x11')](_0x17cc('0x14'));db['VoiceContext']=db[_0x17cc('0x1')][_0x17cc('0x11')](_0x17cc('0x15'));db[_0x17cc('0x16')]=db['sequelize'][_0x17cc('0x11')]('../api/voiceExtension/voiceExtension.model');db[_0x17cc('0x17')]=db[_0x17cc('0x1')][_0x17cc('0x11')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0x17cc('0x18')]=db[_0x17cc('0x1')][_0x17cc('0x11')]('../api/voiceQueue/voiceQueue.model');db[_0x17cc('0x19')]=db[_0x17cc('0x1')]['import'](_0x17cc('0x1a'));db['ScreenRecording']=db['sequelize'][_0x17cc('0x11')](_0x17cc('0x1b'));db['VoiceMail']=db[_0x17cc('0x1')][_0x17cc('0x11')]('../api/voiceMail/voiceMail.model');db['VoiceMailMessage']=db[_0x17cc('0x1')][_0x17cc('0x11')](_0x17cc('0x1c'));db['VoiceCallReport']=db['sequelize'][_0x17cc('0x11')](_0x17cc('0x1d'));db[_0x17cc('0x1e')]=db[_0x17cc('0x1')][_0x17cc('0x11')](_0x17cc('0x1f'));db[_0x17cc('0x20')]=db[_0x17cc('0x1')][_0x17cc('0x11')](_0x17cc('0x21'));db[_0x17cc('0x22')]=db[_0x17cc('0x1')][_0x17cc('0x11')](_0x17cc('0x23'));db[_0x17cc('0x24')]=db['sequelize']['import'](_0x17cc('0x25'));db['Trunk']=db['sequelize']['import'](_0x17cc('0x26'));db['VoiceTransferReport']=db[_0x17cc('0x1')][_0x17cc('0x11')](_0x17cc('0x27'));db[_0x17cc('0x28')]=db[_0x17cc('0x1')][_0x17cc('0x11')](_0x17cc('0x29'));db['UserVoiceQueue']=db[_0x17cc('0x1')][_0x17cc('0x11')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0x17cc('0x2a')]=db[_0x17cc('0x1')][_0x17cc('0x11')]('../api/userChatQueue/userChatQueue.model');db[_0x17cc('0x2b')]=db[_0x17cc('0x1')][_0x17cc('0x11')](_0x17cc('0x2c'));db[_0x17cc('0x2d')]=db['sequelize'][_0x17cc('0x11')]('../api/userFaxQueue/userFaxQueue.model');db[_0x17cc('0x2e')]=db[_0x17cc('0x1')][_0x17cc('0x11')](_0x17cc('0x2f'));db['UserOpenchannelQueue']=db['sequelize'][_0x17cc('0x11')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0x17cc('0x30')]=db['sequelize'][_0x17cc('0x11')](_0x17cc('0x31'));db[_0x17cc('0x32')]=db['sequelize']['import'](_0x17cc('0x33'));db[_0x17cc('0x34')]=db[_0x17cc('0x1')]['import'](_0x17cc('0x35'));db['MailAccount']=db[_0x17cc('0x1')][_0x17cc('0x11')](_0x17cc('0x36'));db['MailQueue']=db[_0x17cc('0x1')][_0x17cc('0x11')](_0x17cc('0x37'));db[_0x17cc('0x38')]=db[_0x17cc('0x1')][_0x17cc('0x11')](_0x17cc('0x39'));db['MailInteraction']=db[_0x17cc('0x1')][_0x17cc('0x11')](_0x17cc('0x3a'));db[_0x17cc('0x3b')]=db['sequelize'][_0x17cc('0x11')]('../api/mailMessage/mailMessage.model');db[_0x17cc('0x3c')]=db[_0x17cc('0x1')][_0x17cc('0x11')](_0x17cc('0x3d'));db[_0x17cc('0x3e')]=db[_0x17cc('0x1')][_0x17cc('0x11')](_0x17cc('0x3f'));db[_0x17cc('0x40')]=db[_0x17cc('0x1')]['import'](_0x17cc('0x41'));db[_0x17cc('0x42')]=db['sequelize']['import'](_0x17cc('0x43'));db[_0x17cc('0x44')]=db[_0x17cc('0x1')]['import'](_0x17cc('0x45'));db[_0x17cc('0x46')]=db[_0x17cc('0x1')]['import'](_0x17cc('0x47'));db[_0x17cc('0x48')]=db[_0x17cc('0x1')][_0x17cc('0x11')](_0x17cc('0x49'));db['FaxMessage']=db[_0x17cc('0x1')][_0x17cc('0x11')]('../api/faxMessage/faxMessage.model');db['FaxQueue']=db[_0x17cc('0x1')][_0x17cc('0x11')]('../api/faxQueue/faxQueue.model');db['FaxQueueReport']=db['sequelize'][_0x17cc('0x11')](_0x17cc('0x4a'));db[_0x17cc('0x4b')]=db[_0x17cc('0x1')][_0x17cc('0x11')](_0x17cc('0x4c'));db[_0x17cc('0x4d')]=db[_0x17cc('0x1')]['import']('../api/smsApplication/smsApplication.model');db[_0x17cc('0x4e')]=db['sequelize'][_0x17cc('0x11')](_0x17cc('0x4f'));db['SmsMessage']=db[_0x17cc('0x1')]['import'](_0x17cc('0x50'));db[_0x17cc('0x51')]=db[_0x17cc('0x1')][_0x17cc('0x11')]('../api/smsQueue/smsQueue.model');db['OpenchannelAccount']=db[_0x17cc('0x1')]['import'](_0x17cc('0x52'));db[_0x17cc('0x53')]=db[_0x17cc('0x1')][_0x17cc('0x11')](_0x17cc('0x54'));db[_0x17cc('0x55')]=db[_0x17cc('0x1')][_0x17cc('0x11')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x17cc('0x56')]=db[_0x17cc('0x1')]['import'](_0x17cc('0x57'));db[_0x17cc('0x58')]=db[_0x17cc('0x1')]['import']('../api/openchannelQueue/openchannelQueue.model');db[_0x17cc('0x59')]=db[_0x17cc('0x1')][_0x17cc('0x11')](_0x17cc('0x5a'));db[_0x17cc('0x5b')]=db['sequelize']['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x17cc('0x5c')]=db[_0x17cc('0x1')][_0x17cc('0x11')](_0x17cc('0x5d'));db[_0x17cc('0x5e')]=db[_0x17cc('0x1')][_0x17cc('0x11')](_0x17cc('0x5f'));db[_0x17cc('0x60')]=db[_0x17cc('0x1')][_0x17cc('0x11')](_0x17cc('0x61'));db['ChatOfflineMessage']=db[_0x17cc('0x1')][_0x17cc('0x11')](_0x17cc('0x62'));db[_0x17cc('0x63')]=db['sequelize']['import'](_0x17cc('0x64'));db[_0x17cc('0x65')]=db['sequelize']['import'](_0x17cc('0x66'));db[_0x17cc('0x67')]=db[_0x17cc('0x1')][_0x17cc('0x11')](_0x17cc('0x68'));db[_0x17cc('0x69')]=db[_0x17cc('0x1')][_0x17cc('0x11')](_0x17cc('0x6a'));db[_0x17cc('0x6b')]=db['sequelize'][_0x17cc('0x11')](_0x17cc('0x6c'));db['CmHopper']=db[_0x17cc('0x1')][_0x17cc('0x11')](_0x17cc('0x6d'));db[_0x17cc('0x6e')]=db['sequelize'][_0x17cc('0x11')](_0x17cc('0x6f'));db['CmHopperFinal']=db[_0x17cc('0x1')][_0x17cc('0x11')](_0x17cc('0x70'));db['CmHopperHistory']=db[_0x17cc('0x1')]['import'](_0x17cc('0x71'));db[_0x17cc('0x72')]=db[_0x17cc('0x1')]['import'](_0x17cc('0x73'));db[_0x17cc('0x74')]=db[_0x17cc('0x1')][_0x17cc('0x11')](_0x17cc('0x75'));db[_0x17cc('0x76')]=db[_0x17cc('0x1')]['import']('../api/action/action.model');db[_0x17cc('0x77')]=db[_0x17cc('0x1')]['import'](_0x17cc('0x78'));db['CannedAnswer']=db['sequelize'][_0x17cc('0x11')](_0x17cc('0x79'));db[_0x17cc('0x7a')]=db[_0x17cc('0x1')][_0x17cc('0x11')](_0x17cc('0x7b'));db[_0x17cc('0x7c')]=db[_0x17cc('0x1')][_0x17cc('0x11')](_0x17cc('0x7d'));db['Interval']=db[_0x17cc('0x1')][_0x17cc('0x11')]('../api/interval/interval.model');db['Pause']=db[_0x17cc('0x1')]['import'](_0x17cc('0x7e'));db[_0x17cc('0x7f')]=db[_0x17cc('0x1')]['import'](_0x17cc('0x80'));db[_0x17cc('0x81')]=db[_0x17cc('0x1')]['import'](_0x17cc('0x82'));db[_0x17cc('0x83')]=db[_0x17cc('0x1')]['import'](_0x17cc('0x84'));db[_0x17cc('0x85')]=db['sequelize'][_0x17cc('0x11')](_0x17cc('0x86'));db[_0x17cc('0x87')]=db[_0x17cc('0x1')][_0x17cc('0x11')](_0x17cc('0x88'));db[_0x17cc('0x89')]=db[_0x17cc('0x1')][_0x17cc('0x11')]('../api/contactItemType/contactItemType.model');db[_0x17cc('0x8a')]=db[_0x17cc('0x1')]['import'](_0x17cc('0x8b'));db[_0x17cc('0x8c')]=db['sequelize']['import'](_0x17cc('0x8d'));db[_0x17cc('0x8e')]=db[_0x17cc('0x1')][_0x17cc('0x11')]('../api/template/template.model');db[_0x17cc('0x8f')]=db['sequelize'][_0x17cc('0x11')](_0x17cc('0x90'));db['Variable']=db[_0x17cc('0x1')][_0x17cc('0x11')](_0x17cc('0x91'));db['Integration']=db['sequelize'][_0x17cc('0x11')](_0x17cc('0x92'));db[_0x17cc('0x93')]=db[_0x17cc('0x1')][_0x17cc('0x11')]('../api/integrationReport/integrationReport.model');db[_0x17cc('0x94')]=db[_0x17cc('0x1')][_0x17cc('0x11')](_0x17cc('0x95'));db[_0x17cc('0x96')]=db['sequelize'][_0x17cc('0x11')](_0x17cc('0x97'));db[_0x17cc('0x98')]=db[_0x17cc('0x1')]['import'](_0x17cc('0x99'));db[_0x17cc('0x9a')]=db[_0x17cc('0x1')][_0x17cc('0x11')](_0x17cc('0x9b'));db[_0x17cc('0x9c')]=db[_0x17cc('0x1')][_0x17cc('0x11')](_0x17cc('0x9d'));db['AnalyticTreeReport']=db[_0x17cc('0x1')][_0x17cc('0x11')](_0x17cc('0x9e'));db[_0x17cc('0x9f')]=db[_0x17cc('0x1')][_0x17cc('0x11')](_0x17cc('0xa0'));db[_0x17cc('0xa1')]=db[_0x17cc('0x1')]['import'](_0x17cc('0xa2'));db[_0x17cc('0xa3')]=db[_0x17cc('0x1')][_0x17cc('0x11')]('../api/intSalesforceField/intSalesforceField.model');db['SugarcrmAccount']=db[_0x17cc('0x1')][_0x17cc('0x11')](_0x17cc('0xa4'));db['SugarcrmConfiguration']=db[_0x17cc('0x1')][_0x17cc('0x11')](_0x17cc('0xa5'));db[_0x17cc('0xa6')]=db[_0x17cc('0x1')]['import'](_0x17cc('0xa7'));db[_0x17cc('0xa8')]=db['sequelize'][_0x17cc('0x11')](_0x17cc('0xa9'));db[_0x17cc('0xaa')]=db['sequelize'][_0x17cc('0x11')](_0x17cc('0xab'));db[_0x17cc('0xac')]=db[_0x17cc('0x1')][_0x17cc('0x11')]('../api/intDeskField/intDeskField.model');db[_0x17cc('0xad')]=db[_0x17cc('0x1')][_0x17cc('0x11')](_0x17cc('0xae'));db[_0x17cc('0xaf')]=db[_0x17cc('0x1')][_0x17cc('0x11')](_0x17cc('0xb0'));db['ZohoField']=db[_0x17cc('0x1')]['import']('../api/intZohoField/intZohoField.model');db[_0x17cc('0xb1')]=db[_0x17cc('0x1')][_0x17cc('0x11')](_0x17cc('0xb2'));db['ZendeskConfiguration']=db[_0x17cc('0x1')][_0x17cc('0x11')](_0x17cc('0xb3'));db[_0x17cc('0xb4')]=db[_0x17cc('0x1')][_0x17cc('0x11')](_0x17cc('0xb5'));db[_0x17cc('0xb6')]=db[_0x17cc('0x1')]['import'](_0x17cc('0xb7'));db[_0x17cc('0xb8')]=db[_0x17cc('0x1')][_0x17cc('0x11')](_0x17cc('0xb9'));db[_0x17cc('0xba')]=db['sequelize'][_0x17cc('0x11')]('../api/intFreshdeskField/intFreshdeskField.model');db[_0x17cc('0xbb')]=db[_0x17cc('0x1')]['import']('../api/intVtigerAccount/intVtigerAccount.model');db[_0x17cc('0xbc')]=db[_0x17cc('0x1')][_0x17cc('0x11')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x17cc('0xbd')]=db[_0x17cc('0x1')][_0x17cc('0x11')](_0x17cc('0xbe'));db[_0x17cc('0xbf')]=db[_0x17cc('0x1')][_0x17cc('0x11')](_0x17cc('0xc0'));db[_0x17cc('0xc1')]=db[_0x17cc('0x1')][_0x17cc('0x11')](_0x17cc('0xc2'));db['ServicenowField']=db[_0x17cc('0x1')]['import'](_0x17cc('0xc3'));db[_0x17cc('0xc4')]=db['sequelize'][_0x17cc('0x11')](_0x17cc('0xc5'));db[_0x17cc('0xc6')]=db[_0x17cc('0x1')][_0x17cc('0x11')](_0x17cc('0xc7'));db[_0x17cc('0xc8')]=db[_0x17cc('0x1')][_0x17cc('0x11')]('../api/intDynamics365Field/intDynamics365Field.model');db['FreshsalesAccount']=db['sequelize'][_0x17cc('0x11')](_0x17cc('0xc9'));db[_0x17cc('0xca')]=db[_0x17cc('0x1')][_0x17cc('0x11')](_0x17cc('0xcb'));db[_0x17cc('0xcc')]=db[_0x17cc('0x1')][_0x17cc('0x11')](_0x17cc('0xcd'));db['Integration']=db[_0x17cc('0x1')][_0x17cc('0x11')]('../api/integration/integration.model');db[_0x17cc('0xce')]=db[_0x17cc('0x1')][_0x17cc('0x11')]('../api/network/network.model');db[_0x17cc('0xcf')]=db['sequelize']['import'](_0x17cc('0xd0'));db[_0x17cc('0xd1')]=db[_0x17cc('0x1')][_0x17cc('0x11')]('../api/chatInternalMessage/chatInternalMessage.model');db['JscriptyAnswerReport']=db[_0x17cc('0x1')][_0x17cc('0x11')](_0x17cc('0xd2'));db['JscriptyQuestionReport']=db[_0x17cc('0x1')][_0x17cc('0x11')](_0x17cc('0xd3'));db[_0x17cc('0xd4')]=db['sequelize'][_0x17cc('0x11')](_0x17cc('0xd5'));db[_0x17cc('0xd6')]=db['sequelize'][_0x17cc('0x11')](_0x17cc('0xd7'));db[_0x17cc('0xd8')]=db[_0x17cc('0x1')][_0x17cc('0x11')]('../api/squareReport/squareReport.model');db[_0x17cc('0xd9')]=db[_0x17cc('0x1')]['import'](_0x17cc('0xda'));db[_0x17cc('0xdb')]=db['sequelize'][_0x17cc('0x11')](_0x17cc('0xdc'));db[_0x17cc('0xdd')]=db[_0x17cc('0x1')][_0x17cc('0x11')](_0x17cc('0xde'));db[_0x17cc('0xdf')]=db['sequelize'][_0x17cc('0x11')](_0x17cc('0xe0'));db[_0x17cc('0xe1')]=db[_0x17cc('0x1')]['import'](_0x17cc('0xe2'));db[_0x17cc('0xe3')]=db[_0x17cc('0x1')][_0x17cc('0x11')]('../api/squareRecording/squareRecording.model');db[_0x17cc('0xe4')]=db[_0x17cc('0x1')][_0x17cc('0x11')](_0x17cc('0xe5'));db[_0x17cc('0xe6')]=db['sequelize'][_0x17cc('0x11')]('../api/team/team.model');db[_0x17cc('0xe7')]=db[_0x17cc('0x1')][_0x17cc('0x11')]('../api/license/license.model');db[_0x17cc('0xe8')]=db[_0x17cc('0x1')][_0x17cc('0x11')](_0x17cc('0xe9'));db['Migration']=db[_0x17cc('0x1')][_0x17cc('0x11')]('../api/migration/migration.model');db[_0x17cc('0xea')]=db['sequelize'][_0x17cc('0x11')](_0x17cc('0xeb'));db[_0x17cc('0xec')]=db['sequelize']['import'](_0x17cc('0xed'));db['MailTransferReport']=db['sequelize']['import'](_0x17cc('0xee'));db[_0x17cc('0xef')]=db[_0x17cc('0x1')][_0x17cc('0x11')]('../api/chatTransferReport/chatTransferReport.model');db['FaxTransferReport']=db[_0x17cc('0x1')][_0x17cc('0x11')](_0x17cc('0xf0'));db[_0x17cc('0xf1')]=db[_0x17cc('0x1')]['import'](_0x17cc('0xf2'));db[_0x17cc('0xf3')]=db[_0x17cc('0x1')]['import']('../api/smsTransferReport/smsTransferReport.model');db[_0x17cc('0xf4')]=db['sequelize'][_0x17cc('0x11')]('../api/cmList/cmList.model');db[_0x17cc('0xf5')]=db[_0x17cc('0x1')]['import'](_0x17cc('0xf6'));db[_0x17cc('0xf7')]=db['sequelize']['import']('../api/userProfile/userProfile.model');db[_0x17cc('0xf8')]=db[_0x17cc('0x1')][_0x17cc('0x11')](_0x17cc('0xf9'));db[_0x17cc('0xfa')]=db[_0x17cc('0x1')][_0x17cc('0x11')](_0x17cc('0xfb'));db['UserNotification']=db[_0x17cc('0x1')][_0x17cc('0x11')](_0x17cc('0xfc'));db[_0x17cc('0xfd')]=db[_0x17cc('0x1')][_0x17cc('0x11')](_0x17cc('0xfe'));db[_0x17cc('0xff')]=db['sequelize'][_0x17cc('0x11')]('../api/whatsappApplication/whatsappApplication.model');db[_0x17cc('0x100')]=db['sequelize'][_0x17cc('0x11')](_0x17cc('0x101'));db[_0x17cc('0x102')]=db[_0x17cc('0x1')][_0x17cc('0x11')](_0x17cc('0x103'));db[_0x17cc('0x104')]=db[_0x17cc('0x1')]['import'](_0x17cc('0x105'));db[_0x17cc('0x106')]=db[_0x17cc('0x1')][_0x17cc('0x11')](_0x17cc('0x107'));db[_0x17cc('0x108')]=db['sequelize']['import'](_0x17cc('0x109'));db[_0x17cc('0x10a')]=db[_0x17cc('0x1')]['import'](_0x17cc('0x10b'));db['TeamVoiceQueue']=db[_0x17cc('0x1')][_0x17cc('0x11')](_0x17cc('0x10c'));db[_0x17cc('0x10d')]=db[_0x17cc('0x1')]['import'](_0x17cc('0x10e'));db[_0x17cc('0x10f')]=db[_0x17cc('0x1')][_0x17cc('0x11')](_0x17cc('0x110'));db[_0x17cc('0x111')]=db[_0x17cc('0x1')]['import'](_0x17cc('0x112'));db[_0x17cc('0x113')]=db[_0x17cc('0x1')][_0x17cc('0x11')](_0x17cc('0x114'));db['User'][_0x17cc('0x115')](db[_0x17cc('0x116')],{'as':'VoiceMail','onDelete':_0x17cc('0x117'),'foreignKey':_0x17cc('0x118')});db['User'][_0x17cc('0x115')](db[_0x17cc('0x111')],{'as':_0x17cc('0x119'),'onDelete':_0x17cc('0x117'),'foreignKey':_0x17cc('0x118')});db[_0x17cc('0x10')][_0x17cc('0x11a')](db[_0x17cc('0x19')],{'as':_0x17cc('0x11b'),'foreignKey':'UserId'});db['User'][_0x17cc('0x11a')](db[_0x17cc('0x28')],{'as':_0x17cc('0x11c'),'foreignKey':'UserId'});db[_0x17cc('0x10')]['hasMany'](db[_0x17cc('0x16')],{'as':'Extensions','onDelete':_0x17cc('0x117'),'hooks':!![]});db[_0x17cc('0x10')][_0x17cc('0x11a')](db[_0x17cc('0x11d')],{'as':_0x17cc('0x11e'),'foreignKey':_0x17cc('0x118')});db[_0x17cc('0x10')][_0x17cc('0x11a')](db[_0x17cc('0x11f')],{'as':'HopperHistory','foreignKey':_0x17cc('0x118')});db[_0x17cc('0x10')][_0x17cc('0x11a')](db[_0x17cc('0x72')],{'as':_0x17cc('0x72'),'foreignKey':_0x17cc('0x118')});db[_0x17cc('0x10')][_0x17cc('0x11a')](db[_0x17cc('0x55')],{'as':_0x17cc('0x120'),'foreignKey':'UserId'});db['User'][_0x17cc('0x11a')](db[_0x17cc('0x5e')],{'as':_0x17cc('0x121'),'foreignKey':_0x17cc('0x118')});db[_0x17cc('0x10')][_0x17cc('0x11a')](db[_0x17cc('0x4e')],{'as':'SmsInteractions','foreignKey':_0x17cc('0x118')});db[_0x17cc('0x10')]['hasMany'](db[_0x17cc('0x48')],{'as':_0x17cc('0x122'),'foreignKey':_0x17cc('0x118')});db[_0x17cc('0x10')]['hasMany'](db[_0x17cc('0x123')],{'as':_0x17cc('0x124'),'foreignKey':_0x17cc('0x118')});db[_0x17cc('0x10')][_0x17cc('0x11a')](db[_0x17cc('0x100')],{'as':_0x17cc('0x125'),'foreignKey':_0x17cc('0x118')});db['User']['hasMany'](db['UserNotification'],{'as':_0x17cc('0x126'),'foreignKey':_0x17cc('0x127')});db[_0x17cc('0x10')][_0x17cc('0x11a')](db[_0x17cc('0x128')],{'as':'Hoppers','foreignKey':_0x17cc('0x118'),'onDelete':_0x17cc('0x129')});db['User'][_0x17cc('0x12a')](db[_0x17cc('0xf7')],{'as':_0x17cc('0xf7'),'foreignKey':_0x17cc('0x12b')});db[_0x17cc('0x10')]['belongsToMany'](db[_0x17cc('0x65')],{'as':_0x17cc('0x12c'),'through':_0x17cc('0x12d')});db[_0x17cc('0x10')][_0x17cc('0x12e')](db[_0x17cc('0x6b')],{'as':'Contacts','through':'cm_user_has_contacts'});db[_0x17cc('0x10')][_0x17cc('0x12e')](db['CmList'],{'as':_0x17cc('0x12f'),'through':'cm_user_has_lists'});db['User'][_0x17cc('0x12e')](db[_0x17cc('0xe6')],{'through':_0x17cc('0x130')});db['User']['belongsToMany'](db[_0x17cc('0x123')],{'as':_0x17cc('0x124'),'through':'user_has_mail_interactions'});db[_0x17cc('0x10')][_0x17cc('0x12e')](db[_0x17cc('0x5e')],{'as':_0x17cc('0x121'),'through':_0x17cc('0x131')});db[_0x17cc('0x10')][_0x17cc('0x12e')](db['FaxInteraction'],{'as':_0x17cc('0x122'),'through':_0x17cc('0x132')});db[_0x17cc('0x10')]['belongsToMany'](db[_0x17cc('0x4e')],{'as':_0x17cc('0x133'),'through':_0x17cc('0x134')});db[_0x17cc('0x10')][_0x17cc('0x12e')](db[_0x17cc('0x55')],{'as':_0x17cc('0x120'),'through':'user_has_openchannel_interactions'});db[_0x17cc('0x10')][_0x17cc('0x12e')](db[_0x17cc('0x100')],{'as':_0x17cc('0x125'),'through':_0x17cc('0x135')});db[_0x17cc('0x10')][_0x17cc('0x12e')](db[_0x17cc('0x18')],{'as':_0x17cc('0x136'),'through':_0x17cc('0x137'),'required':![]});db[_0x17cc('0x10')][_0x17cc('0x12e')](db[_0x17cc('0xf5')],{'as':_0x17cc('0x138'),'through':_0x17cc('0x10f'),'required':![]});db[_0x17cc('0x10')][_0x17cc('0x12e')](db[_0x17cc('0x139')],{'as':'MailQueues','through':_0x17cc('0x2b'),'required':![]});db[_0x17cc('0x10')]['belongsToMany'](db[_0x17cc('0x63')],{'as':_0x17cc('0x13a'),'through':'UserChatQueue','required':![],'hooks':!![]});db[_0x17cc('0x10')][_0x17cc('0x12e')](db[_0x17cc('0x13b')],{'as':_0x17cc('0x13c'),'through':'UserFaxQueue','required':![]});db[_0x17cc('0x10')][_0x17cc('0x12e')](db[_0x17cc('0x51')],{'as':'SmsQueues','through':_0x17cc('0x2e'),'required':![]});db['User']['belongsToMany'](db[_0x17cc('0x58')],{'as':'OpenchannelQueues','through':'UserOpenchannelQueue','required':![]});db[_0x17cc('0x10')][_0x17cc('0x12e')](db['WhatsappQueue'],{'as':_0x17cc('0x13d'),'through':_0x17cc('0x30'),'required':![]});db[_0x17cc('0x10')]['belongsToMany'](db['CmList'],{'through':_0x17cc('0x13e')});db[_0x17cc('0x10')]['belongsToMany'](db[_0x17cc('0x59')],{'as':_0x17cc('0x13f'),'through':_0x17cc('0x140')});db['User'][_0x17cc('0x12e')](db[_0x17cc('0x44')],{'as':'FaxAccounts','through':'user_has_fax_accounts'});db['User']['belongsToMany'](db[_0x17cc('0x141')],{'as':_0x17cc('0x142'),'through':'user_has_mail_accounts'});db[_0x17cc('0x10')][_0x17cc('0x12e')](db[_0x17cc('0x143')],{'as':'OpenchannelAccounts','through':_0x17cc('0x144')});db[_0x17cc('0x10')]['belongsToMany'](db[_0x17cc('0x4b')],{'as':_0x17cc('0x145'),'through':'user_has_sms_accounts'});db['User']['belongsToMany'](db[_0x17cc('0xfd')],{'as':'WhatsappAccounts','through':_0x17cc('0x146')});db[_0x17cc('0x13')]['hasMany'](db[_0x17cc('0x16')],{'as':_0x17cc('0x147'),'onDelete':_0x17cc('0x117'),'foreignKey':'ChanSpyId'});db[_0x17cc('0x148')][_0x17cc('0x11a')](db[_0x17cc('0x16')],{'onDelete':'cascade'});db[_0x17cc('0x16')][_0x17cc('0x11a')](db[_0x17cc('0x16')],{'as':_0x17cc('0x149'),'onDelete':_0x17cc('0x117')});db[_0x17cc('0x17')][_0x17cc('0x12e')](db[_0x17cc('0x85')],{'as':'Sounds','through':_0x17cc('0x14a')});db[_0x17cc('0x18')][_0x17cc('0x11a')](db[_0x17cc('0x28')],{'as':_0x17cc('0x14b'),'foreignKey':'VoiceQueueId'});db[_0x17cc('0x18')]['hasMany'](db[_0x17cc('0x128')],{'as':'Hoppers','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x17cc('0x11a')](db['CmHopperFinal'],{'as':_0x17cc('0x11e'),'foreignKey':_0x17cc('0x14c')});db[_0x17cc('0x18')][_0x17cc('0x11a')](db[_0x17cc('0x11f')],{'as':_0x17cc('0x14d'),'foreignKey':_0x17cc('0x14c')});db[_0x17cc('0x18')][_0x17cc('0x11a')](db[_0x17cc('0x72')],{'as':'ReportAgentPreview','foreignKey':_0x17cc('0x14c')});db[_0x17cc('0x18')][_0x17cc('0x11a')](db[_0x17cc('0x6e')],{'as':_0x17cc('0x14e'),'foreignKey':'VoiceQueueId'});db[_0x17cc('0x18')][_0x17cc('0x11a')](db['JscriptySessionReport'],{'as':_0x17cc('0x14f'),'foreignKey':_0x17cc('0x14c')});db[_0x17cc('0x18')]['belongsTo'](db[_0x17cc('0x150')],{'as':'Trunk','foreignKey':_0x17cc('0x151')});db[_0x17cc('0x18')]['belongsTo'](db[_0x17cc('0x150')],{'as':'TrunkBackup','foreignKey':'TrunkBackupId'});db['VoiceQueue'][_0x17cc('0x12a')](db['Interval'],{'as':_0x17cc('0x152'),'foreignKey':_0x17cc('0x153')});db[_0x17cc('0x18')][_0x17cc('0x12a')](db[_0x17cc('0x154')],{'as':_0x17cc('0x155'),'foreignKey':_0x17cc('0x156')});db['VoiceQueue'][_0x17cc('0x12e')](db[_0x17cc('0xf4')],{'as':'Lists','through':_0x17cc('0x157')});db[_0x17cc('0x18')][_0x17cc('0x12e')](db[_0x17cc('0x10')],{'as':_0x17cc('0x158'),'through':_0x17cc('0x137')});db['VoiceQueue'][_0x17cc('0x12e')](db[_0x17cc('0xe6')],{'as':_0x17cc('0x159'),'through':_0x17cc('0x15a')});db[_0x17cc('0x18')][_0x17cc('0x12e')](db[_0x17cc('0xf4')],{'as':_0x17cc('0x15b'),'through':_0x17cc('0x15c')});db[_0x17cc('0x19')][_0x17cc('0x12a')](db[_0x17cc('0x10')],{'as':'User','foreignKey':_0x17cc('0x118')});db['ScreenRecording'][_0x17cc('0x12a')](db[_0x17cc('0x10')],{'as':_0x17cc('0x10'),'foreignKey':_0x17cc('0x118')});db['VoiceMail'][_0x17cc('0x11a')](db[_0x17cc('0x15d')],{'as':_0x17cc('0x15e'),'onDelete':_0x17cc('0x117'),'foreignKey':_0x17cc('0x15f'),'sourceKey':_0x17cc('0x160')});db[_0x17cc('0x15d')]['belongsTo'](db[_0x17cc('0x116')],{'foreignKey':'mailboxuser','targetKey':_0x17cc('0x160')});db[_0x17cc('0x161')][_0x17cc('0x11a')](db[_0x17cc('0x22')],{'as':'QueueCalls','foreignKey':'uniqueid','constraints':![]});db[_0x17cc('0x161')][_0x17cc('0x11a')](db[_0x17cc('0x20')],{'as':_0x17cc('0x162'),'foreignKey':_0x17cc('0x163'),'constraints':![]});db[_0x17cc('0x161')][_0x17cc('0x12a')](db['User'],{'as':_0x17cc('0x10'),'foreignKey':_0x17cc('0x118')});db['VoiceCallReport'][_0x17cc('0x12a')](db[_0x17cc('0x6b')],{'as':_0x17cc('0x164'),'foreignKey':_0x17cc('0x165')});db[_0x17cc('0x32')][_0x17cc('0x12a')](db[_0x17cc('0x141')],{'as':_0x17cc('0x141'),'foreignKey':_0x17cc('0x166')});db['MailServerIn']['belongsTo'](db[_0x17cc('0x10a')],{'as':'CloudProvider','foreignKey':_0x17cc('0x167'),'onDelete':_0x17cc('0x168')});db[_0x17cc('0x34')][_0x17cc('0x12a')](db[_0x17cc('0x141')],{'as':_0x17cc('0x141'),'foreignKey':_0x17cc('0x166')});db[_0x17cc('0x34')][_0x17cc('0x12a')](db[_0x17cc('0x10a')],{'as':_0x17cc('0x10a'),'foreignKey':_0x17cc('0x167'),'onDelete':_0x17cc('0x168')});db[_0x17cc('0x141')]['hasOne'](db[_0x17cc('0x32')],{'as':_0x17cc('0x169'),'onDelete':_0x17cc('0x117')});db[_0x17cc('0x141')][_0x17cc('0x115')](db['MailServerOut'],{'as':_0x17cc('0x16a'),'onDelete':_0x17cc('0x117')});db[_0x17cc('0x141')]['hasMany'](db[_0x17cc('0x7a')],{'as':_0x17cc('0x16b'),'foreignKey':_0x17cc('0x166'),'onDelete':_0x17cc('0x117')});db[_0x17cc('0x141')]['hasMany'](db['CannedAnswer'],{'as':_0x17cc('0x16c'),'foreignKey':'MailAccountId'});db[_0x17cc('0x141')][_0x17cc('0x11a')](db[_0x17cc('0x3b')],{'as':_0x17cc('0x15e'),'foreignKey':_0x17cc('0x166')});db[_0x17cc('0x141')][_0x17cc('0x11a')](db[_0x17cc('0x123')],{'as':_0x17cc('0x16d')});db[_0x17cc('0x141')][_0x17cc('0x11a')](db[_0x17cc('0x3c')],{'as':_0x17cc('0x149'),'foreignKey':_0x17cc('0x166'),'onDelete':_0x17cc('0x117')});db[_0x17cc('0x141')][_0x17cc('0x12a')](db[_0x17cc('0xf4')],{'as':_0x17cc('0x16e'),'foreignKey':_0x17cc('0x16f')});db[_0x17cc('0x141')][_0x17cc('0x12a')](db['Template'],{'as':'Template','foreignKey':_0x17cc('0x170')});db['MailAccount'][_0x17cc('0x12a')](db[_0x17cc('0x154')],{'as':'mandatoryDispositionPause','foreignKey':_0x17cc('0x156')});db[_0x17cc('0x141')][_0x17cc('0x12e')](db['User'],{'as':_0x17cc('0x158'),'through':_0x17cc('0x171')});db[_0x17cc('0x139')][_0x17cc('0x12e')](db[_0x17cc('0x10')],{'as':_0x17cc('0x158'),'through':'UserMailQueue'});db['MailQueue'][_0x17cc('0x12e')](db[_0x17cc('0xe6')],{'through':'team_has_mail_queues','as':'Teams'});db['MailInteraction'][_0x17cc('0x11a')](db['MailMessage'],{'as':_0x17cc('0x15e'),'onDelete':_0x17cc('0x117'),'foreignKey':_0x17cc('0x172')});db[_0x17cc('0x123')][_0x17cc('0x12a')](db['MailAccount'],{'as':_0x17cc('0x173'),'foreignKey':_0x17cc('0x166')});db[_0x17cc('0x123')][_0x17cc('0x12a')](db['CmContact'],{'as':_0x17cc('0x164'),'foreignKey':'ContactId'});db[_0x17cc('0x123')][_0x17cc('0x12a')](db[_0x17cc('0x10')],{'as':_0x17cc('0x174'),'foreignKey':_0x17cc('0x118')});db[_0x17cc('0x123')][_0x17cc('0x12e')](db[_0x17cc('0x87')],{'through':_0x17cc('0x175'),'as':_0x17cc('0x176')});db['MailInteraction'][_0x17cc('0x12e')](db[_0x17cc('0x87')],{'through':_0x17cc('0x175'),'as':_0x17cc('0x177')});db[_0x17cc('0x123')][_0x17cc('0x12e')](db[_0x17cc('0x10')],{'as':'Users','through':_0x17cc('0x178'),'foreignKey':_0x17cc('0x172')});db[_0x17cc('0x3b')]['hasMany'](db[_0x17cc('0xea')],{'as':'Attachments','onDelete':_0x17cc('0x117')});db['MailMessage'][_0x17cc('0x12a')](db[_0x17cc('0x10')],{'as':_0x17cc('0x10')});db[_0x17cc('0x3b')]['belongsTo'](db[_0x17cc('0x6b')],{'onDelete':_0x17cc('0x117'),'as':_0x17cc('0x164')});db['MailMessage']['belongsTo'](db['MailInteraction'],{'as':_0x17cc('0x179'),'foreignKey':_0x17cc('0x172')});db[_0x17cc('0x3b')]['belongsTo'](db['MailAccount'],{'as':_0x17cc('0x173'),'foreignKey':_0x17cc('0x166')});db[_0x17cc('0x3b')][_0x17cc('0x12a')](db[_0x17cc('0x59')],{'as':_0x17cc('0x59'),'foreignKey':_0x17cc('0x17a')});db[_0x17cc('0x3b')][_0x17cc('0x12a')](db['ChatOfflineMessage'],{'as':'ChatOfflineMessage','foreignKey':_0x17cc('0x17b')});db[_0x17cc('0x3c')]['belongsTo'](db[_0x17cc('0x10')],{'onDelete':_0x17cc('0x168')});db[_0x17cc('0x3c')][_0x17cc('0x12a')](db[_0x17cc('0x139')],{'onDelete':_0x17cc('0x168')});db['MailApplication']['belongsTo'](db['MailAccount'],{'onDelete':_0x17cc('0x168')});db[_0x17cc('0x3c')][_0x17cc('0x12a')](db['Interval'],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0x17cc('0x3c')][_0x17cc('0x12a')](db['Tag'],{'onDelete':_0x17cc('0x168'),'foreignKey':_0x17cc('0x17c')});db['MailQueueReport'][_0x17cc('0x12a')](db['MailAccount'],{});db[_0x17cc('0x3e')][_0x17cc('0x12a')](db[_0x17cc('0xf4')],{'as':_0x17cc('0x16e'),'foreignKey':'ListId'});db['MailQueueReport']['belongsTo'](db[_0x17cc('0x6b')],{'as':_0x17cc('0x164'),'foreignKey':_0x17cc('0x165')});db[_0x17cc('0x3e')]['belongsTo'](db[_0x17cc('0x123')],{});db[_0x17cc('0x3e')][_0x17cc('0x12a')](db['MailMessage'],{});db[_0x17cc('0x3e')][_0x17cc('0x12a')](db[_0x17cc('0x10')],{});db['MailQueueReport'][_0x17cc('0x12a')](db['MailQueue'],{});db[_0x17cc('0x40')][_0x17cc('0x11a')](db[_0x17cc('0x42')],{'as':_0x17cc('0x17d'),'onDelete':_0x17cc('0x117')});db[_0x17cc('0x44')][_0x17cc('0x11a')](db['Disposition'],{'as':'Dispositions','foreignKey':'FaxAccountId','onDelete':'cascade'});db[_0x17cc('0x44')][_0x17cc('0x11a')](db[_0x17cc('0x17e')],{'as':_0x17cc('0x16c'),'foreignKey':_0x17cc('0x17f')});db[_0x17cc('0x44')][_0x17cc('0x11a')](db[_0x17cc('0x48')],{'as':_0x17cc('0x16d')});db[_0x17cc('0x44')]['hasMany'](db[_0x17cc('0x46')],{'as':_0x17cc('0x149'),'foreignKey':_0x17cc('0x17f'),'onDelete':_0x17cc('0x117')});db[_0x17cc('0x44')][_0x17cc('0x11a')](db['VoiceExtension'],{'as':_0x17cc('0x180'),'onDelete':_0x17cc('0x117')});db[_0x17cc('0x44')]['hasMany'](db[_0x17cc('0x181')],{'as':_0x17cc('0x15e')});db[_0x17cc('0x44')][_0x17cc('0x12a')](db[_0x17cc('0x150')],{'as':_0x17cc('0x150')});db['FaxAccount'][_0x17cc('0x12a')](db[_0x17cc('0xf4')],{'as':'List','foreignKey':'ListId'});db[_0x17cc('0x44')]['belongsTo'](db[_0x17cc('0x154')],{'as':_0x17cc('0x155'),'foreignKey':_0x17cc('0x156')});db[_0x17cc('0x44')][_0x17cc('0x12e')](db[_0x17cc('0x10')],{'as':_0x17cc('0x158'),'through':'user_has_fax_accounts'});db[_0x17cc('0x46')][_0x17cc('0x12a')](db['User'],{'onDelete':_0x17cc('0x168')});db['FaxApplication'][_0x17cc('0x12a')](db[_0x17cc('0x13b')],{'onDelete':'restrict'});db['FaxApplication'][_0x17cc('0x12a')](db[_0x17cc('0x44')],{'onDelete':_0x17cc('0x168')});db[_0x17cc('0x46')]['belongsTo'](db['Tag'],{'onDelete':_0x17cc('0x168'),'foreignKey':_0x17cc('0x17c')});db[_0x17cc('0x48')]['hasMany'](db['FaxMessage'],{'as':_0x17cc('0x15e'),'onDelete':_0x17cc('0x117'),'foreignKey':_0x17cc('0x182')});db[_0x17cc('0x48')]['belongsTo'](db[_0x17cc('0x44')],{'as':_0x17cc('0x173'),'foreignKey':_0x17cc('0x17f')});db[_0x17cc('0x48')][_0x17cc('0x12a')](db['CmContact'],{'as':_0x17cc('0x164'),'foreignKey':_0x17cc('0x165')});db[_0x17cc('0x48')][_0x17cc('0x12a')](db[_0x17cc('0x10')],{'as':_0x17cc('0x174'),'foreignKey':_0x17cc('0x118')});db[_0x17cc('0x48')][_0x17cc('0x12e')](db[_0x17cc('0x87')],{'through':'fax_interaction_has_tags','as':_0x17cc('0x176')});db[_0x17cc('0x48')][_0x17cc('0x12e')](db[_0x17cc('0x87')],{'through':_0x17cc('0x183'),'as':_0x17cc('0x177')});db['FaxInteraction'][_0x17cc('0x12e')](db[_0x17cc('0x10')],{'as':_0x17cc('0x184'),'through':'user_has_fax_interactions','foreignKey':'FaxInteractionId'});db['FaxMessage'][_0x17cc('0x12a')](db[_0x17cc('0x10')],{'onDelete':'cascade','as':_0x17cc('0x10')});db[_0x17cc('0x181')][_0x17cc('0x12a')](db[_0x17cc('0x48')],{'as':'Interaction','foreignKey':'FaxInteractionId'});db['FaxMessage'][_0x17cc('0x12a')](db['CmContact'],{'onDelete':_0x17cc('0x117'),'as':_0x17cc('0x164')});db[_0x17cc('0x181')]['belongsTo'](db[_0x17cc('0xea')],{'as':_0x17cc('0xea'),'foreignKey':_0x17cc('0x185')});db[_0x17cc('0x181')]['belongsTo'](db[_0x17cc('0x44')],{'as':_0x17cc('0x173'),'foreignKey':_0x17cc('0x17f')});db[_0x17cc('0x13b')][_0x17cc('0x12e')](db[_0x17cc('0x10')],{'as':_0x17cc('0x158'),'through':_0x17cc('0x2d')});db[_0x17cc('0x13b')][_0x17cc('0x12e')](db[_0x17cc('0xe6')],{'through':_0x17cc('0x186'),'as':_0x17cc('0x159')});db[_0x17cc('0x187')][_0x17cc('0x12a')](db['FaxAccount'],{});db[_0x17cc('0x187')][_0x17cc('0x12a')](db[_0x17cc('0xf4')],{'as':_0x17cc('0x16e'),'foreignKey':'ListId'});db[_0x17cc('0x187')][_0x17cc('0x12a')](db[_0x17cc('0x6b')],{'as':_0x17cc('0x164'),'foreignKey':_0x17cc('0x165')});db['FaxQueueReport'][_0x17cc('0x12a')](db[_0x17cc('0x48')],{});db['FaxQueueReport'][_0x17cc('0x12a')](db[_0x17cc('0x181')],{});db[_0x17cc('0x187')][_0x17cc('0x12a')](db[_0x17cc('0x10')],{});db[_0x17cc('0x187')][_0x17cc('0x12a')](db['FaxQueue'],{});db[_0x17cc('0x4b')]['hasMany'](db[_0x17cc('0x7a')],{'as':_0x17cc('0x16b'),'foreignKey':'SmsAccountId','onDelete':_0x17cc('0x117')});db[_0x17cc('0x4b')]['hasMany'](db['CannedAnswer'],{'as':_0x17cc('0x16c'),'foreignKey':_0x17cc('0x188')});db[_0x17cc('0x4b')][_0x17cc('0x11a')](db[_0x17cc('0x189')],{'as':_0x17cc('0x15e'),'foreignKey':'SmsAccountId'});db['SmsAccount'][_0x17cc('0x11a')](db['SmsInteraction'],{'as':_0x17cc('0x16d')});db['SmsAccount'][_0x17cc('0x11a')](db[_0x17cc('0x4d')],{'as':'Applications','foreignKey':_0x17cc('0x188'),'onDelete':_0x17cc('0x117')});db[_0x17cc('0x4b')][_0x17cc('0x12a')](db[_0x17cc('0xf4')],{'as':'List','foreignKey':_0x17cc('0x16f')});db[_0x17cc('0x4b')]['belongsTo'](db['Pause'],{'as':_0x17cc('0x155'),'foreignKey':_0x17cc('0x156')});db[_0x17cc('0x4b')][_0x17cc('0x12e')](db[_0x17cc('0x10')],{'as':_0x17cc('0x158'),'through':'user_has_sms_accounts'});db[_0x17cc('0x4d')]['belongsTo'](db['User'],{'onDelete':'restrict'});db['SmsApplication'][_0x17cc('0x12a')](db['SmsQueue'],{'onDelete':_0x17cc('0x168')});db[_0x17cc('0x4d')][_0x17cc('0x12a')](db[_0x17cc('0x4b')],{'onDelete':_0x17cc('0x168')});db[_0x17cc('0x4d')]['belongsTo'](db['Interval'],{'onDelete':'restrict','foreignKey':_0x17cc('0x153')});db[_0x17cc('0x4d')][_0x17cc('0x12a')](db[_0x17cc('0x87')],{'onDelete':_0x17cc('0x168'),'foreignKey':_0x17cc('0x17c')});db[_0x17cc('0x4e')][_0x17cc('0x11a')](db[_0x17cc('0x189')],{'as':_0x17cc('0x15e'),'onDelete':_0x17cc('0x117'),'foreignKey':_0x17cc('0x18a')});db[_0x17cc('0x4e')]['belongsTo'](db[_0x17cc('0x4b')],{'as':_0x17cc('0x173'),'foreignKey':_0x17cc('0x188')});db[_0x17cc('0x4e')][_0x17cc('0x12a')](db[_0x17cc('0x6b')],{'as':_0x17cc('0x164'),'foreignKey':_0x17cc('0x165')});db[_0x17cc('0x4e')][_0x17cc('0x12a')](db[_0x17cc('0x10')],{'as':_0x17cc('0x174'),'foreignKey':_0x17cc('0x118')});db[_0x17cc('0x4e')][_0x17cc('0x12e')](db['Tag'],{'through':'sms_interaction_has_tags','as':_0x17cc('0x176')});db[_0x17cc('0x4e')][_0x17cc('0x12e')](db['Tag'],{'through':'sms_interaction_has_tags','as':_0x17cc('0x177')});db[_0x17cc('0x4e')][_0x17cc('0x12e')](db[_0x17cc('0x10')],{'as':'Users','through':'user_has_sms_interactions','foreignKey':_0x17cc('0x18a')});db['SmsMessage'][_0x17cc('0x12a')](db[_0x17cc('0x10')],{'as':'User'});db['SmsMessage'][_0x17cc('0x12a')](db[_0x17cc('0x6b')],{'onDelete':'cascade','as':_0x17cc('0x164')});db[_0x17cc('0x189')]['belongsTo'](db[_0x17cc('0x4e')],{'onDelete':_0x17cc('0x117'),'as':_0x17cc('0x179'),'foreignKey':'SmsInteractionId'});db['SmsMessage'][_0x17cc('0x12a')](db[_0x17cc('0x4b')],{'as':_0x17cc('0x173'),'foreignKey':_0x17cc('0x188')});db[_0x17cc('0x51')][_0x17cc('0x12e')](db[_0x17cc('0x10')],{'as':_0x17cc('0x158'),'through':_0x17cc('0x2e'),'foreignKey':_0x17cc('0x18b')});db['SmsQueue']['belongsToMany'](db[_0x17cc('0xe6')],{'through':_0x17cc('0x18c'),'as':'Teams'});db[_0x17cc('0x143')][_0x17cc('0x11a')](db[_0x17cc('0x7a')],{'as':_0x17cc('0x16b'),'foreignKey':_0x17cc('0x18d'),'onDelete':_0x17cc('0x117')});db['OpenchannelAccount'][_0x17cc('0x11a')](db[_0x17cc('0x17e')],{'as':_0x17cc('0x16c'),'foreignKey':_0x17cc('0x18d')});db[_0x17cc('0x143')]['hasMany'](db[_0x17cc('0x55')],{'as':_0x17cc('0x16d'),'foreignKey':_0x17cc('0x18d')});db[_0x17cc('0x143')][_0x17cc('0x11a')](db[_0x17cc('0x56')],{'as':_0x17cc('0x15e'),'foreignKey':'OpenchannelAccountId'});db[_0x17cc('0x143')][_0x17cc('0x11a')](db['OpenchannelApplication'],{'as':_0x17cc('0x149'),'foreignKey':'OpenchannelAccountId','onDelete':_0x17cc('0x117')});db[_0x17cc('0x143')]['belongsTo'](db[_0x17cc('0xf4')],{'as':_0x17cc('0x16e'),'foreignKey':_0x17cc('0x16f')});db[_0x17cc('0x143')][_0x17cc('0x12a')](db[_0x17cc('0x154')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x17cc('0x143')]['belongsToMany'](db[_0x17cc('0x10')],{'as':_0x17cc('0x158'),'through':'user_has_openchannel_accounts'});db[_0x17cc('0x53')][_0x17cc('0x12a')](db[_0x17cc('0x10')],{'onDelete':_0x17cc('0x168')});db['OpenchannelApplication'][_0x17cc('0x12a')](db[_0x17cc('0x58')],{'onDelete':_0x17cc('0x168'),'foreignKey':_0x17cc('0x18e')});db['OpenchannelApplication'][_0x17cc('0x12a')](db['OpenchannelAccount'],{'onDelete':'restrict','foreignKey':_0x17cc('0x18d')});db[_0x17cc('0x53')][_0x17cc('0x12a')](db['Interval'],{'onDelete':_0x17cc('0x168'),'foreignKey':_0x17cc('0x153')});db[_0x17cc('0x53')][_0x17cc('0x12a')](db[_0x17cc('0x87')],{'onDelete':_0x17cc('0x168'),'foreignKey':'TagId'});db[_0x17cc('0x55')]['hasMany'](db[_0x17cc('0x56')],{'as':_0x17cc('0x15e'),'onDelete':_0x17cc('0x117'),'foreignKey':_0x17cc('0x18f')});db[_0x17cc('0x55')][_0x17cc('0x12a')](db[_0x17cc('0x143')],{'as':_0x17cc('0x173'),'foreignKey':_0x17cc('0x18d')});db[_0x17cc('0x55')][_0x17cc('0x12a')](db[_0x17cc('0x6b')],{'as':_0x17cc('0x164'),'foreignKey':'ContactId'});db[_0x17cc('0x55')][_0x17cc('0x12a')](db[_0x17cc('0x10')],{'as':_0x17cc('0x174'),'foreignKey':_0x17cc('0x118')});db[_0x17cc('0x55')][_0x17cc('0x12e')](db[_0x17cc('0x87')],{'through':_0x17cc('0x190'),'as':_0x17cc('0x176')});db['OpenchannelInteraction'][_0x17cc('0x12e')](db[_0x17cc('0x87')],{'through':_0x17cc('0x190'),'as':'ThroughTags'});db[_0x17cc('0x55')][_0x17cc('0x12e')](db[_0x17cc('0x10')],{'as':_0x17cc('0x184'),'through':'user_has_openchannel_interactions','foreignKey':_0x17cc('0x18f')});db[_0x17cc('0x56')]['belongsTo'](db[_0x17cc('0x10')],{'onDelete':'cascade','as':_0x17cc('0x10')});db[_0x17cc('0x56')]['belongsTo'](db[_0x17cc('0x6b')],{'onDelete':_0x17cc('0x117'),'as':_0x17cc('0x164')});db['OpenchannelMessage'][_0x17cc('0x12a')](db['OpenchannelInteraction'],{'onDelete':'cascade','as':_0x17cc('0x179'),'foreignKey':_0x17cc('0x18f')});db[_0x17cc('0x56')][_0x17cc('0x12a')](db['Attachment'],{'as':_0x17cc('0xea'),'foreignKey':_0x17cc('0x185')});db[_0x17cc('0x56')][_0x17cc('0x12a')](db['OpenchannelAccount'],{'as':_0x17cc('0x173'),'foreignKey':_0x17cc('0x18d')});db[_0x17cc('0x58')][_0x17cc('0x12e')](db['User'],{'as':_0x17cc('0x158'),'through':_0x17cc('0x191'),'foreignKey':'OpenchannelQueueId'});db[_0x17cc('0x58')][_0x17cc('0x12e')](db[_0x17cc('0xe6')],{'through':_0x17cc('0x192'),'as':'Teams'});db['ChatWebsite'][_0x17cc('0x11a')](db[_0x17cc('0x7a')],{'as':_0x17cc('0x16b'),'foreignKey':_0x17cc('0x17a'),'onDelete':'cascade'});db[_0x17cc('0x59')]['hasMany'](db[_0x17cc('0x17e')],{'as':_0x17cc('0x16c'),'foreignKey':_0x17cc('0x17a')});db[_0x17cc('0x59')][_0x17cc('0x11a')](db['ChatProactiveAction'],{'as':'ProactiveActions'});db[_0x17cc('0x59')][_0x17cc('0x11a')](db[_0x17cc('0x5e')],{'as':_0x17cc('0x16d')});db[_0x17cc('0x59')][_0x17cc('0x11a')](db[_0x17cc('0x5c')],{'as':_0x17cc('0x149'),'foreignKey':'ChatWebsiteId','onDelete':'cascade'});db['ChatWebsite'][_0x17cc('0x11a')](db[_0x17cc('0x60')],{'as':_0x17cc('0x15e')});db[_0x17cc('0x59')][_0x17cc('0x12a')](db[_0x17cc('0xf4')],{'as':_0x17cc('0x16e'),'foreignKey':_0x17cc('0x16f')});db[_0x17cc('0x59')]['belongsTo'](db[_0x17cc('0x152')],{'as':_0x17cc('0x152'),'foreignKey':_0x17cc('0x153')});db[_0x17cc('0x59')]['belongsTo'](db[_0x17cc('0x141')],{'as':_0x17cc('0x141'),'foreignKey':_0x17cc('0x166')});db['ChatWebsite'][_0x17cc('0x12a')](db[_0x17cc('0x154')],{'as':_0x17cc('0x155'),'foreignKey':_0x17cc('0x156')});db[_0x17cc('0x59')][_0x17cc('0x12e')](db[_0x17cc('0x10')],{'as':_0x17cc('0x158'),'through':_0x17cc('0x140')});db['OpenchannelQueueReport'][_0x17cc('0x12a')](db[_0x17cc('0x143')],{});db[_0x17cc('0x5b')]['belongsTo'](db[_0x17cc('0xf4')],{'as':_0x17cc('0x16e'),'foreignKey':_0x17cc('0x16f')});db[_0x17cc('0x5b')][_0x17cc('0x12a')](db[_0x17cc('0x6b')],{'as':'Contact','foreignKey':_0x17cc('0x165')});db['OpenchannelQueueReport']['belongsTo'](db[_0x17cc('0x55')],{});db['OpenchannelQueueReport'][_0x17cc('0x12a')](db['OpenchannelMessage'],{});db['OpenchannelQueueReport'][_0x17cc('0x12a')](db[_0x17cc('0x10')],{});db[_0x17cc('0x5b')][_0x17cc('0x12a')](db[_0x17cc('0x58')],{});db[_0x17cc('0x5c')][_0x17cc('0x12a')](db[_0x17cc('0x10')],{'as':'Agent','foreignKey':_0x17cc('0x118'),'onDelete':_0x17cc('0x168')});db[_0x17cc('0x5c')]['belongsTo'](db[_0x17cc('0x63')],{'as':_0x17cc('0x193'),'foreignKey':_0x17cc('0x194'),'onDelete':_0x17cc('0x168')});db[_0x17cc('0x5c')][_0x17cc('0x12a')](db[_0x17cc('0x59')],{'as':_0x17cc('0x195'),'foreignKey':_0x17cc('0x17a'),'onDelete':_0x17cc('0x168')});db['ChatApplication'][_0x17cc('0x12a')](db['Tag'],{'onDelete':_0x17cc('0x168'),'foreignKey':_0x17cc('0x17c')});db[_0x17cc('0x5e')][_0x17cc('0x11a')](db[_0x17cc('0x60')],{'as':_0x17cc('0x15e'),'onDelete':_0x17cc('0x117'),'foreignKey':'ChatInteractionId'});db[_0x17cc('0x5e')][_0x17cc('0x12a')](db['ChatWebsite'],{'as':_0x17cc('0x173'),'foreignKey':_0x17cc('0x17a')});db[_0x17cc('0x5e')]['belongsTo'](db[_0x17cc('0x6b')],{'as':'Contact','foreignKey':_0x17cc('0x165')});db['ChatInteraction'][_0x17cc('0x12a')](db[_0x17cc('0x10')],{'as':_0x17cc('0x174'),'foreignKey':'UserId'});db[_0x17cc('0x5e')][_0x17cc('0x12e')](db[_0x17cc('0x87')],{'through':'chat_interaction_has_tags','as':_0x17cc('0x176')});db['ChatInteraction'][_0x17cc('0x12e')](db[_0x17cc('0x87')],{'through':_0x17cc('0x196'),'as':_0x17cc('0x177')});db[_0x17cc('0x5e')]['belongsToMany'](db['User'],{'as':_0x17cc('0x184'),'through':_0x17cc('0x131'),'foreignKey':_0x17cc('0x197')});db[_0x17cc('0x60')][_0x17cc('0x12a')](db[_0x17cc('0x10')],{'onDelete':_0x17cc('0x117'),'as':_0x17cc('0x10')});db[_0x17cc('0x60')][_0x17cc('0x12a')](db[_0x17cc('0x6b')],{'onDelete':_0x17cc('0x117'),'as':_0x17cc('0x164'),'foreignKey':_0x17cc('0x165')});db[_0x17cc('0x60')][_0x17cc('0x12a')](db['ChatInteraction'],{'onDelete':'cascade','as':_0x17cc('0x179'),'foreignKey':_0x17cc('0x197')});db[_0x17cc('0x60')][_0x17cc('0x12a')](db['Attachment'],{'as':'Attachment','foreignKey':_0x17cc('0x185')});db['ChatMessage'][_0x17cc('0x12a')](db[_0x17cc('0x59')],{'as':_0x17cc('0x173'),'foreignKey':'ChatWebsiteId'});db[_0x17cc('0x198')][_0x17cc('0x11a')](db['Attachment'],{'as':_0x17cc('0x199'),'foreignKey':_0x17cc('0x17b'),'onDelete':_0x17cc('0x117'),'hooks':!![]});db[_0x17cc('0x198')][_0x17cc('0x12a')](db[_0x17cc('0x6b')],{'onDelete':_0x17cc('0x117'),'as':_0x17cc('0x164'),'foreignKey':_0x17cc('0x165')});db[_0x17cc('0x198')]['belongsTo'](db[_0x17cc('0x59')],{'as':_0x17cc('0x173'),'foreignKey':'ChatWebsiteId'});db[_0x17cc('0x63')][_0x17cc('0x12e')](db[_0x17cc('0x10')],{'as':'Agents','through':'UserChatQueue','hooks':!![]});db[_0x17cc('0x63')][_0x17cc('0x12e')](db[_0x17cc('0xe6')],{'through':'team_has_chat_queues','as':_0x17cc('0x159')});db[_0x17cc('0x65')][_0x17cc('0x11a')](db[_0x17cc('0xd1')],{'as':_0x17cc('0x15e'),'foreignKey':_0x17cc('0x19a'),'onDelete':_0x17cc('0x117')});db[_0x17cc('0x65')]['belongsToMany'](db[_0x17cc('0x10')],{'as':'Members','through':_0x17cc('0x12d')});db['ChatProactiveAction'][_0x17cc('0x12a')](db[_0x17cc('0x59')],{'as':_0x17cc('0x195'),'foreignKey':'ChatWebsiteId'});db[_0x17cc('0x69')]['hasMany'](db[_0x17cc('0x6b')],{'as':_0x17cc('0x19b'),'foreignKey':_0x17cc('0x19c')});db['CmContact'][_0x17cc('0x11a')](db[_0x17cc('0x8a')],{'as':'Phones','foreignKey':_0x17cc('0x19d')});db[_0x17cc('0x6b')][_0x17cc('0x11a')](db[_0x17cc('0x128')],{'as':_0x17cc('0x19e'),'foreignKey':_0x17cc('0x165')});db[_0x17cc('0x6b')][_0x17cc('0x11a')](db[_0x17cc('0x11d')],{'as':_0x17cc('0x11e'),'foreignKey':_0x17cc('0x165')});db[_0x17cc('0x6b')]['hasMany'](db[_0x17cc('0x11f')],{'as':_0x17cc('0x14d'),'foreignKey':_0x17cc('0x165')});db[_0x17cc('0x6b')][_0x17cc('0x11a')](db[_0x17cc('0x72')],{'as':'ReportAgentPreview','foreignKey':_0x17cc('0x165')});db[_0x17cc('0x6b')][_0x17cc('0x11a')](db['JscriptySessionReport'],{'as':_0x17cc('0x14f'),'foreignKey':_0x17cc('0x165')});db['CmContact'][_0x17cc('0x11a')](db[_0x17cc('0x55')],{'as':_0x17cc('0x120'),'foreignKey':_0x17cc('0x165'),'onDelete':_0x17cc('0x168')});db[_0x17cc('0x6b')][_0x17cc('0x11a')](db[_0x17cc('0x5e')],{'as':_0x17cc('0x121'),'foreignKey':_0x17cc('0x165'),'onDelete':_0x17cc('0x168')});db['CmContact'][_0x17cc('0x11a')](db['SmsInteraction'],{'as':_0x17cc('0x133'),'foreignKey':_0x17cc('0x165'),'onDelete':'restrict'});db['CmContact'][_0x17cc('0x11a')](db[_0x17cc('0x48')],{'as':_0x17cc('0x122'),'foreignKey':_0x17cc('0x165'),'onDelete':_0x17cc('0x168')});db[_0x17cc('0x6b')][_0x17cc('0x11a')](db[_0x17cc('0x123')],{'as':_0x17cc('0x124'),'foreignKey':_0x17cc('0x165'),'onDelete':_0x17cc('0x168')});db['CmContact']['belongsTo'](db[_0x17cc('0x69')],{'as':_0x17cc('0x19f'),'foreignKey':_0x17cc('0x19c')});db['CmContact'][_0x17cc('0x12a')](db[_0x17cc('0xf4')],{'as':_0x17cc('0x16e'),'foreignKey':_0x17cc('0x16f'),'onDelete':_0x17cc('0x117')});db[_0x17cc('0x6b')][_0x17cc('0x12e')](db['User'],{'as':_0x17cc('0x184'),'through':_0x17cc('0x1a0')});db['CmContact'][_0x17cc('0x12e')](db[_0x17cc('0x87')],{'as':_0x17cc('0x176'),'through':_0x17cc('0x1a1')});db[_0x17cc('0x6b')][_0x17cc('0x12e')](db[_0x17cc('0x87')],{'through':_0x17cc('0x1a1'),'as':'ThroughTags'});db[_0x17cc('0x128')]['hasMany'](db[_0x17cc('0x8c')],{'as':_0x17cc('0x1a2'),'foreignKey':_0x17cc('0x1a3')});db[_0x17cc('0x128')][_0x17cc('0x12a')](db[_0x17cc('0x6b')],{'as':_0x17cc('0x164'),'foreignKey':'ContactId','onDelete':_0x17cc('0x117')});db[_0x17cc('0x128')][_0x17cc('0x12a')](db[_0x17cc('0xf4')],{'as':_0x17cc('0x16e'),'foreignKey':_0x17cc('0x16f'),'onDelete':_0x17cc('0x117')});db[_0x17cc('0x128')][_0x17cc('0x12a')](db[_0x17cc('0x10')],{'as':_0x17cc('0x1a4'),'foreignKey':_0x17cc('0x118')});db[_0x17cc('0x128')][_0x17cc('0x12a')](db[_0x17cc('0x18')],{'as':'Queue','foreignKey':_0x17cc('0x14c'),'onDelete':'cascade'});db[_0x17cc('0x128')][_0x17cc('0x12a')](db[_0x17cc('0xe8')],{'as':'Campaign','foreignKey':'CampaignId','onDelete':_0x17cc('0x117')});db[_0x17cc('0x128')]['belongsTo'](db[_0x17cc('0x10')],{'as':_0x17cc('0x174'),'foreignKey':_0x17cc('0x1a5')});db[_0x17cc('0x6e')][_0x17cc('0x12a')](db[_0x17cc('0x6b')],{'as':_0x17cc('0x164'),'foreignKey':_0x17cc('0x165'),'onDelete':_0x17cc('0x117')});db[_0x17cc('0x6e')][_0x17cc('0x12a')](db[_0x17cc('0xf4')],{'as':'List','foreignKey':_0x17cc('0x16f'),'onDelete':_0x17cc('0x117')});db['CmHopperBlack'][_0x17cc('0x12a')](db[_0x17cc('0x18')],{'as':'Queue','foreignKey':_0x17cc('0x14c'),'onDelete':'cascade'});db['CmHopperBlack'][_0x17cc('0x12a')](db[_0x17cc('0xe8')],{'as':'Campaign','foreignKey':_0x17cc('0x1a6'),'onDelete':'cascade'});db['Automation'][_0x17cc('0x11a')](db[_0x17cc('0x7c')],{'as':{'plural':_0x17cc('0x1a7'),'singular':_0x17cc('0x1a8')},'foreignKey':'AutomationAllId','onDelete':_0x17cc('0x117'),'hooks':!![]});db[_0x17cc('0x77')]['hasMany'](db[_0x17cc('0x7c')],{'as':{'plural':_0x17cc('0x1a9'),'singular':_0x17cc('0x1aa')},'foreignKey':'AutomationAnyId','onDelete':'cascade','hooks':!![]});db[_0x17cc('0x77')][_0x17cc('0x11a')](db[_0x17cc('0x76')],{'as':_0x17cc('0x1ab'),'foreignKey':'AutomationId','onDelete':_0x17cc('0x117'),'hooks':!![]});db[_0x17cc('0x7a')][_0x17cc('0x11a')](db[_0x17cc('0x7a')],{'as':_0x17cc('0x16b'),'foreignKey':_0x17cc('0x1ac'),'onDelete':_0x17cc('0x117')});db[_0x17cc('0x152')]['hasMany'](db[_0x17cc('0x152')],{'as':_0x17cc('0x1ad'),'foreignKey':_0x17cc('0x153'),'onDelete':_0x17cc('0x117'),'hooks':!![],'required':![]});db[_0x17cc('0x152')]['hasMany'](db[_0x17cc('0x16')],{'as':_0x17cc('0x1ae'),'foreignKey':'IntervalId','onDelete':_0x17cc('0x168')});db[_0x17cc('0x152')][_0x17cc('0x11a')](db[_0x17cc('0x3c')],{'as':'MailApplications','foreignKey':_0x17cc('0x153')});db[_0x17cc('0x152')][_0x17cc('0x11a')](db[_0x17cc('0x5c')],{'as':'ChatApplications','foreignKey':'IntervalId'});db[_0x17cc('0x152')][_0x17cc('0x11a')](db[_0x17cc('0x46')],{'as':_0x17cc('0x1af'),'foreignKey':_0x17cc('0x153')});db['Interval'][_0x17cc('0x11a')](db['SmsApplication'],{'as':_0x17cc('0x1b0'),'foreignKey':'IntervalId'});db[_0x17cc('0x83')][_0x17cc('0x12a')](db[_0x17cc('0x141')],{});db['Schedule']['belongsTo'](db[_0x17cc('0x96')],{'foreignKey':_0x17cc('0x1b1')});db['Schedule'][_0x17cc('0x12a')](db[_0x17cc('0x94')],{'foreignKey':'CustomReportId'});db['Sound'][_0x17cc('0x12e')](db[_0x17cc('0x17')],{'as':_0x17cc('0x1b2'),'through':_0x17cc('0x14a'),'onDelete':'restrict'});db[_0x17cc('0x87')][_0x17cc('0x12e')](db[_0x17cc('0x6b')],{'through':'cm_contact_has_tags'});db['Tag']['belongsToMany'](db[_0x17cc('0x5e')],{'through':_0x17cc('0x196')});db[_0x17cc('0x87')][_0x17cc('0x12e')](db['MailInteraction'],{'through':_0x17cc('0x175')});db[_0x17cc('0x87')]['belongsToMany'](db['SmsInteraction'],{'through':_0x17cc('0x1b3')});db['Tag'][_0x17cc('0x12e')](db['FaxInteraction'],{'through':_0x17cc('0x183')});db['Tag'][_0x17cc('0x12e')](db[_0x17cc('0x55')],{'through':_0x17cc('0x190')});db[_0x17cc('0x87')]['belongsToMany'](db[_0x17cc('0x100')],{'through':'whatsapp_interaction_has_tags'});db[_0x17cc('0x8a')][_0x17cc('0x12a')](db['ContactItemType'],{'as':_0x17cc('0x1b4'),'foreignKey':_0x17cc('0x1b5')});db[_0x17cc('0x8c')][_0x17cc('0x12a')](db['CmHopper'],{'as':_0x17cc('0x1b6'),'foreignKey':_0x17cc('0x1a3')});db[_0x17cc('0x8a')]['belongsTo'](db[_0x17cc('0x6b')],{'as':_0x17cc('0x164'),'foreignKey':_0x17cc('0x19d')});db[_0x17cc('0x8f')][_0x17cc('0x11a')](db[_0x17cc('0x7c')],{'as':{'plural':'AllConditions','singular':_0x17cc('0x1b7')},'foreignKey':_0x17cc('0x1b8'),'onDelete':_0x17cc('0x117'),'hooks':!![]});db[_0x17cc('0x8f')][_0x17cc('0x11a')](db[_0x17cc('0x7c')],{'as':{'plural':'AnyConditions','singular':_0x17cc('0x1b9')},'foreignKey':'TriggerAnyId','onDelete':'cascade','hooks':!![]});db[_0x17cc('0x8f')][_0x17cc('0x11a')](db['Action'],{'as':_0x17cc('0x1ab'),'foreignKey':'TriggerId','onDelete':'cascade','hooks':!![]});db[_0x17cc('0x94')]['hasMany'](db[_0x17cc('0x9c')],{'as':_0x17cc('0x1ba'),'onDelete':_0x17cc('0x117'),'foreignKey':_0x17cc('0x1bb'),'hooks':!![]});db['AnalyticDefaultReport'][_0x17cc('0x11a')](db[_0x17cc('0x9c')],{'as':'Fields','onDelete':_0x17cc('0x117'),'foreignKey':'DefaultReportId'});db[_0x17cc('0x9a')][_0x17cc('0x11a')](db['AnalyticFieldReport'],{'as':'Fields','onDelete':'cascade','foreignKey':_0x17cc('0x1bc')});db[_0x17cc('0x9c')][_0x17cc('0x12a')](db[_0x17cc('0x9a')],{'foreignKey':_0x17cc('0x1bc')});db[_0x17cc('0x9f')][_0x17cc('0x11a')](db[_0x17cc('0xa1')],{'as':_0x17cc('0x1bd'),'onDelete':_0x17cc('0x117'),'foreignKey':_0x17cc('0x1be')});db['SalesforceConfiguration'][_0x17cc('0x11a')](db[_0x17cc('0xa3')],{'as':_0x17cc('0x1bf'),'onDelete':_0x17cc('0x117'),'foreignKey':'SubjectId'});db[_0x17cc('0xa1')]['hasMany'](db[_0x17cc('0xa3')],{'as':_0x17cc('0x1c0'),'onDelete':'cascade','foreignKey':_0x17cc('0x1c1')});db['SalesforceConfiguration'][_0x17cc('0x11a')](db[_0x17cc('0xa3')],{'as':_0x17cc('0x1ba'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0x17cc('0xa1')][_0x17cc('0x12a')](db[_0x17cc('0x9f')],{'as':_0x17cc('0x173'),'foreignKey':_0x17cc('0x1be')});db[_0x17cc('0xa3')][_0x17cc('0x11a')](db['SalesforceField'],{'as':_0x17cc('0x1c2'),'foreignKey':'SubjectId'});db[_0x17cc('0xa3')]['hasMany'](db['SalesforceField'],{'as':_0x17cc('0x1c3'),'foreignKey':_0x17cc('0x1c1')});db[_0x17cc('0xa3')][_0x17cc('0x11a')](db[_0x17cc('0xa3')],{'as':_0x17cc('0x1c4'),'foreignKey':_0x17cc('0x1c5')});db['SalesforceField'][_0x17cc('0x12a')](db[_0x17cc('0x1c6')],{'as':_0x17cc('0x1c6'),'foreignKey':_0x17cc('0x1c7')});db[_0x17cc('0x1c8')][_0x17cc('0x11a')](db['SugarcrmConfiguration'],{'as':_0x17cc('0x1bd'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x17cc('0x1c9')]['hasMany'](db[_0x17cc('0xa6')],{'as':_0x17cc('0x1bf'),'onDelete':_0x17cc('0x117'),'foreignKey':_0x17cc('0x1ca')});db['SugarcrmConfiguration'][_0x17cc('0x11a')](db[_0x17cc('0xa6')],{'as':_0x17cc('0x1c0'),'onDelete':'cascade','foreignKey':_0x17cc('0x1c1')});db[_0x17cc('0x1c9')][_0x17cc('0x11a')](db[_0x17cc('0xa6')],{'as':_0x17cc('0x1ba'),'onDelete':'cascade','foreignKey':_0x17cc('0x1c5')});db[_0x17cc('0x1c9')][_0x17cc('0x12a')](db[_0x17cc('0x1c8')],{'as':_0x17cc('0x173'),'foreignKey':_0x17cc('0x1be')});db[_0x17cc('0xa6')][_0x17cc('0x11a')](db['SugarcrmField'],{'as':_0x17cc('0x1c2'),'foreignKey':'SubjectId'});db['SugarcrmField'][_0x17cc('0x11a')](db[_0x17cc('0xa6')],{'as':_0x17cc('0x1c3'),'foreignKey':_0x17cc('0x1c1')});db[_0x17cc('0xa6')][_0x17cc('0x11a')](db[_0x17cc('0xa6')],{'as':_0x17cc('0x1c4'),'foreignKey':_0x17cc('0x1c5')});db[_0x17cc('0xa6')][_0x17cc('0x12a')](db[_0x17cc('0x1c6')],{'as':'Variable','foreignKey':_0x17cc('0x1c7')});db['DeskAccount'][_0x17cc('0x11a')](db[_0x17cc('0xaa')],{'as':_0x17cc('0x1bd'),'onDelete':_0x17cc('0x117'),'foreignKey':'AccountId'});db['DeskConfiguration'][_0x17cc('0x11a')](db[_0x17cc('0xac')],{'as':_0x17cc('0x1bf'),'onDelete':_0x17cc('0x117'),'foreignKey':_0x17cc('0x1ca')});db['DeskConfiguration'][_0x17cc('0x11a')](db['DeskField'],{'as':'Descriptions','onDelete':_0x17cc('0x117'),'foreignKey':_0x17cc('0x1c1')});db[_0x17cc('0xaa')][_0x17cc('0x11a')](db[_0x17cc('0xac')],{'as':'Fields','onDelete':_0x17cc('0x117'),'foreignKey':'FieldId'});db['DeskConfiguration'][_0x17cc('0x12a')](db['DeskAccount'],{'as':'Account','foreignKey':_0x17cc('0x1be')});db[_0x17cc('0xaa')][_0x17cc('0x12e')](db['Tag'],{'through':_0x17cc('0x1cb')});db['DeskField'][_0x17cc('0x11a')](db['DeskField'],{'as':_0x17cc('0x1c2'),'foreignKey':_0x17cc('0x1ca')});db[_0x17cc('0xac')][_0x17cc('0x11a')](db[_0x17cc('0xac')],{'as':_0x17cc('0x1c3'),'foreignKey':_0x17cc('0x1c1')});db[_0x17cc('0xac')][_0x17cc('0x11a')](db[_0x17cc('0xac')],{'as':_0x17cc('0x1c4'),'foreignKey':_0x17cc('0x1c5')});db['DeskField'][_0x17cc('0x12a')](db[_0x17cc('0x1c6')],{'as':_0x17cc('0x1c6'),'foreignKey':_0x17cc('0x1c7')});db['ZohoAccount'][_0x17cc('0x11a')](db[_0x17cc('0xaf')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x17cc('0x1be')});db[_0x17cc('0xaf')][_0x17cc('0x11a')](db[_0x17cc('0x1cc')],{'as':_0x17cc('0x1bf'),'onDelete':_0x17cc('0x117'),'foreignKey':_0x17cc('0x1ca')});db['ZohoConfiguration'][_0x17cc('0x11a')](db[_0x17cc('0x1cc')],{'as':_0x17cc('0x1c0'),'onDelete':_0x17cc('0x117'),'foreignKey':_0x17cc('0x1c1')});db[_0x17cc('0xaf')][_0x17cc('0x11a')](db[_0x17cc('0x1cc')],{'as':_0x17cc('0x1ba'),'onDelete':_0x17cc('0x117'),'foreignKey':_0x17cc('0x1c5')});db[_0x17cc('0xaf')][_0x17cc('0x12a')](db['ZohoAccount'],{'as':_0x17cc('0x173'),'foreignKey':'AccountId'});db[_0x17cc('0x1cc')]['hasMany'](db[_0x17cc('0x1cc')],{'as':_0x17cc('0x1c2'),'foreignKey':_0x17cc('0x1ca')});db['ZohoField']['hasMany'](db[_0x17cc('0x1cc')],{'as':_0x17cc('0x1c3'),'foreignKey':'DescriptionId'});db[_0x17cc('0x1cc')][_0x17cc('0x11a')](db[_0x17cc('0x1cc')],{'as':_0x17cc('0x1c4'),'foreignKey':_0x17cc('0x1c5')});db[_0x17cc('0x1cc')]['belongsTo'](db[_0x17cc('0x1c6')],{'as':_0x17cc('0x1c6'),'foreignKey':_0x17cc('0x1c7')});db['ZendeskAccount'][_0x17cc('0x11a')](db[_0x17cc('0x1cd')],{'as':_0x17cc('0x1bd'),'onDelete':_0x17cc('0x117'),'foreignKey':_0x17cc('0x1be')});db[_0x17cc('0x1cd')][_0x17cc('0x11a')](db[_0x17cc('0xb4')],{'as':_0x17cc('0x1bf'),'foreignKey':_0x17cc('0x1ca')});db[_0x17cc('0x1cd')][_0x17cc('0x11a')](db[_0x17cc('0xb4')],{'as':_0x17cc('0x1c0'),'foreignKey':_0x17cc('0x1c1')});db['ZendeskConfiguration'][_0x17cc('0x11a')](db[_0x17cc('0xb4')],{'as':_0x17cc('0x1ba'),'foreignKey':_0x17cc('0x1c5')});db['ZendeskConfiguration'][_0x17cc('0x12a')](db[_0x17cc('0xb1')],{'as':_0x17cc('0x173'),'foreignKey':_0x17cc('0x1be')});db[_0x17cc('0x1cd')][_0x17cc('0x12e')](db[_0x17cc('0x87')],{'through':_0x17cc('0x1ce')});db['ZendeskField'][_0x17cc('0x11a')](db[_0x17cc('0xb4')],{'as':'Subject','foreignKey':_0x17cc('0x1ca')});db[_0x17cc('0xb4')][_0x17cc('0x11a')](db['ZendeskField'],{'as':_0x17cc('0x1c3'),'foreignKey':'DescriptionId'});db[_0x17cc('0xb4')][_0x17cc('0x11a')](db[_0x17cc('0xb4')],{'as':_0x17cc('0x1c4'),'foreignKey':'FieldId'});db[_0x17cc('0xb4')]['belongsTo'](db['Variable'],{'as':_0x17cc('0x1c6'),'foreignKey':'VariableId'});db['FreshdeskAccount'][_0x17cc('0x11a')](db[_0x17cc('0xb8')],{'as':_0x17cc('0x1bd'),'onDelete':_0x17cc('0x117'),'foreignKey':'AccountId'});db[_0x17cc('0xb8')][_0x17cc('0x11a')](db[_0x17cc('0xba')],{'as':_0x17cc('0x1bf'),'onDelete':_0x17cc('0x117'),'foreignKey':_0x17cc('0x1ca')});db[_0x17cc('0xb8')][_0x17cc('0x11a')](db[_0x17cc('0xba')],{'as':_0x17cc('0x1c0'),'onDelete':_0x17cc('0x117'),'foreignKey':'DescriptionId'});db[_0x17cc('0xb8')][_0x17cc('0x11a')](db[_0x17cc('0xba')],{'as':_0x17cc('0x1ba'),'onDelete':_0x17cc('0x117'),'foreignKey':_0x17cc('0x1c5')});db[_0x17cc('0xb8')]['belongsTo'](db[_0x17cc('0xb6')],{'as':'Account','foreignKey':_0x17cc('0x1be')});db[_0x17cc('0xb8')][_0x17cc('0x12e')](db['Tag'],{'through':_0x17cc('0x1cf')});db[_0x17cc('0xba')][_0x17cc('0x11a')](db[_0x17cc('0xba')],{'as':_0x17cc('0x1c2'),'foreignKey':'SubjectId'});db[_0x17cc('0xba')][_0x17cc('0x11a')](db[_0x17cc('0xba')],{'as':_0x17cc('0x1c3'),'foreignKey':_0x17cc('0x1c1')});db[_0x17cc('0xba')][_0x17cc('0x11a')](db[_0x17cc('0xba')],{'as':_0x17cc('0x1c4'),'foreignKey':_0x17cc('0x1c5')});db[_0x17cc('0xba')][_0x17cc('0x12a')](db[_0x17cc('0x1c6')],{'as':_0x17cc('0x1c6'),'foreignKey':_0x17cc('0x1c7')});db[_0x17cc('0xbb')][_0x17cc('0x11a')](db[_0x17cc('0xbc')],{'as':_0x17cc('0x1bd'),'onDelete':_0x17cc('0x117'),'foreignKey':_0x17cc('0x1be')});db[_0x17cc('0xbc')][_0x17cc('0x11a')](db[_0x17cc('0xbd')],{'as':'Subjects','foreignKey':_0x17cc('0x1ca')});db['VtigerConfiguration'][_0x17cc('0x11a')](db[_0x17cc('0xbd')],{'as':_0x17cc('0x1c0'),'foreignKey':'DescriptionId'});db[_0x17cc('0xbc')][_0x17cc('0x11a')](db[_0x17cc('0xbd')],{'as':_0x17cc('0x1ba'),'foreignKey':_0x17cc('0x1c5')});db[_0x17cc('0xbc')][_0x17cc('0x12a')](db[_0x17cc('0xbb')],{'as':'Account','foreignKey':'AccountId'});db['VtigerField'][_0x17cc('0x11a')](db[_0x17cc('0xbd')],{'as':_0x17cc('0x1c2'),'foreignKey':'SubjectId'});db[_0x17cc('0xbd')]['hasMany'](db[_0x17cc('0xbd')],{'as':_0x17cc('0x1c3'),'foreignKey':'DescriptionId'});db[_0x17cc('0xbd')][_0x17cc('0x11a')](db[_0x17cc('0xbd')],{'as':'Field','foreignKey':_0x17cc('0x1c5')});db[_0x17cc('0xbd')]['belongsTo'](db[_0x17cc('0x1c6')],{'as':'Variable','foreignKey':'VariableId'});db[_0x17cc('0xbf')]['hasMany'](db[_0x17cc('0xc1')],{'as':_0x17cc('0x1bd'),'onDelete':_0x17cc('0x117'),'foreignKey':'AccountId'});db[_0x17cc('0xc1')][_0x17cc('0x11a')](db['ServicenowField'],{'as':'Subjects','foreignKey':_0x17cc('0x1ca')});db[_0x17cc('0xc1')][_0x17cc('0x11a')](db[_0x17cc('0x1d0')],{'as':_0x17cc('0x1c0'),'foreignKey':'DescriptionId'});db[_0x17cc('0xc1')][_0x17cc('0x11a')](db[_0x17cc('0x1d0')],{'as':_0x17cc('0x1ba'),'foreignKey':_0x17cc('0x1c5')});db[_0x17cc('0xc1')][_0x17cc('0x12a')](db[_0x17cc('0xbf')],{'as':_0x17cc('0x173'),'foreignKey':_0x17cc('0x1be')});db[_0x17cc('0x1d0')][_0x17cc('0x11a')](db[_0x17cc('0x1d0')],{'as':'Subject','foreignKey':_0x17cc('0x1ca')});db['ServicenowField']['hasMany'](db[_0x17cc('0x1d0')],{'as':_0x17cc('0x1c3'),'foreignKey':'DescriptionId'});db[_0x17cc('0x1d0')][_0x17cc('0x11a')](db[_0x17cc('0x1d0')],{'as':_0x17cc('0x1c4'),'foreignKey':'FieldId'});db[_0x17cc('0x1d0')][_0x17cc('0x12a')](db['Variable'],{'as':_0x17cc('0x1c6'),'foreignKey':_0x17cc('0x1c7')});db['Dynamics365Account']['hasMany'](db['Dynamics365Configuration'],{'as':_0x17cc('0x1bd'),'onDelete':_0x17cc('0x117'),'foreignKey':_0x17cc('0x1be')});db[_0x17cc('0xc4')]['belongsTo'](db[_0x17cc('0x10a')],{'as':_0x17cc('0x10a'),'foreignKey':_0x17cc('0x167')});db[_0x17cc('0xc6')]['hasMany'](db[_0x17cc('0xc8')],{'as':'Subjects','onDelete':_0x17cc('0x117'),'foreignKey':_0x17cc('0x1ca')});db[_0x17cc('0xc6')][_0x17cc('0x11a')](db[_0x17cc('0xc8')],{'as':_0x17cc('0x1c0'),'onDelete':_0x17cc('0x117'),'foreignKey':_0x17cc('0x1c1')});db[_0x17cc('0xc6')][_0x17cc('0x11a')](db[_0x17cc('0xc8')],{'as':_0x17cc('0x1ba'),'onDelete':_0x17cc('0x117'),'foreignKey':_0x17cc('0x1c5')});db[_0x17cc('0xc6')][_0x17cc('0x12a')](db[_0x17cc('0xc4')],{'as':_0x17cc('0x173'),'foreignKey':_0x17cc('0x1be')});db[_0x17cc('0xc8')][_0x17cc('0x11a')](db[_0x17cc('0xc8')],{'as':'Subject','foreignKey':_0x17cc('0x1ca')});db['Dynamics365Field']['hasMany'](db[_0x17cc('0xc8')],{'as':_0x17cc('0x1c3'),'foreignKey':_0x17cc('0x1c1')});db['Dynamics365Field'][_0x17cc('0x11a')](db['Dynamics365Field'],{'as':_0x17cc('0x1c4'),'foreignKey':_0x17cc('0x1c5')});db[_0x17cc('0xc8')][_0x17cc('0x12a')](db[_0x17cc('0x1c6')],{'as':'Variable','foreignKey':_0x17cc('0x1c7')});db[_0x17cc('0x1d1')]['hasMany'](db[_0x17cc('0xca')],{'as':_0x17cc('0x1bd'),'onDelete':'cascade','foreignKey':_0x17cc('0x1be')});db['FreshsalesConfiguration'][_0x17cc('0x11a')](db[_0x17cc('0xcc')],{'as':_0x17cc('0x1bf'),'foreignKey':'SubjectId'});db['FreshsalesConfiguration'][_0x17cc('0x11a')](db[_0x17cc('0xcc')],{'as':_0x17cc('0x1c0'),'foreignKey':_0x17cc('0x1c1')});db[_0x17cc('0xca')][_0x17cc('0x11a')](db[_0x17cc('0xcc')],{'as':'Fields','foreignKey':_0x17cc('0x1c5')});db['FreshsalesConfiguration'][_0x17cc('0x12a')](db['FreshsalesAccount'],{'as':'Account','foreignKey':'AccountId'});db[_0x17cc('0xcc')][_0x17cc('0x11a')](db[_0x17cc('0xcc')],{'as':_0x17cc('0x1c2'),'foreignKey':_0x17cc('0x1ca')});db['FreshsalesField'][_0x17cc('0x11a')](db[_0x17cc('0xcc')],{'as':'Description','foreignKey':_0x17cc('0x1c1')});db[_0x17cc('0xcc')][_0x17cc('0x11a')](db[_0x17cc('0xcc')],{'as':_0x17cc('0x1c4'),'foreignKey':_0x17cc('0x1c5')});db['FreshsalesField']['belongsTo'](db['Variable'],{'as':_0x17cc('0x1c6'),'foreignKey':'VariableId'});db[_0x17cc('0xcf')][_0x17cc('0x12a')](db[_0x17cc('0x59')],{});db[_0x17cc('0xcf')][_0x17cc('0x12a')](db[_0x17cc('0xf4')],{'as':_0x17cc('0x16e'),'foreignKey':_0x17cc('0x16f')});db['ChatQueueReport']['belongsTo'](db['CmContact'],{'as':_0x17cc('0x164'),'foreignKey':'ContactId'});db[_0x17cc('0xcf')][_0x17cc('0x12a')](db[_0x17cc('0x5e')],{});db[_0x17cc('0xcf')][_0x17cc('0x12a')](db['ChatMessage'],{});db['ChatQueueReport'][_0x17cc('0x12a')](db[_0x17cc('0x10')],{});db[_0x17cc('0xcf')][_0x17cc('0x12a')](db[_0x17cc('0x63')],{});db['ChatInternalMessage'][_0x17cc('0x12a')](db[_0x17cc('0x10')],{'onDelete':_0x17cc('0x117'),'foreignKey':_0x17cc('0x1d2')});db[_0x17cc('0xd1')][_0x17cc('0x12a')](db[_0x17cc('0x10')],{'onDelete':_0x17cc('0x117'),'foreignKey':_0x17cc('0x1d3')});db[_0x17cc('0xd4')][_0x17cc('0x11a')](db[_0x17cc('0x1d4')],{'foreignKey':_0x17cc('0x1d5'),'onDelete':_0x17cc('0x117')});db['JscriptySessionReport'][_0x17cc('0x11a')](db[_0x17cc('0x1d6')],{'foreignKey':_0x17cc('0x1d5'),'onDelete':_0x17cc('0x117')});db['SmsQueueReport'][_0x17cc('0x12a')](db[_0x17cc('0x4b')],{});db[_0x17cc('0xd6')][_0x17cc('0x12a')](db[_0x17cc('0xf4')],{'as':_0x17cc('0x16e'),'foreignKey':_0x17cc('0x16f')});db['SmsQueueReport'][_0x17cc('0x12a')](db[_0x17cc('0x6b')],{'as':_0x17cc('0x164'),'foreignKey':'ContactId'});db[_0x17cc('0xd6')][_0x17cc('0x12a')](db[_0x17cc('0x4e')],{});db[_0x17cc('0xd6')][_0x17cc('0x12a')](db[_0x17cc('0x189')],{});db['SmsQueueReport']['belongsTo'](db[_0x17cc('0x10')],{});db[_0x17cc('0xd6')][_0x17cc('0x12a')](db[_0x17cc('0x51')],{});db[_0x17cc('0xdb')][_0x17cc('0x11a')](db[_0x17cc('0xd4')],{'foreignKey':_0x17cc('0x1d7')});db[_0x17cc('0xdb')]['hasMany'](db[_0x17cc('0x1d4')],{'foreignKey':_0x17cc('0x1d7')});db[_0x17cc('0xdb')][_0x17cc('0x11a')](db[_0x17cc('0x1d6')],{'foreignKey':_0x17cc('0x1d7')});db[_0x17cc('0xe6')]['belongsToMany'](db['User'],{'as':_0x17cc('0x158'),'through':_0x17cc('0x130')});db['Team'][_0x17cc('0x12e')](db[_0x17cc('0x18')],{'through':_0x17cc('0x15a'),'as':'VoiceQueues'});db['Team'][_0x17cc('0x12e')](db[_0x17cc('0x139')],{'through':_0x17cc('0x1d8'),'as':_0x17cc('0x1d9')});db[_0x17cc('0xe6')]['belongsToMany'](db[_0x17cc('0x63')],{'through':'team_has_chat_queues','as':'ChatQueues'});db[_0x17cc('0xe6')][_0x17cc('0x12e')](db[_0x17cc('0x13b')],{'through':'team_has_fax_queues','as':'FaxQueues'});db[_0x17cc('0xe6')][_0x17cc('0x12e')](db[_0x17cc('0x51')],{'through':_0x17cc('0x18c'),'as':'SmsQueues'});db[_0x17cc('0xe6')][_0x17cc('0x12e')](db[_0x17cc('0x58')],{'through':'team_has_openchannel_queues','as':_0x17cc('0x1da')});db[_0x17cc('0xe6')][_0x17cc('0x12e')](db['WhatsappQueue'],{'through':_0x17cc('0x1db'),'as':_0x17cc('0x13d')});db[_0x17cc('0xe6')]['belongsToMany'](db[_0x17cc('0xf5')],{'through':_0x17cc('0x10d'),'as':_0x17cc('0x138')});db[_0x17cc('0xe8')]['hasMany'](db[_0x17cc('0x128')],{'as':_0x17cc('0x19e'),'foreignKey':'CampaignId'});db[_0x17cc('0xe8')][_0x17cc('0x11a')](db[_0x17cc('0x11d')],{'as':_0x17cc('0x11e'),'foreignKey':_0x17cc('0x1a6')});db[_0x17cc('0xe8')]['hasMany'](db[_0x17cc('0x11f')],{'as':_0x17cc('0x14d'),'foreignKey':_0x17cc('0x1a6')});db[_0x17cc('0xe8')]['hasMany'](db[_0x17cc('0x6e')],{'as':_0x17cc('0x14e'),'foreignKey':_0x17cc('0x1a6')});db[_0x17cc('0xe8')][_0x17cc('0x12a')](db['Trunk'],{'as':_0x17cc('0x150'),'foreignKey':_0x17cc('0x151')});db[_0x17cc('0xe8')][_0x17cc('0x12a')](db['Trunk'],{'as':_0x17cc('0x1dc'),'foreignKey':_0x17cc('0x1dd')});db[_0x17cc('0xe8')][_0x17cc('0x12a')](db[_0x17cc('0x152')],{'as':_0x17cc('0x152'),'foreignKey':_0x17cc('0x153')});db[_0x17cc('0xe8')][_0x17cc('0x12a')](db[_0x17cc('0xe1')],{'as':_0x17cc('0xe1'),'foreignKey':_0x17cc('0x1de')});db[_0x17cc('0xe8')]['belongsToMany'](db[_0x17cc('0xf4')],{'as':_0x17cc('0x12f'),'through':_0x17cc('0x1df')});db[_0x17cc('0xe8')]['belongsToMany'](db['CmList'],{'as':_0x17cc('0x15b'),'through':_0x17cc('0x1e0')});db[_0x17cc('0xea')][_0x17cc('0x12a')](db[_0x17cc('0x198')],{'as':_0x17cc('0x198'),'foreignKey':'ChatOfflineMessageId'});db[_0x17cc('0x1e1')]['belongsTo'](db[_0x17cc('0x3b')],{});db['MailTransferReport']['belongsTo'](db['MailInteraction'],{});db[_0x17cc('0x1e1')][_0x17cc('0x12a')](db['MailAccount'],{'foreignKey':'FromMailAccountId','as':'FromAccount'});db['MailTransferReport']['belongsTo'](db[_0x17cc('0x10')],{'foreignKey':'FromUserId','as':_0x17cc('0x1e2')});db['MailTransferReport']['belongsTo'](db[_0x17cc('0x10')],{'foreignKey':_0x17cc('0x1e3'),'as':'ToAgent'});db[_0x17cc('0x1e1')][_0x17cc('0x12a')](db[_0x17cc('0x139')],{'foreignKey':_0x17cc('0x1e4'),'as':_0x17cc('0x1e5')});db['MailTransferReport'][_0x17cc('0x12a')](db[_0x17cc('0x141')],{'foreignKey':_0x17cc('0x1e6'),'as':_0x17cc('0x1e7')});db[_0x17cc('0xef')]['belongsTo'](db[_0x17cc('0x60')],{});db[_0x17cc('0xef')][_0x17cc('0x12a')](db[_0x17cc('0x5e')],{});db[_0x17cc('0xef')]['belongsTo'](db[_0x17cc('0x59')],{'foreignKey':'FromChatWebsiteId','as':_0x17cc('0x1e8')});db[_0x17cc('0xef')][_0x17cc('0x12a')](db[_0x17cc('0x10')],{'foreignKey':_0x17cc('0x1e9'),'as':'FromAgent'});db[_0x17cc('0xef')]['belongsTo'](db[_0x17cc('0x10')],{'foreignKey':_0x17cc('0x1e3'),'as':_0x17cc('0x1ea')});db[_0x17cc('0xef')][_0x17cc('0x12a')](db[_0x17cc('0x63')],{'foreignKey':_0x17cc('0x1eb'),'as':_0x17cc('0x1e5')});db['ChatTransferReport'][_0x17cc('0x12a')](db[_0x17cc('0x59')],{'foreignKey':'ToChatWebsiteId','as':_0x17cc('0x1e7')});db[_0x17cc('0x1ec')][_0x17cc('0x12a')](db[_0x17cc('0x181')],{});db[_0x17cc('0x1ec')]['belongsTo'](db[_0x17cc('0x48')],{});db[_0x17cc('0x1ec')]['belongsTo'](db[_0x17cc('0x44')],{'foreignKey':'FromFaxAccountId','as':_0x17cc('0x1e8')});db[_0x17cc('0x1ec')]['belongsTo'](db['User'],{'foreignKey':_0x17cc('0x1e9'),'as':_0x17cc('0x1e2')});db[_0x17cc('0x1ec')][_0x17cc('0x12a')](db[_0x17cc('0x10')],{'foreignKey':_0x17cc('0x1e3'),'as':'ToAgent'});db['FaxTransferReport'][_0x17cc('0x12a')](db['FaxQueue'],{'foreignKey':_0x17cc('0x1ed'),'as':_0x17cc('0x1e5')});db[_0x17cc('0x1ec')][_0x17cc('0x12a')](db['FaxAccount'],{'foreignKey':_0x17cc('0x1ee'),'as':_0x17cc('0x1e7')});db[_0x17cc('0xf1')][_0x17cc('0x12a')](db[_0x17cc('0x56')],{});db[_0x17cc('0xf1')]['belongsTo'](db[_0x17cc('0x55')],{});db[_0x17cc('0xf1')]['belongsTo'](db[_0x17cc('0x143')],{'foreignKey':_0x17cc('0x1ef'),'as':_0x17cc('0x1e8')});db[_0x17cc('0xf1')][_0x17cc('0x12a')](db[_0x17cc('0x10')],{'foreignKey':_0x17cc('0x1e9'),'as':'FromAgent'});db['OpenchannelTransferReport']['belongsTo'](db[_0x17cc('0x10')],{'foreignKey':_0x17cc('0x1e3'),'as':_0x17cc('0x1ea')});db[_0x17cc('0xf1')][_0x17cc('0x12a')](db[_0x17cc('0x58')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x17cc('0xf1')][_0x17cc('0x12a')](db['OpenchannelAccount'],{'foreignKey':_0x17cc('0x1f0'),'as':'ToAccount'});db[_0x17cc('0xf3')][_0x17cc('0x12a')](db['SmsMessage'],{});db[_0x17cc('0xf3')][_0x17cc('0x12a')](db[_0x17cc('0x4e')],{});db[_0x17cc('0xf3')][_0x17cc('0x12a')](db['SmsAccount'],{'foreignKey':_0x17cc('0x1f1'),'as':_0x17cc('0x1e8')});db[_0x17cc('0xf3')][_0x17cc('0x12a')](db[_0x17cc('0x10')],{'foreignKey':'FromUserId','as':_0x17cc('0x1e2')});db[_0x17cc('0xf3')][_0x17cc('0x12a')](db[_0x17cc('0x10')],{'foreignKey':_0x17cc('0x1e3'),'as':'ToAgent'});db[_0x17cc('0xf3')][_0x17cc('0x12a')](db[_0x17cc('0x51')],{'foreignKey':_0x17cc('0x1f2'),'as':_0x17cc('0x1e5')});db[_0x17cc('0xf3')][_0x17cc('0x12a')](db[_0x17cc('0x4b')],{'foreignKey':_0x17cc('0x1f3'),'as':_0x17cc('0x1e7')});db[_0x17cc('0xf4')][_0x17cc('0x11a')](db[_0x17cc('0x7a')],{'as':_0x17cc('0x16b'),'foreignKey':_0x17cc('0x16f'),'onDelete':_0x17cc('0x117')});db[_0x17cc('0xf4')][_0x17cc('0x11a')](db[_0x17cc('0x74')],{'as':_0x17cc('0x1f4'),'foreignKey':_0x17cc('0x16f')});db[_0x17cc('0xf4')][_0x17cc('0x11a')](db['CmContact'],{'as':_0x17cc('0x19b'),'onDelete':_0x17cc('0x117'),'foreignKey':'ListId'});db[_0x17cc('0xf4')][_0x17cc('0x11a')](db[_0x17cc('0x11d')],{'as':'HopperFinals','foreignKey':'ListId'});db[_0x17cc('0xf4')]['hasMany'](db[_0x17cc('0x11f')],{'as':_0x17cc('0x1f5'),'foreignKey':'ListId'});db[_0x17cc('0xf4')][_0x17cc('0x11a')](db['ReportAgentPreview'],{'as':_0x17cc('0x72'),'foreignKey':_0x17cc('0x16f')});db[_0x17cc('0xf4')]['belongsToMany'](db[_0x17cc('0x18')],{'as':_0x17cc('0x1f6'),'through':_0x17cc('0x157')});db['CmList'][_0x17cc('0x12e')](db['User'],{'as':_0x17cc('0x158'),'through':_0x17cc('0x13e')});db['VoicePrefix']['hasMany'](db[_0x17cc('0x16')],{'as':'Extensions','onDelete':'cascade'});db[_0x17cc('0xf5')]['belongsToMany'](db[_0x17cc('0x10')],{'as':_0x17cc('0x158'),'through':_0x17cc('0x10f')});db[_0x17cc('0xf5')][_0x17cc('0x12e')](db[_0x17cc('0xe6')],{'through':_0x17cc('0x10d'),'as':_0x17cc('0x159')});db[_0x17cc('0xf7')][_0x17cc('0x11a')](db['User'],{'as':_0x17cc('0x184'),'foreignKey':_0x17cc('0x12b')});db['UserProfile'][_0x17cc('0x11a')](db[_0x17cc('0xf8')],{'as':_0x17cc('0x1f7'),'foreignKey':'userProfileId','onDelete':_0x17cc('0x117')});db[_0x17cc('0xf8')]['hasMany'](db['UserProfileResource'],{'as':_0x17cc('0x1f8'),'foreignKey':'sectionId','onDelete':_0x17cc('0x117')});db[_0x17cc('0xfd')][_0x17cc('0x11a')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x17cc('0x1f9'),'onDelete':'cascade'});db['WhatsappAccount'][_0x17cc('0x11a')](db[_0x17cc('0x17e')],{'as':_0x17cc('0x16c'),'foreignKey':_0x17cc('0x1f9')});db[_0x17cc('0xfd')][_0x17cc('0x11a')](db[_0x17cc('0x102')],{'as':'Messages','foreignKey':_0x17cc('0x1f9')});db['WhatsappAccount'][_0x17cc('0x11a')](db[_0x17cc('0x100')],{'as':'Interactions'});db[_0x17cc('0xfd')]['hasMany'](db[_0x17cc('0xff')],{'as':'Applications','foreignKey':_0x17cc('0x1f9'),'onDelete':_0x17cc('0x117')});db[_0x17cc('0xfd')]['belongsTo'](db[_0x17cc('0xf4')],{'as':'List','foreignKey':_0x17cc('0x16f')});db[_0x17cc('0xfd')][_0x17cc('0x12a')](db[_0x17cc('0x154')],{'as':_0x17cc('0x155'),'foreignKey':_0x17cc('0x156')});db['WhatsappAccount']['belongsToMany'](db[_0x17cc('0x10')],{'as':_0x17cc('0x158'),'through':_0x17cc('0x146')});db[_0x17cc('0xff')][_0x17cc('0x12a')](db[_0x17cc('0x10')],{'onDelete':_0x17cc('0x168')});db[_0x17cc('0xff')]['belongsTo'](db[_0x17cc('0x108')],{'onDelete':'restrict'});db[_0x17cc('0xff')][_0x17cc('0x12a')](db[_0x17cc('0xfd')],{'onDelete':_0x17cc('0x168')});db['WhatsappApplication'][_0x17cc('0x12a')](db['Interval'],{'onDelete':'restrict','foreignKey':_0x17cc('0x153')});db[_0x17cc('0xff')][_0x17cc('0x12a')](db[_0x17cc('0x87')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0x17cc('0x100')][_0x17cc('0x11a')](db[_0x17cc('0x102')],{'as':_0x17cc('0x15e'),'onDelete':_0x17cc('0x117'),'foreignKey':_0x17cc('0x1fa')});db[_0x17cc('0x100')][_0x17cc('0x12a')](db[_0x17cc('0xfd')],{'as':'Account','foreignKey':_0x17cc('0x1f9')});db['WhatsappInteraction'][_0x17cc('0x12a')](db[_0x17cc('0x6b')],{'as':'Contact','foreignKey':_0x17cc('0x165')});db[_0x17cc('0x100')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x17cc('0x118')});db[_0x17cc('0x100')][_0x17cc('0x12e')](db['Tag'],{'through':_0x17cc('0x1fb'),'as':'Tags'});db['WhatsappInteraction'][_0x17cc('0x12e')](db[_0x17cc('0x87')],{'through':_0x17cc('0x1fb'),'as':_0x17cc('0x177')});db[_0x17cc('0x100')][_0x17cc('0x12e')](db[_0x17cc('0x10')],{'as':'Users','through':_0x17cc('0x135'),'foreignKey':'WhatsappInteractionId'});db[_0x17cc('0x102')][_0x17cc('0x12a')](db[_0x17cc('0x10')],{'as':_0x17cc('0x10')});db[_0x17cc('0x102')]['belongsTo'](db[_0x17cc('0x6b')],{'onDelete':'cascade','as':'Contact'});db[_0x17cc('0x102')][_0x17cc('0x12a')](db[_0x17cc('0x100')],{'onDelete':_0x17cc('0x117'),'as':_0x17cc('0x179'),'foreignKey':_0x17cc('0x1fa')});db['WhatsappMessage'][_0x17cc('0x12a')](db[_0x17cc('0xfd')],{'as':_0x17cc('0x173'),'foreignKey':'WhatsappAccountId'});db[_0x17cc('0x104')]['belongsTo'](db[_0x17cc('0xfd')],{});db[_0x17cc('0x104')][_0x17cc('0x12a')](db['CmList'],{'as':_0x17cc('0x16e'),'foreignKey':_0x17cc('0x16f')});db[_0x17cc('0x104')]['belongsTo'](db[_0x17cc('0x6b')],{'as':_0x17cc('0x164'),'foreignKey':_0x17cc('0x165')});db[_0x17cc('0x104')][_0x17cc('0x12a')](db[_0x17cc('0x100')],{});db[_0x17cc('0x104')]['belongsTo'](db[_0x17cc('0x108')],{});db[_0x17cc('0x104')][_0x17cc('0x12a')](db[_0x17cc('0x102')],{});db[_0x17cc('0x104')][_0x17cc('0x12a')](db[_0x17cc('0x10')],{});db['WhatsappTransferReport'][_0x17cc('0x12a')](db['WhatsappMessage'],{});db[_0x17cc('0x106')][_0x17cc('0x12a')](db[_0x17cc('0x100')],{});db[_0x17cc('0x106')][_0x17cc('0x12a')](db[_0x17cc('0xfd')],{'foreignKey':'FromWhatsappAccountId','as':_0x17cc('0x1e8')});db['WhatsappTransferReport'][_0x17cc('0x12a')](db[_0x17cc('0xfd')],{'foreignKey':_0x17cc('0x1fc'),'as':_0x17cc('0x1e7')});db['WhatsappTransferReport'][_0x17cc('0x12a')](db['WhatsappQueue'],{'foreignKey':'ToQueueId','as':_0x17cc('0x1e5')});db[_0x17cc('0x106')][_0x17cc('0x12a')](db[_0x17cc('0x10')],{'foreignKey':_0x17cc('0x1e9'),'as':'FromAgent'});db[_0x17cc('0x106')][_0x17cc('0x12a')](db[_0x17cc('0x10')],{'foreignKey':_0x17cc('0x1e3'),'as':_0x17cc('0x1ea')});db[_0x17cc('0x108')][_0x17cc('0x12e')](db[_0x17cc('0x10')],{'as':'Agents','through':_0x17cc('0x30'),'foreignKey':_0x17cc('0x1fd')});db[_0x17cc('0x108')][_0x17cc('0x12e')](db['Team'],{'through':_0x17cc('0x1db'),'as':_0x17cc('0x159')});db['UserSetting'][_0x17cc('0x12a')](db[_0x17cc('0x10')],{'as':'user','foreignKey':_0x17cc('0x118'),'onDelete':_0x17cc('0x117'),'hooks':!![]});db[_0x17cc('0x10a')][_0x17cc('0x115')](db[_0x17cc('0xc4')],{'as':_0x17cc('0xc4'),'onDelete':_0x17cc('0x168')});db[_0x17cc('0x10a')][_0x17cc('0x115')](db[_0x17cc('0x32')],{'as':'Imap','onDelete':_0x17cc('0x168')});db['CloudProvider']['hasOne'](db[_0x17cc('0x34')],{'as':_0x17cc('0x16a'),'onDelete':'restrict'});module[_0x17cc('0x1fe')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 357dda2..2e6ff16 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0x4600=['./api/condition','/api/intervals','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','/api/sounds','./api/sound','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','/api/triggers','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','./api/analyticTreeReport','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmField','/api/integrations/desk/accounts','/api/integrations/desk/configurations','/api/integrations/desk/fields','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/fields','./api/intFreshdeskField','./api/intVtigerAccount','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','./api/chatInternalMessage','/api/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','/api/sms/reports/queue','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','/api/settings','./api/setting','/api/square/odbc','/api/square/projects','./api/squareProject','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','/api/migrations','/api/attachments','./api/attachment','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','/api/openchannel/reports/transfer','./api/openchannelTransferReport','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/userProfiles','./api/userProfile','./api/userProfileSection','./api/userProfileResource','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/user-setting','/api/mail_interaction_has_tags','./api/mailInteractionHasTag','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/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','sendFile','resolve','appPath','/index.html','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','then','use','/api/users','./api/user','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','./api/voiceRecording','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','/api/voice/calls/reports','/api/voice/dials/reports','./api/voiceDialReport','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','./api/trunk','/api/mail/out_servers','./api/mailServerOut','./api/mailAccount','./api/mailQueue','/api/mail/substatuses','/api/mail/interactions','./api/mailMessage','./api/mailApplication','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','./api/openchannelQueueReport','/api/chat/applications','/api/chat/messages','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/cannedAnswer','/api/dispositions','./api/disposition'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x4600,0xad));var _0x0460=function(_0x2e70b4,_0x41a477){_0x2e70b4=_0x2e70b4-0x0;var _0x27aeaa=_0x4600[_0x2e70b4];return _0x27aeaa;};'use strict';var path=require('path');var express=require(_0x0460('0x0'));var errors=require(_0x0460('0x1'));var config=require(_0x0460('0x2'));var setupLoggers=require(_0x0460('0x3'))[_0x0460('0x4')];var clientSideLogs=require('./api/client-side-logs');exports['default']=function(_0x467254){return setupLoggers(_0x467254)[_0x0460('0x5')](function(){_0x467254[_0x0460('0x6')](_0x0460('0x7'),require(_0x0460('0x8')));_0x467254[_0x0460('0x6')]('/api/voice/chanspy',require(_0x0460('0x9')));_0x467254['use'](_0x0460('0xa'),require(_0x0460('0xb')));_0x467254['use'](_0x0460('0xc'),require(_0x0460('0xd')));_0x467254['use'](_0x0460('0xe'),require(_0x0460('0xf')));_0x467254['use'](_0x0460('0x10'),require(_0x0460('0x11')));_0x467254[_0x0460('0x6')]('/api/voice/recordings',require(_0x0460('0x12')));_0x467254[_0x0460('0x6')]('/api/screen/recordings',require(_0x0460('0x13')));_0x467254[_0x0460('0x6')](_0x0460('0x14'),require(_0x0460('0x15')));_0x467254['use'](_0x0460('0x16'),require('./api/voiceMailMessage'));_0x467254[_0x0460('0x6')](_0x0460('0x17'),require('./api/voiceCallReport'));_0x467254['use'](_0x0460('0x18'),require(_0x0460('0x19')));_0x467254[_0x0460('0x6')]('/api/voice/agents/reports',require(_0x0460('0x1a')));_0x467254['use'](_0x0460('0x1b'),require(_0x0460('0x1c')));_0x467254[_0x0460('0x6')](_0x0460('0x1d'),require(_0x0460('0x1e')));_0x467254[_0x0460('0x6')]('/api/trunks',require(_0x0460('0x1f')));_0x467254[_0x0460('0x6')]('/api/voice/transfers/reports',require('./api/voiceTransferReport'));_0x467254[_0x0460('0x6')](_0x0460('0x20'),require(_0x0460('0x21')));_0x467254[_0x0460('0x6')]('/api/mail/accounts',require(_0x0460('0x22')));_0x467254['use']('/api/mail/queues',require(_0x0460('0x23')));_0x467254[_0x0460('0x6')](_0x0460('0x24'),require('./api/mailSubstatus'));_0x467254[_0x0460('0x6')](_0x0460('0x25'),require('./api/mailInteraction'));_0x467254[_0x0460('0x6')]('/api/mail/messages',require(_0x0460('0x26')));_0x467254['use']('/api/mail/applications',require(_0x0460('0x27')));_0x467254[_0x0460('0x6')]('/api/mail/reports/queue',require(_0x0460('0x28')));_0x467254[_0x0460('0x6')](_0x0460('0x29'),require(_0x0460('0x2a')));_0x467254[_0x0460('0x6')](_0x0460('0x2b'),require('./api/dashboardItem'));_0x467254['use'](_0x0460('0x2c'),require(_0x0460('0x2d')));_0x467254[_0x0460('0x6')](_0x0460('0x2e'),require(_0x0460('0x2f')));_0x467254[_0x0460('0x6')](_0x0460('0x30'),require('./api/faxInteraction'));_0x467254['use']('/api/fax/messages',require(_0x0460('0x31')));_0x467254[_0x0460('0x6')](_0x0460('0x32'),require(_0x0460('0x33')));_0x467254['use'](_0x0460('0x34'),require('./api/faxQueueReport'));_0x467254[_0x0460('0x6')]('/api/sms/accounts',require(_0x0460('0x35')));_0x467254[_0x0460('0x6')](_0x0460('0x36'),require(_0x0460('0x37')));_0x467254[_0x0460('0x6')](_0x0460('0x38'),require(_0x0460('0x39')));_0x467254['use'](_0x0460('0x3a'),require(_0x0460('0x3b')));_0x467254[_0x0460('0x6')]('/api/sms/queues',require(_0x0460('0x3c')));_0x467254['use'](_0x0460('0x3d'),require(_0x0460('0x3e')));_0x467254['use'](_0x0460('0x3f'),require('./api/openchannelApplication'));_0x467254[_0x0460('0x6')]('/api/openchannel/interactions',require(_0x0460('0x40')));_0x467254[_0x0460('0x6')](_0x0460('0x41'),require(_0x0460('0x42')));_0x467254[_0x0460('0x6')](_0x0460('0x43'),require(_0x0460('0x44')));_0x467254[_0x0460('0x6')](_0x0460('0x45'),require(_0x0460('0x46')));_0x467254[_0x0460('0x6')]('/api/openchannel/reports/queue',require(_0x0460('0x47')));_0x467254[_0x0460('0x6')](_0x0460('0x48'),require('./api/chatApplication'));_0x467254['use']('/api/chat/interactions',require('./api/chatInteraction'));_0x467254[_0x0460('0x6')](_0x0460('0x49'),require('./api/chatMessage'));_0x467254[_0x0460('0x6')](_0x0460('0x4a'),require(_0x0460('0x4b')));_0x467254[_0x0460('0x6')](_0x0460('0x4c'),require(_0x0460('0x4d')));_0x467254[_0x0460('0x6')](_0x0460('0x4e'),require(_0x0460('0x4f')));_0x467254[_0x0460('0x6')](_0x0460('0x50'),require(_0x0460('0x51')));_0x467254[_0x0460('0x6')](_0x0460('0x52'),require(_0x0460('0x53')));_0x467254[_0x0460('0x6')](_0x0460('0x54'),require(_0x0460('0x55')));_0x467254['use']('/api/cm/hopper',require('./api/cmHopper'));_0x467254['use'](_0x0460('0x56'),require(_0x0460('0x57')));_0x467254['use'](_0x0460('0x58'),require(_0x0460('0x59')));_0x467254[_0x0460('0x6')](_0x0460('0x5a'),require('./api/cmHopperHistory'));_0x467254[_0x0460('0x6')]('/api/cm/custom_fields',require(_0x0460('0x5b')));_0x467254[_0x0460('0x6')](_0x0460('0x5c'),require(_0x0460('0x5d')));_0x467254[_0x0460('0x6')](_0x0460('0x5e'),require('./api/automation'));_0x467254['use']('/api/canned_answers',require(_0x0460('0x5f')));_0x467254['use'](_0x0460('0x60'),require(_0x0460('0x61')));_0x467254[_0x0460('0x6')]('/api/conditions',require(_0x0460('0x62')));_0x467254[_0x0460('0x6')](_0x0460('0x63'),require('./api/interval'));_0x467254[_0x0460('0x6')](_0x0460('0x64'),require(_0x0460('0x65')));_0x467254[_0x0460('0x6')](_0x0460('0x66'),require(_0x0460('0x67')));_0x467254[_0x0460('0x6')](_0x0460('0x68'),require(_0x0460('0x69')));_0x467254[_0x0460('0x6')](_0x0460('0x6a'),require('./api/schedule'));_0x467254['use'](_0x0460('0x6b'),require(_0x0460('0x6c')));_0x467254['use'](_0x0460('0x6d'),require(_0x0460('0x6e')));_0x467254['use'](_0x0460('0x6f'),require(_0x0460('0x70')));_0x467254['use'](_0x0460('0x71'),require('./api/cmContactHasItem'));_0x467254[_0x0460('0x6')](_0x0460('0x72'),require(_0x0460('0x73')));_0x467254[_0x0460('0x6')](_0x0460('0x74'),require('./api/template'));_0x467254[_0x0460('0x6')](_0x0460('0x75'),require('./api/trigger'));_0x467254[_0x0460('0x6')]('/api/variables',require(_0x0460('0x76')));_0x467254['use'](_0x0460('0x77'),require(_0x0460('0x78')));_0x467254[_0x0460('0x6')](_0x0460('0x79'),require(_0x0460('0x7a')));_0x467254[_0x0460('0x6')](_0x0460('0x7b'),require('./api/analyticCustomReport'));_0x467254['use'](_0x0460('0x7c'),require(_0x0460('0x7d')));_0x467254[_0x0460('0x6')](_0x0460('0x7e'),require(_0x0460('0x7f')));_0x467254[_0x0460('0x6')]('/api/analytics/metrics',require(_0x0460('0x80')));_0x467254[_0x0460('0x6')](_0x0460('0x81'),require(_0x0460('0x82')));_0x467254['use']('/api/analytics/tree_reports',require(_0x0460('0x83')));_0x467254[_0x0460('0x6')]('/api/integrations/salesforce/accounts',require(_0x0460('0x84')));_0x467254[_0x0460('0x6')]('/api/integrations/salesforce/configurations',require(_0x0460('0x85')));_0x467254['use'](_0x0460('0x86'),require(_0x0460('0x87')));_0x467254[_0x0460('0x6')]('/api/integrations/sugarcrm/accounts',require(_0x0460('0x88')));_0x467254[_0x0460('0x6')](_0x0460('0x89'),require('./api/intSugarcrmConfiguration'));_0x467254[_0x0460('0x6')]('/api/integrations/sugarcrm/fields',require(_0x0460('0x8a')));_0x467254[_0x0460('0x6')](_0x0460('0x8b'),require('./api/intDeskAccount'));_0x467254[_0x0460('0x6')](_0x0460('0x8c'),require('./api/intDeskConfiguration'));_0x467254[_0x0460('0x6')](_0x0460('0x8d'),require(_0x0460('0x8e')));_0x467254['use']('/api/integrations/zoho/accounts',require(_0x0460('0x8f')));_0x467254[_0x0460('0x6')](_0x0460('0x90'),require(_0x0460('0x91')));_0x467254[_0x0460('0x6')](_0x0460('0x92'),require(_0x0460('0x93')));_0x467254[_0x0460('0x6')]('/api/integrations/zendesk/accounts',require(_0x0460('0x94')));_0x467254[_0x0460('0x6')](_0x0460('0x95'),require(_0x0460('0x96')));_0x467254[_0x0460('0x6')](_0x0460('0x97'),require(_0x0460('0x98')));_0x467254[_0x0460('0x6')](_0x0460('0x99'),require('./api/intFreshdeskAccount'));_0x467254[_0x0460('0x6')]('/api/integrations/freshdesk/configurations',require('./api/intFreshdeskConfiguration'));_0x467254[_0x0460('0x6')](_0x0460('0x9a'),require(_0x0460('0x9b')));_0x467254[_0x0460('0x6')]('/api/integrations/vtiger/accounts',require(_0x0460('0x9c')));_0x467254[_0x0460('0x6')]('/api/integrations/vtiger/configurations',require(_0x0460('0x9d')));_0x467254[_0x0460('0x6')](_0x0460('0x9e'),require('./api/intVtigerField'));_0x467254[_0x0460('0x6')](_0x0460('0x9f'),require(_0x0460('0xa0')));_0x467254[_0x0460('0x6')](_0x0460('0xa1'),require(_0x0460('0xa2')));_0x467254[_0x0460('0x6')](_0x0460('0xa3'),require('./api/intServicenowField'));_0x467254[_0x0460('0x6')](_0x0460('0xa4'),require(_0x0460('0xa5')));_0x467254[_0x0460('0x6')](_0x0460('0xa6'),require(_0x0460('0xa7')));_0x467254[_0x0460('0x6')](_0x0460('0xa8'),require(_0x0460('0xa9')));_0x467254[_0x0460('0x6')](_0x0460('0xaa'),require(_0x0460('0xab')));_0x467254[_0x0460('0x6')](_0x0460('0xac'),require(_0x0460('0xad')));_0x467254[_0x0460('0x6')](_0x0460('0xae'),require('./api/intFreshsalesField'));_0x467254[_0x0460('0x6')](_0x0460('0xaf'),require(_0x0460('0xb0')));_0x467254[_0x0460('0x6')](_0x0460('0xb1'),require(_0x0460('0xb2')));_0x467254[_0x0460('0x6')]('/api/chat/internal/messages',require(_0x0460('0xb3')));_0x467254[_0x0460('0x6')](_0x0460('0xb4'),require('./api/jscriptyAnswerReport'));_0x467254[_0x0460('0x6')](_0x0460('0xb5'),require(_0x0460('0xb6')));_0x467254[_0x0460('0x6')](_0x0460('0xb7'),require('./api/jscriptySessionReport'));_0x467254['use'](_0x0460('0xb8'),require('./api/smsQueueReport'));_0x467254[_0x0460('0x6')](_0x0460('0xb9'),require(_0x0460('0xba')));_0x467254[_0x0460('0x6')](_0x0460('0xbb'),require(_0x0460('0xbc')));_0x467254[_0x0460('0x6')](_0x0460('0xbd'),require('./api/jscriptyProject'));_0x467254[_0x0460('0x6')](_0x0460('0xbe'),require(_0x0460('0xbf')));_0x467254[_0x0460('0x6')](_0x0460('0xc0'),require('./api/squareOdbc'));_0x467254[_0x0460('0x6')](_0x0460('0xc1'),require(_0x0460('0xc2')));_0x467254[_0x0460('0x6')]('/api/square/recordings',require(_0x0460('0xc3')));_0x467254['use'](_0x0460('0xc4'),require(_0x0460('0xc5')));_0x467254[_0x0460('0x6')](_0x0460('0xc6'),require(_0x0460('0xc7')));_0x467254[_0x0460('0x6')](_0x0460('0xc8'),require(_0x0460('0xc9')));_0x467254[_0x0460('0x6')](_0x0460('0xca'),require('./api/campaign'));_0x467254[_0x0460('0x6')](_0x0460('0xcb'),require('./api/migration'));_0x467254[_0x0460('0x6')](_0x0460('0xcc'),require(_0x0460('0xcd')));_0x467254[_0x0460('0x6')]('/api/plugins',require(_0x0460('0xce')));_0x467254[_0x0460('0x6')](_0x0460('0xcf'),require(_0x0460('0xd0')));_0x467254[_0x0460('0x6')](_0x0460('0xd1'),require(_0x0460('0xd2')));_0x467254['use'](_0x0460('0xd3'),require('./api/faxTransferReport'));_0x467254[_0x0460('0x6')](_0x0460('0xd4'),require(_0x0460('0xd5')));_0x467254[_0x0460('0x6')]('/api/sms/reports/transfer',require(_0x0460('0xd6')));_0x467254['use'](_0x0460('0xd7'),require(_0x0460('0xd8')));_0x467254[_0x0460('0x6')]('/api/voice/prefixes',require('./api/voicePrefix'));_0x467254[_0x0460('0x6')](_0x0460('0xd9'),require(_0x0460('0xda')));_0x467254[_0x0460('0x6')]('/api/userProfile/sections',require(_0x0460('0xdb')));_0x467254[_0x0460('0x6')]('/api/userProfile/resources',require(_0x0460('0xdc')));_0x467254[_0x0460('0x6')]('/api/userNotifications',require(_0x0460('0xdd')));_0x467254[_0x0460('0x6')](_0x0460('0xde'),require(_0x0460('0xdf')));_0x467254[_0x0460('0x6')]('/api/whatsapp/applications',require(_0x0460('0xe0')));_0x467254[_0x0460('0x6')](_0x0460('0xe1'),require(_0x0460('0xe2')));_0x467254['use'](_0x0460('0xe3'),require('./api/whatsappMessage'));_0x467254['use'](_0x0460('0xe4'),require(_0x0460('0xe5')));_0x467254['use'](_0x0460('0xe6'),require('./api/whatsappTransferReport'));_0x467254['use'](_0x0460('0xe7'),require(_0x0460('0xe8')));_0x467254[_0x0460('0x6')](_0x0460('0xe9'),require(_0x0460('0xea')));_0x467254['use'](_0x0460('0xeb'),require('./api/realtime'));_0x467254['use']('/api/user-settings',require(_0x0460('0xec')));_0x467254[_0x0460('0x6')](_0x0460('0xed'),require(_0x0460('0xee')));_0x467254[_0x0460('0x6')]('/api/auth/local',require('./api/authLocal'));_0x467254[_0x0460('0x6')](_0x0460('0xef'),require(_0x0460('0xf0')));_0x467254['use']('/api/auth/activedirectory',require('./api/authActiveDirectory'));_0x467254[_0x0460('0x6')](_0x0460('0xf1'),require(_0x0460('0xf2')));_0x467254[_0x0460('0x6')](_0x0460('0xf3'),require(_0x0460('0xf4')));_0x467254[_0x0460('0x6')](_0x0460('0xf5'),require(_0x0460('0xf6')));_0x467254['use'](_0x0460('0xf7'),require(_0x0460('0xf8')));_0x467254[_0x0460('0x6')](_0x0460('0xf9'),require(_0x0460('0xfa')));_0x467254['use'](_0x0460('0xfb'),require('./api/webbar'));_0x467254[_0x0460('0x6')](_0x0460('0xfc'),clientSideLogs);_0x467254['use'](_0x0460('0xfd'),express[_0x0460('0xfe')](path[_0x0460('0xff')](config[_0x0460('0x100')],_0x0460('0xfd'))));_0x467254[_0x0460('0x6')](_0x0460('0x101'),express['static'](path[_0x0460('0xff')](config['root'],_0x0460('0x101'))));_0x467254[_0x0460('0x6')]('/demo',express[_0x0460('0xfe')](path[_0x0460('0xff')](config[_0x0460('0x100')],_0x0460('0x102'))));_0x467254['use'](_0x0460('0x103'),express['static'](path[_0x0460('0xff')](config[_0x0460('0x100')],_0x0460('0x104'),_0x0460('0x105'))));_0x467254[_0x0460('0x6')](_0x0460('0x106'),express[_0x0460('0xfe')](path[_0x0460('0xff')](config[_0x0460('0x100')],_0x0460('0x107'))));_0x467254[_0x0460('0x108')](_0x0460('0x109'))[_0x0460('0x10a')](errors[0x194]);_0x467254['route']('/*')[_0x0460('0x10a')](function(_0x3bea26,_0x6ebffd){_0x6ebffd[_0x0460('0x10b')](path[_0x0460('0x10c')](_0x467254[_0x0460('0x10a')](_0x0460('0x10d'))+_0x0460('0x10e')));});return _0x467254;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 64b1d80..1ac2244 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0xf99d=['../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/pause/pause.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc'];(function(_0x482115,_0x5550f5){var _0x40afb4=function(_0x44ce30){while(--_0x44ce30){_0x482115['push'](_0x482115['shift']());}};_0x40afb4(++_0x5550f5);}(_0xf99d,0x165));var _0xdf99=function(_0x15c421,_0x6366f7){_0x15c421=_0x15c421-0x0;var _0x5e5ed5=_0xf99d[_0x15c421];return _0x5e5ed5;};'use strict';var jayson=require('jayson/promise');var _=require('lodash');var config=require('../config/environment');exports[_0xdf99('0x0')]=function(){return new Promise(function(_0xc6e6da,_0x60cc1e){var _0x2a6eae={};_0x2a6eae=_[_0xdf99('0x1')](_0x2a6eae,require(_0xdf99('0x2')));_0x2a6eae=_['merge'](_0x2a6eae,require(_0xdf99('0x3')));_0x2a6eae=_[_0xdf99('0x1')](_0x2a6eae,require(_0xdf99('0x4')));_0x2a6eae=_[_0xdf99('0x1')](_0x2a6eae,require(_0xdf99('0x5')));_0x2a6eae=_['merge'](_0x2a6eae,require(_0xdf99('0x6')));_0x2a6eae=_[_0xdf99('0x1')](_0x2a6eae,require(_0xdf99('0x7')));_0x2a6eae=_[_0xdf99('0x1')](_0x2a6eae,require(_0xdf99('0x8')));_0x2a6eae=_[_0xdf99('0x1')](_0x2a6eae,require(_0xdf99('0x9')));_0x2a6eae=_[_0xdf99('0x1')](_0x2a6eae,require('../api/memberReport/memberReport.rpc'));_0x2a6eae=_[_0xdf99('0x1')](_0x2a6eae,require('../api/trunk/trunk.rpc'));_0x2a6eae=_['merge'](_0x2a6eae,require(_0xdf99('0xa')));_0x2a6eae=_[_0xdf99('0x1')](_0x2a6eae,require(_0xdf99('0xb')));_0x2a6eae=_['merge'](_0x2a6eae,require(_0xdf99('0xc')));_0x2a6eae=_['merge'](_0x2a6eae,require(_0xdf99('0xd')));_0x2a6eae=_[_0xdf99('0x1')](_0x2a6eae,require(_0xdf99('0xe')));_0x2a6eae=_[_0xdf99('0x1')](_0x2a6eae,require(_0xdf99('0xf')));_0x2a6eae=_[_0xdf99('0x1')](_0x2a6eae,require(_0xdf99('0x10')));_0x2a6eae=_[_0xdf99('0x1')](_0x2a6eae,require(_0xdf99('0x11')));_0x2a6eae=_[_0xdf99('0x1')](_0x2a6eae,require(_0xdf99('0x12')));_0x2a6eae=_[_0xdf99('0x1')](_0x2a6eae,require(_0xdf99('0x13')));_0x2a6eae=_['merge'](_0x2a6eae,require(_0xdf99('0x14')));_0x2a6eae=_['merge'](_0x2a6eae,require(_0xdf99('0x15')));_0x2a6eae=_[_0xdf99('0x1')](_0x2a6eae,require(_0xdf99('0x16')));_0x2a6eae=_[_0xdf99('0x1')](_0x2a6eae,require(_0xdf99('0x17')));_0x2a6eae=_[_0xdf99('0x1')](_0x2a6eae,require(_0xdf99('0x18')));_0x2a6eae=_['merge'](_0x2a6eae,require('../api/smsAccount/smsAccount.rpc'));_0x2a6eae=_[_0xdf99('0x1')](_0x2a6eae,require(_0xdf99('0x19')));_0x2a6eae=_[_0xdf99('0x1')](_0x2a6eae,require('../api/smsMessage/smsMessage.rpc'));_0x2a6eae=_['merge'](_0x2a6eae,require(_0xdf99('0x1a')));_0x2a6eae=_[_0xdf99('0x1')](_0x2a6eae,require(_0xdf99('0x1b')));_0x2a6eae=_[_0xdf99('0x1')](_0x2a6eae,require(_0xdf99('0x1c')));_0x2a6eae=_[_0xdf99('0x1')](_0x2a6eae,require(_0xdf99('0x1d')));_0x2a6eae=_[_0xdf99('0x1')](_0x2a6eae,require(_0xdf99('0x1e')));_0x2a6eae=_[_0xdf99('0x1')](_0x2a6eae,require(_0xdf99('0x1f')));_0x2a6eae=_[_0xdf99('0x1')](_0x2a6eae,require('../api/chatInteraction/chatInteraction.rpc'));_0x2a6eae=_['merge'](_0x2a6eae,require(_0xdf99('0x20')));_0x2a6eae=_[_0xdf99('0x1')](_0x2a6eae,require(_0xdf99('0x21')));_0x2a6eae=_[_0xdf99('0x1')](_0x2a6eae,require(_0xdf99('0x22')));_0x2a6eae=_[_0xdf99('0x1')](_0x2a6eae,require('../api/cmHopper/cmHopper.rpc'));_0x2a6eae=_[_0xdf99('0x1')](_0x2a6eae,require(_0xdf99('0x23')));_0x2a6eae=_[_0xdf99('0x1')](_0x2a6eae,require(_0xdf99('0x24')));_0x2a6eae=_['merge'](_0x2a6eae,require(_0xdf99('0x25')));_0x2a6eae=_[_0xdf99('0x1')](_0x2a6eae,require(_0xdf99('0x26')));_0x2a6eae=_[_0xdf99('0x1')](_0x2a6eae,require('../api/interval/interval.rpc'));_0x2a6eae=_[_0xdf99('0x1')](_0x2a6eae,require(_0xdf99('0x27')));_0x2a6eae=_[_0xdf99('0x1')](_0x2a6eae,require('../api/sound/sound.rpc'));_0x2a6eae=_[_0xdf99('0x1')](_0x2a6eae,require(_0xdf99('0x28')));_0x2a6eae=_[_0xdf99('0x1')](_0x2a6eae,require(_0xdf99('0x29')));_0x2a6eae=_['merge'](_0x2a6eae,require(_0xdf99('0x2a')));_0x2a6eae=_[_0xdf99('0x1')](_0x2a6eae,require(_0xdf99('0x2b')));_0x2a6eae=_[_0xdf99('0x1')](_0x2a6eae,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x2a6eae=_[_0xdf99('0x1')](_0x2a6eae,require(_0xdf99('0x2c')));_0x2a6eae=_['merge'](_0x2a6eae,require(_0xdf99('0x2d')));_0x2a6eae=_['merge'](_0x2a6eae,require(_0xdf99('0x2e')));_0x2a6eae=_[_0xdf99('0x1')](_0x2a6eae,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x2a6eae=_[_0xdf99('0x1')](_0x2a6eae,require(_0xdf99('0x2f')));_0x2a6eae=_[_0xdf99('0x1')](_0x2a6eae,require(_0xdf99('0x30')));_0x2a6eae=_[_0xdf99('0x1')](_0x2a6eae,require(_0xdf99('0x31')));_0x2a6eae=_[_0xdf99('0x1')](_0x2a6eae,require(_0xdf99('0x32')));_0x2a6eae=_[_0xdf99('0x1')](_0x2a6eae,require(_0xdf99('0x33')));_0x2a6eae=_[_0xdf99('0x1')](_0x2a6eae,require(_0xdf99('0x34')));_0x2a6eae=_[_0xdf99('0x1')](_0x2a6eae,require(_0xdf99('0x35')));_0x2a6eae=_[_0xdf99('0x1')](_0x2a6eae,require(_0xdf99('0x36')));_0x2a6eae=_[_0xdf99('0x1')](_0x2a6eae,require(_0xdf99('0x37')));_0x2a6eae=_[_0xdf99('0x1')](_0x2a6eae,require(_0xdf99('0x38')));_0x2a6eae=_[_0xdf99('0x1')](_0x2a6eae,require(_0xdf99('0x39')));_0x2a6eae=_[_0xdf99('0x1')](_0x2a6eae,require(_0xdf99('0x3a')));_0x2a6eae=_[_0xdf99('0x1')](_0x2a6eae,require(_0xdf99('0x3b')));_0x2a6eae=_[_0xdf99('0x1')](_0x2a6eae,require(_0xdf99('0x3c')));_0x2a6eae=_[_0xdf99('0x1')](_0x2a6eae,require(_0xdf99('0x3d')));_0x2a6eae=_['merge'](_0x2a6eae,require('../api/attachment/attachment.rpc'));_0x2a6eae=_[_0xdf99('0x1')](_0x2a6eae,require('../api/plugin/plugin.rpc'));_0x2a6eae=_[_0xdf99('0x1')](_0x2a6eae,require(_0xdf99('0x3e')));_0x2a6eae=_['merge'](_0x2a6eae,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x2a6eae=_['merge'](_0x2a6eae,require(_0xdf99('0x3f')));_0x2a6eae=_[_0xdf99('0x1')](_0x2a6eae,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x2a6eae=_['merge'](_0x2a6eae,require(_0xdf99('0x40')));var _0x1e7384=jayson['server'](_0x2a6eae)[_0xdf99('0x41')]();var _0x31a424=config[_0xdf99('0x42')][_0xdf99('0x43')]||config['port']+0x1;var _0x3c9b41=config['rpc']['ip']||_0xdf99('0x44');_0x1e7384['on'](_0xdf99('0x45'),function(_0x5d470a){return _0x60cc1e(_0x5d470a);});_0x1e7384[_0xdf99('0x0')](_0x31a424,_0x3c9b41,function(){console[_0xdf99('0x46')](_0xdf99('0x47'),_0x3c9b41,_0x31a424);require(_0xdf99('0x48'))[_0xdf99('0x49')]();return _0xc6e6da(_0xdf99('0x4a')+_0x3c9b41+':'+_0x31a424);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 1e14d84..103ee3a 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 _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 +var _0x035c=['agi','AGI','wait','exec','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','events','EventEmitter','./reply','./error','setEncoding','utf8','headers','emit','ready','line','toLowerCase','hangup','520-Invalid','search','520\x20End\x20of\x20proper','substring','no\x20code','replace','indexOf','substr','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','function','write','inherits','prototype','sync','answer','sendRequest','ANSWER','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','isArray','EXEC\x20%s\x20%s','join','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','continueAt','extension','setPriority','getVariable','recordFile','wav','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22'];(function(_0x7fa3af,_0x15e2ad){var _0x2bdc18=function(_0x23f7ca){while(--_0x23f7ca){_0x7fa3af['push'](_0x7fa3af['shift']());}};_0x2bdc18(++_0x15e2ad);}(_0x035c,0xa8));var _0xc035=function(_0x526de6,_0xa610f9){_0x526de6=_0x526de6-0x0;var _0xeb0ffa=_0x035c[_0x526de6];return _0xeb0ffa;};'use strict';var util=require(_0xc035('0x0'));var _=require('lodash');var EventEmitter=require(_0xc035('0x1'))[_0xc035('0x2')];var AGIReply=require(_0xc035('0x3'));var AGIError=require(_0xc035('0x4'));function AGIChannel(_0x1e42c9){var _0x29443d=this,_0x8ec421=new AGIReply(),_0xd9678e=![],_0x1335c8={};EventEmitter['call'](_0x29443d);_0x1e42c9[_0xc035('0x5')](_0xc035('0x6'));_0x1e42c9['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x8ec421['setEncoding'](_0xc035('0x6'));_0x8ec421['on'](_0xc035('0x7'),function(_0x398898){for(var _0x26623f in _0x398898){_0x29443d[_0x26623f]=_0x398898[_0x26623f];}_0x29443d[_0xc035('0x8')](_0xc035('0x9'));});_0x8ec421['on'](_0xc035('0xa'),function(_0x3bacc6){if(_0x3bacc6[_0xc035('0xb')]()==_0xc035('0xc')){_0x29443d['emit'](_0xc035('0xc'));return;}if(_0x3bacc6['substring'](0x0,0xb)==_0xc035('0xd')){_0xd9678e=!![];}if(_0xd9678e){_0x1335c8['rx']+=_0x3bacc6+'\x0a';if(_0x3bacc6[_0xc035('0xe')](_0xc035('0xf'))!=-0x1){_0xd9678e=![];}}else{_0x1335c8['rx']=_0x3bacc6;}if(_0xd9678e){return;}if(typeof _0x1335c8['cb']=='function'){var _0x63a5cf=_0x1335c8['rx'][_0xc035('0x10')](0x0,0x3),_0xab2ae4=null,_0xd644fe=null;_0x63a5cf=parseInt(_0x63a5cf);if(isNaN(_0x63a5cf)){_0x1335c8['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xc035('0x11')});return;}if(_0x63a5cf!=0xc8){_0x1335c8['cb'](null,{'code':_0x63a5cf,'result':-0x1,'extra':'KO'});return;}_0xab2ae4=_0x1335c8['rx'][_0xc035('0x10')](0x4)[_0xc035('0x12')]('result=','');if(_0xab2ae4[_0xc035('0x13')]('\x20')!=-0x1){_0xab2ae4=_0xab2ae4[_0xc035('0x14')](0x0,_0xab2ae4[_0xc035('0x13')]('\x20'));}if(_['startsWith'](_0xab2ae4,'-1')){_0xab2ae4=parseInt(_0xab2ae4);}_0xd644fe=_0x1335c8['rx']['split']('\x20');if(_0xd644fe['length']==0x3){_0xd644fe=_0xd644fe[0x2][_0xc035('0x10')](0x1,_0xd644fe[0x2]['length']-0x1);}else if(_0xd644fe['length']>0x3){var _0x4e0dcf=/\((.+)\)/;var _0x2df2f4=_0x1335c8['rx'][_0xc035('0x15')](_0x4e0dcf);if(_0x2df2f4){_0xd644fe=_0x2df2f4[0x1];}else{_0xd644fe=null;}}else{_0xd644fe=null;}_0x1335c8['cb'](null,{'code':_0x63a5cf,'result':_0xab2ae4,'extra':_0xd644fe});}});_0x1e42c9['on']('error',function(_0x42d9e4){_0x29443d['emit'](_0xc035('0x16'),new AGIError(_0xc035('0x17'),_0x42d9e4[_0xc035('0x18')]));});_0x1e42c9['on']('close',function(){_0x29443d[_0xc035('0x8')](_0xc035('0x19'),new AGIError(_0xc035('0x1a')));});_0x1e42c9['on'](_0xc035('0x1b'),function(){_0x29443d[_0xc035('0x8')](_0xc035('0x1b'),new AGIError(_0xc035('0x1c')));_0x1e42c9[_0xc035('0x1d')]();});_0x1e42c9[_0xc035('0x1e')](_0x8ec421);this[_0xc035('0x1f')]=function(_0x28cfab,_0x51d35f){var _0x28cfab=_0x28cfab||'',_0x51d35f=typeof _0x51d35f==_0xc035('0x20')?_0x51d35f:new Function();_0x1335c8={'tx':_0x28cfab,'rx':'','cb':_0x51d35f};_0x1e42c9[_0xc035('0x21')](_0x28cfab+'\x0a');},this[_0xc035('0x19')]=function(){_0x1e42c9[_0xc035('0x1d')]();};}util[_0xc035('0x22')](AGIChannel,EventEmitter);AGIChannel[_0xc035('0x23')]['sendRequest']=function(_0x3597c3){return this[_0xc035('0x1f')][_0xc035('0x24')](this,_0x3597c3);};AGIChannel[_0xc035('0x23')][_0xc035('0x25')]=function(){return this[_0xc035('0x26')](_0xc035('0x27'));};AGIChannel[_0xc035('0x23')][_0xc035('0x28')]=function(_0x18f946,_0x326214,_0xf9ef4e){_0x18f946=_0x18f946===undefined?'beep':_0x18f946;_0x326214=_0x326214===undefined?'5':_0x326214;_0xf9ef4e=_0xf9ef4e===undefined?'1':_0xf9ef4e;return this[_0xc035('0x26')](util[_0xc035('0x29')](_0xc035('0x2a'),_0x18f946,_0x326214*0x3e8,_0xf9ef4e));};AGIChannel[_0xc035('0x23')][_0xc035('0x2b')]=function(_0x4efb1d){_0x4efb1d=_0x4efb1d||_0xc035('0x2c');return this[_0xc035('0x26')](util[_0xc035('0x29')](_0xc035('0x2d'),_0x4efb1d));};AGIChannel[_0xc035('0x23')]['exec']=function(_0x469c95,_0x557994){if(_[_0xc035('0x2e')](_0x557994)){return this['sendRequest'](util[_0xc035('0x29')](_0xc035('0x2f'),_0x469c95,_0x557994[_0xc035('0x30')](',')));}return this[_0xc035('0x26')](util[_0xc035('0x29')]('EXEC\x20%s\x20%s',_0x469c95,_0x557994));};AGIChannel[_0xc035('0x23')]['setContext']=function(_0x2aad98){return this[_0xc035('0x26')](util['format'](_0xc035('0x31'),_0x2aad98));};AGIChannel[_0xc035('0x23')][_0xc035('0x32')]=function(_0x279901){return this[_0xc035('0x26')](util[_0xc035('0x29')](_0xc035('0x33'),_0x279901));};AGIChannel['prototype']['setPriority']=function(_0x328879){return this['sendRequest'](util[_0xc035('0x29')](_0xc035('0x34'),_0x328879));};AGIChannel['prototype'][_0xc035('0xc')]=function(){return this['sendRequest']('HANGUP');};AGIChannel['prototype'][_0xc035('0x35')]=function(_0x24f605,_0x42afd8){var _0x27c117=_[_0xc035('0x36')](_0x42afd8)||_[_0xc035('0x37')](_0x42afd8)?_0x42afd8[_0xc035('0x38')]():_0x42afd8;return this[_0xc035('0x26')](util[_0xc035('0x29')](_0xc035('0x39'),_0x24f605,_0x27c117?_0x27c117[_0xc035('0x38')]()[_0xc035('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xc035('0x23')][_0xc035('0x3a')]=function(_0x482e71,_0x3c1adb){return this[_0xc035('0x26')](util[_0xc035('0x29')](_0xc035('0x3b'),_0x482e71,_0x3c1adb));};AGIChannel[_0xc035('0x23')][_0xc035('0x3c')]=function(_0x38e650,_0x470d95){return this[_0xc035('0x26')](util[_0xc035('0x29')](_0xc035('0x3d'),_0x38e650,_0x470d95));};AGIChannel[_0xc035('0x23')][_0xc035('0x3e')]=function(_0x729b7,_0x2e01dd){return this['sendRequest'](util[_0xc035('0x29')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x729b7,_0x2e01dd));};AGIChannel['prototype'][_0xc035('0x3f')]=function(_0x2b4dae,_0xdcef81,_0x52305d){_0xdcef81=_0xdcef81||this[_0xc035('0x40')];_0x52305d=_0x52305d||0x1;this['setContext'](_0x2b4dae);this[_0xc035('0x32')](_0xdcef81);this[_0xc035('0x41')](_0x52305d);return this[_0xc035('0x2b')](util[_0xc035('0x29')]('GOTO\x20%s\x20%s\x20%s',_0x2b4dae,_0xdcef81,_0x52305d));};AGIChannel[_0xc035('0x23')][_0xc035('0x42')]=function(_0x24f49e){return this[_0xc035('0x26')](util[_0xc035('0x29')]('GET\x20VARIABLE\x20\x22%s\x22',_0x24f49e));};AGIChannel[_0xc035('0x23')][_0xc035('0x43')]=function(_0x1bdf6d,_0x14ffd5,_0x5d60ad,_0x1b4f6c,_0x4b48a1,_0x3cc216){_0x14ffd5=_0x14ffd5||_0xc035('0x44');_0x5d60ad=_0x5d60ad||'';_0x1b4f6c=_0x1b4f6c===undefined?-0x1:_0x1b4f6c==='-1'?-0x1:_0x1b4f6c*0x3e8;_0x4b48a1=_0x4b48a1===undefined?'':'s='+_0x4b48a1;_0x3cc216=_0x3cc216?'BEEP':'';return this[_0xc035('0x26')](util[_0xc035('0x29')](_0xc035('0x45'),_0x1bdf6d,_0x14ffd5,_0x5d60ad,_0x1b4f6c,_0x3cc216,_0x4b48a1));};AGIChannel[_0xc035('0x23')][_0xc035('0x46')]=function(_0x72dff8,_0x1d862d){_0x1d862d=_0x1d862d||'';return this[_0xc035('0x26')](util[_0xc035('0x29')](_0xc035('0x47'),_0x72dff8,_0x1d862d));};AGIChannel[_0xc035('0x23')][_0xc035('0x48')]=function(_0xdaabbc){return this['exec'](_0xc035('0x49'),_0xdaabbc);};AGIChannel['prototype'][_0xc035('0x4a')]=function(_0xf5ebd4){return this[_0xc035('0x4b')](_0xc035('0x4c'),_0xf5ebd4);};AGIChannel[_0xc035('0x23')]['error']=function(_0x33ba67,_0x22de0d){this['noop'](util[_0xc035('0x29')](_0xc035('0x4d'),_0x33ba67['id'],_0x33ba67[_0xc035('0x4e')],_0x22de0d));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xc035('0x4f')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 0dd879d..044b2dd 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 _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 +var _0xcfe5=['util','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED','push','format','message','name','exports'];(function(_0x46e8ff,_0x161935){var _0x7df3b3=function(_0x380087){while(--_0x380087){_0x46e8ff['push'](_0x46e8ff['shift']());}};_0x7df3b3(++_0x161935);}(_0xcfe5,0x9c));var _0x5cfe=function(_0x5d0594,_0x3d8ede){_0x5d0594=_0x5d0594-0x0;var _0x179e9a=_0xcfe5[_0x5d0594];return _0x179e9a;};'use strict';var util=require(_0x5cfe('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x5cfe('0x1'),'E_AGI_SERVER_MAXCONNECTION':_0x5cfe('0x2'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x5cfe('0x3'),'E_AGI_SOCKET_CLOSE':_0x5cfe('0x4'),'E_AGI_SOCKET_TIMEOUT':_0x5cfe('0x5'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x5cfe('0x6'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x5ab5fa){var _0x5ab5fa=_0x5ab5fa||null,_0x4a44b5=_0x4a44b5||[],_0x308f74=0x1,_0x41398d='';if(!error[_0x5ab5fa]){_0x5ab5fa=_0x5cfe('0x7');}_0x4a44b5[_0x5cfe('0x8')](error[_0x5ab5fa]);while(arguments[_0x308f74]){_0x4a44b5['push'](arguments[_0x308f74]);_0x308f74++;}_0x41398d=util[_0x5cfe('0x9')]['apply'](util,_0x4a44b5);this[_0x5cfe('0xa')]=_0x41398d;this[_0x5cfe('0xb')]=_0x5ab5fa;}module[_0x5cfe('0xc')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 5903b21..65ff96b 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 _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 +var _0xb6b7=['redis','subscribe','E_AGI_SERVER_ERROR','agi','parse','emit','projectUpdate','exports','lodash','events','ioredis','./error','../../config/environment','defaults','localhost'];(function(_0x102ff9,_0x907658){var _0x24fa97=function(_0x3622ff){while(--_0x3622ff){_0x102ff9['push'](_0x102ff9['shift']());}};_0x24fa97(++_0x907658);}(_0xb6b7,0xf8));var _0x7b6b=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xb6b7[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x7b6b('0x0'));var EventEmitter=require(_0x7b6b('0x1'))['EventEmitter'];var Redis=require(_0x7b6b('0x2'));var AGIError=require(_0x7b6b('0x3'));var config=require(_0x7b6b('0x4'));config['redis']=_[_0x7b6b('0x5')](config['redis'],{'host':_0x7b6b('0x6'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x7b6b('0x7')]);sub[_0x7b6b('0x8')]('agi',function(_0x4f9406){if(_0x4f9406)return eventEmitter['emit']('error',new AGIError(_0x7b6b('0x9'),_0x4f9406));});sub['on']('message',function(_0x487aa0,_0x1f1a2d){if(_0x487aa0!==_0x7b6b('0xa'))return;try{var _0x328523=JSON[_0x7b6b('0xb')](_0x1f1a2d);eventEmitter[_0x7b6b('0xc')](_0x7b6b('0xd'),_0x328523);}catch(_0x5494a4){eventEmitter[_0x7b6b('0xc')]('error',new AGIError(_0x7b6b('0x9'),_0x5494a4));}});module[_0x7b6b('0xe')]={'EventEmitter':eventEmitter}; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 8d6949b..bdf730f 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 _0x4564=['menu','getdigits','getsecretdigits','vertices','edges','numberOfEdges','prototype','addVertex','push','size','relations','getVertex','info','no\x20vertex\x20found','stop\x20traverse','no\x20edge/s\x20available','condition','split','length','agicommand','vswitch','default','target','traverseBFS','default\x20on\x20switch\x20not\x20found','max\x20retry\x20reach','condition\x20not\x20found'];(function(_0xc471d2,_0x26ab16){var _0x334c68=function(_0x2deae4){while(--_0x2deae4){_0xc471d2['push'](_0xc471d2['shift']());}};_0x334c68(++_0x26ab16);}(_0x4564,0xd8));var _0x4456=function(_0x58014e,_0x56206a){_0x58014e=_0x58014e-0x0;var _0x3aaa87=_0x4564[_0x58014e];return _0x3aaa87;};'use strict';var _=require('lodash');var logger=require('../../../config/logger')('agi');var verticesWithRetry=[_0x4456('0x0'),_0x4456('0x1'),_0x4456('0x2')];var Graph=function(){this[_0x4456('0x3')]={};this[_0x4456('0x4')]={};this[_0x4456('0x5')]=0x0;};Graph[_0x4456('0x6')][_0x4456('0x7')]=function(_0x2fe05f){this[_0x4456('0x3')][_0x2fe05f['id']]=_0x2fe05f;this[_0x4456('0x4')][_0x2fe05f['id']]=[];};Graph['prototype']['addEdge']=function(_0x18a468,_0x28a5a2,_0x5833b9){this[_0x4456('0x4')][_0x18a468][_0x4456('0x8')]({'target':_0x28a5a2,'condition':_0x5833b9});this['numberOfEdges']+=0x1;};Graph[_0x4456('0x6')][_0x4456('0x9')]=function(){return _[_0x4456('0x9')](this['vertices']);};Graph[_0x4456('0x6')][_0x4456('0xa')]=function(){return this[_0x4456('0x5')];};Graph[_0x4456('0x6')][_0x4456('0xb')]=function(_0x37bf95){return this[_0x4456('0x3')][_0x37bf95];};Graph['prototype']['traverseBFS']=function(_0x33381a,_0x5133b2){if(!this[_0x4456('0x3')][_0x33381a]){return logger[_0x4456('0xc')](_0x4456('0xd'));}var _0xb3bf32=_0x5133b2(this[_0x4456('0x3')][_0x33381a]);if(!_0xb3bf32){return logger['info'](_0x4456('0xe'));}if(this[_0x4456('0x4')][_0x33381a]['length']===0x0){return logger['info'](_0x4456('0xf'));}for(var _0x38b58d=0x0,_0x5375a9=[],_0x3f9157=![];_0x38b58d\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 +var _0xb946=['./project','EventEmitter','defaults','127.0.0.1','projectUpdate','nextTick','stack','findIndex','deleted','splice','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','error','[%s]\x20%s','message','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','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','evtHangup','createSquareReport','then','catch','hasOwnProperty','agi_','substring','stringify','close','timeout','hangup','handleNotFound','production','handleUnpublished','initialize','getLicense','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','getAll','./server','listening','connection','lodash','syncho','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc'];(function(_0x58c56a,_0x40d9e4){var _0x4f83d0=function(_0x16d682){while(--_0x16d682){_0x58c56a['push'](_0x58c56a['shift']());}};_0x4f83d0(++_0x40d9e4);}(_0xb946,0x6d));var _0x6b94=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0xb946[_0x1eda20];return _0x31b953;};'use strict';var _=require(_0x6b94('0x0'));var syncho=require(_0x6b94('0x1'));var util=require('util');var config=require(_0x6b94('0x2'));var logger=require(_0x6b94('0x3'))(_0x6b94('0x4'));var utilLicense=require(_0x6b94('0x5'));var rpc=require(_0x6b94('0x6'));var Project=require(_0x6b94('0x7'));var AGIEmitter=require('./events')[_0x6b94('0x8')];var projects=[];config[_0x6b94('0x4')]=_[_0x6b94('0x9')](config[_0x6b94('0x4')],{'ip':_0x6b94('0xa'),'port':0x11dd});AGIEmitter['on'](_0x6b94('0xb'),projectUpdateHandler);function connectionHandler(_0x57c169){process[_0x6b94('0xc')](function(){syncho(function(){try{setChannelVariables(_0x57c169);agiHandler(_0x57c169);}catch(_0x3592ba){logger['error'](_0x3592ba[_0x6b94('0xd')]);}});});}function projectUpdateHandler(_0x5de5bd){try{var _0x2a1f0e=_[_0x6b94('0xe')](projects,['id',_0x5de5bd['id']]);if(_0x2a1f0e>-0x1){if(_0x5de5bd[_0x6b94('0xf')]===!![]){projects[_0x6b94('0x10')](_0x2a1f0e,0x1);}else{projects[_0x2a1f0e]=_0x5de5bd;}}else{projects['push'](_0x5de5bd);}}catch(_0x275f3f){logger['error'](_0x275f3f[_0x6b94('0xd')]);}}function listeningHandler(){console[_0x6b94('0x11')](_0x6b94('0x12'),config[_0x6b94('0x4')][_0x6b94('0x13')]);logger[_0x6b94('0x14')](util[_0x6b94('0x15')](_0x6b94('0x16'),config[_0x6b94('0x4')]['ip'],config[_0x6b94('0x4')][_0x6b94('0x13')]));}function errorHandler(_0x4e97d6){if(_0x4e97d6&&_0x4e97d6[_0x6b94('0x17')]&&_0x4e97d6['message']){logger[_0x6b94('0x18')](util[_0x6b94('0x15')](_0x6b94('0x19'),_0x4e97d6[_0x6b94('0x17')],_0x4e97d6[_0x6b94('0x1a')]));}else{logger['error'](util['format']('[ERROR]\x20%s',_0x4e97d6[_0x6b94('0xd')]));}}function closeHandler(){logger[_0x6b94('0x14')](util[_0x6b94('0x15')](_0x6b94('0x1b'),this['arg_1'],this[_0x6b94('0x1c')],this[_0x6b94('0x1d')],this[_0x6b94('0x1e')],this[_0x6b94('0x1f')]));try{createSquareReport(this);}catch(_0x5cb956){logger[_0x6b94('0x18')](_0x5cb956[_0x6b94('0xd')]);}}function timeoutHandler(){logger['info'](util[_0x6b94('0x15')](_0x6b94('0x20'),this[_0x6b94('0x21')],this[_0x6b94('0x1c')],this[_0x6b94('0x1d')],this[_0x6b94('0x1e')],this[_0x6b94('0x1f')]));}function hangupHandler(){logger['info'](util[_0x6b94('0x15')](_0x6b94('0x22'),this['arg_1'],this[_0x6b94('0x1c')],this[_0x6b94('0x1d')],this[_0x6b94('0x1e')],this[_0x6b94('0x1f')]));this[_0x6b94('0x23')]=!![];}function createSquareReport(_0x36cf3d,_0x1a331a){rpc[_0x6b94('0x24')](_0x36cf3d)[_0x6b94('0x25')](function(_0x38c877){if(_0x1a331a){_0x1a331a(null,_0x38c877);}})[_0x6b94('0x26')](function(_0x1b315a){if(_0x1a331a){_0x1a331a(null,_0x1b315a);}});}function setChannelVariables(_0x5183ae){for(var _0x8be9e5 in _0x5183ae){if(_0x5183ae[_0x6b94('0x27')](_0x8be9e5)){if(_0x8be9e5['indexOf'](_0x6b94('0x28'))===0x0){_0x5183ae[_0x8be9e5[_0x6b94('0x29')](0x4)]=_0x5183ae[_0x8be9e5];delete _0x5183ae[_0x8be9e5];}}}}function agiHandler(_0x103661){logger['debug']('variables',JSON[_0x6b94('0x2a')](_0x103661,null,0x2));logger[_0x6b94('0x14')](util[_0x6b94('0x15')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x103661[_0x6b94('0x21')],_0x103661[_0x6b94('0x1c')],_0x103661['callerid'],_0x103661[_0x6b94('0x1e')],_0x103661[_0x6b94('0x1f')]));_0x103661['on'](_0x6b94('0x18'),errorHandler);_0x103661['on'](_0x6b94('0x2b'),closeHandler);_0x103661['on'](_0x6b94('0x2c'),timeoutHandler);_0x103661[_0x6b94('0x23')]=![];_0x103661['on'](_0x6b94('0x2d'),hangupHandler);var _0x95b0e9=_['find'](projects,[_0x6b94('0x17'),_0x103661[_0x6b94('0x21')]]);if(!_0x95b0e9)return Project[_0x6b94('0x2e')](_0x103661);if(!_0x95b0e9[_0x6b94('0x2f')])return Project[_0x6b94('0x30')](_0x103661);return Project[_0x6b94('0x31')](_0x95b0e9,_0x103661);}function main(){var _0x3911d7;return utilLicense[_0x6b94('0x32')]()['then'](function(_0x8466fe){if(!_0x8466fe)return;if(_0x8466fe['voice']){if(_0x8466fe[_0x6b94('0x33')]&&_0x8466fe[_0x6b94('0x33')]>0x0){logger[_0x6b94('0x14')](util[_0x6b94('0x15')](_0x6b94('0x34'),_0x8466fe[_0x6b94('0x33')]));_0x3911d7=_0x8466fe[_0x6b94('0x33')];}else{logger[_0x6b94('0x14')](_0x6b94('0x35'));}}else{logger[_0x6b94('0x14')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x3911d7=-0x1;}})[_0x6b94('0x25')](function(){return Project[_0x6b94('0x36')]();})[_0x6b94('0x25')](function(_0x182186){projects=_0x182186;return;})[_0x6b94('0x26')](function(_0x36ace4){logger[_0x6b94('0x18')]('[LICENSE]',_0x36ace4[_0x6b94('0xd')]);})['finally'](function(){var _0x2e2b71=require(_0x6b94('0x37'))(config[_0x6b94('0x4')][_0x6b94('0x13')],config['agi']['ip'],_0x3911d7);_0x2e2b71['on']('error',errorHandler);_0x2e2b71['on'](_0x6b94('0x38'),listeningHandler);_0x2e2b71['on'](_0x6b94('0x39'),connectionHandler);_0x2e2b71['on'](_0x6b94('0x2b'),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 3353ab6..74465bc 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 _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 +var _0x02d8=['SendMail','bluebird','http','request','then','error','message','result','catch','sendMailMessage'];(function(_0x271cc3,_0x4dd84a){var _0x598afa=function(_0x22a1e7){while(--_0x22a1e7){_0x271cc3['push'](_0x271cc3['shift']());}};_0x598afa(++_0x4dd84a);}(_0x02d8,0x105));var _0x802d=function(_0x381983,_0x2801d0){_0x381983=_0x381983-0x0;var _0x486d5a=_0x02d8[_0x381983];return _0x486d5a;};'use strict';var BPromise=require(_0x802d('0x0'));var jayson=require('jayson/promise');var client=jayson['client'][_0x802d('0x1')]({'port':0x232b});function request(_0x197b1f,_0x5b0bde){return new BPromise(function(_0x575486,_0x8b081b){return client[_0x802d('0x2')](_0x197b1f,_0x5b0bde)[_0x802d('0x3')](function(_0x23ebab){if(_0x23ebab[_0x802d('0x4')]){return _0x8b081b(_0x23ebab[_0x802d('0x4')][_0x802d('0x5')]);}else{return _0x575486(_0x23ebab[_0x802d('0x6')]);}})[_0x802d('0x7')](function(_0x5b1d29){return _0x8b081b(_0x5b1d29);});});}exports[_0x802d('0x8')]=function(_0x3f0ee7,_0x51f9bc){return request(_0x802d('0x9'),{'account':_0x3f0ee7,'message':_0x51f9bc});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 127f819..52d82c1 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 _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 +var _0xe7f7=['inspect','production','stringify','format','YYYY-MM-DD\x20HH:mm:ss','[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','start','debug','vertex','gotoc','info','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','code','result','response','error','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','traverseBFS','clear','isUndefined','agicommand\x20not\x20found','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','exports','lodash','xml2json','../../config/logger','agi','./rpc','./graph','getSquareProjects','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','isArray','length','source','target','addEdge','mxGraphModel','root'];(function(_0x235563,_0x260ece){var _0x219be0=function(_0xef2469){while(--_0xef2469){_0x235563['push'](_0x235563['shift']());}};_0x219be0(++_0x260ece);}(_0xe7f7,0x151));var _0x7e7f=function(_0x4715d2,_0x3371b2){_0x4715d2=_0x4715d2-0x0;var _0x141811=_0xe7f7[_0x4715d2];return _0x141811;};'use strict';var _=require(_0x7e7f('0x0'));var moment=require('moment');var parser=require(_0x7e7f('0x1'));var util=require('util');var logger=require(_0x7e7f('0x2'))(_0x7e7f('0x3'));var rpc=require(_0x7e7f('0x4'));var mailRpc=require('./mailRpc');var Graph=require(_0x7e7f('0x5'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x7e7f('0x6')]()['catch'](function(_0x4662dc){logger['error'](_0x7e7f('0x7'),_0x4662dc[_0x7e7f('0x8')]);return[];});}function addVertex(_0x466c4f,_0x53adb3,_0x42cf85){_0x53adb3[_0x7e7f('0x9')]=_0x42cf85;if(_0x53adb3[_0x7e7f('0xa')](_0x7e7f('0xb'))){_0x53adb3[_0x7e7f('0xc')]=parseInt(_0x53adb3['retry'],0xa);}_0x466c4f[_0x7e7f('0xd')](_[_0x7e7f('0xe')](_0x53adb3,_0x7e7f('0xf')));}function initGraph(_0x33cc4b,_0x2b995b){var _0x5ca546=new Graph();for(var _0x44bfc7 in _0x33cc4b){if(_0x33cc4b[_0x7e7f('0xa')](_0x44bfc7)){if(_[_0x7e7f('0x10')](_0x33cc4b[_0x44bfc7])){for(var _0x4532e2=0x0;_0x4532e2<_0x33cc4b[_0x44bfc7][_0x7e7f('0x11')];_0x4532e2+=0x1){addVertex(_0x5ca546,_0x33cc4b[_0x44bfc7][_0x4532e2],_0x44bfc7);}}else{addVertex(_0x5ca546,_0x33cc4b[_0x44bfc7],_0x44bfc7);}}}for(var _0x39e5ae=0x0;_0x39e5ae<_0x2b995b[_0x7e7f('0x11')];_0x39e5ae+=0x1){if(_0x2b995b[_0x39e5ae][_0x7e7f('0x12')]&&_0x2b995b[_0x39e5ae][_0x7e7f('0x13')]){_0x5ca546[_0x7e7f('0x14')](_0x2b995b[_0x39e5ae][_0x7e7f('0x12')],_0x2b995b[_0x39e5ae][_0x7e7f('0x13')],_0x2b995b[_0x39e5ae]['value']);}}return _0x5ca546;}function getRoot(_0x3ebd9c){return parser['toJson'](_0x3ebd9c,{'object':!![]})[_0x7e7f('0x15')][_0x7e7f('0x16')];}function inspect(_0x573848){return util[_0x7e7f('0x17')](_0x573848,{'showHidden':![],'depth':null});}function initialize(_0x516005,_0x461ffe){var _0x451878=getRoot(_0x516005[_0x7e7f('0x18')]);if(!_0x451878||!_0x451878['start'])return;var _0x4091be,_0x31288e,_0x5acbec;logger['debug'](_0x7e7f('0x16'),JSON[_0x7e7f('0x19')](_0x451878,null,0x2));_0x461ffe['joinAt']=moment()[_0x7e7f('0x1a')](_0x7e7f('0x1b'));_0x4091be=initGraph(_[_0x7e7f('0xe')](_0x451878,'mxCell'),_0x451878[_0x7e7f('0xf')]);_0x31288e=new Vertices(_0x461ffe,rpc,mailRpc);logger['info'](util['format'](_0x7e7f('0x1c'),_0x461ffe[_0x7e7f('0x1d')],_0x461ffe[_0x7e7f('0x1e')],_0x461ffe[_0x7e7f('0x1f')],_0x461ffe[_0x7e7f('0x20')],_0x461ffe['uniqueid']));_0x4091be['traverseBFS'](_0x451878[_0x7e7f('0x21')]['id'],function(_0x172693){try{_0x172693=_0x31288e['clear'](_0x172693);logger[_0x7e7f('0x22')](_0x7e7f('0x23'),JSON[_0x7e7f('0x19')](_0x172693,null,0x2));if(_0x172693[_0x7e7f('0x9')]===_0x7e7f('0x24')){logger[_0x7e7f('0x25')](_0x7e7f('0x26'));_0x461ffe[_0x7e7f('0x27')]=_0x172693[_0x7e7f('0x27')]||_0x461ffe[_0x7e7f('0x27')];_0x461ffe[_0x7e7f('0x28')]=_0x172693[_0x7e7f('0x28')];_0x461ffe[_0x7e7f('0x29')]=_0x172693[_0x7e7f('0x29')]?_0x172693[_0x7e7f('0x29')]-0x1:0x1;return null;}else if(_0x172693&&_0x31288e[_0x172693['agicommand']]){_0x5acbec=_0x31288e[_0x172693[_0x7e7f('0x9')]](_0x172693);logger[_0x7e7f('0x25')]('response',JSON[_0x7e7f('0x19')](_0x5acbec,null,0x2));if(_0x5acbec&&_0x5acbec[_0x7e7f('0x2a')]===AGI_CODE_SUCCESS&&_0x5acbec[_0x7e7f('0x2b')]!==AGI_RESULT_ERROR&&!_0x461ffe['evtHangup']){logger['debug'](_0x7e7f('0x2c'),inspect(_0x5acbec));return _['isUndefined'](_0x5acbec[_0x7e7f('0x2b')])?null:_0x5acbec['result']['toString']();}else{logger[_0x7e7f('0x2d')](_0x7e7f('0x2c'),inspect(_0x5acbec));return null;}}else{logger[_0x7e7f('0x2d')]('agicommand\x20not\x20found');return null;}}catch(_0x5f2882){logger[_0x7e7f('0x2d')](_0x5f2882[_0x7e7f('0x8')]);return null;}});if(_0x451878[_0x7e7f('0x2e')]){logger[_0x7e7f('0x25')](util[_0x7e7f('0x1a')](_0x7e7f('0x2f'),_0x461ffe[_0x7e7f('0x1d')],_0x461ffe[_0x7e7f('0x1e')],_0x461ffe['callerid'],_0x461ffe[_0x7e7f('0x20')],_0x461ffe[_0x7e7f('0x30')]));_0x4091be[_0x7e7f('0x31')](_0x451878[_0x7e7f('0x2e')]['id'],function(_0x55f606){try{_0x55f606=_0x31288e[_0x7e7f('0x32')](_0x55f606);logger[_0x7e7f('0x22')](_0x7e7f('0x23'),JSON[_0x7e7f('0x19')](_0x55f606,null,0x2));if(_0x55f606&&_0x31288e[_0x55f606[_0x7e7f('0x9')]]){_0x5acbec=_0x31288e[_0x55f606[_0x7e7f('0x9')]](_0x55f606);if(_0x5acbec){logger[_0x7e7f('0x22')]('response',inspect(_0x5acbec));return _[_0x7e7f('0x33')](_0x5acbec['result'])?null:_0x5acbec[_0x7e7f('0x2b')]['toString']();}else{logger[_0x7e7f('0x2d')](_0x7e7f('0x2c'),inspect(_0x5acbec));return null;}}else{logger[_0x7e7f('0x2d')](_0x7e7f('0x34'));return null;}}catch(_0x1ae2c9){logger[_0x7e7f('0x2d')](_0x1ae2c9[_0x7e7f('0x8')]);return null;}});}logger[_0x7e7f('0x25')](util[_0x7e7f('0x1a')](_0x7e7f('0x35'),_0x461ffe[_0x7e7f('0x1d')],_0x461ffe[_0x7e7f('0x1e')],_0x461ffe[_0x7e7f('0x1f')],_0x461ffe[_0x7e7f('0x20')],_0x461ffe[_0x7e7f('0x30')]));logger[_0x7e7f('0x25')](util[_0x7e7f('0x1a')](_0x7e7f('0x36'),_0x461ffe[_0x7e7f('0x27')],_0x461ffe[_0x7e7f('0x28')],parseInt(_0x461ffe[_0x7e7f('0x29')],0xa)+0x1));_0x461ffe[_0x7e7f('0x37')](_0x461ffe[_0x7e7f('0x27')],_0x461ffe[_0x7e7f('0x28')],parseInt(_0x461ffe[_0x7e7f('0x29')],0xa)+0x1);_0x461ffe[_0x7e7f('0x38')]();}function handleNotFound(_0x3a3afd){logger[_0x7e7f('0x2d')](util[_0x7e7f('0x1a')](_0x7e7f('0x39'),_0x3a3afd[_0x7e7f('0x1d')]));_0x3a3afd['continueAt'](_0x3a3afd[_0x7e7f('0x27')],_0x3a3afd['extension'],parseInt(_0x3a3afd['priority'],0xa)+0x1);_0x3a3afd[_0x7e7f('0x38')]();}function handleUnpublished(_0x5476d2){logger['error'](util[_0x7e7f('0x1a')](_0x7e7f('0x3a'),_0x5476d2[_0x7e7f('0x1d')]));_0x5476d2[_0x7e7f('0x37')](_0x5476d2[_0x7e7f('0x27')],_0x5476d2[_0x7e7f('0x28')],parseInt(_0x5476d2[_0x7e7f('0x29')],0xa)+0x1);_0x5476d2[_0x7e7f('0x38')]();}module[_0x7e7f('0x3b')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 512f40d..a22e719 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 _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 +var _0x4517=['split','trim','slice','length','headers','emit','line','exports','stream','Transform','call','_localBuffer','_inBody','inherits','prototype','_transform','toString','indexOf','substring'];(function(_0xd30336,_0x455fb8){var _0x248dae=function(_0x3306ae){while(--_0x3306ae){_0xd30336['push'](_0xd30336['shift']());}};_0x248dae(++_0x455fb8);}(_0x4517,0x112));var _0x7451=function(_0x5de706,_0x4b22b0){_0x5de706=_0x5de706-0x0;var _0x30e2ac=_0x4517[_0x5de706];return _0x30e2ac;};'use strict';var util=require('util');var Transform=require(_0x7451('0x0'))[_0x7451('0x1')];function AGIReply(_0x4ca2cd){Transform[_0x7451('0x2')](this,_0x4ca2cd);this[_0x7451('0x3')]='';this[_0x7451('0x4')]=![];}util[_0x7451('0x5')](AGIReply,Transform);AGIReply[_0x7451('0x6')][_0x7451('0x7')]=function(_0xb96eb8,_0x29eab9,_0x451332){var _0x3489f9='\x0a',_0x3ac271=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x1bfc08=-0x1,_0x26306e=-0x1,_0x443b80='',_0x2c2ace=0x0,_0x468a0a='',_0x10031d='';this[_0x7451('0x3')]+=_0xb96eb8[_0x7451('0x8')]();_0x468a0a=this[_0x7451('0x3')];if(!this[_0x7451('0x4')]){_0x2c2ace=0x0;while(_0x3ac271[_0x2c2ace]){while((_0x26306e=_0x468a0a[_0x7451('0x9')](_0x3ac271[_0x2c2ace]))!=-0x1){_0x443b80=_0x3ac271[_0x2c2ace];_0x10031d=_0x468a0a[_0x7451('0xa')](0x0,_0x26306e);_0x468a0a=_0x468a0a[_0x7451('0xa')](_0x26306e+_0x443b80['length']);var _0x4c4477=_0x10031d[_0x7451('0xb')](_0x3489f9),_0xf47f51=0x0,_0x5c7605={},_0x450463='',_0x2cb40b='',_0x4a14dc=-0x1;while(_0x4c4477[_0xf47f51]){_0x4a14dc=_0x4c4477[_0xf47f51][_0x7451('0x9')](':');if(_0x4a14dc!=-0x1){_0x450463=_0x4c4477[_0xf47f51]['slice'](0x0,_0x4a14dc)[_0x7451('0xc')]();_0x2cb40b=_0x4c4477[_0xf47f51][_0x7451('0xd')](_0x4a14dc+0x1)[_0x7451('0xc')]();if(_0x450463[_0x7451('0xe')]>0x0){_0x5c7605[_0x450463]=_0x2cb40b;}}else{}_0xf47f51++;}this['emit'](_0x7451('0xf'),_0x5c7605);this[_0x7451('0x4')]=!![];}_0x2c2ace++;}this[_0x7451('0x3')]=_0x468a0a;}else{while((_0x1bfc08=_0x468a0a['indexOf'](_0x3489f9))!=-0x1){_0x10031d=_0x468a0a['substring'](0x0,_0x1bfc08);this[_0x7451('0x10')](_0x7451('0x11'),_0x10031d);_0x468a0a=_0x468a0a[_0x7451('0xa')](_0x1bfc08+_0x3489f9[_0x7451('0xe')]);}this[_0x7451('0x3')]=_0x468a0a;}_0x451332();};module[_0x7451('0x12')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index db7ec1d..b18db3f 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 _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 +var _0x402f=['then','CreateCmContact','ShowPause','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','lodash','jayson/promise','request','error','message','result','getSquareProjects','GetSquareProjects','name','production','getSquareProject','ShowSquareProject','getVoiceQueueById','ShowVoiceQueue','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Intervals','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','arg_1','arg_2','format','CreateSquareRecording','createSquareMessage','CreateSquareMessage','ListId'];(function(_0x57411a,_0x59328f){var _0xd487ba=function(_0x2fb456){while(--_0x2fb456){_0x57411a['push'](_0x57411a['shift']());}};_0xd487ba(++_0x59328f);}(_0x402f,0x6f));var _0xf402=function(_0x45d570,_0xfd3b5c){_0x45d570=_0x45d570-0x0;var _0x37074d=_0x402f[_0x45d570];return _0x37074d;};'use strict';var _=require(_0xf402('0x0'));var moment=require('moment');var jayson=require(_0xf402('0x1'));var client=jayson['client']['http']({'port':0x2329});function request(_0x3ccbce,_0xe1847c){return new Promise(function(_0x86f726,_0x4a52b8){return client[_0xf402('0x2')](_0x3ccbce,_0xe1847c)['then'](function(_0x20c2cc){if(_0x20c2cc[_0xf402('0x3')]){return _0x4a52b8(_0x20c2cc[_0xf402('0x3')][_0xf402('0x4')]);}else{return _0x86f726(_0x20c2cc[_0xf402('0x5')]);}})['catch'](function(_0x4d1771){return _0x4a52b8(_0x4d1771);});});}exports[_0xf402('0x6')]=function(){return request(_0xf402('0x7'),{'options':{'raw':![],'attributes':['id',_0xf402('0x8'),_0xf402('0x9')]}});};exports[_0xf402('0xa')]=function(_0x298e44){return request(_0xf402('0xb'),{'options':{'raw':![],'where':{'name':_0x298e44},'attributes':[_0xf402('0x9')]}});};exports['getMailAccountById']=function(_0x120560){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x120560},'include':[{'model':'MailServerOut','as':'Smtp','include':[{'model':'CloudProvider','as':'CloudProvider'}]}],'attributes':['id',_0xf402('0x8'),'email'],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x5d129b){return request(_0xf402('0xb'),{'options':{'where':{'id':_0x5d129b},'attributes':['name']}});};exports[_0xf402('0xc')]=function(_0xb3deb6){return request(_0xf402('0xd'),{'options':{'where':{'id':_0xb3deb6},'attributes':[_0xf402('0x8')]}});};exports['getVariableById']=function(_0x16767b){return request('ShowVariable',{'options':{'where':{'id':_0x16767b},'attributes':[_0xf402('0x8')]}});};exports['getSquareOdbcById']=function(_0x5cc240){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x5cc240},'attributes':[_0xf402('0xe')]}});};exports[_0xf402('0xf')]=function(_0xd406bf){return request(_0xf402('0x10'),{'options':{'where':{'id':_0xd406bf},'attributes':[_0xf402('0x8')]}});};exports[_0xf402('0x11')]=function(_0x3ed3eb){return request(_0xf402('0x12'),{'options':{'where':{'phone':_0x3ed3eb[_0xf402('0x13')]},'attributes':['id']}});};exports[_0xf402('0x14')]=function(_0x5bb928){return request(_0xf402('0x15'),{'options':{'where':{'id':_0x5bb928},'attributes':[_0xf402('0x8')]}});};exports[_0xf402('0x16')]=function(_0xb47b61){return request(_0xf402('0x17'),{'options':{'where':{'id':_0xb47b61},'attributes':[_0xf402('0x18')]}});};exports[_0xf402('0x19')]=function(_0xf52248){return request(_0xf402('0x1a'),{'options':{'raw':![],'where':{'id':_0xf52248},'include':[{'model':'Interval','as':_0xf402('0x1b')}]}});};exports['getSmsAccountById']=function(_0x297a68){return request(_0xf402('0x1c'),{'options':{'where':{'id':_0x297a68},'attributes':['id',_0xf402('0x8')]}});};exports[_0xf402('0x1d')]=function(_0x20dca1){return request(_0xf402('0x1e'),{'body':_0x20dca1});};exports[_0xf402('0x1f')]=function(_0x28dce7){return request(_0xf402('0x20'),{'body':_0x28dce7});};exports[_0xf402('0x21')]=function(_0x3cbe98){return request(_0xf402('0x22'),{'body':_['merge'](_0x3cbe98,{'project_name':_0x3cbe98[_0xf402('0x23')],'prev_project_name':_0x3cbe98[_0xf402('0x24')]||'','is_subproject':_0x3cbe98[_0xf402('0x24')]?!![]:![],'leaveAt':moment()[_0xf402('0x25')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports['createSquareRecording']=function(_0x3e26d3){return request(_0xf402('0x26'),{'body':_0x3e26d3});};exports[_0xf402('0x27')]=function(_0xb7c8e4){return request(_0xf402('0x28'),{'body':_0xb7c8e4});};exports['createCmContact']=function(_0x39a38a){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x39a38a[_0xf402('0x13')],'ListId':_0x39a38a[_0xf402('0x29')]}}})[_0xf402('0x2a')](function(_0xb28d88){if(_0xb28d88){return _0xb28d88;}return request(_0xf402('0x2b'),{'body':_0x39a38a});});};exports['getPauseById']=function(_0xaeda0f){return request(_0xf402('0x2c'),{'options':{'where':{'id':_0xaeda0f},'attributes':[_0xf402('0x8')]}});};exports['agentLogin']=function(_0x4d86bd,_0x3ffab6){return request(_0xf402('0x2d'),{'body':{'interface':_0x3ffab6},'options':{'where':_0x4d86bd}});};exports[_0xf402('0x2e')]=function(_0x221d6d,_0x162cce,_0x4a593b){return request(_0xf402('0x2f'),{'body':{'type':_0x162cce,'uniqueid':_0x4a593b},'options':{'where':_0x221d6d}});};exports[_0xf402('0x30')]=function(_0x44aa26){return request(_0xf402('0x31'),{'body':{},'options':{'where':_0x44aa26}});};exports[_0xf402('0x32')]=function(_0x1bb9ae){return request('LogoutUser',{'body':{},'options':{'where':_0x1bb9ae}});}; \ 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 f44f7a1..fd4cc9f 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 _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 +var _0xbba1=['./polly'];(function(_0xeea5ec,_0x24e705){var _0xfcc302=function(_0x5ca663){while(--_0x5ca663){_0xeea5ec['push'](_0xeea5ec['shift']());}};_0xfcc302(++_0x24e705);}(_0xbba1,0x17f));var _0x1bba=function(_0xbef2c7,_0x3fc973){_0xbef2c7=_0xbef2c7-0x0;var _0x5c7de3=_0xbba1[_0xbef2c7];return _0x5c7de3;};var polly=require(_0x1bba('0x0'));var lex=require('./lex');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 d88ee3d..6f33966 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 _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 +var _0x2547=['exports'];(function(_0x31db9b,_0x4b404b){var _0x1dd1e8=function(_0x4edf9a){while(--_0x4edf9a){_0x31db9b['push'](_0x31db9b['shift']());}};_0x1dd1e8(++_0x4b404b);}(_0x2547,0x1cd));var _0x7254=function(_0x501079,_0x4639e5){_0x501079=_0x501079-0x0;var _0x2c7e92=_0x2547[_0x501079];return _0x2c7e92;};'use strict';var lex=require('./lib/api');module[_0x7254('0x0')]=function(_0x23e38c,_0x44b692,_0x3ea6e6,_0xbbc747,_0x1a36de,_0x9f3435){return lex(_0x23e38c,_0x44b692,_0x3ea6e6,_0xbbc747,_0x1a36de,_0x9f3435);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/lib/api.js b/server/services/agi/scripts/aws/lex/lib/api.js index 17cdbd9..c839f9b 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(_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 +var _0xa9e0=['LexRuntime','bluebird','aws-sdk','slots','hasOwnProperty'];(function(_0x4c3d1f,_0x2f9f1e){var _0x13c7f7=function(_0x2b011d){while(--_0x2b011d){_0x4c3d1f['push'](_0x4c3d1f['shift']());}};_0x13c7f7(++_0x2f9f1e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'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 41a77ac..a18f470 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 _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 +var _0x1cc4=['./lib/api','exports'];(function(_0x960e1a,_0xdcfd78){var _0x2b4f46=function(_0x12ef21){while(--_0x12ef21){_0x960e1a['push'](_0x960e1a['shift']());}};_0x2b4f46(++_0xdcfd78);}(_0x1cc4,0x1de));var _0x41cc=function(_0x33593e,_0x22ddd3){_0x33593e=_0x33593e-0x0;var _0x53db1a=_0x1cc4[_0x33593e];return _0x53db1a;};'use strict';var polly=require(_0x41cc('0x0'));module[_0x41cc('0x1')]=function(_0x223538,_0x4789ff,_0x27df4e,_0x4d27ce,_0x8cfbed,_0x376cae,_0x25fd8b){return polly(_0x223538,_0x4789ff,_0x27df4e,_0x4d27ce,_0x8cfbed,_0x376cae,_0x25fd8b);}; \ 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 33dcae5..c886c73 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 _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 +var _0x8e77=['synthesizeSpeech','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','exports','text','mp3','path','randomstring','aws-sdk'];(function(_0x434d21,_0x3492b8){var _0x3d8c1f=function(_0x37c940){while(--_0x37c940){_0x434d21['push'](_0x434d21['shift']());}};_0x3d8c1f(++_0x3492b8);}(_0x8e77,0x177));var _0x78e7=function(_0x3042c5,_0x36cb88){_0x3042c5=_0x3042c5-0x0;var _0x7cd140=_0x8e77[_0x3042c5];return _0x7cd140;};'use strict';var fs=require('fs');var path=require(_0x78e7('0x0'));var BPromise=require('bluebird');var rs=require(_0x78e7('0x1'));var AWS=require(_0x78e7('0x2'));function pollyResult(_0x39dbd2,_0x441536,_0x57913b){return new BPromise(function(_0x5dd279,_0x4bd68d){_0x39dbd2[_0x78e7('0x3')](_0x441536,function(_0x66a7ca,_0x172a5a){if(_0x66a7ca){_0x4bd68d(_0x66a7ca);}else if(_0x172a5a){if(_0x172a5a[_0x78e7('0x4')]instanceof Buffer){fs['writeFile'](_0x57913b,_0x172a5a[_0x78e7('0x4')],function(_0x37cdc1){if(_0x37cdc1){_0x4bd68d(_0x37cdc1);}else{_0x5dd279();}});}else{_0x4bd68d(new Error(_0x78e7('0x5')));}}else{_0x4bd68d(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0x78e7('0x6')]=function(_0x12506a,_0x9db8f4,_0x5c4d80,_0x2977a6,_0x5e401d,_0x5c4f7b,_0xe0c974){var _0x52c8db=new AWS['Polly']({'accessKeyId':_0x12506a,'secretAccessKey':_0x9db8f4,'region':_0x5c4d80});var _0x4a1475={'Text':_0x5e401d,'TextType':_0x5c4f7b||_0x78e7('0x7'),'OutputFormat':_0x78e7('0x8'),'VoiceId':_0x2977a6};return pollyResult(_0x52c8db,_0x4a1475,_0xe0c974);}; \ 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 025f884..c4b5551 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 _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 +var _0x37e9=['./lib/api','exports'];(function(_0x1ec7b0,_0x2eb52a){var _0x5aff54=function(_0x1af5e6){while(--_0x1af5e6){_0x1ec7b0['push'](_0x1ec7b0['shift']());}};_0x5aff54(++_0x2eb52a);}(_0x37e9,0x158));var _0x937e=function(_0x5ca182,_0x40ed99){_0x5ca182=_0x5ca182-0x0;var _0x5b9d54=_0x37e9[_0x5ca182];return _0x5b9d54;};'use strict';var asr=require(_0x937e('0x0'));module[_0x937e('0x1')]=function(_0x76bfaa,_0x205f71,_0x2aa791,_0x58ea06){return asr(_0x76bfaa,_0x205f71,_0x2aa791);}; \ 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 da4829b..ee8644f 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 _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 +var _0xe739=['string','length','key\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','8000','url','https://speech.googleapis.com','exports'];(function(_0xa1afaa,_0x1c099c){var _0x1648b5=function(_0x39340d){while(--_0x39340d){_0xa1afaa['push'](_0xa1afaa['shift']());}};_0x1648b5(++_0x1c099c);}(_0xe739,0x105));var _0x9e73=function(_0x240911,_0x41846b){_0x240911=_0x240911-0x0;var _0x1bc381=_0xe739[_0x240911];return _0x1bc381;};'use strict';var url=require(_0x9e73('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host=_0x9e73('0x1');module[_0x9e73('0x2')]=function(_0x2dc1a9,_0x508042,_0x54a986){return new BPromise(function(_0x594f94,_0x3bbc00){var _0x43c2e8;if(typeof _0x2dc1a9!==_0x9e73('0x3')||_0x2dc1a9[_0x9e73('0x4')]===0x0){return _0x3bbc00('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x508042!==_0x9e73('0x3')||_0x508042[_0x9e73('0x4')]===0x0){return _0x3bbc00(_0x9e73('0x5'));}if(typeof _0x54a986!=='undefined'&&(typeof _0x54a986!==_0x9e73('0x3')||_0x54a986[_0x9e73('0x4')]===0x0)){return _0x3bbc00(_0x9e73('0x6'));}try{_0x43c2e8=fs[_0x9e73('0x7')](_0x2dc1a9)[_0x9e73('0x8')](_0x9e73('0x9'));}catch(_0x52393d){return _0x3bbc00(_0x52393d);}return _0x594f94({'method':_0x9e73('0xa'),'uri':host+'/v1/speech:recognize?key='+_0x508042,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0x9e73('0xb'),'languageCode':_0x54a986},'audio':{'content':_0x43c2e8}},'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 c13f6a8..35da3bc 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 _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 +var _0xe905=['exports'];(function(_0x2a9233,_0x5d10eb){var _0x1d62c0=function(_0xd6bedd){while(--_0xd6bedd){_0x2a9233['push'](_0x2a9233['shift']());}};_0x1d62c0(++_0x5d10eb);}(_0xe905,0x187));var _0x5e90=function(_0x479329,_0x4f0a5a){_0x479329=_0x479329-0x0;var _0x2442d8=_0xe905[_0x479329];return _0x2442d8;};var asr=require('./asr');module[_0x5e90('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 c60186f..707c738 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 _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 +var _0x29dc=['join','googleASR\x20transcription','catch','name','message','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','responseId','tildeASR','asr','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','model=%s','sestekNDA','nda','text','channelData','CustomAction','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','https','md5','querystring','request-promise','randomstring','sox','google-tts-api','url','parse','util','./aws','./google','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','host','path','WHAT_EVER','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','https:','data','transcode','wav','error\x20convert','start','resolve','tmp','base64','then','chmodSync','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','audioConfig','text:synthesize','POST','generate','.mp3','from','audioContent','writeFile','.wav','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','null','generic','slice','parse\x20response\x20failed:\x0a','length','lang\x20\x22','writeFileSync','goggleTTS\x20path','googleASR','uri','results','alternatives','transcript','confidence'];(function(_0x5598ae,_0x2921b9){var _0x437325=function(_0x4a8fb7){while(--_0x4a8fb7){_0x5598ae['push'](_0x5598ae['shift']());}};_0x437325(++_0x2921b9);}(_0x29dc,0x158));var _0xc29d=function(_0x24ae54,_0x38120d){_0x24ae54=_0x24ae54-0x0;var _0x39efee=_0x29dc[_0x24ae54];return _0x39efee;};'use strict';var apiai=require(_0xc29d('0x0'));var BPromise=require(_0xc29d('0x1'));var dialogflow=require(_0xc29d('0x2'));var fs=require('fs');var http=require(_0xc29d('0x3'));var https=require(_0xc29d('0x4'));var md5=require(_0xc29d('0x5'));var path=require('path');var querystring=require(_0xc29d('0x6'));var rp=require(_0xc29d('0x7'));var rs=require(_0xc29d('0x8'));var sox=require(_0xc29d('0x9'));var tts=require(_0xc29d('0xa'));var urlParse=require(_0xc29d('0xb'))[_0xc29d('0xc')];var util=require(_0xc29d('0xd'));var aws=require(_0xc29d('0xe'));var google=require(_0xc29d('0xf'));var sestek=require('./sestek');var tilde=require(_0xc29d('0x10'));var logger=require(_0xc29d('0x11'))(_0xc29d('0x12'));var ISPEECH_API=_0xc29d('0x13');function downloadFile(_0x78889a,_0x4765de){return new BPromise(function(_0x3f9d9d,_0x10eab4){var _0x297b01=urlParse(_0x78889a);var _0x590393=_0x297b01[_0xc29d('0x14')]==='https:'?https:http;var _0x366af5={'host':_0x297b01[_0xc29d('0x15')],'path':_0x297b01[_0xc29d('0x16')],'headers':{'user-agent':_0xc29d('0x17')}};_0x590393['get'](_0x366af5,function(_0x305026){if(_0x305026[_0xc29d('0x18')]!==0xc8){logger[_0xc29d('0x19')](_0xc29d('0x1a')+_0x78889a+_0xc29d('0x1b')+_0x305026[_0xc29d('0x18')]+'\x20('+_0x305026[_0xc29d('0x1c')]+')');_0x10eab4(new Error('request\x20to\x20'+_0x78889a+_0xc29d('0x1b')+_0x305026[_0xc29d('0x18')]+'\x20('+_0x305026['statusMessage']+')'));return;}var _0x3d7559=fs[_0xc29d('0x1d')](_0x4765de);_0x3d7559['on'](_0xc29d('0x1e'),function(){logger[_0xc29d('0x1f')](_0xc29d('0x20'));_0x3d7559[_0xc29d('0x21')](_0x3f9d9d);});_0x3d7559['on'](_0xc29d('0x19'),function(_0x14c74e){fs[_0xc29d('0x22')](_0x4765de);logger[_0xc29d('0x19')](_0xc29d('0x23'),_0x14c74e);_0x10eab4(_0x14c74e);});_0x305026[_0xc29d('0x24')](_0x3d7559);})['on'](_0xc29d('0x19'),function(_0x4e3c0b){logger[_0xc29d('0x19')](_0x4e3c0b);_0x10eab4(_0x4e3c0b);})[_0xc29d('0x25')]();});}function uploadFile(_0x3af4fc){return new BPromise(function(_0x162eae,_0x3494d9){var _0x359cb3=urlParse(_0x3af4fc);var _0x2314ab=_0x359cb3[_0xc29d('0x14')]===_0xc29d('0x26')?https:http;var _0x447cf6={'host':_0x359cb3['host'],'path':_0x359cb3[_0xc29d('0x16')],'headers':{'user-agent':'WHAT_EVER'}};_0x2314ab['get'](_0x447cf6,function(_0x471a97){if(_0x471a97[_0xc29d('0x18')]!==0xc8){_0x3494d9(new Error('request\x20to\x20'+_0x3af4fc+_0xc29d('0x1b')+_0x471a97[_0xc29d('0x18')]+'\x20('+_0x471a97[_0xc29d('0x1c')]+')'));return;}var _0x133ea6='';_0x471a97['on'](_0xc29d('0x27'),function(_0x2ed234){_0x133ea6+=_0x2ed234;});_0x471a97['on'](_0xc29d('0x25'),function(){_0x162eae(_0x133ea6);});})['on'](_0xc29d('0x19'),function(_0x18fba5){_0x3494d9(_0x18fba5);})[_0xc29d('0x25')]();});}function convertFile(_0x31f018,_0x28a6d9){return new BPromise(function(_0x5794cf,_0x2915f9){var _0x54dacc=sox[_0xc29d('0x28')](_0x31f018,_0x28a6d9,{'sampleRate':0x1f40,'format':_0xc29d('0x29'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x54dacc['on'](_0xc29d('0x19'),function(_0x45553e){logger[_0xc29d('0x19')](_0xc29d('0x2a'),_0x45553e);_0x2915f9(_0x45553e);});_0x54dacc['on'](_0xc29d('0x25'),function(){logger[_0xc29d('0x1f')]('finish\x20to\x20convert');_0x5794cf();});_0x54dacc[_0xc29d('0x2b')]();});}function base64Decode(_0x5ad115,_0x53ad70){var _0x1cb823=path[_0xc29d('0x2c')](__dirname,_0xc29d('0x2d'),rs['generate'](0x4)+'.wav');fs['writeFileSync'](_0x1cb823,_0x5ad115,_0xc29d('0x2e'));return convertFile(_0x1cb823,_0x53ad70)[_0xc29d('0x2f')](function(){try{fs[_0xc29d('0x22')](_0x1cb823);fs[_0xc29d('0x30')](_0x53ad70,_0xc29d('0x31'));}catch(_0xb3e20a){logger[_0xc29d('0x19')](_0xb3e20a);}return _0x53ad70[_0xc29d('0x32')]('.')[0x0];});}function base64Encode(_0x5e8cb3){var _0x7da1dc=fs[_0xc29d('0x33')](_0x5e8cb3);return new Buffer(_0x7da1dc)[_0xc29d('0x34')](_0xc29d('0x2e'));}exports[_0xc29d('0x35')]=function(_0x30536c,_0x2ccbe9,_0x3bc11d,_0x333acb,_0x4a2dba,_0x431c25){var _0x50ab98,_0x463d7c;var _0x2d4572=_0xc29d('0x36');var _0x333a1a=_0xc29d('0x37')+_0x30536c;var _0xa7dfe6={};if(_0x2ccbe9===_0xc29d('0x38')){_0xa7dfe6[_0xc29d('0x39')]={'ssml':_0x3bc11d};}else{_0xa7dfe6[_0xc29d('0x39')]={'text':_0x3bc11d};};_0xa7dfe6['voice']={'languageCode':_0x333acb,'ssmlGender':_0x4a2dba};_0xa7dfe6[_0xc29d('0x3a')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x5ae28f={'url':_0x2d4572+_0xc29d('0x3b')+_0x333a1a,'method':_0xc29d('0x3c'),'json':!![],'body':_0xa7dfe6};return rp(_0x5ae28f)[_0xc29d('0x2f')](function(_0x3e7985){return new BPromise(function(_0x4aae13,_0xf595b1){_0x50ab98=path[_0xc29d('0x2c')](__dirname,_0xc29d('0x2d'),rs[_0xc29d('0x3d')](0x4)+_0xc29d('0x3e'));var _0x2a5b5e=Buffer[_0xc29d('0x3f')](_0x3e7985[_0xc29d('0x40')],_0xc29d('0x2e'));return fs[_0xc29d('0x41')](_0x50ab98,_0x2a5b5e,function(_0x1057d4){_0xf595b1(_0x1057d4);},function(_0x2ca7ee){fs[_0xc29d('0x30')](_0x50ab98,_0xc29d('0x31'));_0x4aae13(_0x2ca7ee);});});})[_0xc29d('0x2f')](function(_0x5eb21c){_0x463d7c=path[_0xc29d('0x2c')](__dirname,'tmp',rs[_0xc29d('0x3d')](0x4)+_0xc29d('0x42'));return convertFile(_0x50ab98,_0x463d7c);})[_0xc29d('0x2f')](function(){try{fs[_0xc29d('0x22')](_0x50ab98);fs['chmodSync'](_0x463d7c,'777');}catch(_0x4c7404){logger['error'](_0x4c7404);}logger[_0xc29d('0x1f')](_0xc29d('0x43'),_0x463d7c[_0xc29d('0x32')]('.')[0x0]);return _0x463d7c['split']('.')[0x0];});};exports[_0xc29d('0x44')]=function(_0x4c9aec,_0x2ad5d7){var _0x307d6c=_0xc29d('0x45');var _0x578ed6,_0x59359d;var _0x1d3e43;var _0x9f486d={'encoding':_0xc29d('0x46'),'method':_0xc29d('0x3c'),'timeout':0x2710,'url':_0x307d6c,'headers':{'Content-Type':_0xc29d('0x47')},'body':_0xc29d('0x48')+encodeURIComponent(JSON[_0xc29d('0x49')]([[['jQ1olc',JSON['stringify']([_0x4c9aec,_0x2ad5d7||'en',![],_0xc29d('0x4a')]),null,_0xc29d('0x4b')]]]))};return rp(_0x9f486d)[_0xc29d('0x2f')](function(_0x4cd238){try{_0x1d3e43=eval(_0x4cd238[_0xc29d('0x4c')](0x5))[0x0][0x2];}catch(_0x537324){throw new Error(_0xc29d('0x4d')+_0x4cd238[_0xc29d('0x27')]);}if(!_0x1d3e43){if(_0x4c9aec[_0xc29d('0x4e')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0xc29d('0x4f')+_0x2ad5d7+'\x22\x20might\x20not\x20exist');}}try{_0x1d3e43=eval(_0x1d3e43)[0x0];}catch(_0x117c05){throw new Error(_0xc29d('0x4d')+res[_0xc29d('0x27')]);}const _0x4a21f7=_0x1d3e43;_0x578ed6=path['resolve'](__dirname,_0xc29d('0x2d'),rs['generate'](0x4)+_0xc29d('0x3e'));fs[_0xc29d('0x50')](_0x578ed6,_0x1d3e43,{'encoding':_0xc29d('0x2e')});_0x59359d=path['resolve'](__dirname,_0xc29d('0x2d'),rs['generate'](0x4)+_0xc29d('0x42'));return convertFile(_0x578ed6,_0x59359d);})['then'](function(){try{fs['unlink'](_0x578ed6);fs[_0xc29d('0x30')](_0x59359d,'777');}catch(_0x1f4f26){logger[_0xc29d('0x19')](_0x1f4f26);}logger[_0xc29d('0x1f')](_0xc29d('0x51'),_0x59359d[_0xc29d('0x32')]('.')[0x0]);return _0x59359d[_0xc29d('0x32')]('.')[0x0];});};exports[_0xc29d('0x52')]=function(_0x1ee111,_0x341724,_0x596e45){return google['asr'](_0x1ee111,_0x341724,_0x596e45)['then'](function(_0xcefc7e){logger[_0xc29d('0x1f')](_0xcefc7e[_0xc29d('0x53')]);return rp(_0xcefc7e);})['then'](function(_0x58dc5f){var _0x8ae512='';var _0x41f061=0x0;try{fs[_0xc29d('0x22')](_0x1ee111);}catch(_0x1927a6){logger[_0xc29d('0x19')](_0x1927a6);}if(_0x58dc5f&&_0x58dc5f[_0xc29d('0x54')]){_0x8ae512=_0x58dc5f[_0xc29d('0x54')]['map'](function(_0x1945eb){return _0x1945eb&&_0x1945eb[_0xc29d('0x55')][0x0]&&_0x1945eb[_0xc29d('0x55')][0x0][_0xc29d('0x56')]?_0x1945eb['alternatives'][0x0][_0xc29d('0x56')]:'';})['join']('\x0a');_0x41f061=_0x58dc5f['results']['map'](function(_0x59d4d3){return _0x59d4d3&&_0x59d4d3[_0xc29d('0x55')][0x0]&&_0x59d4d3['alternatives'][0x0][_0xc29d('0x57')]?_0x59d4d3[_0xc29d('0x55')][0x0][_0xc29d('0x57')]:0x0;})[_0xc29d('0x58')]('\x0a');}logger['info'](_0xc29d('0x59'),_0x8ae512);logger['info']('googleASR\x20confidence',_0x41f061);return{'transcript':_0x8ae512,'confidence':_0x41f061};})[_0xc29d('0x5a')](function(_0x5d0cbf){logger[_0xc29d('0x19')]('[%s]\x20%s:%s',_0x5d0cbf[_0xc29d('0x18')],_0x5d0cbf[_0xc29d('0x5b')],_0x5d0cbf[_0xc29d('0x5c')]);});};exports['googleDialogflow']=function(_0x2976c8,_0x26a454,_0xbb9135,_0x17ad5d){var _0x28565b=apiai(_0x26a454,{'language':_0x17ad5d||'en'});return _0x28565b['textRequest'](_0xbb9135,{'sessionId':md5(_0x2976c8)})['then'](function(_0x5f528d){logger[_0xc29d('0x1f')](JSON[_0xc29d('0x49')](_0x5f528d));return{'source':_0x5f528d[_0xc29d('0x5d')][_0xc29d('0x5e')],'resolvedQuery':_0x5f528d[_0xc29d('0x5d')][_0xc29d('0x5f')],'action':_0x5f528d['result'][_0xc29d('0x60')],'actionIncomplete':_0x5f528d[_0xc29d('0x5d')][_0xc29d('0x61')],'speech':_0x5f528d[_0xc29d('0x5d')][_0xc29d('0x62')][_0xc29d('0x63')],'score':_0x5f528d[_0xc29d('0x5d')]['score'],'statusCode':_0x5f528d[_0xc29d('0x64')][_0xc29d('0x65')],'endConversation':_0x5f528d[_0xc29d('0x5d')][_0xc29d('0x66')][_0xc29d('0x67')]||![],'isFallbackIntent':_0x5f528d[_0xc29d('0x5d')][_0xc29d('0x66')][_0xc29d('0x68')]};});};exports[_0xc29d('0x69')]=function(_0x2b99f8,_0x16ac31,_0x34699a,_0x41d985,_0x1dc76c,_0x3fb29f){var _0x35df41=_0x41d985[_0xc29d('0x6a')](/\\n/g,'\x0a');var _0x5a6ed5={'credentials':{'private_key':_0x35df41,'client_email':_0x34699a}};var _0x1a7b59=new dialogflow[(_0xc29d('0x6b'))](_0x5a6ed5);var _0x1e513a=_0x1a7b59[_0xc29d('0x6c')](_0x16ac31,md5(_0x2b99f8));var _0x4fec77={'session':_0x1e513a,'queryInput':{'text':{'text':_0x1dc76c,'languageCode':_0x3fb29f}}};return _0x1a7b59[_0xc29d('0x6d')](_0x4fec77)[_0xc29d('0x2f')](function(_0x2b6c3c){if(_0x2b6c3c&&_0x2b6c3c['length']){logger[_0xc29d('0x1f')]('Dialogflow\x20V2\x20response:',JSON['stringify'](_0x2b6c3c));var _0x58a302=_0x2b6c3c[0x0];if(_0x58a302){var _0x583031={'action':_0x58a302[_0xc29d('0x6e')]['action'],'allRequiredParamsPresent':_0x58a302['queryResult'][_0xc29d('0x6f')],'endConversation':_0x58a302[_0xc29d('0x6e')][_0xc29d('0x70')]&&_0x58a302[_0xc29d('0x6e')][_0xc29d('0x70')][_0xc29d('0x71')]?_0x58a302['queryResult'][_0xc29d('0x70')][_0xc29d('0x71')][_0xc29d('0x72')][_0xc29d('0x73')]:![],'fulfillmentText':_0x58a302[_0xc29d('0x6e')][_0xc29d('0x74')],'intentName':_0x58a302[_0xc29d('0x6e')][_0xc29d('0x75')]['name'],'intentDisplayName':_0x58a302[_0xc29d('0x6e')][_0xc29d('0x75')][_0xc29d('0x76')],'isFallbackIntent':_0x58a302[_0xc29d('0x6e')][_0xc29d('0x75')][_0xc29d('0x77')],'languageCode':_0x58a302['queryResult'][_0xc29d('0x78')],'queryText':_0x58a302[_0xc29d('0x6e')][_0xc29d('0x79')],'responseId':_0x58a302[_0xc29d('0x7a')],'score':_0x58a302['queryResult']['intentDetectionConfidence'],'speech':_0x58a302[_0xc29d('0x6e')][_0xc29d('0x74')],'providerResponse':JSON[_0xc29d('0x49')](_0x2b6c3c)};return _0x583031;}}});};exports[_0xc29d('0x7b')]=function(_0x22f686,_0x5f240f,_0x21d690,_0x214282){return tilde[_0xc29d('0x7c')](_0x22f686,_0x5f240f,_0x21d690,_0x214282)[_0xc29d('0x2f')](function(_0x3c0779){try{fs[_0xc29d('0x22')](_0x22f686);}catch(_0x222ab1){logger['error'](_0x222ab1);}logger[_0xc29d('0x1f')](_0xc29d('0x7d'),_0x3c0779[_0xc29d('0x56')]);logger[_0xc29d('0x1f')](_0xc29d('0x7e'),_0x3c0779[_0xc29d('0x57')]);return _0x3c0779;});};exports[_0xc29d('0x7f')]=function(_0x5d0e29,_0x45133f,_0x2eb657,_0x91b000,_0x3fee93,_0x20289f){var _0x5e7f62=path[_0xc29d('0x2c')](__dirname,_0xc29d('0x2d'),rs[_0xc29d('0x3d')](0x4)+'.mp3');var _0x18ca78;return aws[_0xc29d('0x80')](_0x5d0e29,_0x45133f,_0x2eb657,_0x91b000,_0x3fee93,_0x20289f,_0x5e7f62)[_0xc29d('0x2f')](function(){_0x18ca78=path[_0xc29d('0x2c')](__dirname,_0xc29d('0x2d'),rs[_0xc29d('0x3d')](0x4)+_0xc29d('0x42'));return convertFile(_0x5e7f62,_0x18ca78);})[_0xc29d('0x2f')](function(){try{fs[_0xc29d('0x22')](_0x5e7f62);fs[_0xc29d('0x30')](_0x18ca78,_0xc29d('0x31'));}catch(_0x1ea540){logger[_0xc29d('0x19')](_0x1ea540);}return _0x18ca78[_0xc29d('0x32')]('.')[0x0];});};exports[_0xc29d('0x81')]=function(_0x243991,_0x3719bc,_0x546043,_0x1cbbfb,_0x5c4f64,_0x5c462e){return aws[_0xc29d('0x82')](_0x243991,_0x3719bc,_0x546043,_0x1cbbfb,_0x5c4f64,_0x5c462e)['then'](function(_0x328826){logger[_0xc29d('0x1f')](JSON[_0xc29d('0x49')](_0x328826));return _0x328826;});};exports[_0xc29d('0x83')]=function(_0x457538,_0xda0488,_0x518df7,_0x4ae43b){var _0x8fcad1=util[_0xc29d('0x84')](_0xc29d('0x85'),ISPEECH_API,_0x457538,encodeURIComponent(_0xda0488),_0x518df7,_0x4ae43b);var _0x37f5ef=path[_0xc29d('0x2c')](__dirname,'tmp',rs[_0xc29d('0x3d')](0x4)+_0xc29d('0x3e'));var _0x3cca53;return downloadFile(_0x8fcad1,_0x37f5ef)[_0xc29d('0x2f')](function(){_0x3cca53=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+_0xc29d('0x42'));return convertFile(_0x37f5ef,_0x3cca53);})[_0xc29d('0x2f')](function(){try{fs[_0xc29d('0x22')](_0x37f5ef);fs[_0xc29d('0x30')](_0x3cca53,_0xc29d('0x31'));}catch(_0x180157){logger[_0xc29d('0x19')](_0x180157);}return _0x3cca53[_0xc29d('0x32')]('.')[0x0];});};exports['ispeechASR']=function(_0x411c97,_0x5aa423,_0x1a0f86,_0x38c4b8){var _0x47daea=util[_0xc29d('0x84')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x5aa423,_0x1a0f86,base64Encode(_0x411c97),_0x38c4b8?util[_0xc29d('0x84')](_0xc29d('0x86'),encodeURIComponent(_0x38c4b8)):'freeform=3');return uploadFile(_0x47daea)[_0xc29d('0x2f')](function(_0x28802e){return querystring[_0xc29d('0xc')](_0x28802e);});};exports[_0xc29d('0x87')]=function(_0x1b73ec,_0x372831){return sestek[_0xc29d('0x88')](_0x1b73ec,_0x372831)[_0xc29d('0x2f')](function(_0x1fa3f9){logger['info'](JSON['stringify'](_0x1fa3f9));var _0x18cb52={'speech':_0x1fa3f9[_0xc29d('0x89')],'action':_0x1fa3f9[_0xc29d('0x8a')]?_0x1fa3f9[_0xc29d('0x8a')][_0xc29d('0x8b')]:undefined,'actiondata':_0x1fa3f9[_0xc29d('0x8a')]?_0x1fa3f9['channelData']['CustomActionData']:undefined};if(_0x1fa3f9[_0xc29d('0x8a')]&&_0x1fa3f9[_0xc29d('0x8a')][_0xc29d('0x8c')]){return base64Decode(_0x1fa3f9['channelData']['AudioFromTts'][_0xc29d('0x8d')],path[_0xc29d('0x2c')](__dirname,_0xc29d('0x2d'),rs[_0xc29d('0x3d')](0x4)+_0xc29d('0x42')))[_0xc29d('0x2f')](function(_0x554474){_0x18cb52[_0xc29d('0x8e')]=_0x554474;return _0x18cb52;});}return _0x18cb52;});};exports[_0xc29d('0x8f')]=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 e4dbd3f..f8f7b19 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 _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 +var _0x5ce5=['./nda'];(function(_0x9a3bfd,_0x75893c){var _0x10f8a=function(_0x2c9d51){while(--_0x2c9d51){_0x9a3bfd['push'](_0x9a3bfd['shift']());}};_0x10f8a(++_0x75893c);}(_0x5ce5,0xdc));var _0x55ce=function(_0x5ad98a,_0x170716){_0x5ad98a=_0x5ad98a-0x0;var _0x5d2c41=_0x5ce5[_0x5ad98a];return _0x5d2c41;};var nda=require(_0x55ce('0x0'));module['exports']={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 8ca28bc..3aed504 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 _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 +var _0xc964=['resolve','ndauth_url','/token','password','username','then','POST','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','callerid','calleridname','dnid','text','project','body','channelData','ndagenerate_audio','audio/wav','custom_action','CustomAction','custom_action_data','stringify','request-promise','url','agi','exports'];(function(_0x530f37,_0x5a058d){var _0x76632a=function(_0x3c42ae){while(--_0x3c42ae){_0x530f37['push'](_0x530f37['shift']());}};_0x76632a(++_0x5a058d);}(_0xc964,0x7e));var _0x4c96=function(_0x167ae3,_0x546b82){_0x167ae3=_0x167ae3-0x0;var _0x1c2abb=_0xc964[_0x167ae3];return _0x1c2abb;};'use strict';var rp=require(_0x4c96('0x0'));var url=require(_0x4c96('0x1'));var logger=require('../../../../../config/logger')(_0x4c96('0x2'));module[_0x4c96('0x3')]=function(_0x90fbb1,_0x591daa){var _0x2777bb={'method':'POST','uri':url[_0x4c96('0x4')](_0x591daa[_0x4c96('0x5')],_0x4c96('0x6')),'form':{'grant_type':_0x4c96('0x7'),'username':_0x591daa[_0x4c96('0x8')],'password':_0x591daa[_0x4c96('0x7')]},'json':!![]};return rp(_0x2777bb)[_0x4c96('0x9')](function(_0x493618){var _0x19ed76={'method':_0x4c96('0xa'),'uri':url[_0x4c96('0x4')](_0x591daa['ndassistant_url'],_0x4c96('0xb')),'body':{'type':_0x591daa[_0x4c96('0xc')]||'message','channelId':'Nda','conversation':{'id':_0x90fbb1['uniqueid']},'from':{'id':_0x90fbb1[_0x4c96('0xd')],'name':_0x90fbb1[_0x4c96('0xe')]},'recipient':{'id':_0x90fbb1[_0x4c96('0xf')],'name':_0x90fbb1['extension']},'text':_0x591daa[_0x4c96('0x10')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x493618['access_token']},'json':!![]};if(_0x591daa[_0x4c96('0x11')]){_0x19ed76[_0x4c96('0x12')][_0x4c96('0x13')]['ProjectName']=_0x591daa['project'];}if(_0x591daa[_0x4c96('0x14')]=='1'){_0x19ed76[_0x4c96('0x12')][_0x4c96('0x13')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x4c96('0x15')};}if(_0x591daa[_0x4c96('0x16')]){_0x19ed76[_0x4c96('0x12')][_0x4c96('0x13')][_0x4c96('0x17')]=_0x591daa[_0x4c96('0x16')];if(_0x591daa[_0x4c96('0x18')]){_0x19ed76['body'][_0x4c96('0x13')]['CustomActionData']=_0x591daa[_0x4c96('0x18')];}}logger['info'](JSON[_0x4c96('0x19')](_0x19ed76));return rp(_0x19ed76);});}; \ 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 197d7fa..404f130 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 _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 +var _0x3c2f=['exports','./lib/api'];(function(_0x2d93a9,_0x10d74e){var _0x333057=function(_0x42ce69){while(--_0x42ce69){_0x2d93a9['push'](_0x2d93a9['shift']());}};_0x333057(++_0x10d74e);}(_0x3c2f,0x133));var _0xf3c2=function(_0x1fa274,_0x27a51f){_0x1fa274=_0x1fa274-0x0;var _0x5601e0=_0x3c2f[_0x1fa274];return _0x5601e0;};'use strict';var asr=require(_0xf3c2('0x0'));module[_0xf3c2('0x1')]=function(_0x5dd8f3,_0x5ac81a,_0x5cee22,_0x27424b){return asr(_0x5dd8f3,_0x5ac81a,_0x5cee22,_0x27424b);}; \ 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 7e83f65..ca5f25e 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 _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 +var _0x1af0=['message','lodash','moment','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','createReadStream','data','close','EOS','error','stringify','terminate','Tilde\x20ASR\x20hypoteses','result','hypotheses','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','isNil','isObject','open'];(function(_0x2c48b0,_0x14f8c1){var _0x1fe343=function(_0x48a686){while(--_0x48a686){_0x2c48b0['push'](_0x2c48b0['shift']());}};_0x1fe343(++_0x14f8c1);}(_0x1af0,0xc9));var _0x01af=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x1af0[_0x618414];return _0x21c19a;};'use strict';var BPromise=require('bluebird');var _=require(_0x01af('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x01af('0x1'));var crypto=require(_0x01af('0x2'));var logger=require(_0x01af('0x3'))(_0x01af('0x4'));module[_0x01af('0x5')]=function(_0x2985d2,_0x3d8098,_0x4c63bd,_0x2d0f03){return new BPromise(function(_0x1517ff,_0x2adf0d){logger[_0x01af('0x6')](_0x01af('0x7'),_0x2d0f03||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x513621=new WebSocket(_0x2d0f03||_0x01af('0x8'),{'perMessageDeflate':![]});var _0x53170c='';var _0x4b83ca='0';var _0x23e46c='1';var _0x10b411=_0x01af('0x9');function _0x358602(_0xbb5d9b){var _0x440c3c=crypto[_0x01af('0xa')](_0x01af('0xb'));_0x440c3c[_0x01af('0xc')](_0xbb5d9b);return _0x440c3c[_0x01af('0xd')](_0x01af('0xe'));}function _0x2cbfbd(){try{logger[_0x01af('0x6')](_0x01af('0xf'));var _0x15986f=moment()[_0x01af('0x10')]();var _0x3570a5=_0x358602(_0x15986f+_0x3d8098+_0x4c63bd);_0x513621[_0x01af('0x11')](JSON['stringify']({'appID':_0x3d8098,'timestamp':_0x15986f,'appKey':_0x3570a5}));var _0x233020=fs[_0x01af('0x12')](_0x2985d2);_0x233020['on'](_0x01af('0x13'),function(_0x41bb2a){_0x513621[_0x01af('0x11')](_0x41bb2a);});_0x233020['on'](_0x01af('0x14'),function(){_0x513621[_0x01af('0x11')](_0x01af('0x15'));});}catch(_0x13ed1a){logger[_0x01af('0x16')]('Tilde\x20ASR\x20send\x20error',JSON[_0x01af('0x17')](_0x13ed1a));_0x513621[_0x01af('0x18')]();}}function _0x1a2ee0(_0x304315){try{if(_0x304315){var _0x47ca43=JSON['parse'](_0x304315);switch(_0x47ca43['status']){case 0x0:if(_0x47ca43['result']){if(_0x47ca43['result']['final']){logger['info'](_0x01af('0x19'),JSON['stringify'](_0x47ca43[_0x01af('0x1a')][_0x01af('0x1b')]));_0x53170c=_0x47ca43[_0x01af('0x1a')][_0x01af('0x1b')][0x0]['transcript'];_0x4b83ca=_0x47ca43[_0x01af('0x1a')][_0x01af('0x1b')][0x0][_0x01af('0x1c')];_0x23e46c='0';_0x10b411=_0x01af('0x1d');_0x513621[_0x01af('0x18')]();}}break;case 0x1:logger['info'](_0x01af('0x9'));_0x23e46c='1';_0x10b411=_0x01af('0x9');break;case 0x2:logger[_0x01af('0x6')](_0x01af('0x1e'));_0x23e46c='2';_0x10b411=_0x01af('0x1e');break;case 0x9:logger[_0x01af('0x6')](_0x01af('0x1f'));_0x23e46c='9';_0x10b411=_0x01af('0x1f');break;case 0xa:logger[_0x01af('0x6')]('Authentication\x20failed.');_0x23e46c='10';_0x10b411=_0x01af('0x20');break;case 0xb:logger['info'](_0x01af('0x21'));_0x23e46c='11';_0x10b411=_0x01af('0x21');}}}catch(_0xbe1d69){logger[_0x01af('0x16')](_0x01af('0x22'),JSON['stringify'](_0xbe1d69));_0x513621[_0x01af('0x18')]();}}function _0xccb579(){logger[_0x01af('0x6')](_0x01af('0x23'));_0x1517ff({'transcript':_0x53170c,'confidence':_0x4b83ca,'status':_0x23e46c,'status_message':_0x10b411});}function _0x59ab74(_0x364530){logger[_0x01af('0x16')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0x01af('0x24')](_0x364530)){logger[_0x01af('0x16')](_[_0x01af('0x25')](_0x364530)?JSON['stringify'](_0x364530):_0x364530);}}_0x513621['on'](_0x01af('0x26'),_0x2cbfbd);_0x513621['on'](_0x01af('0x27'),_0x1a2ee0);_0x513621['on'](_0x01af('0x14'),_0xccb579);_0x513621['on'](_0x01af('0x16'),_0x59ab74);});}; \ 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 476902f..f9a9dc1 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 _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 +var _0x98a7=['exports','./asr'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x98a7,0x67));var _0x798a=function(_0x3157e5,_0x1868ef){_0x3157e5=_0x3157e5-0x0;var _0x38f981=_0x98a7[_0x3157e5];return _0x38f981;};var asr=require(_0x798a('0x0'));module[_0x798a('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 41bc14c..9c76688 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 _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 +var _0xd8b0=['getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util','net','./channel','127.0.0.1','call','error','E_AGI_ARGUMENT_PORT','listen','listening','emit','connection'];(function(_0x3d2490,_0x536fa1){var _0x2e3a0f=function(_0x18d953){while(--_0x18d953){_0x3d2490['push'](_0x3d2490['shift']());}};_0x2e3a0f(++_0x536fa1);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0x0d8b('0x0'));var net=require(_0x0d8b('0x1'));var EventEmitter=require('events')['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x0d8b('0x2'));var AGIServer=function(_0x5b9b89,_0x43bca1,_0x364286){var _0x8196ed=this;var _0x577834=null;var _0x5e15e6=0x0;if(!_0x5b9b89)_0x5b9b89=0x11dd;if(!_0x43bca1)_0x43bca1=_0x0d8b('0x3');EventEmitter[_0x0d8b('0x4')](_0x8196ed);function _0x39f43a(){if(!_0x5b9b89){_0x8196ed['emit'](_0x0d8b('0x5'),new AGIError(_0x0d8b('0x6')));return![];}_0x577834=net['createServer']();_0x577834[_0x0d8b('0x7')](_0x5b9b89,_0x43bca1);_0x577834['on'](_0x0d8b('0x8'),function(){_0x8196ed[_0x0d8b('0x9')](_0x0d8b('0x8'));});_0x577834['on'](_0x0d8b('0xa'),function(_0x1cac62){_0x577834[_0x0d8b('0xb')](function(_0x28f87c,_0x48fa16){if(_0x28f87c){_0x8196ed[_0x0d8b('0x9')]('error',new AGIError(_0x0d8b('0xc'),_0x28f87c));}else if(_0x364286&&_0x364286<0x0){_0x8196ed[_0x0d8b('0x9')](_0x0d8b('0x5'),new AGIError(_0x0d8b('0xd')));_0x1cac62[_0x0d8b('0xe')]();}else if(_0x364286&&_0x364286>0x0&&_0x364286<_0x48fa16){_0x5e15e6+=0x1;_0x8196ed[_0x0d8b('0x9')](_0x0d8b('0x5'),new AGIError(_0x0d8b('0xf'),_0x5e15e6));_0x1cac62[_0x0d8b('0xe')]();}else{var _0x2ce75e=new AGIChannel(_0x1cac62);_0x2ce75e['on'](_0x0d8b('0x10'),function(){_0x8196ed[_0x0d8b('0x9')](_0x0d8b('0xa'),_0x2ce75e);});}});});_0x577834['on'](_0x0d8b('0x5'),function(_0x4f6f21){_0x8196ed[_0x0d8b('0x9')](_0x0d8b('0x5'),new AGIError(_0x0d8b('0xc'),_0x4f6f21[_0x0d8b('0x11')]));});_0x577834['on'](_0x0d8b('0x12'),function(){_0x8196ed['emit'](_0x0d8b('0x12'),new AGIError(_0x0d8b('0x13')));});}process[_0x0d8b('0x14')](function(){_0x39f43a();});};util[_0x0d8b('0x15')](AGIServer,EventEmitter);module[_0x0d8b('0x16')]=function(_0x18dd2d,_0x264b39,_0xa3612a){return new AGIServer(_0x18dd2d,_0x264b39,_0xa3612a);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 0442354..c05f8ba 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 _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 +var _0x9649=['Query\x20executed\x20correctly\x20%s','close','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','context','extension','dnid','file','createSquareMessage','createCmContact','isNil','random','isEmpty','lastName','phone','list_id','callback','Callback\x20scheduled\x20at\x20','scheduledAt','callback_priority','getPause','getPauseById','agent','agentUnpause','agentLogout','internal','%s/%s@from-sip/n','agentLogin','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','number','POST','PUT','toUpperCase','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','body','parse','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','googleDialogflowV2','dialogflowV2_project_id','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','Amy','aws_text_type','awsLex','aws_access_key_id','googleASR','tildeASR','appsecret','clear','includes','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','saveRestApiResult','format','%s.%s','setVariable','length','split','replaceAll','extra','toString','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','mrcpsynth','MRCPSynth','result','noop','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','agi','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','Executed\x20command\x20MRCPSynth\x20%s','sestektts','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_INSTANCE','SESTEK_ASR_CONFIDENCE','RECOG_INPUT()','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','getSquareOdbc','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','out','Dialogflow\x20Result\x20%s','speech','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20client_email\x20configured','private_key','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','ndauth_url','no\x20ndauth\x20url\x20configured','username','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','streamFile','unlink','.wav','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','Executed\x20command\x20%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','response','maxdigit','hiddendigitsnum','generate','first','substr','getsecretdigits','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws_secret_access_key','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','amazonlex','Amazon\x20Lex\x20Result\x20%s','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','recordFile','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','appid','no\x20appid\x20configured','no\x20appsecret\x20configured','intKey','tilde\x20%s\x20file\x20created','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','priority','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','EVAL\x20CONDITION\x20%s\x20%s','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','getData','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','agentPause','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','RECORDING_SAVENAME','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','no\x20mail\x20account\x20configured','account_id','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','Smtp','bcc','template_id','debug','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','sms_account_id','no\x20sms\x20account\x20configured','sms_text','Trying\x20SendSMS\x20with\x20account\x20%s','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','XMCS-UNIQUEID','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','no\x20subproject\x20selected','getSquareProject','no\x20subproject\x20found\x20with\x20id\x20%d','project_id','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','shellCommand','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','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','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','lodash','shelljs','odbc','moment','mustache','../../config/logger','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','channel','rpc','getVariable','getVariableById','catch','getVoiceQueue','getVoiceQueueById','then','name','prototype','getSquareProjectById','getSquareOdbcById','dsn','getUserById','getTrunk','getSound','getSoundPath','save_name','getMailAccount','sendMailMessage','mailRpc','getIntervals','interval','map','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','query','info'];(function(_0x16dbcd,_0x274516){var _0x34706e=function(_0x43433d){while(--_0x43433d){_0x16dbcd['push'](_0x16dbcd['shift']());}};_0x34706e(++_0x274516);}(_0x9649,0x19f));var _0x9964=function(_0x5c0dbe,_0x3c594b){_0x5c0dbe=_0x5c0dbe-0x0;var _0x5f1bf5=_0x9649[_0x5c0dbe];return _0x5f1bf5;};'use strict';var fs=require('fs');var util=require(_0x9964('0x0'));var _=require(_0x9964('0x1'));var sh=require(_0x9964('0x2'));var odbc=require(_0x9964('0x3'))();var rs=require('randomstring');var moment=require(_0x9964('0x4'));var Mustache=require(_0x9964('0x5'));var rp=require('request-promise');var logger=require(_0x9964('0x6'))('agi');var config=require(_0x9964('0x7'));var scripts=require(_0x9964('0x8'));var FILES_PATH=_0x9964('0x9');var recursiveMapAttributes=[_0x9964('0xa'),_0x9964('0xb')];var verticesWithRetry=[_0x9964('0xc'),_0x9964('0xd'),'getsecretdigits'];var AGIVertices=function(_0x45dda7,_0x67291b,_0x5071f7){this[_0x9964('0xe')]=_0x45dda7;this[_0x9964('0xf')]=_0x67291b;this['mailRpc']=_0x5071f7;};AGIVertices['prototype'][_0x9964('0x10')]=function(_0x4c4a3d,_0xe205db){this[_0x9964('0xf')][_0x9964('0x11')](_0x4c4a3d)['then'](function(_0x2be3fc){_0xe205db(null,_0x2be3fc?_0x2be3fc['name']:![]);})[_0x9964('0x12')](function(_0x39c624){_0xe205db(_0x39c624);});};AGIVertices['prototype'][_0x9964('0x13')]=function(_0x39ef74,_0x5aa1a8){this[_0x9964('0xf')][_0x9964('0x14')](_0x39ef74)[_0x9964('0x15')](function(_0x46688a){_0x5aa1a8(null,_0x46688a?_0x46688a[_0x9964('0x16')]:![]);})['catch'](function(_0x411544){_0x5aa1a8(_0x411544);});};AGIVertices[_0x9964('0x17')]['getSquareProject']=function(_0x2fd50d,_0x3fe796){this['rpc'][_0x9964('0x18')](_0x2fd50d)[_0x9964('0x15')](function(_0x69994d){_0x3fe796(null,_0x69994d?_0x69994d[_0x9964('0x16')]:![]);})['catch'](function(_0x40b3dd){_0x3fe796(_0x40b3dd);});};AGIVertices[_0x9964('0x17')]['getSquareOdbc']=function(_0x2eb3a8,_0x3f6472){this[_0x9964('0xf')][_0x9964('0x19')](_0x2eb3a8)[_0x9964('0x15')](function(_0x1bf791){_0x3f6472(null,_0x1bf791?_0x1bf791[_0x9964('0x1a')]:![]);})[_0x9964('0x12')](function(_0x1072b5){_0x3f6472(_0x1072b5);});};AGIVertices[_0x9964('0x17')]['getUser']=function(_0x455b62,_0x447026){this['rpc'][_0x9964('0x1b')](_0x455b62)['then'](function(_0x242e0a){_0x447026(null,_0x242e0a?_0x242e0a[_0x9964('0x16')]:![]);})[_0x9964('0x12')](function(_0x167525){_0x447026(_0x167525);});};AGIVertices[_0x9964('0x17')][_0x9964('0x1c')]=function(_0x5f30e8,_0x452c96){this[_0x9964('0xf')]['getTrunkById'](_0x5f30e8)[_0x9964('0x15')](function(_0x15a14c){_0x452c96(null,_0x15a14c?_0x15a14c[_0x9964('0x16')]:![]);})[_0x9964('0x12')](function(_0x26cd95){_0x452c96(_0x26cd95);});};AGIVertices['prototype'][_0x9964('0x1d')]=function(_0x4c2b44,_0x44cb60){var _0x512f6b=this;this[_0x9964('0xf')]['getSoundById'](_0x4c2b44)[_0x9964('0x15')](function(_0x162b83){_0x44cb60(null,_0x162b83?_0x512f6b[_0x9964('0x1e')](_0x162b83[_0x9964('0x1f')]):![]);})[_0x9964('0x12')](function(_0x23df5e){_0x44cb60(_0x23df5e);});};AGIVertices[_0x9964('0x17')][_0x9964('0x20')]=function(_0x46c57d,_0x58ce2c){this['rpc']['getMailAccountById'](_0x46c57d)['then'](function(_0x36220b){_0x58ce2c(null,_0x36220b?_0x36220b:![]);})[_0x9964('0x12')](function(_0x4efb43){_0x58ce2c(_0x4efb43);});};AGIVertices[_0x9964('0x17')][_0x9964('0x21')]=function(_0x3092b2,_0x17a244,_0x9d4eaf){this[_0x9964('0x22')]['sendMailMessage'](_0x3092b2,_0x17a244)[_0x9964('0x15')](function(){_0x9d4eaf(null);})[_0x9964('0x12')](function(_0x59ab78){_0x9d4eaf(_0x59ab78);});};AGIVertices[_0x9964('0x17')][_0x9964('0x23')]=function(_0x3e5154,_0x257430){this['rpc']['getIntervalById'](_0x3e5154)[_0x9964('0x15')](function(_0x4e517c){if(_0x4e517c){if(_0x4e517c['IntervalId']){_0x257430(null,[_0x4e517c[_0x9964('0x24')]]);}else{_0x257430(null,_[_0x9964('0x25')](_0x4e517c['Intervals'],'interval'));}}else{_0x257430(null,![]);}})[_0x9964('0x12')](function(_0x71d436){_0x257430(_0x71d436);});};AGIVertices['prototype'][_0x9964('0x1e')]=function(_0x4fca90){return util['format']('%s/sounds/converted/%s',FILES_PATH,_0x4fca90);};AGIVertices[_0x9964('0x17')][_0x9964('0x26')]=function(_0x168f41,_0x1df24e,_0x2cdbbc){odbc[_0x9964('0x27')](_0x168f41,function(_0x31b296){if(_0x31b296){logger[_0x9964('0x28')](_0x9964('0x29'),_0x31b296);_0x2cdbbc(_0x31b296);}else{logger['info'](_0x9964('0x2a'));odbc[_0x9964('0x2b')](_0x1df24e,function(_0x39cd4a,_0x132c7c){if(_0x39cd4a){logger['info']('Error\x20executing\x20query\x20%s',_0x1df24e);_0x2cdbbc(_0x39cd4a);}else{logger[_0x9964('0x2c')](_0x9964('0x2d'),_0x1df24e);odbc[_0x9964('0x2e')](function(_0x1bad9d){if(_0x1bad9d){logger[_0x9964('0x28')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x1bad9d);}_0x2cdbbc(null,_0x132c7c);});}});}});};AGIVertices[_0x9964('0x17')][_0x9964('0x2f')]=function(_0x2b9684,_0x3bde2b){this[_0x9964('0xf')][_0x9964('0x30')](_0x2b9684)[_0x9964('0x15')](function(_0x178f52){_0x3bde2b(null,_0x178f52?_0x178f52:![]);})[_0x9964('0x12')](function(_0x29efe7){_0x3bde2b(_0x29efe7);});};AGIVertices[_0x9964('0x17')][_0x9964('0x31')]=function(_0x3539bf,_0xdc12f7){this[_0x9964('0xf')][_0x9964('0x31')](_0x3539bf)['then'](function(_0x344c6c){_0xdc12f7(null,_0x344c6c);})['catch'](function(_0x366b93){_0xdc12f7(_0x366b93);});};AGIVertices[_0x9964('0x17')][_0x9964('0x32')]=function(_0x4c3d38,_0xf4a80e,_0x5f5312){this[_0x9964('0xf')]['createSquareDetailsReport']({'uniqueid':this[_0x9964('0xe')][_0x9964('0x33')],'node':_0x4c3d38[_0x9964('0x34')],'application':_0x4c3d38[_0x9964('0x35')],'data':_0xf4a80e||null,'project_name':this[_0x9964('0xe')][_0x9964('0x36')],'callerid':this[_0x9964('0xe')][_0x9964('0x37')]})['then'](function(_0x2d83ea){if(_0x5f5312){_0x5f5312(null,_0x2d83ea);}})[_0x9964('0x12')](function(_0x2948f2){if(_0x5f5312){_0x5f5312(_0x2948f2);}});};AGIVertices[_0x9964('0x17')][_0x9964('0x38')]=function(_0x307787,_0xc717aa,_0x28ac20,_0x9841f8){this[_0x9964('0xf')]['createSquareRecording']({'uniqueid':this['channel'][_0x9964('0x33')],'callerid':this['channel'][_0x9964('0x37')],'calleridname':this['channel']['calleridname'],'context':this['channel'][_0x9964('0x39')],'extension':this[_0x9964('0xe')][_0x9964('0x3a')],'priority':this['channel']['priority'],'accountcode':this[_0x9964('0xe')]['accountcode'],'dnid':this[_0x9964('0xe')][_0x9964('0x3b')],'projectName':this[_0x9964('0xe')][_0x9964('0x36')],'saveName':_0xc717aa,'filename':_0x307787[_0x9964('0x3c')]||_0xc717aa,'savePath':_0x28ac20})[_0x9964('0x15')](function(_0x521d03){_0x9841f8(null,_0x521d03);})[_0x9964('0x12')](function(_0x323995){_0x9841f8(_0x323995);});};AGIVertices[_0x9964('0x17')][_0x9964('0x3d')]=function(_0x1c575b,_0x506c24,_0x1e7c32,_0x3873f5,_0x2847e8){this['rpc'][_0x9964('0x3d')]({'uniqueid':this[_0x9964('0xe')][_0x9964('0x33')],'body':_0x1c575b,'direction':_0x506c24,'providerName':_0x1e7c32,'providerResponse':_0x3873f5})[_0x9964('0x15')](function(_0x338140){if(_0x2847e8){_0x2847e8(null,_0x338140);}})[_0x9964('0x12')](function(_0x1a5344){if(_0x2847e8){_0x2847e8(_0x1a5344);}});};AGIVertices[_0x9964('0x17')]['createCmContact']=function(_0x67f068,_0x52566e){this['rpc'][_0x9964('0x3e')]({'firstName':_['isEmpty'](_0x67f068[_0x9964('0x16')])||_[_0x9964('0x3f')](_0x67f068[_0x9964('0x16')])?'callback_'+Math[_0x9964('0x40')]():_0x67f068[_0x9964('0x16')],'lastName':_[_0x9964('0x41')](_0x67f068[_0x9964('0x42')])||_[_0x9964('0x3f')](_0x67f068[_0x9964('0x42')])?null:_0x67f068[_0x9964('0x42')],'phone':_0x67f068[_0x9964('0x43')],'ListId':_0x67f068[_0x9964('0x44')],'scheduledat':_0x67f068['scheduledAt'],'callbackUniqueid':this[_0x9964('0xe')]['uniqueid'],'tags':_0x9964('0x45'),'description':_0x9964('0x46')+_0x67f068[_0x9964('0x47')]['toString'](),'priority':_0x67f068[_0x9964('0x48')]})[_0x9964('0x15')](function(_0x238867){_0x52566e(null,_0x238867);})[_0x9964('0x12')](function(_0xaf7e23){_0x52566e(_0xaf7e23);});};AGIVertices['prototype'][_0x9964('0x49')]=function(_0x205f12,_0x29c074){this[_0x9964('0xf')][_0x9964('0x4a')](_0x205f12)['then'](function(_0x5a0ece){_0x29c074(null,_0x5a0ece?_0x5a0ece['name']:![]);})['catch'](function(_0x368c1a){_0x29c074(_0x368c1a);});};AGIVertices['prototype']['agentPause']=function(_0x5b8892,_0x275535,_0x498c8f){var _0x28201d={'role':_0x9964('0x4b')};_0x28201d[_0x5b8892]=this[_0x9964('0xe')]['callerid'];this[_0x9964('0xf')]['agentPause'](_0x28201d,_0x275535,this['channel'][_0x9964('0x33')])[_0x9964('0x15')](function(_0x2ffa8e){_0x498c8f(null,_['isNil'](_0x2ffa8e)?![]:!![]);})[_0x9964('0x12')](function(_0x1b0752){logger[_0x9964('0x28')](_0x1b0752);_0x498c8f(null,![]);});};AGIVertices['prototype'][_0x9964('0x4c')]=function(_0x2f97c5,_0x3c846d){var _0x4e0e7c={'role':'agent'};_0x4e0e7c[_0x2f97c5]=this[_0x9964('0xe')][_0x9964('0x37')];this[_0x9964('0xf')][_0x9964('0x4c')](_0x4e0e7c)[_0x9964('0x15')](function(_0x222fd1){_0x3c846d(null,_[_0x9964('0x3f')](_0x222fd1)?![]:!![]);})[_0x9964('0x12')](function(_0x21a16f){logger[_0x9964('0x28')](_0x21a16f);_0x3c846d(null,![]);});};AGIVertices[_0x9964('0x17')][_0x9964('0x4d')]=function(_0x36d0c1,_0xc4ba66){var _0x3c706e={'role':'agent'};_0x3c706e[_0x36d0c1]=this[_0x9964('0xe')][_0x9964('0x37')];this[_0x9964('0xf')][_0x9964('0x4d')](_0x3c706e)['then'](function(_0x56bf70){_0xc4ba66(null,_['isNil'](_0x56bf70)?![]:!![]);})['catch'](function(_0x4e374e){logger[_0x9964('0x28')](_0x4e374e);_0xc4ba66(null,![]);});};AGIVertices[_0x9964('0x17')]['agentLogin']=function(_0x249fa7,_0x4434ac){var _0x61b486={'role':_0x9964('0x4b')};_0x61b486[_0x249fa7]=this[_0x9964('0xe')]['callerid'];var _0x3446c8=_0x249fa7!=_0x9964('0x4e')?util['format'](_0x9964('0x4f'),'LOCAL',this[_0x9964('0xe')]['callerid']):undefined;this[_0x9964('0xf')][_0x9964('0x50')](_0x61b486,_0x3446c8)['then'](function(_0x476dba){_0x4434ac(null,_['isNil'](_0x476dba)?![]:!![]);})['catch'](function(_0x1614ad){logger['error'](_0x1614ad);_0x4434ac(null,![]);});};AGIVertices[_0x9964('0x17')]['shellCommand']=function(_0x39acbe,_0x5666c0){sh[_0x9964('0x51')](_[_0x9964('0x52')](_0x39acbe),function(_0x336f52,_0x41144f){var _0x2d0b16=_0x41144f[_0x9964('0x53')](/(\r\n|\n|\r)/gm,'');_0x5666c0(null,_0x2d0b16);});};AGIVertices['prototype'][_0x9964('0x54')]=function(_0x2d90c9,_0xa59931){scripts['googleCloudTTS'](_0x2d90c9[_0x9964('0x55')],_0x2d90c9[_0x9964('0x56')]||_0x9964('0x57'),_0x2d90c9[_0x9964('0x57')],_0x2d90c9[_0x9964('0x58')]||_0x9964('0x59'),_0x2d90c9[_0x9964('0x5a')]||_0x9964('0x5b'),_0x2d90c9[_0x9964('0x5c')]||_0x9964('0x5d'))[_0x9964('0x15')](function(_0x5c6920){_0xa59931(null,_0x5c6920);})[_0x9964('0x12')](function(_0x587874){_0xa59931(_0x587874);});};AGIVertices[_0x9964('0x17')][_0x9964('0x5e')]=function(_0x19fbef,_0xcb9b08){scripts['googleTTS'](_0x19fbef[_0x9964('0x57')],_0x19fbef[_0x9964('0x5f')]||'en',0x1)[_0x9964('0x15')](function(_0x4727aa){_0xcb9b08(null,_0x4727aa);})[_0x9964('0x12')](function(_0x39d044){_0xcb9b08(_0x39d044);});};AGIVertices[_0x9964('0x17')][_0x9964('0x60')]=function(_0x24b96d,_0x16ba3a){var _0x4e3b67={'uri':_0x24b96d[_0x9964('0x61')],'method':_0x24b96d[_0x9964('0x62')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x24b96d[_0x9964('0x63')])===_0x9964('0x64')&&parseInt(_0x24b96d[_0x9964('0x63')])>=0x1?parseInt(_0x24b96d[_0x9964('0x63')])*0x3e8:0x5*0x3e8};if(_['includes']([_0x9964('0x65'),_0x9964('0x66')],_0x4e3b67[_0x9964('0x62')][_0x9964('0x67')]())){try{_0x4e3b67['body']=_0x24b96d['rawBody']?JSON['parse'](_0x24b96d[_0x9964('0xb')]):{};}catch(_0x373c88){logger['error'](_0x9964('0x68'),_0x373c88);}}try{_0x4e3b67[_0x9964('0x69')]=_0x24b96d[_0x9964('0xa')]?JSON['parse'](_0x24b96d[_0x9964('0xa')]):{};}catch(_0x43964c){logger['error'](_0x9964('0x6a'),_0x43964c);}if(_0x24b96d[_0x9964('0x6b')]){try{var _0x4a9a78=require(_0x24b96d[_0x9964('0x6b')])[_0x9964('0x6c')](this,_0x4e3b67);_0x4e3b67[_0x9964('0x6d')]=Mustache[_0x9964('0x6e')](_0x24b96d[_0x9964('0x61')],_0x4a9a78,{},['$$','$$']);if(_0x4e3b67['headers']){_0x4e3b67[_0x9964('0x69')]=JSON['parse'](Mustache[_0x9964('0x6e')](JSON[_0x9964('0x6f')](_0x4e3b67['headers']),_0x4a9a78,{},['$$','$$']));}if(_0x4e3b67[_0x9964('0x70')]){_0x4e3b67[_0x9964('0x70')]=JSON[_0x9964('0x71')](Mustache[_0x9964('0x6e')](JSON['stringify'](_0x4e3b67[_0x9964('0x70')]),_0x4a9a78,{},['$$','$$']));}}catch(_0x1abca3){logger[_0x9964('0x28')](_0x9964('0x72'),_0x1abca3);}}rp(_0x4e3b67)[_0x9964('0x15')](function(_0x265d7e){var _0x128882={'statusCode':_0x265d7e[_0x9964('0x73')]||0xc8,'statusMessage':_0x265d7e[_0x9964('0x74')]||'OK','headers':_0x265d7e[_0x9964('0x69')]||{},'body':_0x265d7e[_0x9964('0x70')]||{}};_0x16ba3a(null,_0x128882);})[_0x9964('0x12')](function(_0x4d6ac6){var _0x424e6e={'statusCode':_0x4d6ac6['statusCode']||0x1f4,'statusMessage':_0x4d6ac6[_0x9964('0x75')]||_0x9964('0x76'),'headers':_0x4d6ac6['options'][_0x9964('0x69')]||{},'body':_0x4d6ac6[_0x9964('0x77')][_0x9964('0x70')]||{}};_0x16ba3a(null,_0x424e6e);});};AGIVertices[_0x9964('0x17')][_0x9964('0x78')]=function(_0x2fefdc,_0x411413){scripts[_0x9964('0x78')](this['channel'][_0x9964('0x33')],_0x2fefdc[_0x9964('0x79')],_0x2fefdc[_0x9964('0x57')],_0x2fefdc['dialogflow_language']||'en')[_0x9964('0x15')](function(_0x3a2be8){_0x411413(null,_0x3a2be8);})[_0x9964('0x12')](function(_0x4d9cd3){_0x411413(_0x4d9cd3);});};AGIVertices[_0x9964('0x17')][_0x9964('0x7a')]=function(_0x3072e8,_0xc99eac){scripts[_0x9964('0x7a')](this[_0x9964('0xe')][_0x9964('0x33')],_0x3072e8[_0x9964('0x7b')],_0x3072e8[_0x9964('0x7c')],_0x3072e8['private_key'],_0x3072e8[_0x9964('0x57')],_0x3072e8[_0x9964('0x7d')]||'en')[_0x9964('0x15')](function(_0x582b39){_0xc99eac(null,_0x582b39);})[_0x9964('0x12')](function(_0x5bb243){_0xc99eac(_0x5bb243);});};AGIVertices[_0x9964('0x17')][_0x9964('0x7e')]=function(_0x463365,_0x540bac){scripts[_0x9964('0x7e')](this[_0x9964('0xe')],_0x463365)[_0x9964('0x15')](function(_0x5ae9ee){_0x540bac(null,_0x5ae9ee);})[_0x9964('0x12')](function(_0x292836){_0x540bac(_0x292836);});};AGIVertices[_0x9964('0x17')]['ispeechTTS']=function(_0x14db69,_0x22e298){scripts[_0x9964('0x7f')](_0x14db69['key'],_0x14db69[_0x9964('0x57')],_0x14db69[_0x9964('0x80')]||_0x9964('0x59'),_0x14db69['speed'])[_0x9964('0x15')](function(_0x2f8d1d){_0x22e298(null,_0x2f8d1d);})[_0x9964('0x12')](function(_0x31b5ab){_0x22e298(_0x31b5ab);});};AGIVertices[_0x9964('0x17')][_0x9964('0x81')]=function(_0x5bdd6d,_0x107967,_0x13caf7){scripts[_0x9964('0x81')](_0x107967,_0x5bdd6d[_0x9964('0x79')],_0x5bdd6d[_0x9964('0x82')]||_0x9964('0x59'),this[_0x9964('0x83')](_0x5bdd6d['model'])?_0x5bdd6d[_0x9964('0x84')]:undefined)[_0x9964('0x15')](function(_0x1570fc){_0x13caf7(null,_0x1570fc);})[_0x9964('0x12')](function(_0x1d1822){_0x13caf7(_0x1d1822);});};AGIVertices[_0x9964('0x17')][_0x9964('0x85')]=function(_0x3b03af,_0x2a9a53){scripts[_0x9964('0x85')](_0x3b03af['aws_access_key_id'],_0x3b03af['aws_secret_access_key'],_0x3b03af['aws_polly_region'],_0x3b03af['aws_polly_voice']||_0x9964('0x86'),_0x3b03af[_0x9964('0x57')],_0x3b03af[_0x9964('0x87')]||_0x9964('0x57'))[_0x9964('0x15')](function(_0xf61611){_0x2a9a53(null,_0xf61611);})[_0x9964('0x12')](function(_0x5b5ece){_0x2a9a53(_0x5b5ece);});};AGIVertices['prototype'][_0x9964('0x88')]=function(_0x53d1e0,_0x30f32){scripts[_0x9964('0x88')](this[_0x9964('0xe')][_0x9964('0x33')],_0x53d1e0[_0x9964('0x89')],_0x53d1e0['aws_secret_access_key'],_0x53d1e0['aws_lex_region'],_0x53d1e0['text'],_0x53d1e0['aws_bot_name'])['then'](function(_0x4783a5){_0x30f32(null,_0x4783a5);})[_0x9964('0x12')](function(_0x88cb7b){_0x30f32(_0x88cb7b);});};AGIVertices[_0x9964('0x17')][_0x9964('0x8a')]=function(_0x43959b,_0x3b61fe,_0x353abf){scripts['googleASR'](_0x3b61fe,_0x43959b[_0x9964('0x79')],_0x43959b['google_asr_language']||_0x9964('0x59'))[_0x9964('0x15')](function(_0x2c9461){_0x353abf(null,_0x2c9461);})['catch'](function(_0x9ad7a8){_0x353abf(_0x9ad7a8);});};AGIVertices['prototype'][_0x9964('0x8b')]=function(_0x2c2d39,_0x2b8be7,_0xd7906f){scripts[_0x9964('0x8b')](_0x2b8be7,_0x2c2d39['appid'],_0x2c2d39[_0x9964('0x8c')],_0x2c2d39[_0x9964('0x6d')])[_0x9964('0x15')](function(_0x457d52){_0xd7906f(null,_0x457d52);})[_0x9964('0x12')](function(_0x3a9149){_0xd7906f(_0x3a9149);});};AGIVertices['prototype'][_0x9964('0x8d')]=function(_0x110c3a){var _0x5d691b=_[_0x9964('0x8e')](verticesWithRetry,_0x110c3a[_0x9964('0x35')])?_0x110c3a:_[_0x9964('0x8f')](_0x110c3a);for(var _0x527c0d in _0x5d691b){if(_0x5d691b[_0x9964('0x90')](_0x527c0d)){if(_0x5d691b[_0x527c0d]&&_[_0x9964('0x91')](_0x5d691b[_0x527c0d])){if(_[_0x9964('0x8e')](recursiveMapAttributes,_0x527c0d)){_0x5d691b[_0x527c0d]=this[_0x9964('0x92')](_0x5d691b[_0x527c0d]);}else{_0x5d691b[_0x527c0d]=this[_0x9964('0x93')](_0x5d691b[_0x527c0d]);}}}}return _0x5d691b;};AGIVertices['prototype'][_0x9964('0x94')]=function(_0x12d128){for(var _0xe15ec5 in _0x12d128){if(_0x12d128['hasOwnProperty'](_0xe15ec5)){if(_[_0x9964('0x95')](_0x12d128[_0xe15ec5])){this[_0x9964('0x94')](_0x12d128[_0xe15ec5]);}else if(_[_0x9964('0x96')](_0x12d128[_0xe15ec5])){for(var _0x30743e=0x0;_0x30743e<_0x12d128[_0xe15ec5]['length'];_0x30743e++){this[_0x9964('0x94')](_0x12d128[_0xe15ec5][_0x30743e]);}}else if(_[_0x9964('0x91')](_0x12d128[_0xe15ec5])){_0x12d128[_0xe15ec5]=this[_0x9964('0x93')](_0x12d128[_0xe15ec5]);}}}};AGIVertices['prototype']['saveRestApiResult']=function(_0x4ca948,_0x280577){for(var _0x1d0890 in _0x4ca948){if(_0x4ca948[_0x9964('0x90')](_0x1d0890)){if(_[_0x9964('0x95')](_0x4ca948[_0x1d0890])){if(!_[_0x9964('0x41')](_0x4ca948[_0x1d0890])){this[_0x9964('0x97')](_0x4ca948[_0x1d0890],util[_0x9964('0x98')](_0x9964('0x99'),_0x280577,_0x1d0890));}}else if(_[_0x9964('0x96')](_0x4ca948[_0x1d0890])){for(var _0x4b8bbb=0x0;_0x4b8bbb<_0x4ca948[_0x1d0890]['length'];_0x4b8bbb++){this[_0x9964('0x97')](_0x4ca948[_0x1d0890][_0x4b8bbb],util[_0x9964('0x98')](_0x9964('0x99'),_0x280577,_0x1d0890+'['+_0x4b8bbb+']'));}}else{if(!_['isNil'](_0x4ca948[_0x1d0890])){this[_0x9964('0xe')][_0x9964('0x9a')](util[_0x9964('0x98')](_0x9964('0x99'),_0x280577,_0x1d0890),_0x4ca948[_0x1d0890]);}}}}};AGIVertices['prototype'][_0x9964('0x92')]=function(_0x120714){try{var _0x2ddaf6=JSON[_0x9964('0x71')](_0x120714);this['recursiveNodeIndex'](_0x2ddaf6);return JSON[_0x9964('0x6f')](_0x2ddaf6);}catch(_0x3754fa){return this[_0x9964('0x93')](_0x120714);}};AGIVertices[_0x9964('0x17')][_0x9964('0x93')]=function(_0x29ba52){var _0x36c913=_0x29ba52['split']('{');for(var _0x46f14b=0x1;_0x46f14b<_0x36c913[_0x9964('0x9b')];_0x46f14b+=0x1){var _0x5748d1=_0x36c913[_0x46f14b][_0x9964('0x9c')]('}');if(_0x5748d1[_0x9964('0x9b')]>0x1){_0x29ba52=_0x29ba52[_0x9964('0x9d')]('{'+_0x5748d1[0x0]+'}',this[_0x9964('0xe')][_0x9964('0x10')](_0x5748d1[0x0])[_0x9964('0x9e')]||_0x5748d1[0x0]);}}if(_0x36c913['length']===0x1){return _0x29ba52[_0x9964('0x9f')]();}return this[_0x9964('0x93')](_0x29ba52);};AGIVertices[_0x9964('0x17')][_0x9964('0xa0')]=function(_0x4a42ab,_0x3d40fd){var _0x383702=this[_0x9964('0xe')]['getVariable'](_0x4a42ab);if(_0x383702['result']===-0x1){return _0x383702;}logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0xa1'),_0x3d40fd,_0x383702['extra']));return this[_0x9964('0xe')][_0x9964('0x9a')](_0x3d40fd,_0x383702[_0x9964('0x9e')]);};AGIVertices[_0x9964('0x17')][_0x9964('0x83')]=function(_0x39c568){return _0x39c568&&_0x39c568!=='0'&&_0x39c568!=='-1'&&_0x39c568!=='';};AGIVertices[_0x9964('0x17')][_0x9964('0xa2')]=function(_0x434b3f){this[_0x9964('0x32')]['sync'](this,_0x434b3f,'-');_0x434b3f[_0x9964('0xa3')]=_0x434b3f[_0x9964('0xa2')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x9964('0xa4')]=function(_0x15a129){logger['info'](util[_0x9964('0x98')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x15a129['label']));if(!this['isConfigured'](_0x15a129['text'])){return this[_0x9964('0xe')]['noop']('no\x20text\x20configured');}var _0x467218='\x22'+_0x15a129[_0x9964('0x57')]+'\x22';if(this[_0x9964('0x83')](_0x15a129['options'])){_0x467218+=','+_0x15a129[_0x9964('0x77')];}var _0x38c329=this[_0x9964('0xe')]['exec'](_0x9964('0xa5'),_0x467218);if(_0x38c329[_0x9964('0xa6')]===-0x1){return _0x38c329;}return this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')]('Executed\x20command\x20MRCPSynth\x20%s',_0x467218));};AGIVertices[_0x9964('0x17')]['mrcprecog']=function(_0x88702d){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0xa8'),_0x88702d[_0x9964('0x34')]));if(!this[_0x9964('0x83')](_0x88702d[_0x9964('0xa9')])){return this['channel']['noop'](_0x9964('0xaa'));}var _0x501be0=_0x88702d[_0x9964('0xa9')];if(this[_0x9964('0x83')](_0x88702d['options'])){_0x501be0+=','+_0x88702d[_0x9964('0x77')];}var _0x403040=this[_0x9964('0xe')][_0x9964('0x51')](_0x9964('0xab'),_0x501be0);if(_0x403040[_0x9964('0xa6')]===-0x1){return _0x403040;}var _0x1bd26d=this[_0x9964('0xa0')](_0x9964('0xac'),'MRCP_RECOG_CONFIDENCE');if(_0x1bd26d['result']===-0x1){return _0x1bd26d;}var _0x5107fd=this['getAndSetVariable']('RECOG_INPUT()',_0x9964('0xad'));if(_0x5107fd[_0x9964('0xa6')]===-0x1){return _0x5107fd;}var _0x132c1b=this[_0x9964('0xa0')](_0x9964('0xae'),_0x9964('0xaf'));if(_0x132c1b[_0x9964('0xa6')]===-0x1){return _0x132c1b;}return this[_0x9964('0xe')]['noop'](util[_0x9964('0x98')](_0x9964('0xb0'),_0x501be0));};AGIVertices[_0x9964('0x17')][_0x9964('0xb1')]=function(_0x2eba6a){logger[_0x9964('0x2c')](util[_0x9964('0x98')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x2eba6a['label']));return this[_0x9964('0xe')][_0x9964('0xb1')]([_0x2eba6a[_0x9964('0xb2')],_0x2eba6a[_0x9964('0xb3')]]);};AGIVertices[_0x9964('0x17')][_0x9964('0xb4')]=function(_0x1f961e){logger['info'](util['format'](_0x9964('0xb5'),_0x1f961e[_0x9964('0x34')]));if(this[_0x9964('0x83')](_0x1f961e['timeout'])){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0xb6'),_0x1f961e[_0x9964('0x63')]));var _0x5961e9=this[_0x9964('0xe')]['wait'](_0x1f961e[_0x9964('0x63')]);if(_0x5961e9['result']===-0x1){return _0x5961e9;}}return this[_0x9964('0xe')][_0x9964('0xb4')]();};AGIVertices[_0x9964('0x17')][_0x9964('0x45')]=function(_0x19c945){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0xb7'),_0x19c945['label']));if(!this[_0x9964('0x83')](_0x19c945[_0x9964('0x44')])){return this[_0x9964('0xe')][_0x9964('0x28')](_0x19c945,_0x9964('0xb8'));}_0x19c945[_0x9964('0x47')]=moment();if(this['isConfigured'](_0x19c945['delay'])){_0x19c945['scheduledAt']=moment()['add'](_0x19c945[_0x9964('0xb9')],_0x9964('0xba'));}if(!this['isConfigured'](_0x19c945[_0x9964('0x48')])){_0x19c945['callback_priority']=0x2;}this[_0x9964('0x3e')][_0x9964('0x6c')](this,_0x19c945);return this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0xbb'),_0x19c945['phone'],_0x19c945[_0x9964('0x44')],_0x19c945['scheduledAt']));};AGIVertices[_0x9964('0x17')][_0x9964('0xbc')]=function(_0x13ec8){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0xbd'),_0x13ec8['label']));var _0x244c6c=this[_0x9964('0xe')][_0x9964('0x51')](_0x13ec8['application'],_0x13ec8[_0x9964('0x77')]);if(_0x244c6c[_0x9964('0xa6')]===-0x1){return _0x244c6c;}return this[_0x9964('0xe')][_0x9964('0xa7')](util['format'](_0x9964('0xbe'),_0x13ec8[_0x9964('0xbf')],_0x13ec8[_0x9964('0x77')]));};AGIVertices[_0x9964('0x17')][_0x9964('0xc0')]=function(_0x518095){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0xc1'),_0x518095['label']));if(!this[_0x9964('0x83')](_0x518095[_0x9964('0x57')])){return this[_0x9964('0xe')][_0x9964('0xa7')](_0x9964('0xc2'));}var _0x22d02e='\x22'+_0x518095['text']+'\x22';if(this[_0x9964('0x83')](_0x518095['options'])){_0x22d02e+=','+_0x518095[_0x9964('0x77')];}var _0x5b26e5=this[_0x9964('0xe')]['exec'](_0x9964('0xa5'),_0x22d02e);if(_0x5b26e5[_0x9964('0xa6')]===-0x1){return _0x5b26e5;}return this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0xc3'),_0x22d02e));};AGIVertices['prototype'][_0x9964('0xc4')]=function(_0xec910){logger[_0x9964('0x2c')](util[_0x9964('0x98')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0xec910[_0x9964('0x34')]));if(!this[_0x9964('0x83')](_0xec910[_0x9964('0x57')])){return this[_0x9964('0xe')][_0x9964('0xa7')]('no\x20text\x20configured');}var _0x483b0e='\x22'+_0xec910['text']+'\x22';if(this[_0x9964('0x83')](_0xec910[_0x9964('0x77')])){_0x483b0e+=','+_0xec910[_0x9964('0x77')];}var _0x5972f6=this[_0x9964('0xe')][_0x9964('0x51')]('MRCPSynth',_0x483b0e);if(_0x5972f6[_0x9964('0xa6')]===-0x1){return _0x5972f6;}return this['channel'][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0xc3'),_0x483b0e));};AGIVertices[_0x9964('0x17')][_0x9964('0xc5')]=function(_0x148483){logger['info'](util[_0x9964('0x98')](_0x9964('0xc6'),_0x148483[_0x9964('0x34')]));if(!this[_0x9964('0x83')](_0x148483[_0x9964('0xa9')])){return this[_0x9964('0xe')][_0x9964('0xa7')](_0x9964('0xaa'));}var _0x29a8ae=_0x148483[_0x9964('0xa9')];if(this[_0x9964('0x83')](_0x148483[_0x9964('0x77')])){_0x29a8ae+=','+_0x148483['options'];}var _0x19242c=this['channel']['exec'](_0x9964('0xab'),_0x29a8ae);if(_0x19242c[_0x9964('0xa6')]===-0x1){return _0x19242c;}var _0x10f924=this[_0x9964('0xa0')](_0x9964('0xac'),_0x9964('0xc7'));if(_0x10f924[_0x9964('0xa6')]===-0x1){return _0x10f924;}var _0x5ca24f=this['getAndSetVariable']('RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT');if(_0x5ca24f[_0x9964('0xa6')]===-0x1){return _0x5ca24f;}var _0x45b0ff=this[_0x9964('0xa0')](_0x9964('0xae'),_0x9964('0xc8'));if(_0x45b0ff['result']===-0x1){return _0x45b0ff;}return this[_0x9964('0xe')]['noop'](util[_0x9964('0x98')](_0x9964('0xb0'),_0x29a8ae));};AGIVertices[_0x9964('0x17')]['sestekasr']=function(_0x945844){logger[_0x9964('0x2c')](util[_0x9964('0x98')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x945844[_0x9964('0x34')]));if(!this[_0x9964('0x83')](_0x945844[_0x9964('0xa9')])){return this[_0x9964('0xe')][_0x9964('0xa7')](_0x9964('0xaa'));}var _0x1ee9ee=_0x945844[_0x9964('0xa9')];if(this[_0x9964('0x83')](_0x945844[_0x9964('0x77')])){_0x1ee9ee+=','+_0x945844[_0x9964('0x77')];}var _0x19e6bb=this[_0x9964('0xe')]['exec'](_0x9964('0xab'),_0x1ee9ee);if(_0x19e6bb[_0x9964('0xa6')]===-0x1){return _0x19e6bb;}var _0x7cb84e=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0x9964('0xc9'));if(_0x7cb84e[_0x9964('0xa6')]===-0x1){return _0x7cb84e;}var _0x309300=this[_0x9964('0xa0')](_0x9964('0xca'),_0x9964('0xcb'));if(_0x309300[_0x9964('0xa6')]===-0x1){return _0x309300;}var _0x1f3f21=this['getAndSetVariable'](_0x9964('0xae'),_0x9964('0xcc'));if(_0x1f3f21[_0x9964('0xa6')]===-0x1){return _0x1f3f21;}return this['channel'][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0xb0'),_0x1ee9ee));};AGIVertices[_0x9964('0x17')][_0x9964('0xcd')]=function(_0x269aaa){logger['info'](util[_0x9964('0x98')](_0x9964('0xce'),_0x269aaa['label']));if(!this['isConfigured'](_0x269aaa[_0x9964('0xcf')])){return this[_0x9964('0xe')][_0x9964('0x28')](_0x269aaa,_0x9964('0xd0'));}var _0x5abf5e=this[_0x9964('0xd1')][_0x9964('0x6c')](this,_0x269aaa[_0x9964('0xcf')]);if(!_0x5abf5e){return this[_0x9964('0xe')][_0x9964('0x28')](_0x269aaa,_0x9964('0xd2'));}if(!this['isConfigured'](_0x269aaa[_0x9964('0x2b')])){return this['channel'][_0x9964('0x28')](_0x269aaa,_0x9964('0xd3'));}var _0x431a7c=_0x269aaa['query'][_0x9964('0x53')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0xd4'),_0x431a7c));var _0xb2de82=this[_0x9964('0x26')][_0x9964('0x6c')](this,_0x5abf5e,_0x431a7c);this['createSquareDetailsReport'][_0x9964('0x6c')](this,_0x269aaa,_0x431a7c);if(!this[_0x9964('0x83')](_0x269aaa[_0x9964('0xd5')])){return this[_0x9964('0xe')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x4e5e4a=this[_0x9964('0x10')][_0x9964('0x6c')](this,_0x269aaa[_0x9964('0xd5')]);if(!_0x4e5e4a){return this[_0x9964('0xe')][_0x9964('0x28')](_0x269aaa,_0x9964('0xd6'));}var _0x49087f=this;_0xb2de82[_0x9964('0xd7')](function(_0x584d9d,_0x2a3235){Object[_0x9964('0xd8')](_0x584d9d)['forEach'](function(_0x3f46eb){_0x49087f[_0x9964('0xe')][_0x9964('0x9a')](util[_0x9964('0x98')](_0x9964('0xd9'),_0x4e5e4a,_0x2a3235,_0x3f46eb),_0x584d9d[_0x3f46eb]);});});this[_0x9964('0xe')][_0x9964('0x9a')](util[_0x9964('0x98')](_0x9964('0xda'),_0x4e5e4a),_0xb2de82['length']);return this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')]('variable\x20%s\x20set',_0x4e5e4a));};AGIVertices['prototype']['dial']=function(_0x1a99a5){logger['debug'](util['format'](_0x9964('0xdb'),_0x1a99a5['label']));if(!this[_0x9964('0x83')](_0x1a99a5[_0x9964('0xdc')])){return this['channel'][_0x9964('0x28')](_0x1a99a5,_0x9964('0xdd'));}var _0x32a37e=this['getUser'][_0x9964('0x6c')](this,_0x1a99a5['sip_id']);if(!_0x32a37e){return this[_0x9964('0xe')]['error'](_0x1a99a5,_0x9964('0xde'));}var _0x58e727=this[_0x9964('0xe')][_0x9964('0x51')](_0x9964('0xdf'),[util['format'](_0x9964('0xe0'),_0x32a37e),_0x1a99a5['timeout'],_0x1a99a5[_0x9964('0xe1')],_0x1a99a5['url']]);if(_0x58e727['result']===-0x1){return _0x58e727;}return this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')]('Executed\x20command\x20%s',_0x9964('0xdf')));};AGIVertices[_0x9964('0x17')][_0x9964('0xe2')]=function(_0x29984d){logger[_0x9964('0x2c')](util['format'](_0x9964('0xe3'),_0x29984d[_0x9964('0x34')]));if(!this['isConfigured'](_0x29984d[_0x9964('0x79')])){return this[_0x9964('0xe')][_0x9964('0xa7')](_0x9964('0xe4'));}if(!this[_0x9964('0x83')](_0x29984d[_0x9964('0x57')])){return this[_0x9964('0xe')][_0x9964('0xa7')]('no\x20text\x20configured');}this['channel'][_0x9964('0xe5')]=!![];this[_0x9964('0x32')](_0x29984d);this[_0x9964('0x3d')](_0x29984d[_0x9964('0x57')],'in','','');this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0xe6'),_0x29984d[_0x9964('0x57')]));var _0x3da78c=this[_0x9964('0x78')][_0x9964('0x6c')](this,_0x29984d);if(_0x3da78c){for(var _0x10c006 in _0x3da78c){if(_0x3da78c[_0x9964('0x90')](_0x10c006)){this[_0x9964('0xe')][_0x9964('0x9a')](util[_0x9964('0x98')](_0x9964('0xe7'),_0x10c006[_0x9964('0x67')]()),_0x3da78c[_0x10c006]);}}this[_0x9964('0x3d')](_0x3da78c['speech'],_0x9964('0xe8'),_0x9964('0xe2'),'');return this['channel'][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0xe9'),_0x3da78c[_0x9964('0xea')]));}return this[_0x9964('0xe')]['error'](_0x29984d,_0x9964('0xeb'));};AGIVertices[_0x9964('0x17')][_0x9964('0xec')]=function(_0x4dfbca){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0xed'),_0x4dfbca['label']));if(!this[_0x9964('0x83')](_0x4dfbca[_0x9964('0x7b')])){return this[_0x9964('0xe')][_0x9964('0xa7')]('no\x20project_id\x20configured');}if(!this[_0x9964('0x83')](_0x4dfbca[_0x9964('0x7c')])){return this[_0x9964('0xe')]['noop'](_0x9964('0xee'));}if(!this[_0x9964('0x83')](_0x4dfbca[_0x9964('0xef')])){return this[_0x9964('0xe')][_0x9964('0xa7')]('no\x20private_key\x20configured');}if(!this['isConfigured'](_0x4dfbca['dialogflowV2_language'])){return this[_0x9964('0xe')]['noop'](_0x9964('0xf0'));}if(!this[_0x9964('0x83')](_0x4dfbca[_0x9964('0x57')])){return this[_0x9964('0xe')][_0x9964('0xa7')](_0x9964('0xc2'));}this['channel'][_0x9964('0xe5')]=!![];this['createSquareDetailsReport'](_0x4dfbca);this[_0x9964('0x3d')](_0x4dfbca[_0x9964('0x57')],'in','','');this[_0x9964('0xe')]['noop'](util[_0x9964('0x98')](_0x9964('0xf1'),_0x4dfbca[_0x9964('0x57')]));var _0x235d7f=this[_0x9964('0x7a')][_0x9964('0x6c')](this,_0x4dfbca);if(_0x235d7f){for(var _0x1b61ca in _0x235d7f){if(_0x235d7f['hasOwnProperty'](_0x1b61ca)){if(_0x1b61ca!=='providerResponse'){this[_0x9964('0xe')]['setVariable'](util[_0x9964('0x98')](_0x9964('0xe7'),_0x1b61ca[_0x9964('0x67')]()),_0x235d7f[_0x1b61ca]);}}}this[_0x9964('0x3d')](_0x235d7f[_0x9964('0xea')],_0x9964('0xe8'),_0x9964('0xec'),_0x235d7f['providerResponse']);return this[_0x9964('0xe')]['noop'](util[_0x9964('0x98')]('DialogflowV2\x20Result\x20%s',_0x235d7f['speech']));}return this[_0x9964('0xe')][_0x9964('0x28')](_0x4dfbca,_0x9964('0xf2'));};AGIVertices[_0x9964('0x17')][_0x9964('0xf3')]=function(_0x519238){logger['info'](util[_0x9964('0x98')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x519238[_0x9964('0x34')]));if(!this[_0x9964('0x83')](_0x519238[_0x9964('0xf4')])){return this[_0x9964('0xe')]['noop'](_0x9964('0xf5'));}if(!this['isConfigured'](_0x519238[_0x9964('0xf6')])){return this[_0x9964('0xe')][_0x9964('0xa7')]('no\x20username\x20configured');}if(!this[_0x9964('0x83')](_0x519238[_0x9964('0xf7')])){return this[_0x9964('0xe')]['noop'](_0x9964('0xf8'));}if(!this[_0x9964('0x83')](_0x519238[_0x9964('0xf9')])){return this[_0x9964('0xe')][_0x9964('0xa7')]('no\x20text\x20configured');}this['channel'][_0x9964('0xe5')]=!![];this['createSquareDetailsReport'](_0x519238);this[_0x9964('0x3d')](_0x519238[_0x9964('0x57')],'in','','');this['channel'][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0xfa'),_0x519238[_0x9964('0x57')]));var _0x599510=this[_0x9964('0x7e')]['sync'](this,_0x519238);if(_0x599510){for(var _0x34a50b in _0x599510){if(_0x599510[_0x9964('0x90')](_0x34a50b)){this[_0x9964('0xe')]['setVariable'](util[_0x9964('0x98')](_0x9964('0xfb'),_0x34a50b[_0x9964('0x67')]()),_0x599510[_0x34a50b]);}}this[_0x9964('0x3d')](_0x599510[_0x9964('0xea')],_0x9964('0xe8'),_0x9964('0xf3'),'');if(_0x599510['audiofile']){this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0xfc'),_0x599510[_0x9964('0xfd')]));var _0x396803=this[_0x9964('0xe')][_0x9964('0xfe')](_0x599510['audiofile']);try{fs[_0x9964('0xff')](_0x599510[_0x9964('0xfd')]+_0x9964('0x100'));}catch(_0x38c44e){logger[_0x9964('0x28')](_0x38c44e);}return _0x396803;}else{return this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')]('SestekNDA\x20Result\x20%s',_0x599510[_0x9964('0xea')]));}}return this[_0x9964('0xe')][_0x9964('0x28')](_0x519238,_0x9964('0x101'));};AGIVertices[_0x9964('0x17')][_0x9964('0x102')]=function(_0x17c7fb){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x103'),_0x17c7fb['label']));return this[_0x9964('0xe')][_0x9964('0xa7')](_0x9964('0x102'));};AGIVertices[_0x9964('0x17')]['ext_dial']=function(_0x3df1f0){logger[_0x9964('0x2c')](util['format'](_0x9964('0x104'),_0x3df1f0['label']));var _0x4e1c9c='';if(_0x3df1f0['trunk_id']){if(!this['isConfigured'](_0x3df1f0[_0x9964('0x105')])){return this[_0x9964('0xe')][_0x9964('0x28')](_0x3df1f0,_0x9964('0x106'));}else{var _0x2415ae=parseInt(_0x3df1f0[_0x9964('0x105')],0xa);if(isNaN(_0x2415ae)){_0x4e1c9c=_0x3df1f0[_0x9964('0x105')];}else{_0x4e1c9c=this['getTrunk'][_0x9964('0x6c')](this,_0x3df1f0[_0x9964('0x105')]);if(!_0x4e1c9c){return this['channel']['error'](_0x3df1f0,_0x9964('0x107'));}}}}else if(_0x3df1f0[_0x9964('0x108')]){_0x4e1c9c=_0x3df1f0[_0x9964('0x108')];}else{return this[_0x9964('0xe')][_0x9964('0x28')](_0x3df1f0,_0x9964('0x106'));}var _0x4f20a0=this[_0x9964('0xe')][_0x9964('0x51')](_0x9964('0xdf'),[util[_0x9964('0x98')](_0x9964('0x109'),_0x4e1c9c,_0x3df1f0['phone']),_0x3df1f0['timeout'],_0x3df1f0['opts'],_0x3df1f0[_0x9964('0x61')]]);if(_0x4f20a0[_0x9964('0xa6')]===-0x1){return _0x4f20a0;}return this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0x10a'),_0x9964('0xdf')));};AGIVertices['prototype'][_0x9964('0x10b')]=function(_0x1e90d8){logger['info'](util[_0x9964('0x98')](_0x9964('0x10c'),_0x1e90d8[_0x9964('0x34')]));return this['channel'][_0x9964('0xa7')](_0x9964('0x10b'));};AGIVertices[_0x9964('0x17')][_0x9964('0xd')]=function(_0x50e53f){logger[_0x9964('0x2c')](util[_0x9964('0x98')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x50e53f[_0x9964('0x34')]));if(_0x50e53f[_0x9964('0xa3')]===0x0){return this[_0x9964('0xa2')](_0x50e53f);}_0x50e53f[_0x9964('0xa3')]-=0x1;if(!this[_0x9964('0x83')](_0x50e53f[_0x9964('0x10d')])){return this[_0x9964('0xe')][_0x9964('0x28')](_0x50e53f,_0x9964('0x10e'));}var _0x5659ff=this[_0x9964('0x1d')][_0x9964('0x6c')](this,_0x50e53f[_0x9964('0x10d')]);if(!_0x5659ff){return this[_0x9964('0xe')][_0x9964('0x28')](_0x50e53f,_0x9964('0x10f'));}if(!this['isConfigured'](_0x50e53f[_0x9964('0xd5')])){return this[_0x9964('0xe')][_0x9964('0x28')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x4e4505=this[_0x9964('0xe')]['getData'](_0x5659ff,_0x50e53f[_0x9964('0x110')],_0x50e53f[_0x9964('0x111')]);var _0x10836c=_0x4e4505['result']?_0x4e4505[_0x9964('0xa6')][_0x9964('0x9f')]():'';logger['info']('test',JSON[_0x9964('0x6f')](_0x4e4505));if(_0x4e4505[_0x9964('0xa6')]===-0x1){this[_0x9964('0x32')][_0x9964('0x6c')](this,_0x50e53f,_0x10836c);return _0x4e4505;}else if(_0x4e4505[_0x9964('0x9e')]==='timeout'){_0x4e4505[_0x9964('0xa6')]=_0x10836c['length']>=parseInt(_0x50e53f['mindigit'])?'x':'i';}else{_0x4e4505[_0x9964('0xa6')]=_0x10836c['length']>=parseInt(_0x50e53f['mindigit'])&&_0x10836c['length']<=parseInt(_0x50e53f['maxdigit'])?'x':'i';}var _0x1a4dfd=this[_0x9964('0x10')][_0x9964('0x6c')](this,_0x50e53f[_0x9964('0xd5')]);if(!_0x1a4dfd){return this[_0x9964('0xe')][_0x9964('0x28')](_0x50e53f,'no\x20variable\x20found');}this[_0x9964('0xe')][_0x9964('0x9a')](_0x1a4dfd,_0x10836c);if(this['isConfigured'](_0x50e53f[_0x9964('0x112')])){var _0xd3ef5c=parseInt(_0x50e53f['hiddendigitsnum'],0xa);var _0x506efc=rs[_0x9964('0x113')]({'charset':'*','length':_0xd3ef5c});var _0x34f0de=_0x10836c[_0x9964('0x9b')];if(_0x34f0de>0x0){if(_0x34f0de>_0xd3ef5c){this[_0x9964('0x32')][_0x9964('0x6c')](this,_0x50e53f,_0x50e53f['hiddendigitspos']===_0x9964('0x114')?_0x506efc+_0x10836c[_0x9964('0x115')](_0xd3ef5c):_0x10836c[_0x9964('0x115')](0x0,_0x34f0de-_0xd3ef5c)+_0x506efc);}else{this[_0x9964('0x32')][_0x9964('0x6c')](this,_0x50e53f,rs[_0x9964('0x113')]({'charset':'*','length':_0x34f0de}));}}else{this[_0x9964('0x32')][_0x9964('0x6c')](this,_0x50e53f,'');}}else{this[_0x9964('0x32')]['sync'](this,_0x50e53f,_0x10836c);}return _0x4e4505;};AGIVertices[_0x9964('0x17')][_0x9964('0x116')]=function(_0x368456){logger['info'](util[_0x9964('0x98')](_0x9964('0x117'),_0x368456[_0x9964('0x34')]));return this[_0x9964('0xd')](_0x368456);};AGIVertices[_0x9964('0x17')][_0x9964('0x118')]=function(_0x37265){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x119'),_0x37265[_0x9964('0x34')]));this['createSquareDetailsReport']['sync'](this,_0x37265,_0x37265[_0x9964('0x11a')]);return this[_0x9964('0xe')]['noop'](util[_0x9964('0x98')](_0x9964('0x11b'),_0x37265[_0x9964('0x11a')]));};AGIVertices['prototype']['awspolly']=function(_0x57fbf7){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x11c'),_0x57fbf7[_0x9964('0x34')]));if(!this[_0x9964('0x83')](_0x57fbf7[_0x9964('0x89')])||!this[_0x9964('0x83')](_0x57fbf7[_0x9964('0x11d')])){return this['channel'][_0x9964('0xa7')](_0x9964('0x11e'));}if(!this[_0x9964('0x83')](_0x57fbf7[_0x9964('0x57')])){return this[_0x9964('0xe')][_0x9964('0xa7')](_0x9964('0xc2'));}this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0x11f'),_0x57fbf7[_0x9964('0x57')]));var _0x4350f8=this['awsPolly'][_0x9964('0x6c')](this,_0x57fbf7);if(_0x4350f8){this[_0x9964('0xe')]['noop'](util[_0x9964('0x98')](_0x9964('0x120'),_0x4350f8));var _0x1dda2d=this[_0x9964('0xe')]['streamFile'](_0x4350f8);try{fs[_0x9964('0xff')](_0x4350f8+'.wav');}catch(_0x164b4c){logger[_0x9964('0x28')](_0x164b4c);}return _0x1dda2d;}return this[_0x9964('0xe')][_0x9964('0x28')](_0x57fbf7,_0x9964('0x121'));};AGIVertices[_0x9964('0x17')]['awslex']=function(_0x420faa){logger['info'](util[_0x9964('0x98')](_0x9964('0x122'),_0x420faa[_0x9964('0x34')]));if(!this[_0x9964('0x83')](_0x420faa['aws_access_key_id'])||!this['isConfigured'](_0x420faa['aws_secret_access_key'])){return this['channel']['noop'](_0x9964('0x11e'));}if(!this['isConfigured'](_0x420faa['aws_bot_name'])){return this[_0x9964('0xe')]['noop'](_0x9964('0x123'));}if(!this['isConfigured'](_0x420faa[_0x9964('0x57')])){return this[_0x9964('0xe')][_0x9964('0xa7')]('no\x20text\x20configured');}this[_0x9964('0xe')][_0x9964('0xe5')]=!![];this[_0x9964('0x32')](_0x420faa);this[_0x9964('0x3d')](_0x420faa[_0x9964('0x57')],'in','','');this[_0x9964('0xe')]['noop'](util[_0x9964('0x98')](_0x9964('0x124'),_0x420faa['text']));var _0x3deff7=this[_0x9964('0x88')][_0x9964('0x6c')](this,_0x420faa);if(_0x3deff7){for(var _0x4e0bc7 in _0x3deff7){if(_0x3deff7[_0x9964('0x90')](_0x4e0bc7)&&_['isString'](_0x3deff7[_0x4e0bc7])){this[_0x9964('0xe')]['setVariable'](util[_0x9964('0x98')](_0x9964('0x125'),_0x4e0bc7['toUpperCase']()),_0x3deff7[_0x4e0bc7]);}}if(_[_0x9964('0x3f')](_0x3deff7[_0x9964('0x75')])){return this[_0x9964('0xe')][_0x9964('0xa7')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this['createSquareMessage'](_0x3deff7[_0x9964('0x75')],'out',_0x9964('0x126'),'');return this['channel'][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0x127'),_0x3deff7['message']));}}return this[_0x9964('0xe')][_0x9964('0x28')](_0x420faa,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x9964('0x17')][_0x9964('0x128')]=function(_0x57369d){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x129'),_0x57369d['label'],_0x57369d[_0x9964('0x63')]));if(!this[_0x9964('0x83')](_0x57369d[_0x9964('0x79')])){return this[_0x9964('0xe')][_0x9964('0xa7')](_0x9964('0xe4'));}var _0x569fd6=_0x9964('0x12a');var _0x1b4a64=util[_0x9964('0x98')](_0x9964('0x12b'),FILES_PATH,rs[_0x9964('0x113')](0x4));var _0x25278d=util[_0x9964('0x98')]('%s.%s',_0x1b4a64,_0x569fd6);var _0x3c7901=!![];if(_0x57369d[_0x9964('0x12c')]===_0x9964('0x12d')){_0x3c7901=![];}var _0x1d7638=this[_0x9964('0xe')][_0x9964('0x12e')](_0x1b4a64,_0x569fd6,_0x57369d['intKey'],_0x57369d[_0x9964('0x63')],undefined,_0x3c7901);if(_0x1d7638[_0x9964('0xa6')]!==-0x1){this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')]('google\x20%s\x20file\x20created',_0x25278d));var _0x4ec225=this['googleASR'][_0x9964('0x6c')](this,_0x57369d,_0x25278d);if(_0x4ec225){for(var _0x127a1f in _0x4ec225){if(_0x4ec225['hasOwnProperty'](_0x127a1f)){this[_0x9964('0xe')]['setVariable'](util[_0x9964('0x98')](_0x9964('0x12f'),_0x127a1f[_0x9964('0x67')]()),_0x4ec225[_0x127a1f]);}}return this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0x130'),JSON[_0x9964('0x6f')](_0x4ec225)));}}return _0x1d7638;};AGIVertices[_0x9964('0x17')]['tildeasr']=function(_0x34671b){logger['info'](util['format']('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x34671b[_0x9964('0x34')]));if(!this[_0x9964('0x83')](_0x34671b[_0x9964('0x131')])){return this[_0x9964('0xe')][_0x9964('0xa7')](_0x9964('0x132'));}if(!this[_0x9964('0x83')](_0x34671b[_0x9964('0x8c')])){return this[_0x9964('0xe')][_0x9964('0xa7')](_0x9964('0x133'));}var _0x211488=_0x9964('0x12a');var _0x580a19=util[_0x9964('0x98')](_0x9964('0x12b'),FILES_PATH,rs[_0x9964('0x113')](0x4));var _0x18e305=util['format'](_0x9964('0x99'),_0x580a19,_0x211488);var _0x23543c=!![];if(_0x34671b['beep']===_0x9964('0x12d')){_0x23543c=![];}var _0x3b3e6b=this[_0x9964('0xe')][_0x9964('0x12e')](_0x580a19,_0x211488,_0x34671b[_0x9964('0x134')],_0x34671b['timeout'],undefined,_0x23543c);if(_0x3b3e6b['result']!==-0x1){this['channel'][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0x135'),_0x18e305));var _0x11f382=this['tildeASR'][_0x9964('0x6c')](this,_0x34671b,_0x18e305);if(_0x11f382){for(var _0x7703d in _0x11f382){if(_0x11f382[_0x9964('0x90')](_0x7703d)){this[_0x9964('0xe')][_0x9964('0x9a')](util[_0x9964('0x98')]('TILDE_ASR_%s',_0x7703d['toUpperCase']()),_0x11f382[_0x7703d]);}}return this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')]('TildeASR\x20Result\x20%s',JSON[_0x9964('0x6f')](_0x11f382)));}}return _0x3b3e6b;};AGIVertices[_0x9964('0x17')][_0x9964('0x136')]=function(_0x3b744a){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x137'),_0x3b744a[_0x9964('0x34')]));return this[_0x9964('0xe')][_0x9964('0x138')](_0x3b744a[_0x9964('0x39')],_0x3b744a[_0x9964('0x3a')],_0x3b744a[_0x9964('0x139')]);};AGIVertices[_0x9964('0x17')]['gotoif']=function(_0x56268a){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x13a'),_0x56268a[_0x9964('0x34')]));if(!this[_0x9964('0x83')](_0x56268a[_0x9964('0x13b')])){return this[_0x9964('0xe')][_0x9964('0x28')](_0x56268a,_0x9964('0x13c'));}try{var _0x593a02=eval(_0x56268a['condition'])?_0x9964('0x13d'):'false';this['channel']['noop'](util[_0x9964('0x98')](_0x9964('0x13e'),_0x56268a[_0x9964('0x13b')],_0x593a02));return{'code':0xc8,'result':_0x593a02};}catch(_0x1440a4){return{'code':0xc8,'result':_0x9964('0x13f')};}};AGIVertices[_0x9964('0x17')][_0x9964('0x140')]=function(_0x3a09d1){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x141'),_0x3a09d1['label']));if(!this[_0x9964('0x83')](_0x3a09d1[_0x9964('0x142')])){return this[_0x9964('0xe')]['error'](_0x3a09d1,_0x9964('0x143'));}var _0x21659b=this[_0x9964('0x23')][_0x9964('0x6c')](this,_0x3a09d1[_0x9964('0x142')]);if(!_0x21659b){return this[_0x9964('0xe')][_0x9964('0x28')](_0x3a09d1,_0x9964('0x144'));}for(var _0x509f1e=0x0;_0x509f1e<_0x21659b[_0x9964('0x9b')];_0x509f1e+=0x1){var _0x4c45a3=this[_0x9964('0xe')]['getVariable'](util[_0x9964('0x98')](_0x9964('0x145'),_0x21659b[_0x509f1e]));if(_0x4c45a3[_0x9964('0xa6')]===-0x1){return _0x4c45a3;}logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x146'),_0x21659b[_0x509f1e],_0x4c45a3[_0x9964('0x9e')]));if(_0x4c45a3[_0x9964('0x9e')]==='true'){logger['info'](util[_0x9964('0x98')](_0x9964('0x146'),_0x21659b[_0x509f1e],'true'));this['channel'][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0x146'),_0x21659b[_0x509f1e],'true'));return{'code':0xc8,'result':_0x9964('0x13d')};}else{logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x146'),_0x21659b[_0x509f1e],_0x9964('0x13f')));this[_0x9964('0xe')][_0x9964('0xa7')](util['format'](_0x9964('0x146'),_0x21659b[_0x509f1e],'false'));}}return{'code':0xc8,'result':_0x9964('0x13f')};};AGIVertices[_0x9964('0x17')][_0x9964('0x147')]=function(_0x47e48f){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x148'),_0x47e48f['label']));return this[_0x9964('0xe')][_0x9964('0x147')]();};AGIVertices['prototype'][_0x9964('0x149')]=function(_0x136039){logger[_0x9964('0x2c')](util['format'](_0x9964('0x14a'),_0x136039[_0x9964('0x34')]));if(!this['isConfigured'](_0x136039[_0x9964('0x79')])){return this['channel']['noop'](_0x9964('0xe4'));}var _0x5775d0='wav';var _0x266979=util[_0x9964('0x98')](_0x9964('0x12b'),FILES_PATH,rs['generate'](0x4));var _0x4ff92f=util[_0x9964('0x98')](_0x9964('0x99'),_0x266979,_0x5775d0);var _0x2021dc=!![];if(_0x136039[_0x9964('0x12c')]===_0x9964('0x12d')){_0x2021dc=![];}var _0x515ed6=this[_0x9964('0xe')][_0x9964('0x12e')](_0x266979,_0x5775d0,_0x136039[_0x9964('0x134')],_0x136039['timeout'],undefined,_0x2021dc);if(_0x515ed6[_0x9964('0xa6')]!==-0x1){this[_0x9964('0xe')][_0x9964('0xa7')](util['format'](_0x9964('0x14b'),_0x4ff92f));var _0x2c717d=this[_0x9964('0x81')][_0x9964('0x6c')](this,_0x136039,_0x4ff92f);if(_0x2c717d){for(var _0x32f6d4 in _0x2c717d){if(_0x2c717d['hasOwnProperty'](_0x32f6d4)){this['channel']['setVariable'](util[_0x9964('0x98')](_0x9964('0x14c'),_0x32f6d4['toUpperCase']()),_0x2c717d[_0x32f6d4]);}}return this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0x14d'),JSON[_0x9964('0x6f')](_0x2c717d)));}}return _0x515ed6;};AGIVertices['prototype'][_0x9964('0x14e')]=function(_0x3ca89b){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x14f'),_0x3ca89b[_0x9964('0x34')]));if(!this[_0x9964('0x83')](_0x3ca89b['key'])){return this[_0x9964('0xe')]['noop']('no\x20key\x20configured');}if(!this[_0x9964('0x83')](_0x3ca89b[_0x9964('0x57')])){return this[_0x9964('0xe')][_0x9964('0xa7')]('no\x20text\x20configured');}this['channel'][_0x9964('0xa7')](util[_0x9964('0x98')]('Trying\x20ispeech\x20TTS\x20%s',_0x3ca89b['text']));var _0xfbb7f2=this[_0x9964('0x7f')][_0x9964('0x6c')](this,_0x3ca89b);if(_0xfbb7f2){this[_0x9964('0xe')]['noop'](util[_0x9964('0x98')](_0x9964('0x14b'),_0xfbb7f2));var _0x1a9631=this[_0x9964('0xe')][_0x9964('0xfe')](_0xfbb7f2,_0x3ca89b['intKey']);try{fs['unlink'](_0xfbb7f2+_0x9964('0x100'));}catch(_0x73d597){logger[_0x9964('0x28')](_0x73d597);}return _0x1a9631;}return this[_0x9964('0xe')][_0x9964('0x28')](_0x3ca89b,_0x9964('0x150'));};AGIVertices[_0x9964('0x17')][_0x9964('0x151')]=function(_0x787730){logger['info'](util['format'](_0x9964('0x152'),_0x787730[_0x9964('0x34')]));if(!this[_0x9964('0x83')](_0x787730[_0x9964('0x153')])){return this[_0x9964('0xe')][_0x9964('0x28')](_0x787730,_0x9964('0x154'));}logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x155'),this[_0x9964('0xe')][_0x9964('0x37')],_0x787730[_0x9964('0x153')]));var _0x1a11b9=this[_0x9964('0x50')][_0x9964('0x6c')](this,_0x787730['findBy']);if(_0x1a11b9){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x156'),this[_0x9964('0xe')]['callerid'],_0x787730[_0x9964('0x153')]));this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0x156'),this[_0x9964('0xe')][_0x9964('0x37')],_0x787730[_0x9964('0x153')]));return{'code':0xc8,'result':_0x9964('0x157')};}else{logger[_0x9964('0x2c')](util['format'](_0x9964('0x158'),this[_0x9964('0xe')][_0x9964('0x37')],_0x787730[_0x9964('0x153')]));this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x9964('0xe')]['callerid'],_0x787730['findBy']));return{'code':0xc8,'result':_0x9964('0x159')};}};AGIVertices[_0x9964('0x17')]['logout']=function(_0x3ca563){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x15a'),_0x3ca563['label']));if(!this[_0x9964('0x83')](_0x3ca563[_0x9964('0x153')])){return this[_0x9964('0xe')]['error'](_0x3ca563,_0x9964('0x154'));}logger[_0x9964('0x2c')](util['format'](_0x9964('0x155'),this[_0x9964('0xe')][_0x9964('0x37')],_0x3ca563[_0x9964('0x153')]));var _0x4fde68=this[_0x9964('0x4d')][_0x9964('0x6c')](this,_0x3ca563['findBy']);if(_0x4fde68){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x156'),this[_0x9964('0xe')][_0x9964('0x37')],_0x3ca563['findBy']));this[_0x9964('0xe')][_0x9964('0xa7')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x9964('0xe')][_0x9964('0x37')],_0x3ca563[_0x9964('0x153')]));return{'code':0xc8,'result':_0x9964('0x157')};}else{logger['info'](util[_0x9964('0x98')](_0x9964('0x158'),this['channel'][_0x9964('0x37')],_0x3ca563[_0x9964('0x153')]));this['channel'][_0x9964('0xa7')](util[_0x9964('0x98')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x9964('0xe')][_0x9964('0x37')],_0x3ca563['findBy']));return{'code':0xc8,'result':_0x9964('0x159')};}};AGIVertices[_0x9964('0x17')][_0x9964('0x15b')]=function(_0x399ba2){logger[_0x9964('0x2c')](util['format'](_0x9964('0x15c'),_0x399ba2['label']));if(!this[_0x9964('0x83')](_0x399ba2[_0x9964('0x15d')])){return this[_0x9964('0xe')][_0x9964('0x28')](_0x399ba2,_0x9964('0x15e'));}this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0x15f'),_0x399ba2[_0x9964('0x15d')]));var _0x16b2a3=eval(_0x399ba2[_0x9964('0x15d')]);if(!this['isConfigured'](_0x399ba2[_0x9964('0xd5')])){return this[_0x9964('0xe')][_0x9964('0xa7')](_0x9964('0x160'));}var _0x4bf8a9=this[_0x9964('0x10')]['sync'](this,_0x399ba2[_0x9964('0xd5')]);if(!_0x4bf8a9){return this[_0x9964('0xe')]['error'](_0x399ba2,_0x9964('0xd6'));}if(_['isArray'](_0x16b2a3)){var _0x3c0494=this;_0x16b2a3[_0x9964('0xd7')](function(_0x2c2542,_0x224d94){_0x3c0494[_0x9964('0xe')][_0x9964('0x9a')](util[_0x9964('0x98')](_0x9964('0x161'),_0x4bf8a9,_0x224d94),_0x2c2542);});return this['channel'][_0x9964('0xa7')](util['format'](_0x9964('0x162'),_0x4bf8a9));}else{return this[_0x9964('0xe')][_0x9964('0x9a')](_0x4bf8a9,_0x16b2a3);}};AGIVertices['prototype'][_0x9964('0xc')]=function(_0x32f80f){logger['info'](util['format'](_0x9964('0x163'),_0x32f80f['label']));if(_0x32f80f['retry']===0x0){return this[_0x9964('0xa2')](_0x32f80f);}_0x32f80f['retry']-=0x1;if(!this[_0x9964('0x83')](_0x32f80f[_0x9964('0x10d')])){return this[_0x9964('0xe')][_0x9964('0x28')](_0x32f80f,_0x9964('0x10e'));}var _0x5c041b=this[_0x9964('0x1d')][_0x9964('0x6c')](this,_0x32f80f[_0x9964('0x10d')]);if(!_0x5c041b){return this['channel']['error'](_0x32f80f,'no\x20file\x20audio\x20found');}var _0x114abe=this[_0x9964('0xe')][_0x9964('0x164')](_0x5c041b,_0x32f80f[_0x9964('0x110')],_0x32f80f[_0x9964('0x165')]);var _0x31bbd1=_0x114abe[_0x9964('0xa6')];if(_0x114abe[_0x9964('0xa6')]===-0x1){this[_0x9964('0x32')][_0x9964('0x6c')](this,_0x32f80f,'-1');return _0x114abe;}else if(_0x114abe[_0x9964('0x9e')]===_0x9964('0x63')){_0x114abe[_0x9964('0xa6')]=_0x114abe[_0x9964('0xa6')]['length']>0x0?_0x114abe[_0x9964('0xa6')]:'t';}else if(_[_0x9964('0x41')](_0x114abe[_0x9964('0xa6')])){_0x114abe[_0x9964('0xa6')]='#';_0x31bbd1='#';}if(!this[_0x9964('0x83')](_0x32f80f[_0x9964('0xd5')])){this[_0x9964('0xe')][_0x9964('0xa7')](_0x9964('0x160'));}else{var _0x420452=this[_0x9964('0x10')][_0x9964('0x6c')](this,_0x32f80f[_0x9964('0xd5')]);if(!_0x420452){return this[_0x9964('0xe')][_0x9964('0x28')](_0x32f80f,_0x9964('0xd6'));}this[_0x9964('0xe')][_0x9964('0x9a')](_0x420452,_0x31bbd1);}this[_0x9964('0x32')][_0x9964('0x6c')](this,_0x32f80f,_0x31bbd1);return _0x114abe;};AGIVertices[_0x9964('0x17')]['noop']=function(_0x2956ba){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x166'),_0x2956ba['label']));return this[_0x9964('0xe')][_0x9964('0xa7')](_0x2956ba['output']||_0x2956ba[_0x9964('0x34')]);};AGIVertices[_0x9964('0x17')]['pause']=function(_0x5d1692){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x167'),_0x5d1692['label']));if(!this[_0x9964('0x83')](_0x5d1692[_0x9964('0x153')])){return this[_0x9964('0xe')][_0x9964('0x28')](_0x5d1692,_0x9964('0x154'));}logger[_0x9964('0x2c')](util[_0x9964('0x98')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x9964('0xe')][_0x9964('0x37')],_0x5d1692[_0x9964('0x153')]));var _0x5af231=this[_0x9964('0x49')][_0x9964('0x6c')](this,_0x5d1692[_0x9964('0x168')]);var _0x464f04=this[_0x9964('0x169')]['sync'](this,_0x5d1692['findBy'],_0x5af231);if(_0x464f04){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x156'),this[_0x9964('0xe')][_0x9964('0x37')],_0x5d1692['findBy']));this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0x156'),this['channel'][_0x9964('0x37')],_0x5d1692[_0x9964('0x153')]));return{'code':0xc8,'result':'success'};}else{logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x158'),this[_0x9964('0xe')]['callerid'],_0x5d1692[_0x9964('0x153')]));this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0x156'),this[_0x9964('0xe')]['callerid'],_0x5d1692['findBy']));return{'code':0xc8,'result':_0x9964('0x159')};}};AGIVertices[_0x9964('0x17')][_0x9964('0x16a')]=function(_0x4414b4){logger[_0x9964('0x2c')](util['format'](_0x9964('0x16b'),_0x4414b4[_0x9964('0x34')]));if(!this[_0x9964('0x83')](_0x4414b4['file_id'])){return this[_0x9964('0xe')][_0x9964('0x28')](_0x4414b4,'no\x20file\x20audio\x20selected');}var _0xebef3a=this[_0x9964('0x1d')][_0x9964('0x6c')](this,_0x4414b4[_0x9964('0x10d')]);if(!_0xebef3a){return this[_0x9964('0xe')]['error'](_0x4414b4,_0x9964('0x10f'));}var _0x27a326=this['channel']['exec'](_0x9964('0x16c'),[_0xebef3a,_0x4414b4[_0x9964('0xe1')]]);if(_0x27a326['result']===-0x1){return _0x27a326;}return this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0xbe'),'PLAYBACK',_0xebef3a));};AGIVertices[_0x9964('0x17')]['queue']=function(_0x57a83a){logger[_0x9964('0x2c')](util['format']('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x57a83a[_0x9964('0x34')]));if(!this[_0x9964('0x83')](_0x57a83a[_0x9964('0x16d')])){return this[_0x9964('0xe')]['error'](_0x57a83a,_0x9964('0x16e'));}var _0x129784='';var _0x2ac83b=parseInt(_0x57a83a[_0x9964('0x16d')],0xa);if(isNaN(_0x2ac83b)){_0x129784=_0x57a83a['queue_id'];}else{_0x129784=this['getVoiceQueue'][_0x9964('0x6c')](this,_0x57a83a[_0x9964('0x16d')]);if(!_0x129784){return this[_0x9964('0xe')][_0x9964('0x28')](_0x57a83a,_0x9964('0x16f'));}}var _0x2e9604='';if(this['isConfigured'](_0x57a83a[_0x9964('0x10d')])){var _0x304435=this[_0x9964('0x1d')][_0x9964('0x6c')](this,_0x57a83a[_0x9964('0x10d')]);if(_0x304435){_0x2e9604=_0x304435;}}this[_0x9964('0x32')]['sync'](this,_0x57a83a,_0x129784);if(_0x57a83a['opts'][_0x9964('0x170')]('x')<0x0){_0x57a83a[_0x9964('0xe1')]+='x';}if(_0x57a83a['opts'][_0x9964('0x170')]('X')<0x0){_0x57a83a[_0x9964('0xe1')]+='X';}this[_0x9964('0xe')][_0x9964('0x9a')](_0x9964('0x171'),_0x129784?_0x129784[_0x9964('0x172')]():'');var _0x1424d9=this[_0x9964('0xe')][_0x9964('0x51')](_0x9964('0x173'),[_0x129784,_0x57a83a[_0x9964('0xe1')],_0x57a83a[_0x9964('0x61')],_0x2e9604,_0x57a83a[_0x9964('0x63')],_0x57a83a[_0x9964('0xb1')],_0x57a83a[_0x9964('0x174')],_0x57a83a[_0x9964('0x175')],'',_0x57a83a['position']]);if(_0x1424d9[_0x9964('0xa6')]===-0x1){return _0x1424d9;}return this[_0x9964('0xe')][_0x9964('0xa7')](util['format'](_0x9964('0xbe'),_0x9964('0x173'),_0x129784));};AGIVertices[_0x9964('0x17')][_0x9964('0x176')]=function(_0x5273ee){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x177'),_0x5273ee['label']));var _0xb20037=_0x5273ee[_0x9964('0x178')]||_0x9964('0x12a');var _0x4b54ae=util['format']('%s_%s',this['channel'][_0x9964('0x33')],rs['generate'](0x5));var _0x505265=util[_0x9964('0x98')]('%s/recordings/%s.%s',FILES_PATH,_0x4b54ae,_0xb20037);var _0x47c8ca=util[_0x9964('0x98')](_0x9964('0x12b'),FILES_PATH,_0x4b54ae);this[_0x9964('0x38')][_0x9964('0x6c')](this,_0x5273ee,_0x4b54ae,_0x505265);this[_0x9964('0xe')][_0x9964('0x9a')](_0x9964('0x179'),_0x4b54ae);logger['info']('Recording\x20%s\x20%s\x20%s\x20%s',_0x47c8ca,_0xb20037,_0x5273ee[_0x9964('0x17a')],_0x5273ee[_0x9964('0x63')]);return this[_0x9964('0xe')][_0x9964('0x12e')](_0x47c8ca,_0xb20037,_0x5273ee['escape_digits'],_0x5273ee[_0x9964('0x63')],undefined,!![]);};AGIVertices[_0x9964('0x17')][_0x9964('0x17b')]=function(_0x314e2a){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x17c'),_0x314e2a[_0x9964('0x34')]));if(!this[_0x9964('0x83')](_0x314e2a['url'])){return this[_0x9964('0xe')][_0x9964('0xa7')](_0x9964('0x17d'));}var _0x93b3f8=this[_0x9964('0x60')][_0x9964('0x6c')](this,_0x314e2a);logger['info'](util[_0x9964('0x98')]('Response:',util['inspect'](_0x93b3f8,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x314e2a[_0x9964('0xd5')])){return this[_0x9964('0xe')]['noop'](_0x9964('0x17e'));}var _0xa848ad=this[_0x9964('0x10')][_0x9964('0x6c')](this,_0x314e2a[_0x9964('0xd5')]);if(!_0xa848ad){return this['channel'][_0x9964('0x28')](_0x314e2a,_0x9964('0xd6'));}this[_0x9964('0xe')][_0x9964('0x9a')](util['format'](_0x9964('0x17f'),_0xa848ad),_0x93b3f8[_0x9964('0x73')]?_0x93b3f8[_0x9964('0x73')]:_0x9964('0x180'));this[_0x9964('0xe')]['setVariable'](util['format']('%s_STATUS_MESSAGE',_0xa848ad),_0x93b3f8[_0x9964('0x74')]?_0x93b3f8[_0x9964('0x74')]:'OK');if(_0x93b3f8[_0x9964('0x70')]){try{this['saveRestApiResult'](_0x93b3f8[_0x9964('0x70')],_0xa848ad);}catch(_0x1725e2){logger[_0x9964('0x28')](util[_0x9964('0x98')](_0x9964('0x181'),_0xa848ad));}}return this['channel'][_0x9964('0xa7')](util[_0x9964('0x98')]('variable\x20%s\x20set',_0xa848ad));};AGIVertices['prototype'][_0x9964('0x182')]=function(_0x8996c3){logger[_0x9964('0x2c')](util['format'](_0x9964('0x183'),_0x8996c3[_0x9964('0x34')]));return this[_0x9964('0xe')][_0x9964('0x184')](_0x8996c3[_0x9964('0x185')][_0x9964('0x53')](/\s+/g,''),_0x8996c3[_0x9964('0x17a')]);};AGIVertices[_0x9964('0x17')][_0x9964('0x186')]=function(_0x4dc77a){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x187'),_0x4dc77a[_0x9964('0x34')]));return this['channel'][_0x9964('0x188')](_0x4dc77a[_0x9964('0x64')][_0x9964('0x53')](/\s+/g,''),_0x4dc77a['escape_digits']);};AGIVertices[_0x9964('0x17')][_0x9964('0x189')]=function(_0x2c9045){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x18a'),_0x2c9045['label']));return this[_0x9964('0xe')][_0x9964('0x18b')](_0x2c9045['text'],_0x2c9045[_0x9964('0x17a')]);};AGIVertices[_0x9964('0x17')][_0x9964('0x18c')]=function(_0x2989e5){logger['info'](util[_0x9964('0x98')](_0x9964('0x18d'),_0x2989e5[_0x9964('0x34')]));if(!this[_0x9964('0x83')](_0x2989e5['account_id'])){return this[_0x9964('0xe')][_0x9964('0xa7')](_0x9964('0x18e'));}var _0x37539c=this[_0x9964('0x20')][_0x9964('0x6c')](this,_0x2989e5[_0x9964('0x18f')]);if(!_0x37539c||!_0x37539c['Smtp']){return this[_0x9964('0xe')]['error'](_0x2989e5,_0x9964('0x190'));}var _0x4aecc9={'from':util[_0x9964('0x98')](_0x9964('0x191'),_0x37539c[_0x9964('0x16')],_0x37539c[_0x9964('0x192')]||_0x37539c[_0x9964('0x193')]['user']),'to':_0x2989e5['to']||'','cc':_0x2989e5['cc']||'','bcc':_0x2989e5[_0x9964('0x194')]||'','subject':_0x2989e5['subject'],'html':_0x2989e5[_0x9964('0x57')],'text':_0x2989e5[_0x9964('0x57')]};if(this[_0x9964('0x83')](_0x2989e5[_0x9964('0x195')])){}logger[_0x9964('0x196')]('sendMail\x20message',JSON[_0x9964('0x6f')](_0x4aecc9));this['createSquareDetailsReport'][_0x9964('0x6c')](this,_0x2989e5,_0x2989e5[_0x9964('0x18f')]);this[_0x9964('0xe')]['noop'](util[_0x9964('0x98')](_0x9964('0x197'),_0x37539c[_0x9964('0x16')]));this[_0x9964('0x21')][_0x9964('0x6c')](this,_0x37539c[_0x9964('0x198')],_0x4aecc9);return this[_0x9964('0xe')][_0x9964('0xa7')](_0x9964('0x199'));};AGIVertices[_0x9964('0x17')][_0x9964('0x19a')]=function(_0x273ace){logger[_0x9964('0x2c')](util['format'](_0x9964('0x19b'),_0x273ace[_0x9964('0x34')]));return this[_0x9964('0xe')][_0x9964('0xa7')](_0x9964('0x19c'));};AGIVertices[_0x9964('0x17')][_0x9964('0x19d')]=function(_0x3631cb){logger[_0x9964('0x2c')](util[_0x9964('0x98')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x3631cb[_0x9964('0x34')]));if(!this[_0x9964('0x83')](_0x3631cb[_0x9964('0x19e')])){return this[_0x9964('0xe')]['noop'](_0x9964('0x19f'));}var _0x4dbf83=this[_0x9964('0x2f')][_0x9964('0x6c')](this,_0x3631cb['sms_account_id']);if(!_0x4dbf83){return this[_0x9964('0xe')]['error'](_0x3631cb,'no\x20sms\x20account\x20found');}var _0x5b14cc={'body':_0x3631cb[_0x9964('0x1a0')],'phone':_0x3631cb['to']||'','SmsAccountId':_0x4dbf83['id']};logger[_0x9964('0x196')]('sendSMS\x20message',JSON[_0x9964('0x6f')](_0x5b14cc));this[_0x9964('0x32')][_0x9964('0x6c')](this,_0x3631cb,_0x3631cb[_0x9964('0x19e')]);this[_0x9964('0xe')]['noop'](util[_0x9964('0x98')](_0x9964('0x1a1'),_0x4dbf83[_0x9964('0x16')]));this[_0x9964('0x31')][_0x9964('0x6c')](this,_0x5b14cc);return this[_0x9964('0xe')]['noop']('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x9964('0x17')][_0x9964('0x1a2')]=function(_0x205314){logger[_0x9964('0x2c')](util['format'](_0x9964('0x1a3'),_0x205314[_0x9964('0x34')]));if(!this[_0x9964('0x83')](_0x205314[_0x9964('0xd5')])){return this[_0x9964('0xe')][_0x9964('0x28')](_0x205314,_0x9964('0x1a4'));}var _0x3629fe=this[_0x9964('0x10')][_0x9964('0x6c')](this,_0x205314[_0x9964('0xd5')]);if(!_0x3629fe){return this['channel'][_0x9964('0x28')](_0x205314,_0x9964('0xd6'));}return this[_0x9964('0xe')][_0x9964('0x9a')](_0x3629fe,_0x205314[_0x9964('0x1a5')]);};AGIVertices['prototype'][_0x9964('0x1a6')]=function(_0x4a5bbf){logger['info'](util['format'](_0x9964('0x1a7'),_0x4a5bbf['label']));this[_0x9964('0xe')][_0x9964('0xa7')]('START\x20CALLY\x20SQUARE');var _0x34ce44=this[_0x9964('0xe')][_0x9964('0x10')](_0x9964('0x1a8'));if(!_[_0x9964('0x41')](_0x34ce44['extra'])){this['channel'][_0x9964('0x33')]=_0x34ce44[_0x9964('0x9e')];}if(_0x4a5bbf[_0x9964('0xb4')]===_0x9964('0x1a9')){this[_0x9964('0xe')][_0x9964('0xa7')](_0x9964('0x1aa'));return this[_0x9964('0xe')][_0x9964('0xb4')]();}return this[_0x9964('0xe')]['noop'](_0x9964('0x1ab'));};AGIVertices[_0x9964('0x17')][_0x9964('0x1ac')]=function(_0x5a21f3){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x1ad'),_0x5a21f3[_0x9964('0x34')]));if(!this[_0x9964('0x83')](_0x5a21f3['project_id'])){return this[_0x9964('0xe')][_0x9964('0x28')](_0x5a21f3,_0x9964('0x1ae'));}var _0x98277c=this[_0x9964('0x1af')][_0x9964('0x6c')](this,_0x5a21f3['project_id']);if(!this['isConfigured'](_0x98277c)){return this[_0x9964('0xe')][_0x9964('0x28')](_0x5a21f3,util['format'](_0x9964('0x1b0'),_0x5a21f3[_0x9964('0x1b1')]));}if(_0x98277c===this[_0x9964('0xe')][_0x9964('0x36')]){return this['channel'][_0x9964('0x28')](_0x5a21f3,_0x9964('0x1b2'));}this['createSquareDetailsReport'][_0x9964('0x6c')](this,_0x5a21f3,_0x98277c);var _0x33cd78=this[_0x9964('0xe')]['exec'](_0x9964('0x1b3'),util[_0x9964('0x98')](_0x9964('0x1b4'),config['agi']['host']||_0x9964('0x1b5'),_0x98277c,this[_0x9964('0xe')][_0x9964('0x36')]));if(_0x33cd78['result']===-0x1){return _0x33cd78;}return this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0xbe'),_0x9964('0x1b3'),_0x98277c));};AGIVertices[_0x9964('0x17')][_0x9964('0x1b6')]=function(_0x4a2a33){logger[_0x9964('0x2c')](util[_0x9964('0x98')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x4a2a33['label']));var _0x575a01=this[_0x9964('0x1b7')][_0x9964('0x6c')](this,_0x4a2a33[_0x9964('0xb2')]);this[_0x9964('0x32')]['sync'](this,_0x4a2a33,_0x4a2a33[_0x9964('0xb2')]);if(this['isConfigured'](_0x4a2a33['variable_id'])){var _0x3f7189=this['getVariable'][_0x9964('0x6c')](this,_0x4a2a33[_0x9964('0xd5')]);if(_0x3f7189){this[_0x9964('0xe')][_0x9964('0x9a')](_0x3f7189,_0x575a01);return this['channel'][_0x9964('0xa7')](util['format'](_0x9964('0x1b8'),_0x4a2a33[_0x9964('0xb2')],_0x3f7189));}}return this[_0x9964('0xe')][_0x9964('0xa7')](util['format'](_0x9964('0x1b9'),_0x4a2a33[_0x9964('0xb2')]));};AGIVertices[_0x9964('0x17')]['google_cloud_tts']=function(_0x3db5f5){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x1ba'),_0x3db5f5[_0x9964('0x34')]));_0x3db5f5['text']=_0x3db5f5[_0x9964('0x57')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x9964('0x83')](_0x3db5f5['apiKey'])){return this[_0x9964('0xe')][_0x9964('0xa7')](_0x9964('0x1bb'));}if(!this['isConfigured'](_0x3db5f5[_0x9964('0x57')])){return this[_0x9964('0xe')][_0x9964('0xa7')](_0x9964('0xc2'));}this[_0x9964('0xe')]['noop'](util[_0x9964('0x98')](_0x9964('0x1bc'),_0x3db5f5[_0x9964('0x57')]));var _0x4a30f7=this['googleCloudTTS']['sync'](this,_0x3db5f5);if(_0x4a30f7){this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0x1bd'),_0x4a30f7));var _0x2161f3=this[_0x9964('0xe')]['streamFile'](_0x4a30f7);try{fs[_0x9964('0xff')](_0x4a30f7+_0x9964('0x100'));}catch(_0x42d2c2){logger[_0x9964('0x28')](_0x42d2c2);}return _0x2161f3;}return this[_0x9964('0xe')][_0x9964('0x28')](_0x3db5f5,_0x9964('0x1be'));};AGIVertices[_0x9964('0x17')][_0x9964('0x1bf')]=function(_0x6ada9a){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x1c0'),_0x6ada9a[_0x9964('0x34')]));_0x6ada9a['text']=_0x6ada9a[_0x9964('0x57')][_0x9964('0x53')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x9964('0x83')](_0x6ada9a[_0x9964('0x57')])){return this['channel'][_0x9964('0xa7')]('no\x20text\x20configured');}this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0x1c1'),_0x6ada9a[_0x9964('0x57')]));var _0x175b70=this[_0x9964('0x5e')][_0x9964('0x6c')](this,_0x6ada9a);if(_0x175b70){this[_0x9964('0xe')][_0x9964('0xa7')](util['format'](_0x9964('0x1c2'),_0x175b70));var _0x159555=this[_0x9964('0xe')]['streamFile'](_0x175b70);try{fs['unlink'](_0x175b70+'.wav');}catch(_0x1daf82){logger[_0x9964('0x28')](_0x1daf82);}return _0x159555;}return this[_0x9964('0xe')][_0x9964('0x28')](_0x6ada9a,_0x9964('0x1c3'));};AGIVertices[_0x9964('0x17')][_0x9964('0x1c4')]=function(_0x1a5649){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x1c5'),_0x1a5649[_0x9964('0x34')]));if(!this[_0x9964('0x83')](_0x1a5649[_0x9964('0x153')])){return this[_0x9964('0xe')][_0x9964('0x28')](_0x1a5649,_0x9964('0x154'));}logger[_0x9964('0x2c')](util['format'](_0x9964('0x155'),this['channel'][_0x9964('0x37')],_0x1a5649[_0x9964('0x153')]));var _0x1b516b=this['agentUnpause'][_0x9964('0x6c')](this,_0x1a5649[_0x9964('0x153')]);if(_0x1b516b){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x156'),this[_0x9964('0xe')][_0x9964('0x37')],_0x1a5649[_0x9964('0x153')]));this['channel'][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0x156'),this['channel'][_0x9964('0x37')],_0x1a5649['findBy']));return{'code':0xc8,'result':_0x9964('0x157')};}else{logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x158'),this[_0x9964('0xe')][_0x9964('0x37')],_0x1a5649['findBy']));this[_0x9964('0xe')][_0x9964('0xa7')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x9964('0xe')][_0x9964('0x37')],_0x1a5649[_0x9964('0x153')]));return{'code':0xc8,'result':_0x9964('0x159')};}};AGIVertices[_0x9964('0x17')]['voicemail']=function(_0x48c502){logger[_0x9964('0x2c')](util[_0x9964('0x98')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x48c502[_0x9964('0x34')]));var _0x1e6dec=this[_0x9964('0xe')]['exec'](_0x9964('0x1c6'),[_0x48c502[_0x9964('0x1c7')],_0x48c502[_0x9964('0x77')]]);if(_0x1e6dec[_0x9964('0xa6')]===-0x1){return _0x1e6dec;}return this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')]('Executed\x20command\x20%s\x20%s',_0x9964('0x1c6'),_0x48c502['mailbox']));};AGIVertices[_0x9964('0x17')][_0x9964('0x1c8')]=function(_0x5a9fe9){logger['info'](util['format'](_0x9964('0x1c9'),_0x5a9fe9[_0x9964('0x34')]));if(!this[_0x9964('0x83')](_0x5a9fe9['variable_id'])){return this['channel']['error'](_0x5a9fe9,_0x9964('0x1a4'));}var _0x144ea7=this[_0x9964('0x10')][_0x9964('0x6c')](this,_0x5a9fe9[_0x9964('0xd5')]);if(!_0x144ea7){return this[_0x9964('0xe')][_0x9964('0x28')](_0x5a9fe9,_0x9964('0xd6'));}var _0x4f5681=this[_0x9964('0xe')]['getVariable'](_0x144ea7);return{'code':0xc8,'result':_0x4f5681['extra']?_0x4f5681[_0x9964('0x9e')]:'-'};};String[_0x9964('0x17')]['replaceAll']=function(_0x2110b9,_0x50add4){return this[_0x9964('0x9c')](_0x2110b9)[_0x9964('0x1ca')](_0x50add4);};module[_0x9964('0x1cb')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index ba473b6..93772df 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 _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 +var _0x477b=['../ami','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','bind','hanguprequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','syncAttendedTransfer','syncBlindTransfer','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','updateAcw','lastPauseAt','update','uniqueid','then','catch','[%s][UPDATE][ERRORS:%s]','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','getAgent','voicePause','info','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','paused','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','format','finally','error','[ACW][START]\x20%s','message','pauseType','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','[ACW][STOP]\x20%s','acw','destlinkedid','syncHangupRequest','attended','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','secondtransfereruniqueid','transfertargetuniqueid','isNil','origtransfereruniqueid','transfereeuniqueid','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment'];(function(_0x54988f,_0x12d32c){var _0x193b6e=function(_0xc79482){while(--_0xc79482){_0x54988f['push'](_0x54988f['shift']());}};_0x193b6e(++_0x12d32c);}(_0x477b,0xaa));var _0xb477=function(_0x5aa294,_0x1a5dc8){_0x5aa294=_0x5aa294-0x0;var _0xc6be4a=_0x477b[_0x5aa294];return _0xc6be4a;};'use strict';var _=require(_0xb477('0x0'));var moment=require(_0xb477('0x1'));var ami=require(_0xb477('0x2'));var logger=require(_0xb477('0x3'))('acw');var RpcUser=require(_0xb477('0x4'));var RpcVoiceAgentReport=require(_0xb477('0x5'));function Acw(_0xd59d8c){this[_0xb477('0x6')]=_0xd59d8c[_0xb477('0x6')];this[_0xb477('0x7')]=_0xd59d8c[_0xb477('0x7')];this['timers']=_0xd59d8c[_0xb477('0x8')];this[_0xb477('0x9')]={};ami['on'](_0xb477('0xa'),this['syncAgentConnect'][_0xb477('0xb')](this));ami['on'](_0xb477('0xc'),this['syncHangupRequest'][_0xb477('0xb')](this));ami['on'](_0xb477('0xd'),this[_0xb477('0xe')][_0xb477('0xb')](this));ami['on'](_0xb477('0xf'),this[_0xb477('0x10')][_0xb477('0xb')](this));ami['on']('attendedtransfer',this[_0xb477('0x11')][_0xb477('0xb')](this));ami['on']('blindtransfer',this[_0xb477('0x12')][_0xb477('0xb')](this));ami['on']('custom:agentConnectPreview',this[_0xb477('0x13')][_0xb477('0xb')](this));}function getDiff(_0x17dbec){var _0x379ec4=moment()[_0xb477('0x14')](0x0);var _0x4c1d93=moment(_0x17dbec)['milliseconds'](0x0);return _0x379ec4[_0xb477('0x15')](_0x4c1d93,_0xb477('0x16'));}Acw[_0xb477('0x17')][_0xb477('0x18')]=function(_0x50f3ff,_0x15fafa){var _0x164dc4=this;var _0x38d4e0=getDiff(_0x164dc4['timers'][_0x50f3ff][_0xb477('0x19')]);clearTimeout(_0x164dc4['timers'][_0x50f3ff]['timer']);_0x164dc4[_0xb477('0x8')][_0x50f3ff]['timer']=![];return RpcVoiceAgentReport[_0xb477('0x1a')]({'acwtime':_0x38d4e0},_0x164dc4[_0xb477('0x8')][_0x50f3ff][_0xb477('0x1b')],_0x50f3ff)[_0xb477('0x1c')](function(_0x9ffc97){logger['info']('[%s][UPDATE][ACWTIME:%s]',_0x15fafa,_0x38d4e0,_0x9ffc97);})[_0xb477('0x1d')](function(_0x492261){logger['error'](_0xb477('0x1e'),_0x15fafa,_0x492261);})['finally'](function(){delete _0x164dc4[_0xb477('0x8')][_0x50f3ff];});};Acw[_0xb477('0x17')][_0xb477('0x1f')]=function(_0x29ddd8){try{var _0x4c6d24=this;var _0x41fedf=this['channels'][_0x29ddd8][_0xb477('0x20')];var _0x2f6e35=this[_0xb477('0x9')][_0x29ddd8][_0xb477('0x21')];var _0x3678a3=this[_0xb477('0x6')][_0x2f6e35];var _0x3a2cd6=![];var _0x33b783=_0xb477('0x22');if(_0x3678a3[_0xb477('0x23')]&&_0x3678a3[_0xb477('0x24')][_0xb477('0x25')]){_0x3a2cd6=!![];_0x33b783=_0x3678a3[_0xb477('0x24')][_0xb477('0x25')];}return ami[_0xb477('0x26')]({'action':_0xb477('0x27'),'interface':_0x41fedf,'paused':!![],'reason':_0x33b783})['then'](function(){if(_0x4c6d24['agents'][_0x41fedf]){return RpcUser[_0xb477('0x28')](_0x4c6d24[_0xb477('0x7')][_0x41fedf]['id'])[_0xb477('0x1c')](function(_0x24933d){if(!_0x24933d||_0x24933d[_0xb477('0x29')]){logger[_0xb477('0x2a')](_0xb477('0x2b'),_0x29ddd8,_0x41fedf,_0x2f6e35);return;}logger[_0xb477('0x2a')](_0xb477('0x2c'),_0x29ddd8,_0x41fedf,_0x2f6e35);var _0x1a98b7=_0x4c6d24[_0xb477('0x9')][_0x29ddd8]['attended']&&_0x4c6d24[_0xb477('0x9')][_0x29ddd8]['destlinkedid']?_0x4c6d24[_0xb477('0x9')][_0x29ddd8]['destlinkedid']:_0x29ddd8;return RpcUser['savePause'](_0x4c6d24[_0xb477('0x7')][_0x41fedf],_0x33b783,_0x1a98b7)[_0xb477('0x1c')](function(_0x5e5811){_0x4c6d24[_0xb477('0x6')][_0x2f6e35]['available']-=0x1;_0x4c6d24[_0xb477('0x6')][_0x2f6e35][_0xb477('0x2d')]+=0x1;return _0x5e5811;});})['then'](function(_0x273b52){if(_0x3a2cd6||!_0x273b52){return;}_0x4c6d24[_0xb477('0x8')][_0x41fedf]={};logger[_0xb477('0x2a')](_0xb477('0x2e'),_0x29ddd8,_0x4c6d24[_0xb477('0x6')][_0x2f6e35][_0xb477('0x2f')],_0x41fedf,_0x2f6e35);_0x4c6d24[_0xb477('0x8')][_0x41fedf][_0xb477('0x30')]=setTimeout(_0x4c6d24[_0xb477('0x31')]['bind'](_0x4c6d24,_0x41fedf),_0x4c6d24[_0xb477('0x6')][_0x2f6e35][_0xb477('0x2f')]*0x3e8);_0x4c6d24[_0xb477('0x8')][_0x41fedf]['lastPauseAt']=moment()[_0xb477('0x32')]('YYYY-MM-DD\x20HH:mm:ss');_0x4c6d24[_0xb477('0x8')][_0x41fedf][_0xb477('0x1b')]=_0x29ddd8;_0x4c6d24['timers'][_0x41fedf][_0xb477('0x21')]=_0x2f6e35;_0x4c6d24[_0xb477('0x8')][_0x41fedf][_0xb477('0x18')]=_0x4c6d24['updateAcw']['bind'](_0x4c6d24,_0x41fedf,_0x29ddd8);});}})[_0xb477('0x1d')](function(){logger['error'](_0xb477('0x2e'),_0x29ddd8,_0x4c6d24[_0xb477('0x6')][_0x2f6e35][_0xb477('0x2f')],_0x41fedf,_0x2f6e35);})[_0xb477('0x33')](function(){delete _0x4c6d24['channels'][_0x29ddd8];});}catch(_0x24d09a){logger[_0xb477('0x34')](_0xb477('0x35'),_0x24d09a[_0xb477('0x36')]);}};Acw[_0xb477('0x17')][_0xb477('0x31')]=function(_0x228023){try{var _0x2eadd3=this;if(_0x2eadd3['timers'][_0x228023]){_0x2eadd3[_0xb477('0x8')][_0x228023][_0xb477('0x30')]=![];var _0x1acf51=_0x2eadd3[_0xb477('0x8')][_0x228023]['uniqueid'];var _0x5caf6c=_0x2eadd3['timers'][_0x228023][_0xb477('0x21')];var _0x5c8931=_0x2eadd3['voiceQueues'][_0x5caf6c][_0xb477('0x2f')];logger[_0xb477('0x2a')]('[%s][TIMER][STOP][AGENT:%s]',_0x1acf51,_0x228023);RpcUser[_0xb477('0x28')](this[_0xb477('0x7')][_0x228023]['id'])[_0xb477('0x1c')](function(_0x431c0e){if(_0x431c0e[_0xb477('0x37')]==='ACW'){return RpcUser['saveUnpause'](_0x2eadd3[_0xb477('0x7')][_0x228023]);}});RpcVoiceAgentReport[_0xb477('0x1a')]({'acwtime':_0x5c8931,'agentacw':!![]},_0x1acf51,_0x228023)[_0xb477('0x1c')](function(_0x415c68){logger[_0xb477('0x2a')]('[%s][UPDATE][ACWTIME:%s]',_0x1acf51,_0x5c8931,_0x415c68);})[_0xb477('0x1d')](function(_0x55f5e4){logger[_0xb477('0x34')](_0xb477('0x1e'),_0x1acf51,_0x55f5e4);});}else{logger[_0xb477('0x34')](_0xb477('0x38'),_0x228023);if(_0x2eadd3[_0xb477('0x8')]){logger[_0xb477('0x2a')](_0xb477('0x39'),JSON['stringify'](_0x2eadd3[_0xb477('0x8')]));}}}catch(_0x4c5cf9){logger['error'](_0xb477('0x3a'),_0x4c5cf9[_0xb477('0x36')]);}};Acw[_0xb477('0x17')]['syncAgentConnect']=function(_0xa8d3bb){try{if(this['voiceQueues'][_0xa8d3bb[_0xb477('0x21')]]&&(this[_0xb477('0x6')][_0xa8d3bb[_0xb477('0x21')]][_0xb477('0x3b')]||this['voiceQueues'][_0xa8d3bb['queue']]['mandatoryDisposition'])){if(this['agents'][_0xa8d3bb[_0xb477('0x20')]]){this['channels'][_0xa8d3bb[_0xb477('0x1b')]]={'queue':_0xa8d3bb['queue'],'interface':_0xa8d3bb[_0xb477('0x20')],'destlinkedid':_0xa8d3bb[_0xb477('0x3c')]};}}}catch(_0x536212){logger[_0xb477('0x34')]('[ACW][syncAgentConnect]\x20%s',_0x536212['message']);}};Acw['prototype'][_0xb477('0x13')]=function(_0x11f4a7){try{if(this[_0xb477('0x6')][_0x11f4a7[_0xb477('0x21')]]&&(this['voiceQueues'][_0x11f4a7[_0xb477('0x21')]][_0xb477('0x3b')]||this[_0xb477('0x6')][_0x11f4a7['queue']][_0xb477('0x23')])){if(this[_0xb477('0x7')][_0x11f4a7[_0xb477('0x20')]]){this[_0xb477('0x9')][_0x11f4a7[_0xb477('0x1b')]]={'queue':_0x11f4a7[_0xb477('0x21')],'interface':_0x11f4a7['interface']};}}}catch(_0x4c759a){logger['error']('[ACW][syncAgentConnectPreview]\x20%s',_0x4c759a[_0xb477('0x36')]);}};Acw[_0xb477('0x17')][_0xb477('0x3d')]=function(_0x173316){try{if(this['channels'][_0x173316[_0xb477('0x1b')]]&&_['isUndefined'](this[_0xb477('0x9')][_0x173316['uniqueid']][_0xb477('0x3e')])){logger[_0xb477('0x2a')]('[%s][HANGUP:UNIQUEID]',_0x173316[_0xb477('0x1b')]);this[_0xb477('0x1f')](_0x173316[_0xb477('0x1b')]);}else if(this[_0xb477('0x9')][_0x173316['linkedid']]&&_[_0xb477('0x3f')](this[_0xb477('0x9')][_0x173316[_0xb477('0x40')]][_0xb477('0x3e')])){logger[_0xb477('0x2a')](_0xb477('0x41'),_0x173316['linkedid']);this[_0xb477('0x1f')](_0x173316[_0xb477('0x40')]);}}catch(_0x48402a){logger['error'](_0xb477('0x42'),_0x48402a[_0xb477('0x36')]);}};Acw[_0xb477('0x17')][_0xb477('0xe')]=function(_0x574eef){try{if(this[_0xb477('0x9')][_0x574eef[_0xb477('0x1b')]]&&this[_0xb477('0x9')][_0x574eef[_0xb477('0x1b')]][_0xb477('0x3e')]){logger[_0xb477('0x2a')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x574eef[_0xb477('0x1b')]);this[_0xb477('0x1f')](_0x574eef[_0xb477('0x1b')]);}else if(this['channels'][_0x574eef[_0xb477('0x40')]]&&this[_0xb477('0x9')][_0x574eef[_0xb477('0x40')]][_0xb477('0x3e')]){logger[_0xb477('0x2a')](_0xb477('0x43'),_0x574eef[_0xb477('0x40')]);this[_0xb477('0x1f')](_0x574eef[_0xb477('0x40')]);}}catch(_0x427879){logger['error'](_0xb477('0x44'),_0x427879[_0xb477('0x36')]);}};Acw[_0xb477('0x17')]['syncAttendedTransfer']=function(_0x389f5a){try{if(!_['isNil'](this[_0xb477('0x9')][_0x389f5a['transfereeuniqueid']])){this[_0xb477('0x1f')](_0x389f5a['transfereeuniqueid']);if(this['channels'][_0x389f5a['secondtransfereruniqueid']]){this[_0xb477('0x9')][_0x389f5a[_0xb477('0x45')]][_0xb477('0x3e')]=!![];this[_0xb477('0x9')][_0x389f5a[_0xb477('0x46')]]=this[_0xb477('0x9')][_0x389f5a[_0xb477('0x45')]];delete this['channels'][_0x389f5a['secondtransfereruniqueid']];}}else if(!_[_0xb477('0x47')](this[_0xb477('0x9')][_0x389f5a['transfertargetuniqueid']])){this[_0xb477('0x1f')](_0x389f5a[_0xb477('0x46')]);if(this[_0xb477('0x9')][_0x389f5a[_0xb477('0x48')]]){this[_0xb477('0x9')][_0x389f5a[_0xb477('0x48')]][_0xb477('0x3e')]=!![];this[_0xb477('0x9')][_0x389f5a[_0xb477('0x49')]]=this[_0xb477('0x9')][_0x389f5a[_0xb477('0x48')]];delete this['channels'][_0x389f5a[_0xb477('0x48')]];}}}catch(_0x536cb4){logger['error']('[ACW][syncAttendedTransfer]\x20%s',_0x536cb4[_0xb477('0x36')]);}};Acw[_0xb477('0x17')][_0xb477('0x12')]=function(_0x409d93){try{if(this[_0xb477('0x9')][_0x409d93[_0xb477('0x4a')]]){logger[_0xb477('0x2a')](_0xb477('0x4b'),JSON[_0xb477('0x4c')](_0x409d93['transfereruniqueid']));this['startAcw'](_0x409d93[_0xb477('0x4a')]);}else if(this[_0xb477('0x9')][_0x409d93[_0xb477('0x4d')]]){logger['info'](_0xb477('0x4e'),JSON[_0xb477('0x4c')](_0x409d93[_0xb477('0x4d')]));this[_0xb477('0x1f')](_0x409d93[_0xb477('0x4d')]);}}catch(_0x552e2f){logger['error'](_0xb477('0x4f'),_0x552e2f[_0xb477('0x36')]);}};Acw[_0xb477('0x17')]['syncAgentRingNoAnswer']=function(_0x1d72c5){try{if(this[_0xb477('0x6')][_0x1d72c5[_0xb477('0x21')]]&&this[_0xb477('0x6')][_0x1d72c5[_0xb477('0x21')]][_0xb477('0x50')]===_0xb477('0x51')){if(this[_0xb477('0x7')][_0x1d72c5['interface']]){logger[_0xb477('0x2a')](_0xb477('0x52'),_0x1d72c5[_0xb477('0x1b')],_0x1d72c5[_0xb477('0x20')],_0x1d72c5[_0xb477('0x21')]);return RpcUser[_0xb477('0x53')](this[_0xb477('0x7')][_0x1d72c5[_0xb477('0x20')]],'Auto-Pause',_0x1d72c5[_0xb477('0x1b')]);}}}catch(_0x451c63){logger[_0xb477('0x34')](_0xb477('0x54'),_0x451c63[_0xb477('0x36')]);}};module[_0xb477('0x55')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 382fb28..b43a870 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 _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 +var _0xe71d=['then','actionSipShowRegistry','actionDeviceStateList','actionSipPeerStatus','[ami.js][fullybooted]','inspect','exports','asterisk-manager','bluebird','util','../../config/logger','ami','../../config/environment','asterisk','port','username','password','promisify','action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','Action','sipshowregistry','devicestatelist','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','format','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s'];(function(_0x13b7fd,_0x4eaf7f){var _0x32a74a=function(_0x2c5d80){while(--_0x2c5d80){_0x13b7fd['push'](_0x13b7fd['shift']());}};_0x32a74a(++_0x4eaf7f);}(_0xe71d,0x15d));var _0xde71=function(_0x369151,_0x179f72){_0x369151=_0x369151-0x0;var _0x4292d5=_0xe71d[_0x369151];return _0x4292d5;};'use strict';var Manager=require(_0xde71('0x0'));var BPromise=require(_0xde71('0x1'));var util=require(_0xde71('0x2'));var logger=require(_0xde71('0x3'))(_0xde71('0x4'));var config=require(_0xde71('0x5'));var ami=new Manager(config[_0xde71('0x6')][_0xde71('0x7')],config[_0xde71('0x6')]['ip'],config[_0xde71('0x6')][_0xde71('0x8')],config['asterisk'][_0xde71('0x9')],!![]);ami['keepConnected']();ami['Action']=BPromise[_0xde71('0xa')](ami[_0xde71('0xb')]);function error(_0x7921b4){logger[_0xde71('0xc')](util['format'](_0xde71('0xd'),config['asterisk'][_0xde71('0x8')],config[_0xde71('0x6')]['ip'],config[_0xde71('0x6')][_0xde71('0x7')],util['inspect'](_0x7921b4,![],null)));}function close(){logger[_0xde71('0xc')](util['format'](_0xde71('0xe'),config['asterisk'][_0xde71('0x8')],config['asterisk']['ip'],config['asterisk'][_0xde71('0x7')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0xde71('0xf')]({'action':_0xde71('0x10')});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0xde71('0xf')]({'action':_0xde71('0x11')});};};ami['actionSipPeerStatus']=function(){return function(){return ami['Action']({'action':'sippeerstatus'});};};ami[_0xde71('0x12')]=function(){return function(){return ami['Action']({'action':_0xde71('0x13')});};};ami[_0xde71('0x14')]=function(){return function(){return ami['Action']({'action':_0xde71('0x15')});};};function connect(){logger[_0xde71('0x16')](util[_0xde71('0x17')](_0xde71('0x18'),config[_0xde71('0x6')][_0xde71('0x8')],config[_0xde71('0x6')]['ip'],config[_0xde71('0x6')][_0xde71('0x7')]));ami[_0xde71('0x19')](_0xde71('0xc'),error);ami['once']('close',close);}ami['on'](_0xde71('0x1a'),connect);ami['on'](_0xde71('0x1b'),function(_0x530c0a){logger['info'](util[_0xde71('0x17')](_0xde71('0x1c'),config[_0xde71('0x6')]['username'],config[_0xde71('0x6')]['ip'],config[_0xde71('0x6')][_0xde71('0x7')],util['inspect'](_0x530c0a,![],null)));});ami['on'](_0xde71('0x1d'),function(){logger[_0xde71('0x16')](util['format'](_0xde71('0x1e'),config[_0xde71('0x6')][_0xde71('0x8')],config['asterisk']['ip'],config[_0xde71('0x6')][_0xde71('0x7')]));return Promise['resolve']()[_0xde71('0x1f')](ami[_0xde71('0x20')]())[_0xde71('0x1f')](ami[_0xde71('0x21')]())[_0xde71('0x1f')](ami[_0xde71('0x22')]())['then'](ami[_0xde71('0x12')]())['then'](ami[_0xde71('0x14')]())['catch'](function(_0x1cbec4){logger['error'](_0xde71('0x23'),util[_0xde71('0x24')](_0x1cbec4,{'showHidden':![],'depth':null}));});});ami['once']('error',error);ami[_0xde71('0x19')]('close',close);module[_0xde71('0x25')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 14351e0..72e0c7d 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 _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 +var _0xda3f=['then','rpc','memberReport','error','message','result','catch','exports','bluebird','../../config/logger','Request','request'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xda3f,0xec));var _0xfda3=function(_0x5f391a,_0x384401){_0x5f391a=_0x5f391a-0x0;var _0x53dfd9=_0xda3f[_0x5f391a];return _0x53dfd9;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xfda3('0x0'));var logger=require(_0xfda3('0x1'))('ami');var client=jayson['client']['http']({'port':0x2329});client[_0xfda3('0x2')]=function(_0x581693,_0x36dc71){return new BPromise(function(_0x22187d,_0x516500){return client[_0xfda3('0x3')](_0x581693,_0x36dc71)[_0xfda3('0x4')](function(_0x47e7e2){logger['debug'](_0xfda3('0x5'),_0xfda3('0x6'),_0x581693,_0x36dc71,_0x47e7e2);if(_0x47e7e2[_0xfda3('0x7')]){logger[_0xfda3('0x7')](_0xfda3('0x5'),_0xfda3('0x6'),_0x581693,_0x47e7e2[_0xfda3('0x7')][_0xfda3('0x8')],_0x36dc71);return _0x516500(_0x47e7e2[_0xfda3('0x7')][_0xfda3('0x8')]);}else{return _0x22187d(_0x47e7e2[_0xfda3('0x9')]);}})[_0xfda3('0xa')](function(_0x4d7841){logger[_0xfda3('0x7')](_0xfda3('0x5'),_0xfda3('0x6'),_0x581693,_0x4d7841,_0x36dc71);return _0x516500(_0x4d7841);});});};module[_0xfda3('0xb')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index f54169d..860985f 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 _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 +var _0x419e=['command','content','true','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','undefined','resolve','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','Interval','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','progressive','handlePower','power','dialPowerLevel','booked','Queue','method\x20not\x20recognized','silly','Voice\x20Queue\x20%s\x20$s','intervalIftime','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','uniqueid','ivr','updateOriginated','YYYY-MM-DD\x20HH:mm:ss','queue','outboundAnswerCallsDay','reason','agent','agiafterat','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','[syncAgentComplete]','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','dropreason','dialQueueProject2','countdropretry','countglobal','dialDropRetryFrequency','callAdditionalPhoneAfterMin','voiceQueue','dialDropMaxRetry','additional','add','minutes','ContactId','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','Drop','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','verifyAdditionalPhones','dialAbandonedMaxRetry','queueCallerAbandonCreateState','rescheduleContact','[syncAgentComplete][createHistory][11]','channel','actionid','strategy','rrmemory','roundrobin','isNil','locked','stateinterface','paused','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','pick','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock2]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncOriginateResponse','getQueue','Success','callProgressDetecting','[callProgressDetecting]\x20','variable','amdstatus','exten','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','membername','emit','custom:amd','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','Machine','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','countmachineretry','dialMachineRetryFrequency','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','MACHINE','AMD','countagentrejectretry','reason\x2019\x20machine....','ivrAnswerCallsDay','[syncHangupIvr]','dialQueueProject','AnswerAGI','[syncHangupIvr][createHistory]','moveContactManagedDialer','Normal\x20Clearing','outboundUnknownCallsDay','cause-txt','Unknow','queuesSummary','running','statusMessage','available','talking','pTalking','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','throttle','filter','dialPreviewRecallmeReminder','online','handlePreviewRecallNotifications','map','Agent','user:dialPreviewRecallReminder','[uniqueid]','clearZombieChannels','[actions]','enqueue','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','loggerHandler','UserId','[emptyContact][createHistory]','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','checkPreviewRecallReminder','user:%s','handleIvr','actionOriginate','object','voiceQueue\x20is\x20undefine','phone','originate','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','xcally-motion-dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','isOutboundQueue','XMD-CAMPAIGNID','setXMDContactVariables','Contact','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','dialOriginateCallerIdName','getCallerIdRandom','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','OriginateError','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialBusyMaxRetry','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','entity\x20is\x20undefine','[callProgressDetecting]','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','dialBusyRetryFrequency','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','predictiveIntervalMaxThreshold','round','predictiveIntervalAvailable','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','predictiveIntervalErlangCallsDroppedCalls','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','loggedIn','predictiveIntervalPauses','outboundQueuePauses','[CatchErlangB]','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','voicePause','unlockContact','outboundReCallsDay','RecallInQueue','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose]','Blacklist','[Originate][MoveBlacklist]','inBlackList','getContactDialerIvr','NO_AVAILABLE_CONTACTS','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','getContactDialer','checkContactEmpty','countReScheduled','ACTIVE','emptyContact','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','dialOrderByScheduledAt','[countReScheduled]\x20','[actionOriginatePredictive]\x20','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\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','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','[busyFactor]','Umin\x20=\x20','exports','util','lodash','uuid','moment','ioredis','./utils','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','predictive','../ami','redis','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','./models/action','./models/history','./models/final','./models/hangup','env','XCALLY_IP_AGI','127.0.0.1','prototype','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','custom:queuesummary','syncQueueSummary','syncQueueSummaryComplete','hangup','syncHangup','syncNewExten','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopClearZombieChannels','then','previewRecallmeReminderInterval','type','outbound','debug','inspect','format','voice:queue:%s','name','isEmpty','-----\x20Stats\x20Predictive\x20---','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','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','History\x20information\x20are\x20empty','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','getSeconds','startProgressive','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','error','stack','checkContactLowerLimitOriginate','temp','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','[getContactDialer2][Empty]','state','statedesc','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','stringify','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','isIVRCampaignActive','isIVRCampaign','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','originated','INACTIVE','is\x20not\x20active','DISACTIVED','is\x20disactive','[ifTime][Action]','Error','isTrunkReachable','active','SIP/%s','status','reachable','unmonitored','Trunk','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','checkIfTime','checkIfTimeIntervals','ifTimeIvr','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','ifTime','\x20Intervals\x20is\x20empty\x20','timezones','\x20Timezone\x20unknow\x20','isArray','length','iftime\x20%s,%s','indexOf','catch','push','Action'];(function(_0x3028fe,_0x92203f){var _0x594bdd=function(_0x599ca8){while(--_0x599ca8){_0x3028fe['push'](_0x3028fe['shift']());}};_0x594bdd(++_0x92203f);}(_0x419e,0x180));var _0xe419=function(_0x57c4ff,_0x102e4e){_0x57c4ff=_0x57c4ff-0x0;var _0x21649c=_0x419e[_0x57c4ff];return _0x21649c;};'use strict';var util=require(_0xe419('0x0'));var _=require(_0xe419('0x1'));var uuid=require(_0xe419('0x2'));var moment=require(_0xe419('0x3'));var rr=require('rr');var Redis=require(_0xe419('0x4'));var utils=require(_0xe419('0x5'));var hopperUtils=require(_0xe419('0x6'));var ut=require(_0xe419('0x7'));var config=require(_0xe419('0x8'));var logger=require('../../../config/logger')('dialer');var loggerBooked=require(_0xe419('0x9'))('booked');var loggerPredictive=require(_0xe419('0x9'))(_0xe419('0xa'));var loggerPredictiveCalls=require(_0xe419('0x9'))('predictiveCalls');var loggerSyncQueueSummary=require(_0xe419('0x9'))('syncQueueSummary');var ami=require(_0xe419('0xb'));config[_0xe419('0xc')]=_['defaults'](config[_0xe419('0xc')],{'host':'localhost','port':0x18eb});var io=require(_0xe419('0xd'))(new Redis(config[_0xe419('0xc')]));var cmHopper=require(_0xe419('0xe'));var voiceQueueRt=require(_0xe419('0xf'));var RpcSetting=require(_0xe419('0x10'));var Interval=require('../rpc/interval');var Action=require(_0xe419('0x11'));var History=require(_0xe419('0x12'));var Final=require(_0xe419('0x13'));var AgentComplete=require('./models/agentComplete');var QueueCallerAbandon=require('./models/queueCallerAbandon');var Hangup=require(_0xe419('0x14'));var ipAgi=process[_0xe419('0x15')][_0xe419('0x16')]||_0xe419('0x17');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xe419('0x18')]['enqueue']=function(_0x402303){this['tail']=this[_0xe419('0x19')]?this[_0xe419('0x19')][_0xe419('0x1a')](_0x402303):_0x402303();};function Dialer(_0x591470,_0x478f8f){this[_0xe419('0x1b')]=new Sequence();this[_0xe419('0x1c')]=_0x478f8f;this[_0xe419('0x1d')]=_0x591470['voiceQueues'];this[_0xe419('0x1e')]=_0x591470[_0xe419('0x1e')];this['agents']=_0x591470[_0xe419('0x1f')];this['trunks']=_0x591470[_0xe419('0x20')];this['maxNumberOriginate']=config[_0xe419('0x21')]||0x2;this[_0xe419('0x22')]={};this[_0xe419('0x23')]={};this[_0xe419('0x24')]={};this[_0xe419('0x25')]={};this[_0xe419('0x26')]={};this[_0xe419('0x27')]={};this['startProgressive']={};this[_0xe419('0x28')]={};this[_0xe419('0x29')]={};this[_0xe419('0x2a')]={};this['queuesSummary']={};ami['on'](_0xe419('0x2b'),this[_0xe419('0x2c')][_0xe419('0x2d')](this));ami['on'](_0xe419('0x2e'),this[_0xe419('0x2f')][_0xe419('0x2d')](this));ami['on']('originateresponse',this['syncOriginateResponse'][_0xe419('0x2d')](this));ami['on'](_0xe419('0x30'),this[_0xe419('0x31')][_0xe419('0x2d')](this));ami['on'](_0xe419('0x32'),this[_0xe419('0x33')]['bind'](this));ami['on']('custom:queuesummarycomplete',this[_0xe419('0x34')][_0xe419('0x2d')](this));ami['on'](_0xe419('0x35'),this[_0xe419('0x36')]['bind'](this));ami['on']('newexten',this[_0xe419('0x37')][_0xe419('0x2d')](this));ami['on']('varset',this[_0xe419('0x38')][_0xe419('0x2d')](this));ami['on'](_0xe419('0x39'),this[_0xe419('0x3a')]['bind'](this));ami['on'](_0xe419('0x3b'),this[_0xe419('0x3c')][_0xe419('0x2d')](this));this['loopCampaigns']();this[_0xe419('0x3d')]();RpcSetting['getSettings']()[_0xe419('0x3e')](function(_0x915382){previewRecallmeReminderInterval=_0x915382[_0xe419('0x3f')];});}function isNotNull(_0x19c03d){return _0x19c03d!==null&&!_['isUndefined'](_0x19c03d);}function msgResponse(_0x4ef7da,_0x309cd8,_0x2774bc){return{'action':_0x4ef7da,'response':_0x309cd8,'message':_0x2774bc,'stack':_0x2774bc};}function emit(_0x462257,_0x59e539,_0x4da7b4){io['to'](_0x462257)['emit'](_0x59e539,_0x4da7b4);}function emitOutboundVoiceQueueSummary(_0x8b38f5){if(_0x8b38f5[_0xe419('0x40')]===_0xe419('0x41')){logger[_0xe419('0x42')]('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util[_0xe419('0x43')](_0x8b38f5,{'showHidden':![],'depth':null}));emit(util[_0xe419('0x44')](_0xe419('0x45'),_0x8b38f5[_0xe419('0x46')]),'voice_queue:save',_0x8b38f5);}}function checkGetDataPredictive(_0xe22007){if(isNotNull(_0xe22007)&&!_[_0xe419('0x47')](_0xe22007)){loggerPredictive['info'](_0xe419('0x48'));loggerPredictive[_0xe419('0x49')](_0xe419('0x4a'),_0xe22007[_0xe419('0x4b')]);loggerPredictive[_0xe419('0x49')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xe22007[_0xe419('0x4c')]);loggerPredictive[_0xe419('0x49')](_0xe419('0x4d'),_0xe22007[_0xe419('0x4e')]);loggerPredictive[_0xe419('0x49')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xe22007[_0xe419('0x4f')]);loggerPredictive['info']('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xe22007[_0xe419('0x50')]);loggerPredictive[_0xe419('0x49')](_0xe419('0x51'),_0xe22007['predictiveIntervalAvgTalktime']);loggerPredictive[_0xe419('0x49')](_0xe419('0x52'));if(_0xe22007[_0xe419('0x4b')]>0x0){if(!_[_0xe419('0x53')](_0xe22007[_0xe419('0x54')])&&_0xe22007[_0xe419('0x54')]>0x0){return!![];}loggerPredictive['info'](_0xe419('0x55'));if(!_[_0xe419('0x53')](_0xe22007[_0xe419('0x50')])&&_0xe22007[_0xe419('0x50')]>0x0){return!![];}loggerPredictive[_0xe419('0x49')](_0xe419('0x56'));}else{loggerPredictive[_0xe419('0x49')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive['info'](_0xe419('0x57'));}return![];}function mergeDataErlangB(_0x96c32f){return function(_0x47ba41){loggerPredictive['info']('---------\x20ErlangB\x20---------');loggerPredictive[_0xe419('0x49')](_0xe419('0x58'),_0x47ba41[_0xe419('0x59')]);loggerPredictive[_0xe419('0x49')](_0xe419('0x5a'),_0x47ba41[_0xe419('0x5b')]);loggerPredictive[_0xe419('0x49')](_0xe419('0x5c'),_0x47ba41[_0xe419('0x5d')]);loggerPredictive['info'](_0xe419('0x5e'),_0x47ba41[_0xe419('0x5f')]);loggerPredictive[_0xe419('0x49')](_0xe419('0x5c'),_0x47ba41[_0xe419('0x5d')]);loggerPredictive[_0xe419('0x49')](_0xe419('0x52'));_[_0xe419('0x60')](_0x96c32f,_0x47ba41);};}function ifInterval(_0x2923f8,_0x4fe755){if(_['isUndefined'](_0x4fe755)){return![];}return utils[_0xe419('0x61')](undefined,_0x4fe755)<_0x2923f8*0x3c;}function clearPredictiveAttributes(_0x1bf111){if(_0x1bf111[_0xe419('0x62')]){_0x1bf111[_0xe419('0x62')]=undefined;loggerPredictive[_0xe419('0x42')](_0x1bf111[_0xe419('0x46')],_0xe419('0x63'));}if(_0x1bf111[_0xe419('0x27')]){_0x1bf111[_0xe419('0x27')]=undefined;loggerPredictive[_0xe419('0x42')](_0x1bf111[_0xe419('0x46')],_0xe419('0x64'));}if(_0x1bf111[_0xe419('0x65')]){clearInterval(_0x1bf111['handlePredictive']);_0x1bf111['handlePredictive']=undefined;loggerPredictive['debug'](_0x1bf111[_0xe419('0x46')],'handlePredictive\x20interval\x20cleared');}}function loggerCatchPredictive(_0x34d3ff,_0x4ab48d){return function(_0x1b736e){loggerPredictive[_0xe419('0x66')](_0x4ab48d['name'],_0x34d3ff);loggerPredictive[_0xe419('0x66')](_0x1b736e[_0xe419('0x67')]);clearPredictiveAttributes(_0x4ab48d);};}function loggerCatch(_0x175b3a){return function(_0x2a8d5e){logger[_0xe419('0x66')](_0x175b3a,util[_0xe419('0x43')](_0x2a8d5e,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x18b736,_0x2d1755,_0x1b47df){return function(_0x30ea3b){utils[_0xe419('0x68')](_0x2d1755,_0x1b47df,0x0);_0x2d1755[_0xe419('0x69')]=0x0;logger[_0xe419('0x66')](_0x18b736,util[_0xe419('0x43')](_0x30ea3b,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x3870b5){return function(_0x3c2316){if(isNotNull(_0x3c2316)&&isNotNull(_0x3c2316[0x0])){if(_0x3c2316[0x0][_0xe419('0x6a')]>0x0){_0x3870b5[_0xe419('0x6b')]=utils[_0xe419('0x6c')][_0xe419('0x6d')];logger[_0xe419('0x49')](_0xe419('0x6e')+_0x3870b5[_0xe419('0x46')],_0x3c2316[0x0][_0xe419('0x6a')],_0xe419('0x6f'));}else{_0x3870b5[_0xe419('0x6b')]=utils[_0xe419('0x6c')]['NO_AVAILABLE_CONTACTS'];logger['info'](_0xe419('0x70')+_0x3870b5['name']);}}};}function createObjHistory(_0x5ef45d,_0x5c7ab9,_0xb3e6c9,_0x577238,_0x599dc0){_0x5ef45d[_0xe419('0x6b')]=_0xb3e6c9;var _0x358cfd=new Action(_0x5ef45d,_0x5c7ab9);var _0x4e05c4=new History(_0x358cfd);_0x4e05c4[_0xe419('0x71')]=_0x577238;_0x4e05c4[_0xe419('0x72')]=_0x599dc0;_0x4e05c4[_0xe419('0x73')]=_0x358cfd[_0xe419('0x74')];return _0x4e05c4;}function unlockQueueStatus(_0xd23911,_0x4713ab){setTimeout(function(){if(_[_0xe419('0x53')](_0xd23911[_0xe419('0x75')])){loggerBooked['error'](_0xe419('0x76'),_0x4713ab);}_0xd23911['queueStatusComplete']=!![];loggerBooked[_0xe419('0x49')]('[booked][unlockQueueStatus]',_0x4713ab,JSON[_0xe419('0x77')](_['pick'](_0xd23911,[_0xe419('0x46'),_0xe419('0x75')])));},0x1f3);}function checkInterval(_0x179e5a){return function(){if(!isNotNull(_0x179e5a['Interval'])){_0x179e5a['message']=utils[_0xe419('0x6c')][_0xe419('0x78')];throw _0x179e5a['name']+_0xe419('0x79');}if(!isNotNull(_0x179e5a['Interval'][_0xe419('0x7a')])){_0x179e5a['message']=utils[_0xe419('0x6c')][_0xe419('0x78')];throw _0x179e5a[_0xe419('0x46')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_['isEmpty'](_0x179e5a['Interval'][_0xe419('0x7a')]))){_0x179e5a[_0xe419('0x6b')]=utils[_0xe419('0x6c')][_0xe419('0x78')];throw _0x179e5a[_0xe419('0x46')]+_0xe419('0x79');}};}function checkIsIVRCampaignActive(_0x523247){return function(){if(!utils[_0xe419('0x7b')](_0x523247)){_0x523247[_0xe419('0x6b')]=utils[_0xe419('0x6c')]['INACTIVE'];throw _0x523247[_0xe419('0x46')]+'\x20NOT\x20Active';}};}function emitCampaignSummary(_0x4d857e){if(utils[_0xe419('0x7c')](_0x4d857e)){emit(util[_0xe419('0x44')](_0xe419('0x7d'),_0x4d857e[_0xe419('0x46')]),_0xe419('0x7e'),_0x4d857e);}}function loggerCatchQueueSummary(_0x5bde3f,_0x2f5a5e){return function(_0x354d85){clearPredictiveAttributes(_0x2f5a5e);emitCampaignSummary(_0x2f5a5e);loggerSyncQueueSummary[_0xe419('0x42')](_0x5bde3f,util[_0xe419('0x43')](_0x354d85,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x4dcee3){if(_0x4dcee3[_0xe419('0x7f')]){if(_0x4dcee3[_0xe419('0x80')]===0x0){_0x4dcee3['sendMessageOneNotActive']=![];_0x4dcee3['message']=utils['CAMPAIGN_STATUS'][_0xe419('0x81')];loggerSyncQueueSummary[_0xe419('0x42')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x4dcee3[_0xe419('0x46')],_0xe419('0x82'));}else{_0x4dcee3['message']=utils['CAMPAIGN_STATUS'][_0xe419('0x83')];loggerSyncQueueSummary['debug']('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x4dcee3['name'],_0xe419('0x84'));}emitCampaignSummary(_0x4dcee3);}}function myreject(_0x500891){return function(_0x55feb6){return _0x500891(msgResponse(_0xe419('0x85'),_0xe419('0x86'),JSON[_0xe419('0x77')](_0x55feb6)));};}Dialer['prototype'][_0xe419('0x87')]=function(_0x409621){return!_[_0xe419('0x53')](_0x409621)&&_0x409621&&!_[_0xe419('0x53')](_0x409621[_0xe419('0x46')])&&!_[_0xe419('0x53')](_0x409621[_0xe419('0x88')])&&_0x409621[_0xe419('0x88')]&&(this[_0xe419('0x20')][util[_0xe419('0x44')](_0xe419('0x89'),_0x409621['name'])][_0xe419('0x8a')]===_0xe419('0x8b')||this[_0xe419('0x20')][util['format'](_0xe419('0x89'),_0x409621[_0xe419('0x46')])][_0xe419('0x8a')]===_0xe419('0x8c'));};Dialer[_0xe419('0x18')]['checkIsTrunkReachable']=function(_0x40200d){var _0x7cda7=this;return function(){if(!_0x7cda7[_0xe419('0x87')](_0x40200d[_0xe419('0x8d')])){if(!_0x7cda7[_0xe419('0x87')](_0x40200d[_0xe419('0x8e')])){_0x40200d[_0xe419('0x6b')]=utils[_0xe419('0x6c')]['TRUNK_NOT_REACHABLE'];throw _0x40200d[_0xe419('0x46')]+_0xe419('0x8f');}}};};Dialer[_0xe419('0x18')][_0xe419('0x90')]=function(_0xee45a,_0x117e32,_0x33faaf,_0x29cc13){var _0xc2f5c8=this;return function(){var _0x5d4e5f=!![];return _0xc2f5c8['ifTimeIvr'](_0xee45a,_0x117e32,_0x33faaf,_0x29cc13,_0x5d4e5f);};};Dialer[_0xe419('0x18')][_0xe419('0x91')]=function(_0x5ba1f8,_0x5a2664,_0xbf183d,_0x24c2d5){var _0x4343e9=this;return function(){var _0x24ddd2=![];return _0x4343e9[_0xe419('0x92')](_0x5ba1f8['Intervals'],_0x5a2664,_0xbf183d,_0x24c2d5,_0x24ddd2);};};Dialer['prototype'][_0xe419('0x92')]=function(_0x1456dc,_0x505d5b,_0x19efdd,_0x3f0557,_0x119cbc){var _0x5be7de=[];return new Promise(function(_0x3b9fae,_0x5c66d6){if(!isNotNull(_0x1456dc)){_0x3f0557['message']=utils[_0xe419('0x6c')][_0xe419('0x78')];return _0x5c66d6(msgResponse('ifTime',_0xe419('0x93'),_0x19efdd+_0xe419('0x94')));}if(_['isEmpty'](_0x1456dc)){_0x3f0557[_0xe419('0x6b')]=utils[_0xe419('0x6c')][_0xe419('0x95')];return _0x5c66d6(msgResponse(_0xe419('0x96'),_0xe419('0x93'),_0x19efdd+_0xe419('0x97')));}if(_0x505d5b&&_['isUndefined'](config[_0xe419('0x98')][_0x505d5b])){_0x3f0557[_0xe419('0x6b')]=utils['CAMPAIGN_STATUS']['UNKNOWN_TIMEZONE'];return _0x5c66d6(msgResponse(_0xe419('0x96'),'Failure',_0x19efdd+_0xe419('0x99')+_0x505d5b));}if(_[_0xe419('0x9a')](_0x1456dc)){for(var _0x5abd80=0x0;_0x5abd80<_0x1456dc[_0xe419('0x9b')];_0x5abd80+=0x1){_0x5be7de['push'](ami['Action']({'action':'command','command':util[_0xe419('0x44')](_0xe419('0x9c'),_0x1456dc[_0x5abd80]['interval'],!_[_0xe419('0x53')](config['timezones'][_0x505d5b])?_0x505d5b:'')})[_0xe419('0x3e')](function(_0x5b4dbd){return _0x5b4dbd['content'][_0xe419('0x9d')]('true')>=0x0;})[_0xe419('0x9e')](myreject(_0x5c66d6)));}}else{_0x5be7de[_0xe419('0x9f')](ami[_0xe419('0xa0')]({'action':_0xe419('0xa1'),'command':util['format'](_0xe419('0x9c'),_0x1456dc,!_[_0xe419('0x53')](config['timezones'][_0x505d5b])?_0x505d5b:'')})[_0xe419('0x3e')](function(_0x3800d2){return _0x3800d2[_0xe419('0xa2')][_0xe419('0x9d')](_0xe419('0xa3'))>=0x0;})[_0xe419('0x9e')](myreject(_0x5c66d6)));}Promise['all'](_0x5be7de)[_0xe419('0x3e')](function(_0x31c8d8){var _0xf4a7bb=_[_0xe419('0xa4')](_0x31c8d8);if(_0xf4a7bb){return _0x3b9fae(_0xf4a7bb);}else{_0x3f0557[_0xe419('0x6b')]=_0x119cbc?utils['CAMPAIGN_STATUS'][_0xe419('0xa5')]:utils[_0xe419('0x6c')][_0xe419('0xa6')];return _0x5c66d6(msgResponse(_0xe419('0xa7'),'Failure',_0xe419('0xa8')+_0x119cbc+'\x20'+_0x19efdd+_0xe419('0xa9')+util[_0xe419('0x43')](_0x1456dc,{'showHidden':![],'depth':null})+_0xe419('0xaa')+_0x505d5b));}})[_0xe419('0x9e')](function(_0x16769c){return _0x5c66d6(msgResponse(_0xe419('0x96'),_0xe419('0x93'),JSON[_0xe419('0x77')](_0x16769c)));});});};Dialer['prototype']['loopCampaigns']=function(){var _0x1c941b=this;return cmHopper[_0xe419('0xab')]({'active':![]},{'where':{'active':!![]}})[_0xe419('0x3e')](function(){setInterval(function(){_0x1c941b[_0xe419('0xac')]();},0x3e8);});};Dialer['prototype'][_0xe419('0xac')]=function(){var _0x119ba8=this;var _0x27b406;for(var _0xd0b467 in this[_0xe419('0x1e')]){if(typeof this[_0xe419('0x1e')][_0xd0b467]!==_0xe419('0xad')){_0x27b406=this[_0xe419('0x1e')][_0xd0b467];if(utils['isIVRCampaign'](_0x27b406)&&utils[_0xe419('0x7b')](_0x27b406)){_0x27b406[_0xe419('0x7f')]=!![];Promise[_0xe419('0xae')]()[_0xe419('0x3e')](checkIsIVRCampaignActive(_0x27b406))[_0xe419('0x3e')](checkInterval(_0x27b406))[_0xe419('0x3e')](_0x119ba8[_0xe419('0xaf')](_0x27b406))[_0xe419('0x3e')](_0x119ba8[_0xe419('0x90')](_0x27b406[_0xe419('0xb0')],_0x27b406[_0xe419('0xb1')],_0x27b406[_0xe419('0x46')],_0x27b406))[_0xe419('0x3e')](_0x119ba8[_0xe419('0x91')](_0x27b406[_0xe419('0xb2')],_0x27b406['dialTimezone'],_0x27b406[_0xe419('0x46')],_0x27b406))[_0xe419('0x3e')](_0x119ba8[_0xe419('0xb3')](_0x27b406))[_0xe419('0x9e')](loggerCatchQueueSummary(_0xe419('0xb4'),_0x27b406));}else{notSendMessagesCampaign(_0x27b406);}}}};Dialer[_0xe419('0x18')][_0xe419('0xb5')]=function(_0x464583){if(_0x464583[_0xe419('0xb6')]!==_0xe419('0xa')){clearPredictiveAttributes(_0x464583);}switch(_0x464583[_0xe419('0xb6')]){case _0xe419('0xb7'):this[_0xe419('0xb8')](_0x464583,0x1);break;case _0xe419('0xb9'):this['handlePower'](_0x464583,_0x464583[_0xe419('0xba')]);break;case'predictive':this[_0xe419('0xa')](_0x464583);break;case _0xe419('0xbb'):this[_0xe419('0xb8')](_0x464583,0x1);break;default:logger[_0xe419('0x66')](_0xe419('0xbc'),_0x464583['name'],_0xe419('0xbd'));}};Dialer['prototype'][_0xe419('0x96')]=function(_0x3164f1,_0x4df74b){var _0x49a041=_0x3164f1[_0xe419('0xb1')];var _0x440599=_0x4df74b?_0x3164f1[_0xe419('0xb0')]:_0x3164f1[_0xe419('0xb2')][_0xe419('0x7a')];logger[_0xe419('0xbe')]('Dialer::ifTime()',_0x440599,_0x49a041,_0x3164f1['name'],util['format'](_0xe419('0xbf'),_0x3164f1['name'],_0x3164f1['id']));var _0x1862b8=null;return Interval[_0xe419('0xc0')](_0x440599,_0x49a041)[_0xe419('0x3e')](function(_0x1f8d7b){if(_0x1f8d7b===!![]){return _0x1f8d7b;}else{_0x3164f1[_0xe419('0x6b')]=_0x4df74b?utils[_0xe419('0x6c')][_0xe419('0xa5')]:utils[_0xe419('0x6c')][_0xe419('0xa6')];_0x1862b8=msgResponse(_0xe419('0xa7'),_0xe419('0x93'),'Global:\x20'+_0x4df74b+'\x20'+_0x3164f1[_0xe419('0x46')]+_0xe419('0xa9')+util['inspect'](_0x440599,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x49a041);}if(_0x1862b8!==null){logger[_0xe419('0xbe')](_0xe419('0xc1'),_0x1862b8);_0x1862b8[_0xe419('0xc2')]=_0x4df74b;throw _0x1862b8;}})[_0xe419('0x9e')](function(_0x176776){logger[_0xe419('0x66')](_0xe419('0xc3'),_0x176776);throw msgResponse('[ifTime][Action]',_0xe419('0x86'),util[_0xe419('0x43')](_0x176776,{'showHidden':![],'depth':null}));});};Dialer[_0xe419('0x18')][_0xe419('0x2c')]=function(_0x1fa67e){if(this[_0xe419('0x1d')][_0x1fa67e['queue']]){if(this[_0xe419('0x25')][_0x1fa67e['uniqueid']]&&this[_0xe419('0x25')][_0x1fa67e[_0xe419('0xc4')]][_0xe419('0x40')]!==_0xe419('0xc5')){this[_0xe419('0xc6')](this['voiceQueues'][_0x1fa67e['queue']]);this[_0xe419('0x25')][_0x1fa67e[_0xe419('0xc4')]]['answertime']=moment()[_0xe419('0x44')](_0xe419('0xc7'));}}};Dialer[_0xe419('0x18')]['syncAgentComplete']=function(_0x1212a7){var _0xc65b6e=this[_0xe419('0x25')][_0x1212a7[_0xe419('0xc4')]];if(this[_0xe419('0x1d')][_0x1212a7[_0xe419('0xc8')]]){if(_0xc65b6e&&_0xc65b6e['type']!==_0xe419('0xc5')){delete this[_0xe419('0x25')][_0x1212a7[_0xe419('0xc4')]];this[_0xe419('0x1d')][_0x1212a7[_0xe419('0xc8')]][_0xe419('0xc9')]+=0x1;var _0x3921d2=new AgentComplete(_0xc65b6e,_0x1212a7);if(_0x1212a7[_0xe419('0xca')]===_0xe419('0xcb')){_0x3921d2[_0xe419('0xcc')]=this['voiceQueues'][_0x1212a7[_0xe419('0xc8')]]['dialQueueProject2']&&this[_0xe419('0x1d')][_0x1212a7[_0xe419('0xc8')]][_0xe419('0xcd')]?moment()[_0xe419('0x44')](_0xe419('0xc7')):undefined;}hopperUtils[_0xe419('0xce')](_0x3921d2)['catch'](loggerCatch(_0xe419('0xcf')));hopperUtils['moveContactManagedDialer'](_0x3921d2)[_0xe419('0x9e')](loggerCatch(_0xe419('0xd0')));}}};Dialer[_0xe419('0x18')]['syncQueueCallerAbandon']=function(_0x45c8b9){var _0x9d13cc=this[_0xe419('0x25')][_0x45c8b9[_0xe419('0xc4')]];var _0x499ef3=this;var _0x4a3a14=![];var _0x118d57;var _0x101277;if(this[_0xe419('0x1d')][_0x45c8b9[_0xe419('0xc8')]]){if(_0x9d13cc&&_0x9d13cc['type']!==_0xe419('0xc5')){delete this[_0xe419('0x25')][_0x45c8b9[_0xe419('0xc4')]];this[_0xe419('0xc6')](this[_0xe419('0x1d')][_0x45c8b9[_0xe419('0xc8')]]);_0x9d13cc[_0xe419('0xd1')]=moment()[_0xe419('0x44')]('YYYY-MM-DD\x20HH:mm:ss');var _0x3d1f0d=new QueueCallerAbandon(_0x9d13cc,_0x45c8b9);if(utils[_0xe419('0x61')](_0x9d13cc[_0xe419('0xd1')],_0x9d13cc[_0xe419('0xd2')])>=_0x9d13cc[_0xe419('0xd3')]){this[_0xe419('0x1d')][_0x45c8b9[_0xe419('0xc8')]][_0xe419('0x4e')]+=0x1;this[_0xe419('0x1d')][_0x45c8b9[_0xe419('0xc8')]][_0xe419('0xd4')]+=0x1;this[_0xe419('0x1d')][_0x45c8b9['queue']]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x3d1f0d[_0xe419('0x71')]=0xa;_0x3d1f0d[_0xe419('0x72')]='Drop';_0x3d1f0d[_0xe419('0xd5')]='TIMEOUT';_0x3d1f0d['agiafterat']=this['voiceQueues'][_0x45c8b9[_0xe419('0xc8')]][_0xe419('0xd6')]?moment()['format'](_0xe419('0xc7')):undefined;_0x3d1f0d[_0xe419('0xd7')]+=0x1;_0x3d1f0d[_0xe419('0xd8')]+=0x1;_0x118d57=this['voiceQueues'][_0x45c8b9[_0xe419('0xc8')]][_0xe419('0xd9')];_0x101277=this[_0xe419('0x1d')][_0x45c8b9[_0xe419('0xc8')]][_0xe419('0xda')];hopperUtils['verifyAdditionalPhones'](_0x3d1f0d,_0x3d1f0d[_0xe419('0x71')],_0x9d13cc[_0xe419('0xdb')])['then'](function(_0x5debe5){_0x4a3a14=_0x5debe5['additional']==0x1;if(_0x3d1f0d[_0xe419('0xd7')]>=_0x499ef3[_0xe419('0x1d')][_0x45c8b9[_0xe419('0xc8')]][_0xe419('0xdc')]){_0x499ef3['queueCallerAbandonCreateState'](_0x3d1f0d,_0x5debe5[_0xe419('0xdd')]);}else{hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x3d1f0d[_0xe419('0xd7')],'scheduledat':moment()[_0xe419('0xde')](_0x499ef3[_0xe419('0x1d')][_0x45c8b9['queue']]['dialDropRetryFrequency'],_0xe419('0xdf'))[_0xe419('0x44')](_0xe419('0xc7')),'ContactId':_0x9d13cc[_0xe419('0xe0')],'ListId':_0x9d13cc[_0xe419('0xe1')],'VoiceQueueId':_0x9d13cc[_0xe419('0xe2')]||undefined,'CampaignId':_0x9d13cc[_0xe419('0xe3')]||undefined})[_0xe419('0x9e')](loggerCatch(_0xe419('0xe4')));var _0x22eb5d=new History(_0x3d1f0d);_0x22eb5d[_0xe419('0x71')]=0xa;_0x22eb5d['statedesc']=_0xe419('0xe5');_0x22eb5d[_0xe419('0x74')]=moment()[_0xe419('0x44')](_0xe419('0xc7'));_0x22eb5d[_0xe419('0x73')]=_0x22eb5d[_0xe419('0x74')];_0x22eb5d[_0xe419('0xe6')]=_0x3d1f0d[_0xe419('0xe6')];_0x22eb5d[_0xe419('0xe7')]=_0x3d1f0d[_0xe419('0xe7')];hopperUtils[_0xe419('0xce')](_0x22eb5d)['catch'](loggerCatch(_0xe419('0xe8')));}})[_0xe419('0x3e')](function(){if(_0x4a3a14)hopperUtils[_0xe419('0xe9')](_0x3d1f0d,_0x118d57,_0x101277)[_0xe419('0x3e')](function(){return 0x1;});});}else{this['voiceQueues'][_0x45c8b9[_0xe419('0xc8')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0xe419('0x1d')][_0x45c8b9[_0xe419('0xc8')]][_0xe419('0xea')]+=0x1;_0x3d1f0d[_0xe419('0x71')]=0xb;_0x3d1f0d[_0xe419('0x72')]=_0xe419('0xeb');_0x3d1f0d['dropreason']=_0xe419('0xec');_0x3d1f0d[_0xe419('0xed')]+=0x1;_0x3d1f0d[_0xe419('0xd8')]+=0x1;_0x118d57=this[_0xe419('0x1d')][_0x45c8b9['queue']][_0xe419('0xee')];_0x101277=this[_0xe419('0x1d')][_0x45c8b9['queue']]['callAdditionalPhoneAfterMin'];hopperUtils[_0xe419('0xef')](_0x3d1f0d,_0x3d1f0d[_0xe419('0x71')],_0x9d13cc[_0xe419('0xdb')])[_0xe419('0x3e')](function(_0x3621e0){if(_0x3d1f0d['countabandonedretry']>=_0x499ef3[_0xe419('0x1d')][_0x45c8b9[_0xe419('0xc8')]][_0xe419('0xf0')]){_0x499ef3[_0xe419('0xf1')](_0x3d1f0d,_0x3621e0[_0xe419('0xdd')]);}else{hopperUtils[_0xe419('0xf2')]({'active':![],'countabandonedretry':_0x3d1f0d[_0xe419('0xed')],'scheduledat':moment()[_0xe419('0xde')](_0x499ef3[_0xe419('0x1d')][_0x45c8b9[_0xe419('0xc8')]][_0xe419('0xee')],_0xe419('0xdf'))[_0xe419('0x44')](_0xe419('0xc7')),'ContactId':_0x9d13cc[_0xe419('0xe0')],'ListId':_0x9d13cc[_0xe419('0xe1')],'VoiceQueueId':_0x9d13cc['VoiceQueueId']||undefined,'CampaignId':_0x9d13cc[_0xe419('0xe3')]||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));var _0x33fabd=new History(_0x3d1f0d);_0x33fabd['state']=0xb;_0x33fabd[_0xe419('0x72')]=_0xe419('0xeb');_0x33fabd[_0xe419('0x74')]=moment()[_0xe419('0x44')](_0xe419('0xc7'));_0x33fabd[_0xe419('0x73')]=_0x33fabd[_0xe419('0x74')];_0x33fabd['calleridname']=_0x3d1f0d[_0xe419('0xe6')];_0x33fabd['calleridnum']=_0x3d1f0d[_0xe419('0xe7')];hopperUtils[_0xe419('0xce')](_0x33fabd)['catch'](loggerCatch(_0xe419('0xf3')));}})[_0xe419('0x3e')](function(){if(_0x4a3a14)hopperUtils[_0xe419('0xe9')](_0x3d1f0d,_0x118d57,_0x101277)[_0xe419('0x3e')](function(){return 0x1;});});}}}};Dialer[_0xe419('0x18')][_0xe419('0x37')]=function(_0x4bbdbe){if(this[_0xe419('0x23')][_0x4bbdbe[_0xe419('0xc4')]]){this[_0xe419('0x23')][_0x4bbdbe['uniqueid']][_0xe419('0xf4')]=_0x4bbdbe['channel'];}if(this[_0xe419('0x25')][_0x4bbdbe[_0xe419('0xc4')]]){this[_0xe419('0x25')][_0x4bbdbe['uniqueid']][_0xe419('0xf4')]=_0x4bbdbe[_0xe419('0xf4')];}};Dialer[_0xe419('0x18')][_0xe419('0x3a')]=function(_0x39477e){if(!this['actions'][_0x39477e['actionid']]){return;}var _0x5c6e31=this[_0xe419('0x1d')][this[_0xe419('0x23')][_0x39477e[_0xe419('0xf5')]]['queue']][_0xe419('0xf6')]||_0xe419('0xf7');if(_0x5c6e31===_0xe419('0xf8')){if(this[_0xe419('0x23')][_0x39477e['actionid']]&&_[_0xe419('0xf9')](this[_0xe419('0x23')][_0x39477e['actionid']][_0xe419('0xfa')])&&_0x39477e[_0xe419('0x8a')]==='1'&&_0x39477e['paused']==='0'){if(this[_0xe419('0x1f')][_0x39477e[_0xe419('0xfb')]]){if(!this[_0xe419('0x1f')][_0x39477e[_0xe419('0xfb')]][_0xe419('0xfa')]){this[_0xe419('0x1f')][_0x39477e[_0xe419('0xfb')]][_0xe419('0xfa')]=!![];this[_0xe419('0x23')][_0x39477e[_0xe419('0xf5')]][_0xe419('0xfa')]=!![];this['actions'][_0x39477e['actionid']][_0xe419('0xfb')]=_0x39477e[_0xe419('0xfb')];}}}}else if(_0x5c6e31==='rrmemory'){if(this['actions'][_0x39477e[_0xe419('0xf5')]]){if(this['agents'][_0x39477e[_0xe419('0xfb')]]){this[_0xe419('0x23')][_0x39477e[_0xe419('0xf5')]][_0xe419('0xfb')]=_0x39477e[_0xe419('0xfb')];if(_[_0xe419('0xf9')](this[_0xe419('0x29')][this[_0xe419('0x23')][_0x39477e[_0xe419('0xf5')]][_0xe419('0xc8')]])){this[_0xe419('0x29')][this[_0xe419('0x23')][_0x39477e[_0xe419('0xf5')]][_0xe419('0xc8')]]=[];}this[_0xe419('0x29')][this['actions'][_0x39477e['actionid']][_0xe419('0xc8')]][_0xe419('0x9f')](_[_0xe419('0x60')](_['pick'](this['actions'][_0x39477e[_0xe419('0xf5')]],['idHopper',_0xe419('0xfb')]),{'status':_0x39477e[_0xe419('0x8a')],'paused':_0x39477e[_0xe419('0xfc')]}));}}}};Dialer[_0xe419('0x18')][_0xe419('0x3c')]=function(_0x1c1653){if(!this[_0xe419('0x23')][_0x1c1653['actionid']]){return;}var _0x29a9d8=this;var _0x6427b4=this['voiceQueues'][this[_0xe419('0x23')][_0x1c1653[_0xe419('0xf5')]][_0xe419('0xc8')]];var _0xdd783c=_0x6427b4['strategy']||_0xe419('0xf7');if(_0xdd783c===_0xe419('0xf8')){if(this['actions'][_0x1c1653['actionid']]&&this[_0xe419('0x23')][_0x1c1653['actionid']][_0xe419('0xfb')]){this['preview'][_0xe419('0xfd')](this[_0xe419('0x23')][_0x1c1653['actionid']][_0xe419('0xfe')],this[_0xe419('0x23')][_0x1c1653[_0xe419('0xf5')]][_0xe419('0xfb')])[_0xe419('0x9e')](function(_0x4740fa){logger[_0xe419('0x66')](_0xe419('0xff'),util['inspect'](_0x4740fa,{'showHidden':![],'depth':null}));})['finally'](function(){_0x29a9d8['updateOriginated'](_0x29a9d8[_0xe419('0x1d')][_0x29a9d8['actions'][_0x1c1653[_0xe419('0xf5')]][_0xe419('0xc8')]]);_0x29a9d8[_0xe419('0x1f')][_0x29a9d8[_0xe419('0x23')][_0x1c1653[_0xe419('0xf5')]]['stateinterface']][_0xe419('0xfa')]=![];delete _0x29a9d8['actions'][_0x1c1653[_0xe419('0xf5')]];unlockQueueStatus(_0x6427b4);});}else{this[_0xe419('0xc6')](this[_0xe419('0x1d')][this[_0xe419('0x23')][_0x1c1653[_0xe419('0xf5')]][_0xe419('0xc8')]]);hopperUtils[_0xe419('0xf2')]({'active':![],'ContactId':this['actions'][_0x1c1653[_0xe419('0xf5')]]['ContactId'],'ListId':this['actions'][_0x1c1653[_0xe419('0xf5')]]['ListId'],'VoiceQueueId':this['actions'][_0x1c1653[_0xe419('0xf5')]]['VoiceQueueId']||undefined,'CampaignId':this[_0xe419('0x23')][_0x1c1653['actionid']][_0xe419('0xe3')]||undefined})[_0xe419('0x9e')](loggerCatch(_0xe419('0x100')));delete this[_0xe419('0x23')][_0x1c1653[_0xe419('0xf5')]];unlockQueueStatus(_0x6427b4);}}else if(_0xdd783c===_0xe419('0xf7')){var _0x5dc36d;if(this[_0xe419('0x23')][_0x1c1653[_0xe419('0xf5')]]&&!_[_0xe419('0x47')](this[_0xe419('0x29')][this[_0xe419('0x23')][_0x1c1653[_0xe419('0xf5')]][_0xe419('0xc8')]])){if(this[_0xe419('0x2a')][_0x29a9d8['actions'][_0x1c1653[_0xe419('0xf5')]][_0xe419('0xc8')]]){this[_0xe419('0x2a')][_0x29a9d8[_0xe419('0x23')][_0x1c1653[_0xe419('0xf5')]][_0xe419('0xc8')]]=this['queueBookedRR'][this[_0xe419('0x23')][_0x1c1653[_0xe419('0xf5')]][_0xe419('0xc8')]]?this['queueBookedRR'][this[_0xe419('0x23')][_0x1c1653[_0xe419('0xf5')]]['queue']]:this[_0xe419('0x29')][this[_0xe419('0x23')][_0x1c1653[_0xe419('0xf5')]][_0xe419('0xc8')]]?this[_0xe419('0x29')][this[_0xe419('0x23')][_0x1c1653[_0xe419('0xf5')]][_0xe419('0xc8')]]['_rr']||0x0:0x0;}this[_0xe419('0x29')][this['actions'][_0x1c1653['actionid']]['queue']][_0xe419('0x101')]=this[_0xe419('0x2a')][this[_0xe419('0x23')][_0x1c1653['actionid']][_0xe419('0xc8')]];for(var _0x411e8a=0x0;_0x411e8a=_0x298729[_0xe419('0x126')]){_0x3877c7[_0xe419('0x127')](_0x2c6642,_0x5cbd33,_0x1c17b8,_0xe419('0x128'));}else{if(_0x2c6642['countmachineretry']>=_0x298729[_0xe419('0x129')]){_0x3877c7[_0xe419('0x12a')](_0x2c6642,_0x5cbd33,_0x1c17b8,'reason\x2019\x20machine....');}else{hopperUtils[_0xe419('0xf2')]({'active':![],'countmachineretry':_0x2c6642[_0xe419('0x12b')],'scheduledat':moment()[_0xe419('0xde')](_0x298729[_0xe419('0x12c')],_0xe419('0xdf'))[_0xe419('0x44')](_0xe419('0xc7')),'ContactId':_0x2c6642['ContactId'],'ListId':_0x2c6642[_0xe419('0xe1')],'VoiceQueueId':_0x2c6642['VoiceQueueId']||undefined,'CampaignId':_0x2c6642[_0xe419('0xe3')]||undefined})[_0xe419('0x9e')](loggerCatch(_0xe419('0x12d')));_0x5cbd33({'reschedule':0x1});}}});}if(_0x5ada35[_0xe419('0x40')]==='ivr'&&this[_0xe419('0x1e')][_0x5ada35['queue']][_0xe419('0x113')]&&_0x554d88['value']===_0xe419('0x115')){delete this[_0xe419('0x25')][_0x554d88['uniqueid']];this['updateOriginated'](this[_0xe419('0x1e')][_0x5ada35[_0xe419('0xc8')]]);_0x261ecd=new Hangup(_0x5ada35,_0x554d88);_0x261ecd[_0xe419('0x71')]=0x12;_0x261ecd['statedesc']=_0xe419('0x117');_0x261ecd[_0xe419('0x118')]='AMD';ami[_0xe419('0x119')](_0xe419('0x11a'),ut['buildObj'](_0x261ecd,_0xe419('0x11c')));this[_0xe419('0x11d')](_0x261ecd,_0xe419('0x12e'),_0xe419('0x12f'));}if(_0x5ada35[_0xe419('0x40')]===_0xe419('0xc5')&&this['campaigns'][_0x5ada35[_0xe419('0xc8')]][_0xe419('0x113')]&&_0x554d88[_0xe419('0x114')]===_0xe419('0x130')){return new Promise(function(_0x3208d3,_0x46ef57){delete _0x3877c7['uniqueId'][_0x554d88['uniqueid']];_0x3877c7[_0xe419('0xc6')](_0x3877c7[_0xe419('0x1e')][_0x5ada35['queue']]);_0x3877c7[_0xe419('0x1e')][_0x5ada35[_0xe419('0xc8')]][_0xe419('0xc9')]+=0x1;_0x3877c7[_0xe419('0x1e')][_0x5ada35[_0xe419('0xc8')]][_0xe419('0x116')]+=0x1;var _0x468557=_0x3877c7['campaigns'][_0x5ada35[_0xe419('0xc8')]];var _0x47397b=new Hangup(_0x5ada35,_0x554d88);_0x47397b['state']=0x13;_0x47397b['statedesc']='Machine';_0x47397b[_0xe419('0x118')]=_0xe419('0x131');_0x47397b[_0xe419('0x12b')]+=0x1;_0x47397b[_0xe419('0xd8')]+=0x1;_0x47397b[_0xe419('0x11c')]=!![];ami[_0xe419('0x119')](_0xe419('0x11a'),ut['buildObj'](_0x47397b,'amd'));hopperUtils[_0xe419('0xce')](_0x47397b)[_0xe419('0x9e')](loggerCatch(_0xe419('0x121')));if(_0x47397b[_0xe419('0x122')]+_0x47397b['countcongestionretry']+_0x47397b[_0xe419('0x124')]+_0x47397b[_0xe419('0x125')]+_0x47397b[_0xe419('0xd7')]+_0x47397b[_0xe419('0xed')]+_0x47397b[_0xe419('0x12b')]+_0x47397b[_0xe419('0x132')]>=_0x468557[_0xe419('0x126')]){_0x3877c7[_0xe419('0x127')](_0x47397b,_0x3208d3,_0x46ef57,'reason19\x20machine....');}else{if(_0x47397b[_0xe419('0x12b')]>=_0x468557[_0xe419('0x129')]){_0x3877c7[_0xe419('0x12a')](_0x47397b,_0x3208d3,_0x46ef57,_0xe419('0x133'));}else{hopperUtils[_0xe419('0xf2')]({'active':![],'countmachineretry':_0x47397b[_0xe419('0x12b')],'scheduledat':moment()[_0xe419('0xde')](_0x468557[_0xe419('0x12c')],_0xe419('0xdf'))[_0xe419('0x44')](_0xe419('0xc7')),'ContactId':_0x47397b[_0xe419('0xe0')],'ListId':_0x47397b[_0xe419('0xe1')],'VoiceQueueId':_0x47397b[_0xe419('0xe2')]||undefined,'CampaignId':_0x47397b['CampaignId']||undefined})[_0xe419('0x9e')](loggerCatch(_0xe419('0x12d')));_0x3208d3({'reschedule':0x1});}}});}}};Dialer[_0xe419('0x18')][_0xe419('0x36')]=function(_0x5daabe){var _0x540a56=this[_0xe419('0x25')][_0x5daabe[_0xe419('0xc4')]];var _0x143dae;if(_0x540a56&&_0x540a56[_0xe419('0x40')]===_0xe419('0xc5')){delete this[_0xe419('0x25')][_0x5daabe['uniqueid']];this['updateOriginated'](this['campaigns'][_0x540a56[_0xe419('0xc8')]]);this[_0xe419('0x1e')][_0x540a56[_0xe419('0xc8')]][_0xe419('0x134')]+=0x1;_0x143dae=new Hangup(_0x540a56,_0x5daabe);hopperUtils['createHistory'](_0x143dae)[_0xe419('0x9e')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils['moveContactManagedDialer'](_0x143dae)[_0xe419('0x9e')](loggerCatch(_0xe419('0x135')));}if(_0x540a56&&_0x540a56[_0xe419('0x40')]!==_0xe419('0xc5')&&isNotNull(this['voiceQueues'][_0x540a56[_0xe419('0xc8')]][_0xe419('0x136')])){delete this['uniqueId'][_0x5daabe[_0xe419('0xc4')]];this[_0xe419('0xc6')](this[_0xe419('0x1d')][_0x540a56[_0xe419('0xc8')]]);this[_0xe419('0x1d')][_0x540a56[_0xe419('0xc8')]][_0xe419('0xc9')]+=0x1;this[_0xe419('0x1d')][_0x540a56[_0xe419('0xc8')]]['outboundAnswerAgiCallsDay']+=0x1;_0x143dae=new Hangup(_0x540a56,_0x5daabe);_0x143dae['state']=0x10;_0x143dae[_0xe419('0x72')]=_0xe419('0x137');_0x143dae['membername']='AGI';hopperUtils[_0xe419('0xce')](_0x143dae)[_0xe419('0x9e')](loggerCatch(_0xe419('0x138')));hopperUtils[_0xe419('0x139')](_0x143dae)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0x540a56&&_0x540a56['type']!==_0xe419('0xc5')&&!isNotNull(this[_0xe419('0x1d')][_0x540a56[_0xe419('0xc8')]][_0xe419('0x136')])){if(_0x5daabe['cause-txt']===_0xe419('0x13a')){delete this[_0xe419('0x25')][_0x5daabe[_0xe419('0xc4')]];this[_0xe419('0x1d')][_0x540a56['queue']][_0xe419('0xc9')]+=0x1;const _0x5f3329=new AgentComplete(_0x540a56,_0x5daabe);_0x5f3329[_0xe419('0xe3')]=this[_0xe419('0x1d')][_0x540a56[_0xe419('0xc8')]]['id'];hopperUtils[_0xe419('0xce')](_0x5f3329)[_0xe419('0x9e')](loggerCatch(_0xe419('0xcf')));hopperUtils[_0xe419('0x139')](_0x5f3329)[_0xe419('0x9e')](loggerCatch(_0xe419('0xd0')));}else{delete this['uniqueId'][_0x5daabe[_0xe419('0xc4')]];this['updateOriginated'](this['voiceQueues'][_0x540a56[_0xe419('0xc8')]]);this[_0xe419('0x1d')][_0x540a56[_0xe419('0xc8')]][_0xe419('0x13b')]+=0x1;_0x143dae=new Hangup(_0x540a56,_0x5daabe);_0x143dae[_0xe419('0x71')]=0xc;_0x143dae[_0xe419('0x72')]=_0x5daabe[_0xe419('0x13c')];_0x143dae[_0xe419('0x118')]=_0xe419('0x13d');hopperUtils[_0xe419('0xce')](_0x143dae)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0xe419('0x139')](_0x143dae)['catch'](loggerCatch(_0xe419('0x135')));}}};Dialer[_0xe419('0x18')][_0xe419('0x33')]=function(_0x316647){var _0x1b7d45=this;if(!_0x1b7d45[_0xe419('0x13e')][_0x316647[_0xe419('0x46')]]){_0x1b7d45[_0xe419('0x13e')][_0x316647[_0xe419('0x46')]]={'running':![]};}else if(_0x1b7d45[_0xe419('0x13e')][_0x316647[_0xe419('0x46')]][_0xe419('0x13f')]===!![]){return;}else if(_0x1b7d45['queuesSummary'][_0x316647[_0xe419('0x46')]][_0xe419('0x13f')]===![]){_0x1b7d45[_0xe419('0x13e')][_0x316647[_0xe419('0x46')]][_0xe419('0x13f')]=!![];}var _0x7d5b0e=_0x1b7d45['voiceQueues'][_0x316647[_0xe419('0x46')]];var _0x4980e2=_0x7d5b0e['message']!==utils['CAMPAIGN_STATUS'][_0xe419('0x81')];var _0x586992=utils['isPreviewCampaign'](_0x7d5b0e);_0x7d5b0e['statusMessage']=utils['getQueueCampaignStatusMessage'](_0x7d5b0e,_0x1b7d45[_0xe419('0x20')]);Promise[_0xe419('0xae')]()[_0xe419('0x3e')](function(){if(_0x7d5b0e[_0xe419('0x140')]===utils[_0xe419('0x6c')]['INACTIVE']){if(_0x4980e2){clearPredictiveAttributes(_0x7d5b0e);_0x316647[_0xe419('0x27')]=undefined;_0x316647[_0xe419('0x62')]=undefined;}if(_0x7d5b0e[_0xe419('0x140')]===utils[_0xe419('0x6c')][_0xe419('0x81')]){_0x316647[_0xe419('0x141')]=0x0;_0x316647[_0xe419('0xfc')]=0x0;_0x316647['inUse']=0x0;_0x316647[_0xe419('0x142')]=0x0;_0x316647[_0xe419('0x143')]=0x0;}}else if(_0x7d5b0e['statusMessage']===utils[_0xe419('0x6c')]['ACTIVE']&&!_0x586992){return _0x1b7d45[_0xe419('0x96')](_0x7d5b0e,!![])[_0xe419('0x3e')](function(){return _0x1b7d45[_0xe419('0x96')](_0x7d5b0e,![]);})[_0xe419('0x3e')](function(){return _0x1b7d45[_0xe419('0xb5')](_0x7d5b0e);})[_0xe419('0x9e')](function(_0x24dcff){loggerSyncQueueSummary['debug'](_0xe419('0x144'),util[_0xe419('0x43')](_0x24dcff,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x7d5b0e);});}else{clearPredictiveAttributes(_0x7d5b0e);}})[_0xe419('0x3e')](function(){var _0x1f1c6f=_0x316647[_0xe419('0x145')](_0x7d5b0e);if(_0x1f1c6f||_0x7d5b0e[_0xe419('0x146')]){_0x7d5b0e[_0xe419('0x146')]=![];_0x316647[_0xe419('0x147')](_0x7d5b0e);Object['assign'](_0x7d5b0e,_0x316647);emitOutboundVoiceQueueSummary(_0x316647);}_0x1b7d45[_0xe419('0x13e')][_0x7d5b0e[_0xe419('0x46')]][_0xe419('0x13f')]=![];})['catch'](function(_0x54de13){logger[_0xe419('0x66')](_0xe419('0x144'),util['inspect'](_0x54de13,{'showHidden':![],'depth':null}));_0x1b7d45[_0xe419('0x13e')][_0x7d5b0e[_0xe419('0x46')]][_0xe419('0x13f')]=![];});};Dialer[_0xe419('0x18')][_0xe419('0x34')]=_[_0xe419('0x148')](function(){var _0x4abcdc=_[_0xe419('0x149')](this[_0xe419('0x1d')],function(_0x1b9d20){return _0x1b9d20[_0xe419('0x14a')];});var _0x3ed203=_[_0xe419('0x149')](this[_0xe419('0x1f')],function(_0x42a649){return _0x42a649[_0xe419('0x14b')]&&_0x42a649[_0xe419('0x8a')]===_0xe419('0x8b');});if(_0x4abcdc[_0xe419('0x9b')]>0x0&&_0x3ed203[_0xe419('0x9b')]>0x0){return Promise[_0xe419('0xae')]()[_0xe419('0x3e')](cmHopper[_0xe419('0x14c')](_[_0xe419('0x14d')](_0x4abcdc,'id'),previewRecallmeReminderInterval,_[_0xe419('0x14d')](_0x3ed203,'id')))[_0xe419('0x3e')](function(_0x36a3e8){for(var _0xe7424=0x0;_0xe7424<_0x36a3e8['length'];_0xe7424++){var _0x3d006c=_0x36a3e8[_0xe7424][_0xe419('0x14e')]['name'];if(_0x3d006c)io['to'](util['format']('user:%s',_0x3d006c))[_0xe419('0x119')](_0xe419('0x14f'),{'hopper':_0x36a3e8[_0xe7424]});}})['catch'](function(_0x204e6a){logger[_0xe419('0x66')]('checkPreviewRecallReminder',_0x204e6a);});}},0x3c*0x3e8,{'leading':!![]});Dialer['prototype'][_0xe419('0x3d')]=function(){var _0x59cb03=this;setInterval(function(){_0x59cb03['clearZombieChannels'](_0x59cb03['uniqueId'],_0xe419('0x150'));_0x59cb03[_0xe419('0x151')](_0x59cb03[_0xe419('0x23')],_0xe419('0x152'));},0x32c8);};Dialer[_0xe419('0x18')]['clearZombieChannels']=function(_0x3894eb,_0x319f36){var _0x222d9c=this;for(var _0x1bcd7d in _0x3894eb){if(typeof _0x3894eb[_0x1bcd7d]!==_0xe419('0xad')){this[_0xe419('0x1b')][_0xe419('0x153')](function(){if(!_[_0xe419('0xf9')](_0x3894eb[_0x1bcd7d])){return ami[_0xe419('0xa0')]({'action':_0xe419('0x8a'),'channel':_0x3894eb[_0x1bcd7d][_0xe419('0xf4')]})[_0xe419('0x9e')](function(_0x17bf9c){if(_0x17bf9c['message']===_0xe419('0x154')){setTimeout(function(){if(_0x3894eb[_0x1bcd7d]&&_0x3894eb[_0x1bcd7d][_0xe419('0x40')]!==_0xe419('0xc5')){_0x222d9c[_0xe419('0xc6')](_0x222d9c[_0xe419('0x1d')][_0x3894eb[_0x1bcd7d]['queue']]);logger[_0xe419('0x66')](_0xe419('0x155'),_0x319f36,_0x1bcd7d,_0x3894eb[_0x1bcd7d][_0xe419('0xc8')]);delete _0x3894eb[_0x1bcd7d];}if(_0x3894eb[_0x1bcd7d]&&_0x3894eb[_0x1bcd7d][_0xe419('0x40')]===_0xe419('0xc5')){_0x222d9c[_0xe419('0xc6')](_0x222d9c[_0xe419('0x1e')][_0x3894eb[_0x1bcd7d][_0xe419('0xc8')]]);logger[_0xe419('0x66')](_0xe419('0x156'),_0x319f36,_0x1bcd7d,_0x3894eb[_0x1bcd7d][_0xe419('0xc8')]);delete _0x3894eb[_0x1bcd7d];}},0x2328);}});}});}}};Dialer['prototype'][_0xe419('0x157')]=function(_0x369682){return Promise[_0xe419('0xae')]()[_0xe419('0x3e')](voiceQueueRt[_0xe419('0x157')](_0x369682))[_0xe419('0x9e')](loggerCatch(_0xe419('0x158')));};Dialer[_0xe419('0x18')][_0xe419('0xc6')]=function(_0x1bbd2b){if(!_[_0xe419('0x53')](_0x1bbd2b)&&_0x1bbd2b!==null){if(typeof _0x1bbd2b['originated']!=='undefined'){if(_0x1bbd2b[_0xe419('0x80')]>0x0){_0x1bbd2b[_0xe419('0x80')]-=0x1;}else{logger['error'](_0xe419('0x159'));}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0xe419('0x18')][_0xe419('0x15a')]=function(_0x4da6ab,_0x14290c){var _0xb975fb=this;return function(_0x181792){_0xb975fb[_0xe419('0xc6')](_0x14290c);logger[_0xe419('0x66')](_0x4da6ab,util[_0xe419('0x43')](_0x181792,{'showHidden':![],'depth':null}));};};Dialer[_0xe419('0x18')]['emptyContact']=function(_0x4f3885,_0x5d7055,_0x2580d2){var _0x244960={'state':0x19,'statedesc':'notFound'};this[_0xe419('0xc6')](_0x5d7055);this['saveInDb'](_[_0xe419('0x60')](_0x244960,_[_0xe419('0x105')](_0x2580d2,[_0xe419('0xe0'),'ListId',_0xe419('0x15b'),'VoiceQueueId',_0xe419('0xe3')])),_0xe419('0x15c'),_0xe419('0x15d'));logger[_0xe419('0x66')](_0x4f3885);};Dialer[_0xe419('0x18')][_0xe419('0x11d')]=function(_0x550403,_0x27f892,_0x5ca843){hopperUtils[_0xe419('0xce')](_0x550403)['catch'](loggerCatch(_0x27f892));hopperUtils[_0xe419('0x139')](_0x550403)[_0xe419('0x9e')](loggerCatch(_0x5ca843));};Dialer[_0xe419('0x18')][_0xe419('0xf1')]=function(_0x1c93ef,_0x29d5bd){hopperUtils[_0xe419('0xce')](_0x1c93ef)[_0xe419('0x9e')](loggerCatch(_0xe419('0xcf')));if(_0x29d5bd==0x0){hopperUtils[_0xe419('0x139')](_0x1c93ef)[_0xe419('0x9e')](loggerCatch(_0xe419('0x15e')));}};Dialer[_0xe419('0x18')][_0xe419('0x15f')]=function(_0x44aa77){return Promise['resolve']()[_0xe419('0x3e')](cmHopper[_0xe419('0x14c')](_0x44aa77['id'],previewRecallmeReminderInterval))[_0xe419('0x3e')](function(_0x27c7aa){for(var _0x7f89da=0x0;_0x7f89da<_0x27c7aa[_0xe419('0x9b')];_0x7f89da++){var _0x37fd9b=_0x27c7aa[_0x7f89da][_0xe419('0x14e')][_0xe419('0x46')];if(_0x37fd9b)io['to'](util['format'](_0xe419('0x160'),_0x37fd9b))['emit'](_0xe419('0x14f'),{'hopper':_0x27c7aa[_0x7f89da]});}})[_0xe419('0x9e')](function(){});};Dialer[_0xe419('0x18')][_0xe419('0xb3')]=function(_0x57f74a){var _0x42de27=this;return function(){_0x42de27[_0xe419('0x161')](_0x57f74a);};};Dialer[_0xe419('0x18')][_0xe419('0x162')]=function(_0x5d71e3,_0x41c035){var _0x2e4299=this;var _0x9f268f=uuid['v4']();this[_0xe419('0x23')][_0x9f268f]=new Action(_0x5d71e3,_0x41c035,_0x9f268f);return new Promise(function(_0x30f7d1,_0xe2d73d){if(_[_0xe419('0x53')](_0x5d71e3)&&typeof _0x5d71e3!==_0xe419('0x163')){return _0xe2d73d(msgResponse('originate',_0xe419('0x93'),_0xe419('0x164')));}if(_[_0xe419('0x53')](_0x41c035[_0xe419('0x165')])||_0x41c035[_0xe419('0x165')]===null){return _0xe2d73d(msgResponse(_0xe419('0x166'),_0xe419('0x93'),_0xe419('0x167')));}var _0x592785={'XMD-CALLERID':_0x2e4299['actions'][_0x9f268f][_0xe419('0x168')](),'XMD-AGI':_0x5d71e3['dialQueueProject']?util[_0xe419('0x44')](_0xe419('0x169'),ipAgi,_0x5d71e3[_0xe419('0x136')]):'NONE','XMD-AGIAFTER':_0x5d71e3[_0xe419('0xd6')]?util[_0xe419('0x44')]('\x22agi://%s/square,%s\x22',ipAgi,_0x5d71e3[_0xe419('0xd6')]):_0xe419('0x16a'),'XMD-QUEUE':utils['isOutboundQueue'](_0x5d71e3)?util['format'](_0xe419('0x16b'),_0x5d71e3[_0xe419('0x46')],_0x5d71e3[_0xe419('0x16c')]||'',_0x5d71e3['dialAgiAfterHangupAgent']?'c':'',_0x5d71e3[_0xe419('0xd3')]||0x3):_0xe419('0x16a'),'XMD-CONTACTID':_0x41c035[_0xe419('0xe0')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x2e4299[_0xe419('0x23')][_0x9f268f][_0xe419('0x168')](),'XMD-AMD':_0x5d71e3['dialAMDActive']?'ACTIVE':_0xe419('0x16a'),'XMD-DESTINATION':_0xe419('0x16d')};if(_0x5d71e3['dialAMDActive']){_0x592785[_0xe419('0x16e')]=_0x5d71e3[_0xe419('0x16f')]||0x9c4;_0x592785[_0xe419('0x170')]=_0x5d71e3[_0xe419('0x171')]||0x5dc;_0x592785[_0xe419('0x172')]=_0x5d71e3[_0xe419('0x173')]||0x320;_0x592785[_0xe419('0x174')]=_0x5d71e3['dialAMDTotalAnalysisTime']||0x1388;_0x592785['XMD-AMDMINWORDLENGTH']=_0x5d71e3[_0xe419('0x175')]||0x64;_0x592785['XMD-AMDBETWEENWORDSSILENCE']=_0x5d71e3[_0xe419('0x176')]||0x32;_0x592785['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x5d71e3[_0xe419('0x177')]||0x3;_0x592785[_0xe419('0x178')]=_0x5d71e3[_0xe419('0x179')]||0x100;_0x592785['XMD-AMDMAXIMUMWORDLENGTH']=_0x5d71e3['dialAMDMaximumWordLength']||0x1388;}if(utils[_0xe419('0x17a')](_0x5d71e3)){_0x592785['XMD-VOICEQUEUEID']=_0x41c035[_0xe419('0xe2')];}else{_0x592785[_0xe419('0x17b')]=_0x41c035[_0xe419('0xe3')];}var _0x4efa9d=utils[_0xe419('0x17c')](_0x41c035[_0xe419('0x17d')]);Object['assign'](_0x592785,_0x4efa9d);var _0x2546a2=_0x2e4299[_0xe419('0x87')](_0x5d71e3[_0xe419('0x8d')])?utils[_0xe419('0x17e')](_0x5d71e3[_0xe419('0x8d')][_0xe419('0x17f')],_0x5d71e3['dialOriginateCallerIdName'],_0x5d71e3[_0xe419('0x180')]>0x0?utils['getCallerIdRandom'](_0x5d71e3['dialOriginateCallerIdNumber'],_0x5d71e3['dialRandomLastDigitCallerIdNumber']):_0x5d71e3[_0xe419('0x181')]):utils[_0xe419('0x17e')](_[_0xe419('0xf9')](_0x5d71e3[_0xe419('0x8e')])?_0x5d71e3['Trunk'][_0xe419('0x17f')]:_0x5d71e3['TrunkBackup'][_0xe419('0x17f')],_0x5d71e3[_0xe419('0x182')],_0x5d71e3[_0xe419('0x180')]>0x0?utils[_0xe419('0x183')](_0x5d71e3[_0xe419('0x181')],_0x5d71e3[_0xe419('0x180')]):_0x5d71e3['dialOriginateCallerIdNumber']);if(_0x2546a2){_0x592785[_0xe419('0x184')]=_0x2e4299[_0xe419('0x23')][_0x9f268f][_0xe419('0x185')]=utils[_0xe419('0x186')](_0x2546a2);_0x592785[_0xe419('0x187')]=_0x41c035[_0xe419('0x165')];}_0x5d71e3[_0xe419('0x188')]=_0x592785;return ami[_0xe419('0xa0')]({'actionid':_0x9f268f,'action':_0xe419('0x166'),'channel':_0x2e4299[_0xe419('0x87')](_0x5d71e3[_0xe419('0x8d')])?util[_0xe419('0x44')](_0xe419('0x189'),_0x5d71e3['Trunk'][_0xe419('0x46')],isNotNull(_0x5d71e3[_0xe419('0x18a')])?_0x5d71e3['dialPrefix'][_0xe419('0x18b')]()||'':'',_0x5d71e3[_0xe419('0x18c')]>0x0?_0x41c035[_0xe419('0x165')][_0xe419('0x18d')](_0x5d71e3[_0xe419('0x18c')]):_0x41c035['phone']):util['format'](_0xe419('0x189'),_['isNil'](_0x5d71e3[_0xe419('0x8e')])?_0x5d71e3[_0xe419('0x8d')][_0xe419('0x46')]:_0x5d71e3['TrunkBackup'][_0xe419('0x46')],isNotNull(_0x5d71e3['dialPrefix'])?_0x5d71e3[_0xe419('0x18a')][_0xe419('0x18b')]()||'':'',_0x5d71e3[_0xe419('0x18c')]>0x0?_0x41c035['phone']['substring'](_0x5d71e3[_0xe419('0x18c')]):_0x41c035[_0xe419('0x165')]),'callerid':_0x2546a2,'Exten':_0xe419('0x16d'),'Context':_0xe419('0x18e'),'Priority':'1','variable':_0x592785,'timeout':(_0x5d71e3[_0xe419('0x18f')]||0x1e)*0x3e8,'async':!![],'channelid':_0x9f268f})[_0xe419('0x3e')](function(_0x5c9de0){return _0x30f7d1(_0x5c9de0);})['catch'](function(_0x195c66){_0x5d71e3[_0xe419('0x190')]+=0x1;var _0x3d12b4=new History(_0x2e4299[_0xe419('0x23')][_0x9f268f]);logger['error'](util[_0xe419('0x44')]('[originateError]:\x20%s',JSON['stringify'](_0x195c66)));_0x3d12b4[_0xe419('0x71')]=0xe;_0x3d12b4[_0xe419('0x72')]=_0xe419('0x191');_0x3d12b4[_0xe419('0x74')]=moment()[_0xe419('0x44')]('YYYY-MM-DD\x20HH:mm:ss');_0x3d12b4[_0xe419('0x73')]=_0x3d12b4[_0xe419('0x74')];hopperUtils['createHistory'](_0x3d12b4)['catch'](loggerCatch('[originate][error]'));_0x2e4299['moveContactManagedDialer'](_0x3d12b4)[_0xe419('0x9e')](loggerCatch('[originate][error]'))[_0xe419('0x1a')](function(){delete _0x2e4299[_0xe419('0x23')][_0x9f268f];return _0xe2d73d(msgResponse(_0xe419('0x166'),_0xe419('0x86'),_0xe419('0x192')));});});});};Dialer['prototype'][_0xe419('0x193')]=function(_0x5c957f,_0x60e286,_0x293532){var _0x30588b=new History(_0x60e286);if(_0x30588b[_0xe419('0x122')]+_0x30588b[_0xe419('0x123')]+_0x30588b[_0xe419('0x124')]+_0x30588b['countnosuchnumberretry']+_0x30588b[_0xe419('0xd7')]+_0x30588b['countabandonedretry']+_0x30588b['countmachineretry']+_0x30588b['countagentrejectretry']>=_0x293532[_0xe419('0x126')]-0x1){return!![];}switch(_0x5c957f){case 0x3:if(_0x30588b['countnoanswerretry']>=_0x293532[_0xe419('0x194')]-0x1){return!![];}hopperUtils[_0xe419('0xf2')]({'active':![],'countnoanswerretry':_0x30588b['countnoanswerretry']+=0x1,'scheduledat':moment()[_0xe419('0xde')](_0x293532[_0xe419('0x195')],_0xe419('0xdf'))[_0xe419('0x44')](_0xe419('0xc7')),'ContactId':_0x30588b[_0xe419('0xe0')],'ListId':_0x30588b[_0xe419('0xe1')],'VoiceQueueId':_0x30588b[_0xe419('0xe2')]||undefined,'CampaignId':_0x30588b[_0xe419('0xe3')]||undefined})[_0xe419('0x9e')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x30588b['countbusyretry']>=_0x293532[_0xe419('0x196')]-0x1){return!![];}hopperUtils[_0xe419('0xf2')]({'active':![],'countbusyretry':_0x30588b[_0xe419('0x122')]+=0x1,'scheduledat':moment()['add'](_0x293532['dialBusyRetryFrequency'],_0xe419('0xdf'))[_0xe419('0x44')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x30588b['ContactId'],'ListId':_0x30588b[_0xe419('0xe1')],'VoiceQueueId':_0x30588b[_0xe419('0xe2')]||undefined,'CampaignId':_0x30588b[_0xe419('0xe3')]||undefined})[_0xe419('0x9e')](loggerCatch(_0xe419('0x197')));break;case 0x8:if(_0x30588b[_0xe419('0x123')]>=_0x293532[_0xe419('0x198')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countcongestionretry':_0x30588b[_0xe419('0x123')]+=0x1,'scheduledat':moment()[_0xe419('0xde')](_0x293532['dialCongestionRetryFrequency'],_0xe419('0xdf'))[_0xe419('0x44')](_0xe419('0xc7')),'ContactId':_0x30588b[_0xe419('0xe0')],'ListId':_0x30588b['ListId'],'VoiceQueueId':_0x30588b[_0xe419('0xe2')]||undefined,'CampaignId':_0x30588b[_0xe419('0xe3')]||undefined})[_0xe419('0x9e')](loggerCatch(_0xe419('0x199')));break;case 0x0:if(_0x30588b[_0xe419('0x125')]>=_0x293532[_0xe419('0x19a')]-0x1){return!![];}else{hopperUtils['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x30588b[_0xe419('0x125')]+=0x1,'scheduledat':moment()[_0xe419('0xde')](_0x293532[_0xe419('0x19b')],_0xe419('0xdf'))[_0xe419('0x44')](_0xe419('0xc7')),'ContactId':_0x30588b['ContactId'],'ListId':_0x30588b[_0xe419('0xe1')],'VoiceQueueId':_0x30588b[_0xe419('0xe2')]||undefined,'CampaignId':_0x30588b[_0xe419('0xe3')]||undefined})[_0xe419('0x9e')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x30588b[_0xe419('0xd7')]>=_0x293532[_0xe419('0xdc')]-0x1){return!![];}hopperUtils[_0xe419('0xf2')]({'active':![],'countdropretry':_0x30588b[_0xe419('0xd7')]+=0x1,'scheduledat':moment()[_0xe419('0xde')](_0x293532[_0xe419('0xd9')],_0xe419('0xdf'))[_0xe419('0x44')](_0xe419('0xc7')),'ContactId':_0x30588b[_0xe419('0xe0')],'ListId':_0x30588b[_0xe419('0xe1')],'VoiceQueueId':_0x30588b[_0xe419('0xe2')]||undefined,'CampaignId':_0x30588b[_0xe419('0xe3')]||undefined})[_0xe419('0x9e')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x30588b[_0xe419('0xed')]>=_0x293532['dialAbandonedMaxRetry']-0x1){return!![];}hopperUtils[_0xe419('0xf2')]({'active':![],'countabandonedretry':_0x30588b['countabandonedretry']+=0x1,'scheduledat':moment()[_0xe419('0xde')](_0x293532[_0xe419('0xee')],_0xe419('0xdf'))[_0xe419('0x44')](_0xe419('0xc7')),'ContactId':_0x30588b[_0xe419('0xe0')],'ListId':_0x30588b['ListId'],'VoiceQueueId':_0x30588b['VoiceQueueId']||undefined,'CampaignId':_0x30588b[_0xe419('0xe3')]||undefined})[_0xe419('0x9e')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x30588b[_0xe419('0x12b')]>=_0x293532['dialMachineMaxRetry']-0x1){return!![];}hopperUtils[_0xe419('0xf2')]({'active':![],'countmachineretry':_0x30588b[_0xe419('0x12b')]+=0x1,'scheduledat':moment()[_0xe419('0xde')](_0x293532[_0xe419('0x12c')],_0xe419('0xdf'))[_0xe419('0x44')](_0xe419('0xc7')),'ContactId':_0x30588b[_0xe419('0xe0')],'ListId':_0x30588b[_0xe419('0xe1')],'VoiceQueueId':_0x30588b[_0xe419('0xe2')]||undefined,'CampaignId':_0x30588b[_0xe419('0xe3')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x30588b['countagentrejectretry']>=_0x293532['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils[_0xe419('0xf2')]({'active':![],'countagentrejectretry':_0x30588b[_0xe419('0x132')]+=0x1,'scheduledat':moment()[_0xe419('0xde')](_0x293532[_0xe419('0x19c')],_0xe419('0xdf'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x30588b['ContactId'],'ListId':_0x30588b['ListId'],'VoiceQueueId':_0x30588b['VoiceQueueId']||undefined,'CampaignId':_0x30588b[_0xe419('0xe3')]||undefined})[_0xe419('0x9e')](loggerCatch(_0xe419('0x19d')));break;default:return!![];}};Dialer['prototype'][_0xe419('0x10e')]=function(_0x15503f,_0x2b8542,_0x1a8656){var _0x587573=this;var _0x5d5167=new History(_0x15503f);var _0x34289b=![];var _0x1e0111;var _0x3c2701;return new Promise(function(_0x1fdc43,_0x5e7352){if(_[_0xe419('0x53')](_0x2b8542)&&typeof _0x2b8542!==_0xe419('0x163')){return _0x5e7352(msgResponse('[callProgressDetecting]',_0xe419('0x93'),_0xe419('0x19e')));}if(_[_0xe419('0x53')](_0x1a8656)&&typeof _0x1a8656!==_0xe419('0x163')){return _0x5e7352(msgResponse(_0xe419('0x19f'),_0xe419('0x93'),'evt\x20is\x20undefine'));}hopperUtils['verifyAdditionalPhones'](_0x5d5167,_0x1a8656[_0xe419('0xca')],_0x2b8542)[_0xe419('0x3e')](function(_0x274fab){if(_0x274fab['additional']==0x1)_0x34289b=!![];switch(_0x1a8656[_0xe419('0xca')]){case'0':_0x2b8542['outboundNoSuchCallsDay']+=0x1;_0x5d5167['state']=0x0;_0x5d5167[_0xe419('0x72')]='NoSuchNumber';_0x5d5167[_0xe419('0x125')]+=0x1;_0x5d5167[_0xe419('0xd8')]+=0x1;ami[_0xe419('0x119')]('custom:agentnosuchnumber',ut[_0xe419('0x11b')](_0x15503f,_0xe419('0x1a0')));_0x1e0111=_0x2b8542[_0xe419('0x19b')];_0x3c2701=_0x2b8542[_0xe419('0xda')];hopperUtils[_0xe419('0xce')](_0x5d5167)[_0xe419('0x9e')](loggerCatch(_0xe419('0x121')));if(_0x587573[_0xe419('0x193')](0x0,_0x15503f,_0x2b8542)&&!_0x34289b){if(_0x5d5167[_0xe419('0x125')]>=_0x2b8542['dialNoSuchNumberMaxRetry']){_0x587573[_0xe419('0x12a')](_0x5d5167,_0x1fdc43,_0x5e7352,_0xe419('0x1a1'));}else{_0x587573[_0xe419('0x127')](_0x5d5167,_0x1fdc43,_0x5e7352,_0xe419('0x1a1'));}}break;case'3':_0x2b8542[_0xe419('0x1a2')]+=0x1;_0x5d5167[_0xe419('0x71')]=0x3;_0x5d5167[_0xe419('0x72')]=_0xe419('0x1a3');_0x5d5167[_0xe419('0x124')]+=0x1;_0x5d5167[_0xe419('0xd8')]+=0x1;var _0x93b6ae=ut[_0xe419('0x1a4')](_0x15503f,_0x2b8542);ami[_0xe419('0x119')](_0xe419('0x1a5'),_0x93b6ae);_0x1e0111=_0x2b8542[_0xe419('0x195')];_0x3c2701=_0x2b8542['callAdditionalPhoneAfterMin'];hopperUtils[_0xe419('0xce')](_0x5d5167)['catch'](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x587573[_0xe419('0x193')](0x3,_0x15503f,_0x2b8542)&&!_0x34289b){if(_0x5d5167[_0xe419('0x124')]>=_0x2b8542[_0xe419('0x194')]){_0x587573[_0xe419('0x12a')](_0x5d5167,_0x1fdc43,_0x5e7352,_0xe419('0x1a6'));}else{_0x587573[_0xe419('0x127')](_0x5d5167,_0x1fdc43,_0x5e7352,_0xe419('0x1a6'));}}break;case'5':_0x2b8542[_0xe419('0x1a7')]+=0x1;_0x5d5167[_0xe419('0x71')]=0x5;_0x5d5167[_0xe419('0x72')]=_0xe419('0x1a8');_0x5d5167[_0xe419('0x122')]+=0x1;_0x5d5167[_0xe419('0xd8')]+=0x1;ami[_0xe419('0x119')](_0xe419('0x1a9'),ut[_0xe419('0x11b')](_0x15503f,_0xe419('0x1aa')));_0x1e0111=_0x2b8542[_0xe419('0x1ab')];_0x3c2701=_0x2b8542['callAdditionalPhoneAfterMin'];hopperUtils[_0xe419('0xce')](_0x5d5167)[_0xe419('0x9e')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x587573[_0xe419('0x193')](0x5,_0x15503f,_0x2b8542)&&!_0x34289b){if(_0x5d5167[_0xe419('0x122')]>=_0x2b8542[_0xe419('0x196')]){_0x587573['createStateFinal'](_0x5d5167,_0x1fdc43,_0x5e7352,_0xe419('0x1ac'));}else{_0x587573['stateGlobal'](_0x5d5167,_0x1fdc43,_0x5e7352,_0xe419('0x1ac'));}}break;case'8':_0x2b8542[_0xe419('0x1ad')]+=0x1;_0x5d5167[_0xe419('0x71')]=0x8;_0x5d5167[_0xe419('0x72')]=_0xe419('0x1ae');_0x5d5167[_0xe419('0x123')]+=0x1;_0x5d5167[_0xe419('0xd8')]+=0x1;_0x1e0111=_0x2b8542[_0xe419('0x1af')];_0x3c2701=_0x2b8542[_0xe419('0xda')];ami[_0xe419('0x119')](_0xe419('0x1b0'),ut[_0xe419('0x11b')](_0x15503f,_0xe419('0x1b1')));hopperUtils[_0xe419('0xce')](_0x5d5167)['catch'](loggerCatch(_0xe419('0x1b2')));if(_0x587573[_0xe419('0x193')](0x8,_0x15503f,_0x2b8542)&&!_0x34289b){if(_0x5d5167['countcongestionretry']>=_0x2b8542[_0xe419('0x198')]){_0x587573[_0xe419('0x12a')](_0x5d5167,_0x1fdc43,_0x5e7352,_0xe419('0x1b3'));}else{_0x587573[_0xe419('0x127')](_0x5d5167,_0x1fdc43,_0x5e7352,_0xe419('0x1b3'));}}break;case'11':_0x2b8542[_0xe419('0x1b4')]+=0x1;_0x5d5167[_0xe419('0x71')]=0xb;_0x5d5167[_0xe419('0x72')]=_0xe419('0xeb');_0x5d5167[_0xe419('0xed')]+=0x1;_0x5d5167['countglobal']+=0x1;_0x1e0111=_0x2b8542['dialAbandonedRetryFrequency'];_0x3c2701=_0x2b8542[_0xe419('0xda')];hopperUtils[_0xe419('0xce')](_0x5d5167)[_0xe419('0x9e')](loggerCatch(_0xe419('0xf3')));if(_0x587573['checkRetriveMax'](0xb,_0x15503f,_0x2b8542)&&!_0x34289b){if(_0x5d5167['countabandonedretry']>=_0x2b8542[_0xe419('0xf0')]){_0x587573[_0xe419('0x12a')](_0x5d5167,_0x1fdc43,_0x5e7352,'reason\x2011\x20abandoned');}else{_0x587573[_0xe419('0x127')](_0x5d5167,_0x1fdc43,_0x5e7352,_0xe419('0x1b5'));}}break;case'20':_0x2b8542[_0xe419('0x1b6')]+=0x1;_0x5d5167[_0xe419('0x71')]=0x14;_0x5d5167[_0xe419('0x72')]=_0xe419('0x1b7');_0x5d5167[_0xe419('0x132')]+=0x1;_0x5d5167[_0xe419('0xd8')]+=0x1;_0x1e0111=_0x2b8542['dialAgentRejectRetryFrequency'];_0x3c2701=_0x2b8542[_0xe419('0xda')];ami[_0xe419('0x119')](_0xe419('0x1b8'),ut[_0xe419('0x11b')](_0x15503f,'agentreject'));hopperUtils[_0xe419('0xce')](_0x5d5167)[_0xe419('0x9e')](loggerCatch(_0xe419('0x1b9')));if(_0x587573['checkRetriveMax'](0x14,_0x15503f,_0x2b8542)&&!_0x34289b){if(_0x5d5167[_0xe419('0x132')]>=_0x2b8542[_0xe419('0x1ba')]){_0x587573[_0xe419('0x12a')](_0x5d5167,_0x1fdc43,_0x5e7352,_0xe419('0x1bb'));}else{_0x587573['stateGlobal'](_0x5d5167,_0x1fdc43,_0x5e7352,'reason\x2020\x20agentreject');}}break;default:_0x2b8542[_0xe419('0x13b')]+=0x1;_0x5d5167[_0xe419('0x71')]=0xc;_0x5d5167[_0xe419('0x72')]=_0x1a8656[_0xe419('0xca')];_0x1e0111=_0x2b8542[_0xe419('0x19c')];_0x3c2701=_0x2b8542[_0xe419('0xda')];hopperUtils[_0xe419('0xce')](_0x5d5167)['catch'](loggerCatch(_0xe419('0x1bc')));if(_0x587573[_0xe419('0x193')](_0x1a8656['reason'],_0x15503f,_0x2b8542)&&!_0x34289b){if(_0x5d5167[_0xe419('0x122')]+_0x5d5167['countcongestionretry']+_0x5d5167['countnoanswerretry']+_0x5d5167[_0xe419('0x125')]+_0x5d5167[_0xe419('0xd7')]+_0x5d5167['countabandonedretry']+_0x5d5167[_0xe419('0x12b')]+_0x5d5167[_0xe419('0x132')]>=_0x2b8542['dialGlobalMaxRetry']){_0x587573['stateGlobal'](_0x5d5167,_0x1fdc43,_0x5e7352,_0x1a8656['reason']);}else{_0x587573[_0xe419('0x12a')](_0x5d5167,_0x1fdc43,_0x5e7352,_0x1a8656['reason']);}}}})[_0xe419('0x3e')](function(){if(_0x34289b){hopperUtils[_0xe419('0xe9')](_0x5d5167,_0x1e0111,_0x3c2701)[_0xe419('0x3e')](function(){return _0x1fdc43(0x1);});}});});};Dialer[_0xe419('0x18')][_0xe419('0x127')]=function(_0x45d3d9,_0x56868d,_0x3d2635,_0x3251f7){var _0x3b18b8=new Final(_0x45d3d9);_0x3b18b8['state']=0xf;_0x3b18b8[_0xe419('0x72')]=_0xe419('0x1bd');this[_0xe419('0x12a')](_0x3b18b8,_0x56868d,_0x3d2635,_0x3251f7);};Dialer[_0xe419('0x18')]['createStateFinal']=function(_0x20dd78,_0x5e3cb4,_0x232f40,_0x335020){hopperUtils[_0xe419('0x139')](_0x20dd78)[_0xe419('0x3e')](function(){return _0x5e3cb4(msgResponse('[callProgressDetecting]',_0xe419('0x10d'),_0x335020));})['catch'](function(){return _0x232f40(msgResponse(_0xe419('0x1be'),_0xe419('0x93'),_0xe419('0x1bf')));});};Dialer[_0xe419('0x18')][_0xe419('0xa')]=function(_0x55004c){var _0x2e94dd=_0x55004c[_0xe419('0x1c0')]/0x64;var _0x13e669=_0x55004c[_0xe419('0xd4')]/(_0x55004c['outboundDropCallsDayTimeout']+_0x55004c[_0xe419('0xc9')]);var _0x24b29a=Math['round'](_0x55004c['predictiveIntervalAvailable']*(_0x55004c[_0xe419('0x1c1')]/0x64));var _0x1e4934=Math[_0xe419('0x1c2')](_0x55004c[_0xe419('0x1c3')]*(_0x55004c[_0xe419('0x1c4')]/0x64));var _0x31fe9b=_0x55004c['available']+_0x55004c['talking'];var _0x2a9d3a=Math[_0xe419('0x1c5')](_0x55004c[_0xe419('0x59')]*_0x55004c['erlangAbandonmentRate']*_0x55004c[_0xe419('0x1c6')]*_0x55004c['predictiveIntervalMultiplicativeFactor']);if(_[_0xe419('0x53')](_0x55004c[_0xe419('0x62')])){if(!_[_0xe419('0x53')](_0x55004c[_0xe419('0x27')])){_0x55004c['startPredictive']=undefined;loggerPredictive[_0xe419('0x66')](_0xe419('0x1c7'),_0xe419('0x1c8'));}if(!_[_0xe419('0x53')](_0x55004c[_0xe419('0x65')])){loggerPredictive[_0xe419('0x66')](_0xe419('0x1c7'),_0xe419('0x1c9'));clearInterval(_0x55004c[_0xe419('0x65')]);_0x55004c['handlePredictive']=undefined;}_0x55004c['startProgressive']=moment()[_0xe419('0x44')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x55004c[_0xe419('0x46')],'collection\x20data\x20in\x20progressive\x20at',_0x55004c[_0xe419('0x62')]);this[_0xe419('0xb8')](_0x55004c,0x1);}else if(ifInterval(_0x55004c[_0xe419('0x1ca')],_0x55004c[_0xe419('0x62')])){this[_0xe419('0xb8')](_0x55004c,0x1);loggerPredictiveCalls[_0xe419('0x49')](_0xe419('0x1cb'),_0x55004c[_0xe419('0x62')],_0x55004c[_0xe419('0x46')]);_0x55004c[_0xe419('0x59')]=0x0;_0x55004c[_0xe419('0x1cc')]=0x0;}else if(_0x2e94dd<_0x13e669&&_0x55004c[_0xe419('0x1cd')]==='dropRate'){clearPredictiveAttributes(_0x55004c);loggerPredictive['info'](_0xe419('0x1ce'),'Dropped\x20calls\x20day',_0x13e669,_0xe419('0x62'),_0x55004c[_0xe419('0x46')]);}else if(_0x2a9d3a<_0x55004c[_0xe419('0x1cc')]&&_0x55004c['dialPredictiveOptimization']===_0xe419('0x1cf')){clearPredictiveAttributes(_0x55004c);loggerPredictive[_0xe419('0x49')](_0xe419('0x1d0'),_0xe419('0x1d1'),_0x2a9d3a,'Drop\x20in\x20this\x20interval',_0x55004c[_0xe419('0x1cc')],_0xe419('0x62'),_0x55004c[_0xe419('0x46')]);}else if(!ifInterval(_0x55004c[_0xe419('0x1ca')],_0x55004c[_0xe419('0x62')])&&_[_0xe419('0x53')](_0x55004c[_0xe419('0x27')])&&!_[_0xe419('0x53')](_0x55004c[_0xe419('0x62')])){_0x55004c[_0xe419('0x27')]=moment()[_0xe419('0x44')](_0xe419('0xc7'));loggerPredictive[_0xe419('0x49')](_0x55004c[_0xe419('0x46')],_0xe419('0x1d2'),_0x55004c[_0xe419('0x27')]);hopperUtils['avgHandleTime'](_0x55004c[_0xe419('0x1ca')])[_0xe419('0x3e')](this[_0xe419('0x1d3')](_0x55004c))['then'](mergeDataErlangB(_0x55004c))[_0xe419('0x3e')](this[_0xe419('0x1d4')](_0x55004c))[_0xe419('0x9e')](loggerCatchPredictive(_0xe419('0x1d5'),_0x55004c));}else if(!ifInterval(_0x55004c[_0xe419('0x1ca')],_0x55004c['startPredictive'])){_0x55004c[_0xe419('0x1cc')]=0x0;_0x55004c[_0xe419('0x27')]=moment()[_0xe419('0x44')](_0xe419('0xc7'));loggerPredictive[_0xe419('0x49')](_0x55004c[_0xe419('0x46')],'recalculate\x20predictive\x20at',_0x55004c[_0xe419('0x27')]);clearInterval(_0x55004c[_0xe419('0x65')]);_0x55004c[_0xe419('0x65')]=undefined;hopperUtils['avgHandleTime'](_0x55004c[_0xe419('0x1ca')])[_0xe419('0x3e')](this[_0xe419('0x1d3')](_0x55004c))['then'](mergeDataErlangB(_0x55004c))[_0xe419('0x3e')](this[_0xe419('0x1d4')](_0x55004c))[_0xe419('0x9e')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x55004c));}else if(_0x55004c['predictiveIntervalAvailable']&&_0x31fe9b<_0x55004c['predictiveIntervalAvailable']-_0x1e4934){clearPredictiveAttributes(_0x55004c);loggerPredictive[_0xe419('0x49')](_0x55004c[_0xe419('0x46')],_0xe419('0x1d6'),_0x31fe9b,_0xe419('0x1d7'),_0x55004c[_0xe419('0x1c3')],'-',_0x1e4934,'=',_0x55004c[_0xe419('0x1c3')]-_0x1e4934,')');}else if(_0x55004c[_0xe419('0x1c3')]&&_0x31fe9b>_0x55004c[_0xe419('0x1c3')]+_0x24b29a){clearPredictiveAttributes(_0x55004c);loggerPredictive[_0xe419('0x49')](_0x55004c[_0xe419('0x46')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x31fe9b,')\x20are\x20more\x20than\x20threshold\x20(',_0x55004c[_0xe419('0x1c3')],'+',_0x24b29a,'=',_0x55004c[_0xe419('0x1c3')]+_0x24b29a,')');}};Dialer[_0xe419('0x18')][_0xe419('0x1d3')]=function(_0x5ba49f){var _0x134702=this;return function(_0x31d85f){return new Promise(function(_0x3b0fb6,_0x1e6a79){_['merge'](_0x5ba49f,_0x31d85f[0x0]);if(checkGetDataPredictive(_0x31d85f[0x0])){var _0x31ded5=_0x5ba49f[_0xe419('0x1c3')]=_0x5ba49f[_0xe419('0x142')]+_0x5ba49f['available'];var _0x2a3b53=_0x5ba49f['dialPredictiveInterval']*0x3c;var _0xc87834=_0x31d85f[0x0][_0xe419('0x54')]+_0x31d85f[0x0]['predictiveIntervalAvgHoldtime'];var _0x49f2af=(_0x31d85f[0x0][_0xe419('0x4c')]+_0x31d85f[0x0][_0xe419('0x4e')]+_0x31d85f[0x0][_0xe419('0x4f')])/_0x31d85f[0x0][_0xe419('0x4b')];_0x5ba49f[_0xe419('0x1c6')]=_0x49f2af>0x0?_0x49f2af:0x1;switch(_0x5ba49f['dialPredictiveOptimization']){case _0xe419('0x1cf'):var _0x3b4126=_0x5ba49f[_0xe419('0x1c0')]/0x64;return _0x134702[_0xe419('0x1d8')](_0x31ded5,_0x2a3b53,_0xc87834,_0x49f2af,_0x3b4126)[_0xe419('0x3e')](function(_0x4d166b){return _0x3b0fb6(_0x4d166b);});case _0xe419('0x1d9'):var _0x1d00bb=_0x5ba49f[_0xe419('0x1c0')]/0x64;return _0x134702[_0xe419('0x1da')](_0x31ded5,_0x2a3b53,_0xc87834,_0x49f2af,_0x1d00bb)[_0xe419('0x3e')](function(_0xdd0c6f){return _0x3b0fb6(_0xdd0c6f);});default:return _0x1e6a79(msgResponse(_0xe419('0x1db'),'Failure',_0xe419('0x1dc')));}}else{return _0x1e6a79(msgResponse(_0xe419('0x1db'),'Failure',_0xe419('0x1dd')));}});};};Dialer[_0xe419('0x18')][_0xe419('0x1de')]=function(_0x4f3aba){var _0x5520c1=this;return function(_0x1abf4c){return new Promise(function(_0x32357c,_0x4ffb54){_['merge'](_0x4f3aba,_0x1abf4c[0x0]);if(checkGetDataPredictive(_0x1abf4c[0x0])){loggerPredictive[_0xe419('0x49')](JSON[_0xe419('0x77')](_0x1abf4c[0x0]));if(_0x4f3aba[_0xe419('0x1cd')]===_0xe419('0x1cf')){return _0x5520c1[_0xe419('0x157')](_0x4f3aba['id'])['then'](function(_0x11c598){var _0x637cbb=_0x4f3aba[_0xe419('0x1df')]-_0x11c598[0x0]['outboundQueuePauses'];var _0xa5530c=_0x4f3aba[_0xe419('0x1ca')]*0x3c;var _0x438d04=_0x1abf4c[0x0][_0xe419('0x54')]+_0x1abf4c[0x0]['predictiveIntervalAvgHoldtime'];var _0x12f676=(_0x1abf4c[0x0]['predictiveIntervalAnsweredCalls']+_0x1abf4c[0x0][_0xe419('0x4e')]+_0x1abf4c[0x0][_0xe419('0x4f')])/_0x1abf4c[0x0][_0xe419('0x4b')];var _0x591461=_0x4f3aba[_0xe419('0x1c0')]/0x64;_0x4f3aba[_0xe419('0x1e0')]=_0x11c598[0x0][_0xe419('0x1e1')]||0x0;_0x4f3aba[_0xe419('0x1c6')]=_0x12f676>0x0?_0x12f676:0x1;return _0x5520c1['abandonmentRate'](_0x637cbb,_0xa5530c,_0x438d04,_0x12f676,_0x591461);})[_0xe419('0x3e')](function(_0x2a6fea){return _0x32357c(_0x2a6fea);})['catch'](function(_0x119909){return _0x4ffb54(msgResponse(_0xe419('0x1e2'),_0xe419('0x93'),JSON[_0xe419('0x77')](_0x119909)));});}if(_0x4f3aba[_0xe419('0x1cd')]===_0xe419('0x1d9')){return _0x5520c1['getVoiceQueueRtPauses'](_0x4f3aba['id'])[_0xe419('0x3e')](function(_0x26ce61){var _0x5b1227=_0x4f3aba[_0xe419('0x1df')]-_0x26ce61[0x0][_0xe419('0x1e1')];var _0x38b9a9=_0x4f3aba[_0xe419('0x1ca')]*0x3c;var _0x5ecd4d=_0x1abf4c[0x0][_0xe419('0x54')]+_0x1abf4c[0x0][_0xe419('0x50')];var _0x21a80f=(_0x1abf4c[0x0]['predictiveIntervalAnsweredCalls']+_0x1abf4c[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x1abf4c[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x1abf4c[0x0][_0xe419('0x4b')];var _0x3e191c=_0x4f3aba[_0xe419('0x1c0')]/0x64;_0x4f3aba['predictiveIntervalPauses']=_0x26ce61[0x0]['outboundQueuePauses']||0x0;_0x4f3aba['predictiveIntervalHitRate']=_0x21a80f>0x0?_0x21a80f:0x1;return _0x5520c1[_0xe419('0x1da')](_0x5b1227,_0x38b9a9,_0x5ecd4d,_0x21a80f,_0x3e191c);})[_0xe419('0x3e')](function(_0x218512){return _0x32357c(_0x218512);})['catch'](function(_0x538cbc){return _0x4ffb54(msgResponse('[CatchErlangB]',_0xe419('0x93'),JSON[_0xe419('0x77')](_0x538cbc)));});}}else{return _0x4ffb54(msgResponse(_0xe419('0x1db'),_0xe419('0x93'),_0xe419('0x1dd')));}});};};Dialer['prototype'][_0xe419('0x1d4')]=function(_0x2a28b1){var _0x4b2362=this;return function(){var _0x5378dd=0x0;var _0x25c363=Math[_0xe419('0x1c5')](_0x2a28b1['erlangCallToSecond']*0x3e8);if(_0x25c363>0x0){_0x25c363=_0x25c363<0x64?0x64:_0x25c363;loggerPredictive['info'](_0x2a28b1[_0xe419('0x46')],_0xe419('0x1e3'),_0x25c363,_0xe419('0x1e4'));_0x2a28b1['handlePredictive']=setInterval(function(){_0x4b2362[_0xe419('0x65')](_0x2a28b1);loggerPredictiveCalls['info'](_0xe419('0x1e5'),_0x5378dd+=0x1);},_0x25c363);}else{loggerPredictive['info'](_0x2a28b1[_0xe419('0x46')],_0xe419('0x1e6'));}};};Dialer[_0xe419('0x18')][_0xe419('0x1e7')]=function(_0x4bb1ce,_0x1f8e4f){var _0x3b6f16=this;return function(_0x3cf573){if(_[_0xe419('0x47')](_0x3cf573)){if(_[_0xe419('0xf9')](_0x1f8e4f[_0xe419('0x15b')])||!_0x1f8e4f[_0xe419('0x1e8')]){if(_0x4bb1ce[_0xe419('0xb6')]===_0xe419('0xbb')){_0x4bb1ce[_0xe419('0x75')]=_['isUndefined'](_0x4bb1ce[_0xe419('0x75')])?!![]:_0x4bb1ce['queueStatusComplete'];var _0x1a116a=uuid['v4']();_0x3b6f16['actions'][_0x1a116a]=new Action(_0x4bb1ce,_0x1f8e4f,_0x1a116a);loggerBooked[_0xe419('0x49')](_0xe419('0x1e9'),_0x1a116a,_0xe419('0x1ea'),JSON[_0xe419('0x77')](_0x4bb1ce[_0xe419('0x75')]),_0xe419('0x1eb'),_0x4bb1ce['name']);if(_0x4bb1ce[_0xe419('0x75')]){_0x4bb1ce[_0xe419('0x75')]=![];_0x3b6f16['queueBooked'][_0x3b6f16[_0xe419('0x23')][_0x1a116a][_0xe419('0xc8')]]=[];ami[_0xe419('0xa0')]({'actionid':_0x1a116a,'action':'queuestatus','queue':_0x4bb1ce[_0xe419('0x46')]})['catch'](function(){_0x3b6f16[_0xe419('0xc6')](_0x4bb1ce);hopperUtils[_0xe419('0xf2')]({'active':![],'ContactId':_0x3b6f16['actions'][_0x1a116a][_0xe419('0xe0')],'ListId':_0x3b6f16[_0xe419('0x23')][_0x1a116a]['ListId'],'VoiceQueueId':_0x3b6f16[_0xe419('0x23')][_0x1a116a][_0xe419('0xe2')]||undefined,'CampaignId':_0x3b6f16[_0xe419('0x23')][_0x1a116a]['CampaignId']||undefined})[_0xe419('0x9e')](loggerCatch(_0xe419('0x1ec')));delete _0x3b6f16[_0xe419('0x23')][_0x1a116a];});}else{loggerBooked['info']('[booked][checkContactBlack][else]',JSON[_0xe419('0x77')](_0x4bb1ce[_0xe419('0x75')]),'Queue:\x20',_0x4bb1ce[_0xe419('0x46')]);_0x3b6f16[_0xe419('0xc6')](_0x4bb1ce);hopperUtils[_0xe419('0xf2')]({'active':![],'ContactId':_0x3b6f16[_0xe419('0x23')][_0x1a116a][_0xe419('0xe0')],'ListId':_0x3b6f16['actions'][_0x1a116a][_0xe419('0xe1')],'VoiceQueueId':_0x3b6f16[_0xe419('0x23')][_0x1a116a][_0xe419('0xe2')]||undefined,'CampaignId':_0x3b6f16[_0xe419('0x23')][_0x1a116a][_0xe419('0xe3')]||undefined})['catch'](loggerCatch(_0xe419('0x1ec')));delete _0x3b6f16[_0xe419('0x23')][_0x1a116a];}}else{return _0x3b6f16[_0xe419('0x162')](_0x4bb1ce,_0x1f8e4f);}}else{if(utils[_0xe419('0x61')](undefined,_0x1f8e4f[_0xe419('0x1ed')])<_0x4bb1ce[_0xe419('0x1ee')]*0x3c){if(_0x1f8e4f[_0xe419('0x14e')]&&!_0x1f8e4f[_0xe419('0x14e')][_0xe419('0x1ef')]){_0x3b6f16[_0xe419('0x1c')][_0xe419('0xfd')](_0x1f8e4f['id'])[_0xe419('0x1a')](function(){_0x3b6f16[_0xe419('0xc6')](_0x4bb1ce);});}else{hopperUtils[_0xe419('0x1f0')]({'active':![]},_0x1f8e4f['id'],0x1)[_0xe419('0x1a')](function(){_0x3b6f16[_0xe419('0xc6')](_0x4bb1ce);});}}else{_0x4bb1ce[_0xe419('0x1f1')]+=0x1;_0x3b6f16['updateOriginated'](_0x4bb1ce);if(_0x4bb1ce['dialRecallInQueue']){hopperUtils[_0xe419('0xf2')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x1f8e4f[_0xe419('0xe0')],'ListId':_0x1f8e4f[_0xe419('0xe1')],'VoiceQueueId':_0x1f8e4f['VoiceQueueId']||undefined,'CampaignId':_0x1f8e4f[_0xe419('0xe3')]||undefined})[_0xe419('0x9e')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));hopperUtils[_0xe419('0xce')](createObjHistory(_0x4bb1ce,_0x1f8e4f,utils['CAMPAIGN_STATUS']['QUEUE_RECALL'],0x17,_0xe419('0x1f2')))['catch'](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x3b6f16['saveInDb'](createObjHistory(_0x4bb1ce,_0x1f8e4f,utils[_0xe419('0x6c')][_0xe419('0x1f3')],0x16,_0xe419('0x1f4')),'[Originate][HistoryRecallClose][historyCatch]',_0xe419('0x1f5'));}}}}else{_0x4bb1ce['outboundBlacklistCallsDay']+=0x1;_0x3b6f16[_0xe419('0x11d')](createObjHistory(_0x4bb1ce,_0x1f8e4f,utils[_0xe419('0x6c')]['BLACKLIST'],0xd,_0xe419('0x1f6')),'[Originate][historyBlacklist]',_0xe419('0x1f7'));throw _0xe419('0x1f8');}};};Dialer[_0xe419('0x18')][_0xe419('0x161')]=function(_0xfeb9d9){var _0x3d0cfc=this;var _0x4ecc75=_0xfeb9d9['limitCalls']-_0xfeb9d9[_0xe419('0x80')];emitCampaignSummary(_0xfeb9d9);if(_0x4ecc75>0x0&&_0xfeb9d9['temp']==0x0){if(_0x4ecc75>this[_0xe419('0x21')]){_0x4ecc75=this['maxNumberOriginate'];}_0xfeb9d9[_0xe419('0x69')]=0x1;hopperUtils[_0xe419('0x1f9')](_0xfeb9d9,_0x4ecc75)[_0xe419('0x3e')](function(_0x44f3ed){_0xfeb9d9['temp']=0x0;if(_0x44f3ed){if(!utils['checkContactEmpty'](_0x44f3ed)){_0xfeb9d9[_0xe419('0x6b')]=utils['CAMPAIGN_STATUS'][_0xe419('0x1fa')];logger[_0xe419('0x49')](_0xe419('0x1fb')+_0xfeb9d9[_0xe419('0x46')]);}else{_0xfeb9d9[_0xe419('0x80')]+=_0x44f3ed[_0xe419('0x9b')];_0xfeb9d9['message']=utils[_0xe419('0x6c')][_0xe419('0x1fc')];for(var _0x32cd32=0x0;_0x32cd32<_0x44f3ed['length'];_0x32cd32+=0x1){_0xfeb9d9[_0xe419('0x1fd')]+=0x1;if(_['isNil'](_0x44f3ed[_0x32cd32])||_['isNil'](_0x44f3ed[_0x32cd32]['Contact'])||_[_0xe419('0xf9')](_0x44f3ed[_0x32cd32]['phone'])){_0x3d0cfc['emptyContact'](_0xe419('0x1fe'),_0xfeb9d9,_0x44f3ed[_0x32cd32]);}else{hopperUtils[_0xe419('0x1ff')](_[_0xe419('0x105')](_0x44f3ed[_0x32cd32],[_0xe419('0xe3'),_0xe419('0x165')]))[_0xe419('0x3e')](_0x3d0cfc[_0xe419('0x1e7')](_0xfeb9d9,_0x44f3ed[_0x32cd32]))[_0xe419('0x9e')](_0x3d0cfc['loggerHandler'](_0xe419('0x200'),_0xfeb9d9));}}}}})['catch'](loggerGetContactDialer(_0xe419('0x201'),_0xfeb9d9,_0x4ecc75));}};Dialer[_0xe419('0x18')][_0xe419('0xb8')]=function(_0x277f51,_0x234137){var _0x5c63d4=this;var _0x31127f=[];if(_0x234137<0x1||_0x277f51[_0xe419('0xb6')]===_0xe419('0xbb')){_0x234137=0x1;}var _0x5b07df=Math[_0xe419('0x1c5')](_0x277f51[_0xe419('0x141')]*_0x234137)-_0x277f51['originated'];if(_0x277f51['dialLimitQueue']>0x0){var _0x102388=_0x277f51[_0xe419('0x202')]-_0x277f51['originated']-_0x277f51['talking']-_0x277f51['pTalking'];if(_0x5b07df>_0x102388){_0x5b07df=_0x102388;}}if(_0x5b07df>0x0&&_0x277f51[_0xe419('0x69')]==0x0){if(_0x277f51['dialMethod']===_0xe419('0xbb')){_0x5b07df=0x1;}if(_0x5b07df>this[_0xe419('0x21')]){_0x5b07df=this['maxNumberOriginate'];}for(var _0x320ad9 in this['agents']){if(typeof this[_0xe419('0x1f')][_0x320ad9]!==_0xe419('0xad')){if(this[_0xe419('0x1f')][_0x320ad9][_0xe419('0x71')]==='not_inuse'&&this[_0xe419('0x1f')][_0x320ad9]['status']===_0xe419('0x8b')){_0x31127f[_0xe419('0x9f')](this['agents'][_0x320ad9]['id']);}}}_0x277f51[_0xe419('0x69')]=0x1;hopperUtils[_0xe419('0x203')](_0x277f51,_0x31127f,_0x5b07df)[_0xe419('0x3e')](function(_0x4a61a1){_0x277f51['temp']=0x0;if(_0x4a61a1){if(!utils[_0xe419('0x204')](_0x4a61a1)){hopperUtils[_0xe419('0x205')](_0x277f51)[_0xe419('0x3e')](sendMessageReschedule(_0x277f51))[_0xe419('0x9e')](loggerCatch('[countReScheduled]\x20'));}else{_0x277f51[_0xe419('0x80')]+=_0x4a61a1['length'];_0x277f51[_0xe419('0x6b')]=_0x277f51[_0xe419('0xb6')]===_0xe419('0xbb')?utils[_0xe419('0x6c')][_0xe419('0x206')]:utils[_0xe419('0x6c')]['RUNNING'];for(var _0x4e0927=0x0;_0x4e0927<_0x4a61a1[_0xe419('0x9b')];_0x4e0927+=0x1){if(_['isNil'](_0x4a61a1[_0x4e0927])||_[_0xe419('0xf9')](_0x4a61a1[_0x4e0927][_0xe419('0x17d')])||_[_0xe419('0xf9')](_0x4a61a1[_0x4e0927][_0xe419('0x165')])){_0x5c63d4[_0xe419('0x207')](_0xe419('0x1fe'),_0x277f51,_0x4a61a1[_0x4e0927]);}else{hopperUtils[_0xe419('0x208')](_[_0xe419('0x105')](_0x4a61a1[_0x4e0927],[_0xe419('0xe2'),_0xe419('0x165')]))[_0xe419('0x3e')](_0x5c63d4['checkContactBlack'](_0x277f51,_0x4a61a1[_0x4e0927]))[_0xe419('0x9e')](_0x5c63d4[_0xe419('0x15a')](_0xe419('0x1fe'),_0x277f51));}}}}})['catch'](loggerGetContactDialer(_0xe419('0x209'),_0x277f51,_0x5b07df));}};Dialer[_0xe419('0x18')]['handlePredictive']=function(_0x54ecd4){if(_0x54ecd4['dialLimitQueue']>0x0){var _0x3650cb=_0x54ecd4[_0xe419('0x202')]-_0x54ecd4[_0xe419('0x80')]-_0x54ecd4[_0xe419('0x142')];if(_0x3650cb>0x0&&_0x54ecd4[_0xe419('0x69')]==0x0){this[_0xe419('0x20a')](_0x54ecd4);}else{loggerPredictiveCalls['info'](_0xe419('0x20b'));}}else{this['tryOriginatePredictive'](_0x54ecd4);}};Dialer[_0xe419('0x18')][_0xe419('0x20a')]=function(_0x4e9b39){var _0x478c14=this;var _0x4f5b4e=[];_0x4e9b39['originated']+=0x1;for(var _0x4f0a4 in this['agents']){if(typeof this[_0xe419('0x1f')][_0x4f0a4]!==_0xe419('0xad')){if(this[_0xe419('0x1f')][_0x4f0a4]['state']===_0xe419('0x20c')&&this[_0xe419('0x1f')][_0x4f0a4][_0xe419('0x8a')]===_0xe419('0x8b')){_0x4f5b4e['push'](this['agents'][_0x4f0a4]['id']);}}}_0x4e9b39[_0xe419('0x69')]=0x1;return this[_0xe419('0x203')](_0x4e9b39['id'],_0x4f5b4e,0x1,_0x4e9b39[_0xe419('0x20d')],_0x4e9b39)[_0xe419('0x3e')](function(_0x1b45b4){_0x4e9b39[_0xe419('0x69')]=0x1;if(_0x1b45b4){if(!utils['checkContactEmpty'](_0x1b45b4)){utils[_0xe419('0x68')](_0x4e9b39,0x1,0x0);return hopperUtils[_0xe419('0x205')](_0x4e9b39)[_0xe419('0x3e')](sendMessageReschedule(_0x4e9b39))[_0xe419('0x9e')](loggerCatch(_0xe419('0x20e')));}else{_0x4e9b39[_0xe419('0x6b')]=utils[_0xe419('0x6c')][_0xe419('0x1fc')];if(_[_0xe419('0xf9')](_0x1b45b4[0x0])||_[_0xe419('0xf9')](_0x1b45b4[0x0]['Contact'])||_[_0xe419('0xf9')](_0x1b45b4[0x0]['phone'])){_0x478c14[_0xe419('0x207')](_0xe419('0x1fe'),_0x4e9b39,_0x1b45b4[0x0]);}else{return hopperUtils[_0xe419('0x208')](_[_0xe419('0x105')](_0x1b45b4[0x0],[_0xe419('0xe2'),_0xe419('0x165')]))['then'](_0x478c14[_0xe419('0x1e7')](_0x4e9b39,_0x1b45b4[0x0]))[_0xe419('0x9e')](_0x478c14[_0xe419('0x15a')](_0xe419('0x20f'),_0x4e9b39));}}}})[_0xe419('0x9e')](loggerGetContactDialer('[getContactDialerPredictive]',_0x4e9b39,0x1));};Dialer['prototype'][_0xe419('0x1d8')]=function(_0xcb7685,_0x3354c9,_0x358ae1,_0x37523b,_0x52b780,_0x3ce0fa){loggerPredictive[_0xe419('0x49')](_0xe419('0x210'));loggerPredictive[_0xe419('0x49')](_0xe419('0x211'),_0xcb7685);loggerPredictive[_0xe419('0x49')](_0xe419('0x212'),_0x3354c9);loggerPredictive[_0xe419('0x49')](_0xe419('0x213'),_0x358ae1);loggerPredictive[_0xe419('0x49')]('P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x37523b);loggerPredictive[_0xe419('0x49')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x52b780);loggerPredictive[_0xe419('0x49')](_0xe419('0x52'));return new Promise(function(_0x2d7f2f,_0x5e0e73){if(_0xcb7685<=0x0||isNaN(_0xcb7685)){return _0x5e0e73(msgResponse(_0xe419('0x214'),_0xe419('0x86'),'m\x20=\x20'+_0xcb7685));}if(_0x358ae1<=0x0||isNaN(_0x358ae1)){return _0x5e0e73(msgResponse('[abandonmentRate]',_0xe419('0x86'),_0xe419('0x215')+_0x358ae1));}if(_0x37523b<=0x0||isNaN(_0x37523b)){return _0x5e0e73(msgResponse(_0xe419('0x214'),'Error',_0xe419('0x216')+_0x37523b));}if(_0x3354c9<=0x0||isNaN(_0x3354c9)){return _0x5e0e73(msgResponse(_0xe419('0x214'),_0xe419('0x86'),_0xe419('0x217')+_0x3354c9));}if(_0x52b780<=0x0||isNaN(_0x52b780)){return _0x5e0e73(msgResponse(_0xe419('0x214'),_0xe419('0x86'),_0xe419('0x218')+_0x52b780));}_0x3ce0fa=_0x3ce0fa||0x0;var _0x29628b=0x1/_0x358ae1;var _0x19ef82=0x0;var _0x584120=0x0;var _0x252905=0x0;var _0x503f54=0x0;for(var _0x1dec29=0x0;_0x252905<_0x52b780;_0x1dec29+=0x1){_0x584120=_0x1dec29/_0x3354c9;_0x19ef82=(_0x37523b*_0x584120+_0x3ce0fa)/_0x29628b;_0x252905=utils[_0xe419('0x219')](_0x19ef82,_0xcb7685);_0x503f54=_0x19ef82/_0xcb7685*(0x1-utils[_0xe419('0x219')](_0x19ef82,_0xcb7685));}return _0x2d7f2f({'erlangCalls':_0x1dec29,'erlangCallToSecond':_0x3354c9/_0x1dec29,'erlangAbandonmentRate':_0x252905,'erlangBusyFactor':_0x503f54});});};Dialer[_0xe419('0x18')]['busyFactor']=function(_0x2601fd,_0x4d8626,_0x36058e,_0x5d81bb,_0x2b5c96,_0x26922d){loggerPredictive['info'](_0xe419('0x21a'));loggerPredictive['info'](_0xe419('0x211'),_0x2601fd);loggerPredictive[_0xe419('0x49')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4d8626);loggerPredictive[_0xe419('0x49')](_0xe419('0x213'),_0x36058e);loggerPredictive[_0xe419('0x49')](_0xe419('0x21b'),_0x5d81bb);loggerPredictive[_0xe419('0x49')](_0xe419('0x21c'),_0x2b5c96);loggerPredictive[_0xe419('0x49')]('---------------------------');return new Promise(function(_0x391423,_0x5aba1d){if(_0x2601fd<=0x0||isNaN(_0x2601fd)){return _0x5aba1d(msgResponse('[busyFactor]','Error',_0xe419('0x21d')+_0x2601fd));}if(_0x36058e<=0x0||isNaN(_0x36058e)){return _0x5aba1d(msgResponse(_0xe419('0x21e'),_0xe419('0x86'),_0xe419('0x215')+_0x36058e));}if(_0x5d81bb<=0x0||isNaN(_0x5d81bb)){return _0x5aba1d(msgResponse(_0xe419('0x21e'),_0xe419('0x86'),_0xe419('0x216')+_0x5d81bb));}if(_0x4d8626<=0x0||isNaN(_0x4d8626)){return _0x5aba1d(msgResponse(_0xe419('0x21e'),_0xe419('0x86'),_0xe419('0x217')+_0x4d8626));}if(_0x2b5c96<=0x0||isNaN(_0x2b5c96)){return _0x5aba1d(msgResponse(_0xe419('0x21e'),_0xe419('0x86'),_0xe419('0x21f')+_0x2b5c96));}_0x26922d=_0x26922d||0x0;var _0x2370c8=0x1/_0x36058e;var _0x278b32=0x0;var _0x2f6411=0x0;var _0x283106=0x0;var _0x304f7a=0x0;for(var _0x115518=0x0;_0x304f7a<_0x2b5c96;_0x115518+=0x1){_0x2f6411=_0x115518/_0x4d8626;_0x278b32=(_0x5d81bb*_0x2f6411+_0x26922d)/_0x2370c8;_0x283106=utils['erlangb'](_0x278b32,_0x2601fd);_0x304f7a=_0x278b32/_0x2601fd*(0x1-utils[_0xe419('0x219')](_0x278b32,_0x2601fd));}return _0x391423({'erlangCalls':_0x115518,'erlangCallToSecond':_0x4d8626/_0x115518,'erlangAbandonmentRate':_0x283106,'erlangBusyFactor':_0x304f7a});});};module[_0xe419('0x220')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/models/action.js b/server/services/ami/dialer/models/action.js index 2ee9e50..e0e91e0 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 _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 +var _0x5491=['dialCutDigit','prototype','getQueue','exports','util','string','isNil','name','Contact','phone','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','firstName','starttime','format','callback','callbackuniqueid','callbackat','recallme','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','voiceQueue'];(function(_0x28f127,_0x451514){var _0x358efe=function(_0x3996aa){while(--_0x3996aa){_0x28f127['push'](_0x28f127['shift']());}};_0x358efe(++_0x451514);}(_0x5491,0x16c));var _0x1549=function(_0x3a4d86,_0x540e20){_0x3a4d86=_0x3a4d86-0x0;var _0x254ffc=_0x5491[_0x3a4d86];return _0x254ffc;};'use strict';var util=require(_0x1549('0x0'));var _=require('lodash');var moment=require('moment');function checkNameSurname(_0xad74c7,_0x489831,_0x1de293){var _0x2c347d='';if(!_['isNil'](_0x489831)&&_0x1549('0x1')===typeof _0x489831){_0x2c347d+=_0x489831;}if(!_[_0x1549('0x2')](_0x1de293)&&_0x1549('0x1')===typeof _0x1de293){_0x2c347d+='\x20'+_0x1de293;}if(_0x2c347d!==''){return _0x2c347d;}return _0xad74c7;}function Action(_0x29b271,_0x580984,_0x1f503b){this['voiceQueue']=_0x29b271;this['uniqueid']=_0x1f503b||undefined;this[_0x1549('0x3')]=checkNameSurname(_0x580984[_0x1549('0x4')][_0x1549('0x5')],_0x580984[_0x1549('0x4')]['firstName'],_0x580984[_0x1549('0x4')][_0x1549('0x6')]);this[_0x1549('0x7')]=_0x580984[_0x1549('0x5')];this[_0x1549('0x8')]=_0x29b271['name'];this[_0x1549('0x9')]=_0x580984[_0x1549('0x9')]||![];this['type']=_0x29b271[_0x1549('0xa')];this[_0x1549('0xb')]=_0x29b271['dialQueueTimeout']||0x3;this[_0x1549('0xc')]=_0x580984[_0x1549('0xc')];this[_0x1549('0xd')]=_0x580984[_0x1549('0xd')];this[_0x1549('0xe')]=_0x580984[_0x1549('0xe')];this[_0x1549('0xf')]=_0x580984[_0x1549('0xf')];this[_0x1549('0x10')]=_0x580984['countnosuchnumberretry'];this['countdropretry']=_0x580984[_0x1549('0x11')];this[_0x1549('0x12')]=_0x580984[_0x1549('0x12')];this['countmachineretry']=_0x580984['countmachineretry'];this[_0x1549('0x13')]=_0x580984[_0x1549('0x13')];this['ContactId']=_0x580984[_0x1549('0x14')];this[_0x1549('0x15')]=_0x580984[_0x1549('0x15')];this['UserId']=_0x580984[_0x1549('0x16')];this[_0x1549('0x17')]=_0x580984[_0x1549('0x17')];this[_0x1549('0x18')]=_0x580984[_0x1549('0x18')];this['idHopper']=_0x580984['id'];this['ContactFirstName']=_0x580984[_0x1549('0x4')][_0x1549('0x19')]||'';this[_0x1549('0x1a')]=moment()[_0x1549('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');this['callback']=_0x580984[_0x1549('0x1c')];this[_0x1549('0x1d')]=_0x580984[_0x1549('0x1d')];this[_0x1549('0x1e')]=_0x580984[_0x1549('0x1e')];this[_0x1549('0x1f')]=_0x580984[_0x1549('0x1f')];this['originatecalleridnum']='';this[_0x1549('0x20')]='';}Action['prototype'][_0x1549('0x21')]=function(){return util[_0x1549('0x1b')](_0x1549('0x22'),this[_0x1549('0x3')],this[_0x1549('0x23')][_0x1549('0x24')]>0x0?this[_0x1549('0x7')]['substring'](this[_0x1549('0x23')][_0x1549('0x24')]):this[_0x1549('0x7')]);};Action[_0x1549('0x25')][_0x1549('0x26')]=function(){return this[_0x1549('0x8')];};module[_0x1549('0x27')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/models/agentComplete.js b/server/services/ami/dialer/models/agentComplete.js index 816376e..ec030e9 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 _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 +var _0x7a4a=['ringtime','holdtime','talktime','getSeconds','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','name','calleridnum','number','starttime','responsetime','answertime','endtime','format'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x7a4a,0x12d));var _0xa7a4=function(_0x4f1af9,_0xc95c63){_0x4f1af9=_0x4f1af9-0x0;var _0x11a60e=_0x7a4a[_0x4f1af9];return _0x11a60e;};'use strict';var moment=require(_0xa7a4('0x0'));var utils=require(_0xa7a4('0x1'));function AgentComplete(_0x3da770,_0x35617b){this[_0xa7a4('0x2')]=0x4;this[_0xa7a4('0x3')]=_0xa7a4('0x4');this['scheduledat']=_0x3da770[_0xa7a4('0x5')];this[_0xa7a4('0x6')]=_0x3da770['type'];this[_0xa7a4('0x7')]=_0x3da770[_0xa7a4('0x6')]===_0xa7a4('0x8')?_0xa7a4('0x9'):_0x3da770[_0xa7a4('0x6')];this[_0xa7a4('0xa')]=_0x3da770[_0xa7a4('0xa')];this[_0xa7a4('0xb')]=_0x3da770[_0xa7a4('0xb')];this['countnoanswerretry']=_0x3da770[_0xa7a4('0xc')];this[_0xa7a4('0xd')]=_0x3da770[_0xa7a4('0xa')]+_0x3da770['countcongestionretry']+_0x3da770[_0xa7a4('0xc')]+_0x3da770[_0xa7a4('0xe')]+_0x3da770[_0xa7a4('0xf')]+_0x3da770['countabandonedretry']+_0x3da770[_0xa7a4('0x10')]+_0x3da770[_0xa7a4('0x11')];this[_0xa7a4('0xe')]=_0x3da770[_0xa7a4('0xe')];this[_0xa7a4('0xf')]=_0x3da770[_0xa7a4('0xf')];this[_0xa7a4('0x12')]=_0x3da770[_0xa7a4('0x12')];this[_0xa7a4('0x10')]=_0x3da770[_0xa7a4('0x10')];this[_0xa7a4('0x11')]=_0x3da770[_0xa7a4('0x11')];this[_0xa7a4('0x13')]=_0x35617b[_0xa7a4('0x13')];this['calleridname']=_0x3da770[_0xa7a4('0x14')];this[_0xa7a4('0x15')]=_0x3da770[_0xa7a4('0x16')];this[_0xa7a4('0x17')]=_0x3da770['starttime'];this[_0xa7a4('0x18')]=_0x3da770[_0xa7a4('0x18')];this[_0xa7a4('0x19')]=_0x3da770['answertime'];this[_0xa7a4('0x1a')]=moment()[_0xa7a4('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xa7a4('0x1c')]=utils['getSeconds'](_0x3da770[_0xa7a4('0x18')],_0x3da770[_0xa7a4('0x17')]);this[_0xa7a4('0x1d')]=utils['getSeconds'](_0x3da770[_0xa7a4('0x19')],_0x3da770['responsetime']);this[_0xa7a4('0x1e')]=utils[_0xa7a4('0x1f')](this[_0xa7a4('0x1a')],_0x3da770[_0xa7a4('0x19')]);this[_0xa7a4('0x9')]=_0x35617b[_0xa7a4('0x9')];this[_0xa7a4('0x20')]=_0x35617b[_0xa7a4('0x20')];this[_0xa7a4('0x21')]=_0x35617b[_0xa7a4('0x21')];this[_0xa7a4('0x22')]=_0x3da770[_0xa7a4('0x22')];this[_0xa7a4('0x23')]=_0x3da770[_0xa7a4('0x23')];this[_0xa7a4('0x24')]=_0x3da770[_0xa7a4('0x24')];this['recallme']=_0x3da770[_0xa7a4('0x25')];this[_0xa7a4('0x26')]=_0x3da770['ContactId'];this[_0xa7a4('0x27')]=_0x3da770['ListId'];this[_0xa7a4('0x28')]=_0x3da770[_0xa7a4('0x28')];this[_0xa7a4('0x29')]=_0x3da770['VoiceQueueId'];this[_0xa7a4('0x2a')]=_0x3da770[_0xa7a4('0x2a')];this[_0xa7a4('0x2b')]=_0x3da770[_0xa7a4('0x2b')]||'';this['originatecalleridname']=_0x3da770[_0xa7a4('0x2c')]||'';this['agiafterat']=_0x3da770[_0xa7a4('0x2d')];}module[_0xa7a4('0x2e')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/models/final.js b/server/services/ami/dialer/models/final.js index a407129..35451ef 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 _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 +var _0x3831=['outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','uniqueid','scheduledat','type','campaigntype'];(function(_0x532c0e,_0x9e069d){var _0x36cdea=function(_0x1ab141){while(--_0x1ab141){_0x532c0e['push'](_0x532c0e['shift']());}};_0x36cdea(++_0x9e069d);}(_0x3831,0x19c));var _0x1383=function(_0x4e324f,_0x4f0cfc){_0x4e324f=_0x4e324f-0x0;var _0x4e6076=_0x3831[_0x4e324f];return _0x4e6076;};'use strict';function Final(_0x551001){this[_0x1383('0x0')]=_0x551001[_0x1383('0x0')];this[_0x1383('0x1')]=_0x551001[_0x1383('0x1')];this[_0x1383('0x2')]=_0x551001[_0x1383('0x2')];this[_0x1383('0x3')]=_0x551001[_0x1383('0x2')]===_0x1383('0x4')?_0x1383('0x5'):_0x551001[_0x1383('0x2')];this[_0x1383('0x6')]=_0x551001['countbusyretry'];this[_0x1383('0x7')]=_0x551001[_0x1383('0x7')];this[_0x1383('0x8')]=_0x551001['countnoanswerretry'];this['countglobal']=_0x551001[_0x1383('0x6')]+_0x551001[_0x1383('0x7')]+_0x551001['countnoanswerretry']+_0x551001['countnosuchnumberretry']+_0x551001[_0x1383('0x9')]+_0x551001[_0x1383('0xa')]+_0x551001[_0x1383('0xb')]+_0x551001[_0x1383('0xc')];this[_0x1383('0xd')]=_0x551001[_0x1383('0xd')];this[_0x1383('0x9')]=_0x551001[_0x1383('0x9')];this[_0x1383('0xa')]=_0x551001[_0x1383('0xa')];this[_0x1383('0xb')]=_0x551001[_0x1383('0xb')];this['countagentrejectretry']=_0x551001['countagentrejectretry'];this[_0x1383('0x5')]=_0x551001['queue'];this[_0x1383('0xe')]=_0x551001[_0x1383('0xe')];this['calleridnum']=_0x551001[_0x1383('0xf')];this[_0x1383('0x10')]=_0x551001['starttime'];this[_0x1383('0x11')]=_0x551001[_0x1383('0x11')];this['endtime']=_0x551001['responsetime'];this[_0x1383('0x12')]=_0x551001['ringtime']||0x0;this[_0x1383('0x13')]=_0x551001[_0x1383('0x13')]||0x0;this['talktime']=_0x551001['talktime']||0x0;this[_0x1383('0x14')]=_0x551001['callback'];this[_0x1383('0x15')]=_0x551001[_0x1383('0x15')];this[_0x1383('0x16')]=_0x551001[_0x1383('0x16')];this[_0x1383('0x17')]=_0x551001[_0x1383('0x17')];this[_0x1383('0x18')]=_0x551001[_0x1383('0x18')];this[_0x1383('0x19')]=_0x551001[_0x1383('0x19')];this[_0x1383('0x1a')]=_0x551001[_0x1383('0x1a')];this['VoiceQueueId']=_0x551001[_0x1383('0x1b')];this[_0x1383('0x1c')]=_0x551001['CampaignId'];this[_0x1383('0x1d')]=_0x551001[_0x1383('0x1d')]||'';this[_0x1383('0x1e')]=_0x551001['originatecalleridname']||'';this['state']=_0x551001['state'];this['statedesc']=_0x551001['statedesc'];}module[_0x1383('0x1f')]=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 2694d24..0cbc587 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 _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 +var _0x8821=['countabandonedretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','number','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','talktime','membername','IVR','reason','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry'];(function(_0x3e61d4,_0x224d2d){var _0x40bd4e=function(_0x21432f){while(--_0x21432f){_0x3e61d4['push'](_0x3e61d4['shift']());}};_0x40bd4e(++_0x224d2d);}(_0x8821,0xc3));var _0x1882=function(_0x255c48,_0x2a4449){_0x255c48=_0x255c48-0x0;var _0xaebda3=_0x8821[_0x255c48];return _0xaebda3;};'use strict';var moment=require(_0x1882('0x0'));var utils=require(_0x1882('0x1'));function Hangup(_0xfd0320,_0x50e5dd){this[_0x1882('0x2')]=0x4;this[_0x1882('0x3')]=_0x1882('0x4');this[_0x1882('0x5')]=_0xfd0320['scheduledat'];this[_0x1882('0x6')]=_0xfd0320[_0x1882('0x6')];this[_0x1882('0x7')]=_0xfd0320[_0x1882('0x6')]==='outbound'?_0x1882('0x8'):_0xfd0320['type'];this['amd']=_0xfd0320[_0x1882('0x9')]||![];this[_0x1882('0xa')]=_0xfd0320['countbusyretry'];this[_0x1882('0xb')]=_0xfd0320[_0x1882('0xb')];this[_0x1882('0xc')]=_0xfd0320[_0x1882('0xc')];this[_0x1882('0xd')]=_0xfd0320[_0x1882('0xa')]+_0xfd0320[_0x1882('0xb')]+_0xfd0320[_0x1882('0xc')]+_0xfd0320['countnosuchnumberretry']+_0xfd0320[_0x1882('0xe')]+_0xfd0320[_0x1882('0xf')]+_0xfd0320['countmachineretry']+_0xfd0320['countagentrejectretry'];this[_0x1882('0x10')]=_0xfd0320['countnosuchnumberretry'];this['countdropretry']=_0xfd0320[_0x1882('0xe')];this['countabandonedretry']=_0xfd0320['countabandonedretry'];this[_0x1882('0x11')]=_0xfd0320[_0x1882('0x11')];this[_0x1882('0x12')]=_0xfd0320['countagentrejectretry'];this['uniqueid']=_0x50e5dd[_0x1882('0x13')];this[_0x1882('0x14')]=_0xfd0320[_0x1882('0x15')];this['calleridnum']=_0xfd0320[_0x1882('0x16')];this[_0x1882('0x17')]=_0xfd0320[_0x1882('0x17')];this[_0x1882('0x18')]=_0xfd0320[_0x1882('0x18')];this[_0x1882('0x19')]=moment()['format'](_0x1882('0x1a'));this[_0x1882('0x1b')]=utils[_0x1882('0x1c')](_0xfd0320[_0x1882('0x18')],_0xfd0320['starttime']);this['holdtime']=0x0;this[_0x1882('0x1d')]=utils['getSeconds'](this[_0x1882('0x19')],_0xfd0320[_0x1882('0x18')]);this[_0x1882('0x8')]=_0xfd0320[_0x1882('0x8')];this[_0x1882('0x1e')]=_0x1882('0x1f');this[_0x1882('0x20')]=_0x50e5dd['cause-txt'];this[_0x1882('0x21')]=_0xfd0320['callback'];this[_0x1882('0x22')]=_0xfd0320['callbackuniqueid'];this['callbackat']=_0xfd0320['callbackat'];this['recallme']=_0xfd0320[_0x1882('0x23')];this[_0x1882('0x24')]=_0xfd0320['ContactId'];this[_0x1882('0x25')]=_0xfd0320[_0x1882('0x25')];this['UserId']=_0xfd0320[_0x1882('0x26')];this[_0x1882('0x27')]=_0xfd0320['VoiceQueueId'];this[_0x1882('0x28')]=_0xfd0320[_0x1882('0x28')];}module[_0x1882('0x29')]=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 6e13c74..04e1e60 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 _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 +var _0x170e=['endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','../utils','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','calleridname','calleridnum','number','starttime','responsetime'];(function(_0x457e03,_0x39fec0){var _0x298a4f=function(_0x1f0628){while(--_0x1f0628){_0x457e03['push'](_0x457e03['shift']());}};_0x298a4f(++_0x39fec0);}(_0x170e,0xef));var _0xe170=function(_0x2fff83,_0x29d5fe){_0x2fff83=_0x2fff83-0x0;var _0xa2a722=_0x170e[_0x2fff83];return _0xa2a722;};'use strict';var utils=require(_0xe170('0x0'));function History(_0x437da5){this[_0xe170('0x1')]=_0x437da5['uniqueid'];this[_0xe170('0x2')]=_0x437da5[_0xe170('0x2')]||undefined;this[_0xe170('0x3')]=_0x437da5[_0xe170('0x3')];this[_0xe170('0x4')]=_0x437da5[_0xe170('0x3')]==='outbound'?_0xe170('0x5'):_0x437da5['type'];this[_0xe170('0x6')]=_0x437da5[_0xe170('0x6')];this[_0xe170('0x7')]=_0x437da5[_0xe170('0x7')];this['countnoanswerretry']=_0x437da5[_0xe170('0x8')];this[_0xe170('0x9')]=_0x437da5[_0xe170('0x6')]+_0x437da5[_0xe170('0x7')]+_0x437da5[_0xe170('0x8')]+_0x437da5['countnosuchnumberretry']+_0x437da5[_0xe170('0xa')]+_0x437da5[_0xe170('0xb')]+_0x437da5[_0xe170('0xc')]+_0x437da5[_0xe170('0xd')];this[_0xe170('0xe')]=_0x437da5[_0xe170('0xe')];this[_0xe170('0xa')]=_0x437da5['countdropretry'];this[_0xe170('0xb')]=_0x437da5[_0xe170('0xb')];this['countmachineretry']=_0x437da5[_0xe170('0xc')];this[_0xe170('0xd')]=_0x437da5[_0xe170('0xd')];this[_0xe170('0x5')]=_0x437da5[_0xe170('0x5')];this[_0xe170('0xf')]=_0x437da5['name'];this[_0xe170('0x10')]=_0x437da5[_0xe170('0x11')];this[_0xe170('0x12')]=_0x437da5[_0xe170('0x12')];this[_0xe170('0x13')]=_0x437da5[_0xe170('0x13')];this[_0xe170('0x14')]=_0x437da5[_0xe170('0x13')];this[_0xe170('0x15')]=utils['getSeconds'](_0x437da5[_0xe170('0x13')],_0x437da5[_0xe170('0x12')]);this[_0xe170('0x16')]=0x0;this[_0xe170('0x17')]=0x0;this[_0xe170('0x18')]=_0x437da5[_0xe170('0x18')];this[_0xe170('0x19')]=_0x437da5[_0xe170('0x19')];this['callbackat']=_0x437da5[_0xe170('0x1a')];this['recallme']=_0x437da5[_0xe170('0x1b')];this[_0xe170('0x1c')]=_0x437da5[_0xe170('0x1c')];this[_0xe170('0x1d')]=_0x437da5[_0xe170('0x1d')];this[_0xe170('0x1e')]=_0x437da5[_0xe170('0x1e')];this[_0xe170('0x1f')]=_0x437da5[_0xe170('0x1f')];this[_0xe170('0x20')]=_0x437da5['CampaignId'];this[_0xe170('0x21')]=_0x437da5[_0xe170('0x21')]||'';this[_0xe170('0x22')]=_0x437da5['originatecalleridname']||'';this[_0xe170('0x23')]=_0x437da5[_0xe170('0x23')];this[_0xe170('0x24')]=_0x437da5[_0xe170('0x24')];}module['exports']=History; \ No newline at end of file diff --git a/server/services/ami/dialer/models/queueCallerAbandon.js b/server/services/ami/dialer/models/queueCallerAbandon.js index 27cbea2..b4f5cfe 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 _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 +var _0x8678=['countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','droptime','dropreason','endtime','ringtime','holdtime','getSeconds','talktime','membername','connectedlinename','reason','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','../utils','scheduledat','type','campaigntype','outbound','countcongestionretry','countnoanswerretry','countglobal','countbusyretry'];(function(_0x2b75db,_0x52925b){var _0x237286=function(_0x5e45f2){while(--_0x5e45f2){_0x2b75db['push'](_0x2b75db['shift']());}};_0x237286(++_0x52925b);}(_0x8678,0x124));var _0x8867=function(_0x565577,_0x3c2195){_0x565577=_0x565577-0x0;var _0x2259c1=_0x8678[_0x565577];return _0x2259c1;};'use strict';var utils=require(_0x8867('0x0'));function QueueCallerAbandon(_0x4617e4,_0x1ccf71){this[_0x8867('0x1')]=_0x4617e4[_0x8867('0x1')];this[_0x8867('0x2')]=_0x4617e4[_0x8867('0x2')];this[_0x8867('0x3')]=_0x4617e4[_0x8867('0x2')]===_0x8867('0x4')?'queue':_0x4617e4[_0x8867('0x2')];this['countbusyretry']=_0x4617e4['countbusyretry'];this[_0x8867('0x5')]=_0x4617e4[_0x8867('0x5')];this[_0x8867('0x6')]=_0x4617e4['countnoanswerretry'];this[_0x8867('0x7')]=_0x4617e4[_0x8867('0x8')]+_0x4617e4[_0x8867('0x5')]+_0x4617e4['countnoanswerretry']+_0x4617e4[_0x8867('0x9')]+_0x4617e4[_0x8867('0xa')]+_0x4617e4['countabandonedretry']+_0x4617e4['countmachineretry']+_0x4617e4[_0x8867('0xb')];this['countnosuchnumberretry']=_0x4617e4[_0x8867('0x9')];this[_0x8867('0xa')]=_0x4617e4['countdropretry'];this['countabandonedretry']=_0x4617e4[_0x8867('0xc')];this[_0x8867('0xd')]=_0x4617e4[_0x8867('0xd')];this[_0x8867('0xb')]=_0x4617e4[_0x8867('0xb')];this[_0x8867('0xe')]=_0x1ccf71[_0x8867('0xe')];this[_0x8867('0xf')]=_0x4617e4['name'];this[_0x8867('0x10')]=_0x4617e4[_0x8867('0x11')];this[_0x8867('0x12')]=_0x4617e4['starttime'];this[_0x8867('0x13')]=_0x4617e4[_0x8867('0x13')];this[_0x8867('0x14')]=_0x4617e4[_0x8867('0x14')];this[_0x8867('0x15')]=_0x4617e4[_0x8867('0x15')];this[_0x8867('0x16')]=this['droptime'];this[_0x8867('0x17')]=utils['getSeconds'](_0x4617e4['responsetime'],_0x4617e4[_0x8867('0x12')]);this[_0x8867('0x18')]=utils[_0x8867('0x19')](this[_0x8867('0x14')],_0x4617e4[_0x8867('0x13')]);this[_0x8867('0x1a')]=0x0;this['queue']=_0x1ccf71['queue'];this[_0x8867('0x1b')]=_0x1ccf71[_0x8867('0x1c')];this['reason']=_0x1ccf71[_0x8867('0x1d')];this['callback']=_0x4617e4['callback'];this['callbackuniqueid']=_0x4617e4[_0x8867('0x1e')];this[_0x8867('0x1f')]=_0x4617e4[_0x8867('0x1f')];this[_0x8867('0x20')]=_0x4617e4[_0x8867('0x20')];this[_0x8867('0x21')]=_0x4617e4[_0x8867('0x21')];this[_0x8867('0x22')]=_0x4617e4[_0x8867('0x22')];this[_0x8867('0x23')]=_0x4617e4[_0x8867('0x23')];this[_0x8867('0x24')]=_0x4617e4['VoiceQueueId'];this[_0x8867('0x25')]=_0x4617e4[_0x8867('0x25')];this[_0x8867('0x26')]=_0x4617e4[_0x8867('0x26')]||'';this[_0x8867('0x27')]=_0x4617e4[_0x8867('0x27')]||'';this[_0x8867('0x28')]=_0x4617e4[_0x8867('0x28')];this['state']=_0x4617e4[_0x8867('0x29')];this[_0x8867('0x2a')]=_0x4617e4[_0x8867('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 daadc7a..8c2bf16 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 _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 +var _0x33af=['../../rpc/cmHopperHistory','inspect','dialOrderByScheduledAt','catch','temp','error','[getContactDialer]','getContactDialerIvr','[getContactDialerIvr]','countReScheduled','[countReScheduled]','rescheduleContact','[rescheduleContact]','unlockContact','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[avgHandleTime]','avgHandleTime','createHistory','[createHistory]','../../../../config/logger','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack'];(function(_0x162d95,_0x3374da){var _0x7b36f4=function(_0x23ab53){while(--_0x23ab53){_0x162d95['push'](_0x162d95['shift']());}};_0x7b36f4(++_0x3374da);}(_0x33af,0xec));var _0xf33a=function(_0x3f5dd3,_0x171037){_0x3f5dd3=_0x3f5dd3-0x0;var _0x3cb003=_0x33af[_0x3f5dd3];return _0x3cb003;};'use strict';var util=require('util');var logger=require(_0xf33a('0x0'))('dialer');var cmHopper=require(_0xf33a('0x1'));var cmHopperAdditionalPhone=require(_0xf33a('0x2'));var cmHopperBlack=require(_0xf33a('0x3'));var cmHopperHistory=require(_0xf33a('0x4'));function inspectError(_0x169f02){return util[_0xf33a('0x5')](_0x169f02,{'showHidden':![],'depth':null});}function getContactDialer(_0x4c734e,_0x433e25,_0x44cfa5){return cmHopper['getContactDialer'](_0x4c734e['id'],_0x433e25,_0x44cfa5,_0x4c734e[_0xf33a('0x6')])[_0xf33a('0x7')](function(_0x1b2b01){_0x4c734e[_0xf33a('0x8')]=0x0;logger[_0xf33a('0x9')](_0xf33a('0xa'),inspectError(_0x1b2b01));});}exports['getContactDialer']=getContactDialer;function getContactDialerIvr(_0x29bb24,_0x14eb0e){return cmHopper[_0xf33a('0xb')](_0x29bb24['id'],_0x14eb0e,_0x29bb24[_0xf33a('0x6')])[_0xf33a('0x7')](function(_0x27f30a){_0x29bb24['temp']=0x0;logger['error'](_0xf33a('0xc'),inspectError(_0x27f30a));});}exports[_0xf33a('0xb')]=getContactDialerIvr;function countReScheduled(_0x170468){return cmHopper[_0xf33a('0xd')](_0x170468)[_0xf33a('0x7')](function(_0x5959c9){logger[_0xf33a('0x9')](_0xf33a('0xe'),inspectError(_0x5959c9));});}exports['countReScheduled']=countReScheduled;function rescheduleContact(_0x506924){return cmHopper[_0xf33a('0xf')](_0x506924)[_0xf33a('0x7')](function(_0x17043){logger[_0xf33a('0x9')](_0xf33a('0x10'),inspectError(_0x17043));});}exports[_0xf33a('0xf')]=rescheduleContact;function unlockContact(_0x45e311,_0x1f2b1b,_0x507cb9){return cmHopper[_0xf33a('0x11')](_0x45e311,_0x1f2b1b,_0x507cb9)['catch'](function(_0x75848d){logger[_0xf33a('0x9')]('[unlockContact]',inspectError(_0x75848d));});}exports[_0xf33a('0x11')]=unlockContact;function moveContactManagedDialer(_0x25c931){return cmHopper['moveContactManagedDialer'](_0x25c931)[_0xf33a('0x7')](function(_0x23d9e2){logger[_0xf33a('0x9')](_0xf33a('0x12'),inspectError(_0x23d9e2));});}exports['moveContactManagedDialer']=moveContactManagedDialer;function checkIsBlackList(_0x11efa0){return cmHopperBlack[_0xf33a('0x13')](_0x11efa0)[_0xf33a('0x7')](function(_0x30e383){logger[_0xf33a('0x9')](_0xf33a('0x14'),inspectError(_0x30e383));});}exports[_0xf33a('0x13')]=checkIsBlackList;function checkIsBlackListIvr(_0x288275){return cmHopperBlack[_0xf33a('0x15')](_0x288275)[_0xf33a('0x7')](function(_0x520dc4){logger[_0xf33a('0x9')](_0xf33a('0x16'),inspectError(_0x520dc4));});}exports[_0xf33a('0x15')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x27faa1,_0x2ab756,_0x51d3fd){return cmHopperAdditionalPhone[_0xf33a('0x17')](_0x27faa1,_0x2ab756,_0x51d3fd)['catch'](function(_0x492986){logger[_0xf33a('0x9')](_0xf33a('0x18'),inspectError(_0x492986));});}exports[_0xf33a('0x17')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x429b83,_0x4b9801,_0x57cb1d){return cmHopperAdditionalPhone[_0xf33a('0x19')](_0x429b83,_0x4b9801,_0x57cb1d)['catch'](function(_0x4af24a){logger[_0xf33a('0x9')]('[swapAdditionalPhone]',inspectError(_0x4af24a));});}exports['swapAdditionalPhones']=swapAdditionalPhones;function avgHandleTime(_0x38eba2){return cmHopperHistory['avgHandleTime'](_0x38eba2)[_0xf33a('0x7')](function(_0x553480){logger[_0xf33a('0x9')](_0xf33a('0x1a'),inspectError(_0x553480));});}exports[_0xf33a('0x1b')]=avgHandleTime;function createHistory(_0x729fca){return cmHopperHistory[_0xf33a('0x1c')](_0x729fca)[_0xf33a('0x7')](function(_0x1d19ee){logger[_0xf33a('0x9')](_0xf33a('0x1d'),inspectError(_0x1d19ee));});}exports[_0xf33a('0x1c')]=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 395288a..25b1cf2 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 _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 +var _0xcfef=['RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','preview','ivr','isIVRCampaign','type','outbound','dialActive','isQueueCampaignActive','active','milliseconds','diff','seconds','getSeconds','available','loggedIn','loggedInDb','paused','talking','pTalking','inUse','originated','name','Trunk','hasQueueCampaignDataChanged','dialTimezone','isNil','dialGlobalInterval','Interval','Intervals','isEmpty','UNKNOWN_TIMEZONE','SIP/','reachable','unmonitored','includes','status','TrunkBackup','INACTIVE','waiting','DISACTIVED','NO_AGENTS_LOGGED','getQueueCampaignStatusMessage','match','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','\x5cw{0,','pow','replace','random','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','length','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','updatedAt','undefined','description','toUpperCase','toString','substring','XMD-','setXMDContactVariables','lodash','moment','util','../../../../config/logger','../../../../config/environment/shared','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','INTERVAL_IS_NULL','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE'];(function(_0x35731b,_0x2bc9a1){var _0x3a080d=function(_0x195eff){while(--_0x195eff){_0x35731b['push'](_0x35731b['shift']());}};_0x3a080d(++_0x2bc9a1);}(_0xcfef,0x150));var _0xfcfe=function(_0x13f436,_0x53f227){_0x13f436=_0x13f436-0x0;var _0x575caf=_0xcfef[_0x13f436];return _0x575caf;};'use strict';var _=require(_0xfcfe('0x0'));var moment=require(_0xfcfe('0x1'));var util=require(_0xfcfe('0x2'));var logger=require(_0xfcfe('0x3'))('dialer');var timezones=require(_0xfcfe('0x4'))['timezones'];var CAMPAIGN_STATUS={'ACTIVE':_0xfcfe('0x5'),'BLACKLIST':_0xfcfe('0x6'),'CONTACTS_RESCHEDULED':_0xfcfe('0x7'),'DEACTIVATED':_0xfcfe('0x8'),'DISACTIVED':_0xfcfe('0x9'),'EMPTY_INTERVAL':_0xfcfe('0xa'),'INACTIVE':_0xfcfe('0xb'),'NO_AGENTS_LOGGED':_0xfcfe('0xc'),'NO_AVAILABLE_CONTACTS':'AVAILABLE_CONTACTS_FINISHED','NULL_INTERVAL':_0xfcfe('0xd'),'OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':_0xfcfe('0xe'),'QUEUE_RECALL':_0xfcfe('0xf'),'RECALL_TIMEOUT':_0xfcfe('0x10'),'RUNNING':_0xfcfe('0x11'),'UNKNOWN_TIMEZONE':_0xfcfe('0x12'),'UNREACHABLE_TRUNK':_0xfcfe('0x13')};exports[_0xfcfe('0x14')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x24e8d5){return _0x24e8d5[_0xfcfe('0x15')]===_0xfcfe('0x16');}exports['isPreviewCampaign']=isPreviewCampaign;function isIVRCampaign(_0x442e06){return _0x442e06['type']===_0xfcfe('0x17');}exports[_0xfcfe('0x18')]=isIVRCampaign;function isOutboundQueue(_0x22f088){return _0x22f088[_0xfcfe('0x19')]===_0xfcfe('0x1a');}exports['isOutboundQueue']=isOutboundQueue;function isQueueCampaignActive(_0x25dd67){return _0x25dd67[_0xfcfe('0x1b')];}exports[_0xfcfe('0x1c')]=isQueueCampaignActive;function isIVRCampaignActive(_0x1bfc57){return _0x1bfc57[_0xfcfe('0x1d')];}exports['isIVRCampaignActive']=isIVRCampaignActive;function getSeconds(_0x27ef16,_0x2c67b5){var _0xb9a7c3=moment(_0x27ef16)[_0xfcfe('0x1e')](0x0);var _0x51c000=moment(_0x2c67b5)[_0xfcfe('0x1e')](0x0);return _0xb9a7c3[_0xfcfe('0x1f')](_0x51c000,_0xfcfe('0x20'));}exports[_0xfcfe('0x21')]=getSeconds;function hasQueueCampaignDataChanged(_0x240e6f,_0xe395fd){var _0x4b1969=![];var _0x360896=_0x240e6f['dialMethod']!==_0xe395fd['dialMethod']||_0x240e6f[_0xfcfe('0x1b')]!==_0xe395fd[_0xfcfe('0x1b')]||_0x240e6f['message']!==_0xe395fd['message'];var _0x5dd0f1=_0x240e6f[_0xfcfe('0x22')]!==_0xe395fd[_0xfcfe('0x22')]||_0x240e6f[_0xfcfe('0x23')]!==_0xe395fd[_0xfcfe('0x23')]||_0x240e6f[_0xfcfe('0x24')]!==_0xe395fd[_0xfcfe('0x24')]||_0x240e6f[_0xfcfe('0x25')]!==_0xe395fd[_0xfcfe('0x25')]||_0x240e6f[_0xfcfe('0x26')]!==_0xe395fd[_0xfcfe('0x26')]||_0x240e6f[_0xfcfe('0x27')]!==_0xe395fd['pTalking']||_0x240e6f['waiting']!==_0xe395fd['waiting']||_0x240e6f[_0xfcfe('0x28')]!==_0xe395fd[_0xfcfe('0x28')]||_0x240e6f[_0xfcfe('0x29')]!==_0xe395fd[_0xfcfe('0x29')];if(_0x240e6f['Trunk']&&_0xe395fd['Trunk']){_0x4b1969=_0x240e6f['Trunk'][_0xfcfe('0x2a')]!==_0xe395fd[_0xfcfe('0x2b')]['name']||_0x240e6f[_0xfcfe('0x2b')]['active']!==_0xe395fd[_0xfcfe('0x2b')][_0xfcfe('0x1d')];}return _0x360896||_0x5dd0f1||_0x4b1969;}exports[_0xfcfe('0x2c')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x105db7){var _0x348533=null;var _0x1c40fd=_0x105db7[_0xfcfe('0x2d')];if(_[_0xfcfe('0x2e')](_0x105db7[_0xfcfe('0x2f')])||_[_0xfcfe('0x2e')](_0x105db7[_0xfcfe('0x30')])||_['isNil'](_0x105db7[_0xfcfe('0x30')][_0xfcfe('0x31')])){_0x348533=CAMPAIGN_STATUS['NULL_INTERVAL'];}else if(_['isEmpty'](_0x105db7[_0xfcfe('0x2f')])||_[_0xfcfe('0x32')](_0x105db7[_0xfcfe('0x30')]['Intervals'])){_0x348533=CAMPAIGN_STATUS['EMPTY_INTERVAL'];}else if(_0x1c40fd&&!timezones[_0x1c40fd]){_0x348533=CAMPAIGN_STATUS[_0xfcfe('0x33')];}return _0x348533;}function checkAnyValidTrunk(_0x2a4505,_0x399ba2){var _0x4a2261=null;var _0x2113d9=_0xfcfe('0x34');var _0x1358ea=[_0xfcfe('0x35'),_0xfcfe('0x36')];var _0x2c1791=!![];if(_0x2a4505[_0xfcfe('0x2b')]&&_0x2a4505[_0xfcfe('0x2b')][_0xfcfe('0x1d')]){_0x2113d9+=_0x2a4505[_0xfcfe('0x2b')][_0xfcfe('0x2a')];_0x4a2261=_0x399ba2[_0x2113d9];_0x2c1791=_0x1358ea[_0xfcfe('0x37')](_0x4a2261[_0xfcfe('0x38')]);}else if(_0x2a4505[_0xfcfe('0x39')]&&_0x2a4505['TrunkBackup'][_0xfcfe('0x1d')]){_0x2113d9+=_0x2a4505[_0xfcfe('0x39')][_0xfcfe('0x2a')];_0x4a2261=_0x399ba2[_0x2113d9];_0x2c1791=_0x1358ea[_0xfcfe('0x37')](_0x4a2261[_0xfcfe('0x38')]);}return _0x2c1791;}function getQueueCampaignStatusMessage(_0x407d30,_0x57f3a4){var _0x2250bb=CAMPAIGN_STATUS[_0xfcfe('0x5')];var _0x187c02=isPreviewCampaign(_0x407d30);if(!isQueueCampaignActive(_0x407d30)){if(_0x187c02){_0x2250bb=CAMPAIGN_STATUS[_0xfcfe('0x3a')];}else{if(_0x407d30[_0xfcfe('0x29')]===0x0&&_0x407d30[_0xfcfe('0x26')]===0x0&&_0x407d30[_0xfcfe('0x3b')]===0x0&&(_0x407d30['pTalking']||0x0)===0x0){_0x2250bb=CAMPAIGN_STATUS[_0xfcfe('0x3a')];}else{_0x2250bb=CAMPAIGN_STATUS[_0xfcfe('0x3c')];}}}else if(_0x407d30['loggedIn']===0x0){_0x2250bb=CAMPAIGN_STATUS[_0xfcfe('0x3d')];}else if(!checkAnyValidTrunk(_0x407d30,_0x57f3a4)){_0x2250bb=CAMPAIGN_STATUS['UNREACHABLE_TRUNK'];}else if(!isPreviewCampaign(_0x407d30)){var _0x436369=checkAnyValidQueueCampaignInterval(_0x407d30);if(_0x436369){_0x2250bb=_0x436369;}}return _0x2250bb;}exports[_0xfcfe('0x3e')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x4afa66){var _0x5343eb=CAMPAIGN_STATUS['DISACTIVED'];if(_0x4afa66[_0xfcfe('0x29')]===0x0&&_0x4afa66[_0xfcfe('0x26')]===0x0&&_0x4afa66[_0xfcfe('0x3b')]===0x0&&(_0x4afa66[_0xfcfe('0x27')]||0x0)===0x0){_0x5343eb=CAMPAIGN_STATUS['INACTIVE'];}return _0x5343eb;}exports['getQueueCampaignActiveStatusMessage']=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x556fbb){var _0x37f5c3=_0x556fbb[_0xfcfe('0x3f')](/"(.*?)"/);return _0x37f5c3?_0x37f5c3[0x1]:_0x556fbb;}exports[_0xfcfe('0x40')]=extractCalleridName;function getCallerId(_0xd29c80,_0x4017c7,_0x401f57){if(!_[_0xfcfe('0x41')](_0x401f57)&&typeof _0x401f57===_0xfcfe('0x42')&&!_[_0xfcfe('0x32')](_0x401f57)){if(!_[_0xfcfe('0x41')](_0x4017c7)&&typeof _0x4017c7===_0xfcfe('0x42')&&!_['isEmpty'](_0x4017c7)){return util[_0xfcfe('0x43')](_0xfcfe('0x44'),_0x4017c7,_0x401f57);}return util[_0xfcfe('0x43')](_0xfcfe('0x44'),_0x401f57,_0x401f57);}if(!_['isUndefined'](_0xd29c80)&&typeof _0xd29c80===_0xfcfe('0x42')&&!_[_0xfcfe('0x32')](_0xd29c80)){return _0xd29c80;}return'\x22\x22\x20<>';}exports['getCallerId']=getCallerId;function getCallerIdRandom(_0x2ccb43,_0x2655e3){var _0x321171;var _0x4a3f4c;var _0x1a5d85;if(_0x2655e3<=0x0){_0x2655e3=0x1;}_0x321171=new RegExp(_0xfcfe('0x45')+_0x2655e3+'}$');_0x4a3f4c=Math[_0xfcfe('0x46')](0xa,_0x2655e3-0x1);_0x1a5d85=Math[_0xfcfe('0x46')](0xa,_0x2655e3)-0x1;return util[_0xfcfe('0x43')]('%s',_[_0xfcfe('0x47')](_0x2ccb43,_0x321171,_[_0xfcfe('0x48')](_0x4a3f4c,_0x1a5d85)['toString']()));}exports[_0xfcfe('0x49')]=getCallerIdRandom;function decrementOriginate(_0x353815){if(_0x353815[_0xfcfe('0x29')]&&_0x353815[_0xfcfe('0x29')]>0x0){_0x353815[_0xfcfe('0x29')]-=0x1;}else{logger[_0xfcfe('0x4a')](_0xfcfe('0x4b'));}}exports['decrementOriginate']=decrementOriginate;function checkContactEmpty(_0x4100c7){return _0x4100c7&&_0x4100c7[_0xfcfe('0x4c')]>0x0;}exports[_0xfcfe('0x4d')]=checkContactEmpty;function erlangb(_0x365ab7,_0x1fc201){if(_0x1fc201===0x0){return 0x0;}var _0x2e6745=0x1;for(var _0x2a3800=0x1;_0x2a3800<=_0x1fc201;_0x2a3800+=0x1){_0x2e6745=0x1+_0x2e6745*_0x2a3800/_0x365ab7;}return 0x1/_0x2e6745;}exports[_0xfcfe('0x4e')]=erlangb;function checkContactLowerLimitOriginate(_0x177894,_0x24fce2,_0x533546){if(_0x24fce2>_0x533546){for(var _0x15bea2=0x0;_0x15bea2<_0x24fce2-_0x533546;_0x15bea2+=0x1){decrementOriginate(_0x177894);}}}exports[_0xfcfe('0x4f')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x1ae61c){var _0x3d9e36={};var _0x3f2bc8=['id','createdAt','tags',_0xfcfe('0x50')];const _0x31501b=0xfa;if(_0x1ae61c){for(var _0x430eb7 in _0x1ae61c){if(typeof _0x1ae61c[_0x430eb7]!==_0xfcfe('0x51')){if(!_[_0xfcfe('0x2e')](_0x1ae61c[_0x430eb7])&&!_0x3f2bc8[_0xfcfe('0x37')](_0x430eb7)){if(_0x430eb7===_0xfcfe('0x52')&&_0x1ae61c[_0x430eb7][_0xfcfe('0x4c')]>_0x31501b){_0x3d9e36['XMD-'+_0x430eb7[_0xfcfe('0x53')]()]=_0x1ae61c[_0x430eb7][_0xfcfe('0x54')]()[_0xfcfe('0x55')](0x0,_0x31501b);}else{_0x3d9e36[_0xfcfe('0x56')+_0x430eb7['toUpperCase']()]=_0x1ae61c[_0x430eb7];}}}}}return _0x3d9e36;}exports[_0xfcfe('0x57')]=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 068467f..97a9fb4 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(_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 +var _0xa9e0=['fax','localstationid','path','AttachmentId','exports','util','lodash','moment','channel','format','%s/%s/%s','tech','Trunk'];(function(_0x3a4ab4,_0x31e564){var _0x69a5d9=function(_0xf5411c){while(--_0xf5411c){_0x3a4ab4['push'](_0x3a4ab4['shift']());}};_0x69a5d9(++_0x31e564);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'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 d1d00a6..1bf6a92 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 _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 +var _0x57a0=['isNil','SIP/%s','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','bluebird','uuid','path','tiff2pdf','./util/gs','../../../config/logger','../ami','./rpcDb','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','syncNewExten','faxstatus','receivefax','syncReceiveFax','hangup','syncHangup','syncOriginateResponse','prototype','context','hasOwnProperty','exten','localstationid','uniqueid','channel','name','\x20syncNewchannel\x20','info','variable','channelstate','channelstatedesc','value','syncFaxStatus','operation','status','filename','remotestationid','pagestransferred','resolution','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','fax','error','stringify','catch','\x20receiveFax\x20','merge','response','reason','AttachmentId','update','then','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','faxpages','updateStatus','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','Fax\x20received','[Fax][execOriginate][failure]','checkAfterSend','checkTrunk','Trunk','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','isTrunkReachable'];(function(_0x4702ee,_0xaf6a45){var _0x62ca7d=function(_0x5b3af7){while(--_0x5b3af7){_0x4702ee['push'](_0x4702ee['shift']());}};_0x62ca7d(++_0xaf6a45);}(_0x57a0,0x7b));var _0x057a=function(_0x4b3dba,_0x562c7d){_0x4b3dba=_0x4b3dba-0x0;var _0x2f6480=_0x57a0[_0x4b3dba];return _0x2f6480;};'use strict';var util=require(_0x057a('0x0'));var _=require('lodash');var BPromise=require(_0x057a('0x1'));var uuid=require(_0x057a('0x2'));var moment=require('moment');var path=require(_0x057a('0x3'));var tiff2pdf=require(_0x057a('0x4'));var gs=require(_0x057a('0x5'));var logger=require(_0x057a('0x6'))('fax');var ami=require(_0x057a('0x7'));var rpcDb=require(_0x057a('0x8'));var Channel=require('./channel');var ut=require(_0x057a('0x9'));var Action=require(_0x057a('0xa'));var faxAccount=require(_0x057a('0xb'));var attachment=require(_0x057a('0xc'));var faxMessage=require(_0x057a('0xd'));function Fax(_0x322d14){this[_0x057a('0xe')]={};this[_0x057a('0xf')]=_0x322d14[_0x057a('0xf')];this['trunks']=_0x322d14[_0x057a('0x10')];this[_0x057a('0x11')]={};ami['on'](_0x057a('0x12'),this[_0x057a('0x13')][_0x057a('0x14')](this));ami['on'](_0x057a('0x15'),this[_0x057a('0x16')]['bind'](this));ami['on'](_0x057a('0x17'),this[_0x057a('0x18')][_0x057a('0x14')](this));ami['on']('newexten',this[_0x057a('0x19')][_0x057a('0x14')](this));ami['on'](_0x057a('0x1a'),this['syncFaxStatus'][_0x057a('0x14')](this));ami['on'](_0x057a('0x1b'),this[_0x057a('0x1c')][_0x057a('0x14')](this));ami['on'](_0x057a('0x1d'),this[_0x057a('0x1e')][_0x057a('0x14')](this));ami['on']('originateresponse',this[_0x057a('0x1f')][_0x057a('0x14')](this));}Fax[_0x057a('0x20')][_0x057a('0x13')]=function(_0x495335){if(_0x495335[_0x057a('0x21')]==='from-voip-provider'){for(var _0x2b90eb in this[_0x057a('0xf')]){if(this[_0x057a('0xf')][_0x057a('0x22')](_0x2b90eb)){if(_0x495335[_0x057a('0x23')]===this[_0x057a('0xf')][_0x2b90eb][_0x057a('0x24')]){this[_0x057a('0xe')][_0x495335[_0x057a('0x25')]]={};this[_0x057a('0xe')][_0x495335[_0x057a('0x25')]][_0x057a('0x26')]=_0x495335[_0x057a('0x26')];this[_0x057a('0xe')][_0x495335[_0x057a('0x25')]]['id']=this[_0x057a('0xf')][_0x2b90eb]['id'];this[_0x057a('0xe')][_0x495335['uniqueid']][_0x057a('0x27')]=this[_0x057a('0xf')][_0x2b90eb][_0x057a('0x27')];logger['info'](_0x495335[_0x057a('0x25')],_0x057a('0x28'));}}}}if(this[_0x057a('0x11')][_0x495335[_0x057a('0x25')]]){this[_0x057a('0xe')][_0x495335[_0x057a('0x25')]]={};this['channels'][_0x495335[_0x057a('0x25')]][_0x057a('0x26')]=_0x495335[_0x057a('0x26')];logger[_0x057a('0x29')](_0x495335[_0x057a('0x25')],'\x20syncNewchannel\x20');}};Fax['prototype'][_0x057a('0x16')]=function(_0x4d0741){if(this[_0x057a('0xe')][_0x4d0741[_0x057a('0x25')]]){for(var _0x3390ed in _0x4d0741[_0x057a('0x2a')]){if(_0x4d0741[_0x057a('0x2a')][_0x057a('0x22')](_0x3390ed)){this[_0x057a('0xe')][_0x4d0741[_0x057a('0x25')]][_0x3390ed]=_0x4d0741['value'];}}}};Fax[_0x057a('0x20')][_0x057a('0x18')]=function(_0x3253bf){if(this[_0x057a('0xe')][_0x3253bf[_0x057a('0x25')]]){this[_0x057a('0xe')][_0x3253bf[_0x057a('0x25')]][_0x057a('0x2b')]=_0x3253bf[_0x057a('0x2b')];this[_0x057a('0xe')][_0x3253bf[_0x057a('0x25')]][_0x057a('0x2c')]=_0x3253bf[_0x057a('0x2c')];}};Fax[_0x057a('0x20')]['syncNewExten']=function(_0x3d5b97){if(this[_0x057a('0xe')][_0x3d5b97[_0x057a('0x25')]]){for(var _0x5e8876 in _0x3d5b97[_0x057a('0x2a')]){if(_0x3d5b97[_0x057a('0x2a')][_0x057a('0x22')](_0x5e8876)){this[_0x057a('0xe')][_0x3d5b97[_0x057a('0x25')]][_0x5e8876]=_0x3d5b97[_0x057a('0x2d')];}}}};Fax[_0x057a('0x20')][_0x057a('0x2e')]=function(_0x1daae3){if(this[_0x057a('0xe')][_0x1daae3[_0x057a('0x25')]]){this['channels'][_0x1daae3['uniqueid']][_0x057a('0x2f')]=_0x1daae3['operation'];this['channels'][_0x1daae3[_0x057a('0x25')]][_0x057a('0x30')]=_0x1daae3[_0x057a('0x30')];this[_0x057a('0xe')][_0x1daae3[_0x057a('0x25')]]['localstationid']=_0x1daae3[_0x057a('0x24')];this['channels'][_0x1daae3['uniqueid']][_0x057a('0x31')]=_0x1daae3[_0x057a('0x31')];logger[_0x057a('0x29')](_0x1daae3[_0x057a('0x25')],'\x20syncFaxStatus\x20');}};Fax['prototype'][_0x057a('0x1c')]=function(_0x1a5ce7){var _0x2e6445=this;if(this[_0x057a('0xe')][_0x1a5ce7[_0x057a('0x25')]]){var _0x12612a=this[_0x057a('0xe')][_0x1a5ce7['uniqueid']]['id'];this[_0x057a('0xe')][_0x1a5ce7['uniqueid']][_0x057a('0x32')]=_0x1a5ce7[_0x057a('0x32')];this[_0x057a('0xe')][_0x1a5ce7[_0x057a('0x25')]][_0x057a('0x33')]=_0x1a5ce7['pagestransferred'];this['channels'][_0x1a5ce7['uniqueid']][_0x057a('0x24')]=_0x1a5ce7['localstationid'];this['channels'][_0x1a5ce7[_0x057a('0x25')]][_0x057a('0x34')]=_0x1a5ce7[_0x057a('0x34')];this['channels'][_0x1a5ce7['uniqueid']]['transferrate']=_0x1a5ce7['transferrate'];this[_0x057a('0xe')][_0x1a5ce7[_0x057a('0x25')]]['filename']=_0x1a5ce7[_0x057a('0x31')];this[_0x057a('0xe')][_0x1a5ce7['uniqueid']][_0x057a('0x35')]=_0x1a5ce7[_0x057a('0x35')];if(this[_0x057a('0xe')][_0x1a5ce7[_0x057a('0x25')]][_0x057a('0x33')]>0x0){tiff2pdf(_0x1a5ce7[_0x057a('0x31')],_0x057a('0x36'),function(_0x2110f3){logger['info'](_0x1a5ce7[_0x057a('0x25')],_0x057a('0x37'),_0x2110f3[_0x057a('0x38')]);attachment[_0x057a('0x39')]({'name':path[_0x057a('0x3a')](_0x1a5ce7['filename'])['name'],'basename':path[_0x057a('0x3a')](_0x1a5ce7[_0x057a('0x31')])[_0x057a('0x27')]+_0x057a('0x3b'),'type':_0x057a('0x3c')})['then'](function(_0x13fe4e){faxAccount['notify'](_0x12612a,{'from':_0x1a5ce7[_0x057a('0x35')],'mapKey':_0x057a('0x3d'),'body':path[_0x057a('0x3a')](_0x1a5ce7[_0x057a('0x31')])['name']+_0x057a('0x3b'),'AttachmentId':_0x13fe4e['id']})['catch'](function(_0x39a208){logger[_0x057a('0x3e')](_0x1a5ce7[_0x057a('0x25')],'\x20notify\x20',JSON[_0x057a('0x3f')](_0x39a208));});})[_0x057a('0x40')](function(_0x28e680){logger['error'](_0x1a5ce7[_0x057a('0x25')],'\x20receiveFax\x20',JSON[_0x057a('0x3f')](_0x28e680));});});}logger[_0x057a('0x29')](_0x1a5ce7['uniqueid'],_0x057a('0x41'));}};Fax[_0x057a('0x20')][_0x057a('0x1f')]=function(_0x321d81){if(this[_0x057a('0x11')][_0x321d81['uniqueid']]){_[_0x057a('0x42')](this[_0x057a('0xe')][_0x321d81[_0x057a('0x25')]],_['pick'](_0x321d81,[_0x057a('0x43'),_0x057a('0x44')]));}};function updateStatus(_0x1124b8){if(_0x1124b8[_0x057a('0x45')]){faxMessage[_0x057a('0x46')](_0x1124b8['AttachmentId'],{'failMessage':'SENDING\x20FAILED\x20'})[_0x057a('0x47')](function(_0x5a8c2c){ut[_0x057a('0x48')](_0x057a('0x49'),_0x5a8c2c);})['catch'](function(_0x24b7ff){ut[_0x057a('0x48')](_0x057a('0x4a'),_0x24b7ff);});}else{ut[_0x057a('0x48')](_0x057a('0x4b'));}}Fax['prototype']['updateStatus']=function(_0x2d57ee,_0x477c59,_0x8c66f8){var _0x49674f=this;var _0x16f6b8={};if(_0x477c59){_0x16f6b8={'read':_0x477c59};}else{_0x16f6b8={'failMessage':_0x8c66f8};}if(this[_0x057a('0x11')][_0x2d57ee][_0x057a('0x45')]){faxMessage[_0x057a('0x46')](this[_0x057a('0x11')][_0x2d57ee][_0x057a('0x45')],_0x16f6b8)['then'](function(_0x486ae2){ut['logger']('[Fax][Message][Updated]',_0x486ae2);})[_0x057a('0x40')](function(_0x5691ea){ut[_0x057a('0x48')](_0x057a('0x4c'),_0x5691ea);})[_0x057a('0x4d')](function(){delete _0x49674f[_0x057a('0xe')][_0x2d57ee];delete _0x49674f['actions'][_0x2d57ee];});}else{ut[_0x057a('0x48')](_0x057a('0x4e'));delete this[_0x057a('0xe')][_0x2d57ee];delete this[_0x057a('0x11')][_0x2d57ee];}};Fax[_0x057a('0x20')][_0x057a('0x1e')]=function(_0xa72a9b){var _0x358dba=this;if(this[_0x057a('0xe')][_0xa72a9b[_0x057a('0x25')]]){if(this['actions'][_0xa72a9b[_0x057a('0x25')]]){this[_0x057a('0xe')][_0xa72a9b[_0x057a('0x25')]]['id']=this['actions'][_0xa72a9b[_0x057a('0x25')]]['id'];this[_0x057a('0xe')][_0xa72a9b[_0x057a('0x25')]][_0x057a('0x27')]=this[_0x057a('0x11')][_0xa72a9b[_0x057a('0x25')]][_0x057a('0x27')];}logger[_0x057a('0x29')](_0xa72a9b['uniqueid'],this['actions'][_0xa72a9b[_0x057a('0x25')]]?'\x20hangup\x20sendFile\x20':'\x20hangup\x20faxRiceive\x20',JSON[_0x057a('0x3f')](this['channels'][_0xa72a9b['uniqueid']]));if(this[_0x057a('0x11')][_0xa72a9b['uniqueid']]){if(this[_0x057a('0xe')][_0xa72a9b[_0x057a('0x25')]][_0x057a('0x4f')]>0x0&&this[_0x057a('0xe')][_0xa72a9b['uniqueid']][_0x057a('0x1a')]==='SUCCESS'){this[_0x057a('0x50')](_0xa72a9b[_0x057a('0x25')],!![]);}else{this[_0x057a('0x50')](_0xa72a9b[_0x057a('0x25')],![],this['channels'][_0xa72a9b[_0x057a('0x25')]]['faxstatusstring']?_0x057a('0x51')+this[_0x057a('0xe')][_0xa72a9b[_0x057a('0x25')]]['faxstatusstring']:_0x057a('0x52'));}}}};Fax[_0x057a('0x20')][_0x057a('0x53')]=function(_0x3c1126){var _0x301d6f=this;return new BPromise(function(_0x4935bc,_0x5b9fe4){_0x301d6f[_0x057a('0x54')](_0x3c1126,_0x301d6f[_0x057a('0xf')][_0x3c1126[_0x057a('0x55')]])[_0x057a('0x47')](function(_0x323f74){ut[_0x057a('0x48')]('[Fax][execOriginate][success]',_0x323f74);_0x4935bc(ut[_0x057a('0x38')](_0x057a('0x56')));})[_0x057a('0x40')](function(_0x4e11fb){ut['logger'](_0x057a('0x57'),_0x4e11fb);updateStatus(_0x3c1126);_0x5b9fe4(ut[_0x057a('0x38')]('Fax\x20failed'));});});};Fax[_0x057a('0x20')][_0x057a('0x58')]=function(_0x422c7f){var _0x3850a6=this;return new BPromise(function(_0x3a3658,_0x165549){var _0x143f83=_0x3850a6[_0x057a('0x59')](_0x3850a6[_0x057a('0xf')][_0x422c7f['FaxAccountId']][_0x057a('0x5a')],_0x422c7f);if(_0x143f83['isValid']){_0x3a3658(ut[_0x057a('0x38')](_0x057a('0x5b')));}else{_0x165549(ut[_0x057a('0x38')](_0x143f83[_0x057a('0x38')]));}});};function originate(_0x3305ca,_0x5bdc41,_0x3897c9){return new BPromise(function(_0x516833,_0x574609){if(_0x3897c9){var _0x1b875e=util[_0x057a('0x5c')](_0x057a('0x5d'),path['parse'](_0x3305ca[_0x057a('0x3')])[_0x057a('0x27')],_0x3305ca[_0x057a('0x3')]);gs[_0x057a('0x5e')](_0x1b875e)['then'](function(){_0x3305ca['path']=util[_0x057a('0x5c')](_0x057a('0x5f'),path[_0x057a('0x3a')](_0x3305ca[_0x057a('0x3')])[_0x057a('0x60')],path[_0x057a('0x3a')](_0x3305ca[_0x057a('0x3')])[_0x057a('0x27')]);_0x5bdc41[_0x057a('0x61')]=_0x3305ca[_0x057a('0x3')];ut['logger'](_0x057a('0x62'),'');ami[_0x057a('0x63')](ut[_0x057a('0x64')](_0x3305ca,_0x5bdc41))[_0x057a('0x47')](function(_0x303586){_0x516833(_0x303586);})['catch'](function(_0x13e3d2){_0x574609(_0x13e3d2);});})[_0x057a('0x40')](function(_0x469c6f){_0x574609(_0x469c6f);});}else{ami[_0x057a('0x63')](ut['variablesAction'](_0x3305ca,_0x5bdc41))[_0x057a('0x47')](function(_0x42ce2a){_0x516833(_0x42ce2a);})['catch'](function(_0x8e2eb6){_0x574609(_0x8e2eb6);});}});}Fax[_0x057a('0x20')]['execOriginate']=function(_0x55a0a6,_0x2781ad){var _0x146b4b=this;return new BPromise(function(_0x43cb7c,_0x41156a){var _0x3b915b=uuid['v4']();var _0xaf220f=ut[_0x057a('0x65')](_0x55a0a6,_0x2781ad);_0x146b4b[_0x057a('0x11')][_0x3b915b]=new Action(_0x3b915b,_0x2781ad,_0x55a0a6);var _0x2d4ea1=_0x146b4b[_0x057a('0x11')][_0x3b915b];if(path[_0x057a('0x3a')](_0x55a0a6[_0x057a('0x3')])['ext']===_0x057a('0x3b')){originate(_0x2d4ea1,_0xaf220f,!![])['then'](function(_0x2ee32f){_0x43cb7c(_0x2ee32f);})[_0x057a('0x40')](function(_0x5d8e2e){_0x41156a(_0x5d8e2e);});}else{originate(_0x2d4ea1,_0xaf220f,![])[_0x057a('0x47')](function(_0x5018cd){_0x43cb7c(_0x5018cd);})[_0x057a('0x40')](function(_0x1e0020){_0x41156a(_0x1e0020);});}});};Fax[_0x057a('0x20')][_0x057a('0x66')]=function(_0x3a47bb){return!_[_0x057a('0x67')](_0x3a47bb)&&!_[_0x057a('0x67')](_0x3a47bb[_0x057a('0x27')])&&!_[_0x057a('0x67')](_0x3a47bb['active'])&&_0x3a47bb['active']&&!_['isNil'](this['trunks'][util['format']('SIP/%s',_0x3a47bb[_0x057a('0x27')])])&&!_[_0x057a('0x67')](this[_0x057a('0x10')][util[_0x057a('0x5c')](_0x057a('0x68'),_0x3a47bb[_0x057a('0x27')])][_0x057a('0x30')])&&(this['trunks'][util[_0x057a('0x5c')](_0x057a('0x68'),_0x3a47bb[_0x057a('0x27')])][_0x057a('0x30')]==='reachable'||this[_0x057a('0x10')][util[_0x057a('0x5c')]('SIP/%s',_0x3a47bb[_0x057a('0x27')])][_0x057a('0x30')]==='unmonitored');};Fax[_0x057a('0x20')][_0x057a('0x59')]=function(_0x34ac77,_0x492946){if(!this[_0x057a('0x66')](_0x34ac77)){ut['logger'](_0x057a('0x69'),_[_0x057a('0x67')](_0x34ac77)?'':_0x34ac77[_0x057a('0x27')]+_0x057a('0x6a'));return{'isValid':![],'message':_0x057a('0x6b')};}if(_['isNil'](_0x492946[_0x057a('0x3d')])){ut[_0x057a('0x48')](_0x057a('0x6c'),JSON[_0x057a('0x3f')](_0x492946));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x057a('0x67')](_0x492946[_0x057a('0x3')])){ut[_0x057a('0x48')](_0x057a('0x6d'),JSON[_0x057a('0x3f')](_0x492946));return{'isValid':![],'message':_0x057a('0x6e')};}return{'isValid':!![],'message':_0x057a('0x6f')};};module[_0x057a('0x70')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 8c0d57a..293999d 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 _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 +var _0xabbc=['../../../config/logger','preview','lodash','../rpc/faxAccount','error','notify','resolve','then','catch','[Notify]\x20','bluebird'];(function(_0xaf025d,_0x586d7a){var _0x1c77cb=function(_0x560b3a){while(--_0x560b3a){_0xaf025d['push'](_0xaf025d['shift']());}};_0x1c77cb(++_0x586d7a);}(_0xabbc,0x112));var _0xcabb=function(_0x3ce41c,_0x252d49){_0x3ce41c=_0x3ce41c-0x0;var _0x28ff40=_0xabbc[_0x3ce41c];return _0x28ff40;};'use strict';var util=require('util');var BPromise=require(_0xcabb('0x0'));var logger=require(_0xcabb('0x1'))(_0xcabb('0x2'));var _=require(_0xcabb('0x3'));var faxAccount=require(_0xcabb('0x4'));function loggerCatch(_0x11c25a){return function(_0x403369){logger[_0xcabb('0x5')](_0x11c25a,util['inspect'](_0x403369,{'showHidden':![],'depth':null}));};}exports[_0xcabb('0x6')]=function(_0x229350,_0x27941d){return BPromise[_0xcabb('0x7')]()[_0xcabb('0x8')](faxAccount[_0xcabb('0x6')](_0x229350,_0x27941d))[_0xcabb('0x9')](loggerCatch(_0xcabb('0xa')));}; \ 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 fc92fa7..6ec8552 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 _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 +var _0x3324=['execute','info','Exec\x20gs','inspect','util','../../../../config/logger','fax','bluebird','child_process','exec'];(function(_0x5e8e69,_0x1d6fbf){var _0x1946c7=function(_0x368cf0){while(--_0x368cf0){_0x5e8e69['push'](_0x5e8e69['shift']());}};_0x1946c7(++_0x1d6fbf);}(_0x3324,0x176));var _0x4332=function(_0x5ffa4b,_0x23f3e6){_0x5ffa4b=_0x5ffa4b-0x0;var _0x3af11c=_0x3324[_0x5ffa4b];return _0x3af11c;};'use strict';var util=require(_0x4332('0x0'));var logger=require(_0x4332('0x1'))(_0x4332('0x2'));var BPromise=require(_0x4332('0x3'));var exec=require(_0x4332('0x4'))[_0x4332('0x5')];exports[_0x4332('0x6')]=function(_0x1d3946){return new BPromise(function(_0x3b04e7,_0x4bc816){exec(_0x1d3946,function(_0x2f3285,_0x1a673c,_0x31266b){logger[_0x4332('0x7')]('Exec\x20gs',_0x1a673c);if(_0x2f3285){logger[_0x4332('0x7')](_0x4332('0x8'),'\x20Error\x20:',util[_0x4332('0x9')](_0x2f3285,{'showHidden':![],'depth':null}),_0x1a673c,_0x31266b);_0x4bc816(_0x2f3285);}_0x3b04e7(_0x1a673c);});});}; \ 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 9bfc3bd..cb6281b 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 _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 +var _0x6be3=['lodash','moment','../../../../config/logger','fax','logger','inspect','addVariables','ecm','minrate','maxrate','gateway','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','headerinfo','localstationid','util'];(function(_0x38f3dd,_0x35fdf2){var _0x6e4b0a=function(_0x158578){while(--_0x158578){_0x38f3dd['push'](_0x38f3dd['shift']());}};_0x6e4b0a(++_0x35fdf2);}(_0x6be3,0x175));var _0x36be=function(_0x432044,_0x35d99b){_0x432044=_0x432044-0x0;var _0x108d8d=_0x6be3[_0x432044];return _0x108d8d;};'use strict';var util=require(_0x36be('0x0'));var _=require(_0x36be('0x1'));var moment=require(_0x36be('0x2'));var logger=require(_0x36be('0x3'))(_0x36be('0x4'));exports['message']=function(_0x367177){return{'message':_0x367177};};exports[_0x36be('0x5')]=function(_0x3bae73,_0x3cbb3a){logger['info'](_0x3bae73,util[_0x36be('0x6')](_0x3cbb3a,{'showHidden':![],'depth':null}));};exports[_0x36be('0x7')]=function(_0x534f8c,_0xc63022){var _0xa73e5f={'XMF-ECM':_0xc63022[_0x36be('0x8')],'XMF-HEADERINFO':_0xc63022['headerinfo'],'XMF-MINRATE':_0xc63022[_0x36be('0x9')],'XMF-MAXRATE':_0xc63022[_0x36be('0xa')],'XMF-MODEM':util['format']('\x22%s\x22',_0xc63022['modem']),'XMF-GATEWAY':_0xc63022[_0x36be('0xb')],'XMF-FAXDETECT':_0xc63022['faxdetect'],'XMF-T38TIMEOUT':_0xc63022['t38timeout'],'XMF-LOCALSTATIONID':_0xc63022['localstationid'],'XMF-PATH':_0x534f8c[_0x36be('0xc')]};return _0xa73e5f;};exports[_0x36be('0xd')]=function(_0x10cc5e,_0x14ccdf){return{'actionid':_0x10cc5e[_0x36be('0xe')],'action':_0x36be('0xf'),'channel':_0x10cc5e[_0x36be('0x10')],'Exten':_0x36be('0x11'),'Context':_0x36be('0x12'),'Priority':'1','callerid':util['format'](_0x36be('0x13'),_0x10cc5e['headerinfo']?_0x10cc5e[_0x36be('0x14')]:'',_0x10cc5e[_0x36be('0x15')]),'variable':_0x14ccdf,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x10cc5e[_0x36be('0xe')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index d3e9042..5a72c00 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 _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 +var _0xa735=['[index.js][main]','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/template','./rpc/cmHopperHistory','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/servicenow','../../config/logger','ami','get','hour','resolve','then','getAgents','getTelephones','initTelephones','getTrunks','initTrunks','initVoiceQueues','initTriggers','getTemplates','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','initVoiceCallReports','catch','error','[index.js][initParams]','inspect','listen','sync'];(function(_0x23ce2a,_0x33a0ba){var _0x4eb9d7=function(_0x27744b){while(--_0x27744b){_0x23ce2a['push'](_0x23ce2a['shift']());}};_0x4eb9d7(++_0x33a0ba);}(_0xa735,0x8f));var _0x5a73=function(_0x5c770f,_0x99b1ad){_0x5c770f=_0x5c770f-0x0;var _0xb30174=_0xa735[_0x5c770f];return _0xb30174;};'use strict';var util=require('util');var moment=require(_0x5a73('0x0'));var server=require(_0x5a73('0x1'));var Realtime=require(_0x5a73('0x2'));var Report=require(_0x5a73('0x3'));var Acw=require(_0x5a73('0x4'));var Trigger=require(_0x5a73('0x5'));var Dialer=require(_0x5a73('0x6'));var Preview=require('./preview');var Fax=require(_0x5a73('0x7'));var user=require(_0x5a73('0x8'));var voiceQueue=require(_0x5a73('0x9'));var voiceQueueReport=require(_0x5a73('0xa'));var voiceCallReport=require(_0x5a73('0xb'));var trunk=require('./rpc/trunk');var trigger=require('./rpc/trigger');var template=require(_0x5a73('0xc'));var cmHopperHistory=require(_0x5a73('0xd'));var campaign=require('./rpc/campaign');var voiceExtension=require(_0x5a73('0xe'));var faxAccount=require(_0x5a73('0xf'));var zendesk=require(_0x5a73('0x10'));var salesforce=require(_0x5a73('0x11'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x5a73('0x12'));var desk=require(_0x5a73('0x13'));var zoho=require(_0x5a73('0x14'));var vtiger=require(_0x5a73('0x15'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0x5a73('0x16'));var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x5a73('0x17'))(_0x5a73('0x18'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x5a73('0x19')](_0x5a73('0x1a'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0x5a73('0x1a'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x5a73('0x1b')]()[_0x5a73('0x1c')](user[_0x5a73('0x1d')]())['then'](realtime['initAgents']())[_0x5a73('0x1c')](user[_0x5a73('0x1e')]())['then'](realtime[_0x5a73('0x1f')]())['then'](trunk[_0x5a73('0x20')]())['then'](realtime[_0x5a73('0x21')]())[_0x5a73('0x1c')](voiceQueue['getVoiceQueues']())[_0x5a73('0x1c')](realtime[_0x5a73('0x22')]())[_0x5a73('0x1c')](trigger['getTriggers']())[_0x5a73('0x1c')](realtime[_0x5a73('0x23')]())[_0x5a73('0x1c')](template[_0x5a73('0x24')]())['then'](realtime['initTemplates']())[_0x5a73('0x1c')](zendesk['getZendeskAccounts']())[_0x5a73('0x1c')](realtime['initZendeskAccounts']())[_0x5a73('0x1c')](salesforce[_0x5a73('0x25')]())[_0x5a73('0x1c')](realtime[_0x5a73('0x26')]())[_0x5a73('0x1c')](sugarcrm[_0x5a73('0x27')]())[_0x5a73('0x1c')](realtime[_0x5a73('0x28')]())[_0x5a73('0x1c')](freshdesk[_0x5a73('0x29')]())[_0x5a73('0x1c')](realtime[_0x5a73('0x2a')]())['then'](desk[_0x5a73('0x2b')]())[_0x5a73('0x1c')](realtime[_0x5a73('0x2c')]())['then'](zoho[_0x5a73('0x2d')]())[_0x5a73('0x1c')](realtime[_0x5a73('0x2e')]())['then'](vtiger[_0x5a73('0x2f')]())[_0x5a73('0x1c')](realtime[_0x5a73('0x30')]())[_0x5a73('0x1c')](freshsales[_0x5a73('0x31')]())[_0x5a73('0x1c')](realtime[_0x5a73('0x32')]())['then'](servicenow[_0x5a73('0x33')]())[_0x5a73('0x1c')](realtime[_0x5a73('0x34')]())[_0x5a73('0x1c')](dynamics365[_0x5a73('0x35')]())[_0x5a73('0x1c')](realtime['initDynamics365Accounts']())[_0x5a73('0x1c')](campaign[_0x5a73('0x36')]())[_0x5a73('0x1c')](realtime[_0x5a73('0x37')]())['then'](voiceExtension[_0x5a73('0x38')]())[_0x5a73('0x1c')](realtime[_0x5a73('0x39')]())['then'](faxAccount[_0x5a73('0x3a')]())['then'](realtime[_0x5a73('0x3b')]())[_0x5a73('0x1c')](function(){return realtime;});}function initParams(){return Promise[_0x5a73('0x1b')]()[_0x5a73('0x1c')](voiceQueueReport['getVoiceQueueReports']())['then'](realtime['initVoiceQueueReports']())[_0x5a73('0x1c')](cmHopperHistory[_0x5a73('0x3c')]())[_0x5a73('0x1c')](realtime['initVoiceQueueHopperHistory']())[_0x5a73('0x1c')](cmHopperHistory[_0x5a73('0x3d')]())[_0x5a73('0x1c')](realtime[_0x5a73('0x3e')]())[_0x5a73('0x1c')](voiceCallReport['getVoiceCallReports']())[_0x5a73('0x1c')](realtime[_0x5a73('0x3f')]())[_0x5a73('0x40')](function(_0x5a798b){logger[_0x5a73('0x41')](_0x5a73('0x42'),util[_0x5a73('0x43')](_0x5a798b,{'showHidden':![],'depth':null}));});}function main(){return server[_0x5a73('0x44')](realtime,preview,fax)[_0x5a73('0x1c')](function(){return initRealtime();})[_0x5a73('0x1c')](function(){return initParams();})[_0x5a73('0x1c')](function(){report[_0x5a73('0x45')]();setInterval(initRealtime,0x1388);})[_0x5a73('0x40')](function(_0x571c17){logger[_0x5a73('0x41')](_0x5a73('0x46'),util[_0x5a73('0x43')](_0x571c17,{'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 4fe1cbe..44eba21 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 _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 +var _0x899d=['user:%s','user:presence','lodash','util','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','email','accountcode','fullname','stateTime','status','unknown','address','phone','mobile','interface','online','voiceStatus','voiceStatusCallerIdNumber','voiceStatusQueue','local','prototype','state','toLowerCase','idle','talking','voiceStatusTime','toNumber','format','onhold','stringify'];(function(_0x2dbb3e,_0x2686b5){var _0x211782=function(_0x1c7ed2){while(--_0x1c7ed2){_0x2dbb3e['push'](_0x2dbb3e['shift']());}};_0x211782(++_0x2686b5);}(_0x899d,0x1b2));var _0xd899=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x899d[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0xd899('0x0'));var util=require(_0xd899('0x1'));var moment=require('moment');var md5=require(_0xd899('0x2'));var Redis=require(_0xd899('0x3'));var config=require(_0xd899('0x4'));config['redis']=_['defaults'](config[_0xd899('0x5')],{'host':_0xd899('0x6'),'port':0x18eb});var io=require(_0xd899('0x7'))(new Redis(config[_0xd899('0x5')]));function Agent(_0x3e9250){this['id']=_0x3e9250['id']||0x0;this[_0xd899('0x8')]=_0x3e9250['name']||'';this[_0xd899('0x9')]=_0x3e9250['email']||'';this[_0xd899('0xa')]=_0x3e9250[_0xd899('0xa')]||'';this['fullname']=_0x3e9250[_0xd899('0xb')]||'';this['state']='unknown';this[_0xd899('0xc')]=0x0;this[_0xd899('0xd')]=_0xd899('0xe');this[_0xd899('0xf')]='';this[_0xd899('0x10')]='';this[_0xd899('0x11')]='';this[_0xd899('0x12')]='';this[_0xd899('0x13')]=_0x3e9250[_0xd899('0x13')]||![];this[_0xd899('0x14')]=_0xd899('0xe');this['voiceStatusTime']=0x0;this[_0xd899('0x15')]='';this[_0xd899('0x16')]='';this['onhold']=![];this[_0xd899('0x17')]=![];this[_0xd899('0x2')]='';}Agent[_0xd899('0x18')]['updateStatusRealtime']=function(_0x49fb96){var _0x47b694;if(_0x49fb96&&_0x49fb96['state']){_0x47b694=_0x49fb96[_0xd899('0x19')][_0xd899('0x1a')]();switch(_0x47b694){case'not_inuse':_0x47b694=_0xd899('0x1b');break;case'inuse':_0x47b694=_0xd899('0x1c');break;}}if(_0x47b694&&this[_0xd899('0x14')]!==_0x47b694||_0x49fb96['statePause']){this[_0xd899('0x1d')]=_[_0xd899('0x1e')](moment()[_0xd899('0x1f')]('x'));}if(_0x47b694){this['voiceStatus']=_0x47b694;}var _0x2be8ac={'id':this['id'],'name':this[_0xd899('0x8')],'email':this[_0xd899('0x9')],'accountcode':this[_0xd899('0xa')],'fullname':this['fullname'],'state':this[_0xd899('0x19')],'stateTime':this[_0xd899('0xc')],'status':this['status'],'address':this[_0xd899('0xf')],'online':this[_0xd899('0x13')],'voiceStatus':this[_0xd899('0x14')],'voiceStatusTime':this[_0xd899('0x1d')],'voiceStatusCallerIdNumber':this[_0xd899('0x15')],'voiceStatusQueue':this[_0xd899('0x16')],'interface':this['interface'],'onhold':this[_0xd899('0x20')]};var _0x3e815d=md5(JSON[_0xd899('0x21')](_0x2be8ac));if(this[_0xd899('0x2')]!==_0x3e815d){this[_0xd899('0x2')]=_0x3e815d;io['to'](util[_0xd899('0x1f')](_0xd899('0x22'),_0x2be8ac[_0xd899('0x8')]))['emit']('user:ami:update',_['omit'](_0x2be8ac,['online']));io['emit'](_0xd899('0x23'),_0x2be8ac);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 048ee93..82263d3 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 _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 +var _0xc5c8=['dialMachineMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','temp','ivrAnswerCallsDay','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdNumber','dialCongestionMaxRetry','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency'];(function(_0x54d4fe,_0x55e869){var _0x1ab5bb=function(_0x5b1af2){while(--_0x5b1af2){_0x54d4fe['push'](_0x54d4fe['shift']());}};_0x1ab5bb(++_0x55e869);}(_0xc5c8,0x118));var _0x8c5c=function(_0x315891,_0x9c8855){_0x315891=_0x315891-0x0;var _0x421487=_0xc5c8[_0x315891];return _0x421487;};'use strict';function Campaign(_0x4634f3){this['id']=_0x4634f3['id']||0x0;this[_0x8c5c('0x0')]=_0x4634f3[_0x8c5c('0x0')]||'';this['type']=_0x4634f3[_0x8c5c('0x1')]||'campaign';this['originated']=0x0;this[_0x8c5c('0x2')]=0x0;this[_0x8c5c('0x3')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0x8c5c('0x4')]='';this[_0x8c5c('0x5')]=!![];this[_0x8c5c('0x6')]=_0x4634f3[_0x8c5c('0x6')];this[_0x8c5c('0x7')]=_0x4634f3[_0x8c5c('0x7')];this[_0x8c5c('0x8')]=_0x4634f3[_0x8c5c('0x8')]||null;this[_0x8c5c('0x9')]=_0x4634f3[_0x8c5c('0x9')]?_0x4634f3['dialGlobalInterval']:null;this['dialOriginateCallerIdName']=_0x4634f3['dialOriginateCallerIdName'];this[_0x8c5c('0xa')]=_0x4634f3[_0x8c5c('0xa')];this['dialOriginateTimeout']=_0x4634f3['dialOriginateTimeout']||0x1e;this[_0x8c5c('0xb')]=_0x4634f3[_0x8c5c('0xb')];this['dialCongestionRetryFrequency']=_0x4634f3['dialCongestionRetryFrequency'];this[_0x8c5c('0xc')]=_0x4634f3[_0x8c5c('0xc')];this['dialBusyRetryFrequency']=_0x4634f3['dialBusyRetryFrequency'];this[_0x8c5c('0xd')]=_0x4634f3[_0x8c5c('0xd')];this[_0x8c5c('0xe')]=_0x4634f3['dialNoAnswerRetryFrequency'];this[_0x8c5c('0xf')]=_0x4634f3[_0x8c5c('0xf')];this['dialNoSuchNumberMaxRetry']=_0x4634f3['dialNoSuchNumberMaxRetry']||0x3;this[_0x8c5c('0x10')]=_0x4634f3['dialNoSuchNumberRetryFrequency']||0x96;this[_0x8c5c('0x11')]=_0x4634f3[_0x8c5c('0x11')]||0x3;this[_0x8c5c('0x12')]=_0x4634f3[_0x8c5c('0x12')]||0x96;this[_0x8c5c('0x13')]=_0x4634f3[_0x8c5c('0x13')]||0x3;this[_0x8c5c('0x14')]=_0x4634f3[_0x8c5c('0x14')]||0x96;this[_0x8c5c('0x15')]=_0x4634f3[_0x8c5c('0x15')]||0x3;this['dialMachineRetryFrequency']=_0x4634f3['dialMachineRetryFrequency']||0x96;this['dialAgentRejectMaxRetry']=_0x4634f3['dialAgentRejectMaxRetry']||0x3;this[_0x8c5c('0x16')]=_0x4634f3['dialAgentRejectRetryFrequency']||0x96;this[_0x8c5c('0x17')]=_0x4634f3[_0x8c5c('0x17')]||_0x8c5c('0x18');this[_0x8c5c('0x19')]=_0x4634f3[_0x8c5c('0x19')]||undefined;this[_0x8c5c('0x1a')]=_0x4634f3[_0x8c5c('0x1a')]||undefined;this[_0x8c5c('0x1b')]=_0x4634f3[_0x8c5c('0x1b')]||undefined;this[_0x8c5c('0x1c')]=_0x4634f3['TrunkBackup']?_0x4634f3[_0x8c5c('0x1c')]:undefined;this[_0x8c5c('0x1d')]=_0x4634f3[_0x8c5c('0x1d')]?_0x4634f3['Trunk']:undefined;this[_0x8c5c('0x1e')]=_0x4634f3['Interval']?_0x4634f3['Interval']:undefined;this['SquareProject']=_0x4634f3[_0x8c5c('0x1f')]?_0x4634f3[_0x8c5c('0x1f')]:undefined;this[_0x8c5c('0x20')]=_0x4634f3[_0x8c5c('0x1f')]?_0x4634f3[_0x8c5c('0x1f')]['name']:undefined;this['dialAMDActive']=_0x4634f3['dialAMDActive']||![];this[_0x8c5c('0x21')]=_0x4634f3[_0x8c5c('0x21')];this[_0x8c5c('0x22')]=_0x4634f3[_0x8c5c('0x22')];this[_0x8c5c('0x23')]=_0x4634f3[_0x8c5c('0x23')];this[_0x8c5c('0x24')]=_0x4634f3[_0x8c5c('0x24')];this[_0x8c5c('0x25')]=_0x4634f3[_0x8c5c('0x25')];this[_0x8c5c('0x26')]=_0x4634f3[_0x8c5c('0x26')];this[_0x8c5c('0x27')]=_0x4634f3['dialAMDMaximumNumberOfWords'];this[_0x8c5c('0x28')]=_0x4634f3['dialAMDSilenceThreshold'];this[_0x8c5c('0x29')]=_0x4634f3[_0x8c5c('0x29')];}module[_0x8c5c('0x2a')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 174046c..8f740c3 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 _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 +var _0xf8ff=['exports','destinationchannel','calleridname','connectedlinenum','connectedlinename','uniqueid','exten','answered','answertime','unmanaged','abandoned','lastapplication','duration','type','tag','disposition','monitor','queue','monitors','transfercalleridnum','transferType'];(function(_0xd9bd90,_0x442aac){var _0x10482a=function(_0x29881b){while(--_0x29881b){_0xd9bd90['push'](_0xd9bd90['shift']());}};_0x10482a(++_0x442aac);}(_0xf8ff,0x127));var _0xff8f=function(_0x35b18a,_0x6b2fbe){_0x35b18a=_0x35b18a-0x0;var _0x4db1bd=_0xf8ff[_0x35b18a];return _0x4db1bd;};'use strict';function Channel(){this['starttime']=null;this['channel']='';this[_0xff8f('0x0')]='';this['calleridnum']=0x0;this[_0xff8f('0x1')]='';this[_0xff8f('0x2')]=undefined;this[_0xff8f('0x3')]=undefined;this['accountcode']=0x0;this['context']='';this[_0xff8f('0x4')]=0x0;this['linkedid']=0x0;this[_0xff8f('0x5')]=0x0;this[_0xff8f('0x6')]=![];this[_0xff8f('0x7')]=null;this['endtime']=null;this[_0xff8f('0x8')]=![];this[_0xff8f('0x9')]=![];this[_0xff8f('0xa')]='';this['lastdata']='';this[_0xff8f('0xb')]=0x0;this['billableseconds']=0x0;this['holdtime']=0x0;this[_0xff8f('0xc')]=null;this[_0xff8f('0xd')]=null;this[_0xff8f('0xe')]=null;this[_0xff8f('0xf')]=![];this['monitorFilename']=null;this[_0xff8f('0x10')]=null;this[_0xff8f('0x11')]=[];this[_0xff8f('0x12')]=undefined;this['transferconnectedlinenum']=undefined;this[_0xff8f('0x13')]=undefined;this['mohtime']=0x0;}module[_0xff8f('0x14')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 357c920..9f5184c 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 _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 +var _0x39ed=['username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name'];(function(_0xcb20f4,_0x1b4313){var _0x36f3b1=function(_0x18f7d1){while(--_0x18f7d1){_0xcb20f4['push'](_0xcb20f4['shift']());}};_0x36f3b1(++_0x1b4313);}(_0x39ed,0x1b9));var _0xd39e=function(_0x59a027,_0x7abab4){_0x59a027=_0x59a027-0x0;var _0x5b5590=_0x39ed[_0x59a027];return _0x5b5590;};'use strict';function DeskAccount(_0x262f27){this['id']=_0x262f27['id']||0x0;this[_0xd39e('0x0')]=_0x262f27[_0xd39e('0x0')]||'';this['username']=_0x262f27[_0xd39e('0x1')]||'';this[_0xd39e('0x2')]=_0x262f27[_0xd39e('0x2')]||'';this[_0xd39e('0x3')]=_0x262f27[_0xd39e('0x3')]||'';this[_0xd39e('0x4')]=_0x262f27[_0xd39e('0x4')]||'';this[_0xd39e('0x5')]=_0x262f27[_0xd39e('0x5')]||'';this['consumerSecret']=_0x262f27[_0xd39e('0x6')]||'';this['token']=_0x262f27[_0xd39e('0x7')]||'';this[_0xd39e('0x8')]=_0x262f27['tokenSecret']||'';this[_0xd39e('0x9')]=_0x262f27[_0xd39e('0x9')]||'';this['serverUrl']=_0x262f27[_0xd39e('0xa')]||'';this[_0xd39e('0xb')]=_0x262f27[_0xd39e('0xb')]||{};}module[_0xd39e('0xc')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index b1bc4ec..fe490e9 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 _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 +var _0xba4b=['name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider'];(function(_0x30961e,_0x16a0b2){var _0x1effe2=function(_0x2f4e82){while(--_0x2f4e82){_0x30961e['push'](_0x30961e['shift']());}};_0x1effe2(++_0x16a0b2);}(_0xba4b,0x18c));var _0xbba4=function(_0x2ffaea,_0x43f64b){_0x2ffaea=_0x2ffaea-0x0;var _0x180ef8=_0xba4b[_0x2ffaea];return _0x180ef8;};'use strict';function Dynamics365Account(_0x4d1d24){this['id']=_0x4d1d24['id']||0x0;this[_0xbba4('0x0')]=_0x4d1d24[_0xbba4('0x0')]||'';this['username']=_0x4d1d24[_0xbba4('0x1')]||'';this['password']=_0x4d1d24[_0xbba4('0x2')]||'';this[_0xbba4('0x3')]=_0x4d1d24[_0xbba4('0x3')]||'';this[_0xbba4('0x4')]=_0x4d1d24[_0xbba4('0x4')]||'';this['clientId']=_0x4d1d24[_0xbba4('0x5')]||'';this['clientSecret']=_0x4d1d24[_0xbba4('0x6')]||{};this[_0xbba4('0x7')]=_0x4d1d24[_0xbba4('0x7')]||'';this[_0xbba4('0x8')]=_0x4d1d24[_0xbba4('0x8')]||![];this[_0xbba4('0x9')]=_0x4d1d24[_0xbba4('0x9')]||{};this[_0xbba4('0xa')]=_0x4d1d24[_0xbba4('0xa')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 0c4e393..2b36150 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 _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 +var _0xdfa8=['description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','tech','SIP','Trunk','ListId','key','exports','name'];(function(_0xd1ce83,_0x4199ec){var _0x51aabb=function(_0xa05538){while(--_0xa05538){_0xd1ce83['push'](_0xd1ce83['shift']());}};_0x51aabb(++_0x4199ec);}(_0xdfa8,0xef));var _0x8dfa=function(_0x792fd5,_0x2b6674){_0x792fd5=_0x792fd5-0x0;var _0xf5f849=_0xdfa8[_0x792fd5];return _0xf5f849;};'use strict';function FaxAccount(_0x203a26){this['id']=_0x203a26['id']||0x0;this[_0x8dfa('0x0')]=_0x203a26[_0x8dfa('0x0')]||'';this['description']=_0x203a26[_0x8dfa('0x1')];this['ecm']=_0x203a26[_0x8dfa('0x2')];this[_0x8dfa('0x3')]=_0x203a26['headerinfo'];this[_0x8dfa('0x4')]=_0x203a26[_0x8dfa('0x4')];this[_0x8dfa('0x5')]=_0x203a26['minrate']||0x960;this['maxrate']=_0x203a26[_0x8dfa('0x6')]||0x3840;this['modem']=_0x203a26[_0x8dfa('0x7')]||_0x8dfa('0x8');this[_0x8dfa('0x9')]=_0x203a26[_0x8dfa('0x9')]||'no';this['faxdetect']=_0x203a26['faxdetect']||'no';this['t38timeout']=_0x203a26['t38timeout']||0x1388;this['tech']=_0x203a26[_0x8dfa('0xa')]||_0x8dfa('0xb');this[_0x8dfa('0xc')]=_0x203a26[_0x8dfa('0xc')]?_0x203a26[_0x8dfa('0xc')]:undefined;this[_0x8dfa('0xd')]=_0x203a26['ListId'];this['key']=_0x203a26[_0x8dfa('0xe')];}module[_0x8dfa('0xf')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index e763f21..6ba27c5 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 _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 +var _0xfaa0=['remoteUri','serverUrl','Configurations','name','username','apiKey','token'];(function(_0x8d794b,_0x596d74){var _0x325de0=function(_0x5596bd){while(--_0x5596bd){_0x8d794b['push'](_0x8d794b['shift']());}};_0x325de0(++_0x596d74);}(_0xfaa0,0x176));var _0x0faa=function(_0xb4907,_0x22833b){_0xb4907=_0xb4907-0x0;var _0x1fd025=_0xfaa0[_0xb4907];return _0x1fd025;};'use strict';function FreshdeskAccount(_0x4470a0){this['id']=_0x4470a0['id']||0x0;this[_0x0faa('0x0')]=_0x4470a0[_0x0faa('0x0')]||'';this[_0x0faa('0x1')]=_0x4470a0[_0x0faa('0x1')]||'';this[_0x0faa('0x2')]=_0x4470a0[_0x0faa('0x3')]||'';this['remoteUri']=_0x4470a0[_0x0faa('0x4')]||'';this[_0x0faa('0x5')]=_0x4470a0['serverUrl']||'';this[_0x0faa('0x6')]=_0x4470a0[_0x0faa('0x6')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 5d1f934..a63027f 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 _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 +var _0xf8af=['exports','name','username','apiKey','remoteUri','serverUrl'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0xf8af,0x8b));var _0xff8a=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xf8af[_0x138adb];return _0x1b27f2;};'use strict';function FreshsalesAccount(_0x5e9d11){this['id']=_0x5e9d11['id']||0x0;this['name']=_0x5e9d11[_0xff8a('0x0')]||'';this[_0xff8a('0x1')]=_0x5e9d11[_0xff8a('0x1')]||'';this[_0xff8a('0x2')]=_0x5e9d11['token']||'';this[_0xff8a('0x3')]=_0x5e9d11[_0xff8a('0x3')]||'';this[_0xff8a('0x4')]=_0x5e9d11[_0xff8a('0x4')]||'';this['Configurations']=_0x5e9d11['Configurations']||{};}module[_0xff8a('0x5')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 48550c9..12db9a6 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 _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 +var _0x2f6d=['assigned','lastAssignedTo','motionChannel','voice','routealias','variables','type','inbound','uniqueid','calleridnum','queuecallerjoinAt','queuecallerleaveAt','count','queuecallerabandon','queuecallerabandonAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinename','accountcode','exten','priority','holdtime'];(function(_0x57f91d,_0x1fac70){var _0x4e3145=function(_0x1a93a8){while(--_0x1a93a8){_0x57f91d['push'](_0x57f91d['shift']());}};_0x4e3145(++_0x1fac70);}(_0x2f6d,0x156));var _0xd2f6=function(_0x29a9ad,_0x120e29){_0x29a9ad=_0x29a9ad-0x0;var _0x16b989=_0x2f6d[_0x29a9ad];return _0x16b989;};'use strict';function QueueReport(){this[_0xd2f6('0x0')]=_0xd2f6('0x1');this[_0xd2f6('0x2')]='';this[_0xd2f6('0x3')]='';this['calleridname']='';this['queue']='';this[_0xd2f6('0x4')]=null;this[_0xd2f6('0x5')]=null;this['position']=0x1;this[_0xd2f6('0x6')]=0x1;this[_0xd2f6('0x7')]=![];this[_0xd2f6('0x8')]=null;this['queuecallercomplete']=![];this['queuecallercompleteAt']=null;this[_0xd2f6('0x9')]=![];this[_0xd2f6('0xa')]=null;this[_0xd2f6('0xb')]=0x1;this[_0xd2f6('0xc')]='';this['connectedlinenum']='';this[_0xd2f6('0xd')]='';this[_0xd2f6('0xe')]='';this['context']='';this[_0xd2f6('0xf')]='';this[_0xd2f6('0x10')]='';this[_0xd2f6('0x11')]=0x0;this[_0xd2f6('0x12')]=![];this[_0xd2f6('0x13')]='';this[_0xd2f6('0x14')]=_0xd2f6('0x15');this[_0xd2f6('0x16')]=null;this['mohtime']=0x0;this[_0xd2f6('0x17')]={};}module['exports']=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 81cc277..0243249 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 _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 +var _0x3147=['name','username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports'];(function(_0x5d842e,_0x3840d8){var _0x1bc267=function(_0x4a70a4){while(--_0x4a70a4){_0x5d842e['push'](_0x5d842e['shift']());}};_0x1bc267(++_0x3840d8);}(_0x3147,0x1b0));var _0x7314=function(_0x31b508,_0x32050f){_0x31b508=_0x31b508-0x0;var _0x37a8de=_0x3147[_0x31b508];return _0x37a8de;};'use strict';function SalesforceAccount(_0x15fb6e){this['id']=_0x15fb6e['id']||0x0;this[_0x7314('0x0')]=_0x15fb6e[_0x7314('0x0')]||'';this[_0x7314('0x1')]=_0x15fb6e[_0x7314('0x1')]||'';this[_0x7314('0x2')]=_0x15fb6e[_0x7314('0x2')]||'';this[_0x7314('0x3')]=_0x15fb6e[_0x7314('0x3')]||'';this['clientId']=_0x15fb6e[_0x7314('0x4')]||'';this[_0x7314('0x5')]=_0x15fb6e[_0x7314('0x5')]||'';this['securityToken']=_0x15fb6e[_0x7314('0x6')]||'';this[_0x7314('0x7')]=_0x15fb6e[_0x7314('0x7')]||_0x7314('0x8');this[_0x7314('0x9')]=_0x15fb6e[_0x7314('0x9')]||'';this[_0x7314('0xa')]=_0x15fb6e[_0x7314('0xa')]||{};}module[_0x7314('0xb')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index da53c44..1553465 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 _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 +var _0x992a=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x425e1c,_0x4f1018){var _0x132ac9=function(_0x5728e5){while(--_0x5728e5){_0x425e1c['push'](_0x425e1c['shift']());}};_0x132ac9(++_0x4f1018);}(_0x992a,0x1d2));var _0xa992=function(_0x3a9635,_0x1ab817){_0x3a9635=_0x3a9635-0x0;var _0x10d08c=_0x992a[_0x3a9635];return _0x10d08c;};'use strict';function ServicenowAccount(_0x2ff737){this['id']=_0x2ff737['id']||0x0;this[_0xa992('0x0')]=_0x2ff737[_0xa992('0x0')]||'';this[_0xa992('0x1')]=_0x2ff737[_0xa992('0x1')]||'';this[_0xa992('0x2')]=_0x2ff737['password']||'';this[_0xa992('0x3')]=_0x2ff737[_0xa992('0x3')]||'';this[_0xa992('0x4')]=_0x2ff737[_0xa992('0x4')]||'';this[_0xa992('0x5')]=_0x2ff737[_0xa992('0x5')]||{};}module[_0xa992('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 7f0c1ab..e355e5e 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 _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 +var _0x8bc1=['remoteUri','serverUrl','Configurations','exports','name','password'];(function(_0x52d91c,_0x534604){var _0x3e0cce=function(_0x31e7d3){while(--_0x31e7d3){_0x52d91c['push'](_0x52d91c['shift']());}};_0x3e0cce(++_0x534604);}(_0x8bc1,0x154));var _0x18bc=function(_0x586ee3,_0x1691c1){_0x586ee3=_0x586ee3-0x0;var _0xc2ae7d=_0x8bc1[_0x586ee3];return _0xc2ae7d;};'use strict';function SugarcrmAccount(_0x1c6444){this['id']=_0x1c6444['id']||0x0;this[_0x18bc('0x0')]=_0x1c6444['name']||'';this['username']=_0x1c6444['username']||'';this[_0x18bc('0x1')]=_0x1c6444[_0x18bc('0x1')]||'';this['remoteUri']=_0x1c6444[_0x18bc('0x2')]||'';this[_0x18bc('0x3')]=_0x1c6444[_0x18bc('0x3')]||'';this[_0x18bc('0x4')]=_0x1c6444[_0x18bc('0x4')]||{};}module[_0x18bc('0x5')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index c75db44..5556448 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 _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 +var _0x18b7=['unknown','stateTime','status','address','exports','name','accountcode','state'];(function(_0x3070a1,_0x3c4f2f){var _0x149bf6=function(_0x517dd6){while(--_0x517dd6){_0x3070a1['push'](_0x3070a1['shift']());}};_0x149bf6(++_0x3c4f2f);}(_0x18b7,0x155));var _0x718b=function(_0x26b95f,_0x50ac9f){_0x26b95f=_0x26b95f-0x0;var _0x8cd23e=_0x18b7[_0x26b95f];return _0x8cd23e;};'use strict';function Telephone(_0x3abef0){this['id']=_0x3abef0['id']||0x0;this[_0x718b('0x0')]=_0x3abef0[_0x718b('0x0')]||'';this[_0x718b('0x1')]=_0x3abef0[_0x718b('0x1')]||'';this[_0x718b('0x2')]=_0x718b('0x3');this[_0x718b('0x4')]=0x0;this[_0x718b('0x5')]=_0x718b('0x3');this[_0x718b('0x6')]='';}module[_0x718b('0x7')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index c1cad88..c993bf7 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(_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 +var _0xb10b=['name','html'];(function(_0x236550,_0x16eb0d){var _0x5b0b12=function(_0x38702b){while(--_0x38702b){_0x236550['push'](_0x236550['shift']());}};_0x5b0b12(++_0x16eb0d);}(_0xb10b,0x12a));var _0xbb10=function(_0x38ff2b,_0x3a0316){_0x38ff2b=_0x38ff2b-0x0;var _0x341f5e=_0xb10b[_0x38ff2b];return _0x341f5e;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index ffff066..0af110e 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 _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 +var _0x757a=['name','status','AllConditions','AnyConditions','Actions','exports'];(function(_0x425e71,_0xe0f830){var _0x4999b7=function(_0x3941a7){while(--_0x3941a7){_0x425e71['push'](_0x425e71['shift']());}};_0x4999b7(++_0xe0f830);}(_0x757a,0xde));var _0xa757=function(_0x312642,_0x3c3d19){_0x312642=_0x312642-0x0;var _0xfb2d00=_0x757a[_0x312642];return _0xfb2d00;};'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 diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 57b436f..f73ba95 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 _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 +var _0xb936=['host','port','domainport','refresh','stateRegistry','registrationtime','address','defaultuser','exports','active','name','unknown','stateTime','status','registry','indexOf','split'];(function(_0x4c1e2e,_0x33f1c5){var _0x27842d=function(_0x4bcc25){while(--_0x4bcc25){_0x4c1e2e['push'](_0x4c1e2e['shift']());}};_0x27842d(++_0x33f1c5);}(_0xb936,0x12a));var _0x6b93=function(_0x452063,_0x104880){_0x452063=_0x452063-0x0;var _0x2223e8=_0xb936[_0x452063];return _0x2223e8;};'use strict';function Trunk(_0x241e2a){this['id']=_0x241e2a['id']||0x0;this['active']=_0x241e2a[_0x6b93('0x0')]||![];this['name']=_0x241e2a[_0x6b93('0x1')]||'';this['state']=_0x6b93('0x2');this[_0x6b93('0x3')]=0x0;this[_0x6b93('0x4')]=_0x6b93('0x2');this[_0x6b93('0x5')]=_0x241e2a[_0x6b93('0x5')]&&_0x241e2a[_0x6b93('0x5')][_0x6b93('0x6')](':')?_0x241e2a[_0x6b93('0x5')][_0x6b93('0x7')](':')[0x0]:'';this[_0x6b93('0x8')]='';this[_0x6b93('0x9')]='';this['domain']='';this[_0x6b93('0xa')]='';this[_0x6b93('0xb')]='';this[_0x6b93('0xc')]=_0x6b93('0x2');this[_0x6b93('0xd')]='';this[_0x6b93('0xe')]='';this[_0x6b93('0xf')]=_0x241e2a[_0x6b93('0xf')]||'';}module[_0x6b93('0x10')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index a501d84..b4ba8a1 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 _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 +var _0x98e4=['recordingFormat','none','exports','exten'];(function(_0xdad237,_0x361a1d){var _0x15c575=function(_0x8db2f6){while(--_0x8db2f6){_0xdad237['push'](_0xdad237['shift']());}};_0x15c575(++_0x361a1d);}(_0x98e4,0x8b));var _0x498e=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x98e4[_0x4b2863];return _0x567d67;};'use strict';function voiceExtension(_0x3864fe){this['id']=_0x3864fe['id']||0x0;this[_0x498e('0x0')]=_0x3864fe[_0x498e('0x0')]||'';this[_0x498e('0x1')]=_0x3864fe['recordingFormat']||_0x498e('0x2');this['mandatoryDisposition']=_0x3864fe['mandatoryDisposition']||![];}module[_0x498e('0x3')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 220665d..b8a23e3 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 _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 +var _0xf0b0=['dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','wav','wav49','gsm','fewestcalls','leastrecent','linear','random','ringall','roundrobin','rrordered','name','monitor_format','type','inbound','waiting','total','answered','sumHoldTime','sumBillable','busy','invalid','loggedIn','onHold','paused','ringing','ringInUse','talking','unavailable','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency'];(function(_0x43d624,_0x1f578b){var _0x49870c=function(_0x3042b8){while(--_0x3042b8){_0x43d624['push'](_0x43d624['shift']());}};_0x49870c(++_0x1f578b);}(_0xf0b0,0xc8));var _0x0f0b=function(_0x1f10ff,_0x20520a){_0x1f10ff=_0x1f10ff-0x0;var _0x575973=_0xf0b0[_0x1f10ff];return _0x575973;};'use strict';var monitorFormat={'wav':_0x0f0b('0x0'),'wav49':_0x0f0b('0x1'),'gsm':_0x0f0b('0x2')};var strategy={'fewestcalls':_0x0f0b('0x3'),'leastrecent':_0x0f0b('0x4'),'linear':_0x0f0b('0x5'),'random':_0x0f0b('0x6'),'ringall':_0x0f0b('0x7'),'rr':_0x0f0b('0x8'),'rrmemory':'rrmemory','rrordered':_0x0f0b('0x9'),'wrandom':'wrandom'};function VoiceQueue(_0x1de910){this['id']=_0x1de910['id']||0x0;this[_0x0f0b('0xa')]=_0x1de910[_0x0f0b('0xa')]||'';this[_0x0f0b('0xb')]=_0x1de910[_0x0f0b('0xb')]||'';this[_0x0f0b('0xc')]=_0x1de910['type']||_0x0f0b('0xd');this[_0x0f0b('0xe')]=0x0;this[_0x0f0b('0xf')]=0x0;this[_0x0f0b('0x10')]=0x0;this['sumDuration']=0x0;this[_0x0f0b('0x11')]=0x0;this[_0x0f0b('0x12')]=0x0;this['unmanaged']=0x0;this['abandoned']=0x0;this['available']=0x0;this[_0x0f0b('0x13')]=0x0;this['inUse']=0x0;this[_0x0f0b('0x14')]=0x0;this[_0x0f0b('0x15')]=0x0;this['notInUse']=0x0;this[_0x0f0b('0x16')]=0x0;this[_0x0f0b('0x17')]=0x0;this[_0x0f0b('0x18')]=0x0;this[_0x0f0b('0x19')]=0x0;this[_0x0f0b('0x1a')]=0x0;this[_0x0f0b('0x1b')]=0x0;this[_0x0f0b('0x1c')]=0x0;this[_0x0f0b('0x1d')]=_0x1de910[_0x0f0b('0x1d')]||![];this[_0x0f0b('0x1e')]=_0x1de910[_0x0f0b('0x1e')]||0xa;this[_0x0f0b('0x1f')]=_0x1de910[_0x0f0b('0x1f')]||'no';this[_0x0f0b('0x20')]=!![];this[_0x0f0b('0x21')]='';this[_0x0f0b('0x22')]='';this[_0x0f0b('0x23')]=0x0;this[_0x0f0b('0x24')]=0x0;this[_0x0f0b('0x25')]=_0x1de910[_0x0f0b('0x25')]||null;this[_0x0f0b('0x26')]=_0x1de910[_0x0f0b('0x26')]?_0x1de910[_0x0f0b('0x26')]:null;this[_0x0f0b('0x27')]=_0x1de910['dialActive'];this[_0x0f0b('0x28')]=_0x1de910['dialMethod']||_0x0f0b('0x29');this[_0x0f0b('0x2a')]=_0x1de910[_0x0f0b('0x2a')]||0x0;this[_0x0f0b('0x2b')]=_0x1de910[_0x0f0b('0x2b')]||0x0;this['dialPowerLevel']=_0x1de910['dialPowerLevel']||0x1;this[_0x0f0b('0x2c')]=_0x1de910['dialPredictiveOptimization']||'dropRate';this['dialPredictiveOptimizationPercentage']=_0x1de910[_0x0f0b('0x2d')]||0.03;this[_0x0f0b('0x2e')]=_0x1de910[_0x0f0b('0x2e')]||0x258;this[_0x0f0b('0x2f')]=_0x1de910[_0x0f0b('0x2f')]||_0x0f0b('0x30');this[_0x0f0b('0x31')]=_0x1de910[_0x0f0b('0x31')]||_0x0f0b('0x30');this['dialOriginateTimeout']=_0x1de910['dialOriginateTimeout']||0x1e;this['dialQueueOptions']=_0x1de910[_0x0f0b('0x32')]||_0x0f0b('0x33');this[_0x0f0b('0x34')]=_0x1de910[_0x0f0b('0x34')]||0x3;this[_0x0f0b('0x35')]=_0x1de910['dialQueueProject']||undefined;this['dialCongestionMaxRetry']=_0x1de910[_0x0f0b('0x36')]||0x3;this[_0x0f0b('0x37')]=_0x1de910[_0x0f0b('0x37')]||0x96;this[_0x0f0b('0x38')]=_0x1de910['dialBusyMaxRetry']||0x3;this[_0x0f0b('0x39')]=_0x1de910[_0x0f0b('0x39')]||0x96;this[_0x0f0b('0x3a')]=_0x1de910[_0x0f0b('0x3a')]||0x3;this[_0x0f0b('0x3b')]=_0x1de910[_0x0f0b('0x3b')]||0x96;this[_0x0f0b('0x3c')]=_0x1de910[_0x0f0b('0x3c')]||0x3;this[_0x0f0b('0x3d')]=_0x1de910[_0x0f0b('0x3d')]||0x96;this['dialDropMaxRetry']=_0x1de910['dialDropMaxRetry']||0x3;this[_0x0f0b('0x3e')]=_0x1de910[_0x0f0b('0x3e')]||0x96;this[_0x0f0b('0x3f')]=_0x1de910[_0x0f0b('0x3f')]||0x3;this[_0x0f0b('0x40')]=_0x1de910['dialAbandonedRetryFrequency']||0x96;this[_0x0f0b('0x41')]=_0x1de910['dialMachineMaxRetry']||0x3;this[_0x0f0b('0x42')]=_0x1de910[_0x0f0b('0x42')]||0x96;this[_0x0f0b('0x43')]=_0x1de910[_0x0f0b('0x43')]||0x3;this[_0x0f0b('0x44')]=_0x1de910['dialAgentRejectRetryFrequency']||0x96;this[_0x0f0b('0x45')]=_0x1de910[_0x0f0b('0x45')]||0x3;this[_0x0f0b('0x46')]=_0x1de910[_0x0f0b('0x46')]||0x4;this['Trunk']=_0x1de910[_0x0f0b('0x47')]?_0x1de910['Trunk']:undefined;this[_0x0f0b('0x48')]=_0x1de910[_0x0f0b('0x48')]?_0x1de910[_0x0f0b('0x48')]:undefined;this[_0x0f0b('0x49')]=_0x1de910[_0x0f0b('0x49')]||undefined;this['Interval']=_0x1de910[_0x0f0b('0x4a')]?_0x1de910['Interval']:undefined;this[_0x0f0b('0x4b')]=_0x1de910[_0x0f0b('0x4b')]||'DESC';this[_0x0f0b('0x4c')]=_0x1de910[_0x0f0b('0x4c')]||undefined;this[_0x0f0b('0x4d')]=_0x1de910[_0x0f0b('0x4d')]||undefined;this[_0x0f0b('0x4e')]=strategy[_0x1de910[_0x0f0b('0x4e')]];this[_0x0f0b('0x4f')]=!![];this[_0x0f0b('0x50')]=_0x1de910[_0x0f0b('0x50')]||![];this['dialAMDInitialSilence']=_0x1de910[_0x0f0b('0x51')];this[_0x0f0b('0x52')]=_0x1de910[_0x0f0b('0x52')];this[_0x0f0b('0x53')]=_0x1de910['dialAMDAfterGreetingSilence'];this[_0x0f0b('0x54')]=_0x1de910[_0x0f0b('0x54')];this[_0x0f0b('0x55')]=_0x1de910['dialAMDMinWordLength'];this[_0x0f0b('0x56')]=_0x1de910['dialAMDBetweenWordsSilence'];this[_0x0f0b('0x57')]=_0x1de910[_0x0f0b('0x57')];this['dialAMDSilenceThreshold']=_0x1de910[_0x0f0b('0x58')];this[_0x0f0b('0x59')]=_0x1de910['dialAMDMaximumWordLength'];this[_0x0f0b('0x5a')]=0x0;this[_0x0f0b('0x5b')]=0x0;this['timeout']=_0x1de910['timeout'];this[_0x0f0b('0x5c')]=0x0;this[_0x0f0b('0x5d')]=0x0;this[_0x0f0b('0x5e')]=0x0;this[_0x0f0b('0x5f')]=0x0;this[_0x0f0b('0x60')]=0x0;this[_0x0f0b('0x61')]=0x0;this[_0x0f0b('0x62')]=0x0;this[_0x0f0b('0x63')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0x0f0b('0x64')]=0x0;this[_0x0f0b('0x65')]=0x0;this[_0x0f0b('0x66')]=0x0;this[_0x0f0b('0x67')]=0x0;this[_0x0f0b('0x68')]=undefined;this['startPredictive']=undefined;this[_0x0f0b('0x69')]=undefined;this[_0x0f0b('0x6a')]=1.05;this[_0x0f0b('0x6b')]=0x0;this[_0x0f0b('0x6c')]=0x0;this[_0x0f0b('0x6d')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x0f0b('0x6e')]=0x0;this[_0x0f0b('0x6f')]=0x0;this[_0x0f0b('0x70')]=0x0;this[_0x0f0b('0x71')]=0x0;this[_0x0f0b('0x72')]=_0x1de910[_0x0f0b('0x73')]||0x14;this['predictiveIntervalMinThreshold']=_0x1de910[_0x0f0b('0x73')]||0xa;this[_0x0f0b('0x74')]=0x0;this[_0x0f0b('0x75')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0x0f0b('0x76')]=0x0;this[_0x0f0b('0x77')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0x0f0b('0x78')]=0x0;this[_0x0f0b('0x79')]=_0x1de910['dialRecallMeTimeout']||0x1e;this[_0x0f0b('0x7a')]=_0x1de910['dialRecallInQueue']||![];this[_0x0f0b('0x7b')]=!!_0x1de910[_0x0f0b('0x7b')]||![];this[_0x0f0b('0x7c')]=!!_0x1de910[_0x0f0b('0x7c')]||![];this[_0x0f0b('0x7d')]=_0x1de910['dialQueueProject2']||undefined;this[_0x0f0b('0x7e')]=_0x1de910[_0x0f0b('0x7e')]||![];this[_0x0f0b('0x7f')]=_0x1de910[_0x0f0b('0x7f')]||![];this[_0x0f0b('0xb')]=monitorFormat[_0x1de910['monitor_format']]?monitorFormat[_0x1de910[_0x0f0b('0xb')]]:undefined;this[_0x0f0b('0x80')]=_0x1de910['mandatoryDisposition']||![];this[_0x0f0b('0x81')]=_0x1de910['mandatoryDispositionPause']?_0x1de910[_0x0f0b('0x81')]:undefined;this[_0x0f0b('0x82')]=![];}module['exports']=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 7b4ba0d..8eb05dd 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 _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 +var _0xdc59=['predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','callerid','prototype','createReport','loggedin','callers','SIP/','incall','status','booked','length','queue','dialer','exten','compareToInboundQueue','some','compareToOutboundQueue','active','updateReportFromOutboundQueue','preview','exports','available','loggedIn','loggedInDb','talking','waiting','answered','inUse','originated','outboundAbandonedCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','paused','pTalking','sumBillable','sumDuration','total','name','strategy','abandoned','busy','invalid','onHold','notInUse','ringing','ringInUse','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate'];(function(_0x53c393,_0x2cd57a){var _0xc1ae94=function(_0x1dabd1){while(--_0x1dabd1){_0x53c393['push'](_0x53c393['shift']());}};_0xc1ae94(++_0x2cd57a);}(_0xdc59,0x12c));var _0x9dc5=function(_0x3c8e9a,_0x384306){_0x3c8e9a=_0x3c8e9a-0x0;var _0x2d4c57=_0xdc59[_0x3c8e9a];return _0x2d4c57;};'use strict';var INBOUND_COUNTERS=[_0x9dc5('0x0'),_0x9dc5('0x1'),_0x9dc5('0x2'),'paused','ringing',_0x9dc5('0x3'),_0x9dc5('0x4')];var OUTBOUND_COUNTERS=[_0x9dc5('0x0'),_0x9dc5('0x5'),_0x9dc5('0x6'),_0x9dc5('0x1'),_0x9dc5('0x2'),_0x9dc5('0x7'),_0x9dc5('0x8'),'outboundAnswerCallsDay',_0x9dc5('0x9'),_0x9dc5('0xa'),_0x9dc5('0xb'),_0x9dc5('0xc'),_0x9dc5('0xd'),_0x9dc5('0xe'),_0x9dc5('0xf'),_0x9dc5('0x10'),_0x9dc5('0x11'),_0x9dc5('0x12'),'talking',_0x9dc5('0x13'),_0x9dc5('0x14'),_0x9dc5('0x15'),_0x9dc5('0x4')];function VoiceQueueSummary(_0x54aaf8){this['id']=_0x54aaf8['id'];this[_0x9dc5('0x16')]=_0x54aaf8[_0x9dc5('0x16')];this[_0x9dc5('0x17')]=_0x54aaf8['strategy'];this[_0x9dc5('0x18')]=_0x54aaf8[_0x9dc5('0x18')]||0x0;this[_0x9dc5('0x5')]=_0x54aaf8[_0x9dc5('0x5')]||0x0;this[_0x9dc5('0x0')]=_0x54aaf8[_0x9dc5('0x0')]||0x0;this[_0x9dc5('0x19')]=_0x54aaf8[_0x9dc5('0x19')]||0x0;this[_0x9dc5('0x6')]=_0x54aaf8[_0x9dc5('0x6')]||0x0;this['invalid']=_0x54aaf8[_0x9dc5('0x1a')]||0x0;this['loggedIn']=_0x54aaf8[_0x9dc5('0x1')]||0x0;this[_0x9dc5('0x2')]=_0x54aaf8['loggedInDb']||0x0;this[_0x9dc5('0x1b')]=_0x54aaf8[_0x9dc5('0x1b')]||0x0;this[_0x9dc5('0x1c')]=_0x54aaf8[_0x9dc5('0x1c')]||0x0;this['paused']=_0x54aaf8[_0x9dc5('0x11')]||0x0;this[_0x9dc5('0x1d')]=_0x54aaf8[_0x9dc5('0x1d')]||0x0;this[_0x9dc5('0x1e')]=_0x54aaf8[_0x9dc5('0x1e')];this['sumBillable']=_0x54aaf8[_0x9dc5('0x13')];this[_0x9dc5('0x14')]=_0x54aaf8[_0x9dc5('0x14')];this['sumHoldTime']=_0x54aaf8['sumHoldTime']||0x0;this[_0x9dc5('0x3')]=_0x54aaf8['talking']||0x0;this[_0x9dc5('0x15')]=_0x54aaf8['total']||0x0;this[_0x9dc5('0x1f')]=_0x54aaf8['type'];this[_0x9dc5('0x20')]=_0x54aaf8['unavailable']||0x0;this[_0x9dc5('0x21')]=_0x54aaf8[_0x9dc5('0x21')]||0x0;this[_0x9dc5('0x22')]=_0x54aaf8['unmanaged']||0x0;this[_0x9dc5('0x4')]=_0x54aaf8[_0x9dc5('0x4')]||0x0;if(_0x54aaf8[_0x9dc5('0x1f')]===_0x9dc5('0x23')){this['pTalking']=_0x54aaf8['pTalking']||0x0;this[_0x9dc5('0x24')]=_0x54aaf8[_0x9dc5('0x24')];this[_0x9dc5('0x25')]=_0x54aaf8[_0x9dc5('0x25')];this['dialOriginateCallerIdName']=_0x54aaf8['dialOriginateCallerIdName'];this[_0x9dc5('0x26')]=_0x54aaf8[_0x9dc5('0x26')];this['dialOriginateTimeout']=_0x54aaf8[_0x9dc5('0x27')];this[_0x9dc5('0x28')]=_0x54aaf8[_0x9dc5('0x28')];this['temp']=_0x54aaf8[_0x9dc5('0x29')];this[_0x9dc5('0x2a')]=_0x54aaf8[_0x9dc5('0x2a')];this[_0x9dc5('0x2b')]=_0x54aaf8[_0x9dc5('0x2b')];this[_0x9dc5('0x9')]=_0x54aaf8['outboundBlacklistCallsDay'];this[_0x9dc5('0xa')]=_0x54aaf8[_0x9dc5('0xa')];this[_0x9dc5('0xb')]=_0x54aaf8[_0x9dc5('0xb')];this[_0x9dc5('0x2c')]=_0x54aaf8['outboundDropCallsDayACS'];this['outboundDropCallsDayCallersExit']=_0x54aaf8[_0x9dc5('0x2d')];this[_0x9dc5('0x2e')]=_0x54aaf8['outboundDropCallsDayTimeout'];this[_0x9dc5('0xc')]=_0x54aaf8[_0x9dc5('0xc')];this[_0x9dc5('0xd')]=_0x54aaf8[_0x9dc5('0xd')];this[_0x9dc5('0x2f')]=_0x54aaf8[_0x9dc5('0x2f')];this[_0x9dc5('0xe')]=_0x54aaf8[_0x9dc5('0xe')];this[_0x9dc5('0xf')]=_0x54aaf8['outboundRejectCallsDay'];this[_0x9dc5('0x10')]=_0x54aaf8[_0x9dc5('0x10')];this[_0x9dc5('0x30')]=_0x54aaf8[_0x9dc5('0x30')];this[_0x9dc5('0x31')]=_0x54aaf8[_0x9dc5('0x31')];this['predictiveIntervalAvgTalktime']=_0x54aaf8[_0x9dc5('0x32')];this['predictiveIntervalDroppedCallsCallersExit']=_0x54aaf8[_0x9dc5('0x33')];this['predictiveIntervalDroppedCallsTimeout']=_0x54aaf8[_0x9dc5('0x34')];this[_0x9dc5('0x35')]=_0x54aaf8[_0x9dc5('0x35')];this[_0x9dc5('0x36')]=_0x54aaf8[_0x9dc5('0x36')];this[_0x9dc5('0x37')]=_0x54aaf8[_0x9dc5('0x37')];this[_0x9dc5('0x38')]=_0x54aaf8[_0x9dc5('0x38')];this[_0x9dc5('0x39')]=_0x54aaf8[_0x9dc5('0x39')];this['predictiveIntervalAvailable']=_0x54aaf8[_0x9dc5('0x3a')];this['predictiveIntervalTotalCalls']=_0x54aaf8[_0x9dc5('0x3b')];this[_0x9dc5('0x7')]=_0x54aaf8[_0x9dc5('0x7')];this['erlangCalls']=_0x54aaf8[_0x9dc5('0x3c')];this[_0x9dc5('0x3d')]=_0x54aaf8[_0x9dc5('0x3d')];this['erlangAbandonmentRate']=_0x54aaf8[_0x9dc5('0x3e')];this[_0x9dc5('0x3f')]=_0x54aaf8[_0x9dc5('0x3f')];this[_0x9dc5('0x40')]=_0x54aaf8['startPredictive'];this[_0x9dc5('0x41')]=_0x54aaf8[_0x9dc5('0x41')];this[_0x9dc5('0x42')]=_0x54aaf8[_0x9dc5('0x42')];this['statusMessage']=_0x54aaf8[_0x9dc5('0x43')];}if(_0x54aaf8['Trunk']){this[_0x9dc5('0x44')]={'id':_0x54aaf8[_0x9dc5('0x44')]['id'],'name':_0x54aaf8[_0x9dc5('0x44')][_0x9dc5('0x16')],'active':_0x54aaf8['Trunk']['active'],'callerid':_0x54aaf8['Trunk'][_0x9dc5('0x45')]};}}VoiceQueueSummary[_0x9dc5('0x46')][_0x9dc5('0x47')]=function(_0x1a9162,_0x57aba9,_0x45235f,_0x19b5bd){this[_0x9dc5('0x2')]=0x0;this[_0x9dc5('0x3')]=0x0;this[_0x9dc5('0x11')]=0x0;this['unknown']=0x0;this['notInUse']=0x0;this[_0x9dc5('0x6')]=0x0;this['busy']=0x0;this[_0x9dc5('0x1a')]=0x0;this[_0x9dc5('0x20')]=0x0;this['ringing']=0x0;this[_0x9dc5('0x1e')]=0x0;this[_0x9dc5('0x1b')]=0x0;if(_0x45235f){if(_0x45235f[_0x9dc5('0x0')]){this[_0x9dc5('0x0')]=Number(_0x45235f[_0x9dc5('0x0')]);}if(_0x45235f[_0x9dc5('0x48')]){this[_0x9dc5('0x1')]=Number(_0x45235f[_0x9dc5('0x48')]);}if(_0x45235f[_0x9dc5('0x49')]){this['waiting']=Number(_0x45235f[_0x9dc5('0x49')]);}}for(var _0x33e5e4=0x0;_0x33e5e4<_0x1a9162['length'];_0x33e5e4++){var _0x585b17=_0x57aba9[_0x9dc5('0x4a')+_0x1a9162[_0x33e5e4]['name']];if(_0x585b17&&_0x585b17['online']){this[_0x9dc5('0x2')]+=0x1;}if(_0x1a9162[_0x33e5e4][_0x9dc5('0x4b')]==='1'){this[_0x9dc5('0x3')]+=0x1;}if(_0x1a9162[_0x33e5e4][_0x9dc5('0x11')]==='1'&&!['2','7','8']['includes'](_0x1a9162[_0x33e5e4][_0x9dc5('0x4c')])){this['paused']+=0x1;}switch(_0x1a9162[_0x33e5e4][_0x9dc5('0x4c')]){case'0':this[_0x9dc5('0x21')]+=0x1;break;case'1':this[_0x9dc5('0x1c')]+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this['busy']+=0x1;break;case'4':this[_0x9dc5('0x1a')]+=0x1;break;case'5':this[_0x9dc5('0x20')]+=0x1;break;case'6':this[_0x9dc5('0x1d')]+=0x1;break;case'7':this[_0x9dc5('0x1e')]+=0x1;break;case'8':this['onHold']+=0x1;break;}}if(this[_0x9dc5('0x25')]===_0x9dc5('0x4d')){var _0x48aa29=Object['keys'](_0x19b5bd);for(var _0x188338=0x0;_0x188338<_0x48aa29[_0x9dc5('0x4e')];_0x188338++){var _0x21999d=_0x48aa29[_0x188338];var _0x3a0eb4=_0x19b5bd[_0x21999d];if(_0x3a0eb4[_0x9dc5('0x4f')]===this[_0x9dc5('0x16')]&&_0x3a0eb4['type']===_0x9dc5('0x50')&&_0x3a0eb4[_0x9dc5('0x51')]==='xcally-motion-preview'){this[_0x9dc5('0x3')]+=0x1;}}if(this[_0x9dc5('0x3')]>this[_0x9dc5('0x6')]){this[_0x9dc5('0x3')]=this['inUse'];}this[_0x9dc5('0x12')]=0x0;}return this;};VoiceQueueSummary[_0x9dc5('0x46')][_0x9dc5('0x52')]=function(_0x2b2c52){var _0x336866=![];if(_0x2b2c52){_0x336866=INBOUND_COUNTERS[_0x9dc5('0x53')](function(_0x23f6cc){return this[_0x23f6cc]!==_0x2b2c52[_0x23f6cc];},this);}return _0x336866;};VoiceQueueSummary[_0x9dc5('0x46')][_0x9dc5('0x54')]=function(_0x5b242a){var _0x20787c=![];var _0x2dbba0=![];var _0x5be028=![];if(_0x5b242a){_0x20787c=this[_0x9dc5('0x25')]!==_0x5b242a[_0x9dc5('0x25')]||this[_0x9dc5('0x24')]!==_0x5b242a[_0x9dc5('0x24')]||this[_0x9dc5('0x42')]!==_0x5b242a[_0x9dc5('0x42')]||this[_0x9dc5('0x43')]!==_0x5b242a[_0x9dc5('0x43')];_0x2dbba0=OUTBOUND_COUNTERS[_0x9dc5('0x53')](function(_0x379323){return this[_0x379323]!==_0x5b242a[_0x379323];},this);if(this[_0x9dc5('0x44')]&&_0x5b242a['Trunk']){_0x5be028=this[_0x9dc5('0x44')]['name']!==_0x5b242a[_0x9dc5('0x44')][_0x9dc5('0x16')]||this['Trunk'][_0x9dc5('0x55')]!==_0x5b242a[_0x9dc5('0x44')][_0x9dc5('0x55')];}}return _0x20787c||_0x2dbba0||_0x5be028;};VoiceQueueSummary['prototype'][_0x9dc5('0x56')]=function(_0x3f0142){this[_0x9dc5('0x5')]=_0x3f0142[_0x9dc5('0x5')];this[_0x9dc5('0x42')]=_0x3f0142[_0x9dc5('0x42')];this[_0x9dc5('0x43')]=_0x3f0142[_0x9dc5('0x43')];this[_0x9dc5('0x7')]=_0x3f0142[_0x9dc5('0x7')];this[_0x9dc5('0x8')]=_0x3f0142[_0x9dc5('0x8')];this[_0x9dc5('0x2b')]=_0x3f0142[_0x9dc5('0x2b')];this['outboundBlacklistCallsDay']=_0x3f0142[_0x9dc5('0x9')];this[_0x9dc5('0xa')]=_0x3f0142[_0x9dc5('0xa')];this['outboundCongestionCallsDay']=_0x3f0142['outboundCongestionCallsDay'];this[_0x9dc5('0xc')]=_0x3f0142[_0x9dc5('0xc')];this[_0x9dc5('0xd')]=_0x3f0142[_0x9dc5('0xd')];this[_0x9dc5('0xe')]=_0x3f0142[_0x9dc5('0xe')];this[_0x9dc5('0xf')]=_0x3f0142[_0x9dc5('0xf')];this[_0x9dc5('0x10')]=_0x3f0142[_0x9dc5('0x10')];this[_0x9dc5('0x13')]=_0x3f0142[_0x9dc5('0x13')];this[_0x9dc5('0x14')]=_0x3f0142[_0x9dc5('0x14')];this[_0x9dc5('0x15')]=_0x3f0142[_0x9dc5('0x15')];if(this[_0x9dc5('0x25')]===_0x9dc5('0x57')){this[_0x9dc5('0x12')]=_0x3f0142[_0x9dc5('0x12')];}};module[_0x9dc5('0x58')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 70c49bf..bb5e33d 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 _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 +var _0xd481=['username','accessKey','remoteUri','Configurations','exports','name'];(function(_0x3ea24e,_0x5ec524){var _0x13f279=function(_0xf20327){while(--_0xf20327){_0x3ea24e['push'](_0x3ea24e['shift']());}};_0x13f279(++_0x5ec524);}(_0xd481,0x197));var _0x1d48=function(_0x2dc1cc,_0x11cee7){_0x2dc1cc=_0x2dc1cc-0x0;var _0x1db71a=_0xd481[_0x2dc1cc];return _0x1db71a;};'use strict';function VtigerAccount(_0x549860){this['id']=_0x549860['id']||0x0;this[_0x1d48('0x0')]=_0x549860[_0x1d48('0x0')]||'';this['username']=_0x549860[_0x1d48('0x1')]||'';this[_0x1d48('0x2')]=_0x549860['accessKey']||'';this[_0x1d48('0x3')]=_0x549860['remoteUri']||'';this['serverUrl']=_0x549860['serverUrl']||'';this[_0x1d48('0x4')]=_0x549860[_0x1d48('0x4')]||{};}module[_0x1d48('0x5')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 533d71f..9118898 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 _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 +var _0x2f97=['remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name','username','password','token'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x2f97,0xc2));var _0x72f9=function(_0x29489e,_0x40b87c){_0x29489e=_0x29489e-0x0;var _0x246757=_0x2f97[_0x29489e];return _0x246757;};'use strict';function ZendeskAccount(_0x1d4603){this['id']=_0x1d4603['id']||0x0;this['name']=_0x1d4603[_0x72f9('0x0')]||'';this[_0x72f9('0x1')]=_0x1d4603[_0x72f9('0x1')]||'';this['password']=_0x1d4603[_0x72f9('0x2')]||'';this[_0x72f9('0x3')]=_0x1d4603[_0x72f9('0x3')]||'';this[_0x72f9('0x4')]=_0x1d4603[_0x72f9('0x4')]||'';this[_0x72f9('0x5')]=_0x1d4603[_0x72f9('0x5')]||'';this[_0x72f9('0x6')]=_0x1d4603[_0x72f9('0x6')]||_0x72f9('0x7');this['serverUrl']=_0x1d4603[_0x72f9('0x8')]||'';this['Configurations']=_0x1d4603[_0x72f9('0x9')]||{};}module[_0x72f9('0xa')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index e62780b..b8f5828 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 _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 +var _0x4a4a=['exports','name','description','host','zone','clientId','serverUrl','code','refreshToken','Configurations'];(function(_0xc73653,_0x41c771){var _0xa23c50=function(_0x3bf557){while(--_0x3bf557){_0xc73653['push'](_0xc73653['shift']());}};_0xa23c50(++_0x41c771);}(_0x4a4a,0xf1));var _0xa4a4=function(_0x529fbe,_0xc844c5){_0x529fbe=_0x529fbe-0x0;var _0x318d7b=_0x4a4a[_0x529fbe];return _0x318d7b;};'use strict';function ZohoAccount(_0x151428){this['id']=_0x151428['id']||0x0;this['name']=_0x151428[_0xa4a4('0x0')]||'';this[_0xa4a4('0x1')]=_0x151428[_0xa4a4('0x1')]||'';this[_0xa4a4('0x2')]=_0x151428['host']||'';this[_0xa4a4('0x3')]=_0x151428[_0xa4a4('0x3')]||'';this[_0xa4a4('0x4')]=_0x151428['clientId']||'';this['clientSecret']=_0x151428['clientSecret']||'';this[_0xa4a4('0x5')]=_0x151428['serverUrl']||'';this[_0xa4a4('0x6')]=_0x151428[_0xa4a4('0x6')]||'';this['refreshToken']=_0x151428[_0xa4a4('0x7')]||'';this['Configurations']=_0x151428[_0xa4a4('0x8')]||{};}module[_0xa4a4('0x9')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 7fd7f3f..027f831 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 _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 +var _0x1eba=['channelAgent','format','SIP/%s','calleridname','Contact','lastName','active','calleridnum','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','getCaller','number','exports','util','lodash','moment','isNil','string','uniqueid','idContact','queue','type','campaigntype','dialAnswer','Agent','name'];(function(_0x4b3fcc,_0x19137b){var _0x344201=function(_0x5adb31){while(--_0x5adb31){_0x4b3fcc['push'](_0x4b3fcc['shift']());}};_0x344201(++_0x19137b);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0x1eba[_0x5c3c0b];return _0x52ecd2;};'use strict';var util=require(_0xa1eb('0x0'));var _=require(_0xa1eb('0x1'));var moment=require(_0xa1eb('0x2'));function checkNameSurname(_0x2158d5,_0x3ef7ee,_0x5865fc){var _0x56c5f2='';if(!_[_0xa1eb('0x3')](_0x3ef7ee)&&_0xa1eb('0x4')===typeof _0x3ef7ee){_0x56c5f2+=_0x3ef7ee;}if(!_[_0xa1eb('0x3')](_0x5865fc)&&_0xa1eb('0x4')===typeof _0x5865fc){_0x56c5f2+='\x20'+_0x5865fc;}if(_0x56c5f2!==''){return _0x56c5f2;}return _0x2158d5;}function Action(_0x138789,_0x2933d0,_0x1d0d67,_0x2bfbb0,_0x39a5a3){this[_0xa1eb('0x5')]=_0x1d0d67||undefined;this[_0xa1eb('0x6')]=_0x138789['id'];this[_0xa1eb('0x7')]=_0x2933d0['name'];this[_0xa1eb('0x8')]=_0x2933d0['type'];this[_0xa1eb('0x9')]='queue';this[_0xa1eb('0xa')]=![];this['membername']=_[_0xa1eb('0x3')](_0x138789['Agent'])?undefined:_0x138789[_0xa1eb('0xb')][_0xa1eb('0xc')];this[_0xa1eb('0xd')]=this['membername']?util[_0xa1eb('0xe')](_0xa1eb('0xf'),this['membername']):_0x2bfbb0||undefined;this[_0xa1eb('0x10')]=checkNameSurname(_0x138789['Contact']['phone'],_0x138789[_0xa1eb('0x11')]['firstName'],_0x138789[_0xa1eb('0x11')][_0xa1eb('0x12')]);this[_0xa1eb('0x13')]=_0x138789[_0xa1eb('0x13')]||![];this[_0xa1eb('0x14')]=_0x138789[_0xa1eb('0x15')];this[_0xa1eb('0x16')]=_0x138789[_0xa1eb('0x16')];this[_0xa1eb('0x17')]=_0x138789['countbusyretry']||0x0;this[_0xa1eb('0x18')]=_0x138789['countcongestionretry']||0x0;this[_0xa1eb('0x19')]=_0x138789[_0xa1eb('0x19')]||0x0;this[_0xa1eb('0x1a')]=(_0x138789[_0xa1eb('0x17')]||0x0)+(_0x138789['countcongestionretry']||0x0)+(_0x138789[_0xa1eb('0x19')]||0x0)+(_0x138789[_0xa1eb('0x1b')]||0x0)+(_0x138789[_0xa1eb('0x1c')]||0x0)+(_0x138789[_0xa1eb('0x1d')]||0x0)+(_0x138789[_0xa1eb('0x1e')]||0x0)+(_0x138789[_0xa1eb('0x1f')]||0x0);this[_0xa1eb('0x1b')]=_0x138789[_0xa1eb('0x1b')]||0x0;this['countdropretry']=_0x138789[_0xa1eb('0x1c')]||0x0;this['countabandonedretry']=_0x138789[_0xa1eb('0x1d')]||0x0;this[_0xa1eb('0x1e')]=_0x138789[_0xa1eb('0x1e')]||0x0;this[_0xa1eb('0x1f')]=_0x138789['countagentrejectretry']||0x0;this['callback']=_0x138789[_0xa1eb('0x20')];this[_0xa1eb('0x21')]=_0x138789['callbackuniqueid'];this[_0xa1eb('0x22')]=_0x138789[_0xa1eb('0x22')];this[_0xa1eb('0x23')]=_0x138789[_0xa1eb('0x23')];this[_0xa1eb('0x24')]=_0x138789[_0xa1eb('0x24')];this[_0xa1eb('0x25')]=_0x138789[_0xa1eb('0x25')];this[_0xa1eb('0x26')]=_[_0xa1eb('0x3')](_0x138789[_0xa1eb('0xb')])?_0x138789[_0xa1eb('0x26')]:_0x138789['Agent']['id'];this[_0xa1eb('0x27')]=_0x138789[_0xa1eb('0x27')];this['originatecalleridnum']='';this[_0xa1eb('0x28')]='';}Action['prototype'][_0xa1eb('0x29')]=function(){return util[_0xa1eb('0xe')]('\x22%s\x22\x20<%s>',this[_0xa1eb('0x10')],this[_0xa1eb('0x2a')]);};module[_0xa1eb('0x2b')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index c3ea1f6..38ccde0 100644 --- a/server/services/ami/preview/index.js +++ b/server/services/ami/preview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','dialActive','setMessage','recallMe','clearZombieChannel','sequence','isNil','Queue','queue','originated:\x20','stringify','pick','UserId','VoiceQueueId','ListId','channel','message','No\x20such\x20channel','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','size','getContactRecallMe','then','length','getDiff','scheduledat','Agent','voicePause','run','[RecallMe]','catch','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[getContactRecallMe]','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','UNREACHABLE_TRUNK','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','activeContact','linkedid','idContact','incrementPreviewCounters','ANSWER','answertime','[syncHangup][talking][increment]','pTalking:\x20','custom:agentconnect','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','uniqueid','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','swapAdditionalPhones','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','cause-txt','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','variablesAction','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','responsetime','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncHangupRequest','addVariable','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','../dialer/utils','redis','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','syncNewExten'];(function(_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 +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(_0x5c3fde,_0x3bab57){var _0x4d7464=function(_0x44a9e7){while(--_0x44a9e7){_0x5c3fde['push'](_0x5c3fde['shift']());}};_0x4d7464(++_0x3bab57);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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 8673d5e..0d45ed0 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 _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 +var _0xe335=['unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','type','uniqueid','calleridname','queue','answertime','queuecallerleaveAt','endtime','membername','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','queuecallerexitreason','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','util','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','error','createHistory','catch','[createHistory]\x20','resolve','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','[rescheduleContact]\x20','countReScheduled'];(function(_0x7a2cb,_0x1f5513){var _0x401404=function(_0xe77bc9){while(--_0xe77bc9){_0x7a2cb['push'](_0x7a2cb['shift']());}};_0x401404(++_0x1f5513);}(_0xe335,0xdf));var _0x5e33=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xe335[_0x199572];return _0x13cfa3;};'use strict';var util=require(_0x5e33('0x0'));var BPromise=require(_0x5e33('0x1'));var logger=require(_0x5e33('0x2'))(_0x5e33('0x3'));var cmHopper=require(_0x5e33('0x4'));var cmHopperHistory=require(_0x5e33('0x5'));var cmHopperBlack=require(_0x5e33('0x6'));var agentReportPreview=require(_0x5e33('0x7'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x4dbbcc){return function(_0x9a4c9b){logger[_0x5e33('0x8')](_0x4dbbcc,util['inspect'](_0x9a4c9b,{'showHidden':![],'depth':null}));};}function create(_0x15b07e){return cmHopperHistory[_0x5e33('0x9')](_0x15b07e)[_0x5e33('0xa')](loggerCatch(_0x5e33('0xb')));}function createAgent(_0x41ffcd){return BPromise[_0x5e33('0xc')]()[_0x5e33('0xd')](agentReportPreview[_0x5e33('0x9')](_0x41ffcd))['catch'](loggerCatch(_0x5e33('0xb')));}function moveContact(_0x456dd0){return cmHopper[_0x5e33('0xe')](_0x456dd0,!![])['catch'](loggerCatch(_0x5e33('0xf')));}exports[_0x5e33('0x10')]=function(_0x26f9b3){return cmHopperBlack[_0x5e33('0x10')](_0x26f9b3)[_0x5e33('0xa')](loggerCatch(_0x5e33('0x11')));};exports[_0x5e33('0x12')]=function(_0x1a1b98){return BPromise[_0x5e33('0xc')]()[_0x5e33('0xd')](cmHopper[_0x5e33('0x12')](_0x1a1b98))[_0x5e33('0xa')](loggerCatch(_0x5e33('0x13')));};exports[_0x5e33('0x9')]=function(_0x3c055f,_0x265d56){create(_0x3c055f)['catch'](loggerCatch(_0x265d56));moveContact(_0x3c055f)[_0x5e33('0xa')](loggerCatch(_0x265d56));};exports[_0x5e33('0x14')]=function(_0x36144a,_0x30324d){createAgent(_0x36144a)[_0x5e33('0xa')](loggerCatch(_0x30324d));};exports[_0x5e33('0x15')]=function(_0x481a53,_0x1e8171){create(_0x481a53)['catch'](loggerCatch(_0x1e8171));};exports[_0x5e33('0x16')]=function(_0xd9608d,_0x4b4d4d){moveContact(_0xd9608d)['catch'](loggerCatch(_0x4b4d4d));};exports[_0x5e33('0x17')]=function(_0x12277d,_0x4760ac,_0x1ace01){if(_0x4760ac){_0x12277d[_0x5e33('0x18')]=null;}if(_0x1ace01){_0x12277d['active']=![];}return cmHopper['rescheduleContact'](_0x12277d)[_0x5e33('0xa')](loggerCatch(_0x5e33('0x19')));};exports[_0x5e33('0x1a')]=function(_0x5ecb42){return cmHopper[_0x5e33('0x1a')](_0x5ecb42)[_0x5e33('0xa')](loggerCatch('[countReScheduled]\x20'));};exports[_0x5e33('0x1b')]=function(_0x8c608b){return cmHopper['unlockContact']({'UserId':null},_0x8c608b,0x1)[_0x5e33('0xa')](loggerCatch(_0x5e33('0x1c')));};exports[_0x5e33('0x1d')]=function(_0x583883){return cmHopper['unlockContact']({'active':![]},_0x583883,0x1)[_0x5e33('0xa')](loggerCatch(_0x5e33('0x1e')));};exports['crateCustomerReportQueue']=function(_0x28d513){var _0x50612f={};_0x50612f[_0x5e33('0x1f')]=_0x28d513[_0x5e33('0x1f')];_0x50612f[_0x5e33('0x20')]=_0x28d513[_0x5e33('0x20')];_0x50612f['calleridnum']=_0x28d513['calleridnum'];_0x50612f[_0x5e33('0x21')]=_0x28d513['calleridname'];_0x50612f['queue']=_0x28d513[_0x5e33('0x22')];_0x50612f['queuecallerjoinAt']=_0x28d513[_0x5e33('0x23')];_0x50612f[_0x5e33('0x24')]=_0x28d513[_0x5e33('0x23')];_0x50612f['queuecallercomplete']=0x1;_0x50612f['queuecallercompleteAt']=_0x28d513[_0x5e33('0x25')];_0x50612f['connectedlinename']=_0x28d513[_0x5e33('0x26')];_0x50612f[_0x5e33('0x27')]=_0x5e33('0x28');_0x50612f[_0x5e33('0x29')]=_0x5e33('0x2a');_0x50612f[_0x5e33('0x2b')]=0x0;_0x50612f[_0x5e33('0x2c')]=0x1;_0x50612f['lastAssignedTo']=_0x28d513['membername'];_0x50612f[_0x5e33('0x2d')]=_0x5e33('0x2e');return BPromise[_0x5e33('0xc')]()[_0x5e33('0xd')](voiceQueueReport['create'](_0x50612f))[_0x5e33('0xa')](loggerCatch(_0x5e33('0x2f')));};exports[_0x5e33('0x30')]=function(_0x4d78a3,_0x2b5ad6){return BPromise[_0x5e33('0xc')]()[_0x5e33('0xd')](cmHopper[_0x5e33('0x30')](_0x4d78a3,_0x2b5ad6))['catch'](loggerCatch(_0x5e33('0x31')));};exports['rescheduleContactInQueue']=function(_0x4e7fa6){return cmHopper[_0x5e33('0x17')](_0x4e7fa6,!![],!![])[_0x5e33('0xa')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index d5cf15b..ebd2f39 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 _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 +var _0xdfa4=['Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','monitor_format','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','toLower','hasOwnProperty','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','getSeconds','logLookAgent','UserId','logCustomer','endtime','ringtime','answertime','isFailure','Failure','RECALL','calleridname','channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','Global','scheduledAt','active','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','motionChannel','voice','buildObj','not_inuse','status','reachable','push','getDiff','milliseconds','diff','CampaignId','filterKey','uniqueid','idContact','type','dialAnswer','countglobal','callback','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-listid','xmd-dialurl','xmd-dialoptions','xmd-dialid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','extractCalleridNumber','noanswer','variables','keys','forEach','toLowerCase','buildNoAnswerEventPayload','util','lodash','moment','../../../../config/logger','preview','XCALLY_IP_AGI','127.0.0.1','loggerCatch','error','inspect','logger','info','loggerError','message','getCallerId','string','isEmpty','isUndefined','format','\x22%s\x22\x20<%s>','isActive','isNil','addVariables','name','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridname','xcally-motion-preview'];(function(_0x5584f0,_0x2736a6){var _0x25d746=function(_0x58add8){while(--_0x58add8){_0x5584f0['push'](_0x5584f0['shift']());}};_0x25d746(++_0x2736a6);}(_0xdfa4,0x69));var _0x4dfa=function(_0x542ed2,_0x529fc5){_0x542ed2=_0x542ed2-0x0;var _0x46f32f=_0xdfa4[_0x542ed2];return _0x46f32f;};'use strict';var util=require(_0x4dfa('0x0'));var _=require(_0x4dfa('0x1'));var moment=require(_0x4dfa('0x2'));var logger=require(_0x4dfa('0x3'))(_0x4dfa('0x4'));var ipAgi=process['env'][_0x4dfa('0x5')]||_0x4dfa('0x6');var utils=require('../../dialer/utils');exports[_0x4dfa('0x7')]=function(_0x260e5a){return function(_0xbce8a){logger[_0x4dfa('0x8')](_0x260e5a,util[_0x4dfa('0x9')](_0xbce8a,{'showHidden':![],'depth':null}));};};exports[_0x4dfa('0xa')]=function(_0x5c6ebc,_0x113eb3){logger[_0x4dfa('0xb')](_0x5c6ebc,util[_0x4dfa('0x9')](_0x113eb3,{'showHidden':![],'depth':null}));};exports[_0x4dfa('0xc')]=function(_0x583f28,_0x1b88d6){logger[_0x4dfa('0x8')](_0x583f28,util['inspect'](_0x1b88d6,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x363b5e){return function(_0x582350){logger[_0x4dfa('0xb')](_0x363b5e,util[_0x4dfa('0x9')](_0x582350,{'showHidden':![],'depth':null}));};};exports[_0x4dfa('0xd')]=function(_0x335709,_0x23c4b1,_0x50930e){return{'message':_0x335709,'unlock':_0x23c4b1,'active':_0x50930e};};exports[_0x4dfa('0xe')]=function(_0x4a1c71,_0x1b5296,_0x371643){if(!_['isUndefined'](_0x371643)&&_0x4dfa('0xf')===typeof _0x371643&&!_[_0x4dfa('0x10')](_0x371643)){if(!_[_0x4dfa('0x11')](_0x1b5296)&&_0x4dfa('0xf')===typeof _0x1b5296&&!_[_0x4dfa('0x10')](_0x1b5296)){return util[_0x4dfa('0x12')](_0x4dfa('0x13'),_0x1b5296,_0x371643);}return util[_0x4dfa('0x12')](_0x4dfa('0x13'),_0x371643,_0x371643);}if(!_[_0x4dfa('0x11')](_0x4a1c71)&&_0x4dfa('0xf')===typeof _0x4a1c71&&!_['isEmpty'](_0x4a1c71)){return _0x4a1c71;}return'\x22\x22\x20<>';};exports[_0x4dfa('0x14')]=function(_0x370f5f){if(_[_0x4dfa('0x15')](_0x370f5f)){return![];}return _0x370f5f;};exports[_0x4dfa('0x16')]=function(_0x52545e,_0x5dfc5d,_0x62aed5,_0x2b8bac,_0x5f38a0,_0x5774ca){var _0x539208={'XMD-QUEUE':_0x5dfc5d['Queue']?_0x5dfc5d['Queue'][_0x4dfa('0x17')]:'','XMD-CALLERID':_0x2b8bac,'XMD-CALLERID-PREVIEW':_0x5774ca?util['format'](_0x4dfa('0x13'),_0x5774ca['calleridname'],_0x5774ca[_0x4dfa('0x18')]):_0x2b8bac,'XMD-DIALID':_0x5f38a0,'XMD-CONTACTID':_0x5dfc5d[_0x4dfa('0x19')],'XMD-CDRTYPE':_0x4dfa('0x1a'),'CALLERID(all)':_0x2b8bac,'XMD-VOICEQUEUEID':_0x5dfc5d[_0x4dfa('0x1b')],'XMD-DIALCHANNEL':_0x62aed5,'XMD-DIALTIMEOUT':_0x52545e[_0x4dfa('0x1c')]||0x1e,'XMD-DIALOPTIONS':util[_0x4dfa('0x12')](_0x4dfa('0x1d'),_0x52545e[_0x4dfa('0x1e')]?'g':'',_[_0x4dfa('0x10')](_0x52545e['monitor_format'])?'':_0x4dfa('0x1f')),'XMD-DIALURL':_0x52545e[_0x4dfa('0x20')]||'','XMD-AGI':_0x52545e[_0x4dfa('0x21')]?util[_0x4dfa('0x12')](_0x4dfa('0x22'),ipAgi,_0x52545e[_0x4dfa('0x21')]):_0x4dfa('0x23'),'XMD-AGIAFTER':_0x52545e[_0x4dfa('0x1e')]?util[_0x4dfa('0x12')](_0x4dfa('0x22'),ipAgi,_0x52545e[_0x4dfa('0x1e')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x5774ca?_0x5774ca['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x5774ca?_0x5774ca[_0x4dfa('0x24')]:'','XMD-DESTINATION':_0x4dfa('0x25'),'SIPADDHEADER':_0x4dfa('0x26')};if(!_[_0x4dfa('0x10')](_0x52545e['monitor_format'])){_0x539208[util['format']('%s',_0x4dfa('0x27'))]=_0x52545e[_0x4dfa('0x28')];_0x539208[util[_0x4dfa('0x12')]('%s',_0x4dfa('0x29'))]=_0x5f38a0;}return _0x539208;};exports[_0x4dfa('0x2a')]=function(_0x33f6f5){var _0x92923a={};for(var _0x4bd613 in _0x33f6f5){if(_0x33f6f5['hasOwnProperty'](_0x4bd613)){_0x92923a[util[_0x4dfa('0x12')]('%s',_[_0x4dfa('0x2b')](_0x4bd613))]=_0x33f6f5[_0x4bd613];}}return{'variables':_0x92923a};};exports['updateOriginated']=function(_0x2d315c,_0x517bdb){if(!_[_0x4dfa('0x15')](_0x2d315c)){if(_0x2d315c[_0x4dfa('0x2c')](_0x4dfa('0x2d'))){if(_0x2d315c[_0x4dfa('0x2d')]>0x0){_0x2d315c[_0x4dfa('0x2d')]-=0x1;}else{logger[_0x4dfa('0x8')](_0x4dfa('0x2e'),_0x517bdb);}}}else{logger[_0x4dfa('0x8')](_0x4dfa('0x2f'),_0x517bdb);}};exports[_0x4dfa('0x30')]=function(_0x3c14f1){var _0x188582=moment()[_0x4dfa('0x12')](_0x4dfa('0x31'));_0x3c14f1[_0x4dfa('0x32')]=0xd;_0x3c14f1[_0x4dfa('0x33')]=_0x4dfa('0x34');_0x3c14f1[_0x4dfa('0x35')]=_0x188582;_0x3c14f1[_0x4dfa('0x36')]=_0x188582;_0x3c14f1['endtime']=_0x188582;};exports['logAgent']=function(_0x51cc65,_0x174e7b,_0x46df3b){var _0x3c5785=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x51cc65[_0x4dfa('0x32')]=_0x174e7b;_0x51cc65[_0x4dfa('0x33')]=_0x46df3b;_0x51cc65[_0x4dfa('0x36')]=_0x3c5785;_0x51cc65['ringtime']=utils[_0x4dfa('0x37')](_0x51cc65[_0x4dfa('0x36')],_0x51cc65[_0x4dfa('0x35')]);};exports[_0x4dfa('0x38')]=function(_0xa263be,_0x58e9e6,_0x4ab4e9){_0xa263be['membername']=_0x58e9e6;_0xa263be[_0x4dfa('0x39')]=_0x4ab4e9;};exports[_0x4dfa('0x3a')]=function(_0x183427,_0x53b8fa,_0x49ed7a){var _0x1985b2=moment()[_0x4dfa('0x12')](_0x4dfa('0x31'));_0x183427[_0x4dfa('0x32')]=_0x53b8fa;_0x183427['statedesc']=_0x49ed7a;_0x183427['responsetime']=_0x183427['responsetime']?_0x183427[_0x4dfa('0x36')]:_0x1985b2;_0x183427[_0x4dfa('0x3b')]=_0x183427[_0x4dfa('0x3b')]?_0x183427[_0x4dfa('0x3b')]:_0x1985b2;_0x183427[_0x4dfa('0x3c')]=utils[_0x4dfa('0x37')](_0x183427['responsetime']||0x0,_0x183427[_0x4dfa('0x35')]||0x0);_0x183427['talktime']=_0x183427[_0x4dfa('0x3d')]?utils['getSeconds'](_0x183427['endtime'],_0x183427[_0x4dfa('0x3d')]):0x0;};exports[_0x4dfa('0x3e')]=function(_0x328ce4){return _0x328ce4===_0x4dfa('0x3f');};exports['variablesAction']=function(_0x7ef432,_0x5ab523,_0x102371,_0x4a694a,_0x59d5e0){var _0x3c0248=_0x4a694a?_0x4dfa('0x40'):_0x7ef432[_0x4dfa('0x41')];_0x3c0248=_0x59d5e0?'BOOKED':_0x3c0248;return{'actionid':_0x7ef432['uniqueid'],'action':'originate','channel':_0x7ef432[_0x4dfa('0x42')],'callerid':util[_0x4dfa('0x12')](_0x4dfa('0x13'),_0x3c0248,_0x7ef432['calleridnum']),'Exten':_0x4dfa('0x25'),'Context':_0x4dfa('0x43'),'Priority':'1','variable':_0x102371,'timeout':(_0x5ab523[_0x4dfa('0x44')]||0x1e)*0x3e8,'async':!![],'channelid':_0x7ef432['uniqueid']};};exports[_0x4dfa('0x45')]=function(_0x5dd0a3){return _0x5dd0a3[_0x4dfa('0x46')]+_0x5dd0a3[_0x4dfa('0x47')]+_0x5dd0a3[_0x4dfa('0x48')]+_0x5dd0a3[_0x4dfa('0x49')]+_0x5dd0a3[_0x4dfa('0x4a')];};exports[_0x4dfa('0x4b')]=function(_0x3c5585){var _0xdbc752=_['clone'](_0x3c5585);_0xdbc752[_0x4dfa('0x32')]=0xf;_0xdbc752[_0x4dfa('0x33')]=_0x4dfa('0x4c');return _0xdbc752;};exports[_0x4dfa('0x4d')]=function(_0x27ef2e,_0x3a9f3f,_0x2c425d){var _0xf94df3={};_0xf94df3[_0x3a9f3f]=_0x27ef2e[_0x3a9f3f];_0xf94df3[_0x4dfa('0x4e')]=![];_0xf94df3[_0x4dfa('0x4f')]=moment()[_0x4dfa('0x50')](_0x2c425d,_0x4dfa('0x51'))[_0x4dfa('0x12')](_0x4dfa('0x31'));_0xf94df3[_0x4dfa('0x19')]=_0x27ef2e[_0x4dfa('0x19')];_0xf94df3[_0x4dfa('0x52')]=_0x27ef2e[_0x4dfa('0x52')];_0xf94df3[_0x4dfa('0x1b')]=_0x27ef2e['VoiceQueueId']||undefined;return _0xf94df3;};exports[_0x4dfa('0x53')]=function(_0x1db33e,_0x3814dc){if(!_[_0x4dfa('0x15')](_0x1db33e)){if(_0x1db33e['pTalking']>0x0){_0x1db33e[_0x4dfa('0x54')]-=0x1;}else{logger[_0x4dfa('0x8')](_0x3814dc,_0x4dfa('0x55'));}}else{logger['error'](_0x3814dc,_0x4dfa('0x56'));}};exports[_0x4dfa('0x57')]=function(_0x59cbf5){if(_0x59cbf5<=0x0){return!![];}return![];};function buildObj(_0x1dea92,_0x58ae78,_0x11ee4e){_0x1dea92[_0x4dfa('0x58')]=_0x58ae78;_0x1dea92[_0x4dfa('0x17')]=_0x1dea92[_0x4dfa('0x59')];_0x1dea92['interface']=_0x1dea92[_0x4dfa('0x42')];_0x1dea92[_0x4dfa('0x5a')]=_0x4dfa('0x5b');if(_0x11ee4e){_0x1dea92['mandatoryDisposition']=_0x11ee4e['mandatoryDisposition'];}return _0x1dea92;}exports[_0x4dfa('0x5c')]=buildObj;exports['agentReadyId']=function(_0x3786a9){var _0x2fba98=[];for(var _0x7c0aff in _0x3786a9){if(_0x3786a9['hasOwnProperty'](_0x7c0aff)){if(!_[_0x4dfa('0x15')](_0x3786a9[_0x7c0aff])&&_0x3786a9[_0x7c0aff][_0x4dfa('0x32')]===_0x4dfa('0x5d')&&_0x3786a9[_0x7c0aff][_0x4dfa('0x5e')]===_0x4dfa('0x5f')){_0x2fba98[_0x4dfa('0x60')](_0x3786a9[_0x7c0aff]['id']);}}}return _0x2fba98;};exports[_0x4dfa('0x61')]=function(_0xcb2e2d){var _0x285170=moment()[_0x4dfa('0x62')](0x0);var _0x35ea41=moment(_0xcb2e2d)[_0x4dfa('0x62')](0x0);return _0x285170[_0x4dfa('0x63')](_0x35ea41,'seconds');};exports['createBody']=function(_0x10c0d6){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x10c0d6[_0x4dfa('0x19')],'ListId':_0x10c0d6[_0x4dfa('0x52')],'VoiceQueueId':_0x10c0d6[_0x4dfa('0x1b')]||undefined,'CampaignId':_0x10c0d6[_0x4dfa('0x64')]||undefined};};exports[_0x4dfa('0x65')]=function(_0x2b97e0){if(_0x2b97e0===_0x4dfa('0x66')||_0x2b97e0===_0x4dfa('0x67')||_0x2b97e0==='queue'||_0x2b97e0===_0x4dfa('0x68')||_0x2b97e0==='campaigntype'||_0x2b97e0===_0x4dfa('0x69')||_0x2b97e0==='membername'||_0x2b97e0===_0x4dfa('0x42')||_0x2b97e0===_0x4dfa('0x41')||_0x2b97e0===_0x4dfa('0x4e')||_0x2b97e0===_0x4dfa('0x18')||_0x2b97e0===_0x4dfa('0x4f')||_0x2b97e0===_0x4dfa('0x46')||_0x2b97e0===_0x4dfa('0x47')||_0x2b97e0===_0x4dfa('0x48')||_0x2b97e0===_0x4dfa('0x6a')||_0x2b97e0===_0x4dfa('0x6b')||_0x2b97e0==='callbackuniqueid'||_0x2b97e0===_0x4dfa('0x6c')||_0x2b97e0===_0x4dfa('0x6d')||_0x2b97e0===_0x4dfa('0x19')||_0x2b97e0===_0x4dfa('0x52')||_0x2b97e0===_0x4dfa('0x39')||_0x2b97e0===_0x4dfa('0x1b')||_0x2b97e0===_0x4dfa('0x6e')||_0x2b97e0===_0x4dfa('0x6f')||_0x2b97e0===_0x4dfa('0x70')||_0x2b97e0==='xmd-phone'||_0x2b97e0===_0x4dfa('0x71')||_0x2b97e0===_0x4dfa('0x72')||_0x2b97e0==='xmd-dialtimeout'||_0x2b97e0===_0x4dfa('0x73')||_0x2b97e0===_0x4dfa('0x74')||_0x2b97e0==='xmd-dialchannel'||_0x2b97e0==='xmd-contactid'||_0x2b97e0===_0x4dfa('0x75')||_0x2b97e0===_0x4dfa('0x76')||_0x2b97e0===_0x4dfa('0x77')||_0x2b97e0===_0x4dfa('0x78')||_0x2b97e0===_0x4dfa('0x79')||_0x2b97e0==='rtpaudioqosbridged'||_0x2b97e0===_0x4dfa('0x7a')||_0x2b97e0===_0x4dfa('0x7b')||_0x2b97e0===_0x4dfa('0x7c')||_0x2b97e0===_0x4dfa('0x7d')||_0x2b97e0===_0x4dfa('0x7e')||_0x2b97e0==='rtpaudioqosrttbridged'||_0x2b97e0==='rtpaudioqos'||_0x2b97e0==='rtpaudioqosbridged'||_0x2b97e0===_0x4dfa('0x7a')||_0x2b97e0===_0x4dfa('0x7b')||_0x2b97e0===_0x4dfa('0x7c')||_0x2b97e0===_0x4dfa('0x7d')||_0x2b97e0===_0x4dfa('0x7e')||_0x2b97e0===_0x4dfa('0x7f')||_0x2b97e0===_0x4dfa('0x80')||_0x2b97e0===_0x4dfa('0x81')||_0x2b97e0==='state'||_0x2b97e0==='statedesc'){return![];}return!![];};exports[_0x4dfa('0x82')]=function(_0x57dcdb,_0x174765){var _0x1196e2,_0xd84e1f,_0x3fe8e4;if(_0x174765<=0x0){_0x174765=0x1;}_0x1196e2=new RegExp(_0x4dfa('0x83')+_0x174765+'}$');_0xd84e1f=Math[_0x4dfa('0x84')](0xa,_0x174765-0x1);_0x3fe8e4=Math[_0x4dfa('0x84')](0xa,_0x174765)-0x1;return util[_0x4dfa('0x12')]('%s',_[_0x4dfa('0x85')](_0x57dcdb,_0x1196e2,_[_0x4dfa('0x86')](_0xd84e1f,_0x3fe8e4)));};exports[_0x4dfa('0x87')]=function(_0xcd6710){var _0x322425=_0xcd6710['match'](/"(.*?)"/);return _0x322425?_0x322425[0x1]:_0xcd6710;};exports[_0x4dfa('0x88')]=function(_0x35ceae){var _0x15d7f1=_0x35ceae['match'](/<(.*?)>/);return _0x15d7f1?_0x15d7f1[0x1]:_0x35ceae;};function buildNoAnswerEventPayload(_0x4ea8c5,_0x44924f){var _0x2c440a=buildObj(_0x4ea8c5,_0x4dfa('0x89'));if(!_['isEmpty'](_0x44924f[_0x4dfa('0x8a')])){Object[_0x4dfa('0x8b')](_0x44924f['variables'])[_0x4dfa('0x8c')](function(_0x50347a){_0x2c440a[_0x50347a[_0x4dfa('0x8d')]()]=_0x44924f[_0x4dfa('0x8a')][_0x50347a];});}return _0x2c440a;}exports[_0x4dfa('0x8e')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 2ee196d..657a077 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 _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 +var _0x0165=['voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','string','number','boolean','queuepause'];(function(_0x29d461,_0x97f12e){var _0x4afafb=function(_0x2e3587){while(--_0x2e3587){_0x29d461['push'](_0x29d461['shift']());}};_0x4afafb(++_0x97f12e);}(_0x0165,0x134));var _0x5016=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x0165[_0x1facfa];return _0x9ec701;};'use strict';exports['queueadd']={'queue':{'type':_0x5016('0x0'),'required':!![]},'interface':{'type':_0x5016('0x0'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x5016('0x1'),'required':![]},'paused':{'type':_0x5016('0x2'),'required':![]}};exports['queueremove']={'queue':{'type':_0x5016('0x0'),'required':!![]},'interface':{'type':'string','required':!![]}};exports[_0x5016('0x3')]={'interface':{'type':_0x5016('0x0'),'required':!![]},'paused':{'type':_0x5016('0x2')},'reason':{'type':_0x5016('0x0'),'required':![]}};exports['reload']={'module':{'type':_0x5016('0x0'),'required':![]}};exports[_0x5016('0x4')]={'uniqueid':{'type':_0x5016('0x0'),'required':!![]}};exports[_0x5016('0x5')]={'uniqueid':{'type':_0x5016('0x0'),'required':!![]},'filename':{'type':'string'},'format':{'type':_0x5016('0x0')},'mixmonitorid':{'type':'string'}};exports[_0x5016('0x6')]={'uniqueid':{'type':_0x5016('0x0'),'required':!![]}};exports[_0x5016('0x7')]={'uniqueid':{'type':_0x5016('0x0'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0x5016('0x0')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 2b03927..63b2b68 100644 --- a/server/services/ami/realtime/index.js +++ b/server/services/ami/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['total','sumHoldTime','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','sumDuration','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','initAgents','length','isNil','SIP/%s','isUndefined','prototype','initTelephones','initTrunks','trunks','initTriggers','initTemplates','salesforceAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','queue','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','diff','queuecallercomplete','answered','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','initVoiceQueues','exports','lodash','util','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','voiceQueues','triggers','templates','outbound','voiceExtensions','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','faxAccounts','mapKeys','name','hasOwnProperty','format','interface'];(function(_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 +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(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x2032,0xd9));var _0x2203=function(_0x117889,_0x1dcdee){_0x117889=_0x117889-0x0;var _0x158b78=_0x2032[_0x117889];return _0x158b78;};'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 diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index 1dffc33..02c64fe 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 _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 +var _0x10d0=['assign','hasOwnProperty','mergeDBDataToRealtime'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x10d0,0x159));var _0x010d=function(_0x175e74,_0x27255e){_0x175e74=_0x175e74-0x0;var _0x1818cf=_0x10d0[_0x175e74];return _0x1818cf;};'use strict';function mergeDBDataToRealtime(_0x22f8eb,_0x2323f3){var _0x201ce2=Object[_0x010d('0x0')]({},_0x22f8eb);for(var _0x1f57b4 in _0x2323f3){if(_0x201ce2[_0x010d('0x1')](_0x1f57b4)){_0x201ce2[_0x1f57b4]=_0x2323f3[_0x1f57b4];}}return _0x201ce2;}exports[_0x010d('0x2')]=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 7f7a0ad..e45dbe4 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 _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 +var _0x71d2=['indexOf','mobile','phone','lastIndexOf','transfererlinkedid','attendedTransfer','lodash','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceCallReport','./voiceAgentReport','./userReport','realtime','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','voiceCallReport','custom:voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','findAgent','find','agents','accountcode','name','isNil','format','SIP/%s','length','interface','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','getAgentByInternal','keys','split','calleridnum','outbound','internal','destination','exten','type','lastapplication','queue','lastdata','context','callerid','from-sip','destinationchannel','channel','calleridpreview','originatecalleridnum','connectedlinenum','transfers','linkedid','transfereelinkedid','uniqueid','blindTransfer','UserId','membername','monitor','monitors','monitorFilename','filename','createdAt','xcally-motion-preview','calleridname','connectedlinename','xcally-motion-dialer','isArray','forEach','startsWith','substring'];(function(_0x6a82f4,_0x192d09){var _0x188d31=function(_0x3146ef){while(--_0x3146ef){_0x6a82f4['push'](_0x6a82f4['shift']());}};_0x188d31(++_0x192d09);}(_0x71d2,0xba));var _0x271d=function(_0x4a2111,_0x34a18a){_0x4a2111=_0x4a2111-0x0;var _0x3f4738=_0x71d2[_0x4a2111];return _0x3f4738;};'use strict';var _=require(_0x271d('0x0'));var moment=require('moment');var util=require(_0x271d('0x1'));var config=require(_0x271d('0x2'));var ami=require(_0x271d('0x3'));var RpcVoiceAgentReport=require(_0x271d('0x4'));var RpcVoiceCallReport=require(_0x271d('0x5'));var RpcVoiceDialReport=require(_0x271d('0x6'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0x271d('0x7'));var RpcVoiceRecording=require(_0x271d('0x8'));var RpcVoiceTransferReport=require(_0x271d('0x9'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0x271d('0xa'));var VoiceAgentReport=require(_0x271d('0xb'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0x271d('0xc'));function Report(_0xec2479){this[_0x271d('0xd')]=_0xec2479;this['agents']=_0xec2479['agents'];this[_0x271d('0xe')]=_0xec2479[_0x271d('0xe')];}Report[_0x271d('0xf')][_0x271d('0x10')]=function(_0x139722){var _0x34339d=new VoiceQueueReport(this['realtime']);var _0x202d42=new VoiceAgentReport(this[_0x271d('0xd')]);var _0x27452d=new VoiceDialReport(this[_0x271d('0xd')]);var _0x2bd8d6=new VoiceCallReport(this[_0x271d('0xd')]);var _0x5de897=new UserReport(this[_0x271d('0xd')]);if(config[_0x271d('0x11')]&&config[_0x271d('0x11')][_0x271d('0x12')]){ami['on'](_0x271d('0x13'),this[_0x271d('0x14')][_0x271d('0x15')](this));ami['on']('custom:voiceCallReport',this[_0x271d('0x16')][_0x271d('0x15')](this));ami['on'](_0x271d('0x17'),this['voiceAgentReport'][_0x271d('0x15')](this));ami['on'](_0x271d('0x18'),this[_0x271d('0x19')]['bind'](this));ami['on'](_0x271d('0x1a'),this['blindTransfer'][_0x271d('0x15')](this));ami['on']('attendedtransfer',this['attendedTransfer'][_0x271d('0x15')](this));}};Report[_0x271d('0xf')][_0x271d('0x1b')]=function(_0x506ae8){var _0x5d197d;_0x5d197d=_[_0x271d('0x1c')](this[_0x271d('0x1d')],function(_0x1357c4){return _0x1357c4[_0x271d('0x1e')]==_0x506ae8||_0x1357c4[_0x271d('0x1f')]==_0x506ae8;});if(_[_0x271d('0x20')](_0x5d197d)){var _0x535a87=_['find'](this['telephones'],function(_0x5e1435){return _0x5e1435[_0x271d('0x1e')]==_0x506ae8||_0x5e1435[_0x271d('0x1f')]==_0x506ae8;});if(_0x535a87){_0x5d197d=_[_0x271d('0x1c')](this[_0x271d('0x1d')],function(_0x496a80){return _0x496a80['interface']==util[_0x271d('0x21')](_0x271d('0x22'),_0x535a87[_0x271d('0x1f')]);});}}return _0x5d197d;};Report[_0x271d('0xf')][_0x271d('0x14')]=function(_0x10c45a){for(var _0x54bd98=0x0;_0x54bd98<_0x10c45a[_0x271d('0x23')];_0x54bd98+=0x1){var _0x16b21e=this[_0x271d('0x1b')](_0x10c45a[_0x54bd98]['connectedlinenum']);if(_0x16b21e){_0x10c45a[_0x54bd98][_0x271d('0x1e')]=_0x16b21e[_0x271d('0x1e')];_0x10c45a[_0x54bd98]['assigned']=!![];_0x10c45a[_0x54bd98]['lastAssignedTo']=_0x16b21e[_0x271d('0x1f')];_0x10c45a[_0x54bd98][_0x271d('0x24')]=_['isNil'](_0x16b21e[_0x271d('0x24')])?util[_0x271d('0x21')](_0x271d('0x22'),_0x16b21e['name']):_0x16b21e['interface'];if(_0x10c45a[_0x54bd98][_0x271d('0x25')]){_0x10c45a[_0x54bd98][_0x271d('0x26')]=moment()[_0x271d('0x21')](_0x271d('0x27'));}if(_0x10c45a[_0x54bd98][_0x271d('0x28')]){_0x10c45a[_0x54bd98][_0x271d('0x29')]=moment()['format'](_0x271d('0x27'));}RpcMemberReport[_0x271d('0x14')](_0x10c45a[_0x54bd98]);}RpcVoiceQueueReport[_0x271d('0x2a')](_0x10c45a[_0x54bd98]);}};function extractCalleridNumber(_0x1c012e){var _0x10ca05=_0x1c012e[_0x271d('0x2b')](/<(.*?)>/);return _0x10ca05?_0x10ca05[0x1]:_0x1c012e;}Report[_0x271d('0xf')][_0x271d('0x2c')]=function(_0x327118){for(var _0x29f25a=0x0;_0x29f25a',_0x2efd1f['calleridname'],_0x2efd1f[_0x271d('0x2f')]);}if(RpcVoiceTransferReport[_0x271d('0x40')][_0x2efd1f[_0x271d('0x41')]]){var _0x531ff3=RpcVoiceTransferReport[_0x271d('0x40')][_0x2efd1f[_0x271d('0x41')]];_0x531ff3[_0x271d('0x42')]=_0x2efd1f[_0x271d('0x43')];RpcVoiceTransferReport[_0x271d('0x44')](_0x531ff3);delete RpcVoiceTransferReport[_0x271d('0x40')][_0x2efd1f[_0x271d('0x41')]];}if(_['isNil'](_0x2efd1f[_0x271d('0x34')])){_0x2efd1f[_0x271d('0x34')]=this['getCallType'](_0x2efd1f);}if(_[_0x271d('0x20')](_0x2efd1f['UserId'])){var _0x107dce=_0x2efd1f[_0x271d('0x3c')][_0x271d('0x2e')]('-')[0x0];var _0x5c9c8a=this[_0x271d('0x1d')][_0x107dce];if(!_0x5c9c8a)_0x5c9c8a=this[_0x271d('0x2c')](_0x2efd1f[_0x271d('0x1e')]);if(_0x5c9c8a){_0x2efd1f[_0x271d('0x45')]=_0x5c9c8a['id'];_0x2efd1f[_0x271d('0x46')]=_0x5c9c8a[_0x271d('0x1f')];}}RpcVoiceCallReport[_0x271d('0x2a')](_0x2efd1f);if(_0x2efd1f[_0x271d('0x47')]){for(var _0x58165e=0x0;_0x58165e<_0x2efd1f[_0x271d('0x48')][_0x271d('0x23')];_0x58165e+=0x1){_0x2efd1f[_0x271d('0x49')]=_0x2efd1f[_0x271d('0x48')][_0x58165e][_0x271d('0x4a')];_0x2efd1f['createdAt']=_0x2efd1f['monitors'][_0x58165e][_0x271d('0x4b')];if(_0x2efd1f[_0x271d('0x33')]==_0x271d('0x4c')){_0x2efd1f[_0x271d('0x2f')]=_0x2efd1f['connectedlinenum'];_0x2efd1f[_0x271d('0x4d')]=_0x2efd1f[_0x271d('0x4e')];_0x2efd1f[_0x271d('0x3f')]=_0x2efd1f[_0x271d('0x1e')];_0x2efd1f['connectedlinename']=_0x2efd1f['membername'];_0x2efd1f[_0x271d('0x33')]=_0x2efd1f[_0x271d('0x3e')];}else if(_0x2efd1f[_0x271d('0x33')]==_0x271d('0x4f')){_0x2efd1f['calleridnum']=_0x2efd1f[_0x271d('0x32')];_0x2efd1f[_0x271d('0x33')]=_0x2efd1f[_0x271d('0x3e')];}RpcVoiceRecording[_0x271d('0x2a')](_0x2efd1f);}}};Report[_0x271d('0xf')]['voiceAgentReport']=function(_0x155a3e){if(_[_0x271d('0x50')](_0x155a3e)){_0x155a3e[_0x271d('0x51')](function(_0x2f93bb){RpcVoiceAgentReport[_0x271d('0x2a')](_0x2f93bb);});}else{RpcVoiceAgentReport['create'](_0x155a3e);}};Report['prototype'][_0x271d('0x19')]=function(_0x4c52e9){RpcVoiceDialReport[_0x271d('0x2a')](_0x4c52e9);var _0x3a7e7d;var _0x18106e;var _0x431300=_0x4c52e9[_0x271d('0x3c')];if(_[_0x271d('0x52')](_0x431300,'Local')){_0x18106e=_0x431300[_0x271d('0x53')](_0x431300['indexOf']('/')+0x1,_0x431300[_0x271d('0x54')]('@'));_0x3a7e7d=_[_0x271d('0x1c')](this[_0x271d('0x1d')],function(_0x41db3a){return _0x41db3a[_0x271d('0x55')]==_0x18106e||_0x41db3a[_0x271d('0x56')]==_0x18106e||_0x41db3a['accountcode']==_0x18106e;});}else{_0x18106e=_0x431300['substring'](_0x431300[_0x271d('0x54')]('/')+0x1,_0x431300[_0x271d('0x57')]('-'));_0x3a7e7d=this[_0x271d('0x1b')](_0x18106e);}if(_0x3a7e7d){_0x4c52e9[_0x271d('0x24')]=_['isNil'](_0x3a7e7d[_0x271d('0x24')])?util[_0x271d('0x21')]('SIP/%s',_0x3a7e7d[_0x271d('0x1f')]):_0x3a7e7d['interface'];_0x4c52e9[_0x271d('0x46')]=_0x3a7e7d['name'];_0x4c52e9[_0x271d('0x1e')]=_0x3a7e7d['accountcode'];RpcMemberReport[_0x271d('0x19')](_0x4c52e9);}};Report[_0x271d('0xf')]['blindTransfer']=function(_0x12479e){RpcVoiceTransferReport[_0x271d('0x40')][_0x12479e[_0x271d('0x58')]]=_0x12479e;};Report[_0x271d('0xf')][_0x271d('0x59')]=function(_0x48abaf){RpcVoiceTransferReport[_0x271d('0x59')](_0x48abaf);};module['exports']=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index db6db8d..140e829 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 _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 +var _0xbae8=['actionid','username','state','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','agents','local','toLowerCase','stateTime','toNumber','updateStatusRealtime','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','name','trunk:save','startsWith','Local','substring','indexOf','mobile','phone','accountcode','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','registered','status','address','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]','exports','moment','ioredis','../../../config/logger','ami','../ami','redis','defaults','localhost','trunks','telephones','syncRegistry','bind','registry','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','resolve','then','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','inspect','actionDeviceStateList','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','syncRealtimeShow','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','debug','[userReport][registry]','find','omit','event'];(function(_0x5684b6,_0x9146d){var _0x4a1324=function(_0x15b625){while(--_0x15b625){_0x5684b6['push'](_0x5684b6['shift']());}};_0x4a1324(++_0x9146d);}(_0xbae8,0x195));var _0x8bae=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xbae8[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var moment=require(_0x8bae('0x0'));var util=require('util');var Redis=require(_0x8bae('0x1'));var BPromise=require('bluebird');var config=require('../../../config/environment');var logger=require(_0x8bae('0x2'))(_0x8bae('0x3'));var ami=require(_0x8bae('0x4'));config[_0x8bae('0x5')]=_[_0x8bae('0x6')](config[_0x8bae('0x5')],{'host':_0x8bae('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function UserReport(_0x35ea98){this[_0x8bae('0x8')]=_0x35ea98[_0x8bae('0x8')];this['agents']=_0x35ea98['agents'];this[_0x8bae('0x9')]=_0x35ea98[_0x8bae('0x9')];ami['on']('registryentry',this[_0x8bae('0xa')][_0x8bae('0xb')](this));ami['on'](_0x8bae('0xc'),this[_0x8bae('0xa')]['bind'](this));ami['on'](_0x8bae('0xd'),this[_0x8bae('0xe')][_0x8bae('0xb')](this));ami['on'](_0x8bae('0xf'),this[_0x8bae('0x10')][_0x8bae('0xb')](this));return this['syncRealtimeShow']();}function showSipRegistrations(){Promise[_0x8bae('0x11')]()[_0x8bae('0x12')](ami[_0x8bae('0x13')]())[_0x8bae('0x14')](function(_0x4a7dd1){logger[_0x8bae('0x15')](_0x8bae('0x16'),util[_0x8bae('0x17')](_0x4a7dd1,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x8bae('0x11')]()[_0x8bae('0x12')](ami[_0x8bae('0x18')]())[_0x8bae('0x14')](function(_0x55a4b8){logger['error']('[userReport][devicestatelist]',util[_0x8bae('0x17')](_0x55a4b8,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x8bae('0x11')]()[_0x8bae('0x12')](ami[_0x8bae('0x19')]())[_0x8bae('0x14')](function(_0x399787){logger[_0x8bae('0x15')](_0x8bae('0x1a'),util[_0x8bae('0x17')](_0x399787,{'showHidden':![],'depth':null}));});}UserReport[_0x8bae('0x1b')][_0x8bae('0x1c')]=function(){setInterval(function(){BPromise[_0x8bae('0x11')]()[_0x8bae('0x12')](showSipRegistrations())['then'](listDeviceStates())['then'](showPeersStatus());},0x32c8);};UserReport['prototype'][_0x8bae('0x1d')]=function(_0x3a2335){return _0x3a2335!==null&&!_[_0x8bae('0x1e')](_0x3a2335);};UserReport[_0x8bae('0x1b')][_0x8bae('0x1f')]=function(_0xfeed28,_0x358600,_0x7f5114){io['to'](_0xfeed28)[_0x8bae('0x1f')](_0x358600,_0x7f5114);};UserReport[_0x8bae('0x1b')][_0x8bae('0xa')]=function(_0x248ffa){try{if(this[_0x8bae('0x1d')](_0x248ffa)){logger[_0x8bae('0x20')](_0x8bae('0x21'),_0x248ffa['username'],_0x248ffa['state']);logger[_0x8bae('0x22')](_0x8bae('0x23'),util[_0x8bae('0x17')](_0x248ffa,{'showHidden':![],'depth':null}));var _0x84ee5b=_[_0x8bae('0x24')](this['trunks'],{'defaultuser':_0x248ffa['username']});if(_0x84ee5b){_0x248ffa['stateRegistry']=_0x248ffa['state'];_['merge'](_0x84ee5b,_[_0x8bae('0x25')](_0x248ffa,[_0x8bae('0x26'),_0x8bae('0x27'),_0x8bae('0x28'),_0x8bae('0x29')]));logger[_0x8bae('0x22')](_0x8bae('0x2a'),util['inspect'](_0x84ee5b,{'showHidden':![],'depth':null}));this[_0x8bae('0x1f')](util[_0x8bae('0x2b')](_0x8bae('0x2c'),_0x84ee5b['name']),'trunk:save',_0x84ee5b);}}}catch(_0x3c2ad7){logger[_0x8bae('0x15')](_0x8bae('0x23'),util[_0x8bae('0x17')](_0x3c2ad7,{'showHidden':![],'depth':null}));}};UserReport[_0x8bae('0x1b')][_0x8bae('0xe')]=function(_0x11f450){try{if(this[_0x8bae('0x1d')](_0x11f450)){logger[_0x8bae('0x20')](_0x8bae('0x2d'),_0x11f450[_0x8bae('0x2e')],_0x11f450[_0x8bae('0x29')]);logger['debug'](_0x8bae('0x2f'),util[_0x8bae('0x17')](_0x11f450,{'showHidden':![],'depth':null}));if(this[_0x8bae('0x30')][_0x11f450['device']]){if(!this['agents'][_0x11f450[_0x8bae('0x2e')]][_0x8bae('0x31')]||_0x11f450[_0x8bae('0x29')]['toLowerCase']()=='inuse'){this[_0x8bae('0x30')][_0x11f450['device']][_0x8bae('0x31')]=![];if(this[_0x8bae('0x30')][_0x11f450[_0x8bae('0x2e')]]['state']!==_0x11f450[_0x8bae('0x29')][_0x8bae('0x32')]()){this['agents'][_0x11f450[_0x8bae('0x2e')]][_0x8bae('0x33')]=_[_0x8bae('0x34')](moment()[_0x8bae('0x2b')]('x'));}this[_0x8bae('0x30')][_0x11f450['device']]['state']=_0x11f450['state'][_0x8bae('0x32')]();this[_0x8bae('0x30')][_0x11f450[_0x8bae('0x2e')]][_0x8bae('0x35')](_0x11f450);}}else if(this[_0x8bae('0x9')][_0x11f450[_0x8bae('0x2e')]]){if(this['telephones'][_0x11f450[_0x8bae('0x2e')]][_0x8bae('0x29')]!==_0x11f450[_0x8bae('0x29')]['toLowerCase']()){this[_0x8bae('0x9')][_0x11f450[_0x8bae('0x2e')]]['stateTime']=_[_0x8bae('0x34')](moment()[_0x8bae('0x2b')]('x'));}this[_0x8bae('0x9')][_0x11f450[_0x8bae('0x2e')]][_0x8bae('0x29')]=_0x11f450[_0x8bae('0x29')]['toLowerCase']();logger[_0x8bae('0x22')]('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util['inspect'](this[_0x8bae('0x9')][_0x11f450[_0x8bae('0x2e')]],{'showHidden':![],'depth':null}));this[_0x8bae('0x1f')](util[_0x8bae('0x2b')](_0x8bae('0x36'),this['telephones'][_0x11f450['device']]['name']),_0x8bae('0x37'),this[_0x8bae('0x9')][_0x11f450['device']]);}else if(this[_0x8bae('0x8')][_0x11f450[_0x8bae('0x2e')]]){if(this[_0x8bae('0x8')][_0x11f450[_0x8bae('0x2e')]][_0x8bae('0x29')]!==_0x11f450[_0x8bae('0x29')]['toLowerCase']()){this['trunks'][_0x11f450[_0x8bae('0x2e')]][_0x8bae('0x33')]=_[_0x8bae('0x34')](moment()[_0x8bae('0x2b')]('x'));}this[_0x8bae('0x8')][_0x11f450['device']][_0x8bae('0x29')]=_0x11f450[_0x8bae('0x29')][_0x8bae('0x32')]();logger[_0x8bae('0x22')](_0x8bae('0x38'),util[_0x8bae('0x17')](this['trunks'][_0x11f450['device']],{'showHidden':![],'depth':null}));this[_0x8bae('0x1f')](util[_0x8bae('0x2b')](_0x8bae('0x2c'),this['trunks'][_0x11f450[_0x8bae('0x2e')]][_0x8bae('0x39')]),_0x8bae('0x3a'),this[_0x8bae('0x8')][_0x11f450['device']]);}else if(_[_0x8bae('0x3b')](_0x11f450[_0x8bae('0x2e')],_0x8bae('0x3c'))){var _0x33c68a=_0x11f450[_0x8bae('0x2e')];var _0x1d876c=_0x33c68a[_0x8bae('0x3d')](_0x33c68a[_0x8bae('0x3e')]('/')+0x1,_0x33c68a[_0x8bae('0x3e')]('@'));var _0x332568=_['find'](this[_0x8bae('0x30')],function(_0xd31602){return _0xd31602[_0x8bae('0x3f')]==_0x1d876c||_0xd31602[_0x8bae('0x40')]==_0x1d876c||_0xd31602[_0x8bae('0x41')]==_0x1d876c;});if(_0x332568){if(_0x332568['state']!==_0x11f450[_0x8bae('0x29')]['toLowerCase']()){_0x332568[_0x8bae('0x33')]=_['toNumber'](moment()[_0x8bae('0x2b')]('x'));}_0x332568[_0x8bae('0x29')]=_0x11f450[_0x8bae('0x29')][_0x8bae('0x32')]();_0x332568[_0x8bae('0x31')]=!![];_0x332568[_0x8bae('0x35')](_0x11f450);}}}}catch(_0x4c1226){logger[_0x8bae('0x15')](_0x8bae('0x2f'),util[_0x8bae('0x17')](_0x4c1226,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x8bae('0x10')]=function(_0x3c79b9){try{if(this[_0x8bae('0x1d')](_0x3c79b9)&&this['isNotNull'](_0x3c79b9[_0x8bae('0xf')])){logger[_0x8bae('0x20')](_0x8bae('0x42'),_0x3c79b9[_0x8bae('0x43')],_0x3c79b9['address'],_0x3c79b9['peerstatus']);logger[_0x8bae('0x22')]('[userReport][peerstatus]',util[_0x8bae('0x17')](_0x3c79b9,{'showHidden':![],'depth':null}));if(this[_0x8bae('0x30')][_0x3c79b9[_0x8bae('0x43')]]){if(!this[_0x8bae('0x30')][_0x3c79b9['peer']][_0x8bae('0x31')]||_0x3c79b9[_0x8bae('0xf')][_0x8bae('0x32')]()==_0x8bae('0x44')){this[_0x8bae('0x30')][_0x3c79b9[_0x8bae('0x43')]][_0x8bae('0x31')]=![];this[_0x8bae('0x30')][_0x3c79b9[_0x8bae('0x43')]][_0x8bae('0x45')]=_0x3c79b9[_0x8bae('0xf')][_0x8bae('0x32')]();this['agents'][_0x3c79b9[_0x8bae('0x43')]][_0x8bae('0x46')]=_0x3c79b9['address'];this[_0x8bae('0x30')][_0x3c79b9[_0x8bae('0x43')]]['updateStatusRealtime'](_0x3c79b9);}}else if(this[_0x8bae('0x9')][_0x3c79b9[_0x8bae('0x43')]]){this[_0x8bae('0x9')][_0x3c79b9['peer']][_0x8bae('0x45')]=_0x3c79b9[_0x8bae('0xf')][_0x8bae('0x32')]();this[_0x8bae('0x9')][_0x3c79b9[_0x8bae('0x43')]]['address']=_0x3c79b9[_0x8bae('0x46')];logger['debug'](_0x8bae('0x47'),util[_0x8bae('0x17')](this[_0x8bae('0x9')][_0x3c79b9[_0x8bae('0x43')]],{'showHidden':![],'depth':null}));this[_0x8bae('0x1f')](util[_0x8bae('0x2b')](_0x8bae('0x36'),this[_0x8bae('0x9')][_0x3c79b9['peer']]['name']),_0x8bae('0x37'),this['telephones'][_0x3c79b9[_0x8bae('0x43')]]);}else if(this['trunks'][_0x3c79b9[_0x8bae('0x43')]]){this[_0x8bae('0x8')][_0x3c79b9[_0x8bae('0x43')]]['status']=_0x3c79b9[_0x8bae('0xf')][_0x8bae('0x32')]();this[_0x8bae('0x8')][_0x3c79b9[_0x8bae('0x43')]][_0x8bae('0x46')]=_0x3c79b9[_0x8bae('0x46')];logger['debug']('[userReport][peerstatus]\x20sending\x20trunk:save\x20event:',util[_0x8bae('0x17')](this['trunks'][_0x3c79b9[_0x8bae('0x43')]],{'showHidden':![],'depth':null}));this[_0x8bae('0x1f')](util[_0x8bae('0x2b')](_0x8bae('0x2c'),this['trunks'][_0x3c79b9['peer']][_0x8bae('0x39')]),_0x8bae('0x3a'),this[_0x8bae('0x8')][_0x3c79b9[_0x8bae('0x43')]]);}}}catch(_0x2ac815){logger[_0x8bae('0x15')](_0x8bae('0x48'),util[_0x8bae('0x17')](_0x2ac815,{'showHidden':![],'depth':null}));}};module[_0x8bae('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 3b407bf..22f4cbf 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 _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 +var _0x8111=['YYYY-MM-DD\x20HH:mm:ss','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','routealias','destconnectedlinenum','name','exten','custom:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswer','answeredelsewheredestinationuniqueid','answeredelsewheremembername','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','agentringnoanswerAt','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','agentcomplete','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','talktime','acw','acwtime','acwTimeout','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','user:agentcomplete','addVariable','keys','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepvtcallid','membercalls','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','transfer','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','agentcompleteAt','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','syncBlindTransfer','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','syncMusicOnHoldStart','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','syncMusicOnHoldStop','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','lodash','ioredis','../../../config/environment','../ami','redis','localhost','voiceChannels','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','syncAgentConnect','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','bind','syncAgentComplete','varset','syncVarSet','syncHangup','musiconholdstart','musiconholdstop','syncAttendedTransfer','blindtransfer','prototype','emit','isNotNull','isUndefined','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','interface','queue','format','called','mandatoryDisposition','type','voice','assign','omit','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','calleridnum','user:%s','error','[%s][voiceAgentReport][agentcalled]','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt'];(function(_0x18d95e,_0x33e9e5){var _0x2ed8fe=function(_0x8a48f){while(--_0x8a48f){_0x18d95e['push'](_0x18d95e['shift']());}};_0x2ed8fe(++_0x33e9e5);}(_0x8111,0x191));var _0x1811=function(_0x471a5f,_0xe3b767){_0x471a5f=_0x471a5f-0x0;var _0x50fc84=_0x8111[_0x471a5f];return _0x50fc84;};'use strict';var _=require(_0x1811('0x0'));var moment=require('moment');var util=require('util');var Redis=require(_0x1811('0x1'));var config=require(_0x1811('0x2'));var logger=require('../../../config/logger')('ami');var ami=require(_0x1811('0x3'));config[_0x1811('0x4')]=_['defaults'](config[_0x1811('0x4')],{'host':_0x1811('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1811('0x4')]));function VoiceAgentReport(_0x43d0b1){this['channels']={};this[_0x1811('0x6')]=_0x43d0b1[_0x1811('0x7')];this[_0x1811('0x8')]=_0x43d0b1['voiceQueues'];this['agents']=_0x43d0b1[_0x1811('0x9')];this[_0x1811('0xa')]={};ami['on'](_0x1811('0xb'),this[_0x1811('0xc')]['bind'](this));ami['on']('agentconnect',this[_0x1811('0xd')]['bind'](this));ami['on']('agentringnoanswer',this[_0x1811('0xe')]['bind'](this));ami['on'](_0x1811('0xf'),this[_0x1811('0x10')][_0x1811('0x11')](this));ami['on']('agentcomplete',this[_0x1811('0x12')][_0x1811('0x11')](this));ami['on'](_0x1811('0x13'),this[_0x1811('0x14')][_0x1811('0x11')](this));ami['on']('hangup',this[_0x1811('0x15')][_0x1811('0x11')](this));ami['on'](_0x1811('0x16'),this['syncMusicOnHoldStart'][_0x1811('0x11')](this));ami['on'](_0x1811('0x17'),this['syncMusicOnHoldStop'][_0x1811('0x11')](this));ami['on']('attendedtransfer',this[_0x1811('0x18')]['bind'](this));ami['on'](_0x1811('0x19'),this['syncBlindTransfer']['bind'](this));}VoiceAgentReport[_0x1811('0x1a')][_0x1811('0x1b')]=function(_0x1d2373,_0x4291b5,_0x34ff21){io['to'](_0x1d2373)[_0x1811('0x1b')](_0x4291b5,_0x34ff21);};VoiceAgentReport[_0x1811('0x1a')][_0x1811('0x1c')]=function(_0x33b41c){return _0x33b41c!==null&&!_[_0x1811('0x1d')](_0x33b41c);};VoiceAgentReport['prototype'][_0x1811('0xc')]=function(_0x223fec){try{if(this[_0x1811('0x1c')](_0x223fec)){logger[_0x1811('0x1e')](_0x1811('0x1f'),_0x223fec[_0x1811('0x20')],_0x223fec[_0x1811('0x21')],_0x223fec[_0x1811('0x22')]);logger[_0x1811('0x23')](_0x1811('0x24'),_0x223fec[_0x1811('0x20')],util[_0x1811('0x25')](_0x223fec,{'showHidden':![],'depth':null}));if(_[_0x1811('0x1d')](this[_0x1811('0x7')][_0x223fec['uniqueid']])){this[_0x1811('0x7')][_0x223fec[_0x1811('0x20')]]={};}var _0x290b05=this[_0x1811('0x9')][_0x223fec[_0x1811('0x26')]];var _0x1d3650=this[_0x1811('0x7')][_0x223fec[_0x1811('0x20')]][_0x223fec[_0x1811('0x22')]];var _0x44c508=this[_0x1811('0x8')][_0x223fec[_0x1811('0x27')]];var _0x25baf2=this['variables'][_0x223fec[_0x1811('0x20')]];if(_[_0x1811('0x1d')](_0x1d3650)){_0x1d3650={'agentcalledAt':moment()[_0x1811('0x28')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0x1811('0x29'),'mandatoryDisposition':_0x44c508&&_0x44c508['mandatoryDisposition']?_0x44c508[_0x1811('0x2a')]:![],'type':_0x44c508&&_0x44c508[_0x1811('0x2b')]?_0x44c508[_0x1811('0x2b')]:'inbound','variables':_0x25baf2,'motionChannel':_0x1811('0x2c')};}Object[_0x1811('0x2d')](_0x1d3650,_[_0x1811('0x2e')](_0x223fec,['event','privilege']));this[_0x1811('0x7')][_0x223fec[_0x1811('0x20')]][_0x223fec['destuniqueid']]=_0x1d3650;logger[_0x1811('0x23')](_0x1811('0x2f'),_0x223fec[_0x1811('0x20')],util[_0x1811('0x25')](_0x1d3650,{'showHidden':![],'depth':null}));ami[_0x1811('0x1b')]('custom:agentcalled',_0x1d3650);var _0x28ddc6={'id':_0x290b05['id'],'calleridnum':_0x1d3650[_0x1811('0x30')],'queue':_0x1d3650[_0x1811('0x27')],'variables':_0x1d3650[_0x1811('0xa')],'uniqueid':_0x223fec[_0x1811('0x20')]};logger[_0x1811('0x23')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x223fec[_0x1811('0x20')],util[_0x1811('0x25')](_0x28ddc6,{'showHidden':![],'depth':null}));this[_0x1811('0x1b')](util[_0x1811('0x28')](_0x1811('0x31'),_0x223fec[_0x1811('0x21')]),'user:called',_0x28ddc6);}}catch(_0x4fdeb2){logger[_0x1811('0x32')](_0x1811('0x33'),_0x223fec[_0x1811('0x20')],util[_0x1811('0x25')](_0x4fdeb2,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1811('0x1a')]['syncAgentConnect']=function(_0x3d11d4){try{if(this[_0x1811('0x1c')](_0x3d11d4)){if(this[_0x1811('0x7')][_0x3d11d4['uniqueid']]){for(var _0x130b67 in this[_0x1811('0x7')][_0x3d11d4[_0x1811('0x20')]]){if(this[_0x1811('0x7')][_0x3d11d4[_0x1811('0x20')]][_0x1811('0x34')](_0x130b67)){if(_0x3d11d4[_0x1811('0x22')]===_0x130b67){logger[_0x1811('0x1e')](_0x1811('0x35'),_0x3d11d4[_0x1811('0x20')],_0x3d11d4['membername'],_0x3d11d4[_0x1811('0x22')]);this[_0x1811('0x7')][_0x3d11d4[_0x1811('0x20')]][_0x130b67][_0x1811('0x36')]=moment()[_0x1811('0x28')](_0x1811('0x37'));this[_0x1811('0x7')][_0x3d11d4[_0x1811('0x20')]][_0x130b67][_0x1811('0x38')]=_0x3d11d4[_0x1811('0x38')];this[_0x1811('0x7')][_0x3d11d4[_0x1811('0x20')]][_0x130b67][_0x1811('0x39')]=_0x3d11d4[_0x1811('0x39')];this[_0x1811('0x7')][_0x3d11d4[_0x1811('0x20')]][_0x130b67][_0x1811('0x3a')]=_0x3d11d4[_0x1811('0x3a')];this[_0x1811('0x7')][_0x3d11d4[_0x1811('0x20')]][_0x130b67][_0x1811('0x3b')]=_0x3d11d4[_0x1811('0x3b')];this[_0x1811('0x7')][_0x3d11d4[_0x1811('0x20')]][_0x130b67]['holdtime']=_0x3d11d4[_0x1811('0x3c')];this[_0x1811('0x7')][_0x3d11d4[_0x1811('0x20')]][_0x130b67][_0x1811('0x3d')]=_0x1811('0x3e');if(this[_0x1811('0x6')][this[_0x1811('0x7')][_0x3d11d4[_0x1811('0x20')]][_0x130b67][_0x1811('0x20')]]){var _0x49dffc=this[_0x1811('0x6')][this[_0x1811('0x7')][_0x3d11d4[_0x1811('0x20')]][_0x130b67][_0x1811('0x20')]][_0x1811('0x3f')];this[_0x1811('0x7')][_0x3d11d4[_0x1811('0x20')]][_0x130b67][_0x1811('0x3f')]=_0x49dffc;_0x3d11d4[_0x1811('0x3f')]=_0x49dffc;}_['merge'](this[_0x1811('0x9')][_0x3d11d4['interface']],_['pick'](_0x3d11d4,[_0x1811('0x27'),_0x1811('0x40'),_0x1811('0x3f')]));var _0x5b7fa3=this[_0x1811('0x9')][_0x3d11d4['interface']];var _0x3635c7={'id':_0x5b7fa3['id'],'name':_0x5b7fa3[_0x1811('0x41')],'agentconnected':!![],'destaccountcode':_0x5b7fa3['accountcode'],'destconnectedlinenum':this[_0x1811('0x7')][_0x3d11d4[_0x1811('0x20')]][_0x3d11d4[_0x1811('0x22')]][_0x1811('0x42')],'queue':this[_0x1811('0x7')][_0x3d11d4[_0x1811('0x20')]][_0x3d11d4[_0x1811('0x22')]][_0x1811('0x27')],'routealias':this['channels'][_0x3d11d4['uniqueid']][_0x3d11d4['destuniqueid']][_0x1811('0x3f')],'uniqueid':this['channels'][_0x3d11d4[_0x1811('0x20')]][_0x3d11d4['destuniqueid']]['uniqueid']};ami['emit'](_0x1811('0x43'),this[_0x1811('0x7')][_0x3d11d4[_0x1811('0x20')]][_0x3d11d4[_0x1811('0x22')]]);this[_0x1811('0x1b')](util['format'](_0x1811('0x31'),_0x3d11d4[_0x1811('0x21')]),'user:agentconnect',_0x3635c7);}else if(!this[_0x1811('0x7')][_0x3d11d4[_0x1811('0x20')]][_0x130b67]['agentringnoanswer']&&!this[_0x1811('0x7')][_0x3d11d4[_0x1811('0x20')]][_0x130b67]['agentcomplete']){logger[_0x1811('0x1e')](_0x1811('0x44'),_0x3d11d4[_0x1811('0x20')],this[_0x1811('0x7')][_0x3d11d4['uniqueid']][_0x130b67]['membername'],_0x130b67);this[_0x1811('0x7')][_0x3d11d4[_0x1811('0x20')]][_0x130b67][_0x1811('0x45')]=!![];this[_0x1811('0x7')][_0x3d11d4[_0x1811('0x20')]][_0x130b67]['agentringnoanswerAt']=moment()[_0x1811('0x28')](_0x1811('0x37'));this[_0x1811('0x7')][_0x3d11d4['uniqueid']][_0x130b67][_0x1811('0x46')]=_0x3d11d4['destuniqueid'];this[_0x1811('0x7')][_0x3d11d4[_0x1811('0x20')]][_0x130b67][_0x1811('0x47')]=_0x3d11d4[_0x1811('0x21')];this[_0x1811('0x7')][_0x3d11d4[_0x1811('0x20')]][_0x130b67][_0x1811('0x3d')]=_0x1811('0x48');this[_0x1811('0x7')][_0x3d11d4[_0x1811('0x20')]][_0x130b67][_0x1811('0x49')]='answered_elsewhere';logger[_0x1811('0x23')](_0x1811('0x4a'),_0x3d11d4[_0x1811('0x20')],util[_0x1811('0x25')](this[_0x1811('0x7')][_0x3d11d4[_0x1811('0x20')]][_0x130b67],{'showHidden':![],'depth':null}));ami[_0x1811('0x1b')](_0x1811('0x4b'),this[_0x1811('0x7')][_0x3d11d4[_0x1811('0x20')]][_0x130b67]);}else{logger['debug'](_0x1811('0x4c'),_0x3d11d4[_0x1811('0x20')]);}}}}}}catch(_0x74ced1){logger[_0x1811('0x32')](_0x1811('0x4d'),_0x3d11d4[_0x1811('0x20')],util[_0x1811('0x25')](_0x74ced1,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncAgentRingNoAnswer']=function(_0x45de6d){try{if(this[_0x1811('0x1c')](_0x45de6d)){logger[_0x1811('0x23')](_0x1811('0x4e'),_0x45de6d[_0x1811('0x20')],util[_0x1811('0x25')](_0x45de6d,{'showHidden':![],'depth':null}));if(this[_0x1811('0x7')][_0x45de6d[_0x1811('0x20')]]&&this['channels'][_0x45de6d[_0x1811('0x20')]][_0x45de6d['destuniqueid']]){logger[_0x1811('0x1e')]('[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected',_0x45de6d['uniqueid'],_0x45de6d[_0x1811('0x21')],_0x45de6d[_0x1811('0x22')]);var _0x203867=this['agents'][_0x45de6d[_0x1811('0x26')]];var _0x436300=this[_0x1811('0x7')][_0x45de6d[_0x1811('0x20')]][_0x45de6d['destuniqueid']];_0x436300[_0x1811('0x45')]=!![];_0x436300[_0x1811('0x4f')]=moment()[_0x1811('0x28')]('YYYY-MM-DD\x20HH:mm:ss');_0x436300['lastevent']=_0x1811('0x50');_0x436300[_0x1811('0x49')]=_0x1811('0x50');var _0x19ed2a={'id':_0x203867['id'],'name':_0x203867[_0x1811('0x41')],'queue':_0x436300[_0x1811('0x27')],'uniqueid':_0x436300[_0x1811('0x20')]};logger[_0x1811('0x23')](_0x1811('0x51'),_0x45de6d[_0x1811('0x20')],util[_0x1811('0x25')](_0x19ed2a,{'showHidden':![],'depth':null}));this[_0x1811('0x1b')](util['format']('user:%s',_0x203867[_0x1811('0x41')]),'user:agentringnoanswer',_0x19ed2a);ami[_0x1811('0x1b')](_0x1811('0x52'),_0x436300);this['channels'][_0x45de6d['uniqueid']][_0x45de6d[_0x1811('0x22')]]=Object['assign']({},_0x436300);}}}catch(_0x2b121a){logger[_0x1811('0x32')](_0x1811('0x53'),_0x45de6d[_0x1811('0x20')],util['inspect'](_0x2b121a,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1811('0x1a')][_0x1811('0x10')]=function(_0x4c278c){try{if(this['isNotNull'](_0x4c278c)){logger[_0x1811('0x23')](_0x1811('0x54'),_0x4c278c[_0x1811('0x20')],util[_0x1811('0x25')](_0x4c278c,{'showHidden':![],'depth':null}));if(this[_0x1811('0x7')][_0x4c278c[_0x1811('0x20')]]){for(var _0xdcd105 in this['channels'][_0x4c278c[_0x1811('0x20')]]){if(this[_0x1811('0x7')][_0x4c278c[_0x1811('0x20')]][_0x1811('0x34')](_0xdcd105)&&!this[_0x1811('0x7')][_0x4c278c[_0x1811('0x20')]][_0xdcd105]['agentringnoanswer']&&!this[_0x1811('0x7')][_0x4c278c[_0x1811('0x20')]][_0xdcd105][_0x1811('0x55')]){logger[_0x1811('0x1e')]('[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x4c278c[_0x1811('0x20')],this[_0x1811('0x7')][_0x4c278c[_0x1811('0x20')]][_0xdcd105][_0x1811('0x21')],_0xdcd105);this['channels'][_0x4c278c['uniqueid']][_0xdcd105][_0x1811('0x45')]=!![];this[_0x1811('0x7')][_0x4c278c[_0x1811('0x20')]][_0xdcd105][_0x1811('0x4f')]=moment()['format'](_0x1811('0x37'));this[_0x1811('0x7')][_0x4c278c[_0x1811('0x20')]][_0xdcd105][_0x1811('0x3d')]='abandoned';this[_0x1811('0x7')][_0x4c278c[_0x1811('0x20')]][_0xdcd105][_0x1811('0x49')]='abandoned';logger['debug'](_0x1811('0x56'),_0x4c278c[_0x1811('0x20')],util[_0x1811('0x25')](this['channels'][_0x4c278c[_0x1811('0x20')]][_0xdcd105],{'showHidden':![],'depth':null}));ami[_0x1811('0x1b')](_0x1811('0x57'),this['channels'][_0x4c278c[_0x1811('0x20')]][_0xdcd105]);}}}}}catch(_0x305540){logger[_0x1811('0x32')](_0x1811('0x58'),_0x4c278c[_0x1811('0x20')],util[_0x1811('0x25')](_0x305540,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1811('0x1a')][_0x1811('0x12')]=function(_0x4e2cba){try{if(this[_0x1811('0x1c')](_0x4e2cba)){logger[_0x1811('0x23')](_0x1811('0x59'),_0x4e2cba[_0x1811('0x20')],util['inspect'](_0x4e2cba,{'showHidden':![],'depth':null}));if(this[_0x1811('0x7')][_0x4e2cba[_0x1811('0x20')]]){for(var _0x26a764 in this[_0x1811('0x7')][_0x4e2cba[_0x1811('0x20')]]){if(this[_0x1811('0x7')][_0x4e2cba[_0x1811('0x20')]]['hasOwnProperty'](_0x26a764)){if(this['channels'][_0x4e2cba[_0x1811('0x20')]][_0x26a764]['agentconnectAt']&&!this[_0x1811('0x7')][_0x4e2cba[_0x1811('0x20')]][_0x26a764]['agentcomplete']){logger['info'](_0x1811('0x5a'),_0x4e2cba['uniqueid'],this[_0x1811('0x7')][_0x4e2cba[_0x1811('0x20')]][_0x26a764][_0x1811('0x21')],_0x26a764);this[_0x1811('0x7')][_0x4e2cba[_0x1811('0x20')]][_0x26a764][_0x1811('0x55')]=!![];this[_0x1811('0x7')][_0x4e2cba[_0x1811('0x20')]][_0x26a764]['agentcompleteAt']=moment()[_0x1811('0x28')](_0x1811('0x37'));this[_0x1811('0x7')][_0x4e2cba['uniqueid']][_0x26a764]['lastevent']='complete';this['channels'][_0x4e2cba[_0x1811('0x20')]][_0x26a764][_0x1811('0x49')]=_0x4e2cba[_0x1811('0x49')]=='transfer'?'agent':_0x4e2cba[_0x1811('0x49')];this[_0x1811('0x7')][_0x4e2cba[_0x1811('0x20')]][_0x26a764][_0x1811('0x5b')]=_0x4e2cba[_0x1811('0x5b')];if(this['voiceQueues'][_0x4e2cba[_0x1811('0x27')]]&&this[_0x1811('0x8')][_0x4e2cba['queue']][_0x1811('0x5c')]){this[_0x1811('0x7')][_0x4e2cba[_0x1811('0x20')]][_0x26a764][_0x1811('0x5d')]=this[_0x1811('0x8')][_0x4e2cba['queue']][_0x1811('0x5e')];this[_0x1811('0x7')][_0x4e2cba[_0x1811('0x20')]][_0x26a764][_0x1811('0x5f')]=!![];}this['agents'][_0x4e2cba[_0x1811('0x26')]]=_[_0x1811('0x2e')](this[_0x1811('0x9')][_0x4e2cba[_0x1811('0x26')]],[_0x1811('0x27'),_0x1811('0x40')]);logger['debug'](_0x1811('0x60'),_0x4e2cba[_0x1811('0x20')],util[_0x1811('0x25')](this[_0x1811('0x7')][_0x4e2cba[_0x1811('0x20')]][_0x26a764],{'showHidden':![],'depth':null}));ami['emit'](_0x1811('0x61'),this[_0x1811('0x7')][_0x4e2cba[_0x1811('0x20')]][_0x26a764]);logger[_0x1811('0x23')](_0x1811('0x62'),_0x4e2cba[_0x1811('0x20')],util[_0x1811('0x25')]({'id':this[_0x1811('0x9')][_0x4e2cba[_0x1811('0x26')]]['id'],'destaccountcode':_0x4e2cba[_0x1811('0x63')]},{'showHidden':![],'depth':null}));this['emit'](util[_0x1811('0x28')]('user:%s',_0x4e2cba[_0x1811('0x21')]),_0x1811('0x64'),{'id':this[_0x1811('0x9')][_0x4e2cba[_0x1811('0x26')]]['id'],'destaccountcode':Number(_0x4e2cba[_0x1811('0x63')])});}}}}}}catch(_0x59b13f){logger[_0x1811('0x32')]('[%s][voiceAgentReport][agentcomplete]',_0x4e2cba['uniqueid'],util[_0x1811('0x25')](_0x59b13f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1811('0x1a')][_0x1811('0x14')]=function(_0x2091fb){try{if(this[_0x1811('0x1c')](_0x2091fb)){logger[_0x1811('0x23')]('[%s][voiceAgentReport][varset]\x20event:',_0x2091fb['uniqueid'],util[_0x1811('0x25')](_0x2091fb,{'showHidden':![],'depth':null}));this[_0x1811('0x65')](_0x2091fb[_0x1811('0x20')],_[_0x1811('0x66')](_0x2091fb['variable'])[0x0],_0x2091fb[_0x1811('0x67')]);if(this['channels'][_0x2091fb[_0x1811('0x20')]]){for(var _0xf65186 in this['channels'][_0x2091fb[_0x1811('0x20')]]){if(this[_0x1811('0x7')][_0x2091fb[_0x1811('0x20')]][_0x1811('0x34')](_0xf65186)){logger[_0x1811('0x1e')](_0x1811('0x68'),_0x2091fb[_0x1811('0x20')],_0xf65186,_[_0x1811('0x66')](_0x2091fb['variable'])[0x0],_0x2091fb[_0x1811('0x67')]);if(_[_0x1811('0x1d')](this['channels'][_0x2091fb[_0x1811('0x20')]][_0xf65186]['variables'])){this[_0x1811('0x7')][_0x2091fb['uniqueid']][_0xf65186][_0x1811('0xa')]={};}this['channels'][_0x2091fb[_0x1811('0x20')]][_0xf65186][_0x1811('0xa')]=this['variables'][_0x2091fb[_0x1811('0x20')]];}}}}}catch(_0x2533ba){logger[_0x1811('0x32')](_0x1811('0x69'),_0x2091fb['uniqueid'],util[_0x1811('0x25')](_0x2533ba,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1811('0x1a')]['addVariable']=function(_0x157de2,_0xa0d05a,_0x26702d){var _0x167862=[_0x1811('0x6a'),'rtpaudioqosbridged',_0x1811('0x6b'),_0x1811('0x6c'),_0x1811('0x6d'),_0x1811('0x6e'),_0x1811('0x6f'),_0x1811('0x70'),_0x1811('0x71'),'sipuri','bridgepeer',_0x1811('0x72'),_0x1811('0x73'),'memberdynamic',_0x1811('0x74'),_0x1811('0x75'),_0x1811('0x21'),_0x1811('0x76'),_0x1811('0x77')];if(!_[_0x1811('0x78')](_0xa0d05a)&&!_[_0x1811('0x79')](_0x167862,_0xa0d05a)){if(_[_0x1811('0x1d')](this[_0x1811('0xa')][_0x157de2])){this[_0x1811('0xa')][_0x157de2]={};}this['variables'][_0x157de2][_0xa0d05a]=_0x26702d;}};VoiceAgentReport[_0x1811('0x1a')][_0x1811('0x15')]=function(_0x2848f4){try{if(this[_0x1811('0x1c')](_0x2848f4)){logger['debug'](_0x1811('0x7a'),_0x2848f4['uniqueid'],util['inspect'](_0x2848f4,{'showHidden':![],'depth':null}));if(this[_0x1811('0x7')][_0x2848f4['uniqueid']]){for(var _0x5d9a9b in this[_0x1811('0x7')][_0x2848f4[_0x1811('0x20')]]){if(this[_0x1811('0x7')][_0x2848f4[_0x1811('0x20')]][_0x1811('0x34')](_0x5d9a9b)){if(this['channels'][_0x2848f4[_0x1811('0x20')]][_0x5d9a9b][_0x1811('0x49')]==_0x1811('0x7b')&&this['channels'][_0x2848f4['uniqueid']][_0x5d9a9b][_0x1811('0x55')]){logger['info'](_0x1811('0x7c'),_0x2848f4['uniqueid'],_0x5d9a9b);this[_0x1811('0x7')][_0x2848f4[_0x1811('0x20')]][_0x5d9a9b][_0x1811('0x7d')]=moment()[_0x1811('0x28')](_0x1811('0x37'));}}}logger[_0x1811('0x23')](_0x1811('0x7e'),_0x2848f4[_0x1811('0x20')],util['inspect'](_[_0x1811('0x7f')](this[_0x1811('0x7')][_0x2848f4[_0x1811('0x20')]]),{'showHidden':![],'depth':null}));ami[_0x1811('0x1b')](_0x1811('0x80'),_[_0x1811('0x7f')](this['channels'][_0x2848f4['uniqueid']]));delete this[_0x1811('0x7')][_0x2848f4[_0x1811('0x20')]];}if(this[_0x1811('0xa')][_0x2848f4[_0x1811('0x20')]]){delete this[_0x1811('0xa')][_0x2848f4[_0x1811('0x20')]];}}}catch(_0x355392){logger[_0x1811('0x32')](_0x1811('0x81'),_0x2848f4[_0x1811('0x20')],util[_0x1811('0x25')](_0x355392,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x1811('0x18')]=function(_0x295c7d){try{if(this['isNotNull'](_0x295c7d)){logger[_0x1811('0x23')](_0x1811('0x82'),_0x295c7d['uniqueid'],util[_0x1811('0x25')](_0x295c7d,{'showHidden':![],'depth':null}));if(this[_0x1811('0x7')][_0x295c7d[_0x1811('0x83')]]){for(var _0x3238eb in this[_0x1811('0x7')][_0x295c7d[_0x1811('0x83')]]){if(this[_0x1811('0x7')][_0x295c7d[_0x1811('0x83')]][_0x1811('0x34')](_0x3238eb)){if(_0x295c7d['origtransfereruniqueid']===_0x3238eb){logger[_0x1811('0x1e')](_0x1811('0x84'),_0x295c7d['uniqueid'],this[_0x1811('0x7')][_0x295c7d['transfereeuniqueid']][_0x3238eb]['membername'],_0x3238eb);var _0x1421d0=moment();this[_0x1811('0x7')][_0x295c7d[_0x1811('0x83')]][_0x3238eb][_0x1811('0x55')]=!![];this[_0x1811('0x7')][_0x295c7d[_0x1811('0x83')]][_0x3238eb][_0x1811('0x7d')]=moment()[_0x1811('0x28')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x1811('0x7')][_0x295c7d['transfereeuniqueid']][_0x3238eb][_0x1811('0x3d')]='complete';this['channels'][_0x295c7d['transfereeuniqueid']][_0x3238eb][_0x1811('0x49')]='transfer';this[_0x1811('0x7')][_0x295c7d[_0x1811('0x83')]][_0x3238eb]['talktime']=_0x1421d0[_0x1811('0x85')](this['channels'][_0x295c7d[_0x1811('0x83')]][_0x3238eb][_0x1811('0x36')],_0x1811('0x86'));}}}}if(this[_0x1811('0x7')][_0x295c7d[_0x1811('0x87')]]){var _0x55b8c5=this[_0x1811('0x7')][_0x295c7d[_0x1811('0x87')]];this[_0x1811('0x7')][_0x295c7d[_0x1811('0x87')]]=this['channels'][_0x295c7d['transfereeuniqueid']];this[_0x1811('0x7')][_0x295c7d[_0x1811('0x83')]]=_0x55b8c5;}}}catch(_0x55bc6f){logger[_0x1811('0x32')](_0x1811('0x88'),_0x295c7d[_0x1811('0x20')],util['inspect'](_0x55bc6f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1811('0x1a')][_0x1811('0x89')]=function(_0x387589){try{if(this[_0x1811('0x1c')](_0x387589)){logger['debug'](_0x1811('0x8a'),_0x387589[_0x1811('0x20')],util[_0x1811('0x25')](_0x387589,{'showHidden':![],'depth':null}));if(this['channels'][_0x387589[_0x1811('0x83')]]){for(var _0x5dde4f in this[_0x1811('0x7')][_0x387589[_0x1811('0x83')]]){if(this['channels'][_0x387589[_0x1811('0x83')]]['hasOwnProperty'](_0x5dde4f)){if(_0x387589[_0x1811('0x8b')]===_0x5dde4f){logger[_0x1811('0x1e')](_0x1811('0x8c'),_0x387589['uniqueid'],this[_0x1811('0x7')][_0x387589[_0x1811('0x83')]][_0x5dde4f][_0x1811('0x21')],_0x5dde4f);var _0x3a5ced=moment();this['channels'][_0x387589[_0x1811('0x83')]][_0x5dde4f][_0x1811('0x55')]=!![];this[_0x1811('0x7')][_0x387589[_0x1811('0x83')]][_0x5dde4f][_0x1811('0x7d')]=_0x3a5ced;this[_0x1811('0x7')][_0x387589[_0x1811('0x83')]][_0x5dde4f][_0x1811('0x3d')]='complete';this[_0x1811('0x7')][_0x387589[_0x1811('0x83')]][_0x5dde4f][_0x1811('0x49')]=_0x1811('0x7b');this[_0x1811('0x7')][_0x387589['transfereeuniqueid']][_0x5dde4f][_0x1811('0x5b')]=_0x3a5ced[_0x1811('0x85')](this[_0x1811('0x7')][_0x387589[_0x1811('0x83')]][_0x5dde4f][_0x1811('0x36')],_0x1811('0x86'));}}}}}}catch(_0x3dddc9){logger[_0x1811('0x32')]('[%s][voiceAgentReport][blindtransfer]',_0x387589[_0x1811('0x20')],util[_0x1811('0x25')](_0x3dddc9,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1811('0x1a')][_0x1811('0x8d')]=function(_0x177772){var _0x51dbb5='';try{if(this[_0x1811('0x1c')](_0x177772)){logger[_0x1811('0x23')](_0x1811('0x8e'),_0x177772[_0x1811('0x20')],util['inspect'](_0x177772,{'showHidden':![],'depth':null}));if(_0x177772[_0x1811('0x8f')]){_0x51dbb5=_0x177772[_0x1811('0x8f')]['substring'](0x0,_0x177772[_0x1811('0x8f')][_0x1811('0x90')]('-'));if(this['agents'][_0x51dbb5]){logger[_0x1811('0x1e')](_0x1811('0x91'),_0x177772[_0x1811('0x20')],_0x51dbb5);this[_0x1811('0x9')][_0x51dbb5][_0x1811('0x92')]=!![];}}}}catch(_0x53ffb9){logger['error'](_0x1811('0x93'),_0x177772[_0x1811('0x20')],util[_0x1811('0x25')](_0x53ffb9,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x1811('0x1a')][_0x1811('0x94')]=function(_0x45faa7){var _0x3b3344='';try{if(this[_0x1811('0x1c')](_0x45faa7)){logger['debug'](_0x1811('0x95'),_0x45faa7[_0x1811('0x20')],util['inspect'](_0x45faa7,{'showHidden':![],'depth':null}));if(_0x45faa7[_0x1811('0x8f')]){_0x3b3344=_0x45faa7[_0x1811('0x8f')]['substring'](0x0,_0x45faa7[_0x1811('0x8f')]['lastIndexOf']('-'));if(this[_0x1811('0x9')][_0x3b3344]){logger[_0x1811('0x1e')](_0x1811('0x96'),_0x45faa7[_0x1811('0x20')],_0x3b3344);this[_0x1811('0x9')][_0x3b3344][_0x1811('0x92')]=![];}}}}catch(_0x30e720){logger[_0x1811('0x32')](_0x1811('0x97'),_0x45faa7[_0x1811('0x20')],util[_0x1811('0x25')](_0x30e720,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 17856c3..528eb19 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 _0x5260=['syncNewExten','bind','newchannel','syncNewChannel','newstate','syncNewState','varset','syncVarSet','hangup','syncHangup','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isUndefined','emit','syncNewCallerId','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','debug','linkedid','merge','keys','context','from-sip','channel','split','exten','xcally-motion-preview','destconnectedlinenum','connectedlinenum','format','user:%s','name','user:agentconnect','accountcode','[%s][voiceCallReport][newcallerid]','isNotNull','[%s][voiceCallReport][newchannel]\x20event:','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','pick','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','OutgoingSpoolFailed','application','toLowerCase','applicationdata','appdata','startsWith','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','starttime','duration','subtract','seconds','includes','lastdata','cdr(','match','type','isNil','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','channelstate','answered','answertime','diff','connectedlinename','destinationchannel','holdtime','routealias','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newstate]','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','.wav49','replace','.WAV','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','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','destination','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','parse','syncMixMonitorFilename','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','transferType','resolve','then','transferToInternal','isEmpty','getSettings','stopRecordingOnTransfer','Action','StopMixMonitor','catch','finally','event','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','transfertargetcalleridnum','origtransfereruniqueid','origtransfererlinkedid','some','routeid','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','[%s][voiceCallReport][blindtransfer]\x20event:','extension','BLIND','transfererchannel','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','mohtime','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','moment','path','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','set','queue','agi','dial','playback','FAILED','NO\x20ANSWER','ANSWERED','BUSY','redis','defaults','localhost','socket.io-emitter','channels','agents','blindTransfers','coreshowchannel'];(function(_0x234018,_0x29b50d){var _0x1d4fd6=function(_0x4551d5){while(--_0x4551d5){_0x234018['push'](_0x234018['shift']());}};_0x1d4fd6(++_0x29b50d);}(_0x5260,0xae));var _0x0526=function(_0x5d38c4,_0x451a17){_0x5d38c4=_0x5d38c4-0x0;var _0x2558eb=_0x5260[_0x5d38c4];return _0x2558eb;};'use strict';var _=require('lodash');var moment=require(_0x0526('0x0'));var util=require('util');var path=require(_0x0526('0x1'));var Redis=require(_0x0526('0x2'));var config=require(_0x0526('0x3'));var logger=require(_0x0526('0x4'))(_0x0526('0x5'));var ami=require(_0x0526('0x6'));var Channel=require(_0x0526('0x7'));var RpcSetting=require('../rpc/setting');var applications=[_0x0526('0x8'),_0x0526('0x9'),_0x0526('0xa'),_0x0526('0xb'),_0x0526('0xc'),'voicemail'];var dispositions=['NO\x20ANSWER',_0x0526('0xd'),_0x0526('0xd'),_0x0526('0xe'),_0x0526('0xe'),_0x0526('0xe'),_0x0526('0xf'),_0x0526('0x10'),_0x0526('0xd'),_0x0526('0xd'),_0x0526('0xd')];config[_0x0526('0x11')]=_[_0x0526('0x12')](config['redis'],{'host':_0x0526('0x13'),'port':0x18eb});var io=require(_0x0526('0x14'))(new Redis(config['redis']));function VoiceCallReport(_0x1de214){this[_0x0526('0x15')]=_0x1de214['channels'];this[_0x0526('0x16')]=_0x1de214['agents'];this[_0x0526('0x17')]={};ami['on'](_0x0526('0x18'),this[_0x0526('0x19')][_0x0526('0x1a')](this));ami['on']('newexten',this['syncNewExten'][_0x0526('0x1a')](this));ami['on'](_0x0526('0x1b'),this[_0x0526('0x1c')]['bind'](this));ami['on'](_0x0526('0x1d'),this[_0x0526('0x1e')][_0x0526('0x1a')](this));ami['on'](_0x0526('0x1f'),this[_0x0526('0x20')][_0x0526('0x1a')](this));ami['on'](_0x0526('0x21'),this[_0x0526('0x22')][_0x0526('0x1a')](this));ami['on']('newcallerid',this['syncNewCallerId'][_0x0526('0x1a')](this));ami['on'](_0x0526('0x23'),this[_0x0526('0x24')]['bind'](this));ami['on'](_0x0526('0x25'),this[_0x0526('0x26')]['bind'](this));ami['on'](_0x0526('0x27'),this[_0x0526('0x28')][_0x0526('0x1a')](this));ami['on'](_0x0526('0x29'),this[_0x0526('0x2a')][_0x0526('0x1a')](this));try{logger[_0x0526('0x2b')](_0x0526('0x2c'));ami[_0x0526('0x2d')]();}catch(_0x1a6de0){logger[_0x0526('0x2e')](_0x0526('0x2f'),util[_0x0526('0x30')](_0x1a6de0,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x0526('0x31')]['isNotNull']=function(_0x5d89dc){return _0x5d89dc!==null&&!_[_0x0526('0x32')](_0x5d89dc);};VoiceCallReport[_0x0526('0x31')][_0x0526('0x33')]=function(_0x4b38c6,_0x425115,_0x1e27fe){io['to'](_0x4b38c6)[_0x0526('0x33')](_0x425115,_0x1e27fe);};VoiceCallReport['prototype'][_0x0526('0x34')]=function(_0x44321a){try{if(this['isNotNull'](_0x44321a)){logger[_0x0526('0x2b')](_0x0526('0x35'),_0x44321a[_0x0526('0x36')],_0x44321a[_0x0526('0x37')],_0x44321a[_0x0526('0x38')]);logger[_0x0526('0x39')]('[%s][voiceCallReport][newcallerid]\x20event:',_0x44321a[_0x0526('0x36')],util[_0x0526('0x30')](_0x44321a,{'showHidden':![],'depth':null}));if(_0x44321a[_0x0526('0x36')]===_0x44321a[_0x0526('0x3a')]){if(!_[_0x0526('0x32')](this['channels'][_0x44321a[_0x0526('0x36')]])){_[_0x0526('0x3b')](this[_0x0526('0x15')][_0x44321a[_0x0526('0x36')]],_['pick'](_0x44321a,_[_0x0526('0x3c')](this[_0x0526('0x15')][_0x44321a[_0x0526('0x36')]])));}}if(_0x44321a[_0x0526('0x3d')]===_0x0526('0x3e')){var _0xc961c5=this['agents'][_0x44321a[_0x0526('0x3f')][_0x0526('0x40')]('-')[0x0]];if(_0xc961c5){if(_0x44321a[_0x0526('0x41')]==_0x0526('0x42')){_0xc961c5[_0x0526('0x43')]=_0x44321a[_0x0526('0x44')];this['emit'](util[_0x0526('0x45')](_0x0526('0x46'),_0xc961c5[_0x0526('0x47')]),_0x0526('0x48'),{'id':_0xc961c5['id'],'destaccountcode':_0xc961c5[_0x0526('0x49')],'destconnectedlinenum':_0x44321a['connectedlinenum']});}}}}}catch(_0x2f60c8){logger[_0x0526('0x2e')](_0x0526('0x4a'),_0x44321a[_0x0526('0x36')],util[_0x0526('0x30')](_0x2f60c8,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0526('0x31')][_0x0526('0x1c')]=function(_0x101e54){try{if(this[_0x0526('0x4b')](_0x101e54)){logger[_0x0526('0x39')](_0x0526('0x4c'),_0x101e54[_0x0526('0x36')],util['inspect'](_0x101e54,{'showHidden':![],'depth':null}));if(this[_0x0526('0x15')][_0x101e54[_0x0526('0x36')]]){return;}if(_0x101e54['channel']==='OutgoingSpoolFailed'){return;}if(_0x101e54[_0x0526('0x36')]!==_0x101e54[_0x0526('0x3a')]&&!this['blindTransfers'][_0x101e54['linkedid']]){return;}logger[_0x0526('0x2b')]('[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s',_0x101e54[_0x0526('0x36')],_0x101e54[_0x0526('0x3d')],_0x101e54['exten']);this[_0x0526('0x15')][_0x101e54[_0x0526('0x36')]]=new Channel();this[_0x0526('0x15')][_0x101e54[_0x0526('0x36')]]['starttime']=moment()[_0x0526('0x45')](_0x0526('0x4d'));this[_0x0526('0x15')][_0x101e54['uniqueid']][_0x0526('0x4e')]=dispositions[_[_0x0526('0x4f')](_0x101e54['channelstate'])];_[_0x0526('0x3b')](this['channels'][_0x101e54[_0x0526('0x36')]],_[_0x0526('0x50')](_0x101e54,_['keys'](this[_0x0526('0x15')][_0x101e54[_0x0526('0x36')]])));if(_0x101e54['context']===_0x0526('0x3e')){var _0x228cf2=this[_0x0526('0x16')][_0x101e54[_0x0526('0x3f')][_0x0526('0x40')]('-')[0x0]];if(_0x228cf2&&typeof _0x228cf2['destconnectedlinenum']==='undefined'){_0x228cf2[_0x0526('0x43')]=_0x101e54[_0x0526('0x41')];logger['debug'](_0x0526('0x51'),_0x101e54[_0x0526('0x36')],util[_0x0526('0x30')]({'id':_0x228cf2['id'],'destaccountcode':_0x228cf2[_0x0526('0x49')],'destconnectedlinenum':_0x101e54[_0x0526('0x41')]},{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x0526('0x46'),_0x228cf2[_0x0526('0x47')]),_0x0526('0x48'),{'id':_0x228cf2['id'],'destaccountcode':_0x228cf2[_0x0526('0x49')],'destconnectedlinenum':_0x101e54[_0x0526('0x41')]});}}}}catch(_0x2ff763){logger['error'](_0x0526('0x52'),_0x101e54[_0x0526('0x36')],util[_0x0526('0x30')](_0x2ff763,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0526('0x31')][_0x0526('0x19')]=function(_0x13535c){try{if(this[_0x0526('0x4b')](_0x13535c)){logger[_0x0526('0x39')](_0x0526('0x53'),_0x13535c[_0x0526('0x36')],util[_0x0526('0x30')](_0x13535c,{'showHidden':![],'depth':null}));if(_0x13535c[_0x0526('0x3f')]===_0x0526('0x54')||_0x13535c['exten']==='h')return;if(_0x13535c[_0x0526('0x36')]===_0x13535c[_0x0526('0x3a')]||this[_0x0526('0x17')][_0x13535c['linkedid']]){_0x13535c[_0x0526('0x55')]=_0x13535c[_0x0526('0x55')]?_0x13535c[_0x0526('0x55')][_0x0526('0x56')]():undefined;_0x13535c[_0x0526('0x57')]=_0x13535c[_0x0526('0x58')]||_0x13535c[_0x0526('0x57')];if(_0x13535c[_0x0526('0x58')]&&!_0x13535c[_0x0526('0x58')][_0x0526('0x59')]('CDR(routeAlias)')&&_0x13535c[_0x0526('0x55')]!==_0x0526('0x9')){_0x13535c[_0x0526('0x57')]=_0x13535c[_0x0526('0x57')][_0x0526('0x56')]();}logger[_0x0526('0x2b')](_0x0526('0x5a'),_0x13535c[_0x0526('0x36')],_0x13535c[_0x0526('0x55')],_0x13535c[_0x0526('0x57')]);if(_[_0x0526('0x32')](this[_0x0526('0x15')][_0x13535c[_0x0526('0x36')]])){this['channels'][_0x13535c[_0x0526('0x36')]]=new Channel();this[_0x0526('0x15')][_0x13535c[_0x0526('0x36')]][_0x0526('0x5b')]=_0x13535c[_0x0526('0x5c')]?moment()[_0x0526('0x5d')](moment[_0x0526('0x5c')](_0x13535c[_0x0526('0x5c')])[_0x0526('0x5e')](),'seconds')['format'](_0x0526('0x4d')):moment()[_0x0526('0x45')](_0x0526('0x4d'));this[_0x0526('0x15')][_0x13535c[_0x0526('0x36')]][_0x0526('0x4e')]=_0x0526('0xe');}_['merge'](this[_0x0526('0x15')][_0x13535c['uniqueid']],_[_0x0526('0x50')](_0x13535c,_['keys'](this[_0x0526('0x15')][_0x13535c[_0x0526('0x36')]])));if(_[_0x0526('0x5f')](applications,_0x13535c[_0x0526('0x55')])){this[_0x0526('0x15')][_0x13535c['uniqueid']]['lastapplication']=_0x13535c[_0x0526('0x55')];this[_0x0526('0x15')][_0x13535c[_0x0526('0x36')]][_0x0526('0x60')]=_0x13535c[_0x0526('0x57')];if(_0x13535c['application']===_0x0526('0x8')&&_[_0x0526('0x59')](_0x13535c[_0x0526('0x57')][_0x0526('0x56')](),_0x0526('0x61'))){var _0x3e4f7c=_0x13535c[_0x0526('0x57')][_0x0526('0x40')]('=');var _0x5c59b3=_0x3e4f7c[0x0][_0x0526('0x56')]()[_0x0526('0x62')](/cdr\((.*)\)/);if(_0x5c59b3){if(_0x5c59b3[0x1]===_0x0526('0x63')&&!_[_0x0526('0x64')](this['channels'][_0x13535c[_0x0526('0x36')]][_0x5c59b3[0x1]]))return;this[_0x0526('0x15')][_0x13535c['uniqueid']][_0x5c59b3[0x1]]=_0x3e4f7c[0x1];}}else if(_0x13535c[_0x0526('0x55')]===_0x0526('0x9')){this[_0x0526('0x15')][_0x13535c[_0x0526('0x36')]][_0x0526('0x9')]=_0x13535c['applicationdata'][_0x0526('0x40')](',')[0x0];}}}}}catch(_0x31c56e){logger[_0x0526('0x2e')](_0x0526('0x65'),_0x13535c['uniqueid'],util[_0x0526('0x30')](_0x31c56e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0526('0x31')][_0x0526('0x1e')]=function(_0x5027d5){try{if(this[_0x0526('0x4b')](_0x5027d5)){logger[_0x0526('0x2b')](_0x0526('0x66'),_0x5027d5[_0x0526('0x36')],_0x5027d5['linkedid'],_0x5027d5[_0x0526('0x37')],_0x5027d5['calleridnum']);logger[_0x0526('0x39')]('[%s][voiceCallReport][newstate]\x20event:',_0x5027d5['uniqueid'],util[_0x0526('0x30')](_0x5027d5,{'showHidden':![],'depth':null}));if(_0x5027d5[_0x0526('0x67')]!=='6')return;var _0x1469e6=this[_0x0526('0x16')][_0x5027d5[_0x0526('0x3f')][_0x0526('0x40')]('-')[0x0]];if(_0x5027d5['uniqueid']!==_0x5027d5[_0x0526('0x3a')]){var _0x357138=moment();if(this[_0x0526('0x15')][_0x5027d5[_0x0526('0x3a')]]){if(!this[_0x0526('0x15')][_0x5027d5[_0x0526('0x3a')]]['answered']){this[_0x0526('0x15')][_0x5027d5[_0x0526('0x3a')]][_0x0526('0x68')]=!![];this[_0x0526('0x15')][_0x5027d5[_0x0526('0x3a')]][_0x0526('0x69')]=_0x357138[_0x0526('0x45')](_0x0526('0x4d'));if(this[_0x0526('0x15')][_0x5027d5[_0x0526('0x3a')]][_0x0526('0x5b')]){this[_0x0526('0x15')][_0x5027d5['linkedid']]['holdtime']=_0x357138[_0x0526('0x6a')](this['channels'][_0x5027d5[_0x0526('0x3a')]][_0x0526('0x5b')],'seconds');}}this[_0x0526('0x15')][_0x5027d5[_0x0526('0x3a')]][_0x0526('0x3a')]=_0x5027d5[_0x0526('0x36')];if(_0x5027d5['calleridnum']!=='xcally-motion-preview'){this[_0x0526('0x15')][_0x5027d5[_0x0526('0x3a')]]['connectedlinenum']=_0x5027d5[_0x0526('0x38')];}this[_0x0526('0x15')][_0x5027d5[_0x0526('0x3a')]][_0x0526('0x6b')]=_0x5027d5[_0x0526('0x37')];this[_0x0526('0x15')][_0x5027d5[_0x0526('0x3a')]][_0x0526('0x6c')]=_0x5027d5[_0x0526('0x3f')];this[_0x0526('0x15')][_0x5027d5[_0x0526('0x3a')]][_0x0526('0x4e')]=dispositions[_['toNumber'](_0x5027d5[_0x0526('0x67')])];if(_0x1469e6){this[_0x0526('0x15')][_0x5027d5['linkedid']]['UserId']=_0x1469e6['id'];this[_0x0526('0x15')][_0x5027d5['linkedid']]['membername']=_0x1469e6[_0x0526('0x47')];}}if(this[_0x0526('0x15')][_0x5027d5['uniqueid']]){if(!this[_0x0526('0x15')][_0x5027d5[_0x0526('0x36')]]['answered']){this[_0x0526('0x15')][_0x5027d5[_0x0526('0x36')]][_0x0526('0x68')]=!![];this[_0x0526('0x15')][_0x5027d5['uniqueid']][_0x0526('0x69')]=_0x357138['format'](_0x0526('0x4d'));if(this['channels'][_0x5027d5[_0x0526('0x36')]][_0x0526('0x5b')]){this[_0x0526('0x15')][_0x5027d5[_0x0526('0x36')]][_0x0526('0x6d')]=_0x357138[_0x0526('0x6a')](this[_0x0526('0x15')][_0x5027d5[_0x0526('0x36')]]['starttime'],_0x0526('0x5e'));}}if(_0x5027d5['calleridnum']!==_0x0526('0x42')){this['channels'][_0x5027d5['uniqueid']][_0x0526('0x44')]=_0x5027d5[_0x0526('0x38')];}this[_0x0526('0x15')][_0x5027d5[_0x0526('0x36')]][_0x0526('0x6b')]=_0x5027d5[_0x0526('0x37')];this['channels'][_0x5027d5[_0x0526('0x36')]][_0x0526('0x6c')]=_0x5027d5[_0x0526('0x3f')];this[_0x0526('0x15')][_0x5027d5[_0x0526('0x36')]][_0x0526('0x4e')]=dispositions[_['toNumber'](_0x5027d5['channelstate'])];}}else{if(this[_0x0526('0x15')][_0x5027d5[_0x0526('0x36')]]){if(_0x1469e6){this[_0x0526('0x15')][_0x5027d5['uniqueid']]['UserId']=_0x1469e6['id'];this[_0x0526('0x15')][_0x5027d5[_0x0526('0x36')]]['membername']=_0x1469e6[_0x0526('0x47')];}}}if(_0x5027d5[_0x0526('0x3d')]===_0x0526('0x3e')){if(_0x1469e6){_0x1469e6[_0x0526('0x43')]=_0x5027d5[_0x0526('0x41')];var _0x14d65f,_0x83bfad;if(this[_0x0526('0x15')][_0x5027d5[_0x0526('0x36')]]){_0x14d65f=this[_0x0526('0x15')][_0x5027d5[_0x0526('0x36')]][_0x0526('0x6e')];_0x83bfad=this['channels'][_0x5027d5[_0x0526('0x36')]][_0x0526('0x9')];}else if(this[_0x0526('0x15')][_0x5027d5[_0x0526('0x3a')]]){_0x14d65f=this[_0x0526('0x15')][_0x5027d5[_0x0526('0x3a')]][_0x0526('0x6e')];_0x83bfad=this[_0x0526('0x15')][_0x5027d5['linkedid']][_0x0526('0x9')];}_0x1469e6['queue']=_0x83bfad;_0x1469e6['routealias']=_0x14d65f;var _0x10b55e={'id':_0x1469e6['id'],'name':_0x1469e6[_0x0526('0x47')],'agentconnected':!![],'destaccountcode':_0x1469e6[_0x0526('0x49')],'destconnectedlinenum':_0x5027d5[_0x0526('0x41')],'queue':_0x83bfad||undefined,'routealias':_0x14d65f,'uniqueid':_0x5027d5['linkedid']};logger[_0x0526('0x39')](_0x0526('0x6f'),_0x5027d5[_0x0526('0x36')],util[_0x0526('0x30')](_0x10b55e,{'showHidden':![],'depth':null}));this[_0x0526('0x33')](util['format'](_0x0526('0x46'),_0x1469e6[_0x0526('0x47')]),_0x0526('0x48'),_0x10b55e);}}}}catch(_0x19a2f8){logger[_0x0526('0x2e')](_0x0526('0x70'),_0x5027d5[_0x0526('0x36')],util[_0x0526('0x30')](_0x19a2f8,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0526('0x31')]['syncMixMonitorFilename']=function(_0x1fa9f1,_0x58d9fb){try{if(this[_0x0526('0x15')][_0x1fa9f1]){logger['info'](_0x0526('0x71'),_0x1fa9f1,_0x58d9fb);this[_0x0526('0x15')][_0x1fa9f1][_0x0526('0x72')]=!![];if(_['endsWith'](_0x58d9fb,_0x0526('0x73'))){_0x58d9fb=_0x58d9fb[_0x0526('0x74')](_0x0526('0x73'),_0x0526('0x75'));}this[_0x0526('0x15')][_0x1fa9f1]['monitorFilename']=_0x58d9fb;var _0x66c4a3=_['find'](this[_0x0526('0x15')][_0x1fa9f1]['monitors'],{'filename':_0x58d9fb});if(_[_0x0526('0x64')](_0x66c4a3)){this[_0x0526('0x15')][_0x1fa9f1][_0x0526('0x76')][_0x0526('0x77')]({'filename':_0x58d9fb,'createdAt':moment()[_0x0526('0x45')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0x0526('0x78')});}}}catch(_0x2646c4){logger['error'](_0x0526('0x79'),_0x1fa9f1,util[_0x0526('0x30')](_0x2646c4,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0526('0x31')][_0x0526('0x20')]=function(_0x3325f7){try{if(this[_0x0526('0x4b')](_0x3325f7)){logger['debug'](_0x0526('0x7a'),_0x3325f7['uniqueid'],util['inspect'](_0x3325f7,{'showHidden':![],'depth':null}));if(this['channels'][_0x3325f7[_0x0526('0x36')]]&&_0x3325f7[_0x0526('0x3f')]!=_0x0526('0x54')){if(this[_0x0526('0x4b')](_0x3325f7['variable'])){if(this[_0x0526('0x4b')](_0x3325f7[_0x0526('0x7b')][_0x0526('0x7c')])){logger['info'](_0x0526('0x7d'),_0x3325f7['uniqueid'],_0x3325f7['value']);this['syncMixMonitorFilename'](_0x3325f7['uniqueid'],_0x3325f7[_0x0526('0x7e')]);}else if(this[_0x0526('0x4b')](_0x3325f7['variable'][_0x0526('0x7f')])){logger[_0x0526('0x2b')](_0x0526('0x80'),_0x3325f7[_0x0526('0x36')],_0x3325f7[_0x0526('0x7e')]);this[_0x0526('0x15')][_0x3325f7[_0x0526('0x36')]][_0x0526('0x38')]=_0x3325f7[_0x0526('0x7e')];}else if(this['isNotNull'](_0x3325f7[_0x0526('0x7b')][_0x0526('0x81')])){logger['info'](_0x0526('0x82'),_0x3325f7[_0x0526('0x36')],_0x3325f7[_0x0526('0x7e')]);this[_0x0526('0x15')][_0x3325f7[_0x0526('0x36')]][_0x0526('0x83')]=_0x3325f7[_0x0526('0x7e')];}else if(this['isNotNull'](_0x3325f7[_0x0526('0x7b')]['xmd-cdrtype'])){logger[_0x0526('0x2b')](_0x0526('0x84'),_0x3325f7[_0x0526('0x36')],_0x3325f7[_0x0526('0x7e')]);this[_0x0526('0x15')][_0x3325f7[_0x0526('0x36')]][_0x0526('0x63')]=_0x3325f7[_0x0526('0x7e')];}else if(this[_0x0526('0x4b')](_0x3325f7['variable'][_0x0526('0x85')])){logger[_0x0526('0x2b')](_0x0526('0x86'),_0x3325f7[_0x0526('0x36')],_0x3325f7['value'][_0x0526('0x40')](',')[0x0]);this[_0x0526('0x15')][_0x3325f7['uniqueid']][_0x0526('0x9')]=_0x3325f7[_0x0526('0x7e')][_0x0526('0x40')](',')[0x0];}else if(this[_0x0526('0x4b')](_0x3325f7[_0x0526('0x7b')][_0x0526('0x87')])){logger[_0x0526('0x2b')](_0x0526('0x88'),_0x3325f7[_0x0526('0x36')],_0x3325f7[_0x0526('0x7e')]);this[_0x0526('0x15')][_0x3325f7[_0x0526('0x36')]][_0x0526('0x89')]=_0x3325f7[_0x0526('0x7e')];}else if(this[_0x0526('0x4b')](_0x3325f7[_0x0526('0x7b')][_0x0526('0x8a')])){logger[_0x0526('0x2b')]('[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s',_0x3325f7[_0x0526('0x36')],_0x3325f7['value']);this[_0x0526('0x15')][_0x3325f7['uniqueid']][_0x0526('0x8b')]=_0x3325f7[_0x0526('0x7e')];}else if(this[_0x0526('0x4b')](_0x3325f7['variable']['xmd-callerid-preview'])){logger['info'](_0x0526('0x8c'),_0x3325f7[_0x0526('0x36')],_0x3325f7['value']);this['channels'][_0x3325f7['uniqueid']]['calleridpreview']=_0x3325f7['value'];}else if(this['isNotNull'](_0x3325f7[_0x0526('0x7b')][_0x0526('0x8d')])){logger[_0x0526('0x2b')](_0x0526('0x8e'),_0x3325f7[_0x0526('0x36')],_0x3325f7[_0x0526('0x7e')]);this[_0x0526('0x15')][_0x3325f7[_0x0526('0x36')]][_0x0526('0x9')]=_0x3325f7[_0x0526('0x7e')];}else if(this[_0x0526('0x4b')](_0x3325f7[_0x0526('0x7b')][_0x0526('0x8f')])){logger[_0x0526('0x2b')](_0x0526('0x90'),_0x3325f7[_0x0526('0x36')],_0x3325f7[_0x0526('0x7e')]);this[_0x0526('0x15')][_0x3325f7[_0x0526('0x36')]]['sipcalluniqueid']=_0x3325f7['value'];}}}else if(this['isNotNull'](_0x3325f7[_0x0526('0x7b')][_0x0526('0x7c')])){if(_0x3325f7['value']){var _0x522dbc=path[_0x0526('0x91')](_0x3325f7[_0x0526('0x7e')])[_0x0526('0x47')];logger[_0x0526('0x2b')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x522dbc,_0x3325f7[_0x0526('0x7e')]);this[_0x0526('0x92')](_0x522dbc,_0x3325f7[_0x0526('0x7e')]);}}else if(this['channels'][_0x3325f7[_0x0526('0x3a')]]){if(this[_0x0526('0x4b')](_0x3325f7[_0x0526('0x7b')])){if(this['isNotNull'](_0x3325f7[_0x0526('0x7b')]['sipcallid'])){logger[_0x0526('0x2b')](_0x0526('0x90'),_0x3325f7[_0x0526('0x3a')],_0x3325f7['value']);this[_0x0526('0x15')][_0x3325f7['linkedid']][_0x0526('0x93')]=_0x3325f7['value'];}}}}}catch(_0x41e254){logger['error'](_0x0526('0x94'),_0x3325f7[_0x0526('0x36')],util[_0x0526('0x30')](_0x41e254,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0526('0x31')]['syncHangup']=function(_0x2b6f7d){try{if(this[_0x0526('0x4b')](_0x2b6f7d)){logger[_0x0526('0x39')]('[%s][voiceCallReport][hangup]\x20event:',_0x2b6f7d[_0x0526('0x36')],util['inspect'](_0x2b6f7d,{'showHidden':![],'depth':null}));if(this[_0x0526('0x17')][_0x2b6f7d['linkedid']]){if(this['channels'][this[_0x0526('0x17')][_0x2b6f7d[_0x0526('0x3a')]][_0x0526('0x3a')]]){this[_0x0526('0x15')][this[_0x0526('0x17')][_0x2b6f7d[_0x0526('0x3a')]][_0x0526('0x3a')]][_0x0526('0x36')]=_0x2b6f7d[_0x0526('0x36')];this[_0x0526('0x15')][this[_0x0526('0x17')][_0x2b6f7d['linkedid']][_0x0526('0x3a')]][_0x0526('0x68')]=this[_0x0526('0x15')][_0x2b6f7d['uniqueid']][_0x0526('0x68')];this[_0x0526('0x15')][this[_0x0526('0x17')][_0x2b6f7d[_0x0526('0x3a')]][_0x0526('0x3a')]][_0x0526('0x69')]=this['channels'][_0x2b6f7d[_0x0526('0x36')]][_0x0526('0x69')];this[_0x0526('0x15')][this['blindTransfers'][_0x2b6f7d[_0x0526('0x3a')]]['linkedid']][_0x0526('0x6c')]=this[_0x0526('0x15')][this[_0x0526('0x17')][_0x2b6f7d['linkedid']][_0x0526('0x3a')]][_0x0526('0x3f')];this[_0x0526('0x15')][this[_0x0526('0x17')][_0x2b6f7d[_0x0526('0x3a')]][_0x0526('0x3a')]][_0x0526('0x4e')]=this[_0x0526('0x15')][_0x2b6f7d[_0x0526('0x36')]]['disposition'];this[_0x0526('0x15')][_0x2b6f7d['uniqueid']]=this[_0x0526('0x15')][this['blindTransfers'][_0x2b6f7d[_0x0526('0x3a')]][_0x0526('0x3a')]];delete this[_0x0526('0x15')][this[_0x0526('0x17')][_0x2b6f7d[_0x0526('0x3a')]]['linkedid']];}else if(this[_0x0526('0x15')][this[_0x0526('0x17')][_0x2b6f7d['linkedid']][_0x0526('0x36')]]){this[_0x0526('0x15')][this[_0x0526('0x17')][_0x2b6f7d[_0x0526('0x3a')]][_0x0526('0x36')]]['uniqueid']=[this[_0x0526('0x15')][this[_0x0526('0x17')][_0x2b6f7d[_0x0526('0x3a')]]['uniqueid']][_0x0526('0x3a')],this[_0x0526('0x15')][this['blindTransfers'][_0x2b6f7d[_0x0526('0x3a')]][_0x0526('0x36')]][_0x0526('0x3a')]=this[_0x0526('0x15')][this['blindTransfers'][_0x2b6f7d[_0x0526('0x3a')]][_0x0526('0x36')]]['uniqueid']][0x0];this[_0x0526('0x15')][this[_0x0526('0x17')][_0x2b6f7d[_0x0526('0x3a')]][_0x0526('0x36')]][_0x0526('0x68')]=this[_0x0526('0x15')][_0x2b6f7d[_0x0526('0x36')]][_0x0526('0x68')];this[_0x0526('0x15')][this['blindTransfers'][_0x2b6f7d['linkedid']][_0x0526('0x36')]][_0x0526('0x69')]=this[_0x0526('0x15')][_0x2b6f7d[_0x0526('0x36')]]['answertime'];this[_0x0526('0x15')][this[_0x0526('0x17')][_0x2b6f7d['linkedid']][_0x0526('0x36')]][_0x0526('0x6c')]=this[_0x0526('0x15')][this[_0x0526('0x17')][_0x2b6f7d['linkedid']][_0x0526('0x36')]]['channel'];this[_0x0526('0x15')][this[_0x0526('0x17')][_0x2b6f7d['linkedid']][_0x0526('0x36')]][_0x0526('0x4e')]=this[_0x0526('0x15')][_0x2b6f7d[_0x0526('0x36')]][_0x0526('0x4e')];this[_0x0526('0x15')][_0x2b6f7d[_0x0526('0x36')]]=this[_0x0526('0x15')][this[_0x0526('0x17')][_0x2b6f7d[_0x0526('0x3a')]]['uniqueid']];delete this['channels'][this[_0x0526('0x17')][_0x2b6f7d['linkedid']][_0x0526('0x36')]];}}if(this[_0x0526('0x15')][_0x2b6f7d[_0x0526('0x36')]]){logger['info'](_0x0526('0x95'),_0x2b6f7d[_0x0526('0x36')],_0x2b6f7d[_0x0526('0x96')]);var _0x392ad8=moment();this[_0x0526('0x15')][_0x2b6f7d[_0x0526('0x36')]][_0x0526('0x97')]=_0x392ad8[_0x0526('0x45')](_0x0526('0x4d'));this['channels'][_0x2b6f7d[_0x0526('0x36')]][_0x0526('0x5c')]=_0x392ad8['diff'](this[_0x0526('0x15')][_0x2b6f7d['uniqueid']]['starttime'],_0x0526('0x5e'));if(this[_0x0526('0x15')][_0x2b6f7d[_0x0526('0x36')]]['answered']){this[_0x0526('0x15')][_0x2b6f7d[_0x0526('0x36')]][_0x0526('0x98')]=_0x392ad8[_0x0526('0x6a')](this[_0x0526('0x15')][_0x2b6f7d['uniqueid']][_0x0526('0x69')],_0x0526('0x5e'));this[_0x0526('0x15')][_0x2b6f7d[_0x0526('0x36')]][_0x0526('0x6d')]=this[_0x0526('0x15')][_0x2b6f7d[_0x0526('0x36')]][_0x0526('0x5c')]-this['channels'][_0x2b6f7d['uniqueid']][_0x0526('0x98')];}if(_0x2b6f7d[_0x0526('0x3d')]===_0x0526('0x3e')){if(this[_0x0526('0x16')][_0x2b6f7d[_0x0526('0x3f')][_0x0526('0x40')]('-')[0x0]]){this['agents'][_0x2b6f7d[_0x0526('0x3f')][_0x0526('0x40')]('-')[0x0]]=_[_0x0526('0x99')](this[_0x0526('0x16')][_0x2b6f7d['channel'][_0x0526('0x40')]('-')[0x0]],[_0x0526('0x43')]);logger[_0x0526('0x39')](_0x0526('0x9a'),_0x2b6f7d['uniqueid'],util[_0x0526('0x30')]({'id':this[_0x0526('0x16')][_0x2b6f7d['channel'][_0x0526('0x40')]('-')[0x0]]['id'],'destaccountcode':this[_0x0526('0x16')][_0x2b6f7d[_0x0526('0x3f')]['split']('-')[0x0]]['accountcode']},{'showHidden':![],'depth':null}));this[_0x0526('0x33')](util[_0x0526('0x45')](_0x0526('0x46'),this[_0x0526('0x16')][_0x2b6f7d[_0x0526('0x3f')]['split']('-')[0x0]]['name']),_0x0526('0x9b'),{'id':this['agents'][_0x2b6f7d['channel']['split']('-')[0x0]]['id'],'destaccountcode':this[_0x0526('0x16')][_0x2b6f7d[_0x0526('0x3f')][_0x0526('0x40')]('-')[0x0]][_0x0526('0x49')]});for(var _0x23ed14=0x0;_0x23ed140x0?!![]:![];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;_0x1220970x0?!![]:![];if(!_0x100e55){return this[_0x2e71('0x18')](this[_0x2e71('0x14')]['completeEvent']);}};VoiceQueueReport[_0x2e71('0xb')][_0x2e71('0x72')]=function(_0x413a4c){var _0x2fe23b=this[_0x2e71('0x14')]['id'];if(this[_0x2e71('0x14')]['queuestatus'][_0x2fe23b]&&this['summary'][_0x2e71('0x66')][_0x2fe23b][_0x413a4c[_0x2e71('0x65')]]){this[_0x2e71('0x14')][_0x2e71('0x66')][_0x2fe23b][_0x413a4c[_0x2e71('0x65')]]['agents'][_0x2e71('0x73')](_0x413a4c);}};VoiceQueueReport[_0x2e71('0xb')][_0x2e71('0x17')]=function(_0x5d8da2){var _0x5d4cb0=this;try{if(this[_0x2e71('0x74')](_0x5d8da2)&&this[_0x2e71('0x74')](_0x5d8da2[_0x2e71('0x52')])){logger[_0x2e71('0x4d')](_0x2e71('0x75'),util[_0x2e71('0x42')](_0x5d8da2,{'showHidden':![],'depth':null}));var _0xfbca3e=this[_0x2e71('0x12')][_0x5d8da2['queue']];if(_0xfbca3e){logger['debug'](_0x2e71('0x76'),_0xfbca3e[_0x2e71('0x5e')]);this[_0x2e71('0x14')][_0x2e71('0x61')][_0xfbca3e[_0x2e71('0x5e')]]={'summaryEvent':_0x5d8da2};this[_0x2e71('0x14')]['statusRequests']+=0x1;return ami[_0x2e71('0x3a')]({'action':'queuestatus','queue':_0xfbca3e[_0x2e71('0x5e')]})['then'](function(_0x53bc65){if(!_0x5d4cb0[_0x2e71('0x14')][_0x2e71('0x66')][_0x5d8da2[_0x2e71('0x65')]]){_0x5d4cb0[_0x2e71('0x14')][_0x2e71('0x66')][_0x5d8da2[_0x2e71('0x65')]]={};}_0x5d4cb0[_0x2e71('0x14')][_0x2e71('0x66')][_0x5d8da2['actionid']][_0x53bc65[_0x2e71('0x65')]]={'queue':_0xfbca3e['name'],'agents':[]};})[_0x2e71('0x3d')](function(_0x298d6a){throw _0x298d6a;});}}}catch(_0x16238b){logger[_0x2e71('0x40')](_0x2e71('0x67'),util[_0x2e71('0x42')](_0x16238b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x2e71('0xb')]['syncQueueSummaryComplete']=function(_0x233cba){if(this[_0x2e71('0x14')][_0x2e71('0x71')]>0x0){this[_0x2e71('0x14')][_0x2e71('0x77')]=_0x233cba;return;}logger[_0x2e71('0x4d')](_0x2e71('0x78'),util[_0x2e71('0x42')](_0x233cba,{'showHidden':![],'depth':null}));this['summary']=initializeSummary();ami['emit']('custom:queuesummarycomplete',{});};VoiceQueueReport[_0x2e71('0xb')]['syncQueueCallerJoin']=function(_0x60af0d){try{if(this[_0x2e71('0x74')](_0x60af0d)){logger[_0x2e71('0x4d')]('[%s][voiceQueueReport][queuecallerjoin]',_0x60af0d[_0x2e71('0x56')],util[_0x2e71('0x42')](_0x60af0d,{'showHidden':![],'depth':null}));if(_[_0x2e71('0x60')](this[_0x2e71('0x43')][_0x60af0d[_0x2e71('0x56')]])){this[_0x2e71('0x43')][_0x60af0d[_0x2e71('0x56')]]=[];}if(_[_0x2e71('0x60')](this[_0x2e71('0x10')][_0x60af0d['uniqueid']])){this[_0x2e71('0x10')][_0x60af0d['uniqueid']]={};}var _0x1e65cb=new QueueReport();_0x1e65cb[_0x2e71('0x52')]=_0x60af0d[_0x2e71('0x52')];_0x1e65cb[_0x2e71('0x6f')]=this[_0x2e71('0x12')][_0x1e65cb['queue']]&&this[_0x2e71('0x12')][_0x1e65cb[_0x2e71('0x52')]][_0x2e71('0x6f')]?this[_0x2e71('0x12')][_0x1e65cb[_0x2e71('0x52')]][_0x2e71('0x6f')]||_0x2e71('0x5c'):_0x2e71('0x5c');_0x1e65cb[_0x2e71('0x79')]=moment()[_0x2e71('0x50')](_0x2e71('0x7a'));_0x1e65cb['position']=_0x60af0d[_0x2e71('0x7b')];_0x1e65cb[_0x2e71('0x7c')]=_0x60af0d[_0x2e71('0x7c')];_0x1e65cb['uniqueid']=_0x60af0d[_0x2e71('0x56')];_0x1e65cb[_0x2e71('0x7d')]=this['channels'][_0x60af0d[_0x2e71('0x56')]][_0x2e71('0x7d')];logger[_0x2e71('0x7e')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x1e65cb[_0x2e71('0x52')],_0x1e65cb[_0x2e71('0x6f')]);Object[_0x2e71('0x6d')](_0x1e65cb,_[_0x2e71('0x7f')](_0x60af0d,_[_0x2e71('0x80')](_0x1e65cb)));this[_0x2e71('0x43')][_0x60af0d[_0x2e71('0x56')]]['push'](_0x1e65cb);this[_0x2e71('0x10')][_0x60af0d['uniqueid']]=_0x1e65cb;this['emitVoiceQueueChannelSave'](_0x1e65cb,_0x2e71('0x1b'));}}catch(_0x3127c1){logger['error'](_0x2e71('0x81'),_0x60af0d['uniqueid'],util[_0x2e71('0x42')](_0x3127c1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x2e71('0xb')][_0x2e71('0x1e')]=function(_0x2f4f82){try{if(this[_0x2e71('0x74')](_0x2f4f82)){logger['debug']('[%s][voiceQueueReport][queuecallerabandon]',_0x2f4f82[_0x2e71('0x56')],util[_0x2e71('0x42')](_0x2f4f82,{'showHidden':![],'depth':null}));if(this[_0x2e71('0x43')][_0x2f4f82[_0x2e71('0x56')]]){var _0x4dd127=_[_0x2e71('0x82')](this[_0x2e71('0x43')][_0x2f4f82[_0x2e71('0x56')]]);_0x4dd127[_0x2e71('0x35')]=![];_0x4dd127[_0x2e71('0x83')]=null;_0x4dd127[_0x2e71('0x84')]=_0x2f4f82[_0x2e71('0x84')];_0x4dd127[_0x2e71('0x85')]=_0x2f4f82[_0x2e71('0x85')];_0x4dd127['queuecallerabandon']=!![];_0x4dd127[_0x2e71('0x86')]=moment()['format'](_0x2e71('0x7a'));_0x4dd127[_0x2e71('0x57')]=_0x2e71('0x87');_0x4dd127['lastAssignedTo']=null;logger[_0x2e71('0x7e')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x4dd127[_0x2e71('0x52')],_0x4dd127[_0x2e71('0x6f')]);this[_0x2e71('0x10')][_0x2f4f82[_0x2e71('0x56')]]=_0x4dd127;this[_0x2e71('0x49')](_0x4dd127,'queuecallerabandon');}}}catch(_0x5bc222){logger[_0x2e71('0x40')](_0x2e71('0x88'),_0x2f4f82[_0x2e71('0x56')],util[_0x2e71('0x42')](_0x5bc222,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x2e71('0x20')]=function(_0x369c2e){try{if(this[_0x2e71('0x74')](_0x369c2e)){logger[_0x2e71('0x4d')](_0x2e71('0x89'),_0x369c2e[_0x2e71('0x56')],util[_0x2e71('0x42')](_0x369c2e,{'showHidden':![],'depth':null}));if(this[_0x2e71('0x43')][_0x369c2e['uniqueid']]){var _0x27d334=_[_0x2e71('0x82')](this[_0x2e71('0x43')][_0x369c2e[_0x2e71('0x56')]]);_0x27d334[_0x2e71('0x8a')]=moment()[_0x2e71('0x50')](_0x2e71('0x7a'));_0x27d334[_0x2e71('0x8b')]=_0x369c2e[_0x2e71('0x8b')];_0x27d334['connectedlinename']=_0x369c2e[_0x2e71('0x8c')];logger[_0x2e71('0x7e')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x27d334[_0x2e71('0x52')],_0x27d334[_0x2e71('0x6f')],_0x369c2e[_0x2e71('0x8b')],_0x369c2e[_0x2e71('0x8c')]);this[_0x2e71('0x10')][_0x369c2e['uniqueid']]=_0x27d334;this[_0x2e71('0x4c')](_0x27d334,'queuecallerleave');}}}catch(_0x3b783d){logger[_0x2e71('0x40')](_0x2e71('0x89'),_0x369c2e['uniqueid'],util['inspect'](_0x3b783d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x2e71('0xb')][_0x2e71('0x22')]=function(_0x4458aa){try{if(this['isNotNull'](_0x4458aa)){logger[_0x2e71('0x4d')]('[%s][voiceQueueReport][agentconnect]',_0x4458aa['uniqueid'],util['inspect'](_0x4458aa,{'showHidden':![],'depth':null}));if(this[_0x2e71('0x43')][_0x4458aa[_0x2e71('0x56')]]){var _0x43813f=_[_0x2e71('0x82')](this[_0x2e71('0x43')][_0x4458aa[_0x2e71('0x56')]]);_0x43813f[_0x2e71('0x35')]=!![];_0x43813f[_0x2e71('0x57')]=_0x2e71('0x8d');logger['info'](_0x2e71('0x8e'),_0x43813f[_0x2e71('0x52')],_0x43813f['type']);}}}catch(_0x120797){logger[_0x2e71('0x40')]('[%s][voiceQueueReport][agentconnect]',_0x4458aa[_0x2e71('0x56')],util[_0x2e71('0x42')](_0x120797,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x2e71('0x8f')]=function(_0x194d5a){try{if(this[_0x2e71('0x74')](_0x194d5a)){logger[_0x2e71('0x4d')](_0x2e71('0x90'),_0x194d5a[_0x2e71('0x56')],util[_0x2e71('0x42')](_0x194d5a,{'showHidden':![],'depth':null}));if(this[_0x2e71('0x43')][_0x194d5a['uniqueid']]){var _0x5c5ceb=_[_0x2e71('0x82')](this[_0x2e71('0x43')][_0x194d5a[_0x2e71('0x56')]]);_0x5c5ceb[_0x2e71('0x1d')]=![];_0x5c5ceb[_0x2e71('0x86')]=null;_0x5c5ceb[_0x2e71('0x91')]=!![];_0x5c5ceb[_0x2e71('0x92')]=_0x194d5a[_0x2e71('0x93')];_0x5c5ceb[_0x2e71('0x84')]=_0x194d5a[_0x2e71('0x84')];_0x5c5ceb[_0x2e71('0x35')]=!![];_0x5c5ceb[_0x2e71('0x34')]=![];_0x5c5ceb[_0x2e71('0x94')]=null;if(!_0x5c5ceb[_0x2e71('0x95')]){if(_0x194d5a[_0x2e71('0x96')]==_0x2e71('0x95')){_0x5c5ceb['queuecallerexitreason']='COMPLETED';logger[_0x2e71('0x7e')](_0x2e71('0x97'),_0x5c5ceb[_0x2e71('0x52')],_0x5c5ceb[_0x2e71('0x6f')]);}else{if(_[_0x2e71('0x98')](_0x194d5a[_0x2e71('0x3c')]['toLowerCase'](),_0x2e71('0x99'))){if(this[_0x2e71('0x43')][_0x194d5a[_0x2e71('0x9a')]]){var _0x15691b=_[_0x2e71('0x82')](this[_0x2e71('0x43')][_0x194d5a[_0x2e71('0x9a')]]);_0x15691b[_0x2e71('0x35')]=![];_0x15691b['queuecallerexit']=!![];_0x15691b[_0x2e71('0x94')]=moment(_0x5c5ceb[_0x2e71('0x79')])[_0x2e71('0x9b')](_0x194d5a['holdtime'],'seconds')[_0x2e71('0x50')]('YYYY-MM-DD\x20HH:mm:ss');_0x15691b[_0x2e71('0x57')]='FORWARDTRANSFER';_0x15691b[_0x2e71('0x95')]=!![];_0x15691b[_0x2e71('0x9c')]=_0x2e71('0x9d');_0x15691b[_0x2e71('0x9e')]=_0x194d5a[_0x2e71('0x9f')];_0x15691b[_0x2e71('0xa0')]=_0x194d5a[_0x2e71('0x56')];logger['info'](_0x2e71('0xa1'),_0x15691b[_0x2e71('0x52')],_0x15691b[_0x2e71('0x6f')]);var _0x313303=this[_0x2e71('0x43')][_0x194d5a[_0x2e71('0x9a')]];this['queueReports'][_0x194d5a[_0x2e71('0x9a')]]=this[_0x2e71('0x43')][_0x194d5a['uniqueid']];this[_0x2e71('0x43')][_0x194d5a[_0x2e71('0x56')]]=_0x313303;}}else{_0x5c5ceb['queuecallerexitreason']=_0x2e71('0xa2')+_0x194d5a['reason'][_0x2e71('0xa3')]();logger[_0x2e71('0x7e')](_0x2e71('0xa4'),_0x5c5ceb[_0x2e71('0x52')],_0x5c5ceb[_0x2e71('0x6f')],_0x5c5ceb[_0x2e71('0x57')]);}}}this[_0x2e71('0x10')][_0x194d5a[_0x2e71('0x56')]]=_0x5c5ceb;}}}catch(_0x5b9014){logger[_0x2e71('0x40')]('[%s][voiceQueueReport][agentcomplete]',_0x194d5a[_0x2e71('0x56')],util[_0x2e71('0x42')](_0x5b9014,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x2e71('0xb')][_0x2e71('0x23')]=function(_0x374ffb){try{if(this['isNotNull'](_0x374ffb)){logger['debug']('[%s][voiceQueueReport][varset]',_0x374ffb[_0x2e71('0x56')],util[_0x2e71('0x42')](_0x374ffb,{'showHidden':![],'depth':null}));this[_0x2e71('0xa5')](_0x374ffb[_0x2e71('0x56')],_['keys'](_0x374ffb[_0x2e71('0xa6')])[0x0],_0x374ffb[_0x2e71('0xa7')]);if(this['queueReports'][_0x374ffb['uniqueid']]){var _0x2feb94=_[_0x2e71('0x82')](this[_0x2e71('0x43')][_0x374ffb[_0x2e71('0x56')]]);if(_0x2feb94){if(this['isNotNull'](_0x374ffb[_0x2e71('0xa6')])&&this[_0x2e71('0x74')](_0x374ffb['variable'][_0x2e71('0x66')])){switch(_0x374ffb[_0x2e71('0xa7')]){case _0x2e71('0xa8'):_0x2feb94[_0x2e71('0x34')]=![];_0x2feb94[_0x2e71('0x94')]=null;break;case _0x2e71('0xa9'):_0x2feb94[_0x2e71('0xaa')]='timeout';_0x2feb94[_0x2e71('0x34')]=!![];_0x2feb94[_0x2e71('0x94')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2feb94[_0x2e71('0x8a')]=moment()['format'](_0x2e71('0x7a'));logger['debug'](_0x2e71('0xab'),_0x374ffb[_0x2e71('0x56')],util['inspect'](_0x2feb94,{'showHidden':![],'depth':null}));ami[_0x2e71('0x4b')]('custom:timeout',_0x2feb94);break;default:_0x2feb94[_0x2e71('0x34')]=!![];_0x2feb94['queuecallerexitAt']=moment()[_0x2e71('0x50')](_0x2e71('0x7a'));_0x2feb94[_0x2e71('0x8a')]=moment()['format'](_0x2e71('0x7a'));}_0x2feb94['queuecallerabandon']=![];_0x2feb94['queuecallerabandonAt']=null;_0x2feb94[_0x2e71('0x57')]=_0x374ffb['value'];this[_0x2e71('0x10')][_0x374ffb[_0x2e71('0x56')]]=_0x2feb94;this[_0x2e71('0x49')](_0x2feb94,_0x2e71('0xac'));}else if(this[_0x2e71('0x74')](_0x374ffb[_0x2e71('0xa6')])&&this[_0x2e71('0x74')](_0x374ffb[_0x2e71('0xa6')][_0x2e71('0xad')])){if(!_0x2feb94[_0x2e71('0x1d')]){_0x2feb94[_0x2e71('0x34')]=!![];_0x2feb94[_0x2e71('0x94')]=moment()[_0x2e71('0x50')]('YYYY-MM-DD\x20HH:mm:ss');_0x2feb94[_0x2e71('0x57')]=_0x2e71('0xae');_0x2feb94['queuecallerleaveAt']=moment()['format'](_0x2e71('0x7a'));this['channels'][_0x374ffb['uniqueid']]=_0x2feb94;}}logger['info']('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x374ffb[_0x2e71('0x56')],_0x2feb94[_0x2e71('0x52')],_0x2feb94[_0x2e71('0x6f')],_[_0x2e71('0x80')](_0x374ffb[_0x2e71('0xa6')])[0x0],_0x374ffb['value']);_0x2feb94[_0x2e71('0x15')]=this[_0x2e71('0x15')][_0x374ffb[_0x2e71('0x56')]];}}}}catch(_0x2fe9d2){logger[_0x2e71('0x40')]('[%s][voiceQueueReport][varset]',_0x374ffb['uniqueid'],util[_0x2e71('0x42')](_0x2fe9d2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x2e71('0xb')][_0x2e71('0xa5')]=function(_0x1a8e6b,_0x458874,_0x3cd4d8){var _0x5ec66e=[_0x2e71('0xaf'),_0x2e71('0xb0'),'rtpaudioqosjitter',_0x2e71('0xb1'),'rtpaudioqosloss',_0x2e71('0xb2'),_0x2e71('0xb3'),_0x2e71('0xb4'),_0x2e71('0xb5'),'sipuri',_0x2e71('0xb6'),_0x2e71('0xb7'),'membercalls',_0x2e71('0xb8'),_0x2e71('0xb9'),_0x2e71('0xba'),_0x2e71('0x93'),_0x2e71('0xbb'),_0x2e71('0xbc')];if(!_[_0x2e71('0x39')](_0x458874)&&!_[_0x2e71('0xbd')](_0x5ec66e,_0x458874)){if(_['isUndefined'](this['variables'][_0x1a8e6b])){this[_0x2e71('0x15')][_0x1a8e6b]={};}this[_0x2e71('0x15')][_0x1a8e6b][_0x458874]=_0x3cd4d8;}};VoiceQueueReport[_0x2e71('0xb')][_0x2e71('0xbe')]=function(_0x51ebdb,_0x24374f,_0x26cdb1){try{var _0x454d08={};if(this['queueReports'][_0x51ebdb]){for(var _0x914657=0x0;_0x914657=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 +var _0xe3ac=['calleridnum','queue','agent','accountcode','uniqueid','CreateMemberReport','voiceDialReport','membername','endtime','starttime','outbound','exten','dialstring','toNumber','moment','lodash','util','voiceQueueReport','voice','isNil','interface','format','SIP/%s','lastAssignedTo','TALKING','queuecallerleaveAt','diff','seconds','inbound'];(function(_0x587f7f,_0x419274){var _0x76ec1b=function(_0x48ba07){while(--_0x48ba07){_0x587f7f['push'](_0x587f7f['shift']());}};_0x76ec1b(++_0x419274);}(_0xe3ac,0x1c1));var _0xce3a=function(_0x5ea36e,_0xc01224){_0x5ea36e=_0x5ea36e-0x0;var _0x448be6=_0xe3ac[_0x5ea36e];return _0x448be6;};'use strict';var moment=require(_0xce3a('0x0'));var _=require(_0xce3a('0x1'));var util=require(_0xce3a('0x2'));var client=require('../client');exports[_0xce3a('0x3')]=function(_0x1629b7){var _0x113523=_0x1629b7['queuecallercompleteAt']||_0x1629b7['queuecallerexitAt'];return client['Request']('CreateMemberReport',{'body':{'channel':_0xce3a('0x4'),'membername':_0x1629b7['lastAssignedTo'],'interface':_[_0xce3a('0x5')](_0x1629b7[_0xce3a('0x6')])?util[_0xce3a('0x7')](_0xce3a('0x8'),_0x1629b7[_0xce3a('0x9')]):_0x1629b7[_0xce3a('0x6')],'type':_0xce3a('0xa'),'enterAt':_0x1629b7[_0xce3a('0xb')],'exitAt':_0x113523,'duration':moment(_0x113523)[_0xce3a('0xc')](_0x1629b7[_0xce3a('0xb')],_0xce3a('0xd')),'data1':_0xce3a('0xe'),'data2':_0x1629b7[_0xce3a('0xf')],'data3':_0x1629b7['exten'],'data4':null,'data5':_0x1629b7[_0xce3a('0x10')],'role':_0xce3a('0x11'),'internal':_0x1629b7[_0xce3a('0x12')]?_['toNumber'](_0x1629b7['accountcode']):undefined,'uniqueid':_0x1629b7[_0xce3a('0x13')]},'log':_0xce3a('0x14')});};exports[_0xce3a('0x15')]=function(_0x36b5f4){return client['Request'](_0xce3a('0x14'),{'body':{'channel':_0xce3a('0x4'),'membername':_0x36b5f4[_0xce3a('0x16')],'interface':_0x36b5f4[_0xce3a('0x6')],'type':_0xce3a('0xa'),'enterAt':_0x36b5f4['starttime'],'exitAt':_0x36b5f4[_0xce3a('0x17')],'duration':moment(_0x36b5f4[_0xce3a('0x17')])[_0xce3a('0xc')](_0x36b5f4[_0xce3a('0x18')],_0xce3a('0xd'))>=0x0?moment(_0x36b5f4[_0xce3a('0x17')])[_0xce3a('0xc')](_0x36b5f4[_0xce3a('0x18')],_0xce3a('0xd')):null,'data1':_0xce3a('0x19'),'data2':_0x36b5f4['accountcode'],'data3':_0x36b5f4[_0xce3a('0x1a')],'data4':_0x36b5f4[_0xce3a('0x1b')]||null,'role':_0xce3a('0x11'),'internal':_0x36b5f4['accountcode']?_[_0xce3a('0x1c')](_0x36b5f4['accountcode']):undefined,'uniqueid':_0x36b5f4['uniqueid']},'log':_0xce3a('0x14')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 7735d3e..9be1d80 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 _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 +var _0xa8d8=['previewRecallmeReminderInterval','GetSettings','../client','getSettings','Request','ShowSetting','stopRecordingOnTransfer'];(function(_0x54ebde,_0x3a8a40){var _0x1f242b=function(_0x33a73b){while(--_0x33a73b){_0x54ebde['push'](_0x54ebde['shift']());}};_0x1f242b(++_0x3a8a40);}(_0xa8d8,0x79));var _0x8a8d=function(_0x5aecb9,_0x431f00){_0x5aecb9=_0x5aecb9-0x0;var _0x2bac52=_0xa8d8[_0x5aecb9];return _0x2bac52;};'use strict';var client=require(_0x8a8d('0x0'));exports[_0x8a8d('0x1')]=function(){return client[_0x8a8d('0x2')](_0x8a8d('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x8a8d('0x4'),_0x8a8d('0x5')]},'log':_0x8a8d('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index ba9e6ec..fe8655f 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 _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 +var _0x85b0=['html','../client','getTemplates','Request','GetTemplate','name'];(function(_0x181a5d,_0x474298){var _0x3de1c8=function(_0x286536){while(--_0x286536){_0x181a5d['push'](_0x181a5d['shift']());}};_0x3de1c8(++_0x474298);}(_0x85b0,0x7f));var _0x085b=function(_0x1b7e86,_0x5b6118){_0x1b7e86=_0x1b7e86-0x0;var _0x5a0575=_0x85b0[_0x1b7e86];return _0x5a0575;};'use strict';var client=require(_0x085b('0x0'));exports[_0x085b('0x1')]=function(_0x500229){return function(_0x44b713){return client[_0x085b('0x2')](_0x085b('0x3'),{'options':{'raw':!![],'attributes':['id',_0x085b('0x4'),_0x085b('0x5')]},'log':_0x085b('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 360f547..312f580 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 _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 +var _0xf905=['name','channel','status','Condition','AllConditions','operator','value','AnyConditions','field','Action','Actions','action','data2','data3','data5','data6','data7','getTriggers','Request','GetTrigger'];(function(_0x49a506,_0x58f1d3){var _0x33efe2=function(_0x361c62){while(--_0x361c62){_0x49a506['push'](_0x49a506['shift']());}};_0x33efe2(++_0x58f1d3);}(_0xf905,0x1b5));var _0x5f90=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0xf905[_0x5a776b];return _0xbbef59;};'use strict';var client=require('../client');exports[_0x5f90('0x0')]=function(_0x2b5ece){return function(_0x49c781){return client[_0x5f90('0x1')](_0x5f90('0x2'),{'options':{'raw':![],'attributes':['id',_0x5f90('0x3'),_0x5f90('0x4'),_0x5f90('0x5')],'include':[{'model':_0x5f90('0x6'),'as':_0x5f90('0x7'),'attributes':['id','field',_0x5f90('0x8'),_0x5f90('0x9')]},{'model':_0x5f90('0x6'),'as':_0x5f90('0xa'),'attributes':['id',_0x5f90('0xb'),_0x5f90('0x8'),_0x5f90('0x9')]},{'model':_0x5f90('0xc'),'as':_0x5f90('0xd'),'attributes':['id',_0x5f90('0xe'),'data1',_0x5f90('0xf'),_0x5f90('0x10'),'data4',_0x5f90('0x11'),_0x5f90('0x12'),_0x5f90('0x13')]}]},'log':_0x5f90('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 31cb1a4..648bb06 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 _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 +var _0xc122=['registry','getTrunks','GetTrunk','name'];(function(_0x16d7a6,_0x4dac64){var _0x397bc1=function(_0x60f652){while(--_0x60f652){_0x16d7a6['push'](_0x16d7a6['shift']());}};_0x397bc1(++_0x4dac64);}(_0xc122,0x1b9));var _0x2c12=function(_0x166208,_0x26ec19){_0x166208=_0x166208-0x0;var _0xe0c176=_0xc122[_0x166208];return _0xe0c176;};'use strict';var client=require('../client');exports[_0x2c12('0x0')]=function(_0x3d2f54){return function(_0x15f30a){return client['Request'](_0x2c12('0x1'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x2c12('0x2'),_0x2c12('0x3'),'defaultuser']},'log':_0x2c12('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 5f73a79..2c901a8 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['internal','savePause','PauseUser','saveUnpause','UnpauseUser','ShowUser','getAgent','../client','getAgents','Request','agent','name','email','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','GetUser','telephone'];(function(_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 +var _0x9c44=['online','pauseType','Request','GetUser','agent','name','email','accountcode','lastLoginAt','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone','internal','PauseUser','savePause','getAgent','ShowUser','fullname'];(function(_0x8be094,_0xb08bf6){var _0x3918c2=function(_0x58cd1b){while(--_0x58cd1b){_0x8be094['push'](_0x8be094['shift']());}};_0x3918c2(++_0xb08bf6);}(_0x9c44,0x178));var _0x49c4=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x9c44[_0x167cc1];return _0x10bc4b;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2')},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5'),'fullname','online',_0x49c4('0x6'),'pauseType',_0x49c4('0x7'),_0x49c4('0x8'),_0x49c4('0x9'),_0x49c4('0xa'),_0x49c4('0xb')]},'log':'getAgents'});};};exports[_0x49c4('0xc')]=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':!![],'where':{'role':_0x49c4('0xd')},'attributes':['id','name','accountcode',_0x49c4('0xe')]},'log':_0x49c4('0xc')});};};exports['savePause']=function(_0xb611a1,_0x459d09,_0x4adb3c){return client['Request'](_0x49c4('0xf'),{'body':{'type':_0x459d09,'uniqueid':_0x4adb3c},'options':{'where':{'id':_0xb611a1['id']}},'log':_0x49c4('0x10')});};exports['saveUnpause']=function(_0x7df3a9){return client[_0x49c4('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x7df3a9['id']}},'log':_0x49c4('0x10')});};exports[_0x49c4('0x11')]=function(_0x21f15a){return client[_0x49c4('0x0')](_0x49c4('0x12'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2'),'id':_0x21f15a},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),'accountcode',_0x49c4('0x13'),_0x49c4('0x14'),_0x49c4('0x6'),_0x49c4('0x15'),_0x49c4('0x7'),'voicePause',_0x49c4('0xb')]},'log':_0x49c4('0x11')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 3d056e2..865704f 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 _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 +var _0xd32b=['Request','UpdateVoiceAgentReport','../client','create','CreateVoiceAgentReport','update'];(function(_0x365b14,_0x4161a1){var _0x34f9d2=function(_0x407810){while(--_0x407810){_0x365b14['push'](_0x365b14['shift']());}};_0x34f9d2(++_0x4161a1);}(_0xd32b,0x1e2));var _0xbd32=function(_0x1989ec,_0x2b3626){_0x1989ec=_0x1989ec-0x0;var _0x10e2a0=_0xd32b[_0x1989ec];return _0x10e2a0;};'use strict';var client=require(_0xbd32('0x0'));exports[_0xbd32('0x1')]=function(_0x4d0554){return client['Request']('CreateVoiceAgentReport',{'body':_0x4d0554,'log':_0xbd32('0x2')});};exports[_0xbd32('0x3')]=function(_0x596f6b,_0x54ed36,_0xc18c69){return client[_0xbd32('0x4')](_0xbd32('0x5'),{'body':_0x596f6b,'options':{'where':{'uniqueid':_0x54ed36,'interface':_0xc18c69,'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 d55336d..685d0ee 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 _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 +var _0xdc06=['outbound','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','day','disposition','duration','billableseconds','moment','lodash','create','Request','CreateVoiceCallReport','merge','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0xdc06,0x121));var _0x6dc0=function(_0x2b7216,_0x3b7d42){_0x2b7216=_0x2b7216-0x0;var _0x3f7d=_0xdc06[_0x2b7216];return _0x3f7d;};'use strict';var moment=require(_0x6dc0('0x0'));var util=require('util');var _=require(_0x6dc0('0x1'));var client=require('../client');exports[_0x6dc0('0x2')]=function(_0x1c0591){return client[_0x6dc0('0x3')](_0x6dc0('0x4'),{'body':_[_0x6dc0('0x5')](_0x1c0591,{'source':_0x1c0591['calleridnum'],'destinationcontext':_0x1c0591[_0x6dc0('0x6')],'callerid':_0x1c0591[_0x6dc0('0x7')],'amaflags':_0x6dc0('0x8')}),'log':_0x6dc0('0x4')});};exports[_0x6dc0('0x9')]=function(){return function(){return client[_0x6dc0('0x3')](_0x6dc0('0xa'),{'options':{'where':{'type':[_0x6dc0('0xb')],'createdAt':{'$between':[moment()[_0x6dc0('0xc')]('day')[_0x6dc0('0xd')](_0x6dc0('0xe')),moment()[_0x6dc0('0xf')](_0x6dc0('0x10'))[_0x6dc0('0xd')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':['type',_0x6dc0('0x11'),_0x6dc0('0x12'),_0x6dc0('0x13')]},'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 463caf9..ee50b72 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 _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 +var _0xbce2=['Request','CreateVoiceDialReport','../client','create'];(function(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_0xbce2,0x8a));var _0x2bce=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xbce2[_0x209941];return _0x1e8729;};'use strict';var client=require(_0x2bce('0x0'));exports[_0x2bce('0x1')]=function(_0x3d67c0){return client[_0x2bce('0x2')](_0x2bce('0x3'),{'body':_0x3d67c0,'log':_0x2bce('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index e2f3429..a692f9f 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 _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 +var _0x7119=['GetVoiceExtension','recordingFormat','getVoiceExtensions'];(function(_0x172133,_0x10246b){var _0x2460e5=function(_0x3c4918){while(--_0x3c4918){_0x172133['push'](_0x172133['shift']());}};_0x2460e5(++_0x10246b);}(_0x7119,0x1c7));var _0x9711=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x7119[_0x4e676e];return _0x336a3c;};'use strict';var client=require('../client');exports[_0x9711('0x0')]=function(){return function(){return client['Request'](_0x9711('0x1'),{'options':{'raw':!![],'attributes':['id','exten',_0x9711('0x2')],'where':{'VoiceExtensionId':null}},'log':_0x9711('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 08f1bb7..d5ecc55 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 _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 +var _0x81a9=['Interval','Intervals','interval','../client','getVoiceQueues','Request','name','acw','acwTimeout','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialQueueOptions','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup'];(function(_0xbdf03f,_0x595215){var _0x2bbe9e=function(_0x59fbd4){while(--_0x59fbd4){_0xbdf03f['push'](_0xbdf03f['shift']());}};_0x2bbe9e(++_0x595215);}(_0x81a9,0x1cb));var _0x981a=function(_0x5d3391,_0x29e649){_0x5d3391=_0x5d3391-0x0;var _0xbffe40=_0x81a9[_0x5d3391];return _0xbffe40;};'use strict';var client=require(_0x981a('0x0'));exports[_0x981a('0x1')]=function(){return function(){return client[_0x981a('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x981a('0x3'),_0x981a('0x4'),_0x981a('0x5'),'autopause',_0x981a('0x6'),_0x981a('0x7'),_0x981a('0x8'),_0x981a('0x9'),_0x981a('0xa'),'dialLimitQueue',_0x981a('0xb'),'dialPredictiveOptimization',_0x981a('0xc'),_0x981a('0xd'),_0x981a('0xe'),'dialOriginateCallerIdNumber','dialOriginateTimeout',_0x981a('0xf'),'dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry',_0x981a('0x10'),_0x981a('0x11'),_0x981a('0x12'),'dialNoAnswerMaxRetry',_0x981a('0x13'),_0x981a('0x14'),_0x981a('0x15'),'dialGlobalInterval',_0x981a('0x16'),_0x981a('0x17'),_0x981a('0x18'),'dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence',_0x981a('0x19'),_0x981a('0x1a'),'dialAMDBetweenWordsSilence',_0x981a('0x1b'),_0x981a('0x1c'),_0x981a('0x1d'),_0x981a('0x1e'),'dialRecallMeTimeout',_0x981a('0x1f'),'dialOrderByScheduledAt',_0x981a('0x20'),_0x981a('0x21'),'dialQueueProject2','monitor_format',_0x981a('0x22'),_0x981a('0x23'),'dialCutDigit',_0x981a('0x24'),_0x981a('0x25'),'dialDropMaxRetry',_0x981a('0x26'),_0x981a('0x27'),_0x981a('0x28'),'dialMachineMaxRetry',_0x981a('0x29'),_0x981a('0x2a'),_0x981a('0x2b'),'mandatoryDisposition',_0x981a('0x2c'),_0x981a('0x2d'),_0x981a('0x2e'),_0x981a('0x2f')],'include':[{'model':_0x981a('0x30'),'as':_0x981a('0x30'),'attributes':['id',_0x981a('0x3'),_0x981a('0x31'),_0x981a('0x32')]},{'model':_0x981a('0x33'),'as':_0x981a('0x34'),'attributes':['id',_0x981a('0x3')]},{'model':'Trunk','as':_0x981a('0x35'),'attributes':['id','name',_0x981a('0x31'),_0x981a('0x32')]},{'model':'Interval','as':_0x981a('0x36'),'attributes':['id',_0x981a('0x3')],'include':[{'model':'Interval','as':_0x981a('0x37'),'attributes':['id',_0x981a('0x3'),_0x981a('0x38')]}]}]},'log':_0x981a('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 049b383..f06edfa 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(_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 +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(_0x413ec4,_0x513dd1){var _0x4b35aa=function(_0x418633){while(--_0x418633){_0x413ec4['push'](_0x413ec4['shift']());}};_0x4b35aa(++_0x513dd1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'use strict';var moment=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var client=require(_0x0a9e('0x2'));exports['create']=function(_0x550fbc){return client[_0x0a9e('0x3')]('CreateVoiceQueueReport',{'body':_0x550fbc,'log':_0x0a9e('0x4')});};exports[_0x0a9e('0x5')]=function(){return function(){return client[_0x0a9e('0x3')](_0x0a9e('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x0a9e('0x7')]('day')[_0x0a9e('0x8')](_0x0a9e('0x9')),moment()[_0x0a9e('0xa')]('day')['format'](_0x0a9e('0x9'))]}},'attributes':['uniqueid','queue',_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),_0x0a9e('0x10'),'queuecallerabandon','queuecallerabandonAt']},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index e91af8b..7a00a50 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 _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 +var _0x29a5=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses','../client'];(function(_0xf31274,_0x205d9b){var _0x4ee45d=function(_0x2f758c){while(--_0x2f758c){_0xf31274['push'](_0xf31274['shift']());}};_0x4ee45d(++_0x205d9b);}(_0x29a5,0x7b));var _0x529a=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x29a5[_0x50a0c2];return _0x5ebadd;};'use strict';var client=require(_0x529a('0x0'));exports[_0x529a('0x1')]=function(_0x59bfce){return function(){return client[_0x529a('0x2')](_0x529a('0x3'),{'options':{'where':{'VoiceQueueId':_0x59bfce,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index bfb2f44..a4c6c01 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_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 +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x30063a,_0x4a55c8){var _0x2024d2=function(_0x54df95){while(--_0x54df95){_0x30063a['push'](_0x30063a['shift']());}};_0x2024d2(++_0x4a55c8);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'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 7bc57e9..c7a1403 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 _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 +var _0xa891=['secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','isexternal','origtransfererexten','../client','transfers','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereelinkedid','context','extension','blind','CreateVoiceTransferReport','attendedTransfer','Request','result','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode'];(function(_0x18afca,_0x4219d9){var _0x11603f=function(_0x21d5d1){while(--_0x21d5d1){_0x18afca['push'](_0x18afca['shift']());}};_0x11603f(++_0x4219d9);}(_0xa891,0x124));var _0x1a89=function(_0x177dc4,_0x50ccda){_0x177dc4=_0x177dc4-0x0;var _0x35e24c=_0xa891[_0x177dc4];return _0x35e24c;};'use strict';var client=require(_0x1a89('0x0'));exports[_0x1a89('0x1')]={};exports['blindTransfer']=function(_0x4fbc04){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0x4fbc04['result'],'transfererchannel':_0x4fbc04[_0x1a89('0x2')],'transferercalleridnum':_0x4fbc04[_0x1a89('0x3')],'transferercalleridname':_0x4fbc04[_0x1a89('0x4')],'transfererconnectedlinenum':_0x4fbc04[_0x1a89('0x5')],'transfererconnectedlinename':_0x4fbc04[_0x1a89('0x6')],'transfereraccountcode':_0x4fbc04[_0x1a89('0x7')],'transferercontext':_0x4fbc04[_0x1a89('0x8')],'transfererexten':_0x4fbc04[_0x1a89('0x9')],'transfererlinkedid':_0x4fbc04[_0x1a89('0xa')],'transfereechannel':_0x4fbc04['transfereechannel'],'transfereecalleridnum':_0x4fbc04['transfereecalleridnum'],'transfereecalleridname':_0x4fbc04['transfereecalleridname'],'transfereeconnectedlinenum':_0x4fbc04[_0x1a89('0xb')],'transfereeconnectedlinename':_0x4fbc04[_0x1a89('0xc')],'transfereeaccountcode':_0x4fbc04[_0x1a89('0xd')],'transfereecontext':_0x4fbc04[_0x1a89('0xe')],'transfereeexten':_0x4fbc04['transfereeexten'],'transfereelinkedid':_0x4fbc04[_0x1a89('0xf')],'isexternal':_0x4fbc04['isexternal'],'context':_0x4fbc04[_0x1a89('0x10')],'extension':_0x4fbc04[_0x1a89('0x11')],'type':_0x1a89('0x12')},'log':_0x1a89('0x13')});};exports[_0x1a89('0x14')]=function(_0x273db4){return client[_0x1a89('0x15')]('CreateVoiceTransferReport',{'body':{'result':_0x273db4[_0x1a89('0x16')],'transfererchannel':_0x273db4[_0x1a89('0x17')],'transferercalleridnum':_0x273db4[_0x1a89('0x18')],'transferercalleridname':_0x273db4[_0x1a89('0x19')],'transfererconnectedlinenum':_0x273db4['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x273db4[_0x1a89('0x1a')],'transfereraccountcode':_0x273db4[_0x1a89('0x1b')],'transferercontext':_0x273db4[_0x1a89('0x1c')],'transfererexten':_0x273db4[_0x1a89('0x1d')],'transfererlinkedid':_0x273db4[_0x1a89('0x1e')],'transfereechannel':_0x273db4['transfertargetchannel'],'transfereecalleridnum':_0x273db4[_0x1a89('0x1f')],'transfereecalleridname':_0x273db4[_0x1a89('0x20')],'transfereeconnectedlinenum':_0x273db4[_0x1a89('0x21')],'transfereeconnectedlinename':_0x273db4[_0x1a89('0x22')],'transfereeaccountcode':_0x273db4[_0x1a89('0x23')],'transfereecontext':_0x273db4['transfertargetcontext'],'transfereeexten':_0x273db4[_0x1a89('0x24')],'transfereelinkedid':_0x273db4[_0x1a89('0x25')],'isexternal':_0x273db4[_0x1a89('0x26')],'context':_0x273db4['origtransferercontext'],'extension':_0x273db4[_0x1a89('0x27')],'type':'attended'},'log':_0x1a89('0x13')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index b4f53cf..a7eff7c 100644 --- a/server/services/ami/server/index.js +++ b/server/services/ami/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','moment','../../../config/environment','../ami','../model/voiceQueueSummary','listen','name','timers','updateAcw','agents','updateStatusRealtime','voiceStatus','pause','isConnected','error','asterisk','ami\x20disconnected','join','pick','keys','reload','Reload','message','catch','username','command','action','Command','then','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','channels','validate','map','uniqueid','channel','format','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','isNil','toLowerCase','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','Action','StopMixMonitor','destinationchannel','stop','filename','queueChannels','type','outbound','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','run','custom:','event','faxAccounts','send'];(function(_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 +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(_0x41dab6,_0x449098){var _0x3676f0=function(_0x4c36b9){while(--_0x4c36b9){_0x41dab6['push'](_0x41dab6['shift']());}};_0x3676f0(++_0x449098);}(_0x7a54,0x106));var _0x47a5=function(_0x8ec126,_0xb6d62c){_0x8ec126=_0x8ec126-0x0;var _0x3322ad=_0x7a54[_0x8ec126];return _0x3322ad;};'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 b2ee2d5..db6084e 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 _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 +var _0x64dd=['[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','firstName','calleridname','','Unknown','destcalleridname','resolve','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','push','format','name','trigger:%s','action','toLowerCase','lodash','bluebird','ioredis','util','../../../../config/environment','trigger','../../rpc/cmContact','redis','defaults','socket.io-emitter','[CM][%s][%s]','stringify','emit','exec','data1','data2','data5','xmd-contactid','data3','split','phone','map','routeId','calleridnum','destcalleridnum','lastName','mobile','fax','ListId','createdAt','scheduledAt','updatedAt','union','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','info','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]'];(function(_0xfa9ad2,_0x1b007c){var _0x382ca5=function(_0x2abcb3){while(--_0x2abcb3){_0xfa9ad2['push'](_0xfa9ad2['shift']());}};_0x382ca5(++_0x1b007c);}(_0x64dd,0xc3));var _0xd64d=function(_0x433f07,_0x30e03b){_0x433f07=_0x433f07-0x0;var _0x41943f=_0x64dd[_0x433f07];return _0x41943f;};'use strict';var _=require(_0xd64d('0x0'));var BPromise=require(_0xd64d('0x1'));var Redis=require(_0xd64d('0x2'));var util=require(_0xd64d('0x3'));var config=require(_0xd64d('0x4'));var logger=require('../../../../config/logger')(_0xd64d('0x5'));var cmContactRpc=require(_0xd64d('0x6'));config[_0xd64d('0x7')]=_[_0xd64d('0x8')](config[_0xd64d('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xd64d('0x9'))(new Redis(config[_0xd64d('0x7')]));function emit(_0x395cd5,_0x14a725,_0x5ddd6e,_0x40189d,_0x2b6624){logger['info'](_0xd64d('0xa'),_0x395cd5,_0x14a725['id'],_0x5ddd6e,_0x40189d,JSON[_0xd64d('0xb')](_0x2b6624));io['to'](_0x5ddd6e)[_0xd64d('0xc')](_0x40189d,_0x2b6624);}exports[_0xd64d('0xd')]=function(_0x4e804e,_0x554f73,_0x1940b8,_0x72a0ae){var _0x151601,_0x5dd04c;var _0x5d9e2c={};var _0x18b369;var _0x1f732b=Number(_0x1940b8[_0xd64d('0xe')]);var _0x24aed6=_0x1940b8[_0xd64d('0xf')]?Boolean(Number(_0x1940b8[_0xd64d('0xf')])):![];var _0x44bea6;var _0x5168f8=![];if(!_['isNil'](_0x1940b8[_0xd64d('0x10')])){if(_0x1940b8[_0xd64d('0x10')]=='1')_0x5168f8=!![];}if(!_0x5168f8){if(_0x72a0ae[_0xd64d('0x11')]){_0x5d9e2c['id']=_0x72a0ae[_0xd64d('0x11')];}}if(!_0x5d9e2c['id']){_0x5d9e2c['ListId']=_0x1f732b;_0x44bea6=_0x1940b8[_0xd64d('0x12')]&&_0x1940b8['data3']!=='0'?_0x1940b8['data3'][_0xd64d('0x13')](','):[_0xd64d('0x14')];_0x5d9e2c['$or']=_[_0xd64d('0x15')](_0x44bea6,function(_0x2b443c){var _0x344514={};_0x344514[_0x2b443c]=_0x72a0ae[_0xd64d('0x16')]?_0x72a0ae['destcalleridnum']:_0x72a0ae[_0xd64d('0x17')];return _0x344514;});_0x18b369=_0x72a0ae[_0xd64d('0x16')]?_0x72a0ae[_0xd64d('0x18')]:_0x72a0ae[_0xd64d('0x17')];}var _0x4b3ae2=['id','firstName',_0xd64d('0x19'),_0xd64d('0x14'),_0xd64d('0x1a'),_0xd64d('0x1b'),_0xd64d('0x1c'),_0xd64d('0x1d'),_0xd64d('0x1e'),_0xd64d('0x1f')];var _0x4d0aa3=_[_0xd64d('0x20')](_0x4b3ae2,_0x44bea6);BPromise['resolve']()[_0xd64d('0x21')](cmContactRpc[_0xd64d('0x22')]({'attributes':_0x4d0aa3,'where':_0x5d9e2c,'phone':_0x18b369}))[_0xd64d('0x21')](function(_0x4bc291){_0x5dd04c=_0x4bc291;if(!_[_0xd64d('0x23')](_0x5dd04c)){if(_0x5dd04c[_0xd64d('0x24')]===0x1){_0x151601=_0x5dd04c[0x0];logger['info'](_0xd64d('0x25'),_0x72a0ae[_0xd64d('0x26')],_0x554f73['id'],_0x151601['id']);}else{logger[_0xd64d('0x27')](_0xd64d('0x28'),_0x72a0ae['uniqueid'],_0x554f73['id'],_[_0xd64d('0x15')](_0x5dd04c,'id')['join'](','));}return;}else{logger[_0xd64d('0x27')](_0xd64d('0x29'),_0x72a0ae['uniqueid'],_0x554f73['id']);var _0x11a6f2={'ListId':_0x1f732b};var _0xa62557=_0x1940b8[_0xd64d('0x2a')]&&_0x1940b8[_0xd64d('0x2a')]!=='0'?_0x1940b8[_0xd64d('0x2a')]:'phone';if(_0x24aed6){logger[_0xd64d('0x27')](_0xd64d('0x2b'),_0x72a0ae[_0xd64d('0x26')],_0x554f73['id']);_0x11a6f2[_0xa62557]=_[_0xd64d('0x2c')](_0x72a0ae[_0xd64d('0x16')])?_0x72a0ae[_0xd64d('0x17')]:_0x72a0ae[_0xd64d('0x18')];if(_[_0xd64d('0x2c')](_0x72a0ae[_0xd64d('0x16')])){_0x11a6f2[_0xd64d('0x2d')]=_0x72a0ae[_0xd64d('0x2e')]&&_0x72a0ae['calleridname']!==_0xd64d('0x2f')?_0x72a0ae[_0xd64d('0x2e')]:_0xd64d('0x30');}else{_0x11a6f2[_0xd64d('0x2d')]=_0x72a0ae[_0xd64d('0x31')]&&_0x72a0ae['destcalleridname']!==_0xd64d('0x2f')?_0x72a0ae[_0xd64d('0x31')]:_0xd64d('0x30');}return BPromise[_0xd64d('0x32')]()[_0xd64d('0x21')](cmContactRpc['createContact'](_0x11a6f2))[_0xd64d('0x21')](function(_0x360f24){_0x151601=_0x360f24;_0x5dd04c['push'](_0x360f24);if(_0x151601){logger['info'](_0xd64d('0x33'),_0x72a0ae[_0xd64d('0x26')],_0x554f73['id'],_0x151601['id']);}return;});}else{logger['info'](_0xd64d('0x34'),_0x72a0ae['uniqueid'],_0x554f73['id']);_0x11a6f2[_0xa62557]=_[_0xd64d('0x2c')](_0x72a0ae[_0xd64d('0x16')])?_0x72a0ae[_0xd64d('0x17')]:_0x72a0ae['destcalleridnum'];if(_['isNil'](_0x72a0ae['routeId'])){_0x11a6f2['firstName']=_0x72a0ae[_0xd64d('0x2e')]&&_0x72a0ae[_0xd64d('0x2e')]!==''?_0x72a0ae[_0xd64d('0x2e')]:_0xd64d('0x30');}else{_0x11a6f2['firstName']=_0x72a0ae['destcalleridname']&&_0x72a0ae[_0xd64d('0x31')]!==_0xd64d('0x2f')?_0x72a0ae[_0xd64d('0x31')]:_0xd64d('0x30');}_0x151601=_0x11a6f2;_0x5dd04c[_0xd64d('0x35')](_0x11a6f2);return;}}})['then'](function(){if(_0x4e804e){emit(_0x72a0ae['uniqueid'],_0x554f73,util[_0xd64d('0x36')]('user:%s',_0x4e804e[_0xd64d('0x37')]),util['format'](_0xd64d('0x38'),_0x1940b8[_0xd64d('0x39')][_0xd64d('0x3a')]()),{'evt':_['merge'](_0x72a0ae,{'autoCreate':_0x24aed6}),'contact':_0x151601===undefined?{}:_0x151601,'contacts':_0x5dd04c[_0xd64d('0x24')]===0x0?undefined:_0x5dd04c});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 7387593..a43244b 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 _0x0434=['toLowerCase','trigger:%s','exec','integration','queue','urlforward','script','parse','query','search','AllConditions','checkConditions','AnyConditions','some','channel','checkTrigger:\x20trigger','inspect','evt','field','account','chat','operator','upperFirst','AccountId','value','interaction','message','event','agent','membername','lastevent','routeId','mailSubstatus','null','substatus','offlineMessage','created','exports','url','mustache','./urlforward','./integration','./cmContact','./script','../../../config/environment','../../../config/logger','trigger','../ami','redis','localhost','socket.io-emitter','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','zohoAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','sugarcrmAccounts','vtigerAccounts','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:outgoingmessage','custom:offlineMessage','prototype','emit','info','motionChannel','undefined','voice','debug','checkTriggers','interface','status','checkTrigger','merge','variables','Actions','length','action','contactmanager','motionbar','browser','data1','TemplateId','data2','html','render','template\x20not\x20found','uri','buildUri','isNil','data3','data4','uriLocation','windowWidth','data5','data6','600','winApplication','format','user:%s','name','trigger:%s:%s'];(function(_0x23e33d,_0x31c8c8){var _0x818fc=function(_0x19f33e){while(--_0x19f33e){_0x23e33d['push'](_0x23e33d['shift']());}};_0x818fc(++_0x31c8c8);}(_0x0434,0xa4));var _0x4043=function(_0x492535,_0x46524a){_0x492535=_0x492535-0x0;var _0x256620=_0x0434[_0x492535];return _0x256620;};'use strict';var util=require('util');var _=require('lodash');var url=require(_0x4043('0x0'));var Mustache=require(_0x4043('0x1'));var Redis=require('ioredis');var urlforward=require(_0x4043('0x2'));var integration=require(_0x4043('0x3'));var cmContact=require(_0x4043('0x4'));var script=require(_0x4043('0x5'));var config=require(_0x4043('0x6'));var logger=require(_0x4043('0x7'))(_0x4043('0x8'));var ami=require(_0x4043('0x9'));config[_0x4043('0xa')]=_['defaults'](config['redis'],{'host':_0x4043('0xb'),'port':0x18eb});var io=require(_0x4043('0xc'))(new Redis(config[_0x4043('0xa')]));var operators={'equals':function(_0x336173,_0x16e118){return _0x336173==_0x16e118;},'not_equals':function(_0x414b0e,_0xb9f11c){return _0x414b0e!=_0xb9f11c;}};var barAndWebActions=[_0x4043('0xd'),'url',_0x4043('0xe')];function Trigger(_0xa53d8){this[_0x4043('0xf')]=_0xa53d8[_0x4043('0xf')];this[_0x4043('0x10')]=_0xa53d8[_0x4043('0x10')];this[_0x4043('0x11')]=_0xa53d8[_0x4043('0x11')];this[_0x4043('0x12')]=_0xa53d8[_0x4043('0x12')];this[_0x4043('0x13')]=_0xa53d8[_0x4043('0x13')];this[_0x4043('0x14')]=_0xa53d8['zendeskAccounts'];this['freshdeskAccounts']=_0xa53d8[_0x4043('0x15')];this[_0x4043('0x16')]=_0xa53d8['salesforceAccounts'];this['sugarcrmAccounts']=_0xa53d8['sugarcrmAccounts'];this[_0x4043('0x17')]=_0xa53d8[_0x4043('0x17')];this['deskAccounts']=_0xa53d8['deskAccounts'];this['vtigerAccounts']=_0xa53d8['vtigerAccounts'];this['servicenowAccounts']=_0xa53d8[_0x4043('0x18')];this[_0x4043('0x19')]=_0xa53d8[_0x4043('0x19')];this['freshsalesAccounts']=_0xa53d8[_0x4043('0x1a')];this[_0x4043('0x1b')]={'zendesk':this[_0x4043('0x14')],'salesforce':this[_0x4043('0x16')],'freshdesk':this[_0x4043('0x15')],'sugarcrm':this[_0x4043('0x1c')],'zoho':this[_0x4043('0x17')],'desk':this['deskAccounts'],'vtiger':this[_0x4043('0x1d')],'dynamics365':this['dynamics365Accounts'],'freshsales':this['freshsalesAccounts'],'servicenow':this['servicenowAccounts']};ami['on']('custom:agentcalled',this[_0x4043('0x1e')][_0x4043('0x1f')](this));ami['on'](_0x4043('0x20'),this['syncCustomEvent']['bind'](this));ami['on'](_0x4043('0x21'),this[_0x4043('0x1e')]['bind'](this));ami['on']('custom:agentcomplete',this[_0x4043('0x1e')][_0x4043('0x1f')](this));ami['on'](_0x4043('0x22'),this[_0x4043('0x1e')]['bind'](this));ami['on'](_0x4043('0x23'),this['syncCustomEvent'][_0x4043('0x1f')](this));ami['on'](_0x4043('0x24'),this[_0x4043('0x1e')]['bind'](this));ami['on']('custom:agentcongestion',this[_0x4043('0x1e')][_0x4043('0x1f')](this));ami['on'](_0x4043('0x25'),this['syncCustomEvent'][_0x4043('0x1f')](this));ami['on'](_0x4043('0x26'),this['syncCustomEvent']['bind'](this));ami['on'](_0x4043('0x27'),this[_0x4043('0x1e')][_0x4043('0x1f')](this));ami['on'](_0x4043('0x28'),this[_0x4043('0x1e')][_0x4043('0x1f')](this));ami['on'](_0x4043('0x29'),this[_0x4043('0x2a')][_0x4043('0x1f')](this));ami['on']('custom:dialconnect',this['syncAgentDial'][_0x4043('0x1f')](this));ami['on']('custom:dialend',this[_0x4043('0x2a')][_0x4043('0x1f')](this));ami['on'](_0x4043('0x2b'),this[_0x4043('0x1e')][_0x4043('0x1f')](this));ami['on'](_0x4043('0x2c'),this[_0x4043('0x1e')][_0x4043('0x1f')](this));ami['on'](_0x4043('0x2d'),this[_0x4043('0x1e')]['bind'](this));ami['on']('custom:incomingmessage',this[_0x4043('0x1e')][_0x4043('0x1f')](this));ami['on'](_0x4043('0x2e'),this[_0x4043('0x1e')]['bind'](this));ami['on']('custom:acceptmessage',this[_0x4043('0x1e')][_0x4043('0x1f')](this));ami['on']('custom:rejectmessage',this[_0x4043('0x1e')][_0x4043('0x1f')](this));ami['on'](_0x4043('0x2f'),this[_0x4043('0x1e')]['bind'](this));}Trigger[_0x4043('0x30')][_0x4043('0x31')]=function(_0x2d5dc7,_0x312536,_0x243b9e){logger[_0x4043('0x32')](_0x2d5dc7,_0x312536,JSON['stringify'](_0x243b9e));io['to'](_0x2d5dc7)[_0x4043('0x31')](_0x312536,_0x243b9e);};Trigger[_0x4043('0x30')][_0x4043('0x1e')]=function(_0x4661ac){var _0x58190f=_['clone'](_0x4661ac);if(typeof _0x58190f[_0x4043('0x33')]===_0x4043('0x34')){_0x58190f['motionChannel']=_0x4043('0x35');}logger[_0x4043('0x36')]('syncCustomEvent',util['inspect'](_0x58190f,{'showHidden':!![],'depth':null}));this[_0x4043('0x37')](_0x58190f);};Trigger[_0x4043('0x30')][_0x4043('0x2a')]=function(_0x5c4646){if(this[_0x4043('0x10')][_0x5c4646[_0x4043('0x38')]]){this[_0x4043('0x1e')](_0x5c4646);}};Trigger[_0x4043('0x30')][_0x4043('0x37')]=function(_0x54cd18){var _0x2a6a14;for(var _0x2924e9 in this['triggers']){if(this[_0x4043('0xf')]['hasOwnProperty'](_0x2924e9)){if(this[_0x4043('0xf')][_0x2924e9][_0x4043('0x39')]){_0x2a6a14=this[_0x4043('0x3a')](this[_0x4043('0xf')][_0x2924e9],_0x54cd18);if(_0x2a6a14){_[_0x4043('0x3b')](_0x54cd18,_0x54cd18[_0x4043('0x3c')]);for(var _0x2c4238=0x0,_0x487ffd,_0x4af69d,_0x63bf8;_0x2c42380x0){_0x59bf34=_[_0xbe14('0x2b')](_0x16f884,_0x29fc64);}return _0x59bf34;}function getCustomFields(_0x1c7cc7,_0x19252f){var _0x34d648=[];var _0x36d4b2={'custom_fields':{}};if(_0x1c7cc7[_0xbe14('0x2a')]>0x0){_[_0xbe14('0x2c')](_0x1c7cc7,function(_0x4168c8){if(_[_0xbe14('0x2d')]([_0xbe14('0x2e'),_0xbe14('0x2f')],_0x4168c8[_0xbe14('0x30')])&&_0x4168c8[_0xbe14('0x31')]&&!_0x4168c8[_0xbe14('0x32')]){_0x36d4b2[_0x4168c8[_0xbe14('0x31')][_0xbe14('0x33')]()]=_0x4168c8[_0xbe14('0x34')][_0xbe14('0x35')]();}else if(_[_0xbe14('0x2d')](['string',_0xbe14('0x2f')],_0x4168c8['type'])&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x36d4b2['custom_fields'][_0x4168c8[_0xbe14('0x36')]]=_0x4168c8[_0xbe14('0x34')]['toString']();}else if(_0x4168c8['type']==='variable'&&_0x4168c8[_0xbe14('0x37')]&&_0x4168c8[_0xbe14('0x36')]&&_0x4168c8['customField']){_0x19252f[_0x4168c8[_0xbe14('0x37')]]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x37')]][_0xbe14('0x35')]());}else if(_0x4168c8['type']==='customVariable'&&_0x4168c8[_0xbe14('0x39')]&&_0x4168c8['Variable']['name']&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()][_0xbe14('0x35')]());}});}if(_0x36d4b2[_0xbe14('0x3b')]){_0x36d4b2[_0xbe14('0x3b')]=Number(_0x36d4b2['priority']);}return _0x36d4b2;}function getTicket(_0x4f51f8,_0x43cdaa,_0x2951e1,_0x13bfcf,_0x520e09){logger[_0xbe14('0x12')](_0xbe14('0x3c'));var _0xeda70e=_[_0xbe14('0x3d')]({'subject':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x3f')],_0x520e09,'\x20'),'type':_0xbe14('0x40'),'status':_0xbe14('0x41'),'labels':[_0xbe14('0x42'),'Motion',_0xbe14('0x43')][_0xbe14('0x44')](getTags(_0x13bfcf[_0xbe14('0x45')],_0xbe14('0x3a'))),'description':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0xbe14('0x47'),_0x43cdaa['id']),'class':_0xbe14('0x48')}},'message':{'direction':'in','body':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a')}},getCustomFields(_0x13bfcf['Fields'],_0x520e09));return request({'uri':util['format'](_0xbe14('0x49'),_0x4f51f8[_0xbe14('0x28')],_0x2951e1['id']),'method':_0xbe14('0x29'),'body':_0xeda70e});}exports['queue']=function(_0x5d5318,_0x6b6aa8,_0x59ae4d,_0x5657fe,_0x3593f8,_0x1f0355){var _0x8216c3,_0x5051e4;_0x1f0355['remoteUri']=intUtil['stripTrailingSlash'](_0x1f0355[_0xbe14('0x28')]);_0x1f0355[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x1f0355['serverUrl']);if(_0x3593f8&&_0x3593f8[_0xbe14('0x4c')]){logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x4e'));_0x6b6aa8['recordingURL']=util['format'](_0xbe14('0x4f'),_0x1f0355[_0xbe14('0x4a')],_0x6b6aa8[_0xbe14('0x50')],md5(_0x6b6aa8[_0xbe14('0x50')]));}else{_0x6b6aa8[_0xbe14('0x51')]='';}headers['Authorization']=getAuth(_0x1f0355);return getUser(_0x1f0355,_0x5657fe['email'])[_0xbe14('0xd')](function(_0x2a3623){_0x8216c3=_0x2a3623;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x8216c3['id']);return getEndUser(_0x1f0355,_0x6b6aa8['calleridname'],_0x6b6aa8[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x53e8ab){_0x5051e4=_0x53e8ab;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x5051e4['id']);return getTicket(_0x1f0355,_0x8216c3,_0x5051e4,_0x59ae4d,_0x6b6aa8);})[_0xbe14('0xd')](function(_0x36c20c){if(_0x36c20c){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x36c20c['id']);switch(_0x1f0355['type']){case'integrationTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x36c20c['id']});break;case'newTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe['name']),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')](_0xbe14('0x5b'),_0x36c20c['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x4d'),_0xbe14('0x5d'));}}})['catch'](function(_0x5aeea9){console[_0xbe14('0x5c')](_0x5aeea9);logger[_0xbe14('0x5c')](_0xbe14('0x4d'),JSON['stringify'](_0x5aeea9));});};exports['outbound']=function(_0x44fe0d,_0x134878,_0x50d78f,_0x339a86,_0x32496a,_0x50c2a0,_0x28f995){var _0x4a40d2,_0x41ba58;_0x50c2a0[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['remoteUri']);_0x50c2a0[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['serverUrl']);if(_0x28f995&&_0x28f995[_0xbe14('0x5e')]&&_0x28f995[_0xbe14('0x5e')]!==_0xbe14('0x5f')){logger[_0xbe14('0x12')](_0xbe14('0x60'),'Recording\x20is\x20enabled!');_0x134878[_0xbe14('0x51')]=util[_0xbe14('0xb')](_0xbe14('0x4f'),_0x50c2a0[_0xbe14('0x4a')],_0x134878[_0xbe14('0x50')],md5(_0x134878[_0xbe14('0x50')]));}headers[_0xbe14('0x61')]=getAuth(_0x50c2a0);return getUser(_0x50c2a0,_0x339a86['email'])[_0xbe14('0xd')](function(_0x1b47a4){_0x4a40d2=_0x1b47a4;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x4a40d2['id']);return getEndUser(_0x50c2a0,_0x134878[_0xbe14('0x62')],_0x134878[_0xbe14('0x63')]);})[_0xbe14('0xd')](function(_0x32df3c){_0x41ba58=_0x32df3c;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x41ba58['id']);return getTicket(_0x50c2a0,_0x4a40d2,_0x41ba58,_0x50d78f,_0x134878);})[_0xbe14('0xd')](function(_0x4bccfc){if(_0x4bccfc){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x4bccfc['id']);switch(_0x50c2a0[_0xbe14('0x30')]){case _0xbe14('0x64'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x4bccfc['id']});break;case _0xbe14('0x65'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')]('%s/agent/tickets/%s',_0x50c2a0[_0xbe14('0x28')],_0x4bccfc['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x60'),_0xbe14('0x5d'));}}})[_0xbe14('0x66')](function(_0x222944){logger[_0xbe14('0x5c')](_0xbe14('0x60'),JSON[_0xbe14('0x19')](_0x222944));});};exports[_0xbe14('0x67')]=function(_0x5917d5,_0x18be56,_0x442ec4,_0x2d4dd4,_0xfd32a3,_0x3ac6d8){var _0x5a1ea6,_0x42b341;_0x3ac6d8[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x3ac6d8[_0xbe14('0x28')]);_0x3ac6d8[_0xbe14('0x4a')]=intUtil['stripTrailingSlash'](_0x3ac6d8[_0xbe14('0x4a')]);if(_0xfd32a3&&_0xfd32a3[_0xbe14('0x4c')]){logger[_0xbe14('0x12')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',_0xbe14('0x4e'));_0x18be56[_0xbe14('0x51')]=util[_0xbe14('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3ac6d8[_0xbe14('0x4a')],_0x18be56[_0xbe14('0x50')],md5(_0x18be56[_0xbe14('0x50')]));}else{_0x18be56[_0xbe14('0x51')]='';}headers[_0xbe14('0x61')]=getAuth(_0x3ac6d8);return getUser(_0x3ac6d8)[_0xbe14('0xd')](function(_0x445302){_0x5a1ea6=_0x445302;logger['info']('The\x20User\x20ID\x20is:',_0x5a1ea6['id']);return getEndUser(_0x3ac6d8,_0x18be56[_0xbe14('0x6a')],_0x18be56[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x2510a0){_0x42b341=_0x2510a0;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x42b341['id']);return getTicket(_0x3ac6d8,_0x5a1ea6,_0x42b341,_0x442ec4,_0x18be56);})[_0xbe14('0xd')](function(_0x43511e){if(_0x43511e){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x43511e['id']);}})[_0xbe14('0x66')](function(_0x57729f){logger[_0xbe14('0x5c')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',JSON[_0xbe14('0x19')](_0x57729f));});}; \ No newline at end of file +var _0x55ca=['debug','[HTTP]','stringify','GET','authType','basic','%s:%s','username','token','%s/token:%s','toString','base64','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','_embedded','entries','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','length','forEach','includes','picklist','type','nameField','customField','toLowerCase','content','string','idField','custom_fields','variable','variableName','customVariable','Variable','name','priority','merge','xCALLY','Motion','CTI','concat','Tags','getString','Descriptions','/api/v2/users/%d','user','Fields','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','error','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/agent/tickets/%s','catch','unmanaged','monitor_format','lastevent','toUpperCase','Recording\x20is\x20enabled!','lodash','request-promise','./util','../../../../config/environment','desk','redis','defaults','localhost','socket.io-emitter','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','%s/users','remoteUri','then','total_entries','find','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me'];(function(_0x5bbb34,_0x79175f){var _0x3558b0=function(_0x27b3f1){while(--_0x27b3f1){_0x5bbb34['push'](_0x5bbb34['shift']());}};_0x3558b0(++_0x79175f);}(_0x55ca,0x126));var _0xa55c=function(_0x382d8e,_0x2a5761){_0x382d8e=_0x382d8e-0x0;var _0x23993d=_0x55ca[_0x382d8e];return _0x23993d;};'use strict';var _=require(_0xa55c('0x0'));var rp=require(_0xa55c('0x1'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var intUtil=require(_0xa55c('0x2'));var config=require(_0xa55c('0x3'));var logger=require('../../../../config/logger')(_0xa55c('0x4'));config[_0xa55c('0x5')]=_[_0xa55c('0x6')](config[_0xa55c('0x5')],{'host':_0xa55c('0x7'),'port':0x18eb});var io=require(_0xa55c('0x8'))(new Redis(config[_0xa55c('0x5')]));function emit(_0x4d0624,_0x2121fd,_0x2537f0){io['to'](_0x4d0624)['emit'](_0x2121fd,_0x2537f0);}var headers={'Content-Type':_0xa55c('0x9'),'Accept':_0xa55c('0x9')};function getUser(_0x52a3bc,_0x5849ad){if(intUtil[_0xa55c('0xa')](_0x5849ad)===!![]){logger[_0xa55c('0xb')](_0xa55c('0xc'),_0x5849ad);return request({'uri':util[_0xa55c('0xd')](_0xa55c('0xe'),_0x52a3bc[_0xa55c('0xf')])})[_0xa55c('0x10')](function(_0x70c2de){if(_0x70c2de[_0xa55c('0x11')]){return _[_0xa55c('0x12')](_0x70c2de['_embedded']['entries'],{'email':_0x5849ad});}})[_0xa55c('0x10')](function(_0x576044){if(_0x576044){logger['info']('Agent\x20found!');return _0x576044;}else{logger[_0xa55c('0xb')](_0xa55c('0x13'));return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x14'),_0x52a3bc[_0xa55c('0xf')])});}});}else{logger[_0xa55c('0xb')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x14'),_0x52a3bc[_0xa55c('0xf')])});}}function request(_0x31e10d){logger[_0xa55c('0x15')](_0xa55c('0x16'),JSON[_0xa55c('0x17')](_0x31e10d));return rp(_[_0xa55c('0x6')](_0x31e10d,{'method':_0xa55c('0x18'),'headers':headers,'json':!![]}));}function getAuth(_0x4cee3c){var _0x3d4c9e;if(_0x4cee3c[_0xa55c('0x19')]===_0xa55c('0x1a')){_0x3d4c9e=util[_0xa55c('0xd')](_0xa55c('0x1b'),_0x4cee3c[_0xa55c('0x1c')],_0x4cee3c['password']);}else if(_0x4cee3c['authType']===_0xa55c('0x1d')){_0x3d4c9e=util[_0xa55c('0xd')](_0xa55c('0x1e'),_0x4cee3c['username'],_0x4cee3c[_0xa55c('0x1d')]);}return util[_0xa55c('0xd')]('Basic\x20%s',new Buffer(_0x3d4c9e)[_0xa55c('0x1f')](_0xa55c('0x20')));}function getEndUser(_0x940f28,_0x1965f1,_0x234372){logger['info'](_0xa55c('0x21'),_0x234372);return request({'uri':util['format']('%s/customers/search',_0x940f28['remoteUri']),'qs':{'phone':_0x234372}})[_0xa55c('0x10')](function(_0x54b038){if(_0x54b038[_0xa55c('0x11')]){logger[_0xa55c('0xb')](_0xa55c('0x22'));return _0x54b038[_0xa55c('0x23')][_0xa55c('0x24')][0x0];}else{logger[_0xa55c('0xb')](_0xa55c('0x25'));return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x26'),_0x940f28[_0xa55c('0xf')]),'method':_0xa55c('0x27'),'body':{'first_name':_0x1965f1,'title':_0x1965f1,'phone_numbers':[{'type':'work','value':_0x234372}]}});}});}function getTags(_0x430d55,_0x28814f){var _0x1c9f6b=[];if(_0x430d55&&_0x430d55[_0xa55c('0x28')]>0x0){_0x1c9f6b=_['map'](_0x430d55,_0x28814f);}return _0x1c9f6b;}function getCustomFields(_0x1377b0,_0x22f6b6){var _0x1b8388=[];var _0x201941={'custom_fields':{}};if(_0x1377b0[_0xa55c('0x28')]>0x0){_[_0xa55c('0x29')](_0x1377b0,function(_0x52d37f){if(_[_0xa55c('0x2a')](['string',_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x2d')]&&!_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0x52d37f['nameField'][_0xa55c('0x2f')]()]=_0x52d37f[_0xa55c('0x30')][_0xa55c('0x1f')]();}else if(_[_0xa55c('0x2a')]([_0xa55c('0x31'),_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x52d37f['content']['toString']();}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x34')&&_0x52d37f['variableName']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x35')]]&&(_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f[_0xa55c('0x35')]][_0xa55c('0x1f')]());}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x36')&&_0x52d37f['Variable']&&_0x52d37f['Variable']['name']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x37')]['name'][_0xa55c('0x2f')]()]&&(_0x201941['custom_fields'][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f['Variable'][_0xa55c('0x38')][_0xa55c('0x2f')]()][_0xa55c('0x1f')]());}});}if(_0x201941['priority']){_0x201941[_0xa55c('0x39')]=Number(_0x201941[_0xa55c('0x39')]);}return _0x201941;}function getTicket(_0x47e93c,_0x6f9c4c,_0x194e78,_0x4d9083,_0x529ff8){logger[_0xa55c('0xb')]('Creating\x20new\x20ticket...');var _0x1e75dc=_[_0xa55c('0x3a')]({'subject':intUtil['getString'](_0x4d9083['Subjects'],_0x529ff8,'\x20'),'type':'phone','status':'new','labels':[_0xa55c('0x3b'),_0xa55c('0x3c'),_0xa55c('0x3d')][_0xa55c('0x3e')](getTags(_0x4d9083[_0xa55c('0x3f')],'name')),'description':intUtil[_0xa55c('0x40')](_0x4d9083[_0xa55c('0x41')],_0x529ff8,'\x0a'),'_links':{'assigned_user':{'href':util[_0xa55c('0xd')](_0xa55c('0x42'),_0x6f9c4c['id']),'class':_0xa55c('0x43')}},'message':{'direction':'in','body':intUtil[_0xa55c('0x40')](_0x4d9083['Descriptions'],_0x529ff8,'\x0a')}},getCustomFields(_0x4d9083[_0xa55c('0x44')],_0x529ff8));return request({'uri':util['format']('%s/customers/%d/cases',_0x47e93c[_0xa55c('0xf')],_0x194e78['id']),'method':_0xa55c('0x27'),'body':_0x1e75dc});}exports['queue']=function(_0x2bd98b,_0x508bd3,_0x5f25f7,_0x2f8449,_0x3fea03,_0x1630ac){var _0x540337,_0x1b2708;_0x1630ac[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1630ac[_0xa55c('0xf')]);_0x1630ac['serverUrl']=intUtil[_0xa55c('0x45')](_0x1630ac[_0xa55c('0x46')]);if(_0x3fea03&&_0x3fea03['monitor_format']){logger[_0xa55c('0xb')](_0xa55c('0x47'),'Recording\x20is\x20enabled!');_0x508bd3[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1630ac['serverUrl'],_0x508bd3[_0xa55c('0x4a')],md5(_0x508bd3['uniqueid']));}else{_0x508bd3[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1630ac);return getUser(_0x1630ac,_0x2f8449[_0xa55c('0x4c')])['then'](function(_0x41eab1){_0x540337=_0x41eab1;logger[_0xa55c('0xb')]('The\x20User\x20ID\x20is:',_0x540337['id']);return getEndUser(_0x1630ac,_0x508bd3[_0xa55c('0x4d')],_0x508bd3[_0xa55c('0x4e')]);})['then'](function(_0x11ff1d){_0x1b2708=_0x11ff1d;logger[_0xa55c('0xb')]('The\x20Enduser\x20ID\x20is:',_0x1b2708['id']);return getTicket(_0x1630ac,_0x540337,_0x1b2708,_0x5f25f7,_0x508bd3);})[_0xa55c('0x10')](function(_0x81cee8){if(_0x81cee8){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger['info'](_0xa55c('0x50'),_0x81cee8['id']);switch(_0x1630ac['type']){case _0xa55c('0x51'):logger[_0xa55c('0xb')](_0xa55c('0x47'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449['name']),_0xa55c('0x53'),{'recordId':_0x81cee8['id']});break;case _0xa55c('0x54'):logger[_0xa55c('0xb')](_0xa55c('0x47'),_0xa55c('0x55'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449[_0xa55c('0x38')]),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')]('https://xcally.desk.com/web/agent/case/%d',_0x81cee8['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x47'),_0xa55c('0x58'));}}})['catch'](function(_0x4c3095){console[_0xa55c('0x57')](_0x4c3095);logger['error'](_0xa55c('0x47'),JSON['stringify'](_0x4c3095));});};exports[_0xa55c('0x59')]=function(_0x228df4,_0x181802,_0x3f9313,_0x2ecf79,_0x5b1cf3,_0x44b7c1,_0x4607ca){var _0x4b85cc,_0x3929a6;_0x44b7c1[_0xa55c('0xf')]=intUtil[_0xa55c('0x45')](_0x44b7c1[_0xa55c('0xf')]);_0x44b7c1['serverUrl']=intUtil['stripTrailingSlash'](_0x44b7c1[_0xa55c('0x46')]);if(_0x4607ca&&_0x4607ca[_0xa55c('0x5a')]&&_0x4607ca[_0xa55c('0x5a')]!==_0xa55c('0x5b')){logger['info'](_0xa55c('0x5c'),'Recording\x20is\x20enabled!');_0x181802[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x44b7c1[_0xa55c('0x46')],_0x181802[_0xa55c('0x4a')],md5(_0x181802['uniqueid']));}headers[_0xa55c('0x4b')]=getAuth(_0x44b7c1);return getUser(_0x44b7c1,_0x2ecf79['email'])[_0xa55c('0x10')](function(_0x157afe){_0x4b85cc=_0x157afe;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0x4b85cc['id']);return getEndUser(_0x44b7c1,_0x181802[_0xa55c('0x5e')],_0x181802[_0xa55c('0x5f')]);})[_0xa55c('0x10')](function(_0x53e2be){_0x3929a6=_0x53e2be;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3929a6['id']);return getTicket(_0x44b7c1,_0x4b85cc,_0x3929a6,_0x3f9313,_0x181802);})[_0xa55c('0x10')](function(_0x23a30e){if(_0x23a30e){logger[_0xa55c('0xb')]('Ticket\x20created!');logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x23a30e['id']);switch(_0x44b7c1[_0xa55c('0x2c')]){case _0xa55c('0x51'):logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x61'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2ecf79[_0xa55c('0x38')]),_0xa55c('0x53'),{'recordId':_0x23a30e['id']});break;case'newTab':logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x55'));emit(util['format'](_0xa55c('0x52'),_0x2ecf79['name']),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')](_0xa55c('0x62'),_0x44b7c1[_0xa55c('0xf')],_0x23a30e['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x5c'),_0xa55c('0x58'));}}})[_0xa55c('0x63')](function(_0x14b515){logger[_0xa55c('0x57')]('[OUTBOUND]',JSON[_0xa55c('0x17')](_0x14b515));});};exports[_0xa55c('0x64')]=function(_0x4ef914,_0x18b928,_0x2b8b88,_0x3e3b4b,_0x9fe234,_0x1b8b06){var _0xa38271,_0x3cef1f;_0x1b8b06[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1b8b06[_0xa55c('0xf')]);_0x1b8b06[_0xa55c('0x46')]=intUtil[_0xa55c('0x45')](_0x1b8b06[_0xa55c('0x46')]);if(_0x9fe234&&_0x9fe234[_0xa55c('0x65')]){logger[_0xa55c('0xb')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',_0xa55c('0x68'));_0x18b928['recordingURL']=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1b8b06[_0xa55c('0x46')],_0x18b928[_0xa55c('0x4a')],md5(_0x18b928[_0xa55c('0x4a')]));}else{_0x18b928[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1b8b06);return getUser(_0x1b8b06)[_0xa55c('0x10')](function(_0x2e4cf7){_0xa38271=_0x2e4cf7;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0xa38271['id']);return getEndUser(_0x1b8b06,_0x18b928['calleridname'],_0x18b928[_0xa55c('0x4e')]);})['then'](function(_0x1228a4){_0x3cef1f=_0x1228a4;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3cef1f['id']);return getTicket(_0x1b8b06,_0xa38271,_0x3cef1f,_0x2b8b88,_0x18b928);})['then'](function(_0x4d9722){if(_0x4d9722){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x4d9722['id']);}})['catch'](function(_0x149cb9){logger[_0xa55c('0x57')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',JSON[_0xa55c('0x17')](_0x149cb9));});}; \ 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 fc66eb6..91657c5 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 _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 +var _0xdfef=['Fields','ticketType','phonecall','queue','callDirection','phonecalls','Subjects','Descriptions','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','additionalSearchContact',']\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','util','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','resolve','clientId','then','access_token','catch','error','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','toUpperCase',']\x20Agent\x20found\x20','userId','systemuserid','username','toLowerCase','outbound','calleridnum','POST','/systemusers(','4.0','body','headers','odata-entityid','substring','lastIndexOf','enduserId','destcalleridnum','contacts?$select=','&$filter=','\x20eq\x20\x27','%2b','contactid','nothing','info',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','forEach','includes','string','type','nameField','idField','indexOf','content','incident','assign','getString','/contacts('];(function(_0x1a9204,_0x1c9e00){var _0x17ca68=function(_0x1f4399){while(--_0x1f4399){_0x1a9204['push'](_0x1a9204['shift']());}};_0x17ca68(++_0x1c9e00);}(_0xdfef,0x1be));var _0xfdfe=function(_0x34dc27,_0x16dbf0){_0x34dc27=_0x34dc27-0x0;var _0x33893e=_0xdfef[_0x34dc27];return _0x33893e;};'use strict';var _=require('lodash');var rp=require('request-promise');var util=require(_0xfdfe('0x0'));var intUtil=require('./util');var md5=require('md5');var Redis=require(_0xfdfe('0x1'));var logger=require(_0xfdfe('0x2'))(_0xfdfe('0x3'));var config=require(_0xfdfe('0x4'));config[_0xfdfe('0x5')]=_[_0xfdfe('0x6')](config['redis'],{'host':_0xfdfe('0x7'),'port':0x18eb});var io=require(_0xfdfe('0x8'))(new Redis(config[_0xfdfe('0x5')]));function getAuthToken(_0x543d0e,_0x29ef9d,_0x392d71){if(_0x543d0e[_0xfdfe('0x9')]){_0x543d0e[_0xfdfe('0xa')]=_0x543d0e[_0xfdfe('0xb')][_0xfdfe('0xc')];_0x543d0e['tenantId']=_0x543d0e[_0xfdfe('0xb')]['data2'];return Promise[_0xfdfe('0xd')](_0x543d0e['CloudProvider']['data5']);}var _0x1413f5={'method':'POST','uri':_0x29ef9d,'form':{'client_id':_0x543d0e[_0xfdfe('0xe')],'resource':_0x543d0e[_0xfdfe('0xa')],'username':_0x543d0e['username'],'password':_0x543d0e['password'],'grant_type':'password','client_secret':_0x543d0e['clientSecret']},'json':!![]};return rp(_0x1413f5)[_0xfdfe('0xf')](function(_0x2e3867){return _0x2e3867[_0xfdfe('0x10')];})[_0xfdfe('0x11')](function(_0x2155be){logger[_0xfdfe('0x12')]('['+[_0x392d71['toUpperCase']()]+']\x20Wrong\x20credentials!');return _0x2155be[_0xfdfe('0x13')];});}function getUser(_0x1518eb,_0x30821d,_0x983465,_0x2203a7,_0x578585,_0x4d64c7){return new Promise(function(_0x40c7de,_0x5f1252){return getAuthToken(_0x30821d,_0x2203a7,_0x4d64c7)[_0xfdfe('0xf')](function(_0x498767){var _0x3b74dc={'method':_0xfdfe('0x14'),'uri':_0x578585+_0xfdfe('0x15'),'headers':{'Authorization':_0xfdfe('0x16')+_0x498767,'OData-Version':'4.0'},'json':!![]};return rp(_0x3b74dc);})[_0xfdfe('0xf')](function(_0x25e1a3){var _0x4d42d=_0x25e1a3[_0xfdfe('0x17')];var _0x50ce2a=![];var _0x68f5ca=null;if(!_[_0xfdfe('0x18')](_0x983465)){if(intUtil[_0xfdfe('0x19')](_0x983465[_0xfdfe('0x1a')])){_0x1518eb[_0xfdfe('0x1b')]=_0x983465[_0xfdfe('0x1a')];for(_0x68f5ca=0x0;_0x68f5ca<_0x4d42d[_0xfdfe('0x1c')];_0x68f5ca++){if(_0x4d42d[_0x68f5ca][_0xfdfe('0x1d')]===_0x983465[_0xfdfe('0x1a')]&&!_0x4d42d[_0x68f5ca][_0xfdfe('0x1e')]){_0x50ce2a=!![];logger['info']('['+[_0x4d64c7[_0xfdfe('0x1f')]()]+_0xfdfe('0x20')+_0x4d42d[_0x68f5ca]['systemuserid']+'!');_0x1518eb[_0xfdfe('0x21')]=_0x4d42d[_0x68f5ca][_0xfdfe('0x22')];}}}}if(!_0x50ce2a){logger['info']('['+[_0x4d64c7['toUpperCase']()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x1518eb[_0xfdfe('0x1b')]=_0x30821d[_0xfdfe('0x23')];for(_0x68f5ca=0x0;_0x68f5ca<_0x4d42d[_0xfdfe('0x1c')];_0x68f5ca++){if(_0x4d42d[_0x68f5ca]['internalemailaddress']===_0x30821d['username']){_0x1518eb[_0xfdfe('0x21')]=_0x4d42d[_0x68f5ca]['systemuserid'];}}}_0x40c7de(_0x1518eb);})[_0xfdfe('0x11')](function(_0x2d6b0c){_0x5f1252(_0x2d6b0c[_0xfdfe('0x13')]);});});}function createEndUser(_0x509ac9,_0x5b4559,_0x2c812e,_0x2753b5,_0x2746d2,_0x1f7e73,_0x1534e7){return new Promise(function(_0x274960,_0x57dd9c){return getAuthToken(_0x5b4559,_0x2c812e,_0x1f7e73)['then'](function(_0x18e8d1){var _0x1870f6=_0x1f7e73[_0xfdfe('0x24')]()===_0xfdfe('0x25')?_0x2746d2['destcalleridnum']:_0x2746d2[_0xfdfe('0x26')];var _0x3ac7bf={'method':_0xfdfe('0x27'),'uri':_0x2753b5+'contacts','body':{'fullname':_0x1870f6,'firstname':_0x1870f6,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xfdfe('0x28')+_0x509ac9[_0xfdfe('0x21')]+')'},'headers':{'Authorization':_0xfdfe('0x16')+_0x18e8d1,'OData-Version':_0xfdfe('0x29')},'json':!![],'resolveWithFullResponse':!![]};_0x3ac7bf[_0xfdfe('0x2a')][_0x1534e7]=_0x1870f6;return rp(_0x3ac7bf);})[_0xfdfe('0xf')](function(_0x5a3a1f){var _0x45241b=_0x5a3a1f[_0xfdfe('0x2b')][_0xfdfe('0x2c')];var _0x332f66=_0x45241b[_0xfdfe('0x2d')](_0x45241b[_0xfdfe('0x2e')]('(')+0x1,_0x45241b[_0xfdfe('0x2e')](')'));_0x509ac9[_0xfdfe('0x2f')]=_0x332f66;_0x274960(_0x509ac9);})[_0xfdfe('0x11')](function(_0x560a50){_0x57dd9c(_0x560a50['message']);});});}function getEndUser(_0x4038b8,_0x263a9d,_0xa2b24e,_0x19a837,_0x486a68,_0x45f695,_0x549f95,_0x348847){var _0x55c727=_0x45f695[_0xfdfe('0x24')]()===_0xfdfe('0x25')?_0x486a68[_0xfdfe('0x30')]:_0x486a68[_0xfdfe('0x26')];return getAuthToken(_0x263a9d,_0xa2b24e,_0x45f695)[_0xfdfe('0xf')](function(_0xc89b31){_0x348847=_0x348847?_0x348847:'telephone1';var _0x13d5be={'method':_0xfdfe('0x14'),'uri':_0x19a837+_0xfdfe('0x31')+_0x348847+_0xfdfe('0x32')+_0x348847+_0xfdfe('0x33')+_0x55c727['replace']('+',_0xfdfe('0x34'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0xc89b31,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x13d5be);})['then'](function(_0x36e370){var _0x2e798e=![];if(!_0x36e370)return _0x2e798e;var _0x1693d1=_0x36e370[_0xfdfe('0x17')];for(var _0x18a7c6=0x0;_0x18a7c6<_0x1693d1['length'];_0x18a7c6++){if(_0x1693d1[_0x18a7c6][_0x348847]===_0x55c727){_0x2e798e=!![];_0x4038b8[_0xfdfe('0x2f')]=_0x1693d1[_0x18a7c6][_0xfdfe('0x35')];}}return _0x2e798e;})[_0xfdfe('0xf')](function(_0x8bf953){if(_0x8bf953)return _0x4038b8;if(_0x549f95===_0xfdfe('0x36')){logger[_0xfdfe('0x37')]('['+[_0x45f695[_0xfdfe('0x1f')]()]+_0xfdfe('0x38'));return _0x4038b8;}return createEndUser(_0x4038b8,_0x263a9d,_0xa2b24e,_0x19a837,_0x486a68,_0x45f695,_0x348847)['then'](function(_0xa1a88){logger[_0xfdfe('0x37')]('['+[_0x45f695[_0xfdfe('0x1f')]()]+']\x20Enduser\x20created!',_0xa1a88['enduserId']);return _0xa1a88;});});}function getCustomFields(_0x51670b,_0x1d50ff,_0x128de9){var _0x3631cb={};if(_0x51670b[_0xfdfe('0x1c')]>0x0){_[_0xfdfe('0x39')](_0x51670b,function(_0x1e347d){if(_[_0xfdfe('0x3a')]([_0xfdfe('0x3b'),'picklist'],_0x1e347d[_0xfdfe('0x3c')])&&_0x1e347d[_0xfdfe('0x3d')]&&!_0x1e347d['customField']){var _0x5ac212=_0x1e347d[_0xfdfe('0x3e')][_0xfdfe('0x24')]();var _0x2b7a4c=_0x5ac212[_0xfdfe('0x2d')](0x0,_0x5ac212['indexOf']('_'));var _0x31697a=_0x5ac212[_0xfdfe('0x2d')](_0x5ac212[_0xfdfe('0x3f')]('_')+0x1);if(_0x2b7a4c===_0x128de9){_0x3631cb[_0x31697a]=_0x1e347d[_0xfdfe('0x40')];}}});}return _0x3631cb;}function getTicket(_0x54d60a,_0x441cad,_0x300b1d,_0x28df72,_0x2eadf1,_0x39c6f6,_0x2f7113){return new Promise(function(_0x1e6937,_0x5cc520){var _0x4dbc39;return getAuthToken(_0x441cad,_0x300b1d,_0x2f7113)['then'](function(_0x9ac859){if(_0x39c6f6['ticketType']===_0xfdfe('0x41')){_0x4dbc39={'method':_0xfdfe('0x27'),'uri':_0x28df72+'incidents','body':Object[_0xfdfe('0x42')]({},{'title':intUtil[_0xfdfe('0x43')](_0x39c6f6['Subjects'],_0x2eadf1,'\x20'),'description':intUtil['getString'](_0x39c6f6['Descriptions'],_0x2eadf1,'\x0a'),'customerid_contact@odata.bind':_0x54d60a[_0xfdfe('0x2f')]?_0xfdfe('0x44')+_0x54d60a['enduserId']+')':undefined,'ownerid@odata.bind':_0xfdfe('0x28')+_0x54d60a[_0xfdfe('0x21')]+')','caseorigincode':'1'},getCustomFields(_0x39c6f6[_0xfdfe('0x45')],_0x2eadf1,_0x39c6f6['ticketType'])),'headers':{'Authorization':'Bearer\x20'+_0x9ac859,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x39c6f6[_0xfdfe('0x46')]===_0xfdfe('0x47')){var _0x2f1404=_0x54d60a[_0xfdfe('0x2f')]?[{'partyid_systemuser@odata.bind':_0xfdfe('0x28')+_0x54d60a[_0xfdfe('0x21')]+')','participationtypemask':_0x54d60a['callDirection']===_0xfdfe('0x48')?0x2:0x1},{'partyid_contact@odata.bind':_0xfdfe('0x44')+_0x54d60a['enduserId']+')','participationtypemask':_0x54d60a[_0xfdfe('0x49')]===_0xfdfe('0x48')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x54d60a[_0xfdfe('0x21')]+')','participationtypemask':_0x54d60a[_0xfdfe('0x49')]===_0xfdfe('0x48')?0x2:0x1}];_0x4dbc39={'method':'POST','uri':_0x28df72+_0xfdfe('0x4a'),'body':Object['assign']({},{'subject':intUtil[_0xfdfe('0x43')](_0x39c6f6[_0xfdfe('0x4b')],_0x2eadf1,'\x20'),'phonenumber':String(_0x2eadf1[_0xfdfe('0x26')]),'description':intUtil[_0xfdfe('0x43')](_0x39c6f6[_0xfdfe('0x4c')],_0x2eadf1,'\x0a'),'regardingobjectid_contact@odata.bind':_0x54d60a['enduserId']?_0xfdfe('0x44')+_0x54d60a[_0xfdfe('0x2f')]+')':undefined,'ownerid@odata.bind':_0xfdfe('0x28')+_0x54d60a[_0xfdfe('0x21')]+')','directioncode':_0x54d60a[_0xfdfe('0x49')]==='queue'?![]:!![],'phonecall_activity_parties':_0x2f1404},getCustomFields(_0x39c6f6['Fields'],_0x2eadf1,_0x39c6f6[_0xfdfe('0x46')])),'headers':{'Authorization':_0xfdfe('0x16')+_0x9ac859,'OData-Version':_0xfdfe('0x29')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x4dbc39);})['then'](function(_0x361d71){var _0x144af=_0x361d71['headers'][_0xfdfe('0x2c')];var _0x2bb425=_0x144af[_0xfdfe('0x2d')](_0x144af['lastIndexOf']('(')+0x1,_0x144af['lastIndexOf'](')'));_0x54d60a[_0xfdfe('0x4d')]=_0x2bb425;_0x1e6937(_0x54d60a);})['catch'](function(_0x412a38){_0x5cc520(_0x412a38[_0xfdfe('0x13')]);});});}function emit(_0x3861a7,_0x16a364,_0x9470ea,_0x2b432c){var _0x2b7e5a={'uri':util[_0xfdfe('0x4e')](_0xfdfe('0x4f'),_0x3861a7,_0x9470ea,_0x2b432c)};io['to'](util['format']('user:%s',_0x16a364))['emit'](_0xfdfe('0x50'),_0x2b7e5a);}exports['cs']=function(_0x1d62c1,_0x1ab405,_0x935bd9,_0x3b503c,_0x58ee05,_0x5e6b4b,_0x24fe85,_0x111463){var _0xb3f90b={};_0x5e6b4b[_0xfdfe('0xa')]=_0x5e6b4b[_0xfdfe('0x9')]?intUtil[_0xfdfe('0x51')](_0x5e6b4b[_0xfdfe('0xb')][_0xfdfe('0xc')]):intUtil['stripTrailingSlash'](_0x5e6b4b[_0xfdfe('0xa')]);_0x5e6b4b[_0xfdfe('0x52')]=intUtil[_0xfdfe('0x51')](_0x5e6b4b[_0xfdfe('0x52')]);_0xb3f90b['callDirection']=_0x111463===_0xfdfe('0x48')||_0x111463===_0xfdfe('0x53')?_0xfdfe('0x48'):'outbound';var _0x25d2e7=_0x5e6b4b['modernAuthentication']?util[_0xfdfe('0x4e')]('%s/api/data/v9.0/',_0x5e6b4b[_0xfdfe('0xb')][_0xfdfe('0xc')]):util[_0xfdfe('0x4e')](_0xfdfe('0x54'),_0x5e6b4b['remoteUri']);var _0x1ceeda=util[_0xfdfe('0x4e')](_0xfdfe('0x55'),_0x5e6b4b[_0xfdfe('0x56')]);var _0x1e1d88=util['format'](_0xfdfe('0x57'),_0x5e6b4b[_0xfdfe('0x52')],_0x1ab405[_0xfdfe('0x58')],md5(_0x1ab405[_0xfdfe('0x58')]));if(_0x58ee05&&_0x58ee05['monitor_format']){logger[_0xfdfe('0x37')](_0xfdfe('0x59'),_0xfdfe('0x5a'));_0x1ab405['recordingURL']=_0x1e1d88;}else if(_0x24fe85&&_0x24fe85[_0xfdfe('0x5b')]&&_0x24fe85[_0xfdfe('0x5b')]!==_0xfdfe('0x5c')){logger['info'](_0xfdfe('0x5d'),'Recording\x20is\x20enabled!');_0x1ab405[_0xfdfe('0x5e')]=_0x1e1d88;}else{_0x1ab405[_0xfdfe('0x5e')]='';}return getUser(_0xb3f90b,_0x5e6b4b,_0x3b503c,_0x1ceeda,_0x25d2e7,_0x111463)['then'](function(_0x1b3a75){logger['info']('['+_0x111463[_0xfdfe('0x1f')]()+']\x20The\x20User\x20ID\x20is:',_0x1b3a75[_0xfdfe('0x21')]);logger[_0xfdfe('0x37')]('['+_0x111463['toUpperCase']()+']\x20The\x20User\x20email\x20is:',_0x1b3a75[_0xfdfe('0x1b')]);return getEndUser(_0x1b3a75,_0x5e6b4b,_0x1ceeda,_0x25d2e7,_0x1ab405,_0x111463,_0x935bd9['moduleCreate'],_0x935bd9[_0xfdfe('0x5f')]);})['then'](function(_0x38396e){logger[_0xfdfe('0x37')]('['+_0x111463[_0xfdfe('0x1f')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x38396e[_0xfdfe('0x2f')]);logger[_0xfdfe('0x37')]('['+_0x111463[_0xfdfe('0x1f')]()+_0xfdfe('0x60'),_0x1ab405[_0xfdfe('0x26')]);return getTicket(_0x38396e,_0x5e6b4b,_0x1ceeda,_0x25d2e7,_0x1ab405,_0x935bd9,_0x111463);})[_0xfdfe('0xf')](function(_0x35cb8d){logger[_0xfdfe('0x37')](util[_0xfdfe('0x4e')]('['+_0x111463[_0xfdfe('0x1f')]()+_0xfdfe('0x61'),_0x935bd9[_0xfdfe('0x46')],_0x35cb8d[_0xfdfe('0x4d')]));logger[_0xfdfe('0x37')](util['format']('['+_0x111463[_0xfdfe('0x1f')]()+_0xfdfe('0x62'),_0x111463));if(_0x111463!==_0xfdfe('0x53')&&_0x935bd9[_0xfdfe('0x63')]){logger['info']('['+_0x111463[_0xfdfe('0x1f')]()+']',_0xfdfe('0x64'));emit(_0x5e6b4b['remoteUri'],_0x3b503c[_0xfdfe('0x65')],_0x935bd9[_0xfdfe('0x46')],_0x35cb8d[_0xfdfe('0x4d')]);}})[_0xfdfe('0x11')](function(_0x41c953){logger[_0xfdfe('0x12')]('['+_0x111463[_0xfdfe('0x1f')]()+_0xfdfe('0x66'),_0x41c953[_0xfdfe('0x13')]);console[_0xfdfe('0x12')]('Error\x20running\x20Dynamics365\x20integration',_0x41c953);});}; \ 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 9804947..c61708c 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 _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 +var _0x184e=['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:','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','outbound','recordingFormat','none','destcalleridname','The\x20Ticket\x20ID\x20is:','[OUTBOUND]','unmanaged','toUpperCase','error','lodash','md5','util','ioredis','./util','../../../../config/environment','freshdesk','redis','localhost','socket.io-emitter','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','Agent\x20found!','find','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','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20created.','toString','base64','stringify','defaults','length','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField'];(function(_0x56a136,_0x27f1e8){var _0x4675a0=function(_0x4740b2){while(--_0x4740b2){_0x56a136['push'](_0x56a136['shift']());}};_0x4675a0(++_0x27f1e8);}(_0x184e,0x1ec));var _0xe184=function(_0x2ef251,_0x3687e5){_0x2ef251=_0x2ef251-0x0;var _0x5c931b=_0x184e[_0x2ef251];return _0x5c931b;};'use strict';var _=require(_0xe184('0x0'));var rp=require('request-promise');var md5=require(_0xe184('0x1'));var util=require(_0xe184('0x2'));var Redis=require(_0xe184('0x3'));var intUtil=require(_0xe184('0x4'));var config=require(_0xe184('0x5'));var logger=require('../../../../config/logger')(_0xe184('0x6'));config[_0xe184('0x7')]=_['defaults'](config['redis'],{'host':_0xe184('0x8'),'port':0x18eb});var io=require(_0xe184('0x9'))(new Redis(config[_0xe184('0x7')]));var headers={'Content-Type':'application/json','Accept':'application/json'};function emit(_0x450c9b,_0xe5188c,_0x1c2f7a){io['to'](_0x450c9b)['emit'](_0xe5188c,_0x1c2f7a);}function getTicket(_0x42339b,_0x1de2f2,_0x59ad7f,_0x263e00,_0x361b60){logger[_0xe184('0xa')](_0xe184('0xb'));var _0x46175b=_[_0xe184('0xc')]({'responder_id':_0x1de2f2['id'],'requester_id':_0x59ad7f['id'],'name':util[_0xe184('0xd')](_0xe184('0xe'),_0x361b60[_0xe184('0xf')]),'phone':_0x361b60[_0xe184('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xe184('0x11')](_0x263e00[_0xe184('0x12')],_0x361b60,'\x20'),'description':intUtil[_0xe184('0x11')](_0x263e00[_0xe184('0x13')],_0x361b60,_0xe184('0x14')),'tags':getTags(_0x263e00[_0xe184('0x15')],_0xe184('0x16'))},getCustomFields(_0x263e00[_0xe184('0x17')],_0x361b60));_0x46175b[_0xe184('0x18')]=_[_0xe184('0x19')](_[_0xe184('0x1a')](_0x46175b[_0xe184('0x18')],'id'),_0xe184('0x1b'));return request({'uri':util['format'](_0xe184('0x1c'),_0x42339b[_0xe184('0x1d')]),'method':_0xe184('0x1e'),'body':_0x46175b})[_0xe184('0x1f')](function(_0x5064e3){logger[_0xe184('0xa')](_0xe184('0x20'));return _0x5064e3;});}function getUser(_0xf25265,_0x1e8e29){if(intUtil['validateEmail'](_0x1e8e29)){return request({'uri':util[_0xe184('0xd')]('%s/api/v2/agents',_0xf25265['remoteUri']),'qs':{'email':_0x1e8e29}})['then'](function(_0xdba58d){if(_0xdba58d['length']){logger[_0xe184('0xa')](_0xe184('0x21'));return _[_0xe184('0x22')](_0xdba58d,function(_0x199120){return _0x199120[_0xe184('0x23')]['email']===_0x1e8e29;});}else{logger[_0xe184('0xa')](_0xe184('0x24'));return request({'uri':util['format'](_0xe184('0x25'),_0xf25265['remoteUri'])})[_0xe184('0x1f')](function(_0xddc254){logger[_0xe184('0xa')](_0xe184('0x26'));return _0xddc254;});}});}else{logger['info'](_0xe184('0x27'));return request({'uri':util[_0xe184('0xd')](_0xe184('0x25'),_0xf25265[_0xe184('0x1d')])})[_0xe184('0x1f')](function(_0x448a22){logger['info'](_0xe184('0x26'));return _0x448a22;});}}function getEndUser(_0x58b3a8,_0x5cbf80,_0x12fecb){logger['info'](_0xe184('0x28'),_0x12fecb);return request({'uri':util[_0xe184('0xd')](_0xe184('0x29'),_0x58b3a8[_0xe184('0x1d')]),'qs':{'phone':_0x12fecb}})['then'](function(_0x48ed47){if(_0x48ed47['length']){logger['info'](_0xe184('0x2a'));return _[_0xe184('0x22')](_0x48ed47,{'phone':_0x12fecb});}else{logger[_0xe184('0xa')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xe184('0xd')](_0xe184('0x29'),_0x58b3a8[_0xe184('0x1d')]),'method':_0xe184('0x1e'),'body':{'name':_0x5cbf80,'phone':_0x12fecb}})[_0xe184('0x1f')](function(_0x40e9e7){logger[_0xe184('0xa')](_0xe184('0x2b'));return _0x40e9e7;});}});}function getAuth(_0x2b9728){return util[_0xe184('0xd')]('Basic\x20%s',new Buffer(_0x2b9728['apiKey']+':X')[_0xe184('0x2c')](_0xe184('0x2d')));}function request(_0x3961d1){logger['debug']('[HTTP]',JSON[_0xe184('0x2e')](_0x3961d1));return rp(_[_0xe184('0x2f')](_0x3961d1,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x6f43f8,_0x3c58f7){var _0x36104c=[];if(_0x6f43f8&&_0x6f43f8[_0xe184('0x30')]>0x0){_0x36104c=_[_0xe184('0x31')](_0x6f43f8,_0x3c58f7);}return _0x36104c;}function getCustomFields(_0x27ca8c,_0x414bfe){var _0x4f33d8=[];var _0x5c9981={'custom_fields':[]};if(_0x27ca8c[_0xe184('0x30')]>0x0){_[_0xe184('0x32')](_0x27ca8c,function(_0x371aef){if(_[_0xe184('0x33')]([_0xe184('0x34'),_0xe184('0x35')],_0x371aef[_0xe184('0x36')])&&_0x371aef[_0xe184('0x37')]&&!_0x371aef[_0xe184('0x38')]){_0x5c9981[_0x371aef['nameField'][_0xe184('0x39')]()]=_0x371aef[_0xe184('0x3a')]['toString']();}else if(_[_0xe184('0x33')](['string',_0xe184('0x35')],_0x371aef[_0xe184('0x36')])&&_0x371aef[_0xe184('0x3b')]&&_0x371aef['customField']){_0x5c9981['custom_fields'][_0xe184('0x3c')]({'id':_0x371aef[_0xe184('0x3b')],'value':_0x371aef['content'][_0xe184('0x2c')]()});}else if(_0x371aef[_0xe184('0x36')]===_0xe184('0x3d')&&_0x371aef['variableName']&&_0x371aef[_0xe184('0x3b')]&&_0x371aef[_0xe184('0x38')]){_0x414bfe[_0x371aef['variableName']]&&_0x5c9981[_0xe184('0x18')]['push']({'id':_0x371aef[_0xe184('0x3b')],'value':_0x414bfe[_0x371aef[_0xe184('0x3e')]][_0xe184('0x2c')]()});}else if(_0x371aef[_0xe184('0x36')]===_0xe184('0x3f')&&_0x371aef[_0xe184('0x40')]&&_0x371aef['Variable']['name']&&_0x371aef[_0xe184('0x3b')]&&_0x371aef[_0xe184('0x38')]){_0x414bfe[_0x371aef[_0xe184('0x40')][_0xe184('0x16')]['toLowerCase']()]&&_0x5c9981[_0xe184('0x18')][_0xe184('0x3c')]({'id':_0x371aef[_0xe184('0x3b')],'value':_0x414bfe[_0x371aef[_0xe184('0x40')][_0xe184('0x16')][_0xe184('0x39')]()][_0xe184('0x2c')]()});}});}return _0x5c9981;}exports[_0xe184('0x41')]=function(_0x35c19c,_0x22957a,_0x2ac637,_0x6ddb7a,_0x1ddd18,_0x4c0a5f){var _0x13c2dd,_0x442416;_0x4c0a5f[_0xe184('0x1d')]=intUtil[_0xe184('0x42')](_0x4c0a5f['remoteUri']);_0x4c0a5f[_0xe184('0x43')]=intUtil[_0xe184('0x42')](_0x4c0a5f[_0xe184('0x43')]);if(_0x1ddd18&&_0x1ddd18[_0xe184('0x44')]){logger[_0xe184('0xa')](_0xe184('0x45'),_0xe184('0x46'));_0x22957a[_0xe184('0x47')]=util[_0xe184('0xd')](_0xe184('0x48'),_0x4c0a5f[_0xe184('0x43')],_0x22957a['uniqueid'],md5(_0x22957a[_0xe184('0x49')]));}else{_0x22957a[_0xe184('0x47')]='';}headers[_0xe184('0x4a')]=getAuth(_0x4c0a5f);return getUser(_0x4c0a5f,_0x6ddb7a[_0xe184('0x4b')])[_0xe184('0x1f')](function(_0x57035e){_0x13c2dd=_0x57035e;logger[_0xe184('0xa')](_0xe184('0x4c'),_0x13c2dd['id']);return getEndUser(_0x4c0a5f,_0x22957a[_0xe184('0xf')],_0x22957a[_0xe184('0x10')]);})[_0xe184('0x1f')](function(_0x251a59){_0x442416=_0x251a59;logger[_0xe184('0xa')](_0xe184('0x4d'),_0x442416['id']);return getTicket(_0x4c0a5f,_0x13c2dd,_0x442416,_0x2ac637,_0x22957a);})[_0xe184('0x1f')](function(_0x3cda72){if(_0x3cda72&&_0x3cda72['id']){logger[_0xe184('0xa')](_0xe184('0x20'));logger[_0xe184('0xa')]('The\x20Ticket\x20ID\x20is:',_0x3cda72['id']);logger[_0xe184('0xa')](_0xe184('0x45'),_0xe184('0x4e'));emit(util[_0xe184('0xd')](_0xe184('0x4f'),_0x6ddb7a[_0xe184('0x16')]),_0xe184('0x50'),{'uri':util[_0xe184('0xd')](_0xe184('0x51'),_0x4c0a5f[_0xe184('0x1d')],_0x3cda72['id'])});}})[_0xe184('0x52')](function(_0x19cce2){logger['error'](_0xe184('0x45'),JSON[_0xe184('0x2e')](_0x19cce2));});};exports[_0xe184('0x53')]=function(_0x333906,_0x33afbe,_0x573f98,_0x4f6770,_0x48d4ba,_0x1ad228,_0x2cf05){var _0x323332,_0x3e0597;_0x1ad228[_0xe184('0x1d')]=intUtil[_0xe184('0x42')](_0x1ad228[_0xe184('0x1d')]);_0x1ad228[_0xe184('0x43')]=intUtil[_0xe184('0x42')](_0x1ad228[_0xe184('0x43')]);if(_0x2cf05&&_0x2cf05['recordingFormat']&&_0x2cf05[_0xe184('0x54')]!==_0xe184('0x55')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x33afbe['recordingURL']=util['format'](_0xe184('0x48'),_0x1ad228[_0xe184('0x43')],_0x33afbe[_0xe184('0x49')],md5(_0x33afbe['uniqueid']));}headers[_0xe184('0x4a')]=getAuth(_0x1ad228);return getUser(_0x1ad228,_0x4f6770[_0xe184('0x4b')])[_0xe184('0x1f')](function(_0x47c649){_0x323332=_0x47c649;logger['info'](_0xe184('0x4c'),_0x323332['id']);return getEndUser(_0x1ad228,_0x33afbe[_0xe184('0x56')],_0x33afbe['destcalleridnum']);})[_0xe184('0x1f')](function(_0x5a2864){_0x3e0597=_0x5a2864;logger[_0xe184('0xa')]('The\x20Enduser\x20ID\x20is:',_0x3e0597['id']);return getTicket(_0x1ad228,_0x323332,_0x3e0597,_0x573f98,_0x33afbe);})[_0xe184('0x1f')](function(_0xc54012){if(_0xc54012&&_0xc54012['id']){logger[_0xe184('0xa')](_0xe184('0x20'));logger[_0xe184('0xa')](_0xe184('0x57'),_0xc54012['id']);logger[_0xe184('0xa')](_0xe184('0x58'),_0xe184('0x4e'));emit(util[_0xe184('0xd')](_0xe184('0x4f'),_0x4f6770[_0xe184('0x16')]),_0xe184('0x50'),{'uri':util[_0xe184('0xd')](_0xe184('0x51'),_0x1ad228[_0xe184('0x1d')],_0xc54012['id'])});}})[_0xe184('0x52')](function(_0x5bb27e){logger['error'](_0xe184('0x58'),JSON['stringify'](_0x5bb27e));});};exports[_0xe184('0x59')]=function(_0x4a754c,_0x154caa,_0x89a614,_0x591e78,_0x5c9bb2,_0x1457dd){var _0x3f59c9,_0x3651b8;_0x1457dd['remoteUri']=intUtil[_0xe184('0x42')](_0x1457dd[_0xe184('0x1d')]);_0x1457dd['serverUrl']=intUtil['stripTrailingSlash'](_0x1457dd['serverUrl']);if(_0x5c9bb2&&_0x5c9bb2[_0xe184('0x44')]){logger['info']('['+_0x154caa['lastevent'][_0xe184('0x5a')]()+']','Recording\x20is\x20enabled!');_0x154caa['recordingURL']=util[_0xe184('0xd')](_0xe184('0x48'),_0x1457dd['serverUrl'],_0x154caa[_0xe184('0x49')],md5(_0x154caa[_0xe184('0x49')]));}else{_0x154caa[_0xe184('0x47')]='';}headers[_0xe184('0x4a')]=getAuth(_0x1457dd);return getUser(_0x1457dd,'')['then'](function(_0xea766a){_0x3f59c9=_0xea766a;logger[_0xe184('0xa')](_0xe184('0x4c'),_0x3f59c9['id']);return getEndUser(_0x1457dd,_0x154caa[_0xe184('0xf')],_0x154caa[_0xe184('0x10')]);})[_0xe184('0x1f')](function(_0x1f7875){_0x3651b8=_0x1f7875;logger['info'](_0xe184('0x4d'),_0x3651b8['id']);return getTicket(_0x1457dd,_0x3f59c9,_0x3651b8,_0x89a614,_0x154caa);})[_0xe184('0x1f')](function(_0x28c026){if(_0x28c026){logger[_0xe184('0xa')](_0xe184('0x20'));logger[_0xe184('0xa')]('The\x20Ticket\x20ID\x20is:',_0x28c026['id']);}})[_0xe184('0x52')](function(_0x2874e1){logger[_0xe184('0x5b')]('['+_0x154caa['lastevent'][_0xe184('0x5a')]()+']',JSON[_0xe184('0x2e')](_0x2874e1));});}; \ 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 819df92..d2cffd9 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 _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 +var _0x36c9=['Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','contact','/api/tasks','getString','Descriptions','ticketId','task','Task\x20created:','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','request-promise','md5','util','bluebird','ioredis','./util','freshsales','redis','localhost','GET','/api/selector/owners','info','Getting\x20admin\x20information','then','length','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','toUpperCase','headers','Getting\x20user\x20list','users','agentEmail','Getting\x20user\x20with\x20email','userEmail','email','userId','User\x20found:','Admin\x20selected','error','message','&f=','&entities=contact','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','Contact\x20found\x20mobile_number:','endUserId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x36c9,0xbe));var _0x936c=function(_0x5ce074,_0x383b63){_0x5ce074=_0x5ce074-0x0;var _0x231c06=_0x36c9[_0x5ce074];return _0x231c06;};'use strict';var _=require('lodash');var rp=require(_0x936c('0x0'));var md5=require(_0x936c('0x1'));var util=require(_0x936c('0x2'));var moment=require('moment');var Promise=require(_0x936c('0x3'));var Redis=require(_0x936c('0x4'));var intUtil=require(_0x936c('0x5'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x936c('0x6'));config['redis']=_['defaults'](config[_0x936c('0x7')],{'host':_0x936c('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x936c('0x7')]));function getAdminId(_0x1d7d62,_0x5efa12,_0x2f45f6,_0x3a45af){return new Promise(function(_0x3450b2,_0x57d513){var _0x240028=![];var _0x2904bc={'method':_0x936c('0x9'),'uri':_0x3a45af+_0x936c('0xa'),'json':!![]};_0x2904bc['headers']=_0x2f45f6;logger[_0x936c('0xb')](_0x936c('0xc'));return rp(_0x2904bc)[_0x936c('0xd')](function(_0x4b1704){if(_0x4b1704){var _0x5ed56c=_0x4b1704['users'];var _0x28b58e=null;for(_0x28b58e=0x0;_0x28b58e<_0x5ed56c[_0x936c('0xe')];_0x28b58e++){if(_0x5ed56c[_0x28b58e]['email']===_0x1d7d62[_0x936c('0xf')]){_0x1d7d62[_0x936c('0x10')]=_0x5ed56c[_0x28b58e]['id'];_0x240028=!![];}}if(_0x240028){logger['info'](_0x936c('0x11'),_0x1d7d62['adminId']);_0x3450b2(_0x1d7d62);}else{_0x57d513({'statusCode':0x194,'message':_0x936c('0x12')});}}else{_0x57d513({'statusCode':0x194,'message':_0x936c('0x12')});}})[_0x936c('0x13')](function(_0x225407){logger['error']('['+[_0x5efa12[_0x936c('0x14')]()]+']',_0x225407['message']);_0x57d513(_0x225407);});});}function getUser(_0x154d10,_0x11e4b8,_0x550a2a){return function(_0x1e5037){return new Promise(function(_0x23a5cb,_0x2e00c7){var _0x40940b={'method':'GET','uri':_0x550a2a+_0x936c('0xa'),'json':!![]};_0x40940b[_0x936c('0x15')]=_0x11e4b8;logger[_0x936c('0xb')](_0x936c('0x16'));return rp(_0x40940b)[_0x936c('0xd')](function(_0x33e59b){if(_0x33e59b){var _0x49077b=_0x33e59b[_0x936c('0x17')];var _0x2cb446=![];var _0x2beb76=null;if(_0x1e5037[_0x936c('0x18')]!==null){logger['info'](_0x936c('0x19'),_0x1e5037[_0x936c('0x18')]);_0x1e5037[_0x936c('0x1a')]=_0x1e5037['agentEmail'];for(_0x2beb76=0x0;_0x2beb76<_0x49077b[_0x936c('0xe')];_0x2beb76++){if(_0x49077b[_0x2beb76][_0x936c('0x1b')]===_0x1e5037[_0x936c('0x18')]){_0x2cb446=!![];_0x1e5037[_0x936c('0x1c')]=_0x49077b[_0x2beb76]['id'];logger[_0x936c('0xb')](_0x936c('0x1d'),_0x1e5037[_0x936c('0x1c')]);}}}if(!_0x2cb446){logger['info'](_0x936c('0x1e'));_0x1e5037[_0x936c('0x1a')]=_0x1e5037[_0x936c('0xf')];_0x1e5037[_0x936c('0x1c')]=_0x1e5037['adminId'];_0x2cb446=!![];}if(_0x2cb446){_0x23a5cb(_0x1e5037);}else{_0x2e00c7({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x2e00c7({'statusCode':0x194,'message':_0x936c('0x12')});}})[_0x936c('0x13')](function(_0x486997){logger[_0x936c('0x1f')]('['+[_0x154d10[_0x936c('0x14')]()]+']',_0x486997[_0x936c('0x20')]);_0x2e00c7(_0x486997);});});};}function searchContact(_0x23249a,_0x2d6bdf,_0x1fe347,_0x35ecca){return new Promise(function(_0x1a7869,_0x1744d7){var _0x23ce9f={'method':'GET','headers':_0x2d6bdf,'uri':_0x23249a+'/api/lookup?q='+_0x35ecca+_0x936c('0x21')+_0x1fe347+_0x936c('0x22'),'json':!![]};rp(_0x23ce9f)[_0x936c('0xd')](function(_0x2a3df9){var _0x1c9ba1=_['find'](_0x2a3df9['contacts'][_0x936c('0x23')],[_0x1fe347,_0x35ecca]);_0x1a7869(_0x1c9ba1);})[_0x936c('0x13')](function(_0x1c904){_0x1744d7(_0x1c904);});});}function getEndUser(_0x40f9a8,_0x10d543,_0x4a9352){return function(_0x14aaf6){return new Promise(function(_0x2279e9,_0x5839a4){logger[_0x936c('0xb')](util[_0x936c('0x24')](_0x936c('0x25'),_0x14aaf6[_0x936c('0x26')]));searchContact(_0x4a9352,_0x10d543,'mobile_number',_0x14aaf6[_0x936c('0x26')])[_0x936c('0xd')](function(_0x2d8310){if(_0x2d8310){_0x14aaf6['endUserId']=_0x2d8310['id'];logger[_0x936c('0xb')](_0x936c('0x27'),_0x14aaf6[_0x936c('0x28')]);return _0x2279e9(_0x14aaf6);}searchContact(_0x4a9352,_0x10d543,'work_number',_0x14aaf6['contactNumber'])[_0x936c('0xd')](function(_0x153f63){if(_0x153f63){_0x14aaf6[_0x936c('0x28')]=_0x153f63['id'];logger[_0x936c('0xb')]('Contact\x20found\x20work_number:',_0x14aaf6[_0x936c('0x28')]);return _0x2279e9(_0x14aaf6);}createEndUser(_0x14aaf6,_0x40f9a8,_0x10d543,_0x4a9352)[_0x936c('0xd')](function(_0x4e1994){logger['info'](_0x936c('0x29'),_0x4e1994['endUserId']);return _0x2279e9(_0x4e1994);});});})['catch'](function(_0x591f85){_0x5839a4(_0x591f85);});});};}function createEndUser(_0x348e86,_0x16bbda,_0x397f2f,_0x279fea){return new Promise(function(_0xc5bc6c,_0x38a8a6){var _0x42f4e9=moment();var _0x21a699={'method':_0x936c('0x2a'),'uri':_0x279fea+_0x936c('0x2b'),'body':{'contact':{'last_name':_0x348e86[_0x936c('0x26')],'work_number':_0x348e86[_0x936c('0x26')],'mobile_number':_0x348e86['contactNumber'],'owner_id':_0x348e86[_0x936c('0x1c')],'created_at':_0x42f4e9[_0x936c('0x24')](_0x936c('0x2c'))}},'json':!![]};_0x21a699[_0x936c('0x15')]=_0x397f2f;logger[_0x936c('0xb')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x21a699)[_0x936c('0xd')](function(_0x32c265){_0x348e86[_0x936c('0x28')]=_0x32c265[_0x936c('0x2d')]['id'];_0xc5bc6c(_0x348e86);})[_0x936c('0x13')](function(_0x224215){logger['error']('['+[_0x16bbda[_0x936c('0x14')]()]+']',_0x224215[_0x936c('0x20')]);_0x38a8a6(_0x224215[_0x936c('0x20')]);});});}function getTicket(_0x411044,_0x4e9033,_0x167306,_0x110dcd,_0x58a8a8){return function(_0x3fce26){logger[_0x936c('0xb')]('Creating\x20new\x20task');return new Promise(function(_0x5bb9ef,_0xbda148){var _0x30cdd4=moment();var _0x3e9496={'method':_0x936c('0x2a'),'uri':_0x167306+_0x936c('0x2e'),'body':{'title':intUtil[_0x936c('0x2f')](_0x110dcd['Subjects'],_0x58a8a8,'\x20'),'description':intUtil['getString'](_0x110dcd[_0x936c('0x30')],_0x58a8a8,'\x0a'),'owner_id':_0x3fce26[_0x936c('0x1c')],'creater_id':_0x3fce26[_0x936c('0x10')],'targetable_id':_0x3fce26['endUserId'],'targetable_type':'Contact','created_at':_0x30cdd4['format'](_0x936c('0x2c')),'due_date':_0x30cdd4['add'](0x1e,'m')[_0x936c('0x24')](_0x936c('0x2c'))},'json':!![]};_0x3e9496[_0x936c('0x15')]=_0x4e9033;return rp(_0x3e9496)[_0x936c('0xd')](function(_0x637896){_0x3fce26[_0x936c('0x31')]=_0x637896[_0x936c('0x32')]['id'];logger['info'](_0x936c('0x33'),_0x3fce26[_0x936c('0x31')]);_0x5bb9ef(_0x3fce26);})[_0x936c('0x13')](function(_0x4516a3){logger[_0x936c('0x1f')]('['+[_0x411044[_0x936c('0x14')]()]+']',_0x4516a3[_0x936c('0x20')]);_0xbda148(_0x4516a3['message']);});});};}function emit(_0x15d3a4,_0x2539cc,_0xae483a){var _0x21300f={'uri':_0x15d3a4+'/contacts/'+_0xae483a};io['to'](util['format'](_0x936c('0x34'),_0x2539cc))[_0x936c('0x35')](_0x936c('0x36'),_0x21300f);}exports['cs']=function(_0x456c18,_0x41fd5d,_0x4dfdde,_0x2ee6ad,_0x23275a,_0xef89c4,_0x5c0fd7,_0x558c41){var _0x4cc1fc={};var _0x386181={'Authorization':_0x936c('0x37')+_0xef89c4[_0x936c('0x38')]};_0xef89c4[_0x936c('0x39')]=intUtil[_0x936c('0x3a')](_0xef89c4[_0x936c('0x39')]);_0xef89c4[_0x936c('0x3b')]=intUtil['stripTrailingSlash'](_0xef89c4[_0x936c('0x3b')]);var _0xd2e9be=_0xef89c4['remoteUri'];_0x4cc1fc[_0x936c('0xf')]=_0xef89c4[_0x936c('0x3c')];_0x4cc1fc[_0x936c('0x26')]=_0x558c41[_0x936c('0x3d')]()===_0x936c('0x3e')?_0x41fd5d[_0x936c('0x3f')]:_0x41fd5d[_0x936c('0x40')];_0x4cc1fc[_0x936c('0x41')]=_0x558c41==='queue'||_0x558c41==='unmanaged'?_0x936c('0x42'):_0x936c('0x3e');if(_0x2ee6ad){_0x4cc1fc[_0x936c('0x18')]=_0x2ee6ad[_0x936c('0x1b')];}var _0xe59b36=util[_0x936c('0x24')](_0x936c('0x43'),_0xef89c4[_0x936c('0x3b')],_0x41fd5d['uniqueid'],md5(_0x41fd5d['uniqueid']));if(_0x23275a&&_0x23275a[_0x936c('0x44')]){logger[_0x936c('0xb')](_0x936c('0x45'),_0x936c('0x46'));_0x41fd5d['recordingURL']=_0xe59b36;}else if(_0x5c0fd7&&_0x5c0fd7['recordingFormat']&&_0x5c0fd7[_0x936c('0x47')]!==_0x936c('0x48')){logger[_0x936c('0xb')](_0x936c('0x49'),_0x936c('0x46'));_0x41fd5d['recordingURL']=_0xe59b36;}else{_0x41fd5d[_0x936c('0x4a')]='';}return getAdminId(_0x4cc1fc,_0x558c41,_0x386181,_0xd2e9be)[_0x936c('0xd')](getUser(_0x558c41,_0x386181,_0xd2e9be))[_0x936c('0xd')](getEndUser(_0x558c41,_0x386181,_0xd2e9be))[_0x936c('0xd')](getTicket(_0x558c41,_0x386181,_0xd2e9be,_0x4dfdde,_0x41fd5d))[_0x936c('0xd')](function(_0x1a0388){logger['info'](util[_0x936c('0x24')](_0x936c('0x4b'),_0x1a0388['ticketId']));if(_0x558c41!=='unmanaged'){logger['info']('['+[_0x558c41[_0x936c('0x14')]()]+']',_0x936c('0x4c'));emit(_0xd2e9be,_0x2ee6ad['name'],_0x1a0388[_0x936c('0x28')]);}})['catch'](function(_0x1f6edf){logger[_0x936c('0x1f')]('['+[_0x558c41[_0x936c('0x14')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util['inspect'](_0x1f6edf,{'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 fbdacb8..368f07d 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 _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 +var _0xfc8a=['../../../../config/logger','error','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./servicenow','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','dynamics365','freshsales','exec','includes','toLowerCase','data1','data2','Configurations','data3','queue','routeId','outbound','EVENT\x20UNKNOWN','desk','vtiger','servicenow','log','unknown\x20integration'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xfc8a,0x15b));var _0xafc8=function(_0x493079,_0x3657e1){_0x493079=_0x493079-0x0;var _0x4ffb5f=_0xfc8a[_0x493079];return _0x4ffb5f;};'use strict';var _=require(_0xafc8('0x0'));var util=require(_0xafc8('0x1'));var zendesk=require(_0xafc8('0x2'));var salesforce=require(_0xafc8('0x3'));var sugarcrm=require(_0xafc8('0x4'));var freshdesk=require(_0xafc8('0x5'));var zoho=require(_0xafc8('0x6'));var desk=require(_0xafc8('0x7'));var vtiger=require('./vtiger');var servicenow=require(_0xafc8('0x8'));var dynamics365=require('./dynamics365');var freshsales=require(_0xafc8('0x9'));var integrations=[_0xafc8('0xa'),_0xafc8('0xb'),_0xafc8('0xc'),_0xafc8('0xd'),_0xafc8('0xe'),'desk','vtiger',_0xafc8('0xf'),_0xafc8('0x10'),'servicenow'];exports[_0xafc8('0x11')]=function(_0x2d8001,_0x1977c2,_0x569025,_0xfecbd6,_0x5661b6,_0x17e625){if(_0x569025){if(_[_0xafc8('0x12')](integrations,_0x2d8001['data1'][_0xafc8('0x13')]())){try{var _0x2d2ba2=null;var _0xc75fdf='';var _0x1b1553=_0x569025[_0x2d8001[_0xafc8('0x14')]['toLowerCase']()];if(_0x1b1553){var _0x3bc7b2=_0x1b1553[_0x2d8001[_0xafc8('0x15')]];if(_0x3bc7b2){var _0x2c1cef=_['find'](_0x3bc7b2[_0xafc8('0x16')],{'id':parseInt(_0x2d8001[_0xafc8('0x17')],0xa)});if(_0x2c1cef){if(_0xfecbd6){if(_0x5661b6&&_0x1977c2[_0xafc8('0x18')]){_0xc75fdf=_0xafc8('0x18');}else if(_0x1977c2[_0xafc8('0x19')]){_0xc75fdf=_0xafc8('0x1a');}else{console['log'](_0xafc8('0x1b'),_0x1977c2);}}else{_0xc75fdf='unmanaged';}switch(_0x2d8001['data1'][_0xafc8('0x13')]()){case _0xafc8('0xa'):zendesk[_0xc75fdf](_0x2d8001,_0x1977c2,_0x2c1cef,_0xfecbd6,_0x5661b6,_0x3bc7b2,_0x17e625);break;case _0xafc8('0xb'):salesforce[_0xc75fdf](_0x2d8001,_0x1977c2,_0x2c1cef,_0xfecbd6,_0x5661b6,_0x3bc7b2,_0x17e625);break;case'sugarcrm':sugarcrm[_0xc75fdf](_0x2d8001,_0x1977c2,_0x2c1cef,_0xfecbd6,_0x5661b6,_0x3bc7b2,_0x17e625);break;case _0xafc8('0xd'):freshdesk[_0xc75fdf](_0x2d8001,_0x1977c2,_0x2c1cef,_0xfecbd6,_0x5661b6,_0x3bc7b2,_0x17e625);break;case _0xafc8('0xe'):zoho[_0xc75fdf](_0x2d8001,_0x1977c2,_0x2c1cef,_0xfecbd6,_0x5661b6,_0x3bc7b2,_0x17e625);break;case _0xafc8('0x1c'):desk[_0xc75fdf](_0x2d8001,_0x1977c2,_0x2c1cef,_0xfecbd6,_0x5661b6,_0x3bc7b2,_0x17e625);break;case _0xafc8('0x1d'):vtiger[_0xc75fdf](_0x2d8001,_0x1977c2,_0x2c1cef,_0xfecbd6,_0x5661b6,_0x3bc7b2,_0x17e625);break;case _0xafc8('0x10'):freshsales['cs'](_0x2d8001,_0x1977c2,_0x2c1cef,_0xfecbd6,_0x5661b6,_0x3bc7b2,_0x17e625,_0xc75fdf);break;case _0xafc8('0x1e'):servicenow['cs'](_0x2d8001,_0x1977c2,_0x2c1cef,_0xfecbd6,_0x5661b6,_0x3bc7b2,_0x17e625,_0xc75fdf);break;case'dynamics365':dynamics365['cs'](_0x2d8001,_0x1977c2,_0x2c1cef,_0xfecbd6,_0x5661b6,_0x3bc7b2,_0x17e625,_0xc75fdf);break;default:console[_0xafc8('0x1f')](_0xafc8('0x20'));}}else{_0x2d2ba2=require(_0xafc8('0x21'))(_0x2d8001[_0xafc8('0x14')][_0xafc8('0x13')]());_0x2d2ba2[_0xafc8('0x22')](_0xafc8('0x23'),util['format'](_0xafc8('0x24'),_0x2d8001['data1'][_0xafc8('0x13')](),_0x2d8001[_0xafc8('0x17')]));}}else{_0x2d2ba2=require(_0xafc8('0x21'))(_0x2d8001['data1']['toLowerCase']());_0x2d2ba2['error'](_0xafc8('0x23'),util['format'](_0xafc8('0x25'),_0x2d8001[_0xafc8('0x14')][_0xafc8('0x13')](),_0x2d8001[_0xafc8('0x15')]));}}else{}}catch(_0x812f8){console[_0xafc8('0x22')](_0x812f8);}}}}; \ 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 39b1fe9..1a387cc 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 _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 +var _0x8104=['jsforce','util','ioredis','./util','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','assign','getString','Subjects','Descriptions','ticketType','Task','utc','IsReminderSet','IsRecurrence','endUserType','lead','WhoId','account','WhatId','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','validateEmail','find','execute','length','Email','Agent\x20%s\x20found.','resolve','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','then','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','Contact','$or','Lead','account_contact_lead','additionalSearchAccount','Account','additionalSearchLead','contact','first','Name','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','No\x20Company','upperFirst','forEach','string','picklist','idField','content','toString','variable','variableName','customVariable','Variable','name','password','securityToken','clientId','login','username','Connection\x20established.','queue','stripTrailingSlash','serverUrl','remoteUri','monitor_format','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','user:%s','trigger:salesforce:display','trigger:browser:url','instanceUrl','error','[QUEUE]','recordingFormat','none','destcalleridname','destcalleridnum','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','%s/%s/e','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','catch','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.','lodash','request-promise','moment','md5'];(function(_0x3dff0d,_0x4d59ff){var _0x352383=function(_0x46e5ef){while(--_0x46e5ef){_0x3dff0d['push'](_0x3dff0d['shift']());}};_0x352383(++_0x4d59ff);}(_0x8104,0x7e));var _0x4810=function(_0xcf6353,_0x26c1df){_0xcf6353=_0xcf6353-0x0;var _0x32f93d=_0x8104[_0xcf6353];return _0x32f93d;};'use strict';var _=require(_0x4810('0x0'));var rp=require(_0x4810('0x1'));var moment=require(_0x4810('0x2'));var BPromise=require('bluebird');var md5=require(_0x4810('0x3'));var jsforce=require(_0x4810('0x4'));var util=require(_0x4810('0x5'));var Redis=require(_0x4810('0x6'));var intUtil=require(_0x4810('0x7'));var config=require('../../../../config/environment');var logger=require(_0x4810('0x8'))('salesforce');config[_0x4810('0x9')]=_[_0x4810('0xa')](config[_0x4810('0x9')],{'host':_0x4810('0xb'),'port':0x18eb});var io=require(_0x4810('0xc'))(new Redis(config[_0x4810('0x9')]));function emit(_0x1702a2,_0x6da20d,_0x57b945){io['to'](_0x1702a2)['emit'](_0x6da20d,_0x57b945);}function getTicket(_0x306128,_0x31e43d,_0x4f722d,_0x466eae,_0x57b43,_0x112f7d,_0x75f85f,_0x1ca2be){var _0x59b004=Object[_0x4810('0xd')]({},{'OwnerId':_0x31e43d['id'],'Subject':intUtil[_0x4810('0xe')](_0x466eae[_0x4810('0xf')],_0x57b43,'\x20'),'Description':intUtil[_0x4810('0xe')](_0x466eae[_0x4810('0x10')],_0x57b43,'\x0a')},getCustomFields(_0x112f7d,_0x57b43));if(_0x4f722d){if(_0x466eae[_0x4810('0x11')]===_0x4810('0x12')){_0x59b004['ActivityDate']=moment[_0x4810('0x13')]();_0x59b004[_0x4810('0x14')]=![];_0x59b004[_0x4810('0x15')]=![];if(_0x4f722d['endUserType']==='contact'||_0x4f722d[_0x4810('0x16')]===_0x4810('0x17')){_0x59b004[_0x4810('0x18')]=_0x4f722d['id'];}else if(_0x4f722d[_0x4810('0x16')]===_0x4810('0x19')){_0x59b004[_0x4810('0x1a')]=_0x4f722d['id'];}}else if(_0x466eae[_0x4810('0x11')]==='Case'){if(_0x4f722d[_0x4810('0x16')]==='contact'){_0x59b004[_0x4810('0x1b')]=_0x4f722d['id'];}else if(_0x4f722d[_0x4810('0x16')]===_0x4810('0x19')){_0x59b004[_0x4810('0x1c')]=_0x4f722d['id'];}else if(_0x4f722d[_0x4810('0x16')]==='lead'&&_0x466eae[_0x4810('0x1d')]){_0x59b004[_0x466eae[_0x4810('0x1d')]]=_0x4f722d['id'];}else{logger[_0x4810('0x1e')](_0x4810('0x1f'));}}}return _0x75f85f[_0x4810('0x20')](_0x466eae[_0x4810('0x11')])[_0x4810('0x21')](_0x59b004);}function getUser(_0xd157a6,_0x2e3b61,_0x377aa4){if(!_['isNil'](_0x2e3b61)&&intUtil[_0x4810('0x22')](_0x2e3b61)){var _0x5458dc={'Email':_0x2e3b61};var _0x3f295e={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x377aa4[_0x4810('0x20')]('User')[_0x4810('0x23')](_0x5458dc,_0x3f295e)[_0x4810('0x24')]()['then'](function(_0x49a8c3){if(_0x49a8c3[_0x4810('0x25')]){var _0x3c0517=_[_0x4810('0x23')](_0x49a8c3,function(_0x4b1f68){return _0x4b1f68[_0x4810('0x26')]===_0x2e3b61;});if(_0x3c0517){logger[_0x4810('0x1e')](_0x4810('0x27'),_0x2e3b61);return BPromise[_0x4810('0x28')]({'id':_0x3c0517['Id'],'name':_0x3c0517['Name']});}}else{logger[_0x4810('0x1e')](_0x4810('0x29'),_0x2e3b61);return _0x377aa4[_0x4810('0x2a')]()['then'](function(_0x457f3e){return BPromise[_0x4810('0x28')]({'id':_0x457f3e[_0x4810('0x2b')],'name':_0x457f3e[_0x4810('0x2c')]});});}});}else{logger[_0x4810('0x1e')](_0x4810('0x29'),_0x2e3b61);return _0x377aa4[_0x4810('0x2a')]()['then'](function(_0x45e267){return BPromise['resolve']({'id':_0x45e267[_0x4810('0x2b')],'name':_0x45e267[_0x4810('0x2c')]});});}}function getEndUser(_0x3770c8,_0x3a70dd,_0x1fc66f,_0x50f5d7,_0x36db93){var _0x4200b8={'$or':{'Phone':_0x50f5d7}};var _0x319b3f={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0x4810('0x2d')](function(){logger[_0x4810('0x1e')](_0x4810('0x2e'),_0x50f5d7,_0x3a70dd[_0x4810('0x2f')]);switch(_0x3a70dd['moduleSearch']){case _0x4810('0x30'):var _0x121b96=_[_0x4810('0x31')](_0x4200b8);if(_0x3a70dd[_0x4810('0x32')]){var _0x17b628={};_0x17b628[_0x3a70dd[_0x4810('0x32')]]=_0x50f5d7;_[_0x4810('0x33')](_0x121b96['$or'],_0x17b628);}return _0x36db93[_0x4810('0x20')](_0x4810('0x34'))[_0x4810('0x23')](_0x121b96,_0x319b3f)[_0x4810('0x24')]()['then'](function(_0xad25d0){if(_0xad25d0&&_0xad25d0[_0x4810('0x25')]){return _0xad25d0;}else{var _0x1d8f5d=_['cloneDeep'](_0x4200b8);if(_0x3a70dd['additionalSearchLead']){var _0x243652={};_0x243652[_0x3a70dd['additionalSearchLead']]=_0x50f5d7;_['merge'](_0x1d8f5d[_0x4810('0x35')],_0x243652);}return _0x36db93[_0x4810('0x20')](_0x4810('0x36'))[_0x4810('0x23')](_0x1d8f5d,_0x319b3f);}});case _0x4810('0x37'):var _0x5f0114=_[_0x4810('0x31')](_0x4200b8);if(_0x3a70dd[_0x4810('0x38')]){var _0x17b628={};_0x17b628[_0x3a70dd[_0x4810('0x38')]]=_0x50f5d7;_['merge'](_0x5f0114[_0x4810('0x35')],_0x17b628);}return _0x36db93['sobject'](_0x4810('0x39'))[_0x4810('0x23')](_0x5f0114,_0x319b3f)[_0x4810('0x24')]()[_0x4810('0x2d')](function(_0x4054fa){if(_0x4054fa&&_0x4054fa[_0x4810('0x25')]){return _0x4054fa;}else{var _0x17d523=_[_0x4810('0x31')](_0x4200b8);if(_0x3a70dd[_0x4810('0x32')]){var _0x503196={};_0x503196[_0x3a70dd[_0x4810('0x32')]]=_0x50f5d7;_[_0x4810('0x33')](_0x17d523[_0x4810('0x35')],_0x503196);}return _0x36db93[_0x4810('0x20')](_0x4810('0x34'))['find'](_0x17d523,_0x319b3f)[_0x4810('0x2d')](function(_0x1d9d9c){if(_0x1d9d9c&&_0x1d9d9c[_0x4810('0x25')]){return _0x1d9d9c;}else{var _0x21bb03=_[_0x4810('0x31')](_0x4200b8);if(_0x3a70dd[_0x4810('0x3a')]){var _0x3c65f5={};_0x3c65f5[_0x3a70dd['additionalSearchLead']]=_0x50f5d7;_['merge'](_0x21bb03['$or'],_0x3c65f5);}return _0x36db93[_0x4810('0x20')](_0x4810('0x36'))[_0x4810('0x23')](_0x21bb03,_0x319b3f);}});}});case _0x4810('0x3b'):var _0x121b96=_[_0x4810('0x31')](_0x4200b8);if(_0x3a70dd['additionalSearchContact']){var _0x17b628={};_0x17b628[_0x3a70dd['additionalSearchContact']]=_0x50f5d7;_[_0x4810('0x33')](_0x121b96[_0x4810('0x35')],_0x17b628);}return _0x36db93[_0x4810('0x20')]('Contact')['find'](_0x121b96,_0x319b3f)[_0x4810('0x24')]();case _0x4810('0x17'):var _0x150b9d=_[_0x4810('0x31')](_0x4200b8);if(_0x3a70dd[_0x4810('0x3a')]){var _0x17b628={};_0x17b628[_0x3a70dd['additionalSearchLead']]=_0x50f5d7;_['merge'](_0x150b9d[_0x4810('0x35')],_0x17b628);}return _0x36db93[_0x4810('0x20')]('Lead')[_0x4810('0x23')](_0x150b9d,_0x319b3f);case'account':var _0x5f0114=_['cloneDeep'](_0x4200b8);if(_0x3a70dd[_0x4810('0x38')]){var _0x17b628={};_0x17b628[_0x3a70dd['additionalSearchAccount']]=_0x50f5d7;_[_0x4810('0x33')](_0x5f0114['$or'],_0x17b628);}return _0x36db93['sobject'](_0x4810('0x39'))[_0x4810('0x23')](_0x5f0114,_0x319b3f);default:return null;}})[_0x4810('0x2d')](function(_0x61af72){if(_0x61af72&&_0x61af72[_0x4810('0x25')]){var _0x3abe9c=_[_0x4810('0x3c')](_0x61af72);if(_0x3abe9c){return BPromise['resolve']({'id':_0x3abe9c['Id'],'name':_0x3abe9c[_0x4810('0x3d')],'phone':_0x3abe9c[_0x4810('0x3e')],'endUserType':_0x3abe9c[_0x4810('0x3f')][_0x4810('0x40')][_0x4810('0x41')]()});}}})[_0x4810('0x2d')](function(_0x280af6){if(_0x280af6){logger[_0x4810('0x1e')](_0x4810('0x42'),_0x280af6[_0x4810('0x16')],_0x50f5d7);return BPromise[_0x4810('0x28')](_0x280af6);}else{logger[_0x4810('0x1e')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x50f5d7);var _0x574dba={'Phone':_0x50f5d7};if(_0x3a70dd[_0x4810('0x43')]){if(_0x3a70dd['moduleCreate']===_0x4810('0x3b')){logger['info'](_0x4810('0x44'),_0x50f5d7,_0x3a70dd[_0x4810('0x43')]);_0x574dba[_0x4810('0x45')]=_0x1fc66f!==_0x4810('0x46')?_0x1fc66f:util[_0x4810('0x47')](_0x4810('0x48'),_0x50f5d7);}else if(_0x3a70dd[_0x4810('0x43')]===_0x4810('0x17')){logger[_0x4810('0x1e')](_0x4810('0x44'),_0x50f5d7,_0x3a70dd[_0x4810('0x43')]);_0x574dba[_0x4810('0x45')]=_0x1fc66f!==_0x4810('0x46')?_0x1fc66f:util[_0x4810('0x47')](_0x4810('0x48'),_0x50f5d7);_0x574dba[_0x4810('0x49')]=_0x4810('0x4a');}else if(_0x3a70dd[_0x4810('0x43')]===_0x4810('0x19')){logger['info'](_0x4810('0x44'),_0x50f5d7,_0x3a70dd['moduleCreate']);_0x574dba['Name']=_0x1fc66f!==''?_0x1fc66f:util[_0x4810('0x47')](_0x4810('0x48'),_0x50f5d7);}else{return null;}}return _0x36db93[_0x4810('0x20')](_[_0x4810('0x4b')](_0x3a70dd[_0x4810('0x43')]))[_0x4810('0x21')](_0x574dba)[_0x4810('0x2d')](function(_0x31ae18){return BPromise[_0x4810('0x28')]({'id':_0x31ae18['id'],'endUserType':_0x3a70dd['moduleCreate']});});}});}function getCustomFields(_0x5ada9f,_0x43a4cb){var _0x44ef75={};if(_0x5ada9f['length']>0x0){_[_0x4810('0x4c')](_0x5ada9f,function(_0x1a3d36){if(_['includes']([_0x4810('0x4d'),_0x4810('0x4e')],_0x1a3d36[_0x4810('0x40')])&&_0x1a3d36[_0x4810('0x4f')]){_0x44ef75[_0x1a3d36[_0x4810('0x4f')]]=_0x1a3d36[_0x4810('0x50')][_0x4810('0x51')]();}else if(_0x1a3d36[_0x4810('0x40')]===_0x4810('0x52')&&_0x1a3d36[_0x4810('0x53')]&&_0x1a3d36[_0x4810('0x4f')]){_0x43a4cb[_0x1a3d36[_0x4810('0x53')]]&&(_0x44ef75[_0x1a3d36[_0x4810('0x4f')]]=_0x43a4cb[_0x1a3d36['variableName']][_0x4810('0x51')]());}else if(_0x1a3d36[_0x4810('0x40')]===_0x4810('0x54')&&_0x1a3d36[_0x4810('0x55')]&&_0x1a3d36['Variable'][_0x4810('0x56')]&&_0x1a3d36[_0x4810('0x4f')]){_0x43a4cb[_0x1a3d36[_0x4810('0x55')][_0x4810('0x56')][_0x4810('0x41')]()]&&(_0x44ef75[_0x1a3d36['idField']]=_0x43a4cb[_0x1a3d36[_0x4810('0x55')][_0x4810('0x56')][_0x4810('0x41')]()][_0x4810('0x51')]());}});}return _0x44ef75;}function getConnection(_0x4d676d){var _0x2e4267=_0x4d676d[_0x4810('0x57')]['concat'](_0x4d676d[_0x4810('0x58')]);var _0x3a8146=new jsforce['Connection']({'oauth2':{'loginUrl':_0x4d676d['remoteUri']||'https://login.salesforce.com','clientId':_0x4d676d[_0x4810('0x59')],'clientSecret':_0x4d676d['clientSecret']}});return _0x3a8146[_0x4810('0x5a')](_0x4d676d[_0x4810('0x5b')],_0x2e4267)['then'](function(){logger['info'](_0x4810('0x5c'));return _0x3a8146;});}exports[_0x4810('0x5d')]=function(_0x39e55d,_0xa0765a,_0x53b4f1,_0x1e7458,_0x293447,_0x414895){var _0xf40329,_0x4ae966,_0x158bd5,_0x152772;_0x414895['serverUrl']=intUtil[_0x4810('0x5e')](_0x414895[_0x4810('0x5f')]);_0x414895[_0x4810('0x60')]=intUtil[_0x4810('0x5e')](_0x414895['remoteUri']);if(_0x293447&&_0x293447[_0x4810('0x61')]){logger['info']('[QUEUE]',_0x4810('0x62'));_0xa0765a[_0x4810('0x63')]=util['format'](_0x4810('0x64'),_0x414895['serverUrl'],_0xa0765a[_0x4810('0x65')],md5(_0xa0765a[_0x4810('0x65')]));}else{_0xa0765a[_0x4810('0x63')]='';}return getConnection(_0x414895)[_0x4810('0x2d')](function(_0x55e9d6){_0x152772=_0x55e9d6;return getUser(_0x414895,_0x1e7458[_0x4810('0x66')],_0x152772);})[_0x4810('0x2d')](function(_0x38c708){_0xf40329=_0x38c708;return getEndUser(_0x414895,_0x53b4f1,_0xa0765a[_0x4810('0x67')],_0xa0765a[_0x4810('0x68')],_0x152772);})[_0x4810('0x2d')](function(_0x26e421){_0x4ae966=_0x26e421;return getTicket(_0x414895,_0xf40329,_0x4ae966,_0x53b4f1,_0xa0765a,_0x53b4f1[_0x4810('0x69')],_0x152772,'queue');})[_0x4810('0x2d')](function(_0x124251){_0x158bd5=_0x124251;logger[_0x4810('0x1e')](_0x4810('0x6a'),_0x158bd5['id']);logger['info'](_0x4810('0x6b'),_0x158bd5['id'],_0x1e7458[_0x4810('0x56')],_0x414895[_0x4810('0x40')]);switch(_0x414895[_0x4810('0x40')]){case _0x4810('0x6c'):emit(util[_0x4810('0x47')](_0x4810('0x6d'),_0x1e7458[_0x4810('0x56')]),_0x4810('0x6e'),{'recordId':_0x158bd5['id']});break;case'newTab':emit(util[_0x4810('0x47')](_0x4810('0x6d'),_0x1e7458[_0x4810('0x56')]),_0x4810('0x6f'),{'uri':util[_0x4810('0x47')]('%s/%s/e',_0x152772[_0x4810('0x70')],_0x158bd5['id'])});break;default:logger[_0x4810('0x71')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})['catch'](function(_0x471577){logger['error'](_0x4810('0x72'),_0x471577);});};exports['outbound']=function(_0x28dc24,_0x38088d,_0x2fc96e,_0x597b38,_0x5eb32d,_0xea6c55,_0x5a1726){var _0x1c9e85,_0x2c9f78,_0x4faa54,_0x219aab;_0xea6c55['serverUrl']=intUtil[_0x4810('0x5e')](_0xea6c55[_0x4810('0x5f')]);_0xea6c55[_0x4810('0x60')]=intUtil[_0x4810('0x5e')](_0xea6c55['remoteUri']);if(_0x5a1726&&_0x5a1726[_0x4810('0x73')]&&_0x5a1726[_0x4810('0x73')]!==_0x4810('0x74')){logger['info']('[OUTBOUND]',_0x4810('0x62'));_0x38088d[_0x4810('0x63')]=util[_0x4810('0x47')](_0x4810('0x64'),_0xea6c55['serverUrl'],_0x38088d[_0x4810('0x65')],md5(_0x38088d[_0x4810('0x65')]));}return getConnection(_0xea6c55)['then'](function(_0xe1854b){_0x219aab=_0xe1854b;return getUser(_0xea6c55,_0x597b38['email'],_0x219aab);})[_0x4810('0x2d')](function(_0xc8f466){_0x1c9e85=_0xc8f466;return getEndUser(_0xea6c55,_0x2fc96e,_0x38088d[_0x4810('0x75')],_0x38088d[_0x4810('0x76')],_0x219aab);})[_0x4810('0x2d')](function(_0x4cf85c){_0x2c9f78=_0x4cf85c;return getTicket(_0xea6c55,_0x1c9e85,_0x2c9f78,_0x2fc96e,_0x38088d,_0x2fc96e[_0x4810('0x69')],_0x219aab,_0x4810('0x77'));})[_0x4810('0x2d')](function(_0x2aec69){_0x4faa54=_0x2aec69;logger[_0x4810('0x1e')](_0x4810('0x78'),_0x4faa54['id']);logger[_0x4810('0x1e')](_0x4810('0x79'),_0x4faa54['id'],_0x597b38[_0x4810('0x56')],_0xea6c55[_0x4810('0x40')]);switch(_0xea6c55[_0x4810('0x40')]){case _0x4810('0x6c'):emit(util[_0x4810('0x47')](_0x4810('0x6d'),_0x597b38[_0x4810('0x56')]),_0x4810('0x6e'),{'recordId':_0x4faa54['id']});break;case'newTab':emit(util['format'](_0x4810('0x6d'),_0x597b38[_0x4810('0x56')]),_0x4810('0x6f'),{'uri':util[_0x4810('0x47')](_0x4810('0x7a'),_0x219aab[_0x4810('0x70')],_0x4faa54['id'])});break;default:logger['error'](_0x4810('0x7b'),_0x4810('0x7c'));}})[_0x4810('0x7d')](function(_0x4a39e6){logger['error'](_0x4810('0x7b'),_0x4a39e6);});};exports[_0x4810('0x7e')]=function(_0xc1f26a,_0x1edbb5,_0x5cb34,_0xf64e5c,_0x26ef18,_0x43755c){var _0x224d08,_0x510be4,_0x1c7a6e,_0x2b3f5d;_0x43755c[_0x4810('0x5f')]=intUtil[_0x4810('0x5e')](_0x43755c[_0x4810('0x5f')]);_0x43755c[_0x4810('0x60')]=intUtil[_0x4810('0x5e')](_0x43755c[_0x4810('0x60')]);if(_0x26ef18&&_0x26ef18[_0x4810('0x61')]){logger[_0x4810('0x1e')]('['+_0x1edbb5[_0x4810('0x7f')][_0x4810('0x80')]()+']',_0x4810('0x62'));_0x1edbb5[_0x4810('0x63')]=util[_0x4810('0x47')](_0x4810('0x64'),_0x43755c['serverUrl'],_0x1edbb5[_0x4810('0x65')],md5(_0x1edbb5['uniqueid']));}else{_0x1edbb5[_0x4810('0x63')]='';}return getConnection(_0x43755c)[_0x4810('0x2d')](function(_0x5c024a){_0x2b3f5d=_0x5c024a;if(!_['isNil'](_0xf64e5c)){return getUser(_0x43755c,_0xf64e5c[_0x4810('0x56')],_0x2b3f5d);}else{return getUser(_0x43755c,null,_0x2b3f5d);}})[_0x4810('0x2d')](function(_0x40b56e){_0x224d08=_0x40b56e;return getEndUser(_0x43755c,_0x5cb34,_0x1edbb5[_0x4810('0x67')],_0x1edbb5['calleridnum'],_0x2b3f5d);})[_0x4810('0x2d')](function(_0x42ff70){_0x510be4=_0x42ff70;return getTicket(_0x43755c,_0x224d08,_0x510be4,_0x5cb34,_0x1edbb5,_0x5cb34[_0x4810('0x69')],_0x2b3f5d);})[_0x4810('0x2d')](function(_0x271075){_0x1c7a6e=_0x271075;logger[_0x4810('0x1e')]('['+_0x1edbb5['lastevent']['toUpperCase']()+_0x4810('0x81'),_0x1c7a6e['id']);logger[_0x4810('0x1e')]('['+_0x1edbb5[_0x4810('0x7f')][_0x4810('0x80')]()+']\x20Integration\x20account\x20type\x20%s.',_0x43755c[_0x4810('0x40')]);})['catch'](function(_0x27059b){logger[_0x4810('0x71')]('['+_0x1edbb5[_0x4810('0x7f')][_0x4810('0x80')]()+']',_0x27059b);});}; \ 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 21f4eda..0c6846a 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 _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 +var _0xa51e=['nameField','customField','toLowerCase','includes','idField','content','variable','variableName','customVariable','Variable','name','outbound','incident','assign','getString','Subjects','Descriptions','Fields','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','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','format','user:%s','trigger:browser:url','username','password','sysparm_limit=1','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','call\x20direction:\x20%s','unmanaged',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','request-promise','ioredis','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','socket.io-emitter','GET','then','result','length','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','message','validateEmail','userEmail','true','userId','adminEmail','],\x20getUser\x20crm','error',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','string','picklist','type'];(function(_0x179775,_0x403b57){var _0x17ee82=function(_0xea75ea){while(--_0xea75ea){_0x179775['push'](_0x179775['shift']());}};_0x17ee82(++_0x403b57);}(_0xa51e,0xa3));var _0xea51=function(_0x1b24eb,_0x39029e){_0x1b24eb=_0x1b24eb-0x0;var _0x157b17=_0xa51e[_0x1b24eb];return _0x157b17;};'use strict';var _=require(_0xea51('0x0'));var Promise=require('bluebird');var rp=require(_0xea51('0x1'));var util=require('util');var md5=require('md5');var Redis=require(_0xea51('0x2'));var intUtil=require('./util');var config=require(_0xea51('0x3'));var logger=require(_0xea51('0x4'))(_0xea51('0x5'));config[_0xea51('0x6')]=_[_0xea51('0x7')](config[_0xea51('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xea51('0x8'))(new Redis(config[_0xea51('0x6')]));function getAdminUser(_0x2090d1,_0x247d84,_0x575e8b,_0x7c61c3,_0x4546dc,_0x3305e8){return new Promise(function(_0x32ca4a,_0x37d411){var _0x3e9e63={'method':_0xea51('0x9'),'uri':_0x7c61c3+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x4546dc+'&'+_0x3305e8,'auth':_0x247d84,'json':!![]};return rp(_0x3e9e63)[_0xea51('0xa')](function(_0x70e547){if(_0x70e547[_0xea51('0xb')][_0xea51('0xc')]>0x0){_0x575e8b[_0xea51('0xd')]=_0x70e547[_0xea51('0xb')][0x0][_0xea51('0xe')];}logger[_0xea51('0xf')]('['+[_0x2090d1[_0xea51('0x10')]()]+_0xea51('0x11'),_0x575e8b);_0x32ca4a(_0x575e8b);})[_0xea51('0x12')](function(_0x1eded3){logger['error']('['+[_0x2090d1[_0xea51('0x10')]()]+']',_0x1eded3['message']);_0x37d411(_0x1eded3[_0xea51('0x13')]);});});}function getUser(_0x104400,_0x679fc2,_0x46dd57,_0x387096,_0x17cc79){return function(_0x4dd6aa){logger[_0xea51('0xf')]('['+[_0x104400[_0xea51('0x10')]()]+'],\x20getUser\x20input\x20crm',_0x4dd6aa);return new Promise(function(_0x310f3c,_0x42b445){if(intUtil[_0xea51('0x14')](_0x4dd6aa[_0xea51('0x15')])){var _0x13b454={'method':_0xea51('0x9'),'uri':_0x46dd57+'sys_user?sysparm_query=email%3D'+_0x4dd6aa[_0xea51('0x15')]+'&'+_0x387096+'&'+_0x17cc79,'auth':_0x679fc2,'json':!![]};logger[_0xea51('0xf')]('['+[_0x104400[_0xea51('0x10')]()]+'],\x20getUser\x20rp\x20obj',_0x13b454);return rp(_0x13b454)[_0xea51('0xa')](function(_0x54a4f7){logger['info']('['+[_0x104400[_0xea51('0x10')]()]+'],\x20getUser\x20entity',_0x54a4f7);if(_0x54a4f7[_0xea51('0xb')][_0xea51('0xc')]>0x0&&String(_0x54a4f7['result'][0x0]['active'])===_0xea51('0x16')){_0x4dd6aa[_0xea51('0x17')]=_0x54a4f7[_0xea51('0xb')][0x0][_0xea51('0xe')];}else{_0x4dd6aa[_0xea51('0x17')]=_0x4dd6aa[_0xea51('0xd')];_0x4dd6aa['userEmail']=_0x4dd6aa[_0xea51('0x18')];}logger[_0xea51('0xf')]('['+[_0x104400[_0xea51('0x10')]()]+_0xea51('0x19'),_0x4dd6aa);_0x310f3c(_0x4dd6aa);})[_0xea51('0x12')](function(_0x2ad6a5){logger[_0xea51('0x1a')]('['+[_0x104400[_0xea51('0x10')]()]+']',_0x2ad6a5['message']);_0x42b445(_0x2ad6a5[_0xea51('0x13')]);});}else{logger[_0xea51('0xf')]('['+[_0x104400[_0xea51('0x10')]()]+_0xea51('0x1b'));_0x4dd6aa['userId']=_0x4dd6aa['adminId'];_0x4dd6aa[_0xea51('0x15')]=_0x4dd6aa['adminEmail'];_0x310f3c(_0x4dd6aa);}});};}function createEndUser(_0x404ef1,_0x34c2a4,_0x2c6e72,_0xcd6df2,_0x30019e){logger['info']('['+[_0x404ef1[_0xea51('0x10')]()]+_0xea51('0x1c'),_0x2c6e72);return new Promise(function(_0x32e850,_0x3e2894){var _0x1123a4={'method':_0xea51('0x1d'),'uri':_0xcd6df2+_0xea51('0x1e')+_0x30019e,'body':{'user_name':_0x2c6e72[_0xea51('0x1f')],'roles':_0xea51('0x20'),'first_name':_0x2c6e72[_0xea51('0x1f')],'active':_0xea51('0x16'),'date_format':_0xea51('0x21'),'phone':_0x2c6e72[_0xea51('0x1f')]},'auth':_0x34c2a4,'json':!![]};return rp(_0x1123a4)[_0xea51('0xa')](function(_0x5473bd){logger[_0xea51('0xf')]('['+[_0x404ef1['toUpperCase']()]+_0xea51('0x22'),_0x5473bd[_0xea51('0xb')]);_0x2c6e72[_0xea51('0x23')]=_0x5473bd['result'][_0xea51('0xe')];_0x32e850(_0x2c6e72);})[_0xea51('0x12')](function(_0x33c6d2){logger[_0xea51('0x1a')]('['+[_0x404ef1[_0xea51('0x10')]()]+']',_0x33c6d2[_0xea51('0x13')]);_0x3e2894(_0x33c6d2[_0xea51('0x13')]);});});}function getEndUser(_0x327a38,_0x4f368f,_0x115670,_0x2d5d0d,_0x3c2bc6){return function(_0x29f16e){logger['info']('['+[_0x327a38[_0xea51('0x10')]()]+_0xea51('0x24'),_0x29f16e);return new Promise(function(_0x1674d5,_0x1526f4){var _0x36a9bf={'method':_0xea51('0x9'),'uri':_0x115670+_0xea51('0x25')+_0x29f16e[_0xea51('0x1f')]+'&'+_0x2d5d0d+'&'+_0x3c2bc6,'auth':_0x4f368f,'json':!![]};return rp(_0x36a9bf)['then'](function(_0x20076a){if(_0x20076a['result'][_0xea51('0xc')]>0x0){_0x29f16e[_0xea51('0x23')]=_0x20076a[_0xea51('0xb')][0x0]['sys_id'];logger[_0xea51('0xf')]('['+[_0x327a38[_0xea51('0x10')]()]+_0xea51('0x26'),_0x29f16e);_0x1674d5(_0x29f16e);}else{return createEndUser(_0x327a38,_0x4f368f,_0x29f16e,_0x115670,_0x2d5d0d)[_0xea51('0xa')](function(_0x5534c6){logger[_0xea51('0xf')]('['+[_0x327a38[_0xea51('0x10')]()]+_0xea51('0x27'),_0x5534c6);_0x1674d5(_0x5534c6);});}})[_0xea51('0x12')](function(_0x443fdb){logger[_0xea51('0x1a')]('['+[_0x327a38[_0xea51('0x10')]()]+']',_0x443fdb['message']);_0x1526f4(_0x443fdb[_0xea51('0x13')]);});});};}function getCustomFields(_0x389a31,_0x3d9248){var _0x408e9d={};if(_0x389a31[_0xea51('0xc')]>0x0){_['forEach'](_0x389a31,function(_0x400b04){if(_['includes']([_0xea51('0x28'),_0xea51('0x29')],_0x400b04[_0xea51('0x2a')])&&_0x400b04[_0xea51('0x2b')]&&!_0x400b04[_0xea51('0x2c')]){_0x408e9d[_0x400b04[_0xea51('0x2b')][_0xea51('0x2d')]()]=_0x400b04['content']['toString']();}else if(_[_0xea51('0x2e')]([_0xea51('0x28'),'picklist'],_0x400b04[_0xea51('0x2a')])&&_0x400b04[_0xea51('0x2f')]&&_0x400b04[_0xea51('0x2c')]){_0x408e9d[_0x400b04[_0xea51('0x2f')][_0xea51('0x2d')]()]=_0x400b04[_0xea51('0x30')]['toString']();}else if(_0x400b04[_0xea51('0x2a')]===_0xea51('0x31')&&_0x400b04[_0xea51('0x32')]&&_0x400b04[_0xea51('0x2f')]&&_0x400b04['customField']){_0x408e9d[_0x400b04['idField'][_0xea51('0x2d')]()]=_0x3d9248[_0x400b04[_0xea51('0x32')]]['toString']();}else if(_0x400b04[_0xea51('0x2a')]===_0xea51('0x33')&&_0x400b04[_0xea51('0x34')]&&_0x400b04['Variable'][_0xea51('0x35')]&&_0x400b04['idField']&&_0x400b04['customField']){_0x408e9d[_0x400b04[_0xea51('0x2f')]['toLowerCase']()]=_0x3d9248[_0x400b04['Variable']['name'][_0xea51('0x2d')]()]['toString']();}});}return _0x408e9d;}function getTicket(_0x9f59b5,_0x1aa5c7,_0x441fed,_0x265537,_0x834f0a,_0x154030){return function(_0x4bd860){logger['info']('['+[_0x9f59b5[_0xea51('0x10')]()]+']\x20getTicket\x20input\x20crm',_0x4bd860);return new Promise(function(_0x4dd29e,_0xd3394f){var _0x2b62c9=_0x9f59b5[_0xea51('0x2d')]()===_0xea51('0x36')?_0x4bd860[_0xea51('0x17')]:_0x4bd860[_0xea51('0x23')];var _0x413eff={'method':_0xea51('0x1d'),'uri':_0x441fed+_0xea51('0x37')+'?'+_0x154030,'body':Object[_0xea51('0x38')]({},{'active':_0xea51('0x16'),'caller_id':_0x2b62c9,'assigned_to':_0x4bd860[_0xea51('0x17')],'short_description':intUtil[_0xea51('0x39')](_0x265537[_0xea51('0x3a')],_0x834f0a,'\x20'),'description':intUtil[_0xea51('0x39')](_0x265537[_0xea51('0x3b')],_0x834f0a,'\x0a')},getCustomFields(_0x265537[_0xea51('0x3c')],_0x834f0a)),'auth':_0x1aa5c7,'json':!![]};return rp(_0x413eff)[_0xea51('0xa')](function(_0x49446f){logger[_0xea51('0xf')]('['+[_0x9f59b5['toUpperCase']()]+']\x20POST\x20incident\x20entity\x20schema',_0x49446f[_0xea51('0xb')]);_0x4bd860[_0xea51('0x3d')]=_0x49446f[_0xea51('0xb')][_0xea51('0xe')];_0x4bd860[_0xea51('0x3e')]=_0x49446f[_0xea51('0xb')][_0xea51('0x3f')];logger[_0xea51('0xf')]('['+[_0x9f59b5[_0xea51('0x10')]()]+_0xea51('0x40'),_0x4bd860);_0x4dd29e(_0x4bd860);})['catch'](function(_0x331fd6){logger[_0xea51('0x1a')]('['+[_0x9f59b5['toUpperCase']()]+']',_0x331fd6['message']);_0xd3394f(_0x331fd6[_0xea51('0x13')]);});});};}function createRemoteTag(_0x31e29d,_0x2926f0,_0x5a61db,_0x1b90b4){return new Promise(function(_0x16b8ec,_0x558cf2){var _0x499f59={'method':_0xea51('0x1d'),'uri':_0x5a61db+'label'+'?'+_0x1b90b4,'body':{'short_description':_0x31e29d,'global':!![],'active':!![],'name':_0x31e29d},'auth':_0x2926f0,'json':!![]};return rp(_0x499f59)[_0xea51('0xa')](function(_0x506924){var _0x4071da=_0x506924['result']['sys_id'];_0x16b8ec(_0x4071da);});});}function getRemoteTag(_0x3969f0,_0x1ece47,_0x5031ef,_0x4852e6,_0x16c92b){return new Promise(function(_0x34f37c,_0x20651d){var _0x2d9e44={'method':_0xea51('0x9'),'uri':_0x5031ef+_0xea51('0x41')+_0xea51('0x42')+_0x3969f0+'&'+_0x4852e6,'auth':_0x1ece47,'json':!![]};return rp(_0x2d9e44)[_0xea51('0xa')](function(_0x23e324){if(_0x23e324[_0xea51('0xb')][_0xea51('0xc')]>0x0){var _0x25e01f=_0x23e324[_0xea51('0xb')][0x0]['sys_id'];_0x34f37c(_0x25e01f);}else{return createRemoteTag(_0x3969f0,_0x1ece47,_0x5031ef,_0x4852e6)[_0xea51('0xa')](function(_0x452ade){_0x34f37c(_0x452ade);});}});});}function assignTagToIncident(_0x2e2d6f,_0x94e109,_0x14092f,_0x3ea791,_0x5ae5c4){return new Promise(function(_0x468bad,_0x431766){var _0x294931={'method':_0xea51('0x1d'),'uri':_0x14092f+_0xea51('0x43')+'?'+_0x5ae5c4,'body':{'label':_0x2e2d6f,'table':_0xea51('0x37'),'id_type':'Incident','table_key':_0x3ea791[_0xea51('0x3d')],'title':_0xea51('0x44')+_0x3ea791[_0xea51('0x3e')],'id_display':_0x3ea791[_0xea51('0x3e')]},'auth':_0x94e109,'json':!![]};return rp(_0x294931)[_0xea51('0xa')](function(_0x35c6cb){_0x468bad();})[_0xea51('0x12')](function(){_0x468bad();});});}function manageTags(_0x26c604,_0x44ea25,_0x2066a3,_0x570edf,_0x32d4b4,_0x57ba31,_0x2d0aeb){return new Promise(function(_0x2555bb,_0x44aa49){var _0x3f2caa=[];_0x44ea25[_0xea51('0x45')](function(_0x279b77){_0x3f2caa[_0xea51('0x46')](getRemoteTag(_0x279b77,_0x2066a3,_0x570edf,_0x57ba31,_0x2d0aeb));});return Promise[_0xea51('0x47')](_0x3f2caa)['then'](function(_0x70f31){if(_0x70f31[_0xea51('0xc')]){logger[_0xea51('0xf')]('['+[_0x26c604['toUpperCase']()]+_0xea51('0x48'),_0x70f31);var _0x5058f9=[];_0x70f31[_0xea51('0x45')](function(_0x2f1c21){_0x5058f9[_0xea51('0x46')](assignTagToIncident(_0x2f1c21,_0x2066a3,_0x570edf,_0x32d4b4,_0x57ba31));});return Promise[_0xea51('0x47')](_0x5058f9)[_0xea51('0xa')](function(){_0x2555bb();})[_0xea51('0x12')](function(){_0x2555bb();});}else{_0x2555bb();}});});}function getTags(_0x5c0d32,_0x5ea347,_0x5ba783,_0x4d9394,_0x594f2c,_0x2d5dbc){return function(_0x37159e){return new Promise(function(_0x182601,_0x3aea55){var _0x11846d=[];var _0x1308f=_0x4d9394[_0xea51('0x49')];if(_0x1308f&&_0x1308f[_0xea51('0xc')]>0x0){_0x11846d=_[_0xea51('0x4a')](_0x1308f,'name');}if(_0x11846d[_0xea51('0xc')]>0x0){return manageTags(_0x5c0d32,_0x11846d,_0x5ea347,_0x5ba783,_0x37159e,_0x594f2c,_0x2d5dbc)[_0xea51('0xa')](function(){_0x182601(_0x37159e);});}else{_0x182601(_0x37159e);}});};}function emit(_0x3eefb1,_0x35aa1f,_0x2b335f){var _0x26653c='%26sysparm_record_target%3Dincident'+_0xea51('0x4b')+'%26sysparm_record_list%3Dactive%253Dtrue'+'%255EORDERBYDESCnumber';var _0x45e2df={'uri':_0x3eefb1+_0xea51('0x4c')+_0x2b335f+_0x26653c};io['to'](util[_0xea51('0x4d')](_0xea51('0x4e'),_0x35aa1f))['emit'](_0xea51('0x4f'),_0x45e2df);}exports['cs']=function(_0x3a30e8,_0x457919,_0x4095ae,_0x2ca415,_0x14e58e,_0x5df4bf,_0x4c7a55,_0x56acdb){var _0x16b384={};var _0x58f04c={'user':_0x5df4bf[_0xea51('0x50')],'pass':_0x5df4bf[_0xea51('0x51')]};var _0x23c908=_0xea51('0x52');var _0x5a28b7='sysparm_display_value=true';_0x5df4bf[_0xea51('0x53')]=intUtil[_0xea51('0x54')](_0x5df4bf[_0xea51('0x53')]);_0x5df4bf[_0xea51('0x55')]=intUtil[_0xea51('0x54')](_0x5df4bf[_0xea51('0x55')]);var _0x3e3219=util[_0xea51('0x4d')](_0xea51('0x56'),_0x5df4bf[_0xea51('0x53')]);_0x16b384[_0xea51('0x15')]=!_[_0xea51('0x57')](_0x2ca415)?_0x2ca415[_0xea51('0x58')]:null;_0x16b384[_0xea51('0x18')]=_0x5df4bf[_0xea51('0x58')];_0x16b384[_0xea51('0x1f')]=_0x56acdb[_0xea51('0x2d')]()==='outbound'?_0x457919[_0xea51('0x59')]:_0x457919['calleridnum'];_0x16b384[_0xea51('0x5a')]=_0x56acdb===_0xea51('0x5b')||_0x56acdb==='unmanaged'?_0xea51('0x5b'):_0xea51('0x36');var _0x9f804a=util[_0xea51('0x4d')](_0xea51('0x5c'),_0x5df4bf[_0xea51('0x55')],_0x457919[_0xea51('0x5d')],md5(_0x457919[_0xea51('0x5d')]));if(_0x14e58e&&_0x14e58e['monitor_format']){logger[_0xea51('0xf')](_0xea51('0x5e'),_0xea51('0x5f'));_0x457919['recordingURL']=_0x9f804a;}else if(_0x4c7a55&&_0x4c7a55[_0xea51('0x60')]&&_0x4c7a55[_0xea51('0x60')]!==_0xea51('0x61')){logger[_0xea51('0xf')](_0xea51('0x62'),_0xea51('0x5f'));_0x457919[_0xea51('0x63')]=_0x9f804a;}else{_0x457919[_0xea51('0x63')]='';}return getAdminUser(_0x56acdb,_0x58f04c,_0x16b384,_0x3e3219,_0x5a28b7,_0x23c908)[_0xea51('0xa')](getUser(_0x56acdb,_0x58f04c,_0x3e3219,_0x5a28b7,_0x23c908))['then'](getEndUser(_0x56acdb,_0x58f04c,_0x3e3219,_0x5a28b7,_0x23c908))[_0xea51('0xa')](getTicket(_0x56acdb,_0x58f04c,_0x3e3219,_0x4095ae,_0x457919,_0x5a28b7))['then'](function(_0x493dce){logger['info'](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x493dce[_0xea51('0x3d')]));logger['info'](util['format'](_0xea51('0x64'),_0x56acdb));if(_0x56acdb!==_0xea51('0x65')){logger['info']('['+[_0x56acdb[_0xea51('0x10')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x5df4bf['remoteUri'],_0x2ca415['name'],_0x493dce[_0xea51('0x3d')]);}})[_0xea51('0x12')](function(_0x448c1f){logger[_0xea51('0x1a')]('['+[_0x56acdb[_0xea51('0x10')]()]+_0xea51('0x66'),util['inspect'](_0x448c1f,{'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 04e9a7d..b8574f4 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 _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 +var _0x94de=['unmanaged','lastevent','toUpperCase','calleridname','Fields','The\x20Ticket\x20ID\x20is:','error','request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','created_by','description','date_start','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','length','forEach','variableName','push','idField','set_entry','JSON','stringify','Calls','format','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','user_name','then','find','Agent\x20found!','resolve','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','value','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','entry_list','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','map','type','string','nameField','customField','toLowerCase','content','custom_fields','customVariable','Variable','login','username','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Inbound','Ticket\x20created!','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','outbound','none','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound'];(function(_0x13ff3b,_0x1d99c6){var _0x1843cf=function(_0x1462a9){while(--_0x1462a9){_0x13ff3b['push'](_0x13ff3b['shift']());}};_0x1843cf(++_0x1d99c6);}(_0x94de,0x1ef));var _0xe94d=function(_0x37d2d8,_0x823af0){_0x37d2d8=_0x37d2d8-0x0;var _0x396dfc=_0x94de[_0x37d2d8];return _0x396dfc;};'use strict';var _=require('lodash');var rp=require(_0xe94d('0x0'));var BPromise=require('bluebird');var md5=require(_0xe94d('0x1'));var util=require(_0xe94d('0x2'));var Redis=require(_0xe94d('0x3'));var intUtil=require('./util');var config=require(_0xe94d('0x4'));var logger=require(_0xe94d('0x5'))(_0xe94d('0x6'));config[_0xe94d('0x7')]=_[_0xe94d('0x8')](config[_0xe94d('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xe94d('0x9'))(new Redis(config[_0xe94d('0x7')]));var def={'method':_0xe94d('0xa'),'json':!![]};function emit(_0x3d6d68,_0x41f376,_0x2e3b3f){io['to'](_0x3d6d68)[_0xe94d('0xb')](_0x41f376,_0x2e3b3f);}function getTicket(_0x48e2c3,_0x153b2c,_0x2ac5d1,_0x4ee600,_0x136a6a,_0x26d68d,_0x27d699,_0x644715){logger[_0xe94d('0xc')](_0xe94d('0xd'));var _0x4aacb0=new Date();var _0x3501b0=[{'name':_0xe94d('0xe'),'value':intUtil[_0xe94d('0xf')](_0x4ee600[_0xe94d('0x10')],_0x136a6a,'\x20')},{'name':'assigned_user_id','value':_0x153b2c['id']},{'name':_0xe94d('0x11'),'value':_0x153b2c['id']},{'name':_0xe94d('0x12'),'value':intUtil[_0xe94d('0xf')](_0x4ee600['Descriptions'],_0x136a6a,'\x0a')},{'name':_0xe94d('0x13'),'value':_0x4aacb0[_0xe94d('0x14')]()[_0xe94d('0x15')](0x0,0x13)[_0xe94d('0x16')]('T','\x20')},{'name':_0xe94d('0x17'),'value':'0'},{'name':_0xe94d('0x18'),'value':'15'},{'name':_0xe94d('0x19'),'value':_0x2ac5d1['id']},{'name':_0xe94d('0x1a'),'value':_0xe94d('0x1b')},{'name':'parent_name','value':_0x2ac5d1[_0xe94d('0xe')]},{'name':'direction','value':_0x644715}];if(_0x26d68d[_0xe94d('0x1c')]){_[_0xe94d('0x1d')](_0x26d68d,function(_0x112ba4){if(_0x136a6a[_0x112ba4[_0xe94d('0x1e')]]){_0x3501b0[_0xe94d('0x1f')]({'name':_0x112ba4[_0xe94d('0x20')],'value':_0x136a6a[_0x112ba4[_0xe94d('0x1e')]]});}});}return request({'form':{'method':_0xe94d('0x21'),'input_type':_0xe94d('0x22'),'response_type':_0xe94d('0x22'),'rest_data':JSON[_0xe94d('0x23')]({'session':_0x27d699['id'],'module_name':_0xe94d('0x24'),'name_value_list':_0x3501b0})}});}function getAuth(_0xa3a87c){return util[_0xe94d('0x25')]('Basic\x20%s',new Buffer(_0xa3a87c['apiKey']+':X')[_0xe94d('0x26')](_0xe94d('0x27')));}function getServerInfo(_0x10c435){return request({'form':{'method':_0xe94d('0x28'),'input_type':_0xe94d('0x22'),'response_type':_0xe94d('0x22'),'rest_data':JSON[_0xe94d('0x23')]({'session':_0x10c435['id']})}});}function getUser(_0x13d322,_0x372fda,_0x4a1130){if(!_[_0xe94d('0x29')](_0x372fda)){logger[_0xe94d('0xc')](_0xe94d('0x2a'),_0x372fda);return request({'form':{'method':_0xe94d('0x2b'),'input_type':_0xe94d('0x22'),'response_type':_0xe94d('0x22'),'rest_data':JSON['stringify']({'session':_0x4a1130['id'],'module_name':_0xe94d('0x2c'),'query':util[_0xe94d('0x25')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x372fda),'order_by':'','offset':'0','select_fields':['id','name',_0xe94d('0x2d')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xe94d('0x2e')](function(_0x4a25b3){if(_0x4a25b3['entry_list'][_0xe94d('0x1c')]){var _0x10f0f1=_[_0xe94d('0x2f')](_0x4a25b3['entry_list'],function(_0x1103fd){return _0x1103fd['name_value_list']['user_name']['value']===_0x372fda;});if(_0x10f0f1){logger['info'](_0xe94d('0x30'));return BPromise[_0xe94d('0x31')]({'id':_0x10f0f1[_0xe94d('0x32')]['id']['value'],'name':_0x10f0f1[_0xe94d('0x32')][_0xe94d('0xe')]['value']});}}logger[_0xe94d('0xc')](_0xe94d('0x33'));return BPromise[_0xe94d('0x31')]({'id':_0x4a1130['name_value_list'][_0xe94d('0x34')]['value'],'name':_0x4a1130[_0xe94d('0x32')]['user_name']['value']});});}else{logger[_0xe94d('0xc')](_0xe94d('0x35'));return BPromise[_0xe94d('0x31')]({'id':_0x4a1130[_0xe94d('0x32')][_0xe94d('0x34')][_0xe94d('0x36')],'name':_0x4a1130['name_value_list'][_0xe94d('0x2d')][_0xe94d('0x36')]});}}function getEndUser(_0x470f05,_0x362b69,_0x26f6b,_0xd3db64){logger[_0xe94d('0xc')](_0xe94d('0x37'),_0x26f6b);return request({'form':{'method':_0xe94d('0x2b'),'input_type':_0xe94d('0x22'),'response_type':_0xe94d('0x22'),'rest_data':JSON[_0xe94d('0x23')]({'session':_0xd3db64['id'],'module_name':_0xe94d('0x1b'),'query':util[_0xe94d('0x25')](_0xe94d('0x38'),_0x26f6b),'order_by':'','offset':'0','select_fields':['id',_0xe94d('0xe'),_0xe94d('0x39')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xe94d('0x2e')](function(_0x435b06){if(_0x435b06[_0xe94d('0x3a')][_0xe94d('0x1c')]){var _0x1e6d44=_[_0xe94d('0x2f')](_0x435b06[_0xe94d('0x3a')],function(_0x24c4fb){return _0x24c4fb['name_value_list'][_0xe94d('0x39')][_0xe94d('0x36')]===_0x26f6b;});if(_0x1e6d44){logger[_0xe94d('0xc')](_0xe94d('0x3b'));return BPromise[_0xe94d('0x31')]({'id':_0x1e6d44[_0xe94d('0x32')]['id'][_0xe94d('0x36')],'name':_0x1e6d44[_0xe94d('0x32')][_0xe94d('0xe')][_0xe94d('0x36')],'phone':_0x1e6d44[_0xe94d('0x32')][_0xe94d('0x39')]['value']});}}else{logger['info'](_0xe94d('0x3c'));return request({'form':{'method':_0xe94d('0x21'),'input_type':'JSON','response_type':_0xe94d('0x22'),'rest_data':JSON[_0xe94d('0x23')]({'session':_0xd3db64['id'],'module_name':_0xe94d('0x1b'),'name_value_list':[{'name':_0xe94d('0x3d'),'value':_0x362b69!==_0xe94d('0x3e')?_0x362b69:util['format'](_0xe94d('0x3f'),_0x26f6b)},{'name':'phone_home','value':_0x26f6b}]})}})['then'](function(_0x1abda3){logger['info'](_0xe94d('0x40'));return BPromise[_0xe94d('0x31')]({'id':_0x1abda3['id'],'name':_0x1abda3[_0xe94d('0x3a')][_0xe94d('0x3d')][_0xe94d('0x36')],'phone':_0x1abda3[_0xe94d('0x3a')][_0xe94d('0x39')]['value']});});}});}function request(_0x4b3f45){logger[_0xe94d('0x41')](_0xe94d('0x42'),JSON[_0xe94d('0x23')](_0x4b3f45));return rp(_[_0xe94d('0x43')](def,_0x4b3f45));}function getTags(_0x4eab93,_0x36c7ad){var _0x1807fa=[];if(_0x4eab93&&_0x4eab93[_0xe94d('0x1c')]>0x0){_0x1807fa=_[_0xe94d('0x44')](_0x4eab93,_0x36c7ad);}return _0x1807fa;}function getCustomFields(_0x12148d,_0xf598e){var _0x5eccce=[];var _0x577795={'custom_fields':[]};if(_0x12148d[_0xe94d('0x1c')]>0x0){_['forEach'](_0x12148d,function(_0x3f403e){if(_0x3f403e[_0xe94d('0x45')]===_0xe94d('0x46')&&_0x3f403e[_0xe94d('0x47')]&&!_0x3f403e[_0xe94d('0x48')]){_0x577795[_0x3f403e['nameField'][_0xe94d('0x49')]()]=_0x3f403e[_0xe94d('0x4a')][_0xe94d('0x26')]();}else if(_0x3f403e[_0xe94d('0x45')]===_0xe94d('0x46')&&_0x3f403e[_0xe94d('0x20')]&&_0x3f403e[_0xe94d('0x48')]){_0x577795['custom_fields']['push']({'id':_0x3f403e['idField'],'value':_0x3f403e['content'][_0xe94d('0x26')]()});}else if(_0x3f403e[_0xe94d('0x45')]==='variable'&&_0x3f403e[_0xe94d('0x1e')]&&_0x3f403e[_0xe94d('0x20')]&&_0x3f403e['customField']){_0xf598e[_0x3f403e[_0xe94d('0x1e')]]&&_0x577795[_0xe94d('0x4b')][_0xe94d('0x1f')]({'id':_0x3f403e['idField'],'value':_0xf598e[_0x3f403e['variableName']][_0xe94d('0x26')]()});}else if(_0x3f403e[_0xe94d('0x45')]===_0xe94d('0x4c')&&_0x3f403e[_0xe94d('0x4d')]&&_0x3f403e[_0xe94d('0x4d')][_0xe94d('0xe')]&&_0x3f403e['idField']&&_0x3f403e['customField']){_0xf598e[_0x3f403e[_0xe94d('0x4d')]['name']['toLowerCase']()]&&_0x577795[_0xe94d('0x4b')][_0xe94d('0x1f')]({'id':_0x3f403e[_0xe94d('0x20')],'value':_0xf598e[_0x3f403e[_0xe94d('0x4d')]['name'][_0xe94d('0x49')]()]['toString']()});}});}return _0x577795;}function getConnection(_0x5ea037){return request({'method':_0xe94d('0xa'),'form':{'method':_0xe94d('0x4e'),'input_type':_0xe94d('0x22'),'response_type':_0xe94d('0x22'),'rest_data':JSON[_0xe94d('0x23')]({'user_auth':{'user_name':_0x5ea037[_0xe94d('0x4f')],'password':_0x5ea037['password'],'encryption':'PLAIN'},'application':_0xe94d('0x50')})}})['then'](function(_0x3e432c){var _0x474ff4=_0x3e432c;if(_0x474ff4['id']){def[_0xe94d('0x51')]=_0x474ff4['id'];return BPromise[_0xe94d('0x31')](_0x474ff4);}else{throw new Error(util[_0xe94d('0x25')](_0xe94d('0x52'),_0x5ea037['id']));}});}function setRelationship(_0x152c14,_0x1b9dfe,_0x619570,_0x5e3b83){return request({'form':{'method':_0xe94d('0x53'),'input_type':_0xe94d('0x22'),'response_type':_0xe94d('0x22'),'rest_data':JSON[_0xe94d('0x23')]({'session':_0x152c14['id'],'module_name':_0xe94d('0x24'),'module_id':_0x619570['id'],'link_field_name':_0x5e3b83,'related_ids':[_0x1b9dfe['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xe94d('0x54')]=function(_0x528905,_0x209609,_0x5590cf,_0x428399,_0x49b940,_0xd75e8){var _0x1d752a,_0xc3daff,_0x586449,_0x83fa42;_0xd75e8[_0xe94d('0x55')]=intUtil[_0xe94d('0x56')](_0xd75e8[_0xe94d('0x55')]);_0xd75e8[_0xe94d('0x57')]=intUtil[_0xe94d('0x56')](_0xd75e8['serverUrl']);def[_0xe94d('0x58')]=util[_0xe94d('0x25')](_0xe94d('0x59'),_0xd75e8[_0xe94d('0x55')]);if(_0x49b940&&_0x49b940['monitor_format']){logger['info'](_0xe94d('0x5a'),_0xe94d('0x5b'));_0x209609['recordingURL']=util[_0xe94d('0x25')](_0xe94d('0x5c'),_0xd75e8[_0xe94d('0x57')],_0x209609[_0xe94d('0x5d')],md5(_0x209609['uniqueid']));}else{_0x209609[_0xe94d('0x5e')]='';}return getConnection(_0xd75e8)[_0xe94d('0x2e')](function(_0x97bb48){_0x83fa42=_0x97bb48;return getUser(_0xd75e8,_0x428399[_0xe94d('0xe')],_0x83fa42);})[_0xe94d('0x2e')](function(_0x52074f){_0x1d752a=_0x52074f;logger[_0xe94d('0xc')](_0xe94d('0x5f'),_0x1d752a['id']);return getEndUser(_0xd75e8,_0x209609['calleridname'],_0x209609['calleridnum'],_0x83fa42);})['then'](function(_0x1abceb){_0xc3daff=_0x1abceb;logger['info'](_0xe94d('0x60'),_0xc3daff['id']);return getTicket(_0xd75e8,_0x1d752a,_0xc3daff,_0x5590cf,_0x209609,_0x5590cf['Fields'],_0x83fa42,_0xe94d('0x61'));})[_0xe94d('0x2e')](function(_0x286c4a){_0x586449=_0x286c4a;logger[_0xe94d('0xc')](_0xe94d('0x62'));logger[_0xe94d('0xc')]('The\x20Ticket\x20ID\x20is:',_0x586449['id']);return setRelationship(_0x83fa42,_0x1d752a,_0x586449,_0xe94d('0x63'));})[_0xe94d('0x2e')](function(){return setRelationship(_0x83fa42,_0xc3daff,_0x586449,_0xe94d('0x64'));})['then'](function(){return getServerInfo(_0x83fa42);})['then'](function(_0x536fd1){var _0x5d4b74=parseInt(_0x536fd1[_0xe94d('0x65')][_0xe94d('0x66')](0x0));var _0x55f0dd=util[_0xe94d('0x25')](_0xe94d('0x67'),_0xd75e8[_0xe94d('0x55')],_0x586449['id']);if(_0x5d4b74>0x6){_0x55f0dd=util[_0xe94d('0x25')](_0xe94d('0x68'),_0xd75e8['remoteUri'],_0x586449['id']);}logger['info'](_0xe94d('0x5a'),_0xe94d('0x69'));emit(util[_0xe94d('0x25')](_0xe94d('0x6a'),_0x428399['name']),_0xe94d('0x6b'),{'uri':_0x55f0dd});})[_0xe94d('0x6c')](function(_0x5bcd0d){logger['error'](_0xe94d('0x5a'),JSON[_0xe94d('0x23')](_0x5bcd0d));});};exports[_0xe94d('0x6d')]=function(_0x322f4e,_0x1536a2,_0xad45e3,_0x496fea,_0x26f44c,_0x31cf10,_0xa2465f){var _0x199eb5,_0x1a46a2,_0x23e220,_0x6bee48;_0x31cf10[_0xe94d('0x55')]=intUtil[_0xe94d('0x56')](_0x31cf10['remoteUri']);_0x31cf10[_0xe94d('0x57')]=intUtil['stripTrailingSlash'](_0x31cf10[_0xe94d('0x57')]);def[_0xe94d('0x58')]=util['format']('%s/service/v4_1/rest.php',_0x31cf10[_0xe94d('0x55')]);if(_0xa2465f&&_0xa2465f['recordingFormat']&&_0xa2465f['recordingFormat']!==_0xe94d('0x6e')){logger[_0xe94d('0xc')](_0xe94d('0x6f'),'Recording\x20is\x20enabled!');_0x1536a2['recordingURL']=util[_0xe94d('0x25')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x31cf10['serverUrl'],_0x1536a2[_0xe94d('0x5d')],md5(_0x1536a2['uniqueid']));}return getConnection(_0x31cf10)[_0xe94d('0x2e')](function(_0x50769e){_0x6bee48=_0x50769e;return getUser(_0x31cf10,_0x496fea[_0xe94d('0xe')],_0x6bee48);})[_0xe94d('0x2e')](function(_0xf2c5f0){_0x199eb5=_0xf2c5f0;logger[_0xe94d('0xc')](_0xe94d('0x5f'),_0x199eb5['id']);return getEndUser(_0x31cf10,_0x1536a2[_0xe94d('0x70')],_0x1536a2[_0xe94d('0x71')],_0x6bee48);})[_0xe94d('0x2e')](function(_0x4351f2){_0x1a46a2=_0x4351f2;logger['info'](_0xe94d('0x60'),_0x1a46a2['id']);return getTicket(_0x31cf10,_0x199eb5,_0x1a46a2,_0xad45e3,_0x1536a2,_0xad45e3['Fields'],_0x6bee48,_0xe94d('0x72'));})['then'](function(_0x142f6b){_0x23e220=_0x142f6b;logger[_0xe94d('0xc')](_0xe94d('0x62'));logger[_0xe94d('0xc')]('The\x20Ticket\x20ID\x20is:',_0x23e220['id']);return setRelationship(_0x6bee48,_0x199eb5,_0x23e220,'users');})[_0xe94d('0x2e')](function(){return setRelationship(_0x6bee48,_0x1a46a2,_0x23e220,'contacts');})[_0xe94d('0x2e')](function(){return getServerInfo(_0x6bee48);})['then'](function(_0x5f31a2){var _0x4b3d6c=parseInt(_0x5f31a2[_0xe94d('0x65')]['charAt'](0x0));var _0x3c64bc=util[_0xe94d('0x25')](_0xe94d('0x67'),_0x31cf10[_0xe94d('0x55')],_0x23e220['id']);if(_0x4b3d6c>0x6){_0x3c64bc=util[_0xe94d('0x25')](_0xe94d('0x68'),_0x31cf10[_0xe94d('0x55')],_0x23e220['id']);}logger[_0xe94d('0xc')](_0xe94d('0x6f'),_0xe94d('0x69'));emit(util['format'](_0xe94d('0x6a'),_0x496fea[_0xe94d('0xe')]),'trigger:browser:url',{'uri':_0x3c64bc});})[_0xe94d('0x6c')](function(_0xe7b729){logger['error']('[OUTBOUND]',JSON['stringify'](_0xe7b729));});};exports[_0xe94d('0x73')]=function(_0x3019cd,_0x48cc79,_0x1a5370,_0x264089,_0x14f2da,_0x460871){var _0x3b31cd,_0x3ed996,_0x290645,_0x30daf2;_0x460871[_0xe94d('0x55')]=intUtil[_0xe94d('0x56')](_0x460871['remoteUri']);_0x460871[_0xe94d('0x57')]=intUtil[_0xe94d('0x56')](_0x460871[_0xe94d('0x57')]);def['uri']=util[_0xe94d('0x25')](_0xe94d('0x59'),_0x460871[_0xe94d('0x55')]);if(_0x14f2da&&_0x14f2da['monitor_format']){logger['info']('['+_0x48cc79[_0xe94d('0x74')][_0xe94d('0x75')]()+']',_0xe94d('0x5b'));_0x48cc79[_0xe94d('0x5e')]=util[_0xe94d('0x25')](_0xe94d('0x5c'),_0x460871[_0xe94d('0x57')],_0x48cc79['uniqueid'],md5(_0x48cc79['uniqueid']));}else{_0x48cc79['recordingURL']='';}return getConnection(_0x460871)[_0xe94d('0x2e')](function(_0x23d057){_0x30daf2=_0x23d057;if(!_[_0xe94d('0x29')](_0x264089)){return getUser(_0x460871,_0x264089['name'],_0x30daf2);}else{return getUser(_0x460871,null,_0x30daf2);}})[_0xe94d('0x2e')](function(_0x18a4d8){_0x3b31cd=_0x18a4d8;logger[_0xe94d('0xc')]('The\x20User\x20ID\x20is:',_0x3b31cd['id']);return getEndUser(_0x460871,_0x48cc79[_0xe94d('0x76')],_0x48cc79['calleridnum'],_0x30daf2);})['then'](function(_0x3e1c03){_0x3ed996=_0x3e1c03;logger[_0xe94d('0xc')]('The\x20Enduser\x20ID\x20is:',_0x3ed996['id']);return getTicket(_0x460871,_0x3b31cd,_0x3ed996,_0x1a5370,_0x48cc79,_0x1a5370[_0xe94d('0x77')],_0x30daf2,'Inbound');})[_0xe94d('0x2e')](function(_0x5f515a){_0x290645=_0x5f515a;logger[_0xe94d('0xc')](_0xe94d('0x62'));logger['info'](_0xe94d('0x78'),_0x290645['id']);return setRelationship(_0x30daf2,_0x3b31cd,_0x290645,_0xe94d('0x63'));})[_0xe94d('0x2e')](function(){return setRelationship(_0x30daf2,_0x3ed996,_0x290645,'contacts');})[_0xe94d('0x2e')](function(){return getServerInfo(_0x30daf2);})[_0xe94d('0x6c')](function(_0x417558){logger[_0xe94d('0x79')]('['+_0x48cc79['lastevent']['toUpperCase']()+']',JSON['stringify'](_0x417558));});}; \ 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 0e99cda..0c13879 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 _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 +var _0x2e24=['keyContent','format','%s:\x20%s','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','test','getString','length','sortBy','string','push','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','key'];(function(_0x58a4ac,_0x43fd42){var _0x545810=function(_0x308e65){while(--_0x308e65){_0x58a4ac['push'](_0x58a4ac['shift']());}};_0x545810(++_0x43fd42);}(_0x2e24,0x10d));var _0x42e2=function(_0x23081b,_0x538ce2){_0x23081b=_0x23081b-0x0;var _0x475e98=_0x2e24[_0x23081b];return _0x475e98;};'use strict';var _=require('lodash');var util=require('util');exports[_0x42e2('0x0')]=function(_0x135305,_0x16a134,_0x3b8712){var _0x195bb2=[];if(_0x135305[_0x42e2('0x1')]>0x0){var _0xc58b5e=_[_0x42e2('0x2')](_0x135305,['id']);for(var _0x348a90=0x0;_0x348a90<_0xc58b5e[_0x42e2('0x1')];_0x348a90++){var _0x20aba0=_0xc58b5e[_0x348a90];if(_0x20aba0['type']===_0x42e2('0x3')){_0x195bb2[_0x42e2('0x4')](_0x20aba0[_0x42e2('0x5')]);}else if(_0x20aba0[_0x42e2('0x6')]===_0x42e2('0x7')&&_0x20aba0[_0x42e2('0x8')]){_0x16a134[_0x20aba0[_0x42e2('0x8')]]&&_0x195bb2['push'](_0x16a134[_0x20aba0[_0x42e2('0x8')]][_0x42e2('0x9')]());}else if(_0x20aba0[_0x42e2('0x6')]===_0x42e2('0xa')&&_0x20aba0[_0x42e2('0xb')]&&_0x20aba0[_0x42e2('0xb')]['name']){_0x16a134[_0x20aba0[_0x42e2('0xb')][_0x42e2('0xc')]['toLowerCase']()]&&_0x195bb2[_0x42e2('0x4')](_0x16a134[_0x20aba0[_0x42e2('0xb')]['name'][_0x42e2('0xd')]()][_0x42e2('0x9')]());}else if(_0x20aba0[_0x42e2('0x6')]===_0x42e2('0xe')){if(_0x20aba0[_0x42e2('0xf')]===_0x42e2('0x3')&&_0x20aba0[_0x42e2('0x10')]){_0x195bb2[_0x42e2('0x4')](util['format']('%s:\x20%s',_0x20aba0['key'],_0x20aba0[_0x42e2('0x11')]));}else if(_0x20aba0['keyType']==='variable'&&_0x20aba0[_0x42e2('0x8')]&&_0x20aba0[_0x42e2('0x10')]){_0x16a134[_0x20aba0[_0x42e2('0x8')]]&&_0x195bb2[_0x42e2('0x4')](util[_0x42e2('0x12')]('%s:\x20%s',_0x20aba0[_0x42e2('0x10')],_0x16a134[_0x20aba0[_0x42e2('0x8')]]));}else if(_0x20aba0['keyType']===_0x42e2('0xa')&&_0x20aba0[_0x42e2('0xb')]&&_0x20aba0[_0x42e2('0xb')]['name']&&_0x20aba0['key']){_0x16a134[_0x20aba0[_0x42e2('0xb')][_0x42e2('0xc')][_0x42e2('0xd')]()]&&_0x195bb2[_0x42e2('0x4')](util[_0x42e2('0x12')](_0x42e2('0x13'),_0x20aba0['key'],_0x16a134[_0x20aba0[_0x42e2('0xb')][_0x42e2('0xc')][_0x42e2('0xd')]()]));}}}}return _0x195bb2['join'](_0x3b8712);};exports[_0x42e2('0x14')]=function(_0x3b6e4d){var _0x52ec7b=_0x3b6e4d[_0x42e2('0x15')](-0x1);if(_0x52ec7b==='/'){_0x3b6e4d=_0x3b6e4d[_0x42e2('0x16')](0x0,_0x3b6e4d[_0x42e2('0x17')](_0x52ec7b));}return _0x3b6e4d;};exports[_0x42e2('0x18')]=function(_0x47688d){if(!_['isNil'](_0x47688d)&&_0x47688d!==''){var _0x27cfb2=/^(([^<>()\[\]\\.,;:\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 _0x27cfb2[_0x42e2('0x19')](String(_0x47688d)[_0x42e2('0xd')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 46b75d5..e707b9f 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 _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 +var _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0x3ea913,_0x255df2){var _0x2b4f28=function(_0x48bb25){while(--_0x48bb25){_0x3ea913['push'](_0x3ea913['shift']());}};_0x2b4f28(++_0x255df2);}(_0xe706,0xa3));var _0x6e70=function(_0x2b7675,_0x5969c9){_0x2b7675=_0x2b7675-0x0;var _0x4c4f97=_0xe706[_0x2b7675];return _0x4c4f97;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 6169b49..172f4f3 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 _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 +var _0x1d2e=['Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','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','POST','Caller\x20-\x20%s','authType','password','username','token','Basic\x20%s','base64','debug','[HTTP]','GET','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','toString','push','idField','variableName','custom_fields','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','%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','Zendesk\x20account\x20type\x20not\x20recognized','catch','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','recordingFormat','none','Recording\x20is\x20enabled!','uniqueid','Authorization','destcalleridname','destcalleridnum','[OUTBOUND]','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','\x20Error\x20running\x20Zendesk\x20integration','request-promise','md5','util','ioredis','./util','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','Tags','name','getString','Descriptions','Fields','then','validateEmail','Getting\x20agent\x20with\x20email','Agent\x20found!','find','results','agent','Admin\x20account\x20selected.'];(function(_0xd5709b,_0x101823){var _0x3dc484=function(_0x28a409){while(--_0x28a409){_0xd5709b['push'](_0xd5709b['shift']());}};_0x3dc484(++_0x101823);}(_0x1d2e,0x192));var _0xe1d2=function(_0x1da1b0,_0x4f76ec){_0x1da1b0=_0x1da1b0-0x0;var _0x4ffdee=_0x1d2e[_0x1da1b0];return _0x4ffdee;};'use strict';var _=require('lodash');var rp=require(_0xe1d2('0x0'));var md5=require(_0xe1d2('0x1'));var util=require(_0xe1d2('0x2'));var Redis=require(_0xe1d2('0x3'));var intUtil=require(_0xe1d2('0x4'));var config=require(_0xe1d2('0x5'));var logger=require('../../../../config/logger')('zendesk');config[_0xe1d2('0x6')]=_[_0xe1d2('0x7')](config[_0xe1d2('0x6')],{'host':_0xe1d2('0x8'),'port':0x18eb});var io=require(_0xe1d2('0x9'))(new Redis(config['redis']));function emit(_0x18d040,_0x2afb9b,_0x443b5e){io['to'](_0x18d040)[_0xe1d2('0xa')](_0x2afb9b,_0x443b5e);}var headers={'Content-Type':'application/json','Accept':_0xe1d2('0xb')};function getTicket(_0x794517,_0x5f1db3,_0x1d753a,_0x25a74e,_0x5c19aa){logger[_0xe1d2('0xc')](_0xe1d2('0xd'));return request({'uri':util[_0xe1d2('0xe')](_0xe1d2('0xf'),_0x794517[_0xe1d2('0x10')]),'method':'POST','body':{'ticket':_['merge']({'requester_id':_0x1d753a['id'],'submitter_id':_0x5f1db3?_0x5f1db3['id']:undefined,'assignee_id':_0x5f1db3?_0x5f1db3['id']:undefined,'tags':getTags(_0x25a74e[_0xe1d2('0x11')],_0xe1d2('0x12')),'subject':intUtil[_0xe1d2('0x13')](_0x25a74e['Subjects'],_0x5c19aa,'\x20'),'description':intUtil['getString'](_0x25a74e[_0xe1d2('0x14')],_0x5c19aa,'\x0a'),'comment':{'public':![],'body':intUtil[_0xe1d2('0x13')](_0x25a74e[_0xe1d2('0x14')],_0x5c19aa,'\x0a')}},getCustomFields(_0x25a74e[_0xe1d2('0x15')],_0x5c19aa))}})[_0xe1d2('0x16')](function(_0x27bc72){logger[_0xe1d2('0xc')]('Ticket\x20created!');return _0x27bc72['ticket'];});}function getUser(_0x48f29a,_0x5bff46){if(intUtil[_0xe1d2('0x17')](_0x5bff46)){logger[_0xe1d2('0xc')](_0xe1d2('0x18'),_0x5bff46);return request({'uri':util[_0xe1d2('0xe')]('%s/search.json',_0x48f29a[_0xe1d2('0x10')]),'qs':{'query':util[_0xe1d2('0xe')]('type:user\x20role:agent\x20email:%s',_0x5bff46)}})[_0xe1d2('0x16')](function(_0x9a6738){if(_0x9a6738['count']){logger['info'](_0xe1d2('0x19'));return _[_0xe1d2('0x1a')](_0x9a6738[_0xe1d2('0x1b')],{'email':_0x5bff46,'role':_0xe1d2('0x1c')});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xe1d2('0xe')]('%s/users/me.json',_0x48f29a[_0xe1d2('0x10')])})[_0xe1d2('0x16')](function(_0xb802e8){logger[_0xe1d2('0xc')](_0xe1d2('0x1d'));return _0xb802e8['user'];});}});}else{logger['info'](_0xe1d2('0x1e'));return request({'uri':util[_0xe1d2('0xe')](_0xe1d2('0x1f'),_0x48f29a[_0xe1d2('0x10')])})[_0xe1d2('0x16')](function(_0x294314){logger[_0xe1d2('0xc')](_0xe1d2('0x1d'));return _0x294314[_0xe1d2('0x20')];});}}function getEndUser(_0x55397c,_0x5221f3,_0x41b214){logger['info'](_0xe1d2('0x21'),_0x41b214);return request({'uri':util[_0xe1d2('0xe')](_0xe1d2('0x22'),_0x55397c['remoteUri']),'qs':{'query':util['format'](_0xe1d2('0x23'),_0x41b214)}})[_0xe1d2('0x16')](function(_0x3819d9){var _0x2d0c8a;if(_0x3819d9['results'][_0xe1d2('0x24')]){_0x3819d9['results']=_[_0xe1d2('0x25')](_0x3819d9[_0xe1d2('0x1b')],{'suspended':![],'role':_0xe1d2('0x26')});if(_0x3819d9['results'][_0xe1d2('0x24')]){_0x2d0c8a=_[_0xe1d2('0x27')](_0x3819d9[_0xe1d2('0x1b')]);}}if(_0x2d0c8a){logger[_0xe1d2('0xc')](_0xe1d2('0x28'));return _0x2d0c8a;}else{logger[_0xe1d2('0xc')](_0xe1d2('0x29'));return request({'uri':util[_0xe1d2('0xe')](_0xe1d2('0x2a'),_0x55397c[_0xe1d2('0x10')]),'method':_0xe1d2('0x2b'),'body':{'user':{'role':_0xe1d2('0x26'),'name':util[_0xe1d2('0xe')](_0xe1d2('0x2c'),_0x5221f3||_0x41b214),'phone':_0x41b214}}})[_0xe1d2('0x16')](function(_0x4ea275){logger[_0xe1d2('0xc')]('Enduser\x20created.');return _0x4ea275[_0xe1d2('0x20')];});}});}function getAuth(_0x39b037){var _0x1725b2;if(_0x39b037[_0xe1d2('0x2d')]===_0xe1d2('0x2e')){_0x1725b2=util[_0xe1d2('0xe')]('%s:%s',_0x39b037[_0xe1d2('0x2f')],_0x39b037[_0xe1d2('0x2e')]);}else if(_0x39b037[_0xe1d2('0x2d')]===_0xe1d2('0x30')){_0x1725b2=util['format']('%s/token:%s',_0x39b037['username'],_0x39b037[_0xe1d2('0x30')]);}return util[_0xe1d2('0xe')](_0xe1d2('0x31'),new Buffer(_0x1725b2)['toString'](_0xe1d2('0x32')));}function request(_0x3d56d4){logger[_0xe1d2('0x33')](_0xe1d2('0x34'),JSON['stringify'](_0x3d56d4));return rp(_[_0xe1d2('0x7')](_0x3d56d4,{'method':_0xe1d2('0x35'),'headers':headers,'json':!![]}));}function getTags(_0x2efae8,_0x926b9){var _0x447f89=[];if(_0x2efae8&&_0x2efae8[_0xe1d2('0x24')]>0x0){_0x447f89=_['map'](_0x2efae8,_0x926b9);}return _0x447f89;}function getCustomFields(_0x381695,_0x4e9125){var _0x29aa3f=[];var _0x3d9cd2={'custom_fields':[]};if(_0x381695[_0xe1d2('0x24')]>0x0){_[_0xe1d2('0x36')](_0x381695,function(_0x2eebc1){if(_[_0xe1d2('0x37')]([_0xe1d2('0x38'),_0xe1d2('0x39')],_0x2eebc1[_0xe1d2('0x3a')])&&_0x2eebc1[_0xe1d2('0x3b')]&&!_0x2eebc1[_0xe1d2('0x3c')]){_0x3d9cd2[_0x2eebc1[_0xe1d2('0x3b')][_0xe1d2('0x3d')]()]=_0x2eebc1[_0xe1d2('0x3e')][_0xe1d2('0x3f')]();}else if(_['includes']([_0xe1d2('0x38'),_0xe1d2('0x39')],_0x2eebc1[_0xe1d2('0x3a')])&&_0x2eebc1['idField']&&_0x2eebc1[_0xe1d2('0x3c')]){_0x3d9cd2['custom_fields'][_0xe1d2('0x40')]({'id':_0x2eebc1[_0xe1d2('0x41')],'value':_0x2eebc1[_0xe1d2('0x3e')][_0xe1d2('0x3f')]()});}else if(_0x2eebc1[_0xe1d2('0x3a')]==='variable'&&_0x2eebc1['variableName']&&_0x2eebc1[_0xe1d2('0x41')]&&_0x2eebc1[_0xe1d2('0x3c')]){_0x4e9125[_0x2eebc1[_0xe1d2('0x42')]]&&_0x3d9cd2[_0xe1d2('0x43')][_0xe1d2('0x40')]({'id':_0x2eebc1[_0xe1d2('0x41')],'value':_0x4e9125[_0x2eebc1[_0xe1d2('0x42')]][_0xe1d2('0x3f')]()});}else if(_0x2eebc1[_0xe1d2('0x3a')]===_0xe1d2('0x44')&&_0x2eebc1[_0xe1d2('0x45')]&&_0x2eebc1[_0xe1d2('0x45')][_0xe1d2('0x12')]&&_0x2eebc1[_0xe1d2('0x41')]&&_0x2eebc1[_0xe1d2('0x3c')]){_0x4e9125[_0x2eebc1[_0xe1d2('0x45')][_0xe1d2('0x12')]['toLowerCase']()]&&_0x3d9cd2[_0xe1d2('0x43')][_0xe1d2('0x40')]({'id':_0x2eebc1[_0xe1d2('0x41')],'value':_0x4e9125[_0x2eebc1[_0xe1d2('0x45')][_0xe1d2('0x12')][_0xe1d2('0x3d')]()][_0xe1d2('0x3f')]()});}});}return _0x3d9cd2;}exports[_0xe1d2('0x46')]=function(_0x237ca8,_0x1635ea,_0x4e61be,_0xfb083,_0x4de94f,_0x56ba3e){var _0x2e4423,_0x16c004;_0x56ba3e[_0xe1d2('0x10')]=intUtil[_0xe1d2('0x47')](_0x56ba3e[_0xe1d2('0x10')]);_0x56ba3e['serverUrl']=intUtil['stripTrailingSlash'](_0x56ba3e[_0xe1d2('0x48')]);if(_0x4de94f&&_0x4de94f[_0xe1d2('0x49')]){logger['info'](_0xe1d2('0x4a'),'Recording\x20is\x20enabled!');_0x1635ea[_0xe1d2('0x4b')]=util['format'](_0xe1d2('0x4c'),_0x56ba3e['serverUrl'],_0x1635ea['uniqueid'],md5(_0x1635ea['uniqueid']));}else{_0x1635ea[_0xe1d2('0x4b')]='';}headers['Authorization']=getAuth(_0x56ba3e);return getUser(_0x56ba3e,_0xfb083[_0xe1d2('0x4d')])[_0xe1d2('0x16')](function(_0x14b0a3){_0x2e4423=_0x14b0a3;logger['info'](_0xe1d2('0x4e'),_0x2e4423['id']);return getEndUser(_0x56ba3e,_0x1635ea[_0xe1d2('0x4f')],_0x1635ea[_0xe1d2('0x50')]);})[_0xe1d2('0x16')](function(_0x337cc2){_0x16c004=_0x337cc2;logger[_0xe1d2('0xc')]('The\x20Enduser\x20ID\x20is:',_0x16c004['id']);return getTicket(_0x56ba3e,_0x2e4423,_0x16c004,_0x4e61be,_0x1635ea);})['then'](function(_0x3657c8){if(_0x3657c8){logger[_0xe1d2('0xc')]('The\x20Ticket\x20ID\x20is:',_0x3657c8['id']);switch(_0x56ba3e[_0xe1d2('0x3a')]){case'integrationTab':logger[_0xe1d2('0xc')](_0xe1d2('0x4a'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format'](_0xe1d2('0x51'),_0x56ba3e[_0xe1d2('0x10')],_0x2e4423['id'],_0x3657c8['id']),'method':_0xe1d2('0x2b')});case'newTab':logger[_0xe1d2('0xc')](_0xe1d2('0x4a'),_0xe1d2('0x52'));emit(util[_0xe1d2('0xe')](_0xe1d2('0x53'),_0xfb083[_0xe1d2('0x12')]),_0xe1d2('0x54'),{'uri':util[_0xe1d2('0xe')](_0xe1d2('0x55'),_0x56ba3e[_0xe1d2('0x10')][_0xe1d2('0x56')](_0xe1d2('0x57'),''),_0x3657c8['id'])});break;default:logger['error'](_0xe1d2('0x4a'),_0xe1d2('0x58'));}}})[_0xe1d2('0x59')](function(_0x5e681f){logger[_0xe1d2('0x5a')](_0xe1d2('0x5b'),util['inspect'](_0x5e681f,{'showHidden':!![],'depth':null}));});};exports[_0xe1d2('0x5c')]=function(_0x2e7eee,_0xfce382,_0x286830,_0xa2da9b,_0x196178,_0x3f5924,_0x17f5f6){var _0x4018f0,_0x2a5d04;_0x3f5924[_0xe1d2('0x10')]=intUtil[_0xe1d2('0x47')](_0x3f5924[_0xe1d2('0x10')]);_0x3f5924[_0xe1d2('0x48')]=intUtil[_0xe1d2('0x47')](_0x3f5924[_0xe1d2('0x48')]);if(_0x17f5f6&&_0x17f5f6[_0xe1d2('0x5d')]&&_0x17f5f6[_0xe1d2('0x5d')]!==_0xe1d2('0x5e')){logger[_0xe1d2('0xc')]('[OUTBOUND]',_0xe1d2('0x5f'));_0xfce382[_0xe1d2('0x4b')]=util[_0xe1d2('0xe')](_0xe1d2('0x4c'),_0x3f5924['serverUrl'],_0xfce382['uniqueid'],md5(_0xfce382[_0xe1d2('0x60')]));}headers[_0xe1d2('0x61')]=getAuth(_0x3f5924);return getUser(_0x3f5924,_0xa2da9b[_0xe1d2('0x4d')])[_0xe1d2('0x16')](function(_0x3d0248){_0x4018f0=_0x3d0248;logger[_0xe1d2('0xc')](_0xe1d2('0x4e'),_0x4018f0['id']);return getEndUser(_0x3f5924,_0xfce382[_0xe1d2('0x62')],_0xfce382[_0xe1d2('0x63')]);})[_0xe1d2('0x16')](function(_0x30facd){_0x2a5d04=_0x30facd;logger['info']('The\x20Enduser\x20ID\x20is:',_0x2a5d04['id']);return getTicket(_0x3f5924,_0x4018f0,_0x2a5d04,_0x286830,_0xfce382);})[_0xe1d2('0x16')](function(_0x171925){if(_0x171925){logger[_0xe1d2('0xc')]('The\x20Ticket\x20ID\x20is:',_0x171925['id']);switch(_0x3f5924['type']){case'integrationTab':logger['info'](_0xe1d2('0x64'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xe1d2('0xe')](_0xe1d2('0x51'),_0x3f5924[_0xe1d2('0x10')],_0x4018f0['id'],_0x171925['id']),'method':'POST'});case'newTab':logger[_0xe1d2('0xc')](_0xe1d2('0x64'),_0xe1d2('0x52'));emit(util[_0xe1d2('0xe')](_0xe1d2('0x53'),_0xa2da9b[_0xe1d2('0x12')]),_0xe1d2('0x54'),{'uri':util[_0xe1d2('0xe')](_0xe1d2('0x55'),_0x3f5924[_0xe1d2('0x10')][_0xe1d2('0x56')](_0xe1d2('0x57'),''),_0x171925['id'])});break;default:logger['error'](_0xe1d2('0x64'),_0xe1d2('0x58'));}}})[_0xe1d2('0x59')](function(_0xafed6c){logger['error'](_0xe1d2('0x65'),util['inspect'](_0xafed6c,{'showHidden':!![],'depth':null}));});};exports[_0xe1d2('0x66')]=function(_0x5388ab,_0x221a7a,_0x2134b2,_0x1621cd,_0x12599d,_0x572d90){var _0x1b9b21,_0x958405;_0x572d90['remoteUri']=intUtil[_0xe1d2('0x47')](_0x572d90['remoteUri']);_0x572d90[_0xe1d2('0x48')]=intUtil['stripTrailingSlash'](_0x572d90[_0xe1d2('0x48')]);if(_0x12599d&&_0x12599d[_0xe1d2('0x49')]){logger[_0xe1d2('0xc')]('['+_0x221a7a[_0xe1d2('0x67')][_0xe1d2('0x68')]()+']',_0xe1d2('0x5f'));_0x221a7a[_0xe1d2('0x4b')]=util[_0xe1d2('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x572d90['serverUrl'],_0x221a7a['uniqueid'],md5(_0x221a7a[_0xe1d2('0x60')]));}else{_0x221a7a['recordingURL']='';}headers[_0xe1d2('0x61')]=getAuth(_0x572d90);return getUser(_0x572d90)[_0xe1d2('0x16')](function(_0x2132fb){_0x1b9b21=_0x2132fb;logger[_0xe1d2('0xc')](_0xe1d2('0x4e'),_0x1b9b21['id']);return getEndUser(_0x572d90,_0x221a7a[_0xe1d2('0x4f')],_0x221a7a['calleridnum']);})[_0xe1d2('0x16')](function(_0x44db13){_0x958405=_0x44db13;logger[_0xe1d2('0xc')](_0xe1d2('0x69'),_0x958405['id']);return getTicket(_0x572d90,_0x1b9b21,_0x958405,_0x2134b2,_0x221a7a);})[_0xe1d2('0x16')](function(_0x112af3){if(_0x112af3){logger['info'](_0xe1d2('0x6a'),_0x112af3['id']);}})['catch'](function(_0x27b026){logger[_0xe1d2('0x5a')]('['+_0x221a7a[_0xe1d2('0x67')][_0xe1d2('0x68')]()+']'+_0xe1d2('0x6b'),util['inspect'](_0x27b026,{'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 0a6cc60..6a9e77b 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 _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 +var _0x3edd=['uniqueid','/downloads?type=uniqueid&token=','com','email','calleridname','calleridnum','Inbound','The\x20Call\x20ID\x20is:','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','[QUEUE]','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','zoho.eu','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','unmanaged','toUpperCase','lodash','request-promise','md5','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','defaults','redis','localhost','socket.io-emitter','debug','stringify','length','includes','string','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','refreshToken','clientId','clientSecret','refresh_token','then','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','GET','https://www.zohoapis.%s/crm/v2/users','users','isArrayLikeObject','findIndex','profile','Administrator','user','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','enduserType','https://www.zohoapis.','/crm/v2/','moduleCreate','role','first_name','data','SUCCESS','details','startCase','log','CREATE\x20ERROR','Zoho-oauthtoken\x20','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','lead','Creating\x20new\x20call...','Owner','last_name','Subject','Subjects','Description','getString','Descriptions','Full_Name','Last_Name','What_Id','First_Name','$se_module','talktime','Call_Duration','utc','format','mm:ss','answertime','endtime','diff','lastevent','called','Call_Result','Called','connect','rejected','Rejected','abandoned','timeout','Timeout','Call_Start_Time','outbound','starttime','YYYY-MM-DDTHH:mm:ss','Call_Type','/crm/v2/Calls','code','Call\x20created!','err','host','stripTrailingSlash','serverUrl','monitor_format','recordingURL','/api/voice/recordings/'];(function(_0x28b7ab,_0x16a764){var _0x56791b=function(_0x25d20d){while(--_0x25d20d){_0x28b7ab['push'](_0x28b7ab['shift']());}};_0x56791b(++_0x16a764);}(_0x3edd,0x14f));var _0xd3ed=function(_0x199d89,_0x3265e5){_0x199d89=_0x199d89-0x0;var _0x1925ee=_0x3edd[_0x199d89];return _0x1925ee;};'use strict';var _=require(_0xd3ed('0x0'));var rp=require(_0xd3ed('0x1'));var md5=require(_0xd3ed('0x2'));var util=require(_0xd3ed('0x3'));var intUtil=require(_0xd3ed('0x4'));var moment=require(_0xd3ed('0x5'));var Redis=require(_0xd3ed('0x6'));var BPromise=require(_0xd3ed('0x7'));var config=require(_0xd3ed('0x8'));var logger=require(_0xd3ed('0x9'))(_0xd3ed('0xa'));config['redis']=_[_0xd3ed('0xb')](config[_0xd3ed('0xc')],{'host':_0xd3ed('0xd'),'port':0x18eb});var io=require(_0xd3ed('0xe'))(new Redis(config[_0xd3ed('0xc')]));function emit(_0x50b98b,_0x992e52,_0x44c2f7){io['to'](_0x50b98b)['emit'](_0x992e52,_0x44c2f7);}function request(_0x1683e6){logger[_0xd3ed('0xf')]('[HTTP]',JSON[_0xd3ed('0x10')](_0x1683e6));return rp(_0x1683e6);}function getCustomFields(_0x40881d,_0x2d0047){var _0x5d13d9={};if(_0x40881d[_0xd3ed('0x11')]>0x0){_['forEach'](_0x40881d,function(_0xacd1f3){if(_[_0xd3ed('0x12')]([_0xd3ed('0x13'),'picklist'],_0xacd1f3[_0xd3ed('0x14')])&&_0xacd1f3['idField']){_0x5d13d9[_0xacd1f3[_0xd3ed('0x15')]]=_0xacd1f3[_0xd3ed('0x16')][_0xd3ed('0x17')]();}else if(_0xacd1f3[_0xd3ed('0x14')]===_0xd3ed('0x18')&&_0xacd1f3[_0xd3ed('0x19')]&&_0xacd1f3[_0xd3ed('0x15')]&&_0x2d0047[_0xacd1f3['variableName']]){_0x5d13d9[_0xacd1f3[_0xd3ed('0x15')]]=_0x2d0047[_0xacd1f3[_0xd3ed('0x19')]][_0xd3ed('0x17')]();}else if(_0xacd1f3[_0xd3ed('0x14')]===_0xd3ed('0x1a')&&_0xacd1f3[_0xd3ed('0x1b')]&&_0xacd1f3[_0xd3ed('0x1b')]['name']&&_0xacd1f3[_0xd3ed('0x15')]&&_0x2d0047[_0xacd1f3[_0xd3ed('0x1b')][_0xd3ed('0x1c')][_0xd3ed('0x1d')]()]){_0x5d13d9[_0xacd1f3['idField']]=_0x2d0047[_0xacd1f3[_0xd3ed('0x1b')][_0xd3ed('0x1c')][_0xd3ed('0x1d')]()]['toString']();}});}return _0x5d13d9;}function getName(_0x307740){if(_0x307740['indexOf']('\x20')>0x0){var _0x1d68b0=_0x307740[_0xd3ed('0x1e')](/ (.+)/);if(_0x1d68b0[0x1]){return _0x1d68b0;}}return[_0x307740,_0x307740];}var accountsTokens={};function getAccessToken(_0x15bf3c){return new Promise(function(_0x59320c,_0x35c144){if(!_[_0xd3ed('0x1f')](accountsTokens[_0x15bf3c['id']])&&!_['isNil'](accountsTokens[_0x15bf3c['id']][_0xd3ed('0x20')])){if(moment()[_0xd3ed('0x21')](accountsTokens[_0x15bf3c['id']][_0xd3ed('0x22')])){_0x59320c(accountsTokens[_0x15bf3c['id']]['access_token']);}}var _0x40fcb6;switch(_0x15bf3c[_0xd3ed('0x23')]){case'US':_0x40fcb6='https://accounts.zoho.com';break;case'AU':_0x40fcb6=_0xd3ed('0x24');break;case'EU':_0x40fcb6=_0xd3ed('0x25');break;case'IN':_0x40fcb6=_0xd3ed('0x26');break;case'CN':_0x40fcb6=_0xd3ed('0x27');break;default:_0x40fcb6=_0xd3ed('0x25');break;}var _0x51c7fb={'method':_0xd3ed('0x28'),'uri':_0x40fcb6+'/oauth/v2/token','qs':{'refresh_token':_0x15bf3c[_0xd3ed('0x29')],'client_id':_0x15bf3c[_0xd3ed('0x2a')],'client_secret':_0x15bf3c[_0xd3ed('0x2b')],'grant_type':_0xd3ed('0x2c')},'json':!![]};return rp(_0x51c7fb)[_0xd3ed('0x2d')](function(_0x222390){accountsTokens[_0x15bf3c['id']]={'access_token':_0x222390[_0xd3ed('0x20')],'expires_in':moment()[_0xd3ed('0x2e')](_0x222390[_0xd3ed('0x22')],_0xd3ed('0x2f'))};_0x59320c(_0x222390[_0xd3ed('0x20')]);})[_0xd3ed('0x30')](function(_0x417d6f){logger[_0xd3ed('0x31')](_0xd3ed('0x32'),_0x417d6f[_0xd3ed('0x33')]);_0x35c144(_0x417d6f);});});}function getUser(_0xcb1cf1,_0x361c0e,_0x52e47b,_0x504e7c){logger[_0xd3ed('0x34')]('Search\x20user');return request({'method':_0xd3ed('0x35'),'uri':util['format'](_0xd3ed('0x36'),_0x361c0e),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0xcb1cf1},'json':!![]})[_0xd3ed('0x2d')](function(_0x4f4441){if(_0x4f4441[_0xd3ed('0x37')]){var _0x4d9e4f=-0x1;if(_[_0xd3ed('0x38')](_0x4f4441[_0xd3ed('0x37')])){if(!_['isNil'](_0x504e7c)){_0x4d9e4f=_[_0xd3ed('0x39')](_0x4f4441[_0xd3ed('0x37')],function(_0x70dc62){return _0x70dc62['email']===_0x504e7c;});}if(_0x4d9e4f>=0x0){logger[_0xd3ed('0x34')]('Agent\x20found!');}else{logger[_0xd3ed('0x34')]('Using\x20the\x20admin\x20account!');_0x4d9e4f=_[_0xd3ed('0x39')](_0x4f4441[_0xd3ed('0x37')],function(_0x502728){return _0x502728[_0xd3ed('0x3a')][_0xd3ed('0x1c')]===_0xd3ed('0x3b');});}return _0x4f4441[_0xd3ed('0x37')][_0x4d9e4f];}else{if(_0x4f4441['user'][_0xd3ed('0x3a')][_0xd3ed('0x1c')]===_0xd3ed('0x3b')){logger[_0xd3ed('0x34')]('Using\x20the\x20admin\x20account!');user=_0x4f4441[_0xd3ed('0x3c')];return user;}else{logger[_0xd3ed('0x31')]('The\x20failing\x20result\x20is',JSON[_0xd3ed('0x10')](_0x4f4441));throw new Error(_0xd3ed('0x3d')+JSON[_0xd3ed('0x10')](_0x4f4441));}}}else{logger[_0xd3ed('0x31')](_0xd3ed('0x3e'),JSON[_0xd3ed('0x10')](_0x4f4441));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xd3ed('0x10')](_0x4f4441));}})[_0xd3ed('0x30')](function(_0x1ab814){console[_0xd3ed('0x31')](_0x1ab814);});}function getZohoUser(_0x366a43,_0x3b362a){return new BPromise(function(_0x3abe0d,_0x4144c2){request(_0x366a43)[_0xd3ed('0x2d')](function(_0x33a2c0){var _0x3771a3=null;if(_0x33a2c0){_0x3771a3=_0x33a2c0['data'][0x0];_0x3771a3[_0xd3ed('0x3f')]=_0x3b362a;}_0x3abe0d(_0x3771a3);})['catch'](function(_0x40b94b){_0x4144c2(_0x40b94b);});});}function createEndUser(_0x4ef9c0,_0x3fa16c,_0x13a7a3,_0x576c9d,_0x2155a1,_0x46e34f){var _0x13a7a3=getName(_0x13a7a3);return request({'method':_0xd3ed('0x28'),'uri':_0xd3ed('0x40')+_0x3fa16c+_0xd3ed('0x41')+_['startCase'](_0x46e34f[_0xd3ed('0x42')])+'s','body':{'data':[{'Last_Name':_0x13a7a3[0x1],'First_Name':_0x13a7a3[0x0],'Phone':_0x576c9d,'Owner':{'name':!_[_0xd3ed('0x1f')](_0x2155a1['role'][_0xd3ed('0x1c')])?_0x2155a1[_0xd3ed('0x43')][_0xd3ed('0x1c')]:!_[_0xd3ed('0x1f')](_0x2155a1[_0xd3ed('0x44')])?_0x2155a1[_0xd3ed('0x44')]+'\x20'+_0x2155a1['last_name']:_0x2155a1['last_name'],'id':_0x2155a1['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x4ef9c0},'json':!![]})[_0xd3ed('0x2d')](function(_0x13cc34){if(_0x13cc34&&_0x13cc34[_0xd3ed('0x45')][0x0]['code']===_0xd3ed('0x46')){var _0x3caceb=_0x13cc34[_0xd3ed('0x45')][0x0][_0xd3ed('0x47')];_0x3caceb[_0xd3ed('0x3f')]=_[_0xd3ed('0x48')](_0x46e34f[_0xd3ed('0x42')])+'s';return _0x3caceb;}logger[_0xd3ed('0x31')](_0xd3ed('0x3e'),JSON[_0xd3ed('0x10')](data));throw new Error('Error:\x20'+JSON[_0xd3ed('0x10')](data));})[_0xd3ed('0x30')](function(_0xb39d0f){console[_0xd3ed('0x49')](_0xd3ed('0x4a'),_0xb39d0f);});}function getEndUser(_0xc61fcf,_0x55409d,_0x11813e,_0x3c064a,_0x505379,_0x56520f,_0x16be36){var _0xa7df6d={'method':_0xd3ed('0x35'),'uri':'','headers':{'Authorization':_0xd3ed('0x4b')+_0xc61fcf},'json':!![]};switch(_0x16be36['moduleSearch']){case _0xd3ed('0x4c'):_0xa7df6d[_0xd3ed('0x4d')]=_0xd3ed('0x40')+_0x55409d+_0xd3ed('0x4e')+_0x505379+'))';return getZohoUser(_0xa7df6d,'Contacts')[_0xd3ed('0x2d')](function(_0x24ba6b){if(_0x24ba6b)return _0x24ba6b;_0xa7df6d['uri']=_0xd3ed('0x40')+_0x55409d+_0xd3ed('0x4f')+_0x505379+'))';return getZohoUser(_0xa7df6d,_0xd3ed('0x50'))['then'](function(_0x197d72){if(_0x197d72)return _0x197d72;if(_0x16be36[_0xd3ed('0x42')]!=_0xd3ed('0x51')){return createEndUser(_0xc61fcf,_0x55409d,_0x3c064a,_0x505379,_0x56520f,_0x16be36);}else{return{};}});});break;case _0xd3ed('0x52'):_0xa7df6d[_0xd3ed('0x4d')]=_0xd3ed('0x40')+_0x55409d+_0xd3ed('0x4e')+_0x505379+'))';return getZohoUser(_0xa7df6d,'Contacts')[_0xd3ed('0x2d')](function(_0x22bf3a){if(_0x22bf3a)return _0x22bf3a;if(_0x16be36[_0xd3ed('0x42')]!='nothing'){return createEndUser(_0xc61fcf,_0x55409d,_0x3c064a,_0x505379,_0x56520f,_0x16be36);}else{return{};}});break;case _0xd3ed('0x53'):_0xa7df6d[_0xd3ed('0x4d')]=_0xd3ed('0x40')+_0x55409d+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x505379+'))';return getZohoUser(_0xa7df6d,_0xd3ed('0x50'))[_0xd3ed('0x2d')](function(_0x4593da){if(_0x4593da)return _0x4593da;if(_0x16be36['moduleCreate']!=_0xd3ed('0x51')){return createEndUser(_0xc61fcf,_0x55409d,_0x3c064a,_0x505379,_0x56520f,_0x16be36);}else{return{};}});break;}}function getCall(_0x1efb32,_0x1ef151,_0x262f86,_0x387743,_0x1950f5,_0x3f11a0,_0x3b8e25,_0x16386e){logger[_0xd3ed('0x34')](_0xd3ed('0x54'));var _0x46656e={};_0x46656e[_0xd3ed('0x55')]={'name':!_[_0xd3ed('0x1f')](_0x387743['role'][_0xd3ed('0x1c')])&&!_['isNil'](_0x387743['profile'][_0xd3ed('0x1c')])&&_0x387743[_0xd3ed('0x3a')][_0xd3ed('0x1c')]==='administrator'?_0x387743['role'][_0xd3ed('0x1c')]:!_[_0xd3ed('0x1f')](_0x387743[_0xd3ed('0x44')])?_0x387743[_0xd3ed('0x44')]+'\x20'+_0x387743[_0xd3ed('0x56')]:_0x387743['last_name'],'id':_0x387743['id']};_0x46656e[_0xd3ed('0x57')]=intUtil['getString'](_0x3f11a0[_0xd3ed('0x58')],_0x3b8e25,'\x20');_0x46656e[_0xd3ed('0x59')]=intUtil[_0xd3ed('0x5a')](_0x3f11a0[_0xd3ed('0x5b')],_0x3b8e25,'\x0a');if(_0x1950f5['enduserType']==='Contacts'){_0x46656e['Who_Id']={'name':!_['isNil'](_0x1950f5[_0xd3ed('0x5c')])?_0x1950f5[_0xd3ed('0x5c')]:!_[_0xd3ed('0x1f')](_0x1950f5['First_Name'])?_0x1950f5['First_Name']+'\x20'+_0x1950f5[_0xd3ed('0x5d')]:_0x1950f5[_0xd3ed('0x5d')],'id':_0x1950f5['id']};}if(_0x1950f5[_0xd3ed('0x3f')]===_0xd3ed('0x50')){_0x46656e[_0xd3ed('0x5e')]={'name':!_[_0xd3ed('0x1f')](_0x1950f5['Full_Name'])?_0x1950f5[_0xd3ed('0x5c')]:!_['isNil'](_0x1950f5[_0xd3ed('0x5f')])?_0x1950f5[_0xd3ed('0x5f')]+'\x20'+_0x1950f5[_0xd3ed('0x5d')]:_0x1950f5['Last_Name'],'id':_0x1950f5['id']};_0x46656e[_0xd3ed('0x60')]=_[_0xd3ed('0x48')](_0x1950f5[_0xd3ed('0x3f')]);}if(_0x3b8e25[_0xd3ed('0x61')]){_0x46656e[_0xd3ed('0x62')]=moment[_0xd3ed('0x63')](parseInt(_0x3b8e25[_0xd3ed('0x61')])*0x3e8)[_0xd3ed('0x64')](_0xd3ed('0x65'));}else if(_0x3b8e25[_0xd3ed('0x66')]&&_0x3b8e25[_0xd3ed('0x67')]){_0x46656e[_0xd3ed('0x62')]=moment[_0xd3ed('0x63')](moment(_0x3b8e25[_0xd3ed('0x67')],'YYYY-MM-DDTHH:mm:ss')[_0xd3ed('0x68')](moment(_0x3b8e25['starttime'],'YYYY-MM-DDTHH:mm:ss')))[_0xd3ed('0x64')]('mm:ss');}switch(_0x3b8e25[_0xd3ed('0x69')]){case _0xd3ed('0x6a'):_0x46656e[_0xd3ed('0x6b')]=_0xd3ed('0x6c');break;case'complete':case _0xd3ed('0x6d'):_0x46656e[_0xd3ed('0x6b')]='Answered';break;case _0xd3ed('0x6e'):_0x46656e[_0xd3ed('0x6b')]=_0xd3ed('0x6f');break;case _0xd3ed('0x70'):_0x46656e[_0xd3ed('0x6b')]='Abandoned';break;case _0xd3ed('0x71'):_0x46656e[_0xd3ed('0x6b')]=_0xd3ed('0x72');default:}_0x46656e[_0xd3ed('0x73')]=(_0x16386e===_0xd3ed('0x74')?moment(_0x3b8e25[_0xd3ed('0x75')])['format'](_0xd3ed('0x76')):moment(_0x3b8e25['agentcalledAt'])[_0xd3ed('0x64')](_0xd3ed('0x76')))||moment()['format'](_0xd3ed('0x76'));_0x46656e[_0xd3ed('0x77')]=_0x16386e||'Inbound';_0x46656e=_['merge'](_0x46656e,getCustomFields(_0x3f11a0['Fields'],_0x3b8e25));return request({'method':_0xd3ed('0x28'),'uri':_0xd3ed('0x40')+_0x1ef151+_0xd3ed('0x78'),'headers':{'Authorization':_0xd3ed('0x4b')+_0x1efb32},'body':{'data':[_0x46656e]},'json':!![]})[_0xd3ed('0x2d')](function(_0x51ad67){if(_0x51ad67&&_0x51ad67[_0xd3ed('0x45')][0x0][_0xd3ed('0x79')]===_0xd3ed('0x46')){logger[_0xd3ed('0x34')](_0xd3ed('0x7a'));return{'id':_0x51ad67[_0xd3ed('0x45')][0x0]['details']['id']};}})[_0xd3ed('0x30')](function(_0x5649a2){logger[_0xd3ed('0x34')](_0xd3ed('0x7b'),_0x5649a2['stack']);console['log'](_0xd3ed('0x7b'),_0x5649a2);});}exports['queue']=function(_0x51faa0,_0x7f2fe8,_0x77616f,_0x318071,_0x587b4d,_0x399c27){var _0x40e547,_0x4d5bd0,_0x1e8904;_0x399c27[_0xd3ed('0x7c')]=intUtil[_0xd3ed('0x7d')](_0x399c27[_0xd3ed('0x7c')]);_0x399c27[_0xd3ed('0x7e')]=intUtil[_0xd3ed('0x7d')](_0x399c27[_0xd3ed('0x7e')]);if(_0x587b4d&&_0x587b4d[_0xd3ed('0x7f')]){logger[_0xd3ed('0x34')]('[QUEUE]','Recording\x20is\x20enabled!');_0x7f2fe8[_0xd3ed('0x80')]=_0x399c27[_0xd3ed('0x7e')]+_0xd3ed('0x81')+_0x7f2fe8[_0xd3ed('0x82')]+_0xd3ed('0x83')+md5(_0x7f2fe8[_0xd3ed('0x82')]);}else{_0x7f2fe8[_0xd3ed('0x80')]='';}var _0x1ad524=_0x399c27[_0xd3ed('0x7c')]==='zoho.eu'?'eu':_0xd3ed('0x84');return getAccessToken(_0x399c27)[_0xd3ed('0x2d')](function(_0x173df3){_0x1e8904=_0x173df3;return getUser(_0x1e8904,_0x1ad524,_0x399c27,_0x318071[_0xd3ed('0x85')]);})[_0xd3ed('0x2d')](function(_0x2feada){_0x40e547=_0x2feada;logger[_0xd3ed('0x34')]('The\x20User\x20ID\x20is:',_0x40e547['id']);return getEndUser(_0x1e8904,_0x1ad524,_0x399c27,_0x7f2fe8[_0xd3ed('0x86')],_0x7f2fe8[_0xd3ed('0x87')],_0x40e547,_0x77616f);})[_0xd3ed('0x2d')](function(_0x1a2e8c){_0x4d5bd0=_0x1a2e8c;return getCall(_0x1e8904,_0x1ad524,_0x399c27,_0x40e547,_0x4d5bd0,_0x77616f,_0x7f2fe8,_0xd3ed('0x88'));})[_0xd3ed('0x2d')](function(_0x499dea){if(_0x499dea){logger[_0xd3ed('0x34')](_0xd3ed('0x89'),_0x499dea['id']);logger[_0xd3ed('0x34')]('[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xd3ed('0x64')]('user:%s',_0x318071['name']),_0xd3ed('0x8a'),{'uri':_0xd3ed('0x8b')+_0x399c27[_0xd3ed('0x7c')]+_0xd3ed('0x8c')+_0x499dea['id']});}})[_0xd3ed('0x30')](function(_0x26e534){logger[_0xd3ed('0x31')](_0xd3ed('0x8d'),JSON[_0xd3ed('0x10')](_0x26e534));});};exports[_0xd3ed('0x74')]=function(_0x9f0408,_0x4302af,_0x1f82dd,_0x703d02,_0x1000ae,_0x5c7aef,_0x15d429){var _0x2a5f3b,_0x8ed548,_0x1a47db;_0x5c7aef[_0xd3ed('0x7c')]=intUtil[_0xd3ed('0x7d')](_0x5c7aef[_0xd3ed('0x7c')]);_0x5c7aef[_0xd3ed('0x7e')]=intUtil['stripTrailingSlash'](_0x5c7aef['serverUrl']);if(_0x15d429&&_0x15d429[_0xd3ed('0x8e')]&&_0x15d429[_0xd3ed('0x8e')]!==_0xd3ed('0x8f')){logger['info'](_0xd3ed('0x90'),_0xd3ed('0x91'));_0x4302af[_0xd3ed('0x80')]=_0x5c7aef['serverUrl']+_0xd3ed('0x81')+_0x4302af['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x4302af[_0xd3ed('0x82')]);}var _0x5befe7=_0x5c7aef['host']===_0xd3ed('0x92')?'eu':_0xd3ed('0x84');return getAccessToken(_0x5c7aef)[_0xd3ed('0x2d')](function(_0xa04b28){_0x1a47db=_0xa04b28;return getUser(_0x1a47db,_0x5befe7,_0x5c7aef,_0x703d02[_0xd3ed('0x85')]);})['then'](function(_0x57e56f){_0x2a5f3b=_0x57e56f;logger[_0xd3ed('0x34')](_0xd3ed('0x93'),_0x2a5f3b['id']);return getEndUser(_0x1a47db,_0x5befe7,_0x5c7aef,_0x4302af[_0xd3ed('0x94')],_0x4302af[_0xd3ed('0x95')],_0x2a5f3b,_0x1f82dd);})[_0xd3ed('0x2d')](function(_0x397d22){_0x8ed548=_0x397d22;return getCall(_0x1a47db,_0x5befe7,_0x5c7aef,_0x2a5f3b,_0x8ed548,_0x1f82dd,_0x4302af,_0xd3ed('0x96'));})[_0xd3ed('0x2d')](function(_0x470a40){if(_0x470a40){logger['info'](_0xd3ed('0x89'),_0x470a40['id']);logger[_0xd3ed('0x34')](_0xd3ed('0x90'),_0xd3ed('0x97'));emit(util[_0xd3ed('0x64')](_0xd3ed('0x98'),_0x703d02['name']),_0xd3ed('0x8a'),{'uri':'https://crm.'+_0x5c7aef[_0xd3ed('0x7c')]+_0xd3ed('0x8c')+_0x470a40['id']});}})[_0xd3ed('0x30')](function(_0x32af6c){logger[_0xd3ed('0x31')](_0xd3ed('0x90'),JSON[_0xd3ed('0x10')](_0x32af6c));});};exports[_0xd3ed('0x99')]=function(_0x1d8047,_0x484a8a,_0x50ea9d,_0x2212f2,_0x5ecac9,_0x48426b){var _0x476894,_0x1fe7a9,_0x34f8b6;_0x48426b[_0xd3ed('0x7c')]=intUtil['stripTrailingSlash'](_0x48426b[_0xd3ed('0x7c')]);_0x48426b['serverUrl']=intUtil[_0xd3ed('0x7d')](_0x48426b['serverUrl']);if(_0x5ecac9&&_0x5ecac9[_0xd3ed('0x7f')]){logger[_0xd3ed('0x34')]('['+_0x484a8a[_0xd3ed('0x69')]['toUpperCase']()+']',_0xd3ed('0x91'));_0x484a8a[_0xd3ed('0x80')]=_0x48426b[_0xd3ed('0x7e')]+_0xd3ed('0x81')+_0x484a8a[_0xd3ed('0x82')]+_0xd3ed('0x83')+md5(_0x484a8a['uniqueid']);}else{_0x484a8a[_0xd3ed('0x80')]='';}var _0x428b46=_0x48426b[_0xd3ed('0x7c')]===_0xd3ed('0x92')?'eu':_0xd3ed('0x84');return getAccessToken(_0x48426b)['then'](function(_0x264495){_0x34f8b6=_0x264495;return getUser(_0x34f8b6,_0x428b46,_0x48426b);})['then'](function(_0x36dfee){_0x476894=_0x36dfee;logger[_0xd3ed('0x34')](_0xd3ed('0x93'),_0x476894['id']);return getEndUser(_0x34f8b6,_0x428b46,_0x48426b,_0x484a8a[_0xd3ed('0x86')],_0x484a8a[_0xd3ed('0x87')],_0x476894,_0x50ea9d);})[_0xd3ed('0x2d')](function(_0x19f469){_0x1fe7a9=_0x19f469;return getCall(_0x34f8b6,_0x428b46,_0x48426b,_0x476894,_0x1fe7a9,_0x50ea9d,_0x484a8a,_0xd3ed('0x88'));})['then'](function(_0x2f66a1){if(_0x2f66a1){logger['info']('The\x20Call\x20ID\x20is:',_0x2f66a1['id']);}})['catch'](function(_0xbe3641){logger[_0xd3ed('0x31')]('['+_0x484a8a[_0xd3ed('0x69')][_0xd3ed('0x9a')]()+']',JSON[_0xd3ed('0x10')](_0xbe3641));});}; \ 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 20ff1ec..ec545b9 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 _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 +var _0xd5da=['Script','data3','render','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','../../../../config/logger','trigger','exec','data2'];(function(_0x27e7dc,_0x234ff4){var _0x20c096=function(_0x2cde78){while(--_0x2cde78){_0x27e7dc['push'](_0x27e7dc['shift']());}};_0x20c096(++_0x234ff4);}(_0xd5da,0x9e));var _0xad5d=function(_0x1a93eb,_0x216ca1){_0x1a93eb=_0x1a93eb-0x0;var _0x439162=_0xd5da[_0x1a93eb];return _0x439162;};'use strict';var util=require(_0xad5d('0x0'));var sh=require(_0xad5d('0x1'));var Mustache=require(_0xad5d('0x2'));var logger=require(_0xad5d('0x3'))(_0xad5d('0x4'));exports[_0xad5d('0x5')]=function(_0x43c80e,_0x456b17){var _0x5d8b3c=_0x43c80e[_0xad5d('0x6')]?_0x43c80e[_0xad5d('0x6')]:_0xad5d('0x7');var _0x282bad=_0x43c80e[_0xad5d('0x8')]?Mustache[_0xad5d('0x9')](_0x43c80e['data3'],_0x456b17):_0x456b17;sh[_0xad5d('0x5')](_0x282bad,function(_0x6e7fa,_0x51d1fa,_0x21f4be){if(_0x6e7fa!==0x0){logger[_0xad5d('0xa')](util[_0xad5d('0xb')](_0xad5d('0xc'),_0x5d8b3c,_0x282bad,_0x6e7fa,_0x21f4be));}else{logger[_0xad5d('0xd')](util['format'](_0xad5d('0xe'),_0x5d8b3c,_0x282bad,_0x51d1fa));}});}; \ 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 dc03a02..c4c2bee 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 _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 +var _0x4ac0=['message','request-promise','lodash','mustache','../../../../config/logger','data1','toUpperCase','render','data2','number','data5','headers','error','stack','GET','DELETE','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s'];(function(_0x38e83c,_0x4dd891){var _0x3faf17=function(_0x377c12){while(--_0x377c12){_0x38e83c['push'](_0x38e83c['shift']());}};_0x3faf17(++_0x4dd891);}(_0x4ac0,0x187));var _0x04ac=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x4ac0[_0x3ff085];return _0x2b68c3;};'use strict';var rp=require(_0x04ac('0x0'));var util=require('util');var _=require(_0x04ac('0x1'));var Mustache=require(_0x04ac('0x2'));var logger=require(_0x04ac('0x3'))('trigger');exports['exec']=function(_0x32d5b7,_0x211d37){var _0x4c8342,_0x5ca6c5;var _0x3ebbc={'method':_0x32d5b7[_0x04ac('0x4')][_0x04ac('0x5')](),'uri':Mustache[_0x04ac('0x6')](_0x32d5b7[_0x04ac('0x7')],_0x211d37),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x32d5b7['data5'])===_0x04ac('0x8')&&parseInt(_0x32d5b7[_0x04ac('0x9')])>=0x1&&parseInt(_0x32d5b7['data5'])<=0xa?parseInt(_0x32d5b7['data5'])*0x3e8:0x5*0x3e8};try{_0x3ebbc[_0x04ac('0xa')]=_0x32d5b7['data6']?JSON['parse'](Mustache[_0x04ac('0x6')](_0x32d5b7['data6'],_0x211d37)):{};}catch(_0x4f3371){logger[_0x04ac('0xb')](_0x4f3371[_0x04ac('0xc')]);}switch(_0x32d5b7[_0x04ac('0x4')]['toUpperCase']()){case _0x04ac('0xd'):case _0x04ac('0xe'):_0x4c8342=null;_0x3ebbc['qs']=_0x211d37;break;case _0x04ac('0xf'):case _0x04ac('0x10'):if(_0x32d5b7[_0x04ac('0x11')]){try{_0x4c8342=JSON['parse'](Mustache[_0x04ac('0x6')](_0x32d5b7[_0x04ac('0x11')],_0x211d37));_0x3ebbc[_0x04ac('0x12')]=_0x4c8342;}catch(_0x15461e){logger['error'](_0x15461e[_0x04ac('0xc')]);logger['error'](_0x04ac('0x13'));}}else{_0x4c8342=_0x211d37;_0x3ebbc['body']=_0x4c8342;}break;}logger['info'](util[_0x04ac('0x14')](_0x04ac('0x15'),_0x32d5b7[_0x04ac('0x4')],_0x32d5b7[_0x04ac('0x7')],JSON[_0x04ac('0x16')](_0x3ebbc)));rp(_0x3ebbc)[_0x04ac('0x17')](function(_0x17061d){_0x4c8342=!_[_0x04ac('0x18')](_0x4c8342)?_0x04ac('0x19')+_0x4c8342:'';_0x5ca6c5=typeof _0x17061d[_0x04ac('0x12')]===_0x04ac('0x1a')?JSON[_0x04ac('0x16')](_0x17061d[_0x04ac('0x12')]):_0x17061d[_0x04ac('0x12')];logger['info'](util[_0x04ac('0x14')](_0x04ac('0x1b'),_0x32d5b7[_0x04ac('0x4')],_0x32d5b7['data2'],_0x17061d['statusCode'],_0x5ca6c5));})['catch'](function(_0x30c866){logger[_0x04ac('0xb')](util[_0x04ac('0x14')](_0x04ac('0x1c'),_0x32d5b7[_0x04ac('0x4')],_0x32d5b7[_0x04ac('0x7')],_0x30c866['statusCode'],_0x30c866['name'],_0x30c866[_0x04ac('0x1d')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 86efd38..a47178f 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 _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 +var _0x41a7=['rpc','error','message','result','catch','exports','jayson/promise','bluebird','routing','client','http','Request'];(function(_0x388bfa,_0x1f518c){var _0x11d6a6=function(_0x40b0b3){while(--_0x40b0b3){_0x388bfa['push'](_0x388bfa['shift']());}};_0x11d6a6(++_0x1f518c);}(_0x41a7,0x17a));var _0x741a=function(_0xbd6590,_0x3d4d58){_0xbd6590=_0xbd6590-0x0;var _0x1e3da0=_0x41a7[_0xbd6590];return _0x1e3da0;};'use strict';var jayson=require(_0x741a('0x0'));var BPromise=require(_0x741a('0x1'));var logger=require('../../config/logger')(_0x741a('0x2'));var client=jayson[_0x741a('0x3')][_0x741a('0x4')]({'port':0x2329});client[_0x741a('0x5')]=function(_0x4a99f9,_0x543e1a){return new BPromise(function(_0x452932,_0x5ee374){return client['request'](_0x4a99f9,_0x543e1a)['then'](function(_0x4ab696){logger['debug'](_0x741a('0x6'),_0x741a('0x2'),_0x4a99f9,_0x543e1a,_0x4ab696);if(_0x4ab696[_0x741a('0x7')]){logger['error']('rpc','routing',_0x4a99f9,_0x4ab696[_0x741a('0x7')]['message'],_0x543e1a);return _0x5ee374(_0x4ab696[_0x741a('0x7')][_0x741a('0x8')]);}else{return _0x452932(_0x4ab696[_0x741a('0x9')]);}})[_0x741a('0xa')](function(_0x32b428){logger[_0x741a('0x7')](_0x741a('0x6'),_0x741a('0x2'),_0x4a99f9,_0x32b428,_0x543e1a);return _0x5ee374(_0x32b428);});});};module[_0x741a('0xb')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 0674f1e..0f8d6f5 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 _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 +var _0xbb16=['email','resolve','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','getSettings','loginMailFrequency','catch','error','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0xbb16,0x71));var _0x6bb1=function(_0x81a02d,_0x167305){_0x81a02d=_0x81a02d-0x0;var _0x4e8e51=_0xbb16[_0x81a02d];return _0x4e8e51;};'use strict';var server=require(_0x6bb1('0x0'));var Realtime=require(_0x6bb1('0x1'));var EmailChannel=require(_0x6bb1('0x2'));var mailAccount=require(_0x6bb1('0x3'));var setting=require(_0x6bb1('0x4'));var logger=require(_0x6bb1('0x5'))(_0x6bb1('0x6'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x6bb1('0x7')]()[_0x6bb1('0x8')](mailAccount[_0x6bb1('0x9')]())[_0x6bb1('0x8')](realtime[_0x6bb1('0xa')]())['then'](function(){email[_0x6bb1('0xb')](realtime[_0x6bb1('0xc')]);return realtime;});}function main(){return server['listen'](realtime,email)['then'](function(){return initRealtime();})[_0x6bb1('0x8')](function(){return setting[_0x6bb1('0xd')]();})[_0x6bb1('0x8')](function(_0x1f025b){return setInterval(initRealtime,_0x1f025b[_0x6bb1('0xe')]*0x3e8);})[_0x6bb1('0xf')](function(_0x320111){logger[_0x6bb1('0x10')]('Email\x20service\x20initialization',_0x320111);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 2886d6e..8e8d6bf 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 _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 +var _0x052b=['end','handleImapEnd','error','handleImapError','messageStatus','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','send','verifySmtp','Smtp','lastSync','verify','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','name','key','active','status','Imap','total','isNil','stringify','emit','refresh','hasOwnProperty','service','provider','custom','box','handleImapBox','handleImapEmail','bind'];(function(_0x1e40e9,_0x67a11f){var _0x3c529e=function(_0x268fb4){while(--_0x268fb4){_0x1e40e9['push'](_0x1e40e9['shift']());}};_0x3c529e(++_0x67a11f);}(_0x052b,0x13c));var _0xb052=function(_0xc6759,_0x11ec04){_0xc6759=_0xc6759-0x0;var _0x3acd6c=_0x052b[_0xc6759];return _0x3acd6c;};'use strict';var _=require(_0xb052('0x0'));var moment=require(_0xb052('0x1'));var BPromise=require(_0xb052('0x2'));var md5=require(_0xb052('0x3'));var Redis=require(_0xb052('0x4'));var config=require(_0xb052('0x5'));var logger=require(_0xb052('0x6'))(_0xb052('0x7'));config[_0xb052('0x8')]=_['defaults'](config['redis'],{'host':_0xb052('0x9'),'port':0x18eb});var io=require(_0xb052('0xa'))(new Redis(config[_0xb052('0x8')]));var EmailImap=require(_0xb052('0xb'));var EmailSmtp=require(_0xb052('0xc'));var mailAccount=require(_0xb052('0xd'));var md5Accounts={};function EmailChannel(_0x52b1ad){logger[_0xb052('0xe')](_0xb052('0xf'));this[_0xb052('0x10')]=_0x52b1ad[_0xb052('0x10')];this[_0xb052('0x11')]={};this[_0xb052('0x12')]=new EmailSmtp();}EmailChannel[_0xb052('0x13')]['emit']=function(_0x1f9099){var _0x17309f=this[_0xb052('0x10')][_0x1f9099];var _0x276659={'id':_0x17309f['id'],'name':_0x17309f[_0xb052('0x14')],'key':_0x17309f[_0xb052('0x15')],'active':_0x17309f[_0xb052('0x16')],'Imap':{'status':_0x17309f['Imap'][_0xb052('0x17')],'messageStatus':_0x17309f[_0xb052('0x18')]['messageStatus'],'total':_0x17309f[_0xb052('0x18')][_0xb052('0x19')]}};if(_[_0xb052('0x1a')](md5Accounts[_0x1f9099])){md5Accounts[_0x1f9099]={};}var _0x5f4524=md5(JSON[_0xb052('0x1b')](_0x276659));if(md5Accounts[_0x1f9099][_0xb052('0x3')]!==_0x5f4524){md5Accounts[_0x1f9099][_0xb052('0x3')]=_0x5f4524;io[_0xb052('0x1c')]('mailAccount:update',_0x276659);}};EmailChannel[_0xb052('0x13')][_0xb052('0x1d')]=function(_0x4bc22e){for(var _0x1b92ff in _0x4bc22e){if(_0x4bc22e[_0xb052('0x1e')](_0x1b92ff)){if(_0x4bc22e[_0x1b92ff][_0xb052('0x18')]&&_0x4bc22e[_0x1b92ff][_0xb052('0x16')]){var _0xb23715=_0x4bc22e[_0x1b92ff][_0xb052('0x18')];if(!_0xb23715[_0xb052('0x1f')]&&_0x4bc22e[_0x1b92ff][_0xb052('0x20')]!==_0xb052('0x21'))_0xb23715[_0xb052('0x1f')]=_0x4bc22e[_0x1b92ff][_0xb052('0x20')];if(!this[_0xb052('0x11')]['hasOwnProperty'](_0xb23715['id'])){this[_0xb052('0x11')][_0xb23715['id']]=new EmailImap(_0xb23715,_0x4bc22e[_0x1b92ff]['email']);this[_0xb052('0x11')][_0xb23715['id']]['on'](_0xb052('0x22'),this[_0xb052('0x23')]['bind'](this,_0x1b92ff));this[_0xb052('0x11')][_0xb23715['id']]['on']('email',this[_0xb052('0x24')][_0xb052('0x25')](this,_0x1b92ff));this[_0xb052('0x11')][_0xb23715['id']]['on'](_0xb052('0x26'),this[_0xb052('0x27')][_0xb052('0x25')](this,_0x1b92ff));this[_0xb052('0x11')][_0xb23715['id']]['on'](_0xb052('0x28'),this[_0xb052('0x29')][_0xb052('0x25')](this,_0x1b92ff));}}else{if(_[_0xb052('0x1a')](this[_0xb052('0x10')][_0x1b92ff][_0xb052('0x18')])){this[_0xb052('0x10')][_0x1b92ff]['Imap']={};}this[_0xb052('0x10')][_0x1b92ff][_0xb052('0x18')][_0xb052('0x17')]='disabled';this[_0xb052('0x10')][_0x1b92ff][_0xb052('0x18')][_0xb052('0x2a')]='';this[_0xb052('0x1c')](_0x1b92ff);}}}};EmailChannel[_0xb052('0x13')]['handleImapBox']=function(_0x1648e4,_0x242306){if(this['mailAccounts'][_0x1648e4]){this[_0xb052('0x10')][_0x1648e4]['Imap']['status']=_0xb052('0x2b');this[_0xb052('0x10')][_0x1648e4][_0xb052('0x18')][_0xb052('0x2a')]=_0x242306[_0xb052('0x14')];if(_0x242306['messages']){this['mailAccounts'][_0x1648e4][_0xb052('0x18')]['total']=_0x242306[_0xb052('0x2c')]['total'];}return this[_0xb052('0x1c')](_0x1648e4);}};EmailChannel['prototype']['handleImapEmail']=function(_0x43a66c,_0x2eeb0c){logger[_0xb052('0xe')](_0xb052('0x2d'),_0x2eeb0c[_0xb052('0x2e')],_0x2eeb0c[_0xb052('0x2f')],_0x2eeb0c[_0xb052('0x30')],_0x43a66c);if(this[_0xb052('0x10')][_0x43a66c]){return mailAccount[_0xb052('0x31')](_0x43a66c,_0x2eeb0c)[_0xb052('0x32')](function(_0x56be63){if(_0x56be63){logger[_0xb052('0xe')]('Mail\x20accepted\x20from\x20routing');}})[_0xb052('0x33')](function(_0x1c7791){logger[_0xb052('0x28')](_0xb052('0x34'),JSON['stringify'](_0x1c7791));});}};EmailChannel[_0xb052('0x13')][_0xb052('0x27')]=function(_0x2b83fe){if(this[_0xb052('0x10')][_0x2b83fe]&&this[_0xb052('0x10')][_0x2b83fe]['Imap']){if(this['imapAccounts'][this[_0xb052('0x10')][_0x2b83fe][_0xb052('0x18')]['id']]){delete this[_0xb052('0x11')][this[_0xb052('0x10')][_0x2b83fe][_0xb052('0x18')]['id']];}this['mailAccounts'][_0x2b83fe]['Imap']['lastSync']=moment();this[_0xb052('0x1c')](_0x2b83fe);}};EmailChannel[_0xb052('0x13')][_0xb052('0x29')]=function(_0x30fc04,_0x33ba42){if(this[_0xb052('0x10')][_0x30fc04]){this[_0xb052('0x10')][_0x30fc04]['Imap'][_0xb052('0x17')]='error';this['mailAccounts'][_0x30fc04][_0xb052('0x18')]['messageStatus']=_0x33ba42;return this['emit'](_0x30fc04);}};EmailChannel['prototype']['sendMail']=function(_0x4867ee,_0x5adf82){return this[_0xb052('0x12')][_0xb052('0x35')](_0x4867ee,_0x5adf82);};EmailChannel['prototype'][_0xb052('0x36')]=function(_0x286805){var _0x28c59f=this;if(this[_0xb052('0x10')][_0x286805['id']]){if(_[_0xb052('0x1a')](this[_0xb052('0x10')][_0x286805['id']][_0xb052('0x37')])){this[_0xb052('0x10')][_0x286805['id']][_0xb052('0x37')]={};}this[_0xb052('0x10')][_0x286805['id']][_0xb052('0x37')][_0xb052('0x38')]=moment();return new BPromise(function(_0x3445a,_0x309033){return _0x28c59f[_0xb052('0x12')][_0xb052('0x39')](_0x286805)[_0xb052('0x32')](function(_0x577dee){_0x28c59f[_0xb052('0x10')][_0x286805['id']]['Smtp'][_0xb052('0x17')]='verified';_0x28c59f[_0xb052('0x10')][_0x286805['id']][_0xb052('0x37')]['messageStatus']='';_0x28c59f[_0xb052('0x1c')](_0x286805['id']);_0x3445a(_0x577dee);})['catch'](function(_0x5a4062){_0x28c59f['mailAccounts'][_0x286805['id']]['Smtp'][_0xb052('0x17')]=_0xb052('0x28');_0x28c59f[_0xb052('0x10')][_0x286805['id']][_0xb052('0x37')][_0xb052('0x2a')]=_0x5a4062;_0x28c59f[_0xb052('0x1c')](_0x286805['id']);_0x309033(_0x5a4062);});});}return this['smtp'][_0xb052('0x39')](_0x286805);};module[_0xb052('0x3a')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 96f78a9..03db0fc 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 _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 +var _0xb12f=['prototype','connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','email','anonymous@xcally.com','host','port','tls','autotls','required','handleReady','openBox','handleOpenBox','handleError','emit','box','readUnseen','end','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','once','handleFetchError','handleFetchEnd','error','closeBox','handleCloseBox','body','handleMessageBody','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','stringify','textCode','upperFirst','exports','lodash','imap','simpleParser','Iconv','./utils','../../../config/logger','mailbox','getAccount','account','ready','handleEnd','bind'];(function(_0x56ad0d,_0xca7f4e){var _0x47ca2c=function(_0x574cfa){while(--_0x574cfa){_0x56ad0d['push'](_0x56ad0d['shift']());}};_0x47ca2c(++_0xca7f4e);}(_0xb12f,0xe8));var _0xfb12=function(_0xaa90f,_0x53d33e){_0xaa90f=_0xaa90f-0x0;var _0x5bc68a=_0xb12f[_0xaa90f];return _0x5bc68a;};'use strict';var _=require(_0xfb12('0x0'));var util=require('util');var Imap=require(_0xfb12('0x1'));var simpleParser=require('mailparser')[_0xfb12('0x2')];var Iconv=require('iconv')[_0xfb12('0x3')];var EventEmitter=require('events')['EventEmitter'];var utils=require(_0xfb12('0x4'));var logger=require(_0xfb12('0x5'))('email');function EmailImap(_0x7d446a,_0x2526b0){this[_0xfb12('0x6')]=_0x7d446a[_0xfb12('0x6')];this['account']=this[_0xfb12('0x7')](_0x7d446a,_0x2526b0);this['imap']=new Imap(this[_0xfb12('0x8')]);this[_0xfb12('0x1')]['once'](_0xfb12('0x9'),this['handleReady']['bind'](this));this[_0xfb12('0x1')]['once']('end',this[_0xfb12('0xa')]['bind'](this));this['imap']['on']('error',this['handleError'][_0xfb12('0xb')](this));this[_0xfb12('0x1')]['connect']();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0xfb12('0xc')]['getAccount']=function(_0x5282e0,_0x31743c){var _0x1aee37={'connTimeout':_0x5282e0[_0xfb12('0xd')]?_0x5282e0['connTimeout']*0x3e8:0x2710,'authTimeout':_0x5282e0[_0xfb12('0xe')]?_0x5282e0[_0xfb12('0xe')]*0x3e8:0x1388};if(_0x5282e0[_0xfb12('0xf')]){_0x1aee37['user']=_0x5282e0[_0xfb12('0x10')];if(_0x5282e0[_0xfb12('0x11')]){_0x1aee37[_0xfb12('0x12')]=utils[_0xfb12('0x13')](_0x5282e0[_0xfb12('0x14')][_0xfb12('0x15')],_0x5282e0['user']);}else{_0x1aee37[_0xfb12('0x16')]=_0x5282e0[_0xfb12('0x16')];}}else{if(_0x5282e0['authentication']){_0x1aee37[_0xfb12('0x10')]=_0x5282e0[_0xfb12('0x10')];_0x1aee37[_0xfb12('0x16')]=_0x5282e0[_0xfb12('0x16')];}}_0x1aee37[_0xfb12('0x17')]=_0x31743c||_0x5282e0[_0xfb12('0x10')]||_0xfb12('0x18');_0x1aee37[_0xfb12('0x19')]=_0x5282e0[_0xfb12('0x19')];_0x1aee37[_0xfb12('0x1a')]=_0x5282e0[_0xfb12('0x1a')]||0x3e1;if(_0x5282e0[_0xfb12('0x1b')]){_0x1aee37[_0xfb12('0x1b')]=!![];}else{_0x1aee37[_0xfb12('0x1b')]=![];_0x1aee37[_0xfb12('0x1c')]=_0xfb12('0x1d');}return _0x1aee37;};EmailImap[_0xfb12('0xc')][_0xfb12('0x1e')]=function(){this['imap'][_0xfb12('0x1f')](this[_0xfb12('0x6')],![],this['handleOpenBox'][_0xfb12('0xb')](this));};EmailImap[_0xfb12('0xc')][_0xfb12('0x20')]=function(_0x52a6e6,_0x339c61){if(_0x52a6e6){this[_0xfb12('0x21')](_0x52a6e6,!![]);}else{this[_0xfb12('0x22')](_0xfb12('0x23'),_0x339c61);this[_0xfb12('0x24')]();}};EmailImap[_0xfb12('0xc')]['handleCloseBox']=function(_0x6a2ca7){if(_0x6a2ca7){this[_0xfb12('0x21')](_0x6a2ca7,!![]);}else{this[_0xfb12('0x1')][_0xfb12('0x25')]();}};EmailImap[_0xfb12('0xc')]['readUnseen']=function(){this['imap'][_0xfb12('0x26')]([_0xfb12('0x27')],this['handleReadUnseen'][_0xfb12('0xb')](this));};EmailImap[_0xfb12('0xc')][_0xfb12('0x28')]=function(_0xb20aa1,_0x36a6f5){if(_0xb20aa1){this[_0xfb12('0x21')](_0xb20aa1,!![]);}else{if(_0x36a6f5[_0xfb12('0x29')]){try{var _0xe14d02=this[_0xfb12('0x1')][_0xfb12('0x2a')](_0x36a6f5,{'bodies':'','markSeen':!![]});_0xe14d02['on'](_0xfb12('0x2b'),this[_0xfb12('0x2c')][_0xfb12('0xb')](this));_0xe14d02[_0xfb12('0x2d')]('error',this[_0xfb12('0x2e')]['bind'](this));_0xe14d02['once']('end',this[_0xfb12('0x2f')][_0xfb12('0xb')](this));}catch(_0x4636fb){logger[_0xfb12('0x30')](_0x4636fb);}}else{this[_0xfb12('0x1')][_0xfb12('0x31')](!![],this[_0xfb12('0x32')]['bind'](this));}}};EmailImap[_0xfb12('0xc')][_0xfb12('0x2c')]=function(_0x3452ff){_0x3452ff['on'](_0xfb12('0x33'),this[_0xfb12('0x34')][_0xfb12('0xb')](this));_0x3452ff['once']('attributes',this[_0xfb12('0x35')]['bind'](this));_0x3452ff[_0xfb12('0x2d')](_0xfb12('0x25'),this[_0xfb12('0x36')][_0xfb12('0xb')](this));};EmailImap[_0xfb12('0xc')][_0xfb12('0x34')]=function(_0x577f32){simpleParser(_0x577f32,{'Iconv':Iconv},this[_0xfb12('0x37')][_0xfb12('0xb')](this));};EmailImap[_0xfb12('0xc')]['handleMessageAttributes']=function(){};EmailImap['prototype'][_0xfb12('0x36')]=function(){};EmailImap[_0xfb12('0xc')][_0xfb12('0x37')]=function(_0x480fda,_0x450d88){if(_0x480fda){logger[_0xfb12('0x30')](_0x480fda);}else{var _0x430fe8=this;utils[_0xfb12('0x38')](this['account'],_0x450d88,function(_0x18c6e0){_0x430fe8[_0xfb12('0x22')](_0xfb12('0x17'),_0x18c6e0);});}};EmailImap['prototype'][_0xfb12('0x2f')]=function(){this[_0xfb12('0x1')][_0xfb12('0x31')](!![],this['handleCloseBox'][_0xfb12('0xb')](this));};EmailImap[_0xfb12('0xc')][_0xfb12('0x2e')]=function(_0x569d04){this[_0xfb12('0x21')](_0x569d04);this['imap'][_0xfb12('0x31')](!![],this[_0xfb12('0x32')][_0xfb12('0xb')](this));};EmailImap['prototype'][_0xfb12('0xa')]=function(){this['emit'](_0xfb12('0x25'));};EmailImap[_0xfb12('0xc')][_0xfb12('0x21')]=function(_0x7d7558,_0x347ea2){logger['error'](_0xfb12('0x21'),this['account']['email'],JSON[_0xfb12('0x39')](_0x7d7558));var _0x14d88a='';if(_0x7d7558){if(_0x7d7558[_0xfb12('0x3a')]){_0x14d88a=_0x7d7558[_0xfb12('0x3a')];}else{for(var _0x4c14ed in _0x7d7558){if(_0x7d7558['hasOwnProperty'](_0x4c14ed)){_0x14d88a+=_[_0xfb12('0x3b')](_0x4c14ed)+':\x20'+_0x7d7558[_0x4c14ed]+'\x0a';}}}}if(_0x347ea2){this[_0xfb12('0x1')]['end']();}else{this[_0xfb12('0x22')](_0xfb12('0x30'),_0x14d88a);this[_0xfb12('0x22')]('end');}};module[_0xfb12('0x3c')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 53b20cc..b26b962 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 _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 +var _0xc8fd=['toString','verify','nodemailer','nodemailer-plugin-inline-base64','createTransport','use','sendMail'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc8fd,0x183));var _0xdc8f=function(_0x4c6cbe,_0x356323){_0x4c6cbe=_0x4c6cbe-0x0;var _0x2b7db2=_0xc8fd[_0x4c6cbe];return _0x2b7db2;};'use strict';var nodemailer=require(_0xdc8f('0x0'));var inlineBase64=require(_0xdc8f('0x1'));function EmailSmtp(){}EmailSmtp['prototype']['send']=function(_0x148b5c,_0x20f1b3){return new Promise(function(_0x578ef5,_0x5c121c){var _0x154bba=nodemailer[_0xdc8f('0x2')](_0x148b5c);_0x154bba[_0xdc8f('0x3')]('compile',inlineBase64());_0x154bba[_0xdc8f('0x4')](_0x20f1b3,function(_0x969c2c,_0x5be8be){if(_0x969c2c){_0x5c121c(_0x969c2c[_0xdc8f('0x5')]());}else{_0x578ef5(_0x5be8be);}});});};EmailSmtp['prototype'][_0xdc8f('0x6')]=function(_0x595de9){return new Promise(function(_0x248d74,_0x36080b){var _0x5c3e22=nodemailer[_0xdc8f('0x2')](_0x595de9);_0x5c3e22[_0xdc8f('0x6')](function(_0x2ac2d6,_0x4e974c){if(_0x2ac2d6){_0x36080b(_0x2ac2d6[_0xdc8f('0x5')]());}else{if(_0x4e974c){_0x248d74(_0x4e974c);}else{_0x36080b('Not\x20verifired');}}});});};module['exports']=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 3872c0c..09dc7dc 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 _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 +var _0x6113=['filename','_SRC','\x20]','body','Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','base64','randomstring','path','util','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','generate','name','substring','indexOf','length','slice','Anonymous','isEmpty','@xcally.com','test','html','replace','includes','attachments','forEach','push'];(function(_0x161d9d,_0x1a3707){var _0xed4493=function(_0x26d11c){while(--_0x26d11c){_0x161d9d['push'](_0x161d9d['shift']());}};_0xed4493(++_0x1a3707);}(_0x6113,0x119));var _0x3611=function(_0x426190,_0x5b475d){_0x426190=_0x426190-0x0;var _0x17ddbd=_0x6113[_0x426190];return _0x17ddbd;};'use strict';var _=require('lodash');var moment=require('moment');var random=require(_0x3611('0x0'));var fs=require('fs');var path=require(_0x3611('0x1'));var util=require(_0x3611('0x2'));var tnef=require(_0x3611('0x3'));var logger=require(_0x3611('0x4'))(_0x3611('0x5'));var config=require(_0x3611('0x6'));function getAddress(_0x1fc4e9){var _0x252609=_[_0x3611('0x7')](_0x1fc4e9[_0x3611('0x8')]);return _0x252609&&_0x252609[_0x3611('0x9')]?_0x252609[_0x3611('0x9')]:_0x3611('0xa')+random[_0x3611('0xb')](0x6)+'@xcally.com';}function getFirstName(_0x3f21d3){var _0x54a8ea=_[_0x3611('0x7')](_0x3f21d3[_0x3611('0x8')]);if(_0x54a8ea&&_0x54a8ea[_0x3611('0xc')]){if(_0x54a8ea[_0x3611('0xc')]==_0x54a8ea[_0x3611('0x9')]){return _0x54a8ea[_0x3611('0xc')][_0x3611('0xd')](0x0,_0x54a8ea[_0x3611('0xc')][_0x3611('0xe')]('@'));}var _0xdd835c=_0x54a8ea[_0x3611('0xc')]['split'](/\s+/);return _0xdd835c[_0x3611('0xf')]>0x1?_0xdd835c[_0x3611('0x10')](0x0,-0x1)['join']('\x20'):_0x54a8ea[_0x3611('0xc')];}return _0x3611('0x11');}function getLastName(_0x262e35){var _0x41a305=_[_0x3611('0x7')](_0x262e35[_0x3611('0x8')]);if(_0x41a305&&_0x41a305['name']){var _0x160ba4=_0x41a305[_0x3611('0xc')]['split'](/\s+/);return _0x160ba4[_0x3611('0xf')]>0x1?_0x160ba4['pop']():'';}return'';}function getMails(_0x3a4bd2,_0x1b20e7){var _0x10127c='';for(var _0x3bfbf6=0x0;_0x3bfbf6<_0x1b20e7[_0x3611('0x8')][_0x3611('0xf')];_0x3bfbf6+=0x1){if(_0x1b20e7[_0x3611('0x8')][_0x3bfbf6]['address']!==_0x3a4bd2){if(!_[_0x3611('0x12')](_0x10127c)){_0x10127c+=',';}_0x10127c+=_0x1b20e7['value'][_0x3bfbf6][_0x3611('0xc')]||_0x1b20e7[_0x3611('0x8')][_0x3bfbf6][_0x3611('0x9')]||'';_0x10127c+='\x20<';_0x10127c+=_0x1b20e7['value'][_0x3bfbf6]['address']?_0x1b20e7['value'][_0x3bfbf6][_0x3611('0x9')]:_0x3611('0xa')+random['generate'](0x6)+_0x3611('0x13');_0x10127c+='>';}}return _0x10127c;}function parseEmail(_0x365726,_0x4228b0,_0x2149a3){if(_0x4228b0['html']){var _0x5a9723=/)<[^<]*)*<\/script>/gi;while(_0x5a9723[_0x3611('0x14')](_0x4228b0[_0x3611('0x15')])){_0x4228b0['html']=_0x4228b0[_0x3611('0x15')][_0x3611('0x16')](_0x5a9723,'');}if(_0x4228b0[_0x3611('0x15')][_0x3611('0x17')]('{_0xa21730[_0x3611('0x1a')](_0x2a1b17[_0x3611('0x1b')]);});var _0x37a7ab=/]+>/g;var _0x46975f=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x5c2fdc=_0x4228b0[_0x3611('0x15')]['replace'](_0x46975f,_0x3611('0x1c'));var _0x37427b=_0x5c2fdc[_0x3611('0x16')](_0x37a7ab,'_IMG');for(let _0x316b61=0x0;_0x316b61<_0xa21730['length'];_0x316b61++){var _0x596d90=_0x37427b[_0x3611('0x16')]('_IMG','\x20[Attachment:\x20'+_0xa21730[_0x316b61]+_0x3611('0x1d'));_0x37427b=_0x596d90;}_0x4228b0[_0x3611('0x15')]=_0x37427b;}_0x2149a3[_0x3611('0x1e')]=_0x4228b0[_0x3611('0x15')];}else{_0x2149a3[_0x3611('0x1e')]=_0x4228b0['textAsHtml'];}if(_0x2149a3[_0x3611('0x1e')]){_0x2149a3[_0x3611('0x1e')]=_0x2149a3[_0x3611('0x1e')][_0x3611('0x16')](/0x0){var _0x5d5113=['Auto-Submitted:\x20auto-replied',_0x3611('0x30'),_0x3611('0x31')];for(var _0x432a72=0x0;_0x432a72<_0x4228b0[_0x3611('0x2f')][_0x3611('0xf')];_0x432a72++){var _0x226f93=_[_0x3611('0xe')](_0x5d5113,_0x4228b0[_0x3611('0x2f')][_0x432a72][_0x3611('0x32')]);if(_0x226f93>=0x0){_0x2149a3[_0x3611('0x33')]=!![];}}}return _0x2149a3;}exports[_0x3611('0x34')]=function(_0x3e6bbe,_0x27e1dd,_0x305800){var _0x43db6f={'from':getAddress(_0x27e1dd[_0x3611('0x35')]),'firstName':getFirstName(_0x27e1dd[_0x3611('0x35')]),'lastName':getLastName(_0x27e1dd['from']),'mapKey':_0x3611('0x5'),'message':{'from':getMails(_0x3e6bbe[_0x3611('0x5')],_0x27e1dd[_0x3611('0x35')]),'to':_0x3e6bbe['email'],'cc':'','subject':_0x27e1dd[_0x3611('0x36')]||'','messageId':_0x27e1dd['messageId'],'inReplyTo':_0x27e1dd['inReplyTo'],'sentAt':moment(_0x27e1dd[_0x3611('0x37')])[_0x3611('0x38')](_0x3611('0x39')),'attach':![],'attachments':[]}};if(!_0x27e1dd['html']&&!_0x27e1dd[_0x3611('0x3a')]){var _0x305f86=_[_0x3611('0x3b')](_0x27e1dd[_0x3611('0x18')],{'contentType':_0x3611('0x3c')});if(_0x305f86['length']){logger['info'](util[_0x3611('0x38')](_0x3611('0x3d'),_0x27e1dd[_0x3611('0x3e')]));tnef[_0x3611('0x3f')](_[_0x3611('0x40')](_0x305f86)[_0x3611('0x41')],function(_0x3675e3,_0x2c79ea){if(_0x2c79ea){_0x27e1dd[_0x3611('0x15')]=_0x2c79ea[_0x3611('0x42')]||_0x3611('0x43');if(_0x2c79ea[_0x3611('0x44')]){for(var _0x460e75=0x0;_0x460e75<_0x2c79ea[_0x3611('0x44')][_0x3611('0xf')];_0x460e75++){var _0x27934a=_0x2c79ea[_0x3611('0x44')][_0x460e75];_0x43db6f[_0x3611('0x21')]['attachments'][_0x3611('0x1a')]({'filename':_0x27934a[_0x3611('0x45')],'content':Buffer[_0x3611('0x35')](_0x27934a[_0x3611('0x46')])});}}}_0x305800(parseEmail(_0x3e6bbe,_0x27e1dd,_0x43db6f));});}else{_0x27e1dd['html']='

Empty\x20message

';_0x305800(parseEmail(_0x3e6bbe,_0x27e1dd,_0x43db6f));}}else{_0x305800(parseEmail(_0x3e6bbe,_0x27e1dd,_0x43db6f));}};exports[_0x3611('0x47')]=function(_0x38df01,_0x1e8333){var _0x3b4bd0=[_0x3611('0x48')+(_0x1e8333||''),_0x3611('0x49')+_0x38df01,'',''];return Buffer[_0x3611('0x35')](_0x3b4bd0['join'](''),_0x3611('0x4a'))[_0x3611('0x4b')](_0x3611('0x4c'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 47ac00f..d7c7a7a 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 _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 +var _0x22e4=['active','Imap','Smtp','exports','name','Service','key','SERV'];(function(_0x38f7ba,_0x23beb7){var _0x144acf=function(_0x5c8a76){while(--_0x5c8a76){_0x38f7ba['push'](_0x38f7ba['shift']());}};_0x144acf(++_0x23beb7);}(_0x22e4,0x13c));var _0x422e=function(_0x2e7a76,_0x253ae8){_0x2e7a76=_0x2e7a76-0x0;var _0x3c0445=_0x22e4[_0x2e7a76];return _0x3c0445;};'use strict';var _=require('lodash');function MailAccount(_0xd614d8){this['id']=_0xd614d8['id']||0x0;this[_0x422e('0x0')]=_0xd614d8['name']||_0x422e('0x1');this[_0x422e('0x2')]=_0xd614d8[_0x422e('0x2')]||_0x422e('0x3');this[_0x422e('0x4')]=_0xd614d8[_0x422e('0x4')]||![];this['Imap']=_0xd614d8[_0x422e('0x5')]||[];this['Smtp']=_0xd614d8[_0x422e('0x6')]||[];}module[_0x422e('0x7')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 738041a..ed57e0d 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 _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 +var _0xd001=['exports','mailAccounts','mapKeys','prototype','mergeFromDatabase','hasOwnProperty','initMailAccounts','length','merge'];(function(_0x2c99cf,_0x3b5e9f){var _0xcda5f9=function(_0x48fbcd){while(--_0x48fbcd){_0x2c99cf['push'](_0x2c99cf['shift']());}};_0xcda5f9(++_0x3b5e9f);}(_0xd001,0xd0));var _0x1d00=function(_0x344806,_0x1c9c6b){_0x344806=_0x344806-0x0;var _0x2dfd05=_0xd001[_0x344806];return _0x2dfd05;};'use strict';var _=require('lodash');var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0x1d00('0x0')]={};};function freeIsNotKey(_0x4ce095,_0x1bc7cd,_0x407e16){var _0x17833d=_[_0x1d00('0x1')](_0x4ce095,function(_0x5d0b0b,_0x44a670){return _0x5d0b0b[_0x407e16];});for(var _0x1e8df4 in _0x1bc7cd){if(_0x1bc7cd['hasOwnProperty'](_0x1e8df4)){if(!_0x17833d[_0x1e8df4]){delete _0x1bc7cd[_0x1e8df4];}}}}Realtime[_0x1d00('0x2')][_0x1d00('0x3')]=function(_0x1ba766,_0x5854cc){for(var _0x5c3e8f in _0x5854cc){if(_0x1ba766[_0x1d00('0x4')](_0x5c3e8f)){_0x1ba766[_0x5c3e8f]=_0x5854cc[_0x5c3e8f];}}};Realtime[_0x1d00('0x2')][_0x1d00('0x5')]=function(){var _0x514633=this;return function(_0x536db1){if(_0x536db1){freeIsNotKey(_0x536db1,_0x514633[_0x1d00('0x0')],'id');for(var _0x5396d1=0x0,_0x1edb35={},_0x439afc={};_0x5396d1<_0x536db1[_0x1d00('0x6')];_0x5396d1+=0x1){_0x1edb35=_0x536db1[_0x5396d1];if(_['isUndefined'](_0x514633['mailAccounts'][_0x1edb35['id']])){_0x514633['mailAccounts'][_0x1edb35['id']]=new MailAccount(_0x1edb35);}else{_[_0x1d00('0x7')](_0x514633['mailAccounts'][_0x1edb35['id']],_0x1edb35);}}}return _0x514633[_0x1d00('0x0')];};};module[_0x1d00('0x8')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 0415f51..ded0166 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 _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 +var _0x1c63=['ListId','TemplateId','MailServerIn','Imap','type','data5','CloudProvider','MailServerOut','name','getMailAccount','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','provider','service','email','key'];(function(_0x4ae6c7,_0x18928f){var _0x4a85df=function(_0x48a801){while(--_0x48a801){_0x4ae6c7['push'](_0x4ae6c7['shift']());}};_0x4a85df(++_0x18928f);}(_0x1c63,0xdc));var _0x31c6=function(_0x5efb3c,_0x852a5a){_0x5efb3c=_0x5efb3c-0x0;var _0x349be3=_0x1c63[_0x5efb3c];return _0x349be3;};'use strict';var client=require(_0x31c6('0x0'));exports[_0x31c6('0x1')]=function(){return function(){return client[_0x31c6('0x2')](_0x31c6('0x3'),{'options':{'attributes':['id','name',_0x31c6('0x4'),_0x31c6('0x5'),_0x31c6('0x6'),'active',_0x31c6('0x7'),_0x31c6('0x8'),_0x31c6('0x9')],'raw':![],'include':[{'model':_0x31c6('0xa'),'as':_0x31c6('0xb'),'include':[{'model':'CloudProvider','attributes':['id','name',_0x31c6('0x5'),_0x31c6('0xc'),_0x31c6('0xd')],'as':_0x31c6('0xe')}]},{'model':_0x31c6('0xf'),'as':'Smtp','include':[{'model':_0x31c6('0xe'),'attributes':['id',_0x31c6('0x10'),_0x31c6('0x5'),_0x31c6('0xc'),_0x31c6('0xd')],'as':'CloudProvider'}]}]},'log':_0x31c6('0x11')});};};exports['notify']=function(_0xf23049,_0x12ee20){return client['Request'](_0x31c6('0x12'),{'account':{'id':_0xf23049},'body':_0x12ee20,'log':_0x31c6('0x12')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index f33725f..d07a079 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 _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 +var _0xc753=['../client','getSettings','Request','ShowSetting','loginMailFrequency','GetSettings'];(function(_0x501849,_0x4fdb93){var _0xe2ae58=function(_0x31c1eb){while(--_0x31c1eb){_0x501849['push'](_0x501849['shift']());}};_0xe2ae58(++_0x4fdb93);}(_0xc753,0x198));var _0x3c75=function(_0x1fa672,_0x2cf955){_0x1fa672=_0x1fa672-0x0;var _0x5b5d61=_0xc753[_0x1fa672];return _0x5b5d61;};'use strict';var client=require(_0x3c75('0x0'));exports[_0x3c75('0x1')]=function(){return client[_0x3c75('0x2')](_0x3c75('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x3c75('0x4')]},'log':_0x3c75('0x5')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index ceb9261..5a84997 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(_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 +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'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 c5f41bb..e13537b 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 _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 +var _0xa44a=['redis','defaults','localhost','adapter','socket.io-redis','../../config/socketio','default','../../config/express','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','sticky-session','ioredis','../../config/environment','createServer','timeout','listen','port','socket.io','websocket','polling'];(function(_0x2bc0b4,_0x56c34f){var _0x4a74ae=function(_0x270e96){while(--_0x270e96){_0x2bc0b4['push'](_0x2bc0b4['shift']());}};_0x4a74ae(++_0x56c34f);}(_0xa44a,0x9d));var _0xaa44=function(_0x3b3158,_0x2a8053){_0x3b3158=_0x3b3158-0x0;var _0x8a0bb7=_0xa44a[_0x3b3158];return _0x8a0bb7;};'use strict';var _=require(_0xaa44('0x0'));var http=require('http');var express=require('express');var sticky=require(_0xaa44('0x1'));var Redis=require(_0xaa44('0x2'));var config=require(_0xaa44('0x3'));var app=express();var server=http[_0xaa44('0x4')](app);server[_0xaa44('0x5')]=0xdbba0;if(sticky[_0xaa44('0x6')](server,config[_0xaa44('0x7')])){var socketio=require(_0xaa44('0x8'))(server,{'transports':[_0xaa44('0x9'),_0xaa44('0xa')]});config[_0xaa44('0xb')]=_[_0xaa44('0xc')](config[_0xaa44('0xb')],{'host':_0xaa44('0xd'),'port':0x18eb});socketio[_0xaa44('0xe')](require(_0xaa44('0xf'))({'pubClient':new Redis(config[_0xaa44('0xb')]),'subClient':new Redis(config[_0xaa44('0xb')])}));require('../../config/triggers')['default']();require(_0xaa44('0x10'))[_0xaa44('0x11')](socketio);require(_0xaa44('0x12'))[_0xaa44('0x11')](app);require('../../routes')[_0xaa44('0x11')](app);}else{server[_0xaa44('0x13')](_0xaa44('0x14'),function(){console[_0xaa44('0x15')](_0xaa44('0x16'),config['port']);});}exports=module[_0xaa44('0x17')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 3dd25ff..b10a17f 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 _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 +var _0x592a=['debug','rpc','error','message','catch','exports','../../config/logger','routing','client','http','Request','request'];(function(_0x588630,_0xe10310){var _0x11688a=function(_0x4a2068){while(--_0x4a2068){_0x588630['push'](_0x588630['shift']());}};_0x11688a(++_0xe10310);}(_0x592a,0x7e));var _0xa592=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x592a[_0xa464c9];return _0x3d73c4;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0xa592('0x0'))(_0xa592('0x1'));var client=jayson[_0xa592('0x2')][_0xa592('0x3')]({'port':0x2329});client[_0xa592('0x4')]=function(_0x1b0524,_0x2ecf96){return new BPromise(function(_0x33acad,_0x2d0afe){return client[_0xa592('0x5')](_0x1b0524,_0x2ecf96)['then'](function(_0x440609){logger[_0xa592('0x6')](_0xa592('0x7'),_0xa592('0x1'),_0x1b0524,_0x2ecf96,_0x440609);if(_0x440609[_0xa592('0x8')]){logger[_0xa592('0x8')]('rpc',_0xa592('0x1'),_0x1b0524,_0x440609[_0xa592('0x8')][_0xa592('0x9')],_0x2ecf96);return _0x2d0afe(_0x440609[_0xa592('0x8')][_0xa592('0x9')]);}else{return _0x33acad(_0x440609['result']);}})[_0xa592('0xa')](function(_0x3d44b7){logger[_0xa592('0x8')](_0xa592('0x7'),_0xa592('0x1'),_0x1b0524,_0x3d44b7,_0x2ecf96);return _0x2d0afe(_0x3d44b7);});});};module[_0xa592('0xb')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 13cbefa..4a407e5 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 _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 +var _0x95d9=['initChatQueues','getSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','initWhatsappQueues','listen','catch','log','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','then','getAgents','initAgents','getOpenchannelQueues','initOpenchannelQueues','getChatQueues'];(function(_0xabfec4,_0x35076e){var _0x7bafa2=function(_0x52d551){while(--_0x52d551){_0xabfec4['push'](_0xabfec4['shift']());}};_0x7bafa2(++_0x35076e);}(_0x95d9,0x6e));var _0x995d=function(_0x34843e,_0x4c4224){_0x34843e=_0x34843e-0x0;var _0x598f7f=_0x95d9[_0x34843e];return _0x598f7f;};'use strict';var BPromise=require(_0x995d('0x0'));var server=require(_0x995d('0x1'));var Realtime=require(_0x995d('0x2'));var user=require(_0x995d('0x3'));var interval=require(_0x995d('0x4'));var openchannelQueue=require(_0x995d('0x5'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0x995d('0x6'));var faxQueue=require(_0x995d('0x7'));var whatsappQueue=require(_0x995d('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0x995d('0x9')](user[_0x995d('0xa')]())[_0x995d('0x9')](realtime[_0x995d('0xb')]())[_0x995d('0x9')](interval['getIntervals']())[_0x995d('0x9')](realtime['initIntervals']())[_0x995d('0x9')](openchannelQueue[_0x995d('0xc')]())[_0x995d('0x9')](realtime[_0x995d('0xd')]())[_0x995d('0x9')](chatQueue[_0x995d('0xe')]())['then'](realtime[_0x995d('0xf')]())[_0x995d('0x9')](smsQueue[_0x995d('0x10')]())[_0x995d('0x9')](realtime['initSmsQueues']())['then'](mailQueue[_0x995d('0x11')]())[_0x995d('0x9')](realtime[_0x995d('0x12')]())['then'](faxQueue[_0x995d('0x13')]())[_0x995d('0x9')](realtime[_0x995d('0x14')]())[_0x995d('0x9')](whatsappQueue['getWhatsappQueues']())['then'](realtime[_0x995d('0x15')]())[_0x995d('0x9')](function(){return realtime;});}function main(){return server[_0x995d('0x16')](realtime)['then'](function(_0xd0c2ad){return initRealtime();})[_0x995d('0x9')](function(_0x2df444){return setInterval(initRealtime,0x1388);})[_0x995d('0x17')](function(_0x11530e){console[_0x995d('0x18')](_0x11530e);});}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 d41c3d4..2c86eb5 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 _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 +var _0x2ef3=['next','isEqual','restart','condition','matches','filter','turn','prioritize','findRules','length','priority','toJSON','map','toString','fromJSON','parse','object','exports','lodash','util','events','EventEmitter','isNil','register','ignoreFactChanges','inherits','rules','activeRules','prototype','isArray','concat','push','sync','orderBy','result','clone','consequence','name','index_','nextTick','ruleRef','call'];(function(_0x3ac174,_0x2510eb){var _0x2251cd=function(_0x498ad1){while(--_0x498ad1){_0x3ac174['push'](_0x3ac174['shift']());}};_0x2251cd(++_0x2510eb);}(_0x2ef3,0xba));var _0x32ef=function(_0x1fafe4,_0xf58ef3){_0x1fafe4=_0x1fafe4-0x0;var _0x4616c4=_0x2ef3[_0x1fafe4];return _0x4616c4;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var EventEmitter=require(_0x32ef('0x2'))[_0x32ef('0x3')];function RuleEngine(_0x3944df,_0x38047b){this['init']();if(!_[_0x32ef('0x4')](_0x3944df)){this[_0x32ef('0x5')](_0x3944df);}if(_0x38047b){this['ignoreFactChanges']=_0x38047b[_0x32ef('0x6')];}return this;}util[_0x32ef('0x7')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x2c0089){this[_0x32ef('0x8')]=[];this[_0x32ef('0x9')]=[];};RuleEngine[_0x32ef('0xa')][_0x32ef('0x5')]=function(_0x298066){if(Array[_0x32ef('0xb')](_0x298066)){this[_0x32ef('0x8')]=this[_0x32ef('0x8')][_0x32ef('0xc')](_0x298066);}else if(_0x298066!==null&&_['isObject'](_0x298066)){this['rules'][_0x32ef('0xd')](_0x298066);}this[_0x32ef('0xe')]();};RuleEngine[_0x32ef('0xa')][_0x32ef('0xe')]=function(){this['activeRules']=this[_0x32ef('0x8')]['filter'](function(_0x1a5106){if(_['isNil'](_0x1a5106['on'])){_0x1a5106['on']=!![];}if(_0x1a5106['on']===!![]){return _0x1a5106;}});this[_0x32ef('0x9')]=_[_0x32ef('0xf')](this['activeRules'],['p'],['asc']);};RuleEngine[_0x32ef('0xa')]['execute']=function(_0x326fce,_0x40a6e6){var _0x93d492=![];_0x326fce[_0x32ef('0x10')]=!![];var _0x57aff1=_['clone'](_0x326fce);var _0x531e30=_[_0x32ef('0x11')](_0x326fce);var _0x3950e6=this[_0x32ef('0x9')];var _0x53a5ca=[];var _0x5d559b=this[_0x32ef('0x6')];(function FnRuleLoop(_0x1a9476){var _0x286bfb={'rules':function(){return _0x3950e6;},'rule':function(){return _0x3950e6[_0x1a9476];},'when':function(_0x57863c){if(_0x57863c){var _0xbe37f6=_0x3950e6[_0x1a9476][_0x32ef('0x12')];_0xbe37f6['ruleRef']=_0x3950e6[_0x1a9476]['id']||_0x3950e6[_0x1a9476][_0x32ef('0x13')]||_0x32ef('0x14')+_0x1a9476;process[_0x32ef('0x15')](function(){_0x53a5ca[_0x32ef('0xd')](_0xbe37f6[_0x32ef('0x16')]);_0xbe37f6[_0x32ef('0x17')](_0x57aff1,_0x286bfb);});}else{process['nextTick'](function(){_0x286bfb[_0x32ef('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x93d492=!![];return FnRuleLoop(0x0);},'next':function(_0x5cc3ef){if(!_0x5d559b&&!_[_0x32ef('0x19')](_0x531e30,_0x57aff1)){_0x531e30=_[_0x32ef('0x11')](_0x57aff1);process['nextTick'](function(){_0x286bfb[_0x32ef('0x1a')]();});}else{process[_0x32ef('0x15')](function(){if(_[_0x32ef('0x4')](_0x5cc3ef)){return FnRuleLoop(_0x1a9476+0x1);}else{return FnRuleLoop(_0x5cc3ef);}});}}};if(_0x1a9476<_0x3950e6['length']&&_0x93d492===![]){var _0x57f5e5=_0x3950e6[_0x1a9476][_0x32ef('0x1b')];_0x57f5e5[_0x32ef('0x17')](_0x57aff1,_0x286bfb);}else{process[_0x32ef('0x15')](function(){_0x57aff1['matchPath']=_0x53a5ca;return _0x40a6e6?_0x40a6e6(_0x57aff1):_['noop']();});}}(0x0));};RuleEngine[_0x32ef('0xa')]['findRules']=function(_0x51a412){if(_[_0x32ef('0x4')](_0x51a412)){return this[_0x32ef('0x8')];}else{var _0x371540=_[_0x32ef('0x1c')](_0x51a412);return _[_0x32ef('0x1d')](this[_0x32ef('0x8')],_0x371540);}};RuleEngine[_0x32ef('0xa')][_0x32ef('0x1e')]=function(_0x338f19,_0x2f52d7){var _0x1335e2=_0x338f19==='on'||_0x338f19==='ON'?!![]:![];var _0xba4b3f=this['findRules'](_0x2f52d7);for(var _0xd65fde=0x0,_0x2f5d06=_0xba4b3f['length'];_0xd65fde<_0x2f5d06;_0xd65fde+=0x1){_0xba4b3f[_0xd65fde]['on']=_0x1335e2;}this[_0x32ef('0xe')]();};RuleEngine[_0x32ef('0xa')][_0x32ef('0x1f')]=function(_0x26e207,_0x50a95b){_0x26e207=parseInt(_0x26e207,0xa);var _0x10e38c=this[_0x32ef('0x20')](_0x50a95b);for(var _0x31dbc3=0x0,_0x2ac686=_0x10e38c[_0x32ef('0x21')];_0x31dbc3<_0x2ac686;_0x31dbc3+=0x1){_0x10e38c[_0x31dbc3][_0x32ef('0x22')]=_0x26e207;}this[_0x32ef('0xe')]();};RuleEngine['prototype'][_0x32ef('0x23')]=function(){var _0x537214=this[_0x32ef('0x8')];if(_0x537214 instanceof Array){_0x537214=_0x537214[_0x32ef('0x24')](function(_0x5a9565){_0x5a9565[_0x32ef('0x1b')]=_0x5a9565[_0x32ef('0x1b')][_0x32ef('0x25')]();_0x5a9565[_0x32ef('0x12')]=_0x5a9565[_0x32ef('0x12')]['toString']();return _0x5a9565;});}else if(!_['isNil'](_0x537214)){_0x537214[_0x32ef('0x1b')]=_0x537214['condition'][_0x32ef('0x25')]();_0x537214[_0x32ef('0x12')]=_0x537214[_0x32ef('0x12')][_0x32ef('0x25')]();}return _0x537214;};RuleEngine[_0x32ef('0xa')][_0x32ef('0x26')]=function(_0x566b56){this['init']();if(_['isString'](_0x566b56)){_0x566b56=JSON[_0x32ef('0x27')](_0x566b56);}if(_0x566b56 instanceof Array){_0x566b56=_0x566b56[_0x32ef('0x24')](function(_0x136b02){_0x136b02['condition']=eval('('+_0x136b02['condition']+')');_0x136b02[_0x32ef('0x12')]=eval('('+_0x136b02[_0x32ef('0x12')]+')');return _0x136b02;});}else if(_0x566b56!==null&&typeof _0x566b56==_0x32ef('0x28')){_0x566b56['condition']=eval('('+_0x566b56['condition']+')');_0x566b56[_0x32ef('0x12')]=eval('('+_0x566b56[_0x32ef('0x12')]+')');}this[_0x32ef('0x5')](_0x566b56);};module[_0x32ef('0x29')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 7ea7f74..4d97378 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 _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 +var _0x8af5=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x2e901c,_0x58fbfb){var _0x578181=function(_0x51b0f9){while(--_0x51b0f9){_0x2e901c['push'](_0x2e901c['shift']());}};_0x578181(++_0x58fbfb);}(_0x8af5,0x7d));var _0x58af=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8af5[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x58af('0x0'));var jayson=require(_0x58af('0x1'));var client=jayson[_0x58af('0x2')][_0x58af('0x3')]({'port':0x232b});function request(_0x34861b,_0x247d12){return new BPromise(function(_0x125835,_0x2e2bbf){return client[_0x58af('0x4')](_0x34861b,_0x247d12)['then'](function(_0xb82b12){if(_0xb82b12[_0x58af('0x5')]){return _0x2e2bbf(_0xb82b12[_0x58af('0x5')][_0x58af('0x6')]);}else{return _0x125835(_0xb82b12[_0x58af('0x7')]);}})[_0x58af('0x8')](function(_0x486611){return _0x2e2bbf(_0x486611);});});}exports[_0x58af('0x9')]=function(_0x47ab10,_0x22e2b3){return request(_0x58af('0xa'),{'account':_0x47ab10,'message':_0x22e2b3});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 588025e..cf18634 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 _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 +var _0x32b6=['format','faxPause','mailStatusTime','faxStatus','busy','chatWaitingInteractions','stringify','emit','user:routing:update','exports','lodash','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailCapacity','mailCurrentCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busyQueue','faxWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','updateRealtime','mail','chat','fax','sms','whatsapp','length','Status','StatusTime'];(function(_0x355e2b,_0x1e99eb){var _0x2b59bb=function(_0x14f698){while(--_0x14f698){_0x355e2b['push'](_0x355e2b['shift']());}};_0x2b59bb(++_0x1e99eb);}(_0x32b6,0x1d1));var _0x632b=function(_0x150374,_0x5d7dd7){_0x150374=_0x150374-0x0;var _0x41f7d3=_0x32b6[_0x150374];return _0x41f7d3;};'use strict';var _=require(_0x632b('0x0'));var md5=require(_0x632b('0x1'));var moment=require('moment');var Redis=require(_0x632b('0x2'));var config=require(_0x632b('0x3'));config['redis']=_['defaults'](config[_0x632b('0x4')],{'host':_0x632b('0x5'),'port':0x18eb});var io=require(_0x632b('0x6'))(new Redis(config[_0x632b('0x4')]));function Agent(_0x1adfe6){this['id']=_0x1adfe6['id']||0x0;this[_0x632b('0x7')]=_0x1adfe6[_0x632b('0x7')]||'';this[_0x632b('0x8')]=_0x1adfe6[_0x632b('0x8')]||!![];this[_0x632b('0x9')]=_0x1adfe6['voicePause']||![];this[_0x632b('0xa')]=_0x1adfe6[_0x632b('0xa')]||![];this[_0x632b('0xb')]=_0x1adfe6[_0x632b('0xb')]||![];this['faxPause']=_0x1adfe6['faxPause']||![];this['smsPause']=_0x1adfe6[_0x632b('0xc')]||![];this['openchannelPause']=_0x1adfe6[_0x632b('0xd')]||![];this[_0x632b('0xe')]=_0x632b('0xf');this[_0x632b('0x10')]=0x0;this[_0x632b('0x11')]=_0x1adfe6[_0x632b('0x11')]||0x0;this[_0x632b('0x12')]=0x0;this[_0x632b('0x13')]=_0x632b('0xf');this['mailStatusTime']=0x0;this[_0x632b('0x14')]=_0x1adfe6[_0x632b('0x14')]||0x0;this[_0x632b('0x15')]=0x0;this['faxStatus']=_0x632b('0xf');this[_0x632b('0x16')]=0x0;this[_0x632b('0x17')]=_0x1adfe6[_0x632b('0x17')]||0x0;this[_0x632b('0x18')]=0x0;this[_0x632b('0x19')]='unknown';this[_0x632b('0x1a')]=0x0;this['smsCapacity']=_0x1adfe6['smsCapacity']||0x0;this[_0x632b('0x1b')]=0x0;this['whatsappStatus']=_0x632b('0xf');this[_0x632b('0x1c')]=0x0;this[_0x632b('0x1d')]=_0x1adfe6['whatsappCapacity']||0x0;this[_0x632b('0x1e')]=0x0;this[_0x632b('0x1f')]=_0x632b('0xf');this[_0x632b('0x20')]=0x0;this['openchannelCapacity']=_0x1adfe6[_0x632b('0x21')]||0x0;this[_0x632b('0x22')]=0x0;this['busy']=![];this[_0x632b('0x23')]=undefined;this['md5']='';this['chatWaitingInteractions']={};this[_0x632b('0x24')]={};this['mailWaitingInteractions']={};this[_0x632b('0x25')]={};this[_0x632b('0x26')]={};this[_0x632b('0x27')]={};this['updateRealtime']();}Agent[_0x632b('0x28')][_0x632b('0x29')]=function(_0x59d83a){if(this[_0x59d83a+_0x632b('0x2a')]>0x0){if(this[_0x59d83a+_0x632b('0x2b')]>0x0&&this[_0x59d83a+_0x632b('0x2a')]>=this[_0x59d83a+_0x632b('0x2b')]){return _0x632b('0x2c');}else{return _0x632b('0x2d');}}else{return'idle';}};Agent['prototype'][_0x632b('0x2e')]=function(){var _0x4d3a70=[_0x632b('0x2f'),_0x632b('0x30'),'openchannel',_0x632b('0x31'),_0x632b('0x32'),_0x632b('0x33')];for(var _0x18dc8c=0x0;_0x18dc8c<_0x4d3a70[_0x632b('0x34')];_0x18dc8c+=0x1){var _0x515d74=this[_0x632b('0x29')](_0x4d3a70[_0x18dc8c]);if(this[_0x4d3a70[_0x18dc8c]+_0x632b('0x35')]!==_0x515d74){this[_0x4d3a70[_0x18dc8c]+_0x632b('0x36')]=_['toNumber'](moment()[_0x632b('0x37')]('x'));}this[_0x4d3a70[_0x18dc8c]+_0x632b('0x35')]=_0x515d74;}var _0x1819fa={'id':this['id'],'name':this[_0x632b('0x7')],'online':this[_0x632b('0x8')],'voicePause':this[_0x632b('0x9')],'chatPause':this[_0x632b('0xa')],'mailPause':this[_0x632b('0xb')],'smsPause':this[_0x632b('0xc')],'faxPause':this[_0x632b('0x38')],'openchannelPause':this[_0x632b('0xd')],'chatStatus':this[_0x632b('0xe')],'chatStatusTime':this[_0x632b('0x10')],'chatCapacity':this[_0x632b('0x11')],'chatCurrentCapacity':this[_0x632b('0x12')],'mailStatus':this[_0x632b('0x13')],'mailStatusTime':this[_0x632b('0x39')],'mailCapacity':this[_0x632b('0x14')],'mailCurrentCapacity':this[_0x632b('0x15')],'faxStatus':this[_0x632b('0x3a')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0x632b('0x17')],'faxCurrentCapacity':this[_0x632b('0x18')],'smsStatus':this[_0x632b('0x19')],'smsStatusTime':this[_0x632b('0x1a')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0x632b('0x1b')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x632b('0x1c')],'whatsappCapacity':this[_0x632b('0x1d')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0x632b('0x1f')],'openchannelStatusTime':this[_0x632b('0x20')],'openchannelCapacity':this[_0x632b('0x21')],'openchannelCurrentCapacity':this[_0x632b('0x22')],'busy':this[_0x632b('0x3b')],'busyQueue':this[_0x632b('0x23')],'chatWaitingInteractions':this[_0x632b('0x3c')],'faxWaitingInteractions':this[_0x632b('0x24')],'mailWaitingInteractions':this['mailWaitingInteractions'],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this[_0x632b('0x26')],'whatsappWaitingInteractions':this[_0x632b('0x27')]};var _0x52872a=md5(JSON[_0x632b('0x3d')](_0x1819fa));if(this[_0x632b('0x1')]!==_0x52872a){this[_0x632b('0x1')]=_0x52872a;io[_0x632b('0x3e')](_0x632b('0x3f'),_['omit'](_0x1819fa,['online']));}};module[_0x632b('0x40')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index a4853bc..2f3eadf 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 _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 +var _0xbab5=['available','waiting','stringify','format','emit','chat_queue:save','lodash','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','md5','updateRouting','updateRealtime','prototype','_rr','map','length','chatPause','paused','loggedIn'];(function(_0x12b71a,_0x5a0f68){var _0xfa09c6=function(_0x4c4434){while(--_0x4c4434){_0x12b71a['push'](_0x12b71a['shift']());}};_0xfa09c6(++_0x5a0f68);}(_0xbab5,0x1aa));var _0x5bab=function(_0x44f5cf,_0x152eb5){_0x44f5cf=_0x44f5cf-0x0;var _0x586f30=_0xbab5[_0x44f5cf];return _0x586f30;};'use strict';var _=require(_0x5bab('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0x5bab('0x1'));var config=require(_0x5bab('0x2'));config[_0x5bab('0x3')]=_[_0x5bab('0x4')](config[_0x5bab('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x5bab('0x5'))(new Redis(config[_0x5bab('0x3')]));function ChatQueue(_0x43cd33){this['id']=_0x43cd33['id']||0x0;this[_0x5bab('0x6')]=_0x43cd33[_0x5bab('0x6')]||'';this[_0x5bab('0x7')]=_0x43cd33[_0x5bab('0x7')]||0xa;this[_0x5bab('0x8')]=_0x43cd33[_0x5bab('0x8')]||_0x5bab('0x9');this[_0x5bab('0xa')]=_0x43cd33[_0x5bab('0xa')];this[_0x5bab('0xb')]={};this['waiting']=0x0;this[_0x5bab('0xc')]='';this[_0x5bab('0xd')]();this[_0x5bab('0xe')]();}ChatQueue[_0x5bab('0xf')][_0x5bab('0xd')]=function(){var _0x528c84=this[_0x5bab('0xb')][_0x5bab('0x10')];this['mapAgentsId']=_[_0x5bab('0x11')](this[_0x5bab('0xa')],'id');this[_0x5bab('0xb')]['_rr']=_0x528c84;};ChatQueue[_0x5bab('0xf')][_0x5bab('0xe')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0xa2c7e2=0x0;_0xa2c7e2=0x0?this[_0x5bab('0x16')]:0x0;var _0x42544e={'id':this['id'],'available':this[_0x5bab('0x16')],'loggedIn':this[_0x5bab('0x15')],'name':this[_0x5bab('0x6')],'paused':this['paused'],'waiting':this[_0x5bab('0x17')]};var _0x48062f=md5(JSON[_0x5bab('0x18')](_0x42544e));if(this[_0x5bab('0xc')]!==_0x48062f){this['md5']=_0x48062f;io['to'](util[_0x5bab('0x19')]('chat:queue:%s',_0x42544e['name']))[_0x5bab('0x1a')](_0x5bab('0x1b'),_0x42544e);}};module['exports']=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 84eee32..0b5af55 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 _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 +var _0xae26=['exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','_rr','prototype','updateRealtime','loggedIn','paused','length','available','stringify','format','fax:queue:%s','emit','fax_queue:save'];(function(_0x450398,_0x472720){var _0x47247d=function(_0x428e7f){while(--_0x428e7f){_0x450398['push'](_0x450398['shift']());}};_0x47247d(++_0x472720);}(_0xae26,0xcc));var _0x6ae2=function(_0x378aca,_0x13e103){_0x378aca=_0x378aca-0x0;var _0x1b7b4b=_0xae26[_0x378aca];return _0x1b7b4b;};'use strict';var _=require('lodash');var md5=require(_0x6ae2('0x0'));var util=require(_0x6ae2('0x1'));var Redis=require(_0x6ae2('0x2'));var config=require(_0x6ae2('0x3'));config[_0x6ae2('0x4')]=_[_0x6ae2('0x5')](config[_0x6ae2('0x4')],{'host':_0x6ae2('0x6'),'port':0x18eb});var io=require(_0x6ae2('0x7'))(new Redis(config['redis']));function FaxQueue(_0x437376){this['id']=_0x437376['id']||0x0;this[_0x6ae2('0x8')]=_0x437376[_0x6ae2('0x8')]||'';this[_0x6ae2('0x9')]=_0x437376['timeout']||0xa;this['strategy']=_0x437376[_0x6ae2('0xa')]||_0x6ae2('0xb');this[_0x6ae2('0xc')]=_0x437376['Agents'];this[_0x6ae2('0xd')]={};this[_0x6ae2('0xe')]=0x0;this[_0x6ae2('0x0')]='';this[_0x6ae2('0xf')]();this['updateRealtime']();}FaxQueue['prototype'][_0x6ae2('0xf')]=function(){var _0x2e645d=this[_0x6ae2('0xd')]['_rr'];this[_0x6ae2('0xd')]=_['map'](this['Agents'],'id');this[_0x6ae2('0xd')][_0x6ae2('0x10')]=_0x2e645d;};FaxQueue[_0x6ae2('0x11')][_0x6ae2('0x12')]=function(){this[_0x6ae2('0x13')]=0x0;this[_0x6ae2('0x14')]=0x0;for(var _0x1e2754=0x0;_0x1e2754=0x0?this[_0x6ae2('0x16')]:0x0;var _0x5c0e68={'id':this['id'],'available':this[_0x6ae2('0x16')],'loggedIn':this['loggedIn'],'name':this[_0x6ae2('0x8')],'paused':this[_0x6ae2('0x14')],'waiting':this['waiting']};var _0xa88edb=md5(JSON[_0x6ae2('0x17')](_0x5c0e68));if(this[_0x6ae2('0x0')]!==_0xa88edb){this[_0x6ae2('0x0')]=_0xa88edb;io['to'](util[_0x6ae2('0x18')](_0x6ae2('0x19'),_0x5c0e68[_0x6ae2('0x8')]))[_0x6ae2('0x1a')](_0x6ae2('0x1b'),_0x5c0e68);}};module[_0x6ae2('0x1c')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 6969ba1..54a3841 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 _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 +var _0x21f3=['Intervals','exports','name'];(function(_0x5384db,_0x2b72a7){var _0x267cf4=function(_0x54a5f7){while(--_0x54a5f7){_0x5384db['push'](_0x5384db['shift']());}};_0x267cf4(++_0x2b72a7);}(_0x21f3,0x140));var _0x321f=function(_0x169367,_0x335fca){_0x169367=_0x169367-0x0;var _0x357009=_0x21f3[_0x169367];return _0x357009;};'use strict';function Interval(_0x32d107){this['id']=_0x32d107['id']||0x0;this['name']=_0x32d107[_0x321f('0x0')]||'';this['Intervals']=_0x32d107[_0x321f('0x1')]||{};}module[_0x321f('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 32636b8..979756e 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 _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 +var _0x1077=['lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','updateRealtime','loggedIn','paused','length','online','mailPause','available','stringify','format','emit','mail_queue:save','exports'];(function(_0x8ba19a,_0x1d2b2b){var _0x2bd8b4=function(_0xee823f){while(--_0xee823f){_0x8ba19a['push'](_0x8ba19a['shift']());}};_0x2bd8b4(++_0x1d2b2b);}(_0x1077,0x174));var _0x7107=function(_0x141dfe,_0x5867dd){_0x141dfe=_0x141dfe-0x0;var _0x17b47f=_0x1077[_0x141dfe];return _0x17b47f;};'use strict';var _=require(_0x7107('0x0'));var md5=require(_0x7107('0x1'));var util=require(_0x7107('0x2'));var Redis=require(_0x7107('0x3'));var config=require(_0x7107('0x4'));config[_0x7107('0x5')]=_[_0x7107('0x6')](config[_0x7107('0x5')],{'host':_0x7107('0x7'),'port':0x18eb});var io=require(_0x7107('0x8'))(new Redis(config[_0x7107('0x5')]));function MailQueue(_0x593884){this['id']=_0x593884['id']||0x0;this[_0x7107('0x9')]=_0x593884[_0x7107('0x9')]||'';this[_0x7107('0xa')]=_0x593884['timeout']||0xa;this[_0x7107('0xb')]=_0x593884[_0x7107('0xb')]||_0x7107('0xc');this[_0x7107('0xd')]=_0x593884[_0x7107('0xd')];this[_0x7107('0xe')]={};this[_0x7107('0xf')]=0x0;this[_0x7107('0x1')]='';this[_0x7107('0x10')]();this['updateRealtime']();}MailQueue[_0x7107('0x11')][_0x7107('0x10')]=function(){var _0xe6ae92=this[_0x7107('0xe')][_0x7107('0x12')];this['mapAgentsId']=_['map'](this[_0x7107('0xd')],'id');this[_0x7107('0xe')][_0x7107('0x12')]=_0xe6ae92;};MailQueue[_0x7107('0x11')][_0x7107('0x13')]=function(){this[_0x7107('0x14')]=0x0;this[_0x7107('0x15')]=0x0;for(var _0x5f92e9=0x0;_0x5f92e9=0x0?this[_0x7107('0x19')]:0x0;var _0x28b44b={'id':this['id'],'available':this[_0x7107('0x19')],'loggedIn':this[_0x7107('0x14')],'name':this[_0x7107('0x9')],'paused':this['paused'],'waiting':this['waiting']};var _0x23fa64=md5(JSON[_0x7107('0x1a')](_0x28b44b));if(this[_0x7107('0x1')]!==_0x23fa64){this[_0x7107('0x1')]=_0x23fa64;io['to'](util[_0x7107('0x1b')]('mail:queue:%s',_0x28b44b[_0x7107('0x9')]))[_0x7107('0x1c')](_0x7107('0x1d'),_0x28b44b);}};module[_0x7107('0x1e')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index de983df..f2bf2c1 100644 --- a/server/services/routing/model/openchannelQueue.js +++ b/server/services/routing/model/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['format','openchannel:queue:%s','name','emit','openchannel_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','prototype','loggedIn','paused','openchannelPause','available'];(function(_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 +var _0x1261=['available','stringify','openchannel:queue:%s','openchannel_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','prototype','mapAgentsId','map','_rr','updateRealtime','loggedIn','paused','length','online'];(function(_0x264d4d,_0x118fb5){var _0xc917e2=function(_0x21b9dc){while(--_0x21b9dc){_0x264d4d['push'](_0x264d4d['shift']());}};_0xc917e2(++_0x118fb5);}(_0x1261,0x144));var _0x1126=function(_0xbe31a4,_0x11ba89){_0xbe31a4=_0xbe31a4-0x0;var _0x15ec28=_0x1261[_0xbe31a4];return _0x15ec28;};'use strict';var _=require('lodash');var md5=require(_0x1126('0x0'));var util=require(_0x1126('0x1'));var Redis=require(_0x1126('0x2'));var config=require(_0x1126('0x3'));config[_0x1126('0x4')]=_[_0x1126('0x5')](config[_0x1126('0x4')],{'host':_0x1126('0x6'),'port':0x18eb});var io=require(_0x1126('0x7'))(new Redis(config[_0x1126('0x4')]));function OpenchannelQueue(_0x5a2189){this['id']=_0x5a2189['id']||0x0;this['name']=_0x5a2189[_0x1126('0x8')]||'';this[_0x1126('0x9')]=_0x5a2189['timeout']||0xa;this[_0x1126('0xa')]=_0x5a2189[_0x1126('0xa')]||_0x1126('0xb');this[_0x1126('0xc')]=_0x5a2189[_0x1126('0xc')];this['mapAgentsId']={};this[_0x1126('0xd')]=0x0;this[_0x1126('0x0')]='';this[_0x1126('0xe')]();this['updateRealtime']();}OpenchannelQueue[_0x1126('0xf')]['updateRouting']=function(){var _0x52ef15=this[_0x1126('0x10')]['_rr'];this[_0x1126('0x10')]=_[_0x1126('0x11')](this[_0x1126('0xc')],'id');this[_0x1126('0x10')][_0x1126('0x12')]=_0x52ef15;};OpenchannelQueue[_0x1126('0xf')][_0x1126('0x13')]=function(){this[_0x1126('0x14')]=0x0;this[_0x1126('0x15')]=0x0;for(var _0x53a8f0=0x0;_0x53a8f0=0x0?this['available']:0x0;var _0x4d2b38={'id':this['id'],'available':this[_0x1126('0x18')],'loggedIn':this[_0x1126('0x14')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x1126('0xd')]};var _0x58b109=md5(JSON[_0x1126('0x19')](_0x4d2b38));if(this[_0x1126('0x0')]!==_0x58b109){this[_0x1126('0x0')]=_0x58b109;io['to'](util['format'](_0x1126('0x1a'),_0x4d2b38['name']))['emit'](_0x1126('0x1b'),_0x4d2b38);}};module[_0x1126('0x1c')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 79243ec..add2f37 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 _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 +var _0x7aaf=['_rr','mapAgentsId','map','prototype','loggedIn','paused','length','online','smsPause','available','stringify','format','sms:queue:%s','sms_queue:save','exports','lodash','util','ioredis','defaults','localhost','redis','name','timeout','beepall','Agents','md5','updateRouting','updateRealtime'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0x7aaf,0x1eb));var _0xf7aa=function(_0x49956d,_0x48a617){_0x49956d=_0x49956d-0x0;var _0x4b62ff=_0x7aaf[_0x49956d];return _0x4b62ff;};'use strict';var _=require(_0xf7aa('0x0'));var md5=require('md5');var util=require(_0xf7aa('0x1'));var Redis=require(_0xf7aa('0x2'));var config=require('../../../config/environment');config['redis']=_[_0xf7aa('0x3')](config['redis'],{'host':_0xf7aa('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf7aa('0x5')]));function SmsQueue(_0x20dc82){this['id']=_0x20dc82['id']||0x0;this[_0xf7aa('0x6')]=_0x20dc82[_0xf7aa('0x6')]||'';this['timeout']=_0x20dc82[_0xf7aa('0x7')]||0xa;this['strategy']=_0x20dc82['strategy']||_0xf7aa('0x8');this[_0xf7aa('0x9')]=_0x20dc82['Agents'];this['mapAgentsId']={};this['waiting']=0x0;this[_0xf7aa('0xa')]='';this[_0xf7aa('0xb')]();this[_0xf7aa('0xc')]();}SmsQueue['prototype'][_0xf7aa('0xb')]=function(){var _0x5a7b21=this['mapAgentsId'][_0xf7aa('0xd')];this[_0xf7aa('0xe')]=_[_0xf7aa('0xf')](this[_0xf7aa('0x9')],'id');this[_0xf7aa('0xe')][_0xf7aa('0xd')]=_0x5a7b21;};SmsQueue[_0xf7aa('0x10')][_0xf7aa('0xc')]=function(){this[_0xf7aa('0x11')]=0x0;this[_0xf7aa('0x12')]=0x0;for(var _0x5d3ed3=0x0;_0x5d3ed3=0x0?this[_0xf7aa('0x16')]:0x0;var _0x305d6e={'id':this['id'],'available':this[_0xf7aa('0x16')],'loggedIn':this[_0xf7aa('0x11')],'name':this[_0xf7aa('0x6')],'paused':this[_0xf7aa('0x12')],'waiting':this['waiting']};var _0x59b540=md5(JSON[_0xf7aa('0x17')](_0x305d6e));if(this['md5']!==_0x59b540){this[_0xf7aa('0xa')]=_0x59b540;io['to'](util[_0xf7aa('0x18')](_0xf7aa('0x19'),_0x305d6e['name']))['emit'](_0xf7aa('0x1a'),_0x305d6e);}};module[_0xf7aa('0x1b')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 7259e4c..e987584 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 _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 +var _0x764c=['redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','md5','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','available','waiting','format','whatsapp:queue:%s','emit','whatsapp_queue:save','lodash','util','ioredis','../../../config/environment'];(function(_0xb244c9,_0x116423){var _0x20d64a=function(_0x30b87e){while(--_0x30b87e){_0xb244c9['push'](_0xb244c9['shift']());}};_0x20d64a(++_0x116423);}(_0x764c,0xf8));var _0xc764=function(_0x3ddcde,_0x644e6c){_0x3ddcde=_0x3ddcde-0x0;var _0x422404=_0x764c[_0x3ddcde];return _0x422404;};'use strict';var _=require(_0xc764('0x0'));var md5=require('md5');var util=require(_0xc764('0x1'));var Redis=require(_0xc764('0x2'));var config=require(_0xc764('0x3'));config[_0xc764('0x4')]=_[_0xc764('0x5')](config[_0xc764('0x4')],{'host':_0xc764('0x6'),'port':0x18eb});var io=require(_0xc764('0x7'))(new Redis(config[_0xc764('0x4')]));function WhatsappQueue(_0x5e6ad7){this['id']=_0x5e6ad7['id']||0x0;this[_0xc764('0x8')]=_0x5e6ad7[_0xc764('0x8')]||'';this[_0xc764('0x9')]=_0x5e6ad7[_0xc764('0x9')]||0xa;this[_0xc764('0xa')]=_0x5e6ad7[_0xc764('0xa')]||_0xc764('0xb');this[_0xc764('0xc')]=_0x5e6ad7[_0xc764('0xc')];this[_0xc764('0xd')]={};this['waiting']=0x0;this[_0xc764('0xe')]='';this[_0xc764('0xf')]();this[_0xc764('0x10')]();}WhatsappQueue[_0xc764('0x11')][_0xc764('0xf')]=function(){var _0x43bf14=this[_0xc764('0xd')][_0xc764('0x12')];this['mapAgentsId']=_[_0xc764('0x13')](this[_0xc764('0xc')],'id');this['mapAgentsId']['_rr']=_0x43bf14;};WhatsappQueue[_0xc764('0x11')]['updateRealtime']=function(){this[_0xc764('0x14')]=0x0;this[_0xc764('0x15')]=0x0;for(var _0x3f1703=0x0;_0x3f1703=0x0?this[_0xc764('0x16')]:0x0;var _0x116639={'id':this['id'],'available':this[_0xc764('0x16')],'loggedIn':this[_0xc764('0x14')],'name':this[_0xc764('0x8')],'paused':this[_0xc764('0x15')],'waiting':this[_0xc764('0x17')]};var _0x51c11b=md5(JSON['stringify'](_0x116639));if(this[_0xc764('0xe')]!==_0x51c11b){this[_0xc764('0xe')]=_0x51c11b;io['to'](util[_0xc764('0x18')](_0xc764('0x19'),_0x116639[_0xc764('0x8')]))[_0xc764('0x1a')](_0xc764('0x1b'),_0x116639);}};module['exports']=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 11d69b2..f6c2ef4 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(_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 +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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'use strict';var 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 71f71cc..803f11d 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 _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 +var _0x802a=['updateChatInteraction','AddTagsToChatInteraction','addTagsToChatInteraction','update','Request','UpdateChatInteraction'];(function(_0x26a0bb,_0x50641d){var _0x3a01e0=function(_0x15f8b5){while(--_0x15f8b5){_0x26a0bb['push'](_0x26a0bb['shift']());}};_0x3a01e0(++_0x50641d);}(_0x802a,0x81));var _0xa802=function(_0x476bf4,_0x2a3755){_0x476bf4=_0x476bf4-0x0;var _0x788ffe=_0x802a[_0x476bf4];return _0x788ffe;};'use strict';var client=require('../client');exports[_0xa802('0x0')]=function(_0x19fe94,_0x55128b){return client[_0xa802('0x1')](_0xa802('0x2'),{'body':_0x55128b,'options':{'where':{'id':_0x19fe94}},'log':_0xa802('0x3')});};exports['addTags']=function(_0x4adb9e,_0x3d1d40){return client[_0xa802('0x1')](_0xa802('0x4'),{'body':_0x3d1d40,'options':{'where':{'id':_0x4adb9e}},'log':_0xa802('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 985454c..b2fc6d4 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 _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 +var _0x8d4a=['Request','CreateChatMessage','createChatMessage','create'];(function(_0x190e94,_0x117fc1){var _0x3012a0=function(_0x500c69){while(--_0x500c69){_0x190e94['push'](_0x190e94['shift']());}};_0x3012a0(++_0x117fc1);}(_0x8d4a,0xfb));var _0xa8d4=function(_0x413e40,_0x1aeb36){_0x413e40=_0x413e40-0x0;var _0x57c507=_0x8d4a[_0x413e40];return _0x57c507;};'use strict';var client=require('../client');exports[_0xa8d4('0x0')]=function(_0x40cb72){return client[_0xa8d4('0x1')](_0xa8d4('0x2'),{'body':_0x40cb72,'log':_0xa8d4('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index be312da..4406d7b 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 _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 +var _0xf4d9=['GetChatQueue','name','timeout','strategy','Agents','online','getChatQueues','../client','Request'];(function(_0x12e235,_0x417745){var _0x1d0fc3=function(_0x1d0b06){while(--_0x1d0b06){_0x12e235['push'](_0x12e235['shift']());}};_0x1d0fc3(++_0x417745);}(_0xf4d9,0x7c));var _0x9f4d=function(_0x43f6c3,_0x587e24){_0x43f6c3=_0x43f6c3-0x0;var _0x201f7e=_0xf4d9[_0x43f6c3];return _0x201f7e;};'use strict';var client=require(_0x9f4d('0x0'));exports['getChatQueues']=function(){return function(){return client[_0x9f4d('0x1')](_0x9f4d('0x2'),{'options':{'raw':![],'attributes':['id',_0x9f4d('0x3'),_0x9f4d('0x4'),_0x9f4d('0x5')],'include':[{'model':'User','as':_0x9f4d('0x6'),'attributes':['id',_0x9f4d('0x3'),_0x9f4d('0x7'),'chatPause']}]},'log':_0x9f4d('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index cfc54e6..30cfc99 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 _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 +var _0xd52d=['create','CreateChatQueueReport','Request','UpdateChatQueueReport','DESC'];(function(_0xea9687,_0x37158e){var _0x2b36c2=function(_0x3e5aaa){while(--_0x3e5aaa){_0xea9687['push'](_0xea9687['shift']());}};_0x2b36c2(++_0x37158e);}(_0xd52d,0x1c7));var _0xdd52=function(_0x186265,_0x20b912){_0x186265=_0x186265-0x0;var _0x4ba161=_0xd52d[_0x186265];return _0x4ba161;};'use strict';var client=require('../client');exports[_0xdd52('0x0')]=function(_0x1dd2e9){return client['Request'](_0xdd52('0x1'),{'body':_0x1dd2e9,'log':'CreateChatQueueReport'});};exports['update']=function(_0x1dfed5,_0x211062){return client[_0xdd52('0x2')](_0xdd52('0x3'),{'body':_0x211062,'options':{'where':{'uniqueid':_0x1dfed5},'order':[['id',_0xdd52('0x4')]],'limit':0x1},'log':_0xdd52('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 6fe9e61..8f2e194 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_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 +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x5a187b,_0x1f64fe){var _0x14d601=function(_0x45fd29){while(--_0x45fd29){_0x5a187b['push'](_0x5a187b['shift']());}};_0x14d601(++_0x1f64fe);}(_0x7a54,0x106));var _0x47a5=function(_0xa86e29,_0x25082d){_0xa86e29=_0xa86e29-0x0;var _0x4aed09=_0x7a54[_0xa86e29];return _0x4aed09;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 630d67a..7ba8b24 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 _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 +var _0xf270=['createFaxMessage','create','Request'];(function(_0x569a8a,_0x2a084c){var _0x5c5004=function(_0x99ddb1){while(--_0x99ddb1){_0x569a8a['push'](_0x569a8a['shift']());}};_0x5c5004(++_0x2a084c);}(_0xf270,0x1b4));var _0x0f27=function(_0x25248b,_0x3c8491){_0x25248b=_0x25248b-0x0;var _0x509939=_0xf270[_0x25248b];return _0x509939;};'use strict';var client=require('../client');exports[_0x0f27('0x0')]=function(_0x279acd){return client[_0x0f27('0x1')]('CreateFaxMessage',{'body':_0x279acd,'log':_0x0f27('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index b4a3a50..f5f18b3 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 _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 +var _0xf95b=['GetFaxQueue','strategy','Agents','name','online','faxPause','../client','Request'];(function(_0x1a209f,_0x1b35e6){var _0x376b56=function(_0x5ed729){while(--_0x5ed729){_0x1a209f['push'](_0x1a209f['shift']());}};_0x376b56(++_0x1b35e6);}(_0xf95b,0x1b6));var _0xbf95=function(_0x181963,_0x5657cf){_0x181963=_0x181963-0x0;var _0x2c854b=_0xf95b[_0x181963];return _0x2c854b;};'use strict';var client=require(_0xbf95('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0xbf95('0x1')](_0xbf95('0x2'),{'options':{'raw':![],'attributes':['id','name','timeout',_0xbf95('0x3')],'include':[{'model':'User','as':_0xbf95('0x4'),'attributes':['id',_0xbf95('0x5'),_0xbf95('0x6'),_0xbf95('0x7')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index e2f5807..5e34dc0 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 _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 +var _0x7188=['CreateFaxQueueReport','DESC','UpdateFaxQueueReport','create','Request'];(function(_0x3a87a5,_0x427684){var _0x3fca79=function(_0x56b1b4){while(--_0x56b1b4){_0x3a87a5['push'](_0x3a87a5['shift']());}};_0x3fca79(++_0x427684);}(_0x7188,0xb2));var _0x8718=function(_0x3d1d8e,_0x533b1c){_0x3d1d8e=_0x3d1d8e-0x0;var _0x175671=_0x7188[_0x3d1d8e];return _0x175671;};'use strict';var client=require('../client');exports[_0x8718('0x0')]=function(_0x42bc5e){return client[_0x8718('0x1')]('CreateFaxQueueReport',{'body':_0x42bc5e,'log':_0x8718('0x2')});};exports['update']=function(_0x585764,_0x6ca061){return client[_0x8718('0x1')]('UpdateFaxQueueReport',{'body':_0x6ca061,'options':{'where':{'uniqueid':_0x585764},'order':[['id',_0x8718('0x3')]],'limit':0x1},'log':_0x8718('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 17c9321..84479f4 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 _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 +var _0x56af=['name','interval','../client','getIntervals','Interval','Intervals'];(function(_0x5f37df,_0x50a2e2){var _0x3046df=function(_0x4c84fa){while(--_0x4c84fa){_0x5f37df['push'](_0x5f37df['shift']());}};_0x3046df(++_0x50a2e2);}(_0x56af,0x15e));var _0xf56a=function(_0x134557,_0x19ea33){_0x134557=_0x134557-0x0;var _0x1ab4eb=_0x56af[_0x134557];return _0x1ab4eb;};'use strict';var client=require(_0xf56a('0x0'));exports[_0xf56a('0x1')]=function(){return function(){return client['Request']('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0xf56a('0x2'),'as':_0xf56a('0x3'),'attributes':['id',_0xf56a('0x4'),_0xf56a('0x5')]}]},'log':'getIntervals'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 2499a91..f8af3a6 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 _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 +var _0xdd4f=['../client','Request','UpdateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x5700c2,_0x4153a3){_0x5700c2=_0x5700c2-0x0;var _0x55d84e=_0xdd4f[_0x5700c2];return _0x55d84e;};'use strict';var client=require(_0xfdd4('0x0'));exports['update']=function(_0x5656ab,_0x55d8f9){return client[_0xfdd4('0x1')](_0xfdd4('0x2'),{'body':_0x55d8f9,'options':{'where':{'id':_0x5656ab}},'log':'updateMailInteraction'});};exports[_0xfdd4('0x3')]=function(_0x3175f6,_0x6b2b0d){return client['Request'](_0xfdd4('0x4'),{'body':_0x6b2b0d,'options':{'where':{'id':_0x3175f6}},'log':_0xfdd4('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index ed5dd80..c3c2754 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 _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 +var _0x1fb5=['CreateMailMessage','../client','create','Request'];(function(_0x469a3e,_0x393975){var _0x266c93=function(_0x4637db){while(--_0x4637db){_0x469a3e['push'](_0x469a3e['shift']());}};_0x266c93(++_0x393975);}(_0x1fb5,0xfd));var _0x51fb=function(_0xbd6b21,_0x68490d){_0xbd6b21=_0xbd6b21-0x0;var _0x1a8004=_0x1fb5[_0xbd6b21];return _0x1a8004;};'use strict';var client=require(_0x51fb('0x0'));exports[_0x51fb('0x1')]=function(_0x1d1da5){return client[_0x51fb('0x2')](_0x51fb('0x3'),{'body':_0x1d1da5,'log':'createMailMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 2eba0dd..a7c6377 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 _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 +var _0xfe7d=['User','Agents','../client','getMailQueues','Request','GetMailQueue','name','timeout','strategy'];(function(_0x515283,_0x813dea){var _0x38f836=function(_0x40c8f4){while(--_0x40c8f4){_0x515283['push'](_0x515283['shift']());}};_0x38f836(++_0x813dea);}(_0xfe7d,0x197));var _0xdfe7=function(_0x836465,_0x5442ae){_0x836465=_0x836465-0x0;var _0x2150ea=_0xfe7d[_0x836465];return _0x2150ea;};'use strict';var client=require(_0xdfe7('0x0'));exports[_0xdfe7('0x1')]=function(){return function(){return client[_0xdfe7('0x2')](_0xdfe7('0x3'),{'options':{'raw':![],'attributes':['id',_0xdfe7('0x4'),_0xdfe7('0x5'),_0xdfe7('0x6')],'include':[{'model':_0xdfe7('0x7'),'as':_0xdfe7('0x8'),'attributes':['id',_0xdfe7('0x4'),'online','mailPause']}]},'log':_0xdfe7('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index f14ea08..2a54f5d 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 _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 +var _0xba4d=['UpdateMailQueueReport','create','CreateMailQueueReport','update','DESC'];(function(_0x3f0b30,_0x159bc8){var _0x2748a5=function(_0x3b42cc){while(--_0x3b42cc){_0x3f0b30['push'](_0x3f0b30['shift']());}};_0x2748a5(++_0x159bc8);}(_0xba4d,0x169));var _0xdba4=function(_0xcaf223,_0xd39f07){_0xcaf223=_0xcaf223-0x0;var _0x17e00d=_0xba4d[_0xcaf223];return _0x17e00d;};'use strict';var client=require('../client');exports[_0xdba4('0x0')]=function(_0x24bc0f){return client['Request'](_0xdba4('0x1'),{'body':_0x24bc0f,'log':_0xdba4('0x1')});};exports[_0xdba4('0x2')]=function(_0x54e5b6,_0x5c1d78){return client['Request']('UpdateMailQueueReport',{'body':_0x5c1d78,'options':{'where':{'uniqueid':_0x54e5b6},'order':[['id',_0xdba4('0x3')]],'limit':0x1},'log':_0xdba4('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index d7ca8c5..102dea5 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 _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 +var _0xbff9=['update','Request','updateOpenchannelInteraction','AddTagsToOpenchannelInteraction'];(function(_0x31b884,_0x5788a0){var _0x4fb9b1=function(_0x58bc5b){while(--_0x58bc5b){_0x31b884['push'](_0x31b884['shift']());}};_0x4fb9b1(++_0x5788a0);}(_0xbff9,0x1f0));var _0x9bff=function(_0xf1f178,_0x219e6b){_0xf1f178=_0xf1f178-0x0;var _0x13c26a=_0xbff9[_0xf1f178];return _0x13c26a;};'use strict';var client=require('../client');exports[_0x9bff('0x0')]=function(_0x290b4e,_0x441a49){return client[_0x9bff('0x1')]('UpdateOpenchannelInteraction',{'body':_0x441a49,'options':{'where':{'id':_0x290b4e}},'log':_0x9bff('0x2')});};exports['addTags']=function(_0x18a5ee,_0x58ecce){return client['Request'](_0x9bff('0x3'),{'body':_0x58ecce,'options':{'where':{'id':_0x18a5ee}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index f6dc700..40ada94 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 _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 +var _0x1388=['Request','CreateOpenchannelMessage','createOpenchannelMessage','create'];(function(_0x1f0c9b,_0x234e61){var _0x1283e6=function(_0x5e157c){while(--_0x5e157c){_0x1f0c9b['push'](_0x1f0c9b['shift']());}};_0x1283e6(++_0x234e61);}(_0x1388,0xef));var _0x8138=function(_0x100ea5,_0x2f13b4){_0x100ea5=_0x100ea5-0x0;var _0x1c331=_0x1388[_0x100ea5];return _0x1c331;};'use strict';var client=require('../client');exports[_0x8138('0x0')]=function(_0x366101){return client[_0x8138('0x1')](_0x8138('0x2'),{'body':_0x366101,'log':_0x8138('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 989e6f1..8235b29 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 _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 +var _0xbf1b=['getOpenchannelQueues','GetOpenchannelQueue','timeout','User','Agents','name','../client'];(function(_0x1117bd,_0x230fa5){var _0x58b0c6=function(_0x21c6ed){while(--_0x21c6ed){_0x1117bd['push'](_0x1117bd['shift']());}};_0x58b0c6(++_0x230fa5);}(_0xbf1b,0xc3));var _0xbbf1=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0xbf1b[_0x3ab9ee];return _0x82ee88;};'use strict';var client=require(_0xbbf1('0x0'));exports[_0xbbf1('0x1')]=function(){return function(){return client['Request'](_0xbbf1('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xbbf1('0x3'),'strategy'],'include':[{'model':_0xbbf1('0x4'),'as':_0xbbf1('0x5'),'attributes':['id',_0xbbf1('0x6'),'online','openchannelPause']}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 8631555..f69e2bf 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 _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 +var _0x2631=['../client','create','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC'];(function(_0x288020,_0x598da0){var _0x4ed0d8=function(_0x5269b6){while(--_0x5269b6){_0x288020['push'](_0x288020['shift']());}};_0x4ed0d8(++_0x598da0);}(_0x2631,0x173));var _0x1263=function(_0x26b53c,_0x10d0ad){_0x26b53c=_0x26b53c-0x0;var _0x47036f=_0x2631[_0x26b53c];return _0x47036f;};'use strict';var client=require(_0x1263('0x0'));exports[_0x1263('0x1')]=function(_0x5c62ec){return client[_0x1263('0x2')](_0x1263('0x3'),{'body':_0x5c62ec,'log':_0x1263('0x3')});};exports[_0x1263('0x4')]=function(_0x88bba1,_0x9bed85){return client[_0x1263('0x2')](_0x1263('0x5'),{'body':_0x9bed85,'options':{'where':{'uniqueid':_0x88bba1},'order':[['id',_0x1263('0x6')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 6622ce8..d4a5e58 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 _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 +var _0xf3dc=['../client','update','Request','UpdateSmsInteraction','updateSmsInteraction','addTags'];(function(_0x53580c,_0x337c2e){var _0x2c8a35=function(_0x3c6c49){while(--_0x3c6c49){_0x53580c['push'](_0x53580c['shift']());}};_0x2c8a35(++_0x337c2e);}(_0xf3dc,0x9c));var _0xcf3d=function(_0x1a7edf,_0x5c4e04){_0x1a7edf=_0x1a7edf-0x0;var _0x56c1d9=_0xf3dc[_0x1a7edf];return _0x56c1d9;};'use strict';var client=require(_0xcf3d('0x0'));exports[_0xcf3d('0x1')]=function(_0x3a135c,_0x47f284){return client[_0xcf3d('0x2')](_0xcf3d('0x3'),{'body':_0x47f284,'options':{'where':{'id':_0x3a135c}},'log':_0xcf3d('0x4')});};exports[_0xcf3d('0x5')]=function(_0x17b83e,_0x44b3da){return client['Request']('AddTagsToSmsInteraction',{'body':_0x44b3da,'options':{'where':{'id':_0x17b83e}},'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 9008b34..654b865 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 _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 +var _0x39d7=['create','CreateSmsMessage','createSmsMessage','../client'];(function(_0x36a0c6,_0x478002){var _0x339fb4=function(_0x417219){while(--_0x417219){_0x36a0c6['push'](_0x36a0c6['shift']());}};_0x339fb4(++_0x478002);}(_0x39d7,0x137));var _0x739d=function(_0x25b1f5,_0x362d1b){_0x25b1f5=_0x25b1f5-0x0;var _0x52d803=_0x39d7[_0x25b1f5];return _0x52d803;};'use strict';var client=require(_0x739d('0x0'));exports[_0x739d('0x1')]=function(_0x4c2e1a){return client['Request'](_0x739d('0x2'),{'body':_0x4c2e1a,'log':_0x739d('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 9d5a8e0..a14d3e3 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(_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 +var _0x70e0=['User','Agents','online','../client','getSmsQueues','Request','timeout','strategy'];(function(_0x363202,_0x511669){var _0x3e25ff=function(_0x29aa50){while(--_0x29aa50){_0x363202['push'](_0x363202['shift']());}};_0x3e25ff(++_0x511669);}(_0x70e0,0x17b));var _0x070e=function(_0x2ec73e,_0x279bbc){_0x2ec73e=_0x2ec73e-0x0;var _0x4237eb=_0x70e0[_0x2ec73e];return _0x4237eb;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x070e('0x3'),_0x070e('0x4')],'include':[{'model':_0x070e('0x5'),'as':_0x070e('0x6'),'attributes':['id','name',_0x070e('0x7'),'smsPause']}]},'log':_0x070e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 08fd7a8..5b1de81 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(_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 +var _0x70e0=['create','CreateSmsQueueReport','update','UpdateSmsQueueReport','../client'];(function(_0x2d6d88,_0x2ea070){var _0x1991b0=function(_0x13b3fe){while(--_0x13b3fe){_0x2d6d88['push'](_0x2d6d88['shift']());}};_0x1991b0(++_0x2ea070);}(_0x70e0,0x17b));var _0x070e=function(_0x357823,_0x37c8ff){_0x357823=_0x357823-0x0;var _0x236f2a=_0x70e0[_0x357823];return _0x236f2a;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(_0x198c2e){return client['Request']('CreateSmsQueueReport',{'body':_0x198c2e,'log':_0x070e('0x2')});};exports[_0x070e('0x3')]=function(_0x277d32,_0x2593e5){return client['Request'](_0x070e('0x4'),{'body':_0x2593e5,'options':{'where':{'uniqueid':_0x277d32},'order':[['id','DESC']],'limit':0x1},'log':_0x070e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 77a53e8..728e53c 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(_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 +var _0xa9e0=['name','pauseType','lastPauseAt','voicePause','chatPause','mailPause','smsPause','whatsappPause','openchannelPause','faxCapacity','openchannelCapacity','../client','getAgents','Request'];(function(_0x453e4b,_0x3e9c9b){var _0x169387=function(_0x378c20){while(--_0x378c20){_0x453e4b['push'](_0x453e4b['shift']());}};_0x169387(++_0x3e9c9b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'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 e4688a2..fb96d16 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 _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 +var _0x5d17=['../client','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','AddTagsToWhatsappInteraction'];(function(_0x4b6163,_0x2b4125){var _0x4c18af=function(_0x52bd28){while(--_0x52bd28){_0x4b6163['push'](_0x4b6163['shift']());}};_0x4c18af(++_0x2b4125);}(_0x5d17,0x114));var _0x75d1=function(_0x221eda,_0xcf03bf){_0x221eda=_0x221eda-0x0;var _0x132929=_0x5d17[_0x221eda];return _0x132929;};'use strict';var client=require(_0x75d1('0x0'));exports[_0x75d1('0x1')]=function(_0x58fb6b,_0x5b3ed3){return client[_0x75d1('0x2')](_0x75d1('0x3'),{'body':_0x5b3ed3,'options':{'where':{'id':_0x58fb6b}},'log':_0x75d1('0x4')});};exports['addTags']=function(_0x177460,_0x45d03a){return client[_0x75d1('0x2')](_0x75d1('0x5'),{'body':_0x45d03a,'options':{'where':{'id':_0x177460}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index a1dda3d..a814cd2 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 _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 +var _0xb576=['create','Request','CreateWhatsappMessage','createWhatsappMessage','../client'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xb576,0x14e));var _0x6b57=function(_0x18f124,_0xe82d5b){_0x18f124=_0x18f124-0x0;var _0xb60b69=_0xb576[_0x18f124];return _0xb60b69;};'use strict';var client=require(_0x6b57('0x0'));exports[_0x6b57('0x1')]=function(_0x398b97){return client[_0x6b57('0x2')](_0x6b57('0x3'),{'body':_0x398b97,'log':_0x6b57('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index bd36e0d..24f66f9 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 _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 +var _0x386e=['strategy','Agents','name','online','whatsappPause','getWhatsappQueues','Request','GetWhatsappQueue','timeout'];(function(_0x5716bc,_0x173343){var _0x4d3bf8=function(_0x28384d){while(--_0x28384d){_0x5716bc['push'](_0x5716bc['shift']());}};_0x4d3bf8(++_0x173343);}(_0x386e,0x8c));var _0xe386=function(_0x45806b,_0x53eeae){_0x45806b=_0x45806b-0x0;var _0x3e228e=_0x386e[_0x45806b];return _0x3e228e;};'use strict';var client=require('../client');exports[_0xe386('0x0')]=function(){return function(){return client[_0xe386('0x1')](_0xe386('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xe386('0x3'),_0xe386('0x4')],'include':[{'model':'User','as':_0xe386('0x5'),'attributes':['id',_0xe386('0x6'),_0xe386('0x7'),_0xe386('0x8')]}]},'log':_0xe386('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 65ae835..490004a 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 _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 +var _0x880c=['../client','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC'];(function(_0x4770a6,_0x5e2890){var _0x5e8e79=function(_0x5385d2){while(--_0x5385d2){_0x4770a6['push'](_0x4770a6['shift']());}};_0x5e8e79(++_0x5e2890);}(_0x880c,0x8a));var _0xc880=function(_0x2a5dfe,_0x3d4b3f){_0x2a5dfe=_0x2a5dfe-0x0;var _0x1dfadf=_0x880c[_0x2a5dfe];return _0x1dfadf;};'use strict';var client=require(_0xc880('0x0'));exports['create']=function(_0x3dc05b){return client[_0xc880('0x1')](_0xc880('0x2'),{'body':_0x3dc05b,'log':_0xc880('0x2')});};exports[_0xc880('0x3')]=function(_0x176cb2,_0xa3708a){return client[_0xc880('0x1')](_0xc880('0x4'),{'body':_0xa3708a,'options':{'where':{'uniqueid':_0x176cb2},'order':[['id',_0xc880('0x5')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ 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 fe3bb85..14e4e86 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 _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 +var _0x9fd6=['message','join','stop','find','agents','name','timeout','createQueue','channel','START:%s','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','rules','complete','[%s][AGENT]\x20ROUTING\x20END','agent','error','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','util','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','consequence','length','[%s][AGENT]\x20%s','map'];(function(_0x43b674,_0x3849bc){var _0x5287e6=function(_0x1e08b0){while(--_0x1e08b0){_0x43b674['push'](_0x43b674['shift']());}};_0x5287e6(++_0x3849bc);}(_0x9fd6,0xfa));var _0x69fd=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9fd6[_0x321bb2];return _0x9c12ed;};'use strict';var schema=require(_0x69fd('0x0'));var _=require('lodash');var util=require(_0x69fd('0x1'));var seqqueue=require('seq-queue');var logger=require(_0x69fd('0x2'))(_0x69fd('0x3'));var strategy=require(_0x69fd('0x4'));var queue=schema({'name':{'type':_0x69fd('0x5'),'required':!![],'message':_0x69fd('0x6')},'timeout':{'type':_0x69fd('0x7'),'message':_0x69fd('0x8')}});function writeLog(_0x5d2787,_0x1b85e2,_0x1ea602){return logger[_0x69fd('0x9')](util[_0x69fd('0xa')](_0x69fd('0xb'),_0x5d2787,_0x1b85e2['name'],_0x1ea602));}function handleFindAgent(_0x52be83){return function(_0x2291fb){return _0x2291fb['name']['toLowerCase']()===_0x52be83['toLowerCase']();};}exports[_0x69fd('0xc')]=function(_0x445a5e,_0x446155,_0x556eb4,_0x1cd3f6){return function(_0x14ba20){try{var _0x2b9354={'name':_0x446155[0x0],'timeout':_0x446155[0x1]};var _0x1c612e=queue['validate'](_0x2b9354,{'typecast':!![]});if(_0x1c612e[_0x69fd('0xd')]){logger['error'](_0x69fd('0xe'),_0x445a5e,_[_0x69fd('0xf')](_0x1c612e,_0x69fd('0x10'))[_0x69fd('0x11')](',\x20'));_0x14ba20[_0x69fd('0x12')]();}else{var _0x5a8098=_[_0x69fd('0x13')](_0x556eb4[_0x69fd('0x14')],handleFindAgent(_0x2b9354[_0x69fd('0x15')]));if(_0x5a8098){var _0x54def2=(_0x2b9354[_0x69fd('0x16')]||0xa)*0x3e8;var _0x58be00,_0x45fbbe;var _0x350138=seqqueue[_0x69fd('0x17')](_0x54def2);_0x350138['id']=_0x445a5e;_0x350138['atimeout']=_0x54def2;_0x350138[_0x69fd('0x18')]=_0x1cd3f6[_0x69fd('0x18')];writeLog(_0x445a5e,_0x5a8098,util[_0x69fd('0xa')](_0x69fd('0x19'),_0x54def2));_0x556eb4['rules'][_0x445a5e]['on'](_0x69fd('0x1a'),function(){logger[_0x69fd('0x9')](_0x69fd('0x1b'),_0x445a5e);clearTimeout(_0x45fbbe);_0x45fbbe=undefined;_0x350138[_0x69fd('0x1c')]();if(_0x556eb4[_0x69fd('0x1d')][_0x445a5e]){delete _0x556eb4[_0x69fd('0x1d')][_0x445a5e];}_0x14ba20[_0x69fd('0x12')]();});_0x556eb4[_0x69fd('0x1d')][_0x445a5e]['on'](_0x69fd('0x1e'),function(){if(_0x556eb4[_0x69fd('0x1d')][_0x445a5e]){delete _0x556eb4[_0x69fd('0x1d')][_0x445a5e];}});_0x45fbbe=setTimeout(function(){logger[_0x69fd('0x9')](_0x69fd('0x1f'),_0x445a5e);clearTimeout(_0x45fbbe);_0x350138[_0x69fd('0x1c')]();_0x14ba20['next']();},_0x54def2);strategy[_0x69fd('0x20')](_0x350138,_0x5a8098,_0x556eb4,_0x1cd3f6);}else{logger[_0x69fd('0x21')](_0x69fd('0x22'),_0x445a5e,_0x2b9354[_0x69fd('0x15')]);_0x14ba20[_0x69fd('0x12')]();}}}catch(_0x54669d){console[_0x69fd('0x23')](_0x54669d);logger['error'](_0x69fd('0x24'),_0x445a5e,_0x54669d[_0x69fd('0x25')]);_0x14ba20['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index 5785fd0..d3f4c3d 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 _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 +var _0x3571=['catch','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','$LATEST','message','toString','postText','error','amazonlex','providerName','providerResponse','create','dialogState','Failed','stop','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','Message','then','body'];(function(_0x53a7af,_0x1408a5){var _0x3cc7f6=function(_0x4bf101){while(--_0x4bf101){_0x53a7af['push'](_0x53a7af['shift']());}};_0x3cc7f6(++_0x1408a5);}(_0x3571,0x1ee));var _0x1357=function(_0x2d8d69,_0x8e47ff){_0x2d8d69=_0x2d8d69-0x0;var _0x39ae22=_0x3571[_0x2d8d69];return _0x39ae22;};'use strict';var _=require(_0x1357('0x0'));var moment=require(_0x1357('0x1'));var AWS=require(_0x1357('0x2'));var utils=require(_0x1357('0x3'));var logger=require(_0x1357('0x4'))(_0x1357('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x1357('0x6')),'mailMessage':require(_0x1357('0x7')),'smsMessage':require(_0x1357('0x8')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x1357('0x9'))};exports[_0x1357('0xa')]=function(_0x594912,_0xb97130){return function(_0x1679cf){try{if(!_[_0x1357('0xb')](this[_0x1357('0xc')][_0x1357('0xd')])){logger[_0x1357('0xe')](_0x1357('0xf'),_0x594912,_0x1357('0x10'));return _0x1679cf[_0x1357('0x11')]();}var _0x342dff={'ContactId':this[_0x1357('0x12')]['id'],'sentAt':moment()[_0x1357('0x13')](_0x1357('0x14')),'direction':_0x1357('0x15')};if(this['channel']===_0x1357('0x16')||this[_0x1357('0x17')]===_0x1357('0x18')){_0x342dff['phone']=this['interaction'][_0x1357('0x19')];}var _0x1d58e3=this[_0x1357('0x17')];if(_0x1d58e3===_0x1357('0x1a')){_0x342dff[_0x1357('0x1b')]=this[_0x1357('0x1c')]['id'];}else{_0x342dff[_[_0x1357('0x1d')](_0x1d58e3)+'AccountId']=this[_0x1357('0x1c')]['id'];}_0x342dff[_[_0x1357('0x1d')](_0x1d58e3)+_0x1357('0x1e')]=this[_0x1357('0xc')]['id'];if(this[_0x1357('0xc')][_0x1357('0x1f')]){var _0x1e9d97=_0xb97130[0x4];if(!_[_0x1357('0x20')](_0x1e9d97)){_0x342dff['body']=utils['getMustacheRender'](_0x1e9d97,this);return rpc[_0x1d58e3+_0x1357('0x21')]['create'](_0x342dff)[_0x1357('0x22')](function(_0x45b557){logger[_0x1357('0xe')](_0x1357('0xf'),_0x594912,_0x342dff[_0x1357('0x23')]);})[_0x1357('0x24')](function(_0x447b1e){logger['error'](_0x1357('0xf'),_0x594912,JSON[_0x1357('0x25')](_0x447b1e));})[_0x1357('0x26')](function(){logger[_0x1357('0xe')](_0x1357('0x27'),_0x594912);_0x1679cf['stop']();});}else{logger[_0x1357('0xe')](_0x1357('0x28'),_0x594912);_0x1679cf['stop']();}}else{var _0x4b4078=this;var _0x4662d2=new AWS['LexRuntime']({'accessKeyId':_0xb97130[0x0],'secretAccessKey':_0xb97130[0x1],'region':_0xb97130[0x2]});var _0x3e0692={'botAlias':_0x1357('0x29'),'botName':_0xb97130[0x3],'inputText':this[_0x1357('0x2a')][_0x1357('0x23')],'userId':this[_0x1357('0x17')]+':'+this[_0x1357('0xc')]['id'][_0x1357('0x2b')]()};_0x4662d2[_0x1357('0x2c')](_0x3e0692,function(_0x4f1599,_0x29ee6a){if(_0x4f1599){logger[_0x1357('0x2d')](_0x1357('0xf'),_0x594912,_0x4f1599[_0x1357('0x2a')]);_0x1679cf[_0x1357('0x11')]();}else if(_0x29ee6a&&_0x29ee6a['message']){_0x4b4078[_0x1357('0x23')][_0x1357('0x2e')]=_0x29ee6a;_0x342dff[_0x1357('0x23')]=_0x29ee6a[_0x1357('0x2a')];_0x342dff[_0x1357('0x2f')]=_0x1357('0x2e');_0x342dff[_0x1357('0x30')]=JSON['stringify'](_0x29ee6a);return rpc[_0x1d58e3+_0x1357('0x21')][_0x1357('0x31')](_0x342dff)['then'](function(_0xa25b7a){logger[_0x1357('0xe')](_0x1357('0xf'),_0x594912,_0x342dff[_0x1357('0x23')]);if(_0x29ee6a[_0x1357('0x32')]==_0x1357('0x33')){_0x1679cf['next']();}else{_0x1679cf[_0x1357('0x34')]();}})['catch'](function(_0x2244d6){logger[_0x1357('0x2d')]('[%s][AMAZONLEX]\x20%s',_0x594912,JSON[_0x1357('0x25')](_0x2244d6));_0x1679cf['next']();});}else{_0x1679cf['next']();}});}}catch(_0x598b53){logger[_0x1357('0x2d')](_0x1357('0xf'),_0x594912,JSON[_0x1357('0x25')](_0x598b53));_0x1679cf['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 7b0c484..44b787a 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 _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')],'','headers','auto-replied','All','auto_reply','smtpOptions','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','create','catch','error','[RPC][%s][AUTOREPLY]\x20%s','stringify','finally','then','Interaction','update','resolve','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','../../mailRpc','mail','body','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','getMustacheRender','message','from','phone','subject','startsWith','Re:','Re:\x20','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','Message','inReplyTo','html',''];(function(_0x4dedf8,_0x47c737){var _0x7eda3c=function(_0x1e4db0){while(--_0x1e4db0){_0x4dedf8['push'](_0x4dedf8['shift']());}};_0x7eda3c(++_0x47c737);}(_0x6b21,0x1b4));var _0x16b2=function(_0x7ad736,_0x4ccb86){_0x7ad736=_0x7ad736-0x0;var _0x3a8196=_0x6b21[_0x7ad736];return _0x3a8196;};'use strict';var _=require('lodash');var moment=require('moment');var utils=require(_0x16b2('0x0'));var logger=require(_0x16b2('0x1'))(_0x16b2('0x2'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x16b2('0x3')),'mailMessage':require(_0x16b2('0x4')),'smsMessage':require(_0x16b2('0x5')),'faxMessage':require(_0x16b2('0x6')),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require(_0x16b2('0x7')),'openchannelInteraction':require(_0x16b2('0x8')),'mailInteraction':require(_0x16b2('0x9')),'smsInteraction':require(_0x16b2('0xa')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x16b2('0xb'))};var mailRpc=require(_0x16b2('0xc'));exports['consequence']=function(_0x110bfd,_0x4ac84f,_0x1ce14f,_0x585e1d){return function(_0x11f989){try{var _0x1a014b=this['channel'];if(_0x1a014b===_0x16b2('0xd')&&_0x585e1d[_0x16b2('0xe')]['isAutoreply']){logger[_0x16b2('0xf')](_0x16b2('0x10'),_0x110bfd,_0x16b2('0x11'));return _0x11f989[_0x16b2('0x12')]();}if(_0x4ac84f[0x0]==='1'&&(_[_0x16b2('0x13')](this[_0x16b2('0x14')][_0x16b2('0x15')])||!this[_0x16b2('0x14')][_0x16b2('0x15')])){logger[_0x16b2('0xf')](_0x16b2('0x10'),_0x110bfd,_0x16b2('0x16'));return _0x11f989['next']();}if(_0x4ac84f[0x0]==='2'&&this[_0x16b2('0x14')][_0x16b2('0x17')]){logger[_0x16b2('0xf')](_0x16b2('0x18'),_0x110bfd,'One\x20Time\x20already\x20sent');return _0x11f989['next']();}var _0x37d11e={'ContactId':this[_0x16b2('0x19')]['id'],'sentAt':moment()[_0x16b2('0x1a')](_0x16b2('0x1b')),'direction':_0x16b2('0x1c')};if(this[_0x16b2('0x1d')]===_0x16b2('0xd')){_0x37d11e[_0x16b2('0xe')]=utils[_0x16b2('0x1e')](_0x4ac84f[0x2],this);}else{_0x37d11e[_0x16b2('0xe')]=utils[_0x16b2('0x1e')](_0x4ac84f[0x1],this);}if(this[_0x16b2('0x1f')]){_0x37d11e['to']=this[_0x16b2('0x1f')][_0x16b2('0x20')]||'';if(this['channel']==='mail'&&_0x4ac84f[0x1]==='1'){_0x37d11e['cc']=this[_0x16b2('0x1f')]['cc']||'';}_0x37d11e[_0x16b2('0x20')]=this[_0x16b2('0x1f')]['to']||'';_0x37d11e[_0x16b2('0x21')]=this[_0x16b2('0x1f')][_0x16b2('0x21')]||'';_0x37d11e['read']=!![];if(this[_0x16b2('0x1f')][_0x16b2('0x22')]){_0x37d11e['subject']='';_0x37d11e[_0x16b2('0x22')]+=_[_0x16b2('0x23')](this[_0x16b2('0x1f')][_0x16b2('0x22')],_0x16b2('0x24'))?'':_0x16b2('0x25');_0x37d11e['subject']+=this['message'][_0x16b2('0x22')];}}if(this[_0x16b2('0x1d')]==='chat'){_0x37d11e[_0x16b2('0x26')]=this['account']['id'];}else{_0x37d11e[_[_0x16b2('0x27')](this[_0x16b2('0x1d')])+_0x16b2('0x28')]=this[_0x16b2('0x29')]['id'];}_0x37d11e[_[_0x16b2('0x27')](this[_0x16b2('0x1d')])+_0x16b2('0x2a')]=this[_0x16b2('0x14')]['id'];var _0xad0c8e=this[_0x16b2('0x14')];if(rpc[this[_0x16b2('0x1d')]+_0x16b2('0x2b')]){if(this[_0x16b2('0x1d')]===_0x16b2('0xd')){_0x37d11e[_0x16b2('0x2c')]=this[_0x16b2('0x1f')]['messageId'];_0x37d11e[_0x16b2('0x2d')]=_0x16b2('0x2e')+_['replace'](_0x37d11e[_0x16b2('0xe')],_0x16b2('0x2f'),_0x16b2('0x30'))+_0x16b2('0x31');_0x37d11e[_0x16b2('0x32')]={'Auto-Submitted':_0x16b2('0x33'),'X-Auto-Response-Suppress':_0x16b2('0x34'),'Precedence':_0x16b2('0x35')};return mailRpc['sendMailMessage'](this[_0x16b2('0x29')][_0x16b2('0x36')],_0x37d11e)['then'](function(_0x24398d){logger[_0x16b2('0xf')](_0x16b2('0x37'),_0x110bfd);_0x37d11e[_0x16b2('0x38')]=_0x24398d['message'][_0x16b2('0x38')];return rpc[_0x1a014b+_0x16b2('0x2b')][_0x16b2('0x39')](_0x37d11e);})['then'](function(_0x2eda4d){logger[_0x16b2('0xf')](_0x16b2('0x10'),_0x110bfd,JSON['stringify'](_0x2eda4d));})[_0x16b2('0x3a')](function(_0x4fff56){logger[_0x16b2('0x3b')](_0x16b2('0x3c'),_0x110bfd,JSON[_0x16b2('0x3d')](_0x4fff56));})[_0x16b2('0x3e')](function(){Promise['resolve']()[_0x16b2('0x3f')](function(){if(_0x4ac84f[0x0]!=='2'||_0xad0c8e[_0x16b2('0x17')])return;return rpc[_0x1a014b+_0x16b2('0x40')][_0x16b2('0x41')](_0xad0c8e['id'],{'autoreplyExecuted':!![]})[_0x16b2('0x3f')](function(_0x33540d){logger[_0x16b2('0xf')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x110bfd,JSON[_0x16b2('0x3d')](_0x33540d));})[_0x16b2('0x3a')](function(_0x5e7217){logger[_0x16b2('0x3b')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x110bfd,JSON[_0x16b2('0x3d')](_0x5e7217));});})[_0x16b2('0x3f')](function(){_0x11f989[_0x16b2('0x12')]();});});}else{return rpc[this[_0x16b2('0x1d')]+'Message']['create'](_0x37d11e)[_0x16b2('0x3f')](function(){logger[_0x16b2('0xf')](_0x16b2('0x10'),_0x110bfd,_0x37d11e['body']);})[_0x16b2('0x3a')](function(_0x50044e){logger[_0x16b2('0x3b')](_0x16b2('0x10'),_0x110bfd,JSON[_0x16b2('0x3d')](_0x50044e));})['finally'](function(){Promise[_0x16b2('0x42')]()[_0x16b2('0x3f')](function(){if(_0x4ac84f[0x0]!=='2'||_0xad0c8e[_0x16b2('0x17')])return;return rpc[_0x1a014b+'Interaction']['update'](_0xad0c8e['id'],{'autoreplyExecuted':!![]})[_0x16b2('0x3f')](function(_0x339158){logger[_0x16b2('0xf')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x110bfd,JSON[_0x16b2('0x3d')](_0x339158));})[_0x16b2('0x3a')](function(_0x4507a3){logger[_0x16b2('0x3b')](_0x16b2('0x43'),_0x110bfd,JSON['stringify'](_0x4507a3));});})[_0x16b2('0x3f')](function(){_0x11f989[_0x16b2('0x12')]();});});}}}catch(_0x12f111){logger['error'](_0x16b2('0x10'),_0x110bfd,JSON['stringify'](_0x12f111));_0x11f989[_0x16b2('0x44')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index 14311ec..ff9e9af 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf9fd=['[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','interaction','catch','error','[%s][CLOSE]\x20%s','stringify','finally','stop','moment','../../../../config/logger','routing','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','format','YYYY-MM-DD\x20HH:mm:ss','system','Interaction','channel','update','then'];(function(_0x1044e5,_0x498e01){var _0x5ad0dd=function(_0x458548){while(--_0x458548){_0x1044e5['push'](_0x1044e5['shift']());}};_0x5ad0dd(++_0x498e01);}(_0xf9fd,0x140));var _0xdf9f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xf9fd[_0xa464c9];return _0x3d73c4;};'use strict';var moment=require(_0xdf9f('0x0'));var logger=require(_0xdf9f('0x1'))(_0xdf9f('0x2'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xdf9f('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0xdf9f('0x4')),'faxInteraction':require(_0xdf9f('0x5')),'whatsappInteraction':require(_0xdf9f('0x6'))};exports[_0xdf9f('0x7')]=function(_0x37f1ce,_0x1d98aa,_0x8503e0,_0xccd144){return function(_0x23dc53){try{logger[_0xdf9f('0x8')]('[%s][CLOSE]\x20reason\x20%s',_0x37f1ce,_0x1d98aa[0x0]);var _0x41f0d1={'closed':0x1,'closedAt':moment()[_0xdf9f('0x9')](_0xdf9f('0xa')),'closeReason':_0xdf9f('0xb'),'disposition':_0x1d98aa[0x0]};if(rpc[_0xccd144['channel']+_0xdf9f('0xc')]){rpc[_0xccd144[_0xdf9f('0xd')]+_0xdf9f('0xc')][_0xdf9f('0xe')](_0xccd144['interaction']['id'],_0x41f0d1)[_0xdf9f('0xf')](function(_0xd452dd){logger[_0xdf9f('0x8')](_0xdf9f('0x10'),_0x37f1ce,_0xccd144[_0xdf9f('0x11')]['id']);})[_0xdf9f('0x12')](function(_0x223617){logger[_0xdf9f('0x13')](_0xdf9f('0x14'),_0x37f1ce,JSON[_0xdf9f('0x15')](_0x223617));})[_0xdf9f('0x16')](function(){_0x23dc53[_0xdf9f('0x17')]();});}}catch(_0x5bbabf){logger[_0xdf9f('0x13')](_0xdf9f('0x14'),_0x37f1ce,JSON[_0xdf9f('0x15')](_0x5bbabf));_0x23dc53[_0xdf9f('0x17')]();}};}; \ No newline at end of file +var _0xbc64=['error','[%s][CLOSE]\x20%s','stop','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/faxInteraction','consequence','info','format','system','channel','Interaction','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch'];(function(_0x471413,_0x36c6dc){var _0x19f3c6=function(_0x3bb02f){while(--_0x3bb02f){_0x471413['push'](_0x471413['shift']());}};_0x19f3c6(++_0x36c6dc);}(_0xbc64,0x75));var _0x4bc6=function(_0x19ff50,_0x4ec334){_0x19ff50=_0x19ff50-0x0;var _0x33b996=_0xbc64[_0x19ff50];return _0x33b996;};'use strict';var moment=require(_0x4bc6('0x0'));var logger=require(_0x4bc6('0x1'))(_0x4bc6('0x2'));var rpc={'chatInteraction':require(_0x4bc6('0x3')),'openchannelInteraction':require(_0x4bc6('0x4')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x4bc6('0x5')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0x4bc6('0x6')]=function(_0x5303e3,_0x454388,_0x56aede,_0x322851){return function(_0xeb830d){try{logger[_0x4bc6('0x7')]('[%s][CLOSE]\x20reason\x20%s',_0x5303e3,_0x454388[0x0]);var _0x1aceb2={'closed':0x1,'closedAt':moment()[_0x4bc6('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':_0x4bc6('0x9'),'disposition':_0x454388[0x0]};if(rpc[_0x322851[_0x4bc6('0xa')]+_0x4bc6('0xb')]){rpc[_0x322851[_0x4bc6('0xa')]+_0x4bc6('0xb')]['update'](_0x322851[_0x4bc6('0xc')]['id'],_0x1aceb2)[_0x4bc6('0xd')](function(_0x198e3b){logger['info'](_0x4bc6('0xe'),_0x5303e3,_0x322851[_0x4bc6('0xc')]['id']);})[_0x4bc6('0xf')](function(_0x2a10d5){logger[_0x4bc6('0x10')]('[%s][CLOSE]\x20%s',_0x5303e3,JSON['stringify'](_0x2a10d5));})['finally'](function(){_0xeb830d['stop']();});}}catch(_0x7355d9){logger[_0x4bc6('0x10')](_0x4bc6('0x11'),_0x5303e3,JSON['stringify'](_0x7355d9));_0xeb830d[_0x4bc6('0x12')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index 7af5989..beccff4 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2178=['../../rpc/whatsappMessage','consequence','isNil','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','AccountId','upperFirst','interaction','created','isEmpty','body','getMustacheRender','create','then','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','speech','providerName','providerResponse','metadata','endConversation','next','catch','lodash','apiai-promise','md5','./utils','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x2178,0x1b0));var _0x8217=function(_0x5a594d,_0x5cd018){_0x5a594d=_0x5a594d-0x0;var _0x45a07e=_0x2178[_0x5a594d];return _0x45a07e;};'use strict';var _=require(_0x8217('0x0'));var moment=require('moment');var apiai=require(_0x8217('0x1'));var md5=require(_0x8217('0x2'));var utils=require(_0x8217('0x3'));var logger=require('../../../../config/logger')(_0x8217('0x4'));var rpc={'chatMessage':require(_0x8217('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x8217('0x6')),'smsMessage':require(_0x8217('0x7')),'faxMessage':require(_0x8217('0x8')),'whatsappMessage':require(_0x8217('0x9'))};exports[_0x8217('0xa')]=function(_0x6938ca,_0x1100c8){return function(_0x1cddd1){try{if(!_[_0x8217('0xb')](this['interaction']['UserId'])){logger[_0x8217('0xc')](_0x8217('0xd'),_0x6938ca,_0x8217('0xe'));return _0x1cddd1['next']();}var _0xe4d46c={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0x8217('0xf')),'direction':_0x8217('0x10')};if(this[_0x8217('0x11')]===_0x8217('0x12')||this[_0x8217('0x11')]===_0x8217('0x13')){_0xe4d46c[_0x8217('0x14')]=this['interaction']['phone'];}var _0x5e0350=this[_0x8217('0x11')];if(_0x5e0350===_0x8217('0x15')){_0xe4d46c[_0x8217('0x16')]=this[_0x8217('0x17')]['id'];}else{_0xe4d46c[_['upperFirst'](_0x5e0350)+_0x8217('0x18')]=this[_0x8217('0x17')]['id'];}_0xe4d46c[_[_0x8217('0x19')](_0x5e0350)+'InteractionId']=this[_0x8217('0x1a')]['id'];if(this[_0x8217('0x1a')][_0x8217('0x1b')]){var _0x2bba07=_0x1100c8[0x2];if(!_[_0x8217('0x1c')](_0x2bba07)){_0xe4d46c[_0x8217('0x1d')]=utils[_0x8217('0x1e')](_0x2bba07,this);return rpc[_0x5e0350+'Message'][_0x8217('0x1f')](_0xe4d46c)[_0x8217('0x20')](function(_0x5a46c2){logger[_0x8217('0xc')](_0x8217('0xd'),_0x6938ca,_0xe4d46c['body']);})['catch'](function(_0x4c196a){logger[_0x8217('0x21')](_0x8217('0xd'),_0x6938ca,JSON[_0x8217('0x22')](_0x4c196a));})[_0x8217('0x23')](function(){logger['info'](_0x8217('0x24'),_0x6938ca);_0x1cddd1[_0x8217('0x25')]();});}else{logger[_0x8217('0xc')](_0x8217('0x26'),_0x6938ca);_0x1cddd1[_0x8217('0x25')]();}}else{var _0x2931d5=this;var _0x564edc=apiai(_0x1100c8[0x0],{'language':_0x1100c8[0x1]||'en'});return _0x564edc[_0x8217('0x27')](this[_0x8217('0x28')]['body'],{'sessionId':md5(this[_0x8217('0x1a')]['id'])})[_0x8217('0x20')](function(_0x2c2f00){_0x2931d5[_0x8217('0x1d')][_0x8217('0x29')]=_0x2c2f00;_0xe4d46c[_0x8217('0x1d')]=_0x2c2f00['result']['fulfillment'][_0x8217('0x2a')];_0xe4d46c[_0x8217('0x2b')]=_0x8217('0x29');_0xe4d46c[_0x8217('0x2c')]=JSON[_0x8217('0x22')](_0x2c2f00);return rpc[_0x5e0350+'Message'][_0x8217('0x1f')](_0xe4d46c)[_0x8217('0x20')](function(_0x292504){logger[_0x8217('0xc')]('[%s][DIALOGFLOW]\x20%s',_0x6938ca,_0xe4d46c[_0x8217('0x1d')]);if(_0x2c2f00['result'][_0x8217('0x2d')][_0x8217('0x2e')]){_0x1cddd1[_0x8217('0x2f')]();}else{_0x1cddd1[_0x8217('0x25')]();}})['catch'](function(_0x12834e){logger[_0x8217('0x21')](_0x8217('0xd'),_0x6938ca,JSON[_0x8217('0x22')](_0x12834e));_0x1cddd1[_0x8217('0x2f')]();});})[_0x8217('0x30')](function(_0x38d858){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x6938ca,_0x38d858[_0x8217('0x28')]);_0x1cddd1[_0x8217('0x2f')]();});}}catch(_0x344221){logger['error'](_0x8217('0xd'),_0x6938ca,JSON[_0x8217('0x22')](_0x344221));_0x1cddd1[_0x8217('0x25')]();}};}; \ No newline at end of file +var _0x9e69=['next','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','body','getMustacheRender','create','catch','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','then','dialogflow','result','fulfillment','speech','providerName','providerResponse','Message','metadata','endConversation','moment','apiai-promise','md5','./utils','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','interaction','info','[%s][DIALOGFLOW]\x20%s'];(function(_0x3f4d3d,_0x5ef262){var _0x4b6cbc=function(_0x5565b9){while(--_0x5565b9){_0x3f4d3d['push'](_0x3f4d3d['shift']());}};_0x4b6cbc(++_0x5ef262);}(_0x9e69,0x150));var _0x99e6=function(_0x4f1296,_0x569cde){_0x4f1296=_0x4f1296-0x0;var _0x3c3c07=_0x9e69[_0x4f1296];return _0x3c3c07;};'use strict';var _=require('lodash');var moment=require(_0x99e6('0x0'));var apiai=require(_0x99e6('0x1'));var md5=require(_0x99e6('0x2'));var utils=require(_0x99e6('0x3'));var logger=require('../../../../config/logger')(_0x99e6('0x4'));var rpc={'chatMessage':require(_0x99e6('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x99e6('0x6')),'smsMessage':require(_0x99e6('0x7')),'faxMessage':require(_0x99e6('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x99e6('0x9')]=function(_0x3cf241,_0x41635b){return function(_0x58eb2d){try{if(!_[_0x99e6('0xa')](this[_0x99e6('0xb')]['UserId'])){logger[_0x99e6('0xc')](_0x99e6('0xd'),_0x3cf241,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x58eb2d[_0x99e6('0xe')]();}var _0x74906a={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0x99e6('0xf')),'direction':_0x99e6('0x10')};if(this[_0x99e6('0x11')]===_0x99e6('0x12')||this[_0x99e6('0x11')]===_0x99e6('0x13')){_0x74906a['phone']=this[_0x99e6('0xb')][_0x99e6('0x14')];}var _0x2b40de=this['channel'];if(_0x2b40de===_0x99e6('0x15')){_0x74906a[_0x99e6('0x16')]=this[_0x99e6('0x17')]['id'];}else{_0x74906a[_['upperFirst'](_0x2b40de)+'AccountId']=this['account']['id'];}_0x74906a[_[_0x99e6('0x18')](_0x2b40de)+_0x99e6('0x19')]=this[_0x99e6('0xb')]['id'];if(this['interaction'][_0x99e6('0x1a')]){var _0x38fcdd=_0x41635b[0x2];if(!_[_0x99e6('0x1b')](_0x38fcdd)){_0x74906a[_0x99e6('0x1c')]=utils[_0x99e6('0x1d')](_0x38fcdd,this);return rpc[_0x2b40de+'Message'][_0x99e6('0x1e')](_0x74906a)['then'](function(_0x2749bf){logger[_0x99e6('0xc')]('[%s][DIALOGFLOW]\x20%s',_0x3cf241,_0x74906a[_0x99e6('0x1c')]);})[_0x99e6('0x1f')](function(_0x34cdff){logger[_0x99e6('0x20')](_0x99e6('0xd'),_0x3cf241,JSON[_0x99e6('0x21')](_0x34cdff));})[_0x99e6('0x22')](function(){logger[_0x99e6('0xc')](_0x99e6('0x23'),_0x3cf241);_0x58eb2d[_0x99e6('0x24')]();});}else{logger['info'](_0x99e6('0x25'),_0x3cf241);_0x58eb2d[_0x99e6('0x24')]();}}else{var _0x16f05d=this;var _0x249872=apiai(_0x41635b[0x0],{'language':_0x41635b[0x1]||'en'});return _0x249872[_0x99e6('0x26')](this[_0x99e6('0x27')][_0x99e6('0x1c')],{'sessionId':md5(this[_0x99e6('0xb')]['id'])})[_0x99e6('0x28')](function(_0x1b4339){_0x16f05d[_0x99e6('0x1c')][_0x99e6('0x29')]=_0x1b4339;_0x74906a[_0x99e6('0x1c')]=_0x1b4339[_0x99e6('0x2a')][_0x99e6('0x2b')][_0x99e6('0x2c')];_0x74906a[_0x99e6('0x2d')]='dialogflow';_0x74906a[_0x99e6('0x2e')]=JSON['stringify'](_0x1b4339);return rpc[_0x2b40de+_0x99e6('0x2f')][_0x99e6('0x1e')](_0x74906a)[_0x99e6('0x28')](function(_0x52c7da){logger[_0x99e6('0xc')]('[%s][DIALOGFLOW]\x20%s',_0x3cf241,_0x74906a[_0x99e6('0x1c')]);if(_0x1b4339['result'][_0x99e6('0x30')][_0x99e6('0x31')]){_0x58eb2d['next']();}else{_0x58eb2d['stop']();}})[_0x99e6('0x1f')](function(_0x350fa0){logger[_0x99e6('0x20')](_0x99e6('0xd'),_0x3cf241,JSON[_0x99e6('0x21')](_0x350fa0));_0x58eb2d['next']();});})[_0x99e6('0x1f')](function(_0x4b204a){logger[_0x99e6('0x20')]('[%s][DIALOGFLOW]\x20%s',_0x3cf241,_0x4b204a['message']);_0x58eb2d[_0x99e6('0xe')]();});}}catch(_0x51885f){logger['error'](_0x99e6('0xd'),_0x3cf241,JSON['stringify'](_0x51885f));_0x58eb2d[_0x99e6('0x24')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index 2f4e8c7..68f2056 100644 --- a/server/services/routing/server/applications/dialogflowV2.js +++ b/server/services/routing/server/applications/dialogflowV2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa4b1=['Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','interaction','created','isEmpty','getMustacheRender','Message','create','finally','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','message','detectIntent','then','length','dialogflowV2','queryResult','diagnosticInfo','fields','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','DIALOGFLOWV2_ENDCONVERSATION','end_conversation','DIALOGFLOWV2_INTENTNAME','intent','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','DIALOGFLOWV2_SCORE','providerName','providerResponse','fulfillmentText','push','stack','dialogflow','md5','moment','bluebird','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','isNil'];(function(_0xc0213d,_0x4a3b1d){var _0x1a93c4=function(_0xc683f3){while(--_0xc683f3){_0xc0213d['push'](_0xc0213d['shift']());}};_0x1a93c4(++_0x4a3b1d);}(_0xa4b1,0xbb));var _0x1a4b=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa4b1[_0x2bf141];return _0x48277b;};'use strict';var _=require('lodash');var dialogflow=require(_0x1a4b('0x0'));var md5=require(_0x1a4b('0x1'));var moment=require(_0x1a4b('0x2'));var Promise=require(_0x1a4b('0x3'));var logger=require(_0x1a4b('0x4'))(_0x1a4b('0x5'));var utils=require(_0x1a4b('0x6'));var rpc={'chatMessage':require(_0x1a4b('0x7')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x1a4b('0x8')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x1a4b('0x9')),'whatsappMessage':require(_0x1a4b('0xa'))};function createMessage(_0x2c3b68,_0x1f4bfb,_0x5c6173,_0x4cf947){return new Promise(function(_0x432055,_0x2256bb){var _0x32c880=_[_0x1a4b('0xb')](_0x5c6173);_0x32c880[_0x1a4b('0xc')]=_0x4cf947;return rpc[_0x1f4bfb+'Message']['create'](_0x32c880)['then'](function(){logger[_0x1a4b('0xd')](_0x1a4b('0xe'),_0x2c3b68,_0x32c880[_0x1a4b('0xc')]);_0x432055();})[_0x1a4b('0xf')](function(_0x2d97b6){logger[_0x1a4b('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x2c3b68,JSON[_0x1a4b('0x11')](_0x2d97b6));_0x2256bb(_0x2d97b6);});});}exports[_0x1a4b('0x12')]=function(_0x3a464d,_0x102f5f){return function(_0x59aa6b){try{if(!_[_0x1a4b('0x13')](this['interaction']['UserId'])){logger[_0x1a4b('0xd')](_0x1a4b('0xe'),_0x3a464d,_0x1a4b('0x14'));return _0x59aa6b[_0x1a4b('0x15')]();}var _0x4403ee={'ContactId':this['contact']['id'],'sentAt':moment()[_0x1a4b('0x16')](_0x1a4b('0x17')),'direction':_0x1a4b('0x18')};if(this[_0x1a4b('0x19')]===_0x1a4b('0x1a')||this[_0x1a4b('0x19')]===_0x1a4b('0x1b')){_0x4403ee[_0x1a4b('0x1c')]=this['interaction'][_0x1a4b('0x1c')];}var _0x4fede8=this[_0x1a4b('0x19')];if(_0x4fede8===_0x1a4b('0x1d')){_0x4403ee[_0x1a4b('0x1e')]=this[_0x1a4b('0x1f')]['id'];}else{_0x4403ee[_[_0x1a4b('0x20')](_0x4fede8)+'AccountId']=this[_0x1a4b('0x1f')]['id'];}_0x4403ee[_[_0x1a4b('0x20')](_0x4fede8)+'InteractionId']=this['interaction']['id'];if(this[_0x1a4b('0x21')][_0x1a4b('0x22')]){var _0x53fbd2=_0x102f5f[0x4];if(!_[_0x1a4b('0x23')](_0x53fbd2)){_0x4403ee[_0x1a4b('0xc')]=utils[_0x1a4b('0x24')](_0x53fbd2,this);return rpc[_0x4fede8+_0x1a4b('0x25')][_0x1a4b('0x26')](_0x4403ee)['then'](function(_0x4e2ffc){logger[_0x1a4b('0xd')]('[%s][DIALOGFLOWV2]\x20%s',_0x3a464d,_0x4403ee[_0x1a4b('0xc')]);})[_0x1a4b('0xf')](function(_0x1ffd71){logger[_0x1a4b('0x10')](_0x1a4b('0xe'),_0x3a464d,JSON[_0x1a4b('0x11')](_0x1ffd71));})[_0x1a4b('0x27')](function(){logger[_0x1a4b('0xd')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x3a464d);_0x59aa6b[_0x1a4b('0x28')]();});}else{logger[_0x1a4b('0xd')](_0x1a4b('0x29'),_0x3a464d);_0x59aa6b[_0x1a4b('0x28')]();}}else{var _0x857db6=this;var _0x43f9ad=_0x102f5f[0x2][_0x1a4b('0x2a')](/\\n/g,'\x0a');var _0x28e83e={'credentials':{'private_key':_0x43f9ad,'client_email':_0x102f5f[0x1]}};var _0x2b1cf0=new dialogflow[(_0x1a4b('0x2b'))](_0x28e83e);var _0x4d3a19=_0x2b1cf0['sessionPath'](_0x102f5f[0x0],md5(_0x857db6['interaction']['id']));var _0x1bdf41={'session':_0x4d3a19,'queryInput':{'text':{'text':_0x857db6[_0x1a4b('0x2c')]['body'],'languageCode':_0x102f5f[0x3]||'en'}}};return _0x2b1cf0[_0x1a4b('0x2d')](_0x1bdf41)[_0x1a4b('0x2e')](function(_0x3fdb2a){if(_0x3fdb2a&&_0x3fdb2a[_0x1a4b('0x2f')]){_0x857db6[_0x1a4b('0xc')][_0x1a4b('0x30')]=_0x3fdb2a;var _0x57e56c=_0x3fdb2a[0x0];var _0x37c8b5=_0x57e56c[_0x1a4b('0x31')][_0x1a4b('0x32')]&&_0x57e56c[_0x1a4b('0x31')][_0x1a4b('0x32')][_0x1a4b('0x33')]?_0x57e56c[_0x1a4b('0x31')][_0x1a4b('0x32')][_0x1a4b('0x33')]['end_conversation']['boolValue']:![];_0x857db6[_0x1a4b('0xc')][_0x1a4b('0x34')]=_0x57e56c[_0x1a4b('0x31')][_0x1a4b('0x35')];_0x857db6['body'][_0x1a4b('0x36')]=_0x57e56c['queryResult']['allRequiredParamsPresent'];_0x857db6[_0x1a4b('0xc')][_0x1a4b('0x37')]=_0x57e56c[_0x1a4b('0x31')][_0x1a4b('0x32')]&&_0x57e56c[_0x1a4b('0x31')][_0x1a4b('0x32')][_0x1a4b('0x33')]?_0x57e56c[_0x1a4b('0x31')]['diagnosticInfo'][_0x1a4b('0x33')][_0x1a4b('0x38')]['boolValue']:![];_0x857db6['body'][_0x1a4b('0x39')]=_0x57e56c[_0x1a4b('0x31')]['intent']['name'];_0x857db6[_0x1a4b('0xc')]['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x57e56c['queryResult'][_0x1a4b('0x3a')]['displayName'];_0x857db6[_0x1a4b('0xc')]['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x57e56c[_0x1a4b('0x31')][_0x1a4b('0x3a')][_0x1a4b('0x3b')];_0x857db6['body'][_0x1a4b('0x3c')]=_0x57e56c[_0x1a4b('0x31')][_0x1a4b('0x3d')];_0x857db6[_0x1a4b('0xc')][_0x1a4b('0x3e')]=_0x57e56c[_0x1a4b('0x31')]['queryText'];_0x857db6['body'][_0x1a4b('0x3f')]=_0x57e56c[_0x1a4b('0x31')]['intentDetectionConfidence'];_0x4403ee[_0x1a4b('0x40')]=_0x1a4b('0x30');_0x4403ee[_0x1a4b('0x41')]=JSON['stringify'](_0x3fdb2a);var _0x3689fb=[];for(var _0x4e0066=0x0;_0x4e0066<_0x3fdb2a['length'];_0x4e0066++){var _0x352c20=_0x3fdb2a[_0x4e0066];if(_0x352c20&&_0x352c20[_0x1a4b('0x31')]&&_0x352c20['queryResult'][_0x1a4b('0x42')]){_0x3689fb[_0x1a4b('0x43')](createMessage(_0x3a464d,_0x4fede8,_0x4403ee,_0x352c20['queryResult'][_0x1a4b('0x42')]));}}return Promise['all'](_0x3689fb)[_0x1a4b('0x2e')](function(){if(_0x37c8b5){_0x59aa6b[_0x1a4b('0x15')]();}else{_0x59aa6b[_0x1a4b('0x28')]();}})[_0x1a4b('0xf')](function(_0x1c0dc5){logger['error'](_0x1a4b('0xe'),_0x3a464d,JSON[_0x1a4b('0x11')](_0x1c0dc5));_0x59aa6b[_0x1a4b('0x15')]();});}})[_0x1a4b('0xf')](function(_0x4a2ef9){logger['error'](_0x1a4b('0xe'),_0x3a464d,_0x4a2ef9[_0x1a4b('0x2c')],_0x4a2ef9[_0x1a4b('0x44')]);_0x59aa6b[_0x1a4b('0x15')]();});}}catch(_0xfaaf27){logger[_0x1a4b('0x10')](_0x1a4b('0xe'),_0x3a464d,JSON[_0x1a4b('0x11')](_0xfaaf27));_0x59aa6b[_0x1a4b('0x28')]();}};}; \ No newline at end of file +var _0xba24=['catch','stringify','consequence','isNil','UserId','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','whatsapp','phone','interaction','chat','ChatWebsiteId','account','upperFirst','AccountId','isEmpty','getMustacheRender','finally','stop','replace','SessionsClient','message','detectIntent','length','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','DIALOGFLOWV2_ENDCONVERSATION','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','intentDetectionConfidence','providerResponse','push','error','stack','lodash','dialogflow','md5','../../../../config/logger','routing','./utils','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','body'];(function(_0x48dd4c,_0x441aa7){var _0x3f6dec=function(_0xb9e411){while(--_0xb9e411){_0x48dd4c['push'](_0x48dd4c['shift']());}};_0x3f6dec(++_0x441aa7);}(_0xba24,0x77));var _0x4ba2=function(_0x314603,_0x2f2420){_0x314603=_0x314603-0x0;var _0x293bbd=_0xba24[_0x314603];return _0x293bbd;};'use strict';var _=require(_0x4ba2('0x0'));var dialogflow=require(_0x4ba2('0x1'));var md5=require(_0x4ba2('0x2'));var moment=require('moment');var Promise=require('bluebird');var logger=require(_0x4ba2('0x3'))(_0x4ba2('0x4'));var utils=require(_0x4ba2('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x4ba2('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x4ba2('0x7')),'faxMessage':require(_0x4ba2('0x8')),'whatsappMessage':require(_0x4ba2('0x9'))};function createMessage(_0x5cc578,_0x5a5592,_0x320873,_0x4d8cfc){return new Promise(function(_0xfa0773,_0xc18e88){var _0x2b5795=_[_0x4ba2('0xa')](_0x320873);_0x2b5795['body']=_0x4d8cfc;return rpc[_0x5a5592+_0x4ba2('0xb')][_0x4ba2('0xc')](_0x2b5795)[_0x4ba2('0xd')](function(){logger[_0x4ba2('0xe')](_0x4ba2('0xf'),_0x5cc578,_0x2b5795[_0x4ba2('0x10')]);_0xfa0773();})[_0x4ba2('0x11')](function(_0x300331){logger['error'](_0x4ba2('0xf'),_0x5cc578,JSON[_0x4ba2('0x12')](_0x300331));_0xc18e88(_0x300331);});});}exports[_0x4ba2('0x13')]=function(_0x1ac3bf,_0x300cf2){return function(_0x4636da){try{if(!_[_0x4ba2('0x14')](this['interaction'][_0x4ba2('0x15')])){logger['info'](_0x4ba2('0xf'),_0x1ac3bf,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x4636da[_0x4ba2('0x16')]();}var _0x36bbcb={'ContactId':this[_0x4ba2('0x17')]['id'],'sentAt':moment()[_0x4ba2('0x18')](_0x4ba2('0x19')),'direction':_0x4ba2('0x1a')};if(this['channel']===_0x4ba2('0x1b')||this['channel']===_0x4ba2('0x1c')){_0x36bbcb[_0x4ba2('0x1d')]=this[_0x4ba2('0x1e')][_0x4ba2('0x1d')];}var _0x1bcdf5=this['channel'];if(_0x1bcdf5===_0x4ba2('0x1f')){_0x36bbcb[_0x4ba2('0x20')]=this[_0x4ba2('0x21')]['id'];}else{_0x36bbcb[_[_0x4ba2('0x22')](_0x1bcdf5)+_0x4ba2('0x23')]=this[_0x4ba2('0x21')]['id'];}_0x36bbcb[_['upperFirst'](_0x1bcdf5)+'InteractionId']=this['interaction']['id'];if(this['interaction']['created']){var _0x85aa6f=_0x300cf2[0x4];if(!_[_0x4ba2('0x24')](_0x85aa6f)){_0x36bbcb[_0x4ba2('0x10')]=utils[_0x4ba2('0x25')](_0x85aa6f,this);return rpc[_0x1bcdf5+_0x4ba2('0xb')][_0x4ba2('0xc')](_0x36bbcb)[_0x4ba2('0xd')](function(_0x4416ab){logger[_0x4ba2('0xe')](_0x4ba2('0xf'),_0x1ac3bf,_0x36bbcb[_0x4ba2('0x10')]);})['catch'](function(_0x4e5e95){logger['error'](_0x4ba2('0xf'),_0x1ac3bf,JSON['stringify'](_0x4e5e95));})[_0x4ba2('0x26')](function(){logger[_0x4ba2('0xe')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x1ac3bf);_0x4636da[_0x4ba2('0x27')]();});}else{logger['info']('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x1ac3bf);_0x4636da['stop']();}}else{var _0x35d0b8=this;var _0x2b0234=_0x300cf2[0x2][_0x4ba2('0x28')](/\\n/g,'\x0a');var _0x1f27ef={'credentials':{'private_key':_0x2b0234,'client_email':_0x300cf2[0x1]}};var _0x20796c=new dialogflow[(_0x4ba2('0x29'))](_0x1f27ef);var _0x30bf8e=_0x20796c['sessionPath'](_0x300cf2[0x0],md5(_0x35d0b8[_0x4ba2('0x1e')]['id']));var _0x2f726e={'session':_0x30bf8e,'queryInput':{'text':{'text':_0x35d0b8[_0x4ba2('0x2a')][_0x4ba2('0x10')],'languageCode':_0x300cf2[0x3]||'en'}}};return _0x20796c[_0x4ba2('0x2b')](_0x2f726e)[_0x4ba2('0xd')](function(_0x1ab7f4){if(_0x1ab7f4&&_0x1ab7f4[_0x4ba2('0x2c')]){_0x35d0b8['body']['dialogflowV2']=_0x1ab7f4;var _0x33f7bb=_0x1ab7f4[0x0];var _0x1217c1=_0x33f7bb['queryResult']['diagnosticInfo']&&_0x33f7bb[_0x4ba2('0x2d')][_0x4ba2('0x2e')][_0x4ba2('0x2f')]?_0x33f7bb[_0x4ba2('0x2d')][_0x4ba2('0x2e')]['fields'][_0x4ba2('0x30')][_0x4ba2('0x31')]:![];_0x35d0b8[_0x4ba2('0x10')][_0x4ba2('0x32')]=_0x33f7bb['queryResult'][_0x4ba2('0x33')];_0x35d0b8['body'][_0x4ba2('0x34')]=_0x33f7bb[_0x4ba2('0x2d')]['allRequiredParamsPresent'];_0x35d0b8[_0x4ba2('0x10')][_0x4ba2('0x35')]=_0x33f7bb[_0x4ba2('0x2d')][_0x4ba2('0x2e')]&&_0x33f7bb[_0x4ba2('0x2d')][_0x4ba2('0x2e')][_0x4ba2('0x2f')]?_0x33f7bb[_0x4ba2('0x2d')][_0x4ba2('0x2e')][_0x4ba2('0x2f')]['end_conversation']['boolValue']:![];_0x35d0b8[_0x4ba2('0x10')]['DIALOGFLOWV2_INTENTNAME']=_0x33f7bb[_0x4ba2('0x2d')][_0x4ba2('0x36')][_0x4ba2('0x37')];_0x35d0b8[_0x4ba2('0x10')][_0x4ba2('0x38')]=_0x33f7bb['queryResult'][_0x4ba2('0x36')][_0x4ba2('0x39')];_0x35d0b8[_0x4ba2('0x10')][_0x4ba2('0x3a')]=_0x33f7bb[_0x4ba2('0x2d')][_0x4ba2('0x36')][_0x4ba2('0x3b')];_0x35d0b8[_0x4ba2('0x10')]['DIALOGFLOWV2_LANGUAGECODE']=_0x33f7bb[_0x4ba2('0x2d')][_0x4ba2('0x3c')];_0x35d0b8['body'][_0x4ba2('0x3d')]=_0x33f7bb[_0x4ba2('0x2d')][_0x4ba2('0x3e')];_0x35d0b8['body']['DIALOGFLOWV2_SCORE']=_0x33f7bb['queryResult'][_0x4ba2('0x3f')];_0x36bbcb['providerName']='dialogflowV2';_0x36bbcb[_0x4ba2('0x40')]=JSON['stringify'](_0x1ab7f4);var _0x52bfd2=[];for(var _0x151758=0x0;_0x151758<_0x1ab7f4[_0x4ba2('0x2c')];_0x151758++){var _0x306c94=_0x1ab7f4[_0x151758];if(_0x306c94&&_0x306c94[_0x4ba2('0x2d')]&&_0x306c94[_0x4ba2('0x2d')]['fulfillmentText']){_0x52bfd2[_0x4ba2('0x41')](createMessage(_0x1ac3bf,_0x1bcdf5,_0x36bbcb,_0x306c94[_0x4ba2('0x2d')]['fulfillmentText']));}}return Promise['all'](_0x52bfd2)[_0x4ba2('0xd')](function(){if(_0x1217c1){_0x4636da[_0x4ba2('0x16')]();}else{_0x4636da[_0x4ba2('0x27')]();}})['catch'](function(_0x7e77e1){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x1ac3bf,JSON[_0x4ba2('0x12')](_0x7e77e1));_0x4636da['next']();});}})[_0x4ba2('0x11')](function(_0x369630){logger[_0x4ba2('0x42')]('[%s][DIALOGFLOWV2]\x20%s',_0x1ac3bf,_0x369630[_0x4ba2('0x2a')],_0x369630[_0x4ba2('0x43')]);_0x4636da[_0x4ba2('0x16')]();});}}catch(_0x5ed530){logger[_0x4ba2('0x42')]('[%s][DIALOGFLOWV2]\x20%s',_0x1ac3bf,JSON[_0x4ba2('0x12')](_0x5ed530));_0x4636da['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index 43b9593..a076790 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _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 +var _0xf052=['join','stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','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','lodash','html-to-text','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','priority\x20true\x20is\x20a\x20number','number','consequence','fromString','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','map','message'];(function(_0x1f4427,_0xee55a4){var _0x15be7c=function(_0x4d1481){while(--_0x4d1481){_0x1f4427['push'](_0x1f4427['shift']());}};_0x15be7c(++_0xee55a4);}(_0xf052,0x1a0));var _0x2f05=function(_0x25f686,_0x199629){_0x25f686=_0x25f686-0x0;var _0x54ad10=_0xf052[_0x25f686];return _0x54ad10;};'use strict';var schema=require(_0x2f05('0x0'));var _=require(_0x2f05('0x1'));var htmlToText=require(_0x2f05('0x2'));var utils=require('./utils');var logger=require(_0x2f05('0x3'))(_0x2f05('0x4'));var gotoif=schema({'condition':{'type':_0x2f05('0x5'),'required':!![],'message':_0x2f05('0x6')},'priorityTrue':{'type':'number','message':_0x2f05('0x7')},'priorityFalse':{'type':_0x2f05('0x8'),'message':'priority\x20false\x20is\x20a\x20number'}});exports[_0x2f05('0x9')]=function(_0x17a432,_0x3702ed){return function(_0x559cb5){try{var _0x21bc63={'condition':htmlToText[_0x2f05('0xa')](utils[_0x2f05('0xb')](_0x3702ed[0x0],this),{'wordwrap':![]})[_0x2f05('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x3702ed[0x1],'priorityFalse':_0x3702ed[0x2]};var _0x344ab1=gotoif[_0x2f05('0x0')](_0x21bc63,{'typecast':!![]});if(_0x344ab1[_0x2f05('0xd')]){logger[_0x2f05('0xe')](_0x2f05('0xf'),_0x17a432,_[_0x2f05('0x10')](_0x344ab1,_0x2f05('0x11'))[_0x2f05('0x12')](',\x20'));_0x559cb5[_0x2f05('0x13')]();}else{try{var _0x9537f8=eval('('+_0x21bc63[_0x2f05('0x14')]+')');var _0x129755=_0x9537f8?_0x21bc63[_0x2f05('0x15')]:_0x21bc63[_0x2f05('0x16')];logger[_0x2f05('0x17')](_0x2f05('0x18'),_0x17a432,_0x21bc63['condition'],_0x9537f8,_0x129755||_0x2f05('0x19'));if(_0x129755){var _0x2d5ac6=_['findIndex'](_0x559cb5[_0x2f05('0x1a')](),{'p':_0x129755});if(_0x2d5ac6>=0x0){logger[_0x2f05('0x17')](_0x2f05('0x1b'),_0x17a432,_0x129755||_0x2f05('0x19'),_0x2d5ac6);_0x559cb5['next'](_0x2d5ac6);}else{logger[_0x2f05('0x17')](_0x2f05('0x1c'),_0x17a432,_0x129755||_0x2f05('0x19'));_0x559cb5['stop']();}}else{_0x559cb5[_0x2f05('0x19')]();}}catch(_0x202706){logger[_0x2f05('0xe')](_0x2f05('0x1d'),_0x17a432,_0x202706[_0x2f05('0x11')]);_0x559cb5['stop']();}}}catch(_0x4a0985){logger[_0x2f05('0xe')](_0x2f05('0xf'),_0x17a432,JSON[_0x2f05('0x1e')](_0x4a0985));_0x559cb5['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index 84324f9..5d0820c 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 _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 +var _0xb99f=['number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','error','[%s][GOTOP]\x20%s','join','stop','info','[%s][GOTOP]\x20priority\x20%s','findIndex','rules','priority','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','../../../../config/logger','routing'];(function(_0x8d562a,_0x484acf){var _0x2c59df=function(_0x40cd73){while(--_0x40cd73){_0x8d562a['push'](_0x8d562a['shift']());}};_0x2c59df(++_0x484acf);}(_0xb99f,0x12c));var _0xfb99=function(_0x67f95e,_0x3ca797){_0x67f95e=_0x67f95e-0x0;var _0x538f5a=_0xb99f[_0x67f95e];return _0x538f5a;};'use strict';var schema=require(_0xfb99('0x0'));var _=require(_0xfb99('0x1'));var logger=require(_0xfb99('0x2'))(_0xfb99('0x3'));var gotop=schema({'priority':{'type':_0xfb99('0x4'),'required':!![],'message':_0xfb99('0x5')}});exports[_0xfb99('0x6')]=function(_0x1e0009,_0x202811){return function(_0x509863){try{var _0x25840f={'priority':_0x202811[0x0]};var _0x33136b=gotop['validate'](_0x25840f,{'typecast':!![]});if(_0x33136b['length']){logger[_0xfb99('0x7')](_0xfb99('0x8'),_0x1e0009,_['map'](_0x33136b,'message')[_0xfb99('0x9')](',\x20'));_0x509863[_0xfb99('0xa')]();}else{logger[_0xfb99('0xb')](_0xfb99('0xc'),_0x1e0009,_0x25840f['priority']);if(_0x25840f['priority']){var _0x38f30f=_[_0xfb99('0xd')](_0x509863[_0xfb99('0xe')](),{'p':_0x25840f[_0xfb99('0xf')]});if(_0x38f30f>=0x0){logger['info']('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x1e0009,_0x25840f[_0xfb99('0xf')]||'next',_0x38f30f);_0x509863[_0xfb99('0x10')](_0x38f30f);}else{logger[_0xfb99('0xb')](_0xfb99('0x11'),_0x1e0009,_0x25840f[_0xfb99('0xf')]||_0xfb99('0x10'));_0x509863['stop']();}}else{_0x509863['next']();}}}catch(_0x17ab4b){logger[_0xfb99('0x7')](_0xfb99('0x8'),_0x1e0009,JSON[_0xfb99('0x12')](_0x17ab4b));_0x509863['stop']();}};}; \ 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 60704f8..ccc46ef 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 _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 +var _0x928c=['InteractionId','Message','then','[%s][MESSAGE]\x20%s','body','catch','error','stringify','stop','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','channel','chat','ChatWebsiteId','account','upperFirst','AccountId'];(function(_0x3ff0ab,_0xad6a24){var _0x493294=function(_0x1e4295){while(--_0x1e4295){_0x3ff0ab['push'](_0x3ff0ab['shift']());}};_0x493294(++_0xad6a24);}(_0x928c,0x17f));var _0xc928=function(_0x23511a,_0x16955b){_0x23511a=_0x23511a-0x0;var _0x186fcb=_0x928c[_0x23511a];return _0x186fcb;};'use strict';var _=require('lodash');var utils=require('./utils');var logger=require(_0xc928('0x0'))(_0xc928('0x1'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xc928('0x2')),'mailMessage':require(_0xc928('0x3')),'smsMessage':require(_0xc928('0x4')),'faxMessage':require(_0xc928('0x5')),'whatsappMessage':require(_0xc928('0x6'))};exports['consequence']=function(_0x3c7369,_0x4704bc){return function(_0x8c0fa5){try{var _0x4ff9e6={'body':utils['getMustacheRender'](_0x4704bc[0x0],this),'ContactId':this['contact']['id']};if(this[_0xc928('0x7')]===_0xc928('0x8')){_0x4ff9e6[_0xc928('0x9')]=this[_0xc928('0xa')]['id'];}else{_0x4ff9e6[_[_0xc928('0xb')](this[_0xc928('0x7')])+_0xc928('0xc')]=this[_0xc928('0xa')]['id'];}_0x4ff9e6[_['upperFirst'](this[_0xc928('0x7')])+_0xc928('0xd')]=this['interaction']['id'];if(rpc[this['channel']+_0xc928('0xe')]){return rpc[this['channel']+_0xc928('0xe')]['create'](_0x4ff9e6)[_0xc928('0xf')](function(_0x2e3a6f){logger['info'](_0xc928('0x10'),_0x3c7369,_0x4ff9e6[_0xc928('0x11')]);_0x8c0fa5['next']();})[_0xc928('0x12')](function(_0x3ae32f){logger[_0xc928('0x13')](_0xc928('0x10'),_0x3c7369,JSON[_0xc928('0x14')](_0x3ae32f));_0x8c0fa5[_0xc928('0x15')]();});}}catch(_0x546cfe){logger[_0xc928('0x13')](_0xc928('0x10'),_0x3c7369,JSON[_0xc928('0x14')](_0x546cfe));_0x8c0fa5[_0xc928('0x15')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index a5e786b..9ef49f7 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 _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 +var _0x12fe=['routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','stop','../../../../config/logger'];(function(_0x5f0573,_0x1368cc){var _0x505466=function(_0x1d7f9f){while(--_0x1d7f9f){_0x5f0573['push'](_0x5f0573['shift']());}};_0x505466(++_0x1368cc);}(_0x12fe,0x18f));var _0xe12f=function(_0x3e02f9,_0x3fd50f){_0x3e02f9=_0x3e02f9-0x0;var _0x3b0ec8=_0x12fe[_0x3e02f9];return _0x3b0ec8;};'use strict';var utils=require('./utils');var logger=require(_0xe12f('0x0'))(_0xe12f('0x1'));exports[_0xe12f('0x2')]=function(_0x2542be,_0x27f4ff){return function(_0x5dac7a){try{logger[_0xe12f('0x3')](_0xe12f('0x4'),_0x2542be,utils[_0xe12f('0x5')](_0x27f4ff[0x0],this));_0x5dac7a[_0xe12f('0x6')]();}catch(_0x3d217b){logger[_0xe12f('0x7')]('[%s][NOOP]\x20%s',_0x2542be,JSON[_0xe12f('0x8')](_0x3d217b));_0x5dac7a[_0xe12f('0x9')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 881ca7a..fb15e14 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 _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 +var _0x22e7=['InteractionId','%sQueuesWaitingInteractions','format','%s:queue:%s','%s_queue_waiting_interaction:%s','remove','pick','../../rpc/mailQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/mailInteraction','../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','contact','list','upperFirst','channel','QueueId','interaction','MessageId','chat','AccountId','WebsiteId','account','[%s][START:QUEUE][NAME:%s]','name','message','QueueReport','create','catch','create\x20queue\x20report','accepted','info','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','then','update\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','error','join','find','timeout','createQueue','atimeout','qtimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','stop','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','moment','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','socket.io-emitter','queue_id','queue','from','joinAt','emit','push','capitalize'];(function(_0xeef081,_0x410eb3){var _0x5739e0=function(_0x24605){while(--_0x24605){_0xeef081['push'](_0xeef081['shift']());}};_0x5739e0(++_0x410eb3);}(_0x22e7,0x9d));var _0x722e=function(_0x1b26dc,_0x3d7fdf){_0x1b26dc=_0x1b26dc-0x0;var _0x37c518=_0x22e7[_0x1b26dc];return _0x37c518;};'use strict';var schema=require(_0x722e('0x0'));var _=require(_0x722e('0x1'));var util=require(_0x722e('0x2'));var seqqueue=require(_0x722e('0x3'));var moment=require(_0x722e('0x4'));var Redis=require('ioredis');var config=require(_0x722e('0x5'));var logger=require(_0x722e('0x6'))(_0x722e('0x7'));var strategy=require(_0x722e('0x8'));config[_0x722e('0x9')]=_[_0x722e('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x722e('0xb'))(new Redis(config[_0x722e('0x9')]));var attributes=['id',_0x722e('0xc'),'account',_0x722e('0xd'),_0x722e('0xe'),_0x722e('0xf')];function emit(_0x220d17,_0x277d14,_0x497801){io['to'](_0x220d17)[_0x722e('0x10')](_0x277d14,_0x497801);}function emitChannelQueueInteraction(_0x29a436,_0x40cc4e,_0x558654,_0x4ea159,_0xf48b89,_0x4bb767,_0x5d8e87,_0xa88e21){var _0x69096b=_['clone'](_0x558654);_0x69096b[_0x722e('0xc')]=_0xa88e21;_0x69096b[_0x722e('0xd')]=_0x40cc4e;_0x69096b['account']=_0x4ea159;_0x69096b['id']=_0xf48b89;if(_0x4bb767){attributes[_0x722e('0x11')](_[_0x722e('0x12')](_0x29a436)+_0x722e('0x13'));_0x5d8e87[util['format'](_0x722e('0x14'),_0x29a436)][_0xf48b89]=_['pick'](_0x69096b,attributes);}else{delete _0x5d8e87[util[_0x722e('0x15')](_0x722e('0x14'),_0x29a436)][_0xf48b89];}emit(util[_0x722e('0x15')](_0x722e('0x16'),_0x29a436,_0x40cc4e),util['format'](_0x722e('0x17'),_0x29a436,_0x4bb767?'save':_0x722e('0x18')),_[_0x722e('0x19')](_0x69096b,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x722e('0x1a')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x722e('0x1b')),'faxQueueReport':require(_0x722e('0x1c')),'whatsappQueueReport':require(_0x722e('0x1d')),'chatInteraction':require('../../rpc/chatInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'mailInteraction':require(_0x722e('0x1e')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'whatsappInteraction':require(_0x722e('0x1f'))};var queue=schema({'name':{'type':_0x722e('0x20'),'required':!![],'message':_0x722e('0x21')},'timeout':{'type':_0x722e('0x22'),'message':_0x722e('0x23')}});function startRouting(_0xfb4489,_0x2ad6d6,_0x5e971c,_0x259bcb){if(_0xfb4489&&_0x2ad6d6&&_0x5e971c){_0x2ad6d6[_0x722e('0x24')]+=0x1;var _0x531d58={'uniqueid':_0xfb4489,'from':_0x5e971c[_0x722e('0x25')]?_0x5e971c['body'][_0x722e('0xe')]:'','joinAt':moment()[_0x722e('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5e971c[_0x722e('0x26')]?_0x5e971c[_0x722e('0x26')]['id']:null,'ListId':_0x5e971c[_0x722e('0x27')]?_0x5e971c[_0x722e('0x27')]['id']:null};_0x531d58[_[_0x722e('0x28')](_0x5e971c[_0x722e('0x29')])+_0x722e('0x2a')]=_0x2ad6d6['id']||null;_0x531d58[_[_0x722e('0x28')](_0x5e971c[_0x722e('0x29')])+'InteractionId']=_0x5e971c[_0x722e('0x2b')]?_0x5e971c[_0x722e('0x2b')]['id']:null;_0x531d58[_[_0x722e('0x28')](_0x5e971c[_0x722e('0x29')])+_0x722e('0x2c')]=_0x5e971c['message']?_0x5e971c['message']['id']:null;_0x531d58[_[_0x722e('0x28')](_0x5e971c[_0x722e('0x29')])+(_0x5e971c['channel']!==_0x722e('0x2d')?_0x722e('0x2e'):_0x722e('0x2f'))]=_0x5e971c[_0x722e('0x30')]?_0x5e971c[_0x722e('0x30')]['id']:null;logger['info'](util[_0x722e('0x15')](_0x722e('0x31'),_0xfb4489,_0x2ad6d6['name']));emitChannelQueueInteraction(_0x5e971c[_0x722e('0x29')],_0x2ad6d6[_0x722e('0x32')],_0x531d58,_0x5e971c[_0x722e('0x30')][_0x722e('0x32')],_0x5e971c[_0x722e('0x33')]['id'],!![],_0x259bcb,_0x2ad6d6['id']);if(rpc[_0x5e971c[_0x722e('0x29')]+_0x722e('0x34')]){return rpc[_0x5e971c[_0x722e('0x29')]+_0x722e('0x34')][_0x722e('0x35')](_0x531d58)[_0x722e('0x36')](function(_0x2efe2a){logger['error'](_0x722e('0x37'),_0x2efe2a);});}}}function stopRouting(_0x3c8f84,_0x1c1e67,_0x5b450f,_0x8b6375){if(_0x3c8f84&&_0x1c1e67){_0x1c1e67[_0x722e('0x24')]-=0x1;var _0x8341bb={'leaveAt':moment()[_0x722e('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0x722e('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x722e('0x38')};logger[_0x722e('0x39')](util['format'](_0x722e('0x3a'),_0x3c8f84,_0x1c1e67[_0x722e('0x32')]));emitChannelQueueInteraction(_0x5b450f[_0x722e('0x29')],_0x1c1e67[_0x722e('0x32')],_0x5b450f['body'],_0x5b450f[_0x722e('0x30')][_0x722e('0x32')],_0x5b450f[_0x722e('0x33')]['id'],![],_0x8b6375,_0x1c1e67['id']);return rpc[_0x5b450f[_0x722e('0x29')]+_0x722e('0x3b')][_0x722e('0x3c')](_0x5b450f['interaction']['id'],{'queueId':_0x1c1e67['id']})[_0x722e('0x3d')](function(){if(rpc[_0x5b450f[_0x722e('0x29')]+_0x722e('0x34')]){return rpc[_0x5b450f[_0x722e('0x29')]+'QueueReport']['update'](_0x3c8f84,_0x8341bb)[_0x722e('0x36')](function(_0x3bb3eb){logger['error'](_0x722e('0x3e'),_0x3bb3eb);});}});}}function endRouting(_0x52f22b,_0x1a151a,_0x58d58d,_0x325541){if(_0x52f22b&&_0x1a151a){_0x1a151a[_0x722e('0x24')]-=0x1;var _0x6b7e6a={'leaveAt':moment()[_0x722e('0x15')](_0x722e('0x3f')),'exitAt':moment()[_0x722e('0x15')](_0x722e('0x3f')),'reason':'timeout'};logger[_0x722e('0x39')](util['format'](_0x722e('0x40'),_0x52f22b,_0x1a151a[_0x722e('0x32')]));emitChannelQueueInteraction(_0x58d58d['channel'],_0x1a151a[_0x722e('0x32')],_0x58d58d[_0x722e('0x25')],_0x58d58d['account'][_0x722e('0x32')],_0x58d58d[_0x722e('0x33')]['id'],![],_0x325541);if(rpc[_0x58d58d['channel']+_0x722e('0x34')]){return rpc[_0x58d58d['channel']+'QueueReport']['update'](_0x52f22b,_0x6b7e6a)[_0x722e('0x36')](function(_0x34ab80){logger['error']('update\x20queue\x20report',_0x34ab80);});}}}function handleFindQueue(_0x501dc6){return function(_0x73e77){return _0x73e77['name'][_0x722e('0x41')]()===_0x501dc6[_0x722e('0x41')]();};}exports[_0x722e('0x42')]=function(_0x37f6f7,_0x3cfbc0,_0x5585d4,_0x22326c){return function(_0x10706c){try{var _0x43b375={'name':_0x3cfbc0[0x0],'timeout':_0x3cfbc0[0x1]};var _0x152cad=queue[_0x722e('0x0')](_0x43b375,{'typecast':!![]});if(_0x152cad[_0x722e('0x43')]){logger[_0x722e('0x44')]('[%s][QUEUE]\x20%s',_0x37f6f7,_['map'](_0x152cad,_0x722e('0x33'))[_0x722e('0x45')](',\x20'));_0x10706c['stop']();}else{var _0x283523=_[_0x722e('0x46')](_0x5585d4[_0x22326c[_0x722e('0x29')]+'Queues'],handleFindQueue(_0x43b375['name']));if(_0x283523){startRouting(_0x37f6f7,_0x283523,_0x22326c,_0x5585d4);var _0x21d541=(_0x283523[_0x722e('0x47')]||0xa)*0x3e8;var _0xa01dbe=(_0x43b375['timeout']||0x14)*0x3e8;var _0x1f42b8;if(_0x21d541>_0xa01dbe){_0xa01dbe=_0x21d541;}var _0x48e166=seqqueue[_0x722e('0x48')](_0x21d541);_0x48e166['id']=_0x37f6f7;_0x48e166[_0x722e('0x49')]=_0x21d541;_0x48e166[_0x722e('0x4a')]=_0xa01dbe;_0x48e166[_0x722e('0x29')]=_0x22326c[_0x722e('0x29')];_0x5585d4['rules'][_0x37f6f7]['on'](_0x722e('0x4b'),function(){logger[_0x722e('0x39')](_0x722e('0x4c'),_0x37f6f7);stopRouting(_0x37f6f7,_0x283523,_0x22326c,_0x5585d4);clearTimeout(_0x1f42b8);_0x1f42b8=undefined;_0x48e166[_0x722e('0x4d')](!![]);if(_0x5585d4['rules'][_0x37f6f7]){delete _0x5585d4[_0x722e('0x4e')][_0x37f6f7];}_0x10706c[_0x722e('0x4f')]();});_0x5585d4['rules'][_0x37f6f7]['on'](_0x722e('0x50'),function(){if(_0x5585d4[_0x722e('0x4e')][_0x37f6f7]){delete _0x5585d4[_0x722e('0x4e')][_0x37f6f7];}});_0x1f42b8=setTimeout(function(){logger['info'](_0x722e('0x51'),_0x37f6f7);endRouting(_0x37f6f7,_0x283523,_0x22326c,_0x5585d4);clearTimeout(_0x1f42b8);_0x48e166[_0x722e('0x4d')](!![]);_0x10706c[_0x722e('0x52')]();},_0xa01dbe);switch(_0x283523[_0x722e('0x53')]){case _0x722e('0x54'):strategy[_0x722e('0x54')](_0x48e166,_0x283523,_0x5585d4,_0x22326c);break;default:strategy[_0x722e('0x55')](_0x48e166,_0x283523,_0x5585d4,_0x22326c);}}else{logger[_0x722e('0x44')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x37f6f7,_0x43b375[_0x722e('0x32')]);_0x10706c[_0x722e('0x4f')]();}}}catch(_0x2391bd){logger[_0x722e('0x44')](_0x722e('0x56'),_0x37f6f7,_0x2391bd[_0x722e('0x57')]);_0x10706c[_0x722e('0x4f')]();}};}; \ 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 af2e639..85a6d30 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 _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 +var _0xbec5=['bind','handleTimeout','drained','handleDrained','prototype','debug','[%s][AGENT]\x20try\x20with\x20%s','isNil','realtime','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','busy','saveWaitingNotification','channel','showNotification','writeLog','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busyQueue','removeWaitingNotification','STOP','lodash','uuid','../../../../../config/logger','routing','notificationId','squeue','agent','push','handleRun'];(function(_0x534982,_0x1dc7a0){var _0x10a77d=function(_0x5c5bb8){while(--_0x5c5bb8){_0x534982['push'](_0x534982['shift']());}};_0x10a77d(++_0x1dc7a0);}(_0xbec5,0xe5));var _0x5bec=function(_0x52684f,_0xff73fc){_0x52684f=_0x52684f-0x0;var _0x4a55f0=_0xbec5[_0x52684f];return _0x4a55f0;};'use strict';var _=require(_0x5bec('0x0'));var uuid=require(_0x5bec('0x1'));var util=require('./util');var logger=require(_0x5bec('0x2'))(_0x5bec('0x3'));var Agent=function(_0x276b9e,_0x3859a1,_0x244027,_0x4ee982){this[_0x5bec('0x4')]=uuid['v4']();this[_0x5bec('0x5')]=_0x276b9e;this[_0x5bec('0x6')]=_0x3859a1;this['realtime']=_0x244027;this[_0x5bec('0x3')]=_0x4ee982;this[_0x5bec('0x5')][_0x5bec('0x7')](this[_0x5bec('0x8')][_0x5bec('0x9')](this),this[_0x5bec('0xa')][_0x5bec('0x9')](this));this[_0x5bec('0x5')]['on']('timeout',this[_0x5bec('0xa')]['bind'](this));this[_0x5bec('0x5')]['on'](_0x5bec('0xb'),this[_0x5bec('0xc')]['bind'](this));};Agent[_0x5bec('0xd')][_0x5bec('0x7')]=function(){this[_0x5bec('0x5')]['push'](this[_0x5bec('0x8')][_0x5bec('0x9')](this),this['handleTimeout'][_0x5bec('0x9')](this));};Agent[_0x5bec('0xd')][_0x5bec('0xc')]=function(){this[_0x5bec('0xa')](!![]);};Agent[_0x5bec('0xd')][_0x5bec('0x8')]=function(){logger[_0x5bec('0xe')](_0x5bec('0xf'),this[_0x5bec('0x5')]['id'],this[_0x5bec('0x6')]['id']);if(_[_0x5bec('0x10')](this[_0x5bec('0x11')][_0x5bec('0x12')][this['agent']['id']])){logger['debug'](_0x5bec('0x13'),this[_0x5bec('0x5')]['id'],this[_0x5bec('0x6')]['id']);setTimeout(this[_0x5bec('0x7')]['bind'](this),0x3e8);}else{if(this['routing'][_0x5bec('0x14')]||util[_0x5bec('0x15')](this['squeue']['id'],this[_0x5bec('0x11')][_0x5bec('0x12')][this[_0x5bec('0x6')]['id']],this[_0x5bec('0x5')]['channel'],![])){this[_0x5bec('0x11')]['agents'][this[_0x5bec('0x6')]['id']][_0x5bec('0x16')]=!![];this[_0x5bec('0x11')][_0x5bec('0x12')][this[_0x5bec('0x6')]['id']]['busyQueue']=undefined;util[_0x5bec('0x17')](this['realtime'],this[_0x5bec('0x3')],this[_0x5bec('0x6')],this['squeue'][_0x5bec('0x18')]);util[_0x5bec('0x19')](this['notificationId'],this[_0x5bec('0x5')]['id'],this[_0x5bec('0x11')][_0x5bec('0x12')][this[_0x5bec('0x6')]['id']],null,this[_0x5bec('0x3')]);util[_0x5bec('0x1a')](this[_0x5bec('0x5')]['id'],this['realtime']['agents'][this['agent']['id']],_0x5bec('0x1b')+(this[_0x5bec('0x3')][_0x5bec('0x14')]?':FORCED':''));}else{logger[_0x5bec('0xe')](_0x5bec('0x1c'),this['squeue']['id'],this[_0x5bec('0x6')]['id']);setTimeout(this[_0x5bec('0x7')]['bind'](this),0x3e8);}}};Agent['prototype'][_0x5bec('0xa')]=function(_0x2a82d5){if(_[_0x5bec('0x10')](this[_0x5bec('0x11')][_0x5bec('0x12')][this[_0x5bec('0x6')]['id']])){return logger['debug'](_0x5bec('0x13'),this['squeue']['id'],this[_0x5bec('0x6')]['id']);}else{logger[_0x5bec('0xe')](_0x5bec('0x1d'),this[_0x5bec('0x5')]['id'],this['agent']['id']);util[_0x5bec('0x1e')](this[_0x5bec('0x4')],this[_0x5bec('0x5')]['id'],this['realtime'][_0x5bec('0x12')][this['agent']['id']],null,this[_0x5bec('0x3')]);this[_0x5bec('0x11')][_0x5bec('0x12')][this['agent']['id']][_0x5bec('0x16')]=![];this[_0x5bec('0x11')]['agents'][this[_0x5bec('0x6')]['id']][_0x5bec('0x1f')]=undefined;util[_0x5bec('0x20')](this[_0x5bec('0x11')],this[_0x5bec('0x3')],this['agent'],this[_0x5bec('0x5')]['channel']);util[_0x5bec('0x1a')](this[_0x5bec('0x5')]['id'],this[_0x5bec('0x11')][_0x5bec('0x12')][this[_0x5bec('0x6')]['id']],_0x2a82d5?_0x5bec('0x21'):'TIMEOUT');}if(!_0x2a82d5){setTimeout(this[_0x5bec('0x7')][_0x5bec('0x9')](this),0x3e8);}};function agent(_0x1d42b0,_0x5de683,_0x40db29,_0x355707){return new Agent(_0x1d42b0,_0x5de683,_0x40db29,_0x355707);}module['exports']=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 b7187e5..e172d03 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 _0xae5d=['squeue','routing','push','handleRun','bind','handleTimeout','drained','handleDrained','prototype','queue','isNil','Agents','length','realtime','agents','debug','channel','writeLog','busy','name','saveWaitingNotification','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','hideNotification','TIMEOUT','busyQueue','removeWaitingNotification','lodash','uuid','./util','../../../../../config/logger','notificationId'];(function(_0x1edad5,_0x58c0af){var _0x156a73=function(_0x1f1859){while(--_0x1f1859){_0x1edad5['push'](_0x1edad5['shift']());}};_0x156a73(++_0x58c0af);}(_0xae5d,0xa5));var _0xdae5=function(_0x3eb4a9,_0x359d73){_0x3eb4a9=_0x3eb4a9-0x0;var _0x48dbad=_0xae5d[_0x3eb4a9];return _0x48dbad;};'use strict';var _=require(_0xdae5('0x0'));var uuid=require(_0xdae5('0x1'));var util=require(_0xdae5('0x2'));var logger=require(_0xdae5('0x3'))('routing');var Beepall=function(_0x5f15a4,_0x386a6d,_0x62f46,_0x38b00c){this[_0xdae5('0x4')]=uuid['v4']();this[_0xdae5('0x5')]=_0x5f15a4;this['queue']=_0x386a6d;this['realtime']=_0x62f46;this[_0xdae5('0x6')]=_0x38b00c;this['squeue'][_0xdae5('0x7')](this[_0xdae5('0x8')][_0xdae5('0x9')](this),this[_0xdae5('0xa')][_0xdae5('0x9')](this));this[_0xdae5('0x5')]['on']('timeout',this[_0xdae5('0xa')][_0xdae5('0x9')](this));this[_0xdae5('0x5')]['on'](_0xdae5('0xb'),this[_0xdae5('0xc')][_0xdae5('0x9')](this));};Beepall[_0xdae5('0xd')]['push']=function(){this['squeue']['push'](this[_0xdae5('0x8')]['bind'](this),this[_0xdae5('0xa')][_0xdae5('0x9')](this));};Beepall[_0xdae5('0xd')]['handleDrained']=function(){this[_0xdae5('0xa')](!![]);};Beepall[_0xdae5('0xd')][_0xdae5('0x8')]=function(){var _0x46282d=!![];if(!_['isNil'](this[_0xdae5('0xe')])&&!_[_0xdae5('0xf')](this[_0xdae5('0xe')][_0xdae5('0x10')])&&this[_0xdae5('0xe')][_0xdae5('0x10')][_0xdae5('0x11')]>0x0){for(var _0x478581=0x0,_0x519f7b;_0x4785810x0){for(var _0x186bec=0x0,_0x47a943;_0x186bec0x0&&_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 +var _0x1f66=['\x20MAXCAPACITY','showNotification','hideNotification','checkWaitingNotifications','interaction','UserId','some','channel','capitalize','agents','WaitingInteractions','writeLog','lodash','util','../utils','ioredis','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','\x20interaction','name','notificationSound','account','body','queue','notificationTemplate','msg','error','format','[%s][QUEUE]\x20%s','message','emit','notification:%s','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','online','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase'];(function(_0x55d1b1,_0x70cede){var _0x3702fa=function(_0xa7e079){while(--_0xa7e079){_0x55d1b1['push'](_0x55d1b1['shift']());}};_0x3702fa(++_0x70cede);}(_0x1f66,0xd4));var _0x61f6=function(_0x44cb6d,_0x3cb2ee){_0x44cb6d=_0x44cb6d-0x0;var _0x1fe78b=_0x1f66[_0x44cb6d];return _0x1fe78b;};'use strict';var _=require(_0x61f6('0x0'));var util=require(_0x61f6('0x1'));var utils=require(_0x61f6('0x2'));var Redis=require(_0x61f6('0x3'));var config=require(_0x61f6('0x4'));var logger=require(_0x61f6('0x5'))(_0x61f6('0x6'));config[_0x61f6('0x7')]=_[_0x61f6('0x8')](config[_0x61f6('0x7')],{'host':_0x61f6('0x9'),'port':0x18eb});var io=require(_0x61f6('0xa'))(new Redis(config[_0x61f6('0x7')]));function sendNotification(_0x539add,_0x5552d1,_0x35cb5d,_0x3e8d8d,_0xaaeea5,_0x476ed0){var _0x43ce1a=_0x476ed0||{};var _0x4d16bd=_0x35cb5d['split']('.');var _0x272abd={'uniqueid':_0x5552d1,'channel':_0x4d16bd[0x0],'id':_0x4d16bd[0x1],'title':_0x4d16bd[0x0]+_0x61f6('0xb'),'interactionId':_0x4d16bd[0x2],'queue':_0xaaeea5?_0xaaeea5[_0x61f6('0xc')]:null,'sound':_0x43ce1a['account'][_0x61f6('0xd')],'shake':_0x43ce1a[_0x61f6('0xe')]['notificationShake']};try{if(!_0x43ce1a[_0x61f6('0xf')]){_0x43ce1a[_0x61f6('0xf')]={};}if(_0xaaeea5){_0x43ce1a[_0x61f6('0xf')][_0x61f6('0x10')]=_0xaaeea5;}else if(_0x43ce1a['body'][_0x61f6('0x10')]){delete _0x43ce1a[_0x61f6('0xf')][_0x61f6('0x10')];}_0x272abd['msg']=utils['getMustacheRender'](_0x43ce1a[_0x61f6('0xe')][_0x61f6('0x11')],_0x43ce1a);}catch(_0x43ca83){_0x272abd[_0x61f6('0x12')]='I\x20can\x27t\x20render\x20your\x20template';logger[_0x61f6('0x13')](util[_0x61f6('0x14')](_0x61f6('0x15'),_0x5552d1,_0x43ca83[_0x61f6('0x16')]));}io['to'](util['format']('user:%s',_0x3e8d8d[_0x61f6('0xc')]))[_0x61f6('0x17')](util[_0x61f6('0x14')](_0x61f6('0x18'),_0x539add?'save':'remove'),_0x272abd);}function writeLog(_0x161cf7,_0x1c291a,_0x458fce){return logger[_0x61f6('0x19')](util[_0x61f6('0x14')](_0x61f6('0x1a'),_0x161cf7,_0x1c291a[_0x61f6('0xc')],_0x458fce));}exports[_0x61f6('0x1b')]=function(_0x36c56b,_0x20099f,_0xbdf934,_0x35a217){if(_0x20099f[_0x61f6('0x1c')]){writeLog(_0x36c56b,_0x20099f,_0x61f6('0x1d'));return![];}if(!_0x20099f[_0x61f6('0x1e')]){writeLog(_0x36c56b,_0x20099f,_0x61f6('0x1f'));return![];}if(_0x20099f[_0xbdf934+_0x61f6('0x20')]){writeLog(_0x36c56b,_0x20099f,_0x61f6('0x21'));return![];}if(_0x35a217&&_0x20099f[_0x61f6('0x22')](_0xbdf934+_0x61f6('0x23'))&&_0x20099f[_0x61f6('0x22')](_0xbdf934+_0x61f6('0x24'))){if(_0x20099f[_0xbdf934+_0x61f6('0x23')]>0x0&&_0x20099f[_0xbdf934+_0x61f6('0x24')]>=_0x20099f[_0xbdf934+_0x61f6('0x23')]){writeLog(_0x36c56b,_0x20099f,_0xbdf934[_0x61f6('0x25')]()+_0x61f6('0x26'));return![];}}return!![];};exports[_0x61f6('0x27')]=function(_0x1300b5,_0x2890d3,_0x2c9d1e,_0x45b068,_0x7baaba){return sendNotification(!![],_0x1300b5,_0x2890d3,_0x2c9d1e,_0x45b068,_0x7baaba);};exports[_0x61f6('0x28')]=function(_0x16152f,_0x4636e2,_0x4795bc,_0x370f3d,_0x296894){return sendNotification(![],_0x16152f,_0x4636e2,_0x4795bc,_0x370f3d,_0x296894);};exports[_0x61f6('0x29')]=function(_0x8693aa,_0x696ba7,_0x4235d9){var _0x5649d6=_0x696ba7[_0x61f6('0x2a')][_0x61f6('0x2b')];if(!_0x5649d6&&_0x4235d9){_0x5649d6=_0x4235d9['id'];}var _0x293ae7=_[_0x61f6('0x2c')](_0x8693aa[_0x696ba7[_0x61f6('0x2d')]+'QueuesWaitingInteractions'],function(_0x1b7c62){var _0x1a0c39=_[_0x61f6('0x2e')](_0x696ba7[_0x61f6('0x2d')])+'InteractionId';return _0x1b7c62[_0x1a0c39]===_0x696ba7['interaction']['id'];});if(!_0x293ae7&&_0x5649d6&&_0x8693aa['agents'][_0x5649d6]){_0x293ae7=_['some'](_0x8693aa[_0x61f6('0x2f')][_0x5649d6][_0x696ba7['channel']+'WaitingInteractions'],function(_0x16f004){return _0x16f004['id']===_0x696ba7[_0x61f6('0x2a')]['id'];});}return _0x293ae7;};exports['saveWaitingNotification']=function(_0x1e987c,_0x4568a3,_0x2d8976,_0x3fed7c){if(_0x2d8976&&_0x2d8976['id']&&_0x1e987c[_0x61f6('0x2f')]&&_0x1e987c[_0x61f6('0x2f')][_0x2d8976['id']]){_0x1e987c['agents'][_0x2d8976['id']][_0x3fed7c+_0x61f6('0x30')][_0x4568a3['message']['id']]={'id':_0x4568a3[_0x61f6('0x2a')]['id']};}};exports['removeWaitingNotification']=function(_0x182e6e,_0x4a8c65,_0x31174b,_0x4c299b){if(_0x31174b&&_0x31174b['id']&&_0x182e6e[_0x61f6('0x2f')]&&_0x182e6e['agents'][_0x31174b['id']]){delete _0x182e6e[_0x61f6('0x2f')][_0x31174b['id']][_0x4c299b+'WaitingInteractions'][_0x4a8c65['message']['id']];}};exports[_0x61f6('0x31')]=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index f3ce3ca..b9d2813 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 _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 +var _0xe06f=['routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','replace','isNil','isEmpty','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','validate','shelljs','./utils'];(function(_0x365be9,_0x3c88b9){var _0x185c12=function(_0xbadbbf){while(--_0xbadbbf){_0x365be9['push'](_0x365be9['shift']());}};_0x185c12(++_0x3c88b9);}(_0xe06f,0x65));var _0xfe06=function(_0x1b2ffe,_0x2fb67b){_0x1b2ffe=_0x1b2ffe-0x0;var _0x3232c8=_0xe06f[_0x1b2ffe];return _0x3232c8;};'use strict';var schema=require(_0xfe06('0x0'));var sh=require(_0xfe06('0x1'));var _=require('lodash');var utils=require(_0xfe06('0x2'));var logger=require('../../../../config/logger')(_0xfe06('0x3'));var system=schema({'command':{'type':_0xfe06('0x4'),'required':!![],'message':_0xfe06('0x5')}});exports[_0xfe06('0x6')]=function(_0x3a07cc,_0x406081){return function(_0x5f4b32){try{var _0x4b4be6={'command':_0x406081[0x0]};var _0x530973=system[_0xfe06('0x0')](_0x4b4be6,{'typecast':!![]});if(_0x530973[_0xfe06('0x7')]){logger[_0xfe06('0x8')](_0xfe06('0x9'),_0x3a07cc,_[_0xfe06('0xa')](_0x530973,_0xfe06('0xb'))['join'](',\x20'));logger[_0xfe06('0xc')](_0xfe06('0xd'),_0x3a07cc);_0x5f4b32[_0xfe06('0xe')]();}else{var _0x3ec380=this;var _0x4efaa2=utils[_0xfe06('0xf')](_0x406081[0x0],this);logger[_0xfe06('0xc')](_0xfe06('0x10'),_0x3a07cc,_0x4efaa2);sh[_0xfe06('0x11')](_[_0xfe06('0x12')](_0x4efaa2),function(_0x11cb75,_0x8c5953){logger[_0xfe06('0xc')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x3a07cc,_0x11cb75);if(_0x11cb75==0x0){var _0xbb32db=_0x8c5953[_0xfe06('0x13')](/(\r\n|\n|\r)/gm,'');if(_[_0xfe06('0x14')](_0x406081[0x1])||_[_0xfe06('0x15')](_0x406081[0x1])){logger['info']('[%s][SYSTEM]\x20no\x20variable',_0x3a07cc);_0x3ec380[_0xfe06('0x16')][_0x406081[0x1]]=_0xbb32db;}else{logger['info'](_0xfe06('0x17'),_0x3a07cc,_0x406081[0x1],_0xbb32db);_0x3ec380[_0xfe06('0x16')][_0x406081[0x1]]=_0xbb32db;}}_0x5f4b32[_0xfe06('0xe')]();});}}catch(_0x54dd69){logger[_0xfe06('0x8')](_0xfe06('0x9'),_0x3a07cc,_[_0xfe06('0x18')](_0x54dd69)?JSON[_0xfe06('0x19')](_0x54dd69):_0x54dd69);logger[_0xfe06('0xc')](_0xfe06('0xd'),_0x3a07cc);_0x5f4b32[_0xfe06('0xe')]();}};}; \ 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 6e60101..0a420ab 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 _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 +var _0x642b=['TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','stringify','finally','next','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','routing'];(function(_0x324012,_0x23f45f){var _0x435cf2=function(_0x378a82){while(--_0x378a82){_0x324012['push'](_0x324012['shift']());}};_0x435cf2(++_0x23f45f);}(_0x642b,0x18c));var _0xb642=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x642b[_0x3511d3];return _0x5d6321;};'use strict';var schema=require(_0xb642('0x0'));var _=require(_0xb642('0x1'));var rpc={'chatInteraction':require(_0xb642('0x2')),'openchannelInteraction':require(_0xb642('0x3')),'smsInteraction':require(_0xb642('0x4')),'mailInteraction':require(_0xb642('0x5')),'faxInteraction':require(_0xb642('0x6')),'whatsappInteraction':require(_0xb642('0x7'))};var logger=require('../../../../config/logger')(_0xb642('0x8'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0xb642('0x9')}});exports[_0xb642('0xa')]=function(_0x537a5b,_0x4a5463,_0xe263fe,_0x2aa148){return function(_0x3f0f93){try{var _0x56f7f9={'tag':_0x4a5463[0x0]};var _0x457e9a=tag['validate'](_0x56f7f9,{'typecast':!![]});if(_0x457e9a[_0xb642('0xb')]){logger[_0xb642('0xc')](_0xb642('0xd'),_0x537a5b,_['map'](_0x457e9a,'message')[_0xb642('0xe')](',\x20'));logger[_0xb642('0xf')](_0xb642('0x10'),_0x537a5b);_0x3f0f93['next']();}else{var _0x563d38={'ids':[_0x4a5463[0x0]]};if(rpc[_0x2aa148[_0xb642('0x11')]+'Interaction']){rpc[_0x2aa148[_0xb642('0x11')]+_0xb642('0x12')][_0xb642('0x13')](_0x2aa148['interaction']['id'],_0x563d38)[_0xb642('0x14')](function(_0x23e357){logger[_0xb642('0xf')](_0xb642('0x15'),_0x537a5b,_0x4a5463[0x1],_0x2aa148[_0xb642('0x11')],_0x2aa148[_0xb642('0x16')]['id']);})['catch'](function(_0x372757){logger['error'](_0xb642('0xd'),_0x537a5b,JSON[_0xb642('0x17')](_0x372757));logger[_0xb642('0xf')](_0xb642('0x10'),_0x537a5b);})[_0xb642('0x18')](function(){_0x3f0f93[_0xb642('0x19')]();});}}}catch(_0x14b9b7){logger['error']('[%s][TAG]\x20%s',_0x537a5b,_[_0xb642('0x1a')](_0x14b9b7)?JSON[_0xb642('0x17')](_0x14b9b7):_0x14b9b7);logger[_0xb642('0xf')](_0xb642('0x10'),_0x537a5b);_0x3f0f93[_0xb642('0x19')]();}};}; \ 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 f589327..2029528 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 _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 +var _0x438e=['../../../../config/logger','routing','lodash','consequence','\x20-\x20','replace','push','urlOnAnswer','?params=','title','jsonrpc','2.0','method','login','params','stringify','then','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data=','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','error','[%s][TVOX]\x20%s','stop','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise'];(function(_0x41dbe0,_0x11a6d2){var _0x5cc563=function(_0x229d64){while(--_0x229d64){_0x41dbe0['push'](_0x41dbe0['shift']());}};_0x5cc563(++_0x11a6d2);}(_0x438e,0x15f));var _0xe438=function(_0x874cf1,_0x2a4954){_0x874cf1=_0x874cf1-0x0;var _0x233579=_0x438e[_0x874cf1];return _0x233579;};'use strict';var rp=require(_0xe438('0x0'));var logger=require(_0xe438('0x1'))(_0xe438('0x2'));var _=require(_0xe438('0x3'));var arr=[];exports[_0xe438('0x4')]=function(_0x1f4d55,_0x4ac202){return function(_0x1acbe4){var _0x28d8ef=_0x4ac202[0xa];var _0x49950a=_0x4ac202[0xb];var _0xa7ad36=_0x4ac202[0xc];var _0x2d9414=_0x4ac202[0xd];var _0x133c74=_0x4ac202[0xe];var _0x445b9d=_0x4ac202[0xf]['replace'](/\n/g,_0xe438('0x5'));var _0x550f11=_0x4ac202[0x10][_0xe438('0x6')](/\n/g,'\x20');if(!arr['includes'](_0x49950a)){arr[_0xe438('0x7')](_0x49950a);var _0x282bea=_0x4ac202[0x3];var _0x1eea2f=_0x4ac202[0x4];var _0x377ace=_0x4ac202[0x1];var _0x4449dc=_0x4ac202[0x0];var _0x59cb4a={};_0x59cb4a[_0xe438('0x8')]=_0x4ac202[0x8]+_0xe438('0x9')+_0xa7ad36+'|'+_0x28d8ef+'|'+_0x2d9414+'|'+_0x49950a+'|'+_0x133c74;_0x59cb4a['urlOnRing']=_0x4ac202[0x7]+'?params='+_0xa7ad36+'|'+_0x28d8ef+'|'+_0x2d9414+'|'+_0x49950a+'|'+_0x133c74+'|'+_0x445b9d+'|'+_0x550f11;_0x59cb4a[_0xe438('0xa')]=_0x4ac202[0x9];var _0x2b02ff={};_0x2b02ff[_0xe438('0xb')]=_0xe438('0xc');_0x2b02ff[_0xe438('0xd')]=_0xe438('0xe');var _0x4b74b2=[];_0x4b74b2[_0xe438('0x7')](_0x4ac202[0x2]);_0x4b74b2[_0xe438('0x7')](_0x4ac202[0x5]);_0x4b74b2[_0xe438('0x7')](_0x4ac202[0x6]);_0x2b02ff[_0xe438('0xf')]=_0x4b74b2;_0x2b02ff['id']=0x1;var _0x4e3401=JSON[_0xe438('0x10')](_0x2b02ff);var _0x59ae7b={'encoding':'utf8','method':'POST','timeout':0x2710,'url':_0x282bea,'headers':{'Content-Type':'application/json-rpc'},'body':_0x4e3401};return rp(_0x59ae7b)[_0xe438('0x11')](function(_0x48a345){const _0x21fc14=JSON[_0xe438('0x12')](_0x48a345);if(!_0x21fc14[_0xe438('0x13')][_0xe438('0x14')]){throw new Error(_0xe438('0x15'));}var _0x4356fc=_0x49950a;var _0x3c08c8=_0xe438('0x16')+_0x377ace+_0xe438('0x17')+_0x4449dc+_0xe438('0x18')+_0x4356fc+_0xe438('0x19')+JSON[_0xe438('0x10')](_0x59cb4a);var _0x4ce76d=_0x1eea2f+'?'+_0x3c08c8;return rp(_0x4ce76d);})[_0xe438('0x11')](function(_0x1f4997){logger['info'](_0xe438('0x1a'),_0x1f4d55,_0x1f4997);_0x1acbe4['stop']();})['catch'](function(_0x34c350){logger[_0xe438('0x1b')](_0xe438('0x1c'),_0x1f4d55,_['isObject'](_0x34c350)?JSON[_0xe438('0x10')](_0x34c350):_0x34c350);_0x1acbe4[_0xe438('0x1d')]();});}else{logger['info'](_0xe438('0x1e'),_0x1f4d55);_0x1acbe4[_0xe438('0x1f')]();}};}; \ 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 59d8356..99baccf 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(_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 +var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x253904,_0x265490){var _0x53b3e5=function(_0x23ce03){while(--_0x23ce03){_0x253904['push'](_0x253904['shift']());}};_0x53b3e5(++_0x265490);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 2e711d0..f04e6c1 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 _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 +var _0xeae6=['routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','%s.%s.%s','isNil','IntervalId','map','Intervals','interval','rules','channel','message','interaction','checkWaitingNotifications','transfer','applications','isArray','length','existsSync','join','app','.js','toLowerCase','autoreply','appdata','split','mail','push','dialogflow','slice','amazonlex','tag','getMustacheRender','account','ChatWebsiteId','ContactId','body','format','./interval','intervals','consequence','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Applications\x20executed','stringify','matchPath','complete','info','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','emit','end','QueueReport','update','UserId','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','find','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','http','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','./applications/utils','../../../config/logger'];(function(_0x3a2a3c,_0x37bd31){var _0x50ac9a=function(_0x494a7f){while(--_0x494a7f){_0x3a2a3c['push'](_0x3a2a3c['shift']());}};_0x50ac9a(++_0x37bd31);}(_0xeae6,0xc3));var _0x6eae=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xeae6[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x6eae('0x0'));var util=require(_0x6eae('0x1'));var path=require(_0x6eae('0x2'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require('bluebird');var utils=require(_0x6eae('0x3'));var sUtils=require('./applications/strategy/util');var logger=require(_0x6eae('0x4'))(_0x6eae('0x5'));var rpc={'openchannelQueueReport':require(_0x6eae('0x6')),'mailQueueReport':require(_0x6eae('0x7')),'chatQueueReport':require(_0x6eae('0x8')),'smsQueueReport':require(_0x6eae('0x9')),'faxQueueReport':require(_0x6eae('0xa')),'whatsappQueueReport':require(_0x6eae('0xb'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x57c926,_0x397f64,_0x2d45b0){return util['format'](_0x6eae('0xc'),_0x57c926,_0x397f64||0x0,_0x2d45b0||0x0);}function getIntervals(_0x213684,_0x4a65a7){var _0x47fe4f=[];if(!_[_0x6eae('0xd')](_0x4a65a7['IntervalId'])&&!_['isNil'](_0x213684[_0x4a65a7['IntervalId']])&&!_[_0x6eae('0xd')](_0x213684[_0x4a65a7[_0x6eae('0xe')]]['Intervals'])){_0x47fe4f=_[_0x6eae('0xf')](_0x213684[_0x4a65a7[_0x6eae('0xe')]][_0x6eae('0x10')],_0x6eae('0x11'));}else if(!_[_0x6eae('0xd')](_0x4a65a7[_0x6eae('0x11')])){_0x47fe4f=[_0x4a65a7[_0x6eae('0x11')]];}return _0x47fe4f;}exports['listen']=function(_0x6cb496){_0x6cb496[_0x6eae('0x12')]={};return new BPromise(function(_0x147b90,_0x275024){var _0x18c008={'Start':function(_0x3828a4){var _0x230bc9=this;return new Promise(function(_0x350393,_0x1157c1){if(_0x3828a4){try{var _0x18cb2d=[];var _0x36b0fd=getId(_0x3828a4[_0x6eae('0x13')],_0x3828a4[_0x6eae('0x14')]?_0x3828a4[_0x6eae('0x14')]['id']:0x0,_0x3828a4[_0x6eae('0x15')]?_0x3828a4[_0x6eae('0x15')]['id']:0x0);var _0x46ddc6=sUtils[_0x6eae('0x16')](_0x6cb496,_0x3828a4);if(_0x3828a4[_0x6eae('0x17')]||!_0x46ddc6&&_0x3828a4[_0x6eae('0x18')]&&_[_0x6eae('0x19')](_0x3828a4[_0x6eae('0x18')])&&_0x3828a4[_0x6eae('0x18')][_0x6eae('0x1a')]){for(var _0x42ffe8=0x0;_0x42ffe8<_0x3828a4[_0x6eae('0x18')][_0x6eae('0x1a')];_0x42ffe8+=0x1){var _0x2bfe01=_0x3828a4['applications'][_0x42ffe8];if(fs[_0x6eae('0x1b')](path[_0x6eae('0x1c')](__dirname,_0x6eae('0x18'),_0x2bfe01[_0x6eae('0x1d')]+_0x6eae('0x1e')))){var _0x1b3061=[];switch(_0x2bfe01['app'][_0x6eae('0x1f')]()){case _0x6eae('0x20'):var _0x6492d5=_0x2bfe01[_0x6eae('0x21')][_0x6eae('0x22')](',');if(_0x3828a4[_0x6eae('0x13')]===_0x6eae('0x23')){_0x1b3061[_0x6eae('0x24')](_0x6492d5[0x0]);_0x1b3061[_0x6eae('0x24')](_0x6492d5[0x1]);_0x1b3061[_0x6eae('0x24')](_0x6492d5['slice'](0x2,_0x6492d5[_0x6eae('0x1a')])[_0x6eae('0x1c')](','));}else{_0x1b3061['push'](_0x6492d5[0x0]);_0x1b3061[_0x6eae('0x24')](_0x6492d5['slice'](0x1,_0x6492d5[_0x6eae('0x1a')])['join'](','));}break;case _0x6eae('0x25'):var _0x3242b1=_0x2bfe01[_0x6eae('0x21')][_0x6eae('0x22')](',');_0x1b3061[_0x6eae('0x24')](_0x3242b1[0x0]);_0x1b3061[_0x6eae('0x24')](_0x3242b1[0x1]);_0x1b3061['push'](_0x3242b1['slice'](0x2,_0x3242b1[_0x6eae('0x1a')])['join'](','));break;case'dialogflowv2':var _0x20ea6a=_0x2bfe01['appdata'][_0x6eae('0x22')](',');_0x1b3061[_0x6eae('0x24')](_0x20ea6a[0x0]);_0x1b3061['push'](_0x20ea6a[0x1]);_0x1b3061['push'](_0x20ea6a[0x2]);_0x1b3061[_0x6eae('0x24')](_0x20ea6a[0x3]);_0x1b3061['push'](_0x20ea6a[_0x6eae('0x26')](0x4,_0x20ea6a[_0x6eae('0x1a')])[_0x6eae('0x1c')](','));break;case _0x6eae('0x27'):var _0x9604ca=_0x2bfe01[_0x6eae('0x21')][_0x6eae('0x22')](',');_0x1b3061['push'](_0x9604ca[0x0]);_0x1b3061[_0x6eae('0x24')](_0x9604ca[0x1]);_0x1b3061[_0x6eae('0x24')](_0x9604ca[0x2]);_0x1b3061[_0x6eae('0x24')](_0x9604ca[0x3]);_0x1b3061[_0x6eae('0x24')](_0x9604ca[_0x6eae('0x26')](0x4,_0x9604ca[_0x6eae('0x1a')])[_0x6eae('0x1c')](','));break;case'message':_0x1b3061[_0x6eae('0x24')](_0x2bfe01[_0x6eae('0x21')]);break;case _0x6eae('0x28'):_0x1b3061['push'](_0x2bfe01['TagId']);_0x1b3061[_0x6eae('0x24')](_0x2bfe01[_0x6eae('0x21')]);break;case'tvox':var _0x1dbd19=utils[_0x6eae('0x29')](_0x3828a4[_0x6eae('0x2a')]['notificationTemplate'],_0x3828a4);var _0x344d78=_0x2bfe01[_0x6eae('0x21')][_0x6eae('0x22')](',');_0x1b3061['push'](_0x344d78[0x0]);_0x1b3061['push'](_0x344d78[0x1]);_0x1b3061['push'](_0x344d78[0x2]);_0x1b3061['push'](_0x344d78[0x3]);_0x1b3061[_0x6eae('0x24')](_0x344d78[0x4]);_0x1b3061[_0x6eae('0x24')](_0x344d78[0x5]);_0x1b3061[_0x6eae('0x24')](_0x344d78[0x6]);_0x1b3061[_0x6eae('0x24')](_0x344d78[0x7]);_0x1b3061[_0x6eae('0x24')](_0x344d78[0x8]);_0x1b3061[_0x6eae('0x24')](_0x344d78[0x9]);_0x1b3061[_0x6eae('0x24')](_0x344d78[0xa]);_0x1b3061['push'](_0x3828a4[_0x6eae('0x15')]['id']);_0x1b3061[_0x6eae('0x24')](_0x3828a4[_0x6eae('0x14')]['id']);_0x1b3061[_0x6eae('0x24')](_0x2bfe01[_0x6eae('0x2b')]);_0x1b3061['push'](_0x3828a4['interaction'][_0x6eae('0x2c')]);_0x1b3061[_0x6eae('0x24')](_0x3828a4[_0x6eae('0x2d')][_0x6eae('0x2d')]);_0x1b3061[_0x6eae('0x24')](_0x1dbd19);break;default:_0x1b3061=_[_0x6eae('0xd')](_0x2bfe01[_0x6eae('0x21')])?[]:_0x2bfe01[_0x6eae('0x21')][_0x6eae('0x22')](',');}var _0x36eb46={'id':util[_0x6eae('0x2e')]('%s:%s:%s',_0x36b0fd,_0x2bfe01['id'],_0x2bfe01[_0x6eae('0x1d')]),'condition':require(_0x6eae('0x2f'))['condition'](_0x36b0fd,getIntervals(_0x6cb496[_0x6eae('0x30')],_0x2bfe01),_0x6cb496),'consequence':require('./applications/'+_0x2bfe01[_0x6eae('0x1d')])[_0x6eae('0x31')](_0x36b0fd,_0x1b3061,_0x6cb496,_0x3828a4),'p':_0x2bfe01['priority']||0x0};logger['info'](_0x6eae('0x32'),_0x36eb46['id'],_0x6eae('0x33'),getIntervals(_0x6cb496[_0x6eae('0x30')],_0x2bfe01)[_0x6eae('0x1c')](_0x6eae('0x34')));_0x18cb2d[_0x6eae('0x24')](_0x36eb46);}else{logger[_0x6eae('0x35')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0x6eae('0x1c')](__dirname,_0x6eae('0x18'),_0x2bfe01[_0x6eae('0x1d')]+_0x6eae('0x1e')));}}_0x6cb496[_0x6eae('0x12')][_0x36b0fd]=new RuleEngine(_0x18cb2d);_0x6cb496[_0x6eae('0x12')][_0x36b0fd]['execute'](_0x3828a4,function(_0x268632){logger['info'](_0x6eae('0x36'),JSON[_0x6eae('0x37')](_0x268632[_0x6eae('0x38')]));if(_0x6cb496[_0x6eae('0x12')][_0x36b0fd]){_0x6cb496[_0x6eae('0x12')][_0x36b0fd]['emit'](_0x6eae('0x39'));}});return _0x350393({'code':0xc8,'message':_0x3828a4});}else{if(_0x46ddc6){logger[_0x6eae('0x3a')](util['format'](_0x6eae('0x3b'),_0x36b0fd));}else{logger['info'](_0x6eae('0x3c'));}return _0x350393({'code':0xc8,'message':_0x3828a4});}}catch(_0x5dde1b){logger['error'](_0x5dde1b[_0x6eae('0x3d')]);return _0x1157c1(_0x230bc9[_0x6eae('0x35')](0x1f4,_0x5dde1b));}}return _0x1157c1(_0x6eae('0x3e'));});},'AcceptMessage':function(_0x51a200){var _0x72c11c=this;return new Promise(function(_0x114e79,_0x47b960){if(_0x51a200[_0x6eae('0x3f')]&&_0x51a200[_0x6eae('0x3f')]['id']){if(_0x6cb496['agents'][_0x51a200[_0x6eae('0x3f')]['id']]){_0x6cb496[_0x6eae('0x40')][_0x51a200[_0x6eae('0x3f')]['id']][_0x6eae('0x41')]=![];_0x6cb496['agents'][_0x51a200[_0x6eae('0x3f')]['id']][_0x6eae('0x42')]=undefined;}}if(_0x51a200['message']&&_0x51a200['message']['id']){try{var _0x2ff08e=getId(_0x51a200[_0x6eae('0x13')],_0x51a200[_0x6eae('0x14')]?_0x51a200[_0x6eae('0x14')]['id']:0x0,_0x51a200[_0x6eae('0x15')]?_0x51a200['interaction']['id']:0x0);if(_0x6cb496[_0x6eae('0x12')][_0x2ff08e]){_0x6cb496[_0x6eae('0x12')][_0x2ff08e][_0x6eae('0x43')](_0x6eae('0x44'));if(rpc[_0x51a200[_0x6eae('0x13')]+'QueueReport']){rpc[_0x51a200[_0x6eae('0x13')]+_0x6eae('0x45')][_0x6eae('0x46')](_0x2ff08e,{'UserId':_0x51a200['message'][_0x6eae('0x47')]})['catch'](function(){logger[_0x6eae('0x35')](_0x6eae('0x48'));});}}return _0x114e79({'code':0xc8,'message':_0x51a200});}catch(_0x3df8bb){logger['error'](_0x3df8bb[_0x6eae('0x3d')]);return _0x47b960(_0x72c11c[_0x6eae('0x35')](0x1f4,_0x3df8bb));}}logger['error']('message\x20is\x20empty');return _0x47b960(_0x72c11c[_0x6eae('0x35')](0x1f4,_0x6eae('0x49')));});},'RejectMessage':function(_0x3515e5){var _0x22cce2=this;return new Promise(function(_0x3b6c48,_0xf20839){if(_0x3515e5['agent']&&_0x3515e5['agent']['id']){try{if(_0x6cb496[_0x6eae('0x40')][_0x3515e5[_0x6eae('0x3f')]['id']]){_0x6cb496[_0x6eae('0x40')][_0x3515e5[_0x6eae('0x3f')]['id']][_0x6eae('0x41')]=![];_0x6cb496[_0x6eae('0x40')][_0x3515e5[_0x6eae('0x3f')]['id']][_0x6eae('0x42')]=undefined;}return _0x3b6c48({'code':0xc8,'message':_0x3515e5});}catch(_0x107c18){logger[_0x6eae('0x35')](_0x107c18[_0x6eae('0x3d')]);return _0xf20839(_0x22cce2[_0x6eae('0x35')](0x1f4,_0x107c18));}}logger['error'](_0x6eae('0x49'));return _0xf20839(_0x22cce2[_0x6eae('0x35')](0x1f4,_0x6eae('0x49')));});},'AbandonInteraction':function(_0x4d84a7){var _0x37a6d0=this;return new Promise(function(_0x54644f,_0x198a1a){if(_0x4d84a7[_0x6eae('0x13')]&&_0x4d84a7[_0x6eae('0x15')]&&_0x4d84a7['interaction']['id']){try{var _0x16d57a=getId(_0x4d84a7[_0x6eae('0x13')],_0x4d84a7[_0x6eae('0x14')]?_0x4d84a7[_0x6eae('0x14')]['id']:0x0,_0x4d84a7['interaction']?_0x4d84a7[_0x6eae('0x15')]['id']:0x0);if(_0x6cb496[_0x6eae('0x12')][_0x16d57a]){_0x6cb496['rules'][_0x16d57a]['emit'](_0x6eae('0x44'));}return _0x54644f({'code':0xc8,'message':_0x4d84a7});}catch(_0x4799d5){logger[_0x6eae('0x35')](_0x4799d5[_0x6eae('0x3d')]);return _0x198a1a(_0x37a6d0[_0x6eae('0x35')](0x1f4,_0x4799d5));}}logger[_0x6eae('0x35')](_0x6eae('0x49'));return _0x198a1a(_0x37a6d0['error'](0x1f4,_0x6eae('0x49')));});},'AgentCapacity':function(_0x4568b4){var _0x184ff9=this;return new Promise(function(_0x508fa7,_0x122eed){if(_0x6cb496['agents'][_0x6eae('0x4a')](_0x4568b4['id'])){for(var _0x30a4a in _0x4568b4[_0x6eae('0x4b')]){if(_0x4568b4[_0x6eae('0x4b')][_0x6eae('0x4a')](_0x30a4a)){if(_0x6cb496[_0x6eae('0x40')][_0x4568b4['id']][_0x6eae('0x4a')](_0x30a4a+'CurrentCapacity')){_0x6cb496[_0x6eae('0x40')][_0x4568b4['id']][_0x30a4a+_0x6eae('0x4c')]=parseInt(_0x4568b4['capacity'][_0x30a4a],0xa);}}}_0x6cb496[_0x6eae('0x40')][_0x4568b4['id']][_0x6eae('0x4d')]();return _0x508fa7({'code':0xc8,'message':_0x6cb496[_0x6eae('0x40')][_0x4568b4['id']]});}else{return _0x122eed(_0x184ff9['error'](0x1f4,_0x6eae('0x4e')));}});},'Agents':function(_0xd66f89){return new Promise(function(_0x26a27a){var _0x28c6ca=_[_0x6eae('0x4f')](_0x6cb496['agents']);if(_0xd66f89&&_0xd66f89['id']){var _0xd8f968=_[_0x6eae('0x50')](_0x28c6ca,function(_0x2c1027){return _0x2c1027['id']===_0xd66f89['id'];});_0x26a27a(_0xd8f968);}else{_0x26a27a({'count':_0x28c6ca[_0x6eae('0x1a')],'rows':_0x28c6ca});}});},'ChatQueues':function(){return new Promise(function(_0x34c080){var _0x53ad00=[];for(var _0x223af3 in _0x6cb496['chatQueues']){if(_0x6cb496[_0x6eae('0x51')]['hasOwnProperty'](_0x223af3)){var _0x532118=_0x6cb496[_0x6eae('0x51')][_0x223af3];var _0x3e8d10={'id':_0x532118['id'],'available':_0x532118[_0x6eae('0x52')],'loggedIn':_0x532118[_0x6eae('0x53')],'name':_0x532118[_0x6eae('0x54')],'paused':_0x532118[_0x6eae('0x55')],'waiting':_0x532118[_0x6eae('0x56')]};_0x53ad00[_0x6eae('0x24')](_0x3e8d10);}}_0x34c080({'count':_0x53ad00['length'],'rows':_0x53ad00});});},'MailQueues':function(){return new Promise(function(_0x4f94ab){var _0x40e28e=[];for(var _0x301cbc in _0x6cb496['mailQueues']){if(_0x6cb496[_0x6eae('0x57')]['hasOwnProperty'](_0x301cbc)){var _0x408594=_0x6cb496[_0x6eae('0x57')][_0x301cbc];var _0x120847={'id':_0x408594['id'],'available':_0x408594[_0x6eae('0x52')],'loggedIn':_0x408594[_0x6eae('0x53')],'name':_0x408594[_0x6eae('0x54')],'paused':_0x408594['paused'],'waiting':_0x408594[_0x6eae('0x56')]};_0x40e28e[_0x6eae('0x24')](_0x120847);}}_0x4f94ab({'count':_0x40e28e[_0x6eae('0x1a')],'rows':_0x40e28e});});},'OpenchannelQueues':function(){return new Promise(function(_0x5a4765){var _0x54beac=[];for(var _0x422ac1 in _0x6cb496[_0x6eae('0x58')]){if(_0x6cb496['openchannelQueues']['hasOwnProperty'](_0x422ac1)){var _0x35956a=_0x6cb496[_0x6eae('0x58')][_0x422ac1];var _0x293957={'id':_0x35956a['id'],'available':_0x35956a[_0x6eae('0x52')],'loggedIn':_0x35956a['loggedIn'],'name':_0x35956a[_0x6eae('0x54')],'paused':_0x35956a[_0x6eae('0x55')],'waiting':_0x35956a['waiting']};_0x54beac[_0x6eae('0x24')](_0x293957);}}_0x5a4765({'count':_0x54beac[_0x6eae('0x1a')],'rows':_0x54beac});});},'SmsQueues':function(){return new Promise(function(_0x2c689b){var _0x1977e6=[];for(var _0x58b12e in _0x6cb496[_0x6eae('0x59')]){if(_0x6cb496[_0x6eae('0x59')][_0x6eae('0x4a')](_0x58b12e)){var _0x3d78ee=_0x6cb496[_0x6eae('0x59')][_0x58b12e];var _0x32e088={'id':_0x3d78ee['id'],'available':_0x3d78ee[_0x6eae('0x52')],'loggedIn':_0x3d78ee[_0x6eae('0x53')],'name':_0x3d78ee[_0x6eae('0x54')],'paused':_0x3d78ee[_0x6eae('0x55')],'waiting':_0x3d78ee[_0x6eae('0x56')]};_0x1977e6[_0x6eae('0x24')](_0x32e088);}}_0x2c689b({'count':_0x1977e6['length'],'rows':_0x1977e6});});},'FaxQueues':function(){return new Promise(function(_0x14945d){var _0x5ab5a7=[];for(var _0x30862d in _0x6cb496[_0x6eae('0x5a')]){if(_0x6cb496[_0x6eae('0x5a')][_0x6eae('0x4a')](_0x30862d)){var _0x20de9d=_0x6cb496[_0x6eae('0x5a')][_0x30862d];var _0x45b599={'id':_0x20de9d['id'],'available':_0x20de9d[_0x6eae('0x52')],'loggedIn':_0x20de9d[_0x6eae('0x53')],'name':_0x20de9d[_0x6eae('0x54')],'paused':_0x20de9d[_0x6eae('0x55')],'waiting':_0x20de9d[_0x6eae('0x56')]};_0x5ab5a7[_0x6eae('0x24')](_0x45b599);}}_0x14945d({'count':_0x5ab5a7[_0x6eae('0x1a')],'rows':_0x5ab5a7});});},'WhatsappQueues':function(){return new Promise(function(_0x57d51e){var _0x20d24f=[];for(var _0x5776bc in _0x6cb496[_0x6eae('0x5b')]){if(_0x6cb496[_0x6eae('0x5b')][_0x6eae('0x4a')](_0x5776bc)){var _0x19ea1a=_0x6cb496[_0x6eae('0x5b')][_0x5776bc];var _0x39ade2={'id':_0x19ea1a['id'],'available':_0x19ea1a[_0x6eae('0x52')],'loggedIn':_0x19ea1a[_0x6eae('0x53')],'name':_0x19ea1a[_0x6eae('0x54')],'paused':_0x19ea1a[_0x6eae('0x55')],'waiting':_0x19ea1a[_0x6eae('0x56')]};_0x20d24f[_0x6eae('0x24')](_0x39ade2);}}_0x57d51e({'count':_0x20d24f[_0x6eae('0x1a')],'rows':_0x20d24f});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x2702cd){var _0x44b4f7=_[_0x6eae('0x4f')](_0x6cb496[_0x6eae('0x5c')]);_0x2702cd({'count':_0x44b4f7[_0x6eae('0x1a')],'rows':_0x44b4f7});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x598b37){var _0x494b48=_[_0x6eae('0x4f')](_0x6cb496['mailQueuesWaitingInteractions']);_0x598b37({'count':_0x494b48[_0x6eae('0x1a')],'rows':_0x494b48});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x189e05){var _0x486b4c=_[_0x6eae('0x4f')](_0x6cb496[_0x6eae('0x5d')]);_0x189e05({'count':_0x486b4c['length'],'rows':_0x486b4c});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x4b1992){var _0x2eeee4=_[_0x6eae('0x4f')](_0x6cb496['smsQueuesWaitingInteractions']);_0x4b1992({'count':_0x2eeee4[_0x6eae('0x1a')],'rows':_0x2eeee4});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0xdaac7c){var _0x341ddd=_[_0x6eae('0x4f')](_0x6cb496[_0x6eae('0x5e')]);_0xdaac7c({'count':_0x341ddd['length'],'rows':_0x341ddd});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x101767){var _0x1a4c2d=_['values'](_0x6cb496[_0x6eae('0x5f')]);_0x101767({'count':_0x1a4c2d[_0x6eae('0x1a')],'rows':_0x1a4c2d});});}};var _0x7d14da=jayson['server'](_0x18c008)[_0x6eae('0x60')]();_0x7d14da['on'](_0x6eae('0x35'),function(_0x5162eb){logger['error'](JSON[_0x6eae('0x37')](_0x5162eb));return _0x275024(_0x5162eb);});_0x7d14da['listen'](0x232c,'127.0.0.1',function(){console[_0x6eae('0x61')](_0x6eae('0x62'),0x232c);return _0x147b90(_0x6eae('0x63')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 88b6114..5a8e024 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 _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 +var _0x92db=['bluebird','../../../config/logger','routing','client','then','error','message','result','catch','condition','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','Command','indexOf','true','[%s][INTERVAL]\x20%s','all','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','stack','util'];(function(_0x4bcbea,_0xba16d6){var _0x4db0f2=function(_0x137077){while(--_0x137077){_0x4bcbea['push'](_0x4bcbea['shift']());}};_0x4db0f2(++_0xba16d6);}(_0x92db,0x186));var _0xb92d=function(_0x12ac54,_0x5b1019){_0x12ac54=_0x12ac54-0x0;var _0x1388fb=_0x92db[_0x12ac54];return _0x1388fb;};'use strict';var util=require(_0xb92d('0x0'));var BPromise=require(_0xb92d('0x1'));var jayson=require('jayson/promise');var _=require('lodash');var logger=require(_0xb92d('0x2'))(_0xb92d('0x3'));var client=jayson[_0xb92d('0x4')]['http']({'port':0x232a});function request(_0x4cb9d7,_0x310f58){return new BPromise(function(_0x3a85fb,_0xfb198b){return client['request'](_0x4cb9d7,_0x310f58)[_0xb92d('0x5')](function(_0x833140){if(_0x833140[_0xb92d('0x6')]){return _0xfb198b(_0x833140[_0xb92d('0x6')][_0xb92d('0x7')]);}else{return _0x3a85fb(_0x833140[_0xb92d('0x8')]);}})[_0xb92d('0x9')](function(_0x4aae59){return _0xfb198b(_0x4aae59);});});}exports[_0xb92d('0xa')]=function(_0x317f07,_0x236561,_0x3b6851){return function(_0x3394b4){if(_0x3b6851['rules']&&!_0x3b6851['rules'][_0x317f07]){logger[_0xb92d('0xb')](_0xb92d('0xc'),_0x317f07);return _0x3394b4[_0xb92d('0xd')]();}var _0x115bd2=[];for(var _0x2a0336=0x0;_0x2a0336<_0x236561['length'];_0x2a0336+=0x1){_0x115bd2['push'](request(_0xb92d('0xe'),{'command':util['format']('iftime\x20%s',_0x236561[_0x2a0336])})[_0xb92d('0x5')](function(_0x1a3afc){return _0x1a3afc&&_0x1a3afc[_0xb92d('0x7')]&&_0x1a3afc[_0xb92d('0x7')][_0xb92d('0xf')](_0xb92d('0x10'))>=0x0?!![]:![];})[_0xb92d('0x9')](function(){logger[_0xb92d('0x6')](_0xb92d('0x11'),_0x317f07,_0x236561[_0x2a0336]);}));}BPromise[_0xb92d('0x12')](_0x115bd2)[_0xb92d('0x5')](function(_0xa2c57b){var _0x3608c1=_['some'](_0xa2c57b);logger[_0xb92d('0xb')](_0xb92d('0x13'),_0x317f07,_0x236561[_0xb92d('0x14')](_0xb92d('0x15')),_0x3608c1);_0x3394b4['when'](_0x3608c1);})[_0xb92d('0x9')](function(_0x1ca291){logger[_0xb92d('0x6')](_0xb92d('0x13'),_0x317f07,_0x236561[_0xb92d('0x14')](_0xb92d('0x15')),_0x1ca291[_0xb92d('0x16')]);_0x3394b4[_0xb92d('0xd')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index a8cab55..6cb225a 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 _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 +var _0x0102=['agentringnoanswerAt','now','reason','timeout','holdtime','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','abandoned','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','transfertype','blind','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','transferexten','origtransfererexten','transfereeuniqueid','agententerreason','calleridname','transfertargetuniqueid','clone','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','agent','util','./utils','queue','membername','interface','calleridnum','lastevent','getVoiceQueueByName','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','uniqueid','destuniqueid','agentcalled','format','[%s][agents][agentcalled]','agentcalledAt','connectedlinenum','connectedlinename','info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','isNil','debug','[%s][agents][agentringnoanswer]'];(function(_0x4f7bb5,_0x1da7cc){var _0x3ced73=function(_0x1b8310){while(--_0x1b8310){_0x4f7bb5['push'](_0x4f7bb5['shift']());}};_0x3ced73(++_0x1da7cc);}(_0x0102,0x186));var _0x2010=function(_0x20e739,_0x38e248){_0x20e739=_0x20e739-0x0;var _0x17bcac=_0x0102[_0x20e739];return _0x17bcac;};'use strict';var _=require('lodash');var util=require(_0x2010('0x0'));var utils=require(_0x2010('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x34c31e,_0x9ae519){utils['info'](util['format']('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x34c31e['uniqueid'],_0x34c31e['channel'],_0x34c31e[_0x2010('0x2')],_0x34c31e[_0x2010('0x3')],_0x34c31e[_0x2010('0x4')],_0x34c31e[_0x2010('0x5')],_0x34c31e['connectedlinenum'],_0x34c31e[_0x2010('0x6')]));if(_0x34c31e['queue']){utils[_0x2010('0x7')](_0x34c31e[_0x2010('0x2')])['then'](function(_0x1f94ca){if(_0x1f94ca){_0x34c31e[_0x2010('0x8')]=_0x1f94ca[_0x2010('0x8')];_0x34c31e[_0x2010('0x9')]=_0x34c31e[_0x2010('0xa')]?_0x1f94ca[_0x2010('0xb')]:![];_0x34c31e[_0x2010('0xc')]=_0x34c31e[_0x2010('0x9')]?_0x1f94ca[_0x2010('0xd')]:0x0;}utils[_0x2010('0xe')](_0x2010('0xf'),_0x34c31e);});}else{utils[_0x2010('0xe')](_0x2010('0xf'),_0x34c31e);}if(_0x9ae519){delete transfers[_0x34c31e[_0x2010('0x10')]];}else{delete agents[_0x34c31e[_0x2010('0x11')]];}}exports[_0x2010('0x12')]=function(_0x528a38){try{utils['debug'](util[_0x2010('0x13')](_0x2010('0x14'),_0x528a38[_0x2010('0x10')]),_0x528a38);agents[_0x528a38[_0x2010('0x11')]]=_0x528a38;agents[_0x528a38[_0x2010('0x11')]][_0x2010('0x15')]=utils['now']();agents[_0x528a38[_0x2010('0x11')]][_0x2010('0x6')]='called';agents[_0x528a38[_0x2010('0x11')]][_0x2010('0x16')]=null;agents[_0x528a38[_0x2010('0x11')]][_0x2010('0x17')]=null;utils[_0x2010('0x18')](util[_0x2010('0x13')](_0x2010('0x19'),_0x528a38[_0x2010('0x10')],agents[_0x528a38[_0x2010('0x11')]]['membername'],_0x528a38['destuniqueid']));}catch(_0x3c72a8){utils[_0x2010('0x1a')](util[_0x2010('0x13')](_0x2010('0x14'),_0x528a38['uniqueid']),_0x3c72a8);}};exports['agentringnoanswer']=function(_0x22c252){try{if(!_[_0x2010('0x1b')](agents[_0x22c252[_0x2010('0x11')]])){utils[_0x2010('0x1c')](util[_0x2010('0x13')](_0x2010('0x1d'),_0x22c252['uniqueid']),_0x22c252);utils[_0x2010('0x18')](util[_0x2010('0x13')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x22c252['uniqueid'],agents[_0x22c252['destuniqueid']][_0x2010('0x3')],_0x22c252['destuniqueid']));agents[_0x22c252[_0x2010('0x11')]]['agentringnoanswer']=!![];agents[_0x22c252['destuniqueid']][_0x2010('0x1e')]=utils[_0x2010('0x1f')]();agents[_0x22c252['destuniqueid']][_0x2010('0x6')]='timeout';agents[_0x22c252[_0x2010('0x11')]][_0x2010('0x20')]=_0x2010('0x21');agents[_0x22c252[_0x2010('0x11')]][_0x2010('0x22')]=_0x22c252[_0x2010('0x23')]?parseInt(_0x22c252[_0x2010('0x23')])/0x3e8:0x0;agents[_0x22c252[_0x2010('0x11')]][_0x2010('0x24')]=0x0;unanswered[_0x2010('0x25')](_0x22c252[_0x2010('0x11')]);}}catch(_0x2ebdbb){utils['error'](util[_0x2010('0x13')]('[%s][agents][agentringnoanswer]',_0x22c252[_0x2010('0x10')]),_0x2ebdbb);}};exports[_0x2010('0x26')]=function(_0xd16c04){try{_[_0x2010('0x27')](agents,function(_0x564a64,_0x554f66){if(_0x564a64[_0x2010('0x10')]==_0xd16c04['uniqueid']&&!_[_0x2010('0x28')](unanswered,_0x564a64[_0x2010('0x11')])){utils['debug'](util[_0x2010('0x13')](_0x2010('0x29'),_0xd16c04[_0x2010('0x10')]),_0xd16c04);utils[_0x2010('0x18')](util[_0x2010('0x13')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0xd16c04[_0x2010('0x10')],_0x564a64[_0x2010('0x3')],_0x564a64[_0x2010('0x11')]));_0x564a64['agentringnoanswer']=!![];_0x564a64['agentringnoanswerAt']=utils[_0x2010('0x1f')]();_0x564a64[_0x2010('0x6')]=_0x2010('0x2a');_0x564a64['reason']='abandoned';_0x564a64[_0x2010('0x22')]=_0xd16c04[_0x2010('0x22')];_0x564a64[_0x2010('0x24')]=0x0;writeDB(_0x564a64);}});}catch(_0x339fd2){utils[_0x2010('0x1a')](util['format']('[%s][agents][queuecallerabandon]',_0xd16c04['uniqueid']),_0x339fd2);}};exports[_0x2010('0x2b')]=function(_0x447eed){try{if(agents[_0x447eed[_0x2010('0x11')]]){utils['debug'](util[_0x2010('0x13')](_0x2010('0x2c'),_0x447eed[_0x2010('0x10')]),_0x447eed);utils[_0x2010('0x18')](util['format'](_0x2010('0x2d'),_0x447eed[_0x2010('0x10')],agents[_0x447eed[_0x2010('0x11')]]['membername'],_0x447eed[_0x2010('0x11')]));agents[_0x447eed['destuniqueid']][_0x2010('0x2e')]=utils[_0x2010('0x1f')]();agents[_0x447eed[_0x2010('0x11')]][_0x2010('0x16')]=_0x447eed[_0x2010('0x16')];agents[_0x447eed[_0x2010('0x11')]]['connectedlinename']=_0x447eed[_0x2010('0x17')];agents[_0x447eed['destuniqueid']][_0x2010('0x22')]=_0x447eed[_0x2010('0x23')];agents[_0x447eed[_0x2010('0x11')]][_0x2010('0x6')]=_0x2010('0x2f');_[_0x2010('0x27')](agents,function(_0x398f10,_0x36ff3e){if(_0x398f10[_0x2010('0x11')]!=_0x447eed[_0x2010('0x11')]&&_0x398f10[_0x2010('0x10')]==_0x447eed[_0x2010('0x10')]){_0x398f10[_0x2010('0x24')]=0x0;_0x398f10[_0x2010('0x22')]=_0x447eed['ringtime'];_0x398f10['agentringnoanswer']=!![];_0x398f10[_0x2010('0x1e')]=utils[_0x2010('0x1f')]();_0x398f10[_0x2010('0x6')]=_0x2010('0x30');_0x398f10[_0x2010('0x20')]=_0x2010('0x30');_0x398f10[_0x2010('0x31')]=_0x447eed['destuniqueid'];_0x398f10[_0x2010('0x32')]=_0x447eed['membername'];writeDB(_0x398f10);}});}}catch(_0x27fd64){utils[_0x2010('0x1a')](util[_0x2010('0x13')](_0x2010('0x2c'),_0x447eed[_0x2010('0x10')]),_0x27fd64);}};exports['agentcomplete']=function(_0x364338){try{if(!_[_0x2010('0x1b')](agents[_0x364338[_0x2010('0x11')]])){utils[_0x2010('0x1c')](util['format'](_0x2010('0x33'),_0x364338['uniqueid']),_0x364338);utils['info'](util['format'](_0x2010('0x34'),_0x364338[_0x2010('0x10')],agents[_0x364338[_0x2010('0x11')]][_0x2010('0x3')],_0x364338[_0x2010('0x11')]));agents[_0x364338[_0x2010('0x11')]]['agentcomplete']=!![];agents[_0x364338[_0x2010('0x11')]][_0x2010('0x35')]=utils[_0x2010('0x1f')]();agents[_0x364338['destuniqueid']]['talktime']=utils[_0x2010('0x36')](agents[_0x364338['destuniqueid']][_0x2010('0x35')],agents[_0x364338[_0x2010('0x11')]][_0x2010('0x2e')]);agents[_0x364338[_0x2010('0x11')]]['reason']=_0x364338[_0x2010('0x20')];agents[_0x364338[_0x2010('0x11')]][_0x2010('0x6')]=_0x2010('0x37');writeDB(agents[_0x364338[_0x2010('0x11')]]);}}catch(_0x2a53b3){utils['error'](util[_0x2010('0x13')](_0x2010('0x33'),_0x364338[_0x2010('0x10')]),_0x2a53b3);}};exports['blindtransfer']=function(_0x30e5d0){try{if(!_[_0x2010('0x1b')](agents[_0x30e5d0['transfereruniqueid']])){utils[_0x2010('0x1c')](util[_0x2010('0x13')](_0x2010('0x38'),_0x30e5d0[_0x2010('0x10')]),_0x30e5d0);utils[_0x2010('0x18')](util[_0x2010('0x13')](_0x2010('0x39'),_0x30e5d0[_0x2010('0x10')],agents[_0x30e5d0['transfereruniqueid']]['membername'],agents[_0x30e5d0[_0x2010('0x3a')]][_0x2010('0x10')]));agents[_0x30e5d0['transfereruniqueid']][_0x2010('0x3b')]=!![];agents[_0x30e5d0[_0x2010('0x3a')]][_0x2010('0x3c')]=_0x2010('0x3d');agents[_0x30e5d0[_0x2010('0x3a')]]['transferexten']=_0x30e5d0['extension'];agents[_0x30e5d0[_0x2010('0x3a')]][_0x2010('0x3e')]=agents[_0x30e5d0[_0x2010('0x3a')]][_0x2010('0x10')];}}catch(_0x38e596){utils[_0x2010('0x1a')](util[_0x2010('0x13')](_0x2010('0x38'),_0x30e5d0[_0x2010('0x10')]),_0x38e596);}};exports[_0x2010('0x3f')]=function(_0x1cc164){try{utils['debug'](util[_0x2010('0x13')](_0x2010('0x40'),_0x1cc164['origtransfereruniqueid']),_0x1cc164);if(_0x1cc164[_0x2010('0x41')]==_0x1cc164[_0x2010('0x42')]){if(!_[_0x2010('0x1b')](agents[_0x1cc164[_0x2010('0x43')]])){utils[_0x2010('0x18')](util[_0x2010('0x13')](_0x2010('0x44'),_0x1cc164[_0x2010('0x41')],agents[_0x1cc164[_0x2010('0x43')]][_0x2010('0x3')]));agents[_0x1cc164[_0x2010('0x43')]][_0x2010('0x3b')]=!![];agents[_0x1cc164[_0x2010('0x43')]][_0x2010('0x3c')]=_0x2010('0x45');agents[_0x1cc164[_0x2010('0x43')]][_0x2010('0x46')]=_0x1cc164[_0x2010('0x47')];agents[_0x1cc164[_0x2010('0x43')]][_0x2010('0x3e')]=_0x1cc164[_0x2010('0x41')];}if(_0x1cc164[_0x2010('0x48')]&&agents[_0x1cc164[_0x2010('0x48')]]){agents[_0x1cc164['transfereeuniqueid']][_0x2010('0x49')]=0x1;transfers[_0x1cc164['transfereeuniqueid']]=_['clone'](agents[_0x1cc164[_0x2010('0x48')]]);transfers[_0x1cc164[_0x2010('0x48')]]['calleridnum']=agents[_0x1cc164[_0x2010('0x43')]][_0x2010('0x5')];transfers[_0x1cc164[_0x2010('0x48')]][_0x2010('0x4a')]=agents[_0x1cc164['secondtransfereruniqueid']][_0x2010('0x4a')];transfers[_0x1cc164[_0x2010('0x48')]][_0x2010('0x15')]=utils[_0x2010('0x1f')]();transfers[_0x1cc164['transfereeuniqueid']][_0x2010('0x2e')]=utils['now']();transfers[_0x1cc164[_0x2010('0x48')]][_0x2010('0x22')]=0x0;transfers[_0x1cc164[_0x2010('0x48')]][_0x2010('0x49')]=0x2;}}else if(_0x1cc164['secondtransfereruniqueid']==_0x1cc164['secondtransfererlinkedid']){if(!_[_0x2010('0x1b')](agents[_0x1cc164[_0x2010('0x41')]])){utils['info'](util['format'](_0x2010('0x44'),_0x1cc164[_0x2010('0x41')],agents[_0x1cc164[_0x2010('0x41')]][_0x2010('0x3')]));agents[_0x1cc164['origtransfereruniqueid']][_0x2010('0x3b')]=!![];agents[_0x1cc164['origtransfereruniqueid']][_0x2010('0x3c')]=_0x2010('0x45');agents[_0x1cc164[_0x2010('0x41')]][_0x2010('0x46')]=_0x1cc164['secondtransfererexten'];agents[_0x1cc164[_0x2010('0x41')]][_0x2010('0x3e')]=_0x1cc164['secondtransfereruniqueid'];}if(_0x1cc164[_0x2010('0x4b')]&&agents[_0x1cc164[_0x2010('0x4b')]]){agents[_0x1cc164[_0x2010('0x4b')]][_0x2010('0x49')]=0x1;transfers[_0x1cc164[_0x2010('0x4b')]]=_[_0x2010('0x4c')](agents[_0x1cc164[_0x2010('0x4b')]]);transfers[_0x1cc164[_0x2010('0x4b')]][_0x2010('0x5')]=agents[_0x1cc164[_0x2010('0x41')]][_0x2010('0x5')];transfers[_0x1cc164[_0x2010('0x4b')]]['calleridname']=agents[_0x1cc164[_0x2010('0x41')]][_0x2010('0x4a')];transfers[_0x1cc164[_0x2010('0x4b')]]['agentcalledAt']=utils['now']();transfers[_0x1cc164[_0x2010('0x4b')]][_0x2010('0x2e')]=utils[_0x2010('0x1f')]();transfers[_0x1cc164[_0x2010('0x4b')]][_0x2010('0x22')]=0x0;transfers[_0x1cc164[_0x2010('0x4b')]]['agententerreason']=0x2;}}}catch(_0xe37cef){utils[_0x2010('0x1a')](util[_0x2010('0x13')]('[%s][agents][attendedtransfer]',_0x1cc164[_0x2010('0x41')]),_0xe37cef);}};exports[_0x2010('0x4d')]=function(_0x13d06d){try{utils['debug'](util[_0x2010('0x13')](_0x2010('0x4e'),_0x13d06d['uniqueid']),_0x13d06d);if(agents[_0x13d06d['uniqueid']]&&agents[_0x13d06d[_0x2010('0x10')]]['reason']==='timeout'){if(_0x13d06d[_0x2010('0x4f')]==='21'){agents[_0x13d06d[_0x2010('0x10')]][_0x2010('0x20')]=_0x2010('0x50');agents[_0x13d06d[_0x2010('0x10')]][_0x2010('0x6')]=_0x2010('0x50');}utils[_0x2010('0x18')](util[_0x2010('0x13')](_0x2010('0x51'),_0x13d06d['uniqueid'],agents[_0x13d06d[_0x2010('0x10')]][_0x2010('0x3')],agents[_0x13d06d['uniqueid']][_0x2010('0x20')],agents[_0x13d06d[_0x2010('0x10')]][_0x2010('0x6')]));writeDB(agents[_0x13d06d[_0x2010('0x10')]]);var _0x517afa=unanswered[_0x2010('0x52')](_0x13d06d[_0x2010('0x10')]);if(_0x517afa>-0x1){unanswered['splice'](_0x517afa,0x1);}}if(transfers[_0x13d06d['uniqueid']]){transfers[_0x13d06d[_0x2010('0x10')]]['agentcomplete']=!![];transfers[_0x13d06d[_0x2010('0x10')]][_0x2010('0x35')]=utils[_0x2010('0x1f')]();transfers[_0x13d06d[_0x2010('0x10')]][_0x2010('0x24')]=utils[_0x2010('0x36')](transfers[_0x13d06d[_0x2010('0x10')]]['agentcompleteAt'],transfers[_0x13d06d[_0x2010('0x10')]][_0x2010('0x2e')]);transfers[_0x13d06d[_0x2010('0x10')]]['reason']=_0x2010('0x53');transfers[_0x13d06d[_0x2010('0x10')]][_0x2010('0x6')]=_0x2010('0x37');utils[_0x2010('0x18')](util[_0x2010('0x13')](_0x2010('0x51'),_0x13d06d[_0x2010('0x10')],transfers[_0x13d06d['uniqueid']][_0x2010('0x3')],transfers[_0x13d06d[_0x2010('0x10')]][_0x2010('0x20')],transfers[_0x13d06d['uniqueid']][_0x2010('0x6')]));writeDB(transfers[_0x13d06d[_0x2010('0x10')]],!![]);}if(agents[_0x13d06d['uniqueid']]&&agents[_0x13d06d[_0x2010('0x10')]][_0x2010('0x2e')]){agents[_0x13d06d[_0x2010('0x10')]][_0x2010('0xa')]=!![];agents[_0x13d06d[_0x2010('0x10')]]['agentcompleteAt']=utils[_0x2010('0x1f')]();agents[_0x13d06d[_0x2010('0x10')]]['talktime']=utils[_0x2010('0x36')](agents[_0x13d06d[_0x2010('0x10')]]['agentcompleteAt'],agents[_0x13d06d[_0x2010('0x10')]]['agentconnectAt']);agents[_0x13d06d['uniqueid']][_0x2010('0x20')]=agents[_0x13d06d[_0x2010('0x10')]][_0x2010('0x3b')]?_0x2010('0x3b'):_0x2010('0x53');agents[_0x13d06d[_0x2010('0x10')]]['lastevent']=_0x2010('0x37');utils[_0x2010('0x18')](util[_0x2010('0x13')](_0x2010('0x51'),_0x13d06d['uniqueid'],agents[_0x13d06d[_0x2010('0x10')]]['membername'],agents[_0x13d06d[_0x2010('0x10')]][_0x2010('0x20')],agents[_0x13d06d[_0x2010('0x10')]][_0x2010('0x6')]));writeDB(agents[_0x13d06d['uniqueid']]);}}catch(_0x496280){utils['error'](util[_0x2010('0x13')]('[%s][agents][hangup]',_0x13d06d[_0x2010('0x10')]),_0x496280);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 4bb8c5c..a4d7432 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 _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 +var _0x1405=['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','calleridnum','lastevent','accountcode','then','UserId','request','CreateVoiceCallReport','newchannel','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','context','exten','DOCUMENTATION','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','now','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','disposition','toNumber','error','hangup','debug','[%s][calls][hangup]','callerid','calleridname','endtime','duration','diffTime','starttime','attendedtransfer','localtwolinkedid','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','destinationchannel','secondtransfererchannel','_attended','transfertargetchannel','origtransfererchannel','[%s][calls][attendedtransfer]','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','[%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-preview','xmd-callerid','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','lastapplication','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','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','appdata','application','toLowerCase','set','startsWith','includes','lodash','util','./utils'];(function(_0x23b5a1,_0x410988){var _0x21ac56=function(_0xa6ac1c){while(--_0xa6ac1c){_0x23b5a1['push'](_0x23b5a1['shift']());}};_0x21ac56(++_0x410988);}(_0x1405,0xc7));var _0x5140=function(_0x4c132e,_0x36bf66){_0x4c132e=_0x4c132e-0x0;var _0x19d5c1=_0x1405[_0x4c132e];return _0x19d5c1;};'use strict';var _=require(_0x5140('0x0'));var util=require(_0x5140('0x1'));var utils=require(_0x5140('0x2'));var dispositions=[_0x5140('0x3'),_0x5140('0x4'),_0x5140('0x4'),_0x5140('0x3'),_0x5140('0x3'),_0x5140('0x3'),_0x5140('0x5'),_0x5140('0x6'),_0x5140('0x4'),_0x5140('0x4'),_0x5140('0x4')];var channels={};function writeDB(_0x1d93ad){utils[_0x5140('0x7')](util[_0x5140('0x8')](_0x5140('0x9'),_0x1d93ad[_0x5140('0xa')],_0x1d93ad[_0x5140('0xb')],_0x1d93ad[_0x5140('0xc')],_0x1d93ad[_0x5140('0xd')],_0x1d93ad['interface'],_0x1d93ad[_0x5140('0xe')],_0x1d93ad['connectedlinenum'],_0x1d93ad[_0x5140('0xf')]));if(_0x1d93ad[_0x5140('0x10')]){utils['getUserByInternal'](_0x1d93ad[_0x5140('0x10')])[_0x5140('0x11')](function(_0x32b245){if(_0x32b245){_0x1d93ad[_0x5140('0x12')]=_0x32b245['id'];}utils[_0x5140('0x13')](_0x5140('0x14'),_0x1d93ad);});}else{utils[_0x5140('0x13')]('CreateVoiceCallReport',_0x1d93ad);}if(channels[_0x1d93ad[_0x5140('0xa')]]){delete channels[_0x1d93ad['uniqueid']];}}exports[_0x5140('0x15')]=function(_0x5e95ad){try{utils['debug'](util[_0x5140('0x8')](_0x5140('0x16'),_0x5e95ad[_0x5140('0xa')]),_0x5e95ad);if(_0x5e95ad[_0x5140('0xa')]==_0x5e95ad[_0x5140('0x17')]&&_0x5e95ad[_0x5140('0xb')]!=_0x5140('0x18')){utils[_0x5140('0x7')](util['format']('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x5e95ad[_0x5140('0xa')],_0x5e95ad[_0x5140('0x19')],_0x5e95ad[_0x5140('0x1a')]));channels[_0x5e95ad['uniqueid']]={'uniqueid':_0x5e95ad['uniqueid'],'accountcode':_0x5e95ad[_0x5140('0x10')],'source':_0x5e95ad[_0x5140('0xe')],'destination':_0x5e95ad['exten'],'destinationcontext':_0x5e95ad[_0x5140('0x19')],'channel':_0x5e95ad[_0x5140('0xb')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x5140('0x3'),'amaflags':_0x5140('0x1b')};}}catch(_0x2f0fae){utils['error'](util[_0x5140('0x8')](_0x5140('0x16'),_0x5e95ad[_0x5140('0xa')]),_0x2f0fae);}};exports[_0x5140('0x1c')]=function(_0x2561e8){try{utils['debug'](util[_0x5140('0x8')](_0x5140('0x1d'),_0x2561e8[_0x5140('0xa')]),_0x2561e8);if(!_[_0x5140('0x1e')](channels[_0x2561e8[_0x5140('0xa')]])&&_0x2561e8[_0x5140('0x1f')]==0x6){utils[_0x5140('0x7')](util['format'](_0x5140('0x20'),_0x2561e8['uniqueid'],_0x2561e8['context'],_0x2561e8[_0x5140('0xb')]));if(_[_0x5140('0x1e')](channels[_0x2561e8['uniqueid']][_0x5140('0x21')])){channels[_0x2561e8[_0x5140('0xa')]][_0x5140('0x21')]=utils[_0x5140('0x22')]();}}else if(!_['isNil'](channels[_0x2561e8[_0x5140('0x17')]])&&_0x2561e8[_0x5140('0x1f')]==0x6&&_0x2561e8[_0x5140('0x19')]!=_0x5140('0x23')){utils[_0x5140('0x7')](util['format'](_0x5140('0x24'),_0x2561e8[_0x5140('0xa')],_0x2561e8['linkedid'],_0x2561e8['context'],_0x2561e8[_0x5140('0xb')]));channels[_0x2561e8[_0x5140('0x17')]][_0x5140('0x10')]=_0x2561e8[_0x5140('0x10')];channels[_0x2561e8[_0x5140('0x17')]]['destinationchannel']=_0x2561e8[_0x5140('0xb')];if(_[_0x5140('0x1e')](channels[_0x2561e8[_0x5140('0x17')]][_0x5140('0x25')])){channels[_0x2561e8[_0x5140('0x17')]]['answertime']=utils[_0x5140('0x22')]();}channels[_0x2561e8[_0x5140('0x17')]][_0x5140('0x26')]=dispositions[_[_0x5140('0x27')](_0x2561e8[_0x5140('0x1f')])]||'ANSWERED';}}catch(_0x8d69db){utils[_0x5140('0x28')](util[_0x5140('0x8')](_0x5140('0x1d'),_0x2561e8[_0x5140('0xa')]),_0x8d69db);}};exports[_0x5140('0x29')]=function(_0x10f150){try{if(!_[_0x5140('0x1e')](channels[_0x10f150[_0x5140('0xa')]])){utils[_0x5140('0x2a')](util[_0x5140('0x8')](_0x5140('0x2b'),_0x10f150['uniqueid']),_0x10f150);if(_['isNil'](channels[_0x10f150[_0x5140('0xa')]][_0x5140('0x2c')])){channels[_0x10f150[_0x5140('0xa')]][_0x5140('0x2c')]=_0x10f150[_0x5140('0x2d')]+'\x20<'+_0x10f150[_0x5140('0xe')]+'>';}utils[_0x5140('0x7')](util[_0x5140('0x8')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x10f150['uniqueid'],channels[_0x10f150[_0x5140('0xa')]]['callerid'],_0x10f150['cause-txt']));channels[_0x10f150[_0x5140('0xa')]][_0x5140('0x2e')]=utils[_0x5140('0x22')]();channels[_0x10f150[_0x5140('0xa')]][_0x5140('0x2f')]=utils[_0x5140('0x30')](channels[_0x10f150[_0x5140('0xa')]][_0x5140('0x2e')],channels[_0x10f150[_0x5140('0xa')]][_0x5140('0x31')]);channels[_0x10f150[_0x5140('0xa')]]['billableseconds']=channels[_0x10f150[_0x5140('0xa')]][_0x5140('0x25')]?utils[_0x5140('0x30')](channels[_0x10f150[_0x5140('0xa')]][_0x5140('0x2e')],channels[_0x10f150[_0x5140('0xa')]][_0x5140('0x25')]):0x0;writeDB(channels[_0x10f150[_0x5140('0xa')]]);}}catch(_0x42dc9c){utils['error'](util[_0x5140('0x8')]('[%s][calls][hangup]',_0x10f150[_0x5140('0xa')]),_0x42dc9c);}};exports[_0x5140('0x32')]=function(_0x15cf3e){try{if(!_['isNil'](channels[_0x15cf3e[_0x5140('0x33')]])){utils['debug'](util[_0x5140('0x8')]('[%s][calls][attendedtransfer]',_0x15cf3e[_0x5140('0x34')]),_0x15cf3e);if(channels[_0x15cf3e['localtwolinkedid']]['channel']==_0x15cf3e[_0x5140('0x35')]){utils[_0x5140('0x7')](util[_0x5140('0x8')](_0x5140('0x36'),_0x15cf3e[_0x5140('0x34')],_0x15cf3e['localtwolinkedid'],_0x15cf3e['secondtransfererchannel']));channels[_0x15cf3e[_0x5140('0x33')]][_0x5140('0x37')]=_0x15cf3e[_0x5140('0x38')];channels[_0x15cf3e['localtwolinkedid']]['userfield']=_0x5140('0x39');}else if(channels[_0x15cf3e[_0x5140('0x33')]][_0x5140('0xb')]=_0x15cf3e[_0x5140('0x3a')]){utils[_0x5140('0x7')](util['format'](_0x5140('0x36'),_0x15cf3e[_0x5140('0x34')],_0x15cf3e[_0x5140('0x33')],_0x15cf3e['origtransfererchannel']));channels[_0x15cf3e[_0x5140('0x33')]][_0x5140('0x37')]=_0x15cf3e[_0x5140('0x3b')];channels[_0x15cf3e['localtwolinkedid']]['userfield']=_0x5140('0x39');}}}catch(_0x4dcbd2){utils[_0x5140('0x28')](util[_0x5140('0x8')](_0x5140('0x3c'),_0x15cf3e[_0x5140('0x34')]),_0x4dcbd2);}};exports[_0x5140('0x3d')]=function(_0x2e0c32){try{if(!_[_0x5140('0x1e')](channels[_0x2e0c32[_0x5140('0xa')]])){utils[_0x5140('0x2a')](util[_0x5140('0x8')](_0x5140('0x3e'),_0x2e0c32[_0x5140('0xa')]),_0x2e0c32);channels[_0x2e0c32[_0x5140('0xa')]][_0x5140('0x3f')]=utils[_0x5140('0x22')]();utils[_0x5140('0x7')](util[_0x5140('0x8')](_0x5140('0x40'),_0x2e0c32['uniqueid'],channels[_0x2e0c32['uniqueid']][_0x5140('0x3f')]));}}catch(_0x38ad0d){utils[_0x5140('0x28')](util[_0x5140('0x8')](_0x5140('0x3e'),_0x2e0c32[_0x5140('0xa')]),_0x38ad0d);}};exports[_0x5140('0x41')]=function(_0x16c870){try{if(!_[_0x5140('0x1e')](channels[_0x16c870['uniqueid']])){utils['debug'](util[_0x5140('0x8')](_0x5140('0x42'),_0x16c870['uniqueid']),_0x16c870);if(!_['isNil'](channels[_0x16c870['uniqueid']][_0x5140('0x3f')])){channels[_0x16c870[_0x5140('0xa')]]['mohtime']+=utils[_0x5140('0x30')](utils[_0x5140('0x22')](),channels[_0x16c870[_0x5140('0xa')]][_0x5140('0x3f')]);utils[_0x5140('0x7')](util['format'](_0x5140('0x43'),_0x16c870[_0x5140('0xa')],channels[_0x16c870[_0x5140('0xa')]][_0x5140('0x44')]));delete channels[_0x16c870[_0x5140('0xa')]]['musiconholdstartAt'];}}}catch(_0x552945){utils['error'](util[_0x5140('0x8')](_0x5140('0x42'),_0x16c870[_0x5140('0xa')]),_0x552945);}};exports['varset']=function(_0x55faa3){try{if(!_['isNil'](channels[_0x55faa3[_0x5140('0xa')]])){utils[_0x5140('0x2a')](util[_0x5140('0x8')](_0x5140('0x45'),_0x55faa3[_0x5140('0xa')]),_0x55faa3);if(!_[_0x5140('0x1e')](_0x55faa3[_0x5140('0x46')]['xmd-originatecalleridnum'])){utils[_0x5140('0x7')](util[_0x5140('0x8')](_0x5140('0x47'),_0x55faa3[_0x5140('0xa')],_0x55faa3[_0x5140('0x48')]));channels[_0x55faa3['uniqueid']][_0x5140('0x49')]=_0x55faa3[_0x5140('0x48')];}if(!_[_0x5140('0x1e')](_0x55faa3[_0x5140('0x46')]['xmd-phone'])){utils[_0x5140('0x7')](util['format'](_0x5140('0x4a'),_0x55faa3[_0x5140('0xa')],_0x55faa3[_0x5140('0x48')]));channels[_0x55faa3[_0x5140('0xa')]][_0x5140('0x4b')]=_0x55faa3['value'];channels[_0x55faa3[_0x5140('0xa')]][_0x5140('0x2c')]='\x22'+_0x55faa3[_0x5140('0x48')]+_0x5140('0x4c')+_0x55faa3[_0x5140('0x48')]+'>';}if(!_[_0x5140('0x1e')](_0x55faa3[_0x5140('0x46')][_0x5140('0x4d')])||!_[_0x5140('0x1e')](_0x55faa3['variable'][_0x5140('0x4e')])){utils['info'](util[_0x5140('0x8')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x55faa3['uniqueid'],!_['isNil'](_0x55faa3['variable'][_0x5140('0x4d')])?'xmd-callerid-preview':_0x5140('0x4e'),_0x55faa3[_0x5140('0x48')]));channels[_0x55faa3['uniqueid']][_0x5140('0x2c')]=_0x55faa3[_0x5140('0x48')];}if(!_[_0x5140('0x1e')](_0x55faa3['variable']['xmd-queue'])||!_['isNil'](_0x55faa3[_0x5140('0x46')][_0x5140('0x4f')])){utils[_0x5140('0x7')](util[_0x5140('0x8')](_0x5140('0x50'),_0x55faa3[_0x5140('0xa')],!_[_0x5140('0x1e')](_0x55faa3[_0x5140('0x46')][_0x5140('0x51')])?'xmd-queue':_0x5140('0x4f'),_0x55faa3['value']));channels[_0x55faa3[_0x5140('0xa')]][_0x5140('0x52')]='Queue';channels[_0x55faa3[_0x5140('0xa')]][_0x5140('0x53')]=_0x55faa3[_0x5140('0x48')];channels[_0x55faa3[_0x5140('0xa')]]['queue']=!![];}if(!_[_0x5140('0x1e')](_0x55faa3['variable'][_0x5140('0x54')])){utils[_0x5140('0x7')](util[_0x5140('0x8')](_0x5140('0x55'),_0x55faa3[_0x5140('0xa')],_0x55faa3[_0x5140('0x48')]));channels[_0x55faa3[_0x5140('0xa')]]['ContactId']=_0x55faa3['value'];}if(!_[_0x5140('0x1e')](_0x55faa3[_0x5140('0x46')][_0x5140('0x56')])){utils[_0x5140('0x7')](util[_0x5140('0x8')](_0x5140('0x57'),_0x55faa3['uniqueid'],_0x55faa3[_0x5140('0x48')]));channels[_0x55faa3[_0x5140('0xa')]][_0x5140('0x58')]=_0x55faa3['value'];}if(!_['isNil'](_0x55faa3['variable']['outboundrouteid'])){utils['info'](util[_0x5140('0x8')](_0x5140('0x59'),_0x55faa3['uniqueid'],_0x55faa3[_0x5140('0x48')]));channels[_0x55faa3['uniqueid']][_0x5140('0x5a')]=_0x55faa3[_0x5140('0x48')];}if(!_[_0x5140('0x1e')](_0x55faa3[_0x5140('0x46')][_0x5140('0x5b')])){utils['info'](util['format'](_0x5140('0x5c'),_0x55faa3[_0x5140('0xa')],_0x55faa3['value']));channels[_0x55faa3['uniqueid']][_0x5140('0x5b')]=_0x55faa3[_0x5140('0x48')];}}}catch(_0x4e983f){utils[_0x5140('0x28')](util['format'](_0x5140('0x45'),_0x55faa3[_0x5140('0xa')]),_0x4e983f);}};exports[_0x5140('0x5d')]=function(_0x150c83){try{if(!_[_0x5140('0x1e')](channels[_0x150c83[_0x5140('0xa')]])){utils[_0x5140('0x2a')](util[_0x5140('0x8')](_0x5140('0x5e'),_0x150c83['uniqueid']),_0x150c83);utils[_0x5140('0x7')](util[_0x5140('0x8')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x150c83[_0x5140('0xa')],_0x150c83['application'],_0x150c83[_0x5140('0x5f')]));if(_0x150c83[_0x5140('0x60')][_0x5140('0x61')]()==_0x5140('0x62')&&_[_0x5140('0x63')](_0x150c83[_0x5140('0x5f')][_0x5140('0x61')](),'cdr')){var _0x256b17=_0x150c83[_0x5140('0x5f')]['split']('=');var _0x184b7e=_0x256b17[0x0]['substring'](_0x256b17[0x0]['lastIndexOf']('(')+0x1,_0x256b17[0x0]['lastIndexOf'](')'));var _0x57f855=_0x256b17[0x1];channels[_0x150c83[_0x5140('0xa')]][_0x184b7e]=_0x57f855;}if(!_[_0x5140('0x64')]([_0x5140('0x29'),'noop','execif','set','gotoif'],_0x150c83['application'][_0x5140('0x61')]())){channels[_0x150c83['uniqueid']][_0x5140('0x52')]=_0x150c83[_0x5140('0x60')];channels[_0x150c83[_0x5140('0xa')]][_0x5140('0x53')]=_0x150c83['appdata'];}}}catch(_0x218e02){utils[_0x5140('0x28')](util[_0x5140('0x8')](_0x5140('0x5e'),_0x150c83[_0x5140('0xa')]),_0x218e02);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index d9eee07..22f00b4 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 _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 +var _0xaa81=['info','[core]\x20connected','shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','./utils','connect'];(function(_0x201798,_0x208be1){var _0x2775fa=function(_0x39442a){while(--_0x39442a){_0x201798['push'](_0x201798['shift']());}};_0x2775fa(++_0x208be1);}(_0xaa81,0xe2));var _0x1aa8=function(_0x3366f0,_0x5ab0e){_0x3366f0=_0x3366f0-0x0;var _0x590337=_0xaa81[_0x3366f0];return _0x590337;};'use strict';var utils=require(_0x1aa8('0x0'));exports[_0x1aa8('0x1')]=function(){utils[_0x1aa8('0x2')](_0x1aa8('0x3'));};exports[_0x1aa8('0x4')]=function(){utils[_0x1aa8('0x2')]('[core]\x20shutdown');};exports[_0x1aa8('0x5')]=function(){utils[_0x1aa8('0x2')](_0x1aa8('0x6'));};exports[_0x1aa8('0x7')]=function(_0xf70dc4){utils[_0x1aa8('0x7')](_0x1aa8('0x8'),_0xf70dc4);};exports[_0x1aa8('0x9')]=function(){utils[_0x1aa8('0x2')](_0x1aa8('0xa'));};exports[_0x1aa8('0xb')]=function(_0x29e0ca){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 5d6986d..d723520 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 _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 +var _0xf788=['split','error','varset','[%s][dials][varset]','isNil','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','hangup','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','diffTime','endtime','billableseconds','lodash','util','info','format','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','startsWith','appdata','cdr(routeid)'];(function(_0x36fd73,_0x28287c){var _0x389e52=function(_0x14474b){while(--_0x14474b){_0x36fd73['push'](_0x36fd73['shift']());}};_0x389e52(++_0x28287c);}(_0xf788,0x114));var _0x8f78=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xf788[_0x5f09c5];return _0x426ad9;};'use strict';var _=require(_0x8f78('0x0'));var util=require(_0x8f78('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x219557){utils[_0x8f78('0x2')](util[_0x8f78('0x3')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x219557[_0x8f78('0x4')],_0x219557[_0x8f78('0x5')],_0x219557[_0x8f78('0x6')],_0x219557[_0x8f78('0x7')],_0x219557[_0x8f78('0x8')],_0x219557[_0x8f78('0x9')]));utils['request'](_0x8f78('0xa'),_0x219557);delete dials[_0x219557[_0x8f78('0x4')]];}exports[_0x8f78('0xb')]=function(_0x232c4b){try{utils[_0x8f78('0xc')](util[_0x8f78('0x3')](_0x8f78('0xd'),_0x232c4b[_0x8f78('0x4')]),_0x232c4b);utils['info'](util[_0x8f78('0x3')](_0x8f78('0xe'),_0x232c4b[_0x8f78('0x4')],_0x232c4b['application'],_0x232c4b['appdata']));if(_0x232c4b['application']['toLowerCase']()=='set'&&_[_0x8f78('0xf')](_0x232c4b[_0x8f78('0x10')]['toLowerCase'](),_0x8f78('0x11'))){var _0x38f9a5=_0x232c4b[_0x8f78('0x10')][_0x8f78('0x12')]('=');dials[_0x232c4b[_0x8f78('0x4')]]={'routeId':_0x38f9a5[0x1]};}}catch(_0x15d093){utils[_0x8f78('0x13')](util[_0x8f78('0x3')](_0x8f78('0xd'),_0x232c4b[_0x8f78('0x4')]),_0x15d093);}};exports[_0x8f78('0x14')]=function(_0x52fad8){try{utils[_0x8f78('0xc')](util[_0x8f78('0x3')](_0x8f78('0x15'),_0x52fad8[_0x8f78('0x4')]),_0x52fad8);if(!_[_0x8f78('0x16')](_0x52fad8['variable'][_0x8f78('0x17')])){utils[_0x8f78('0x2')](util['format'](_0x8f78('0x18'),_0x52fad8[_0x8f78('0x4')],_0x52fad8['value']));dials[_0x52fad8[_0x8f78('0x4')]]={'routeId':_0x52fad8[_0x8f78('0x19')]};}}catch(_0x3280e3){utils['error'](util[_0x8f78('0x3')](_0x8f78('0x15'),_0x52fad8['uniqueid']),_0x3280e3);}};exports[_0x8f78('0x1a')]=function(_0x20e146){try{if(!_[_0x8f78('0x16')](dials[_0x20e146[_0x8f78('0x4')]])){utils[_0x8f78('0xc')](util['format'](_0x8f78('0x1b'),_0x20e146['uniqueid']),_0x20e146);dials[_0x20e146['uniqueid']]=_[_0x8f78('0x1c')](dials[_0x20e146[_0x8f78('0x4')]],_0x20e146);dials[_0x20e146['uniqueid']][_0x8f78('0x1d')]=utils[_0x8f78('0x1e')]();dials[_0x20e146['uniqueid']][_0x8f78('0x1f')]=_0x8f78('0x20');utils[_0x8f78('0x2')](util['format'](_0x8f78('0x21'),_0x20e146['uniqueid'],dials[_0x20e146[_0x8f78('0x4')]]['starttime']));}}catch(_0x2b3d8d){utils[_0x8f78('0x13')](util[_0x8f78('0x3')](_0x8f78('0x1b'),_0x20e146[_0x8f78('0x4')]),_0x2b3d8d);}};exports[_0x8f78('0x22')]=function(_0x23ca19){try{if(!_[_0x8f78('0x16')](dials[_0x23ca19[_0x8f78('0x4')]])){utils['debug'](util[_0x8f78('0x3')](_0x8f78('0x23'),_0x23ca19[_0x8f78('0x4')]),_0x23ca19);dials[_0x23ca19[_0x8f78('0x4')]][_0x8f78('0x9')]=_0x23ca19[_0x8f78('0x9')];if(_0x23ca19['dialstatus']==_0x8f78('0x24')){dials[_0x23ca19[_0x8f78('0x4')]]=_['assign'](dials[_0x23ca19[_0x8f78('0x4')]],_0x23ca19);dials[_0x23ca19['uniqueid']][_0x8f78('0x25')]=utils[_0x8f78('0x1e')]();dials[_0x23ca19[_0x8f78('0x4')]][_0x8f78('0x1f')]=_0x8f78('0x26');utils[_0x8f78('0x2')](util[_0x8f78('0x3')](_0x8f78('0x27'),_0x23ca19['uniqueid'],_0x23ca19[_0x8f78('0x9')],dials[_0x23ca19['uniqueid']][_0x8f78('0x25')]));}else{utils[_0x8f78('0x2')](util[_0x8f78('0x3')]('[%s][dials][dialend]\x20dialstatus:%s',_0x23ca19['uniqueid'],_0x23ca19[_0x8f78('0x9')]));}}}catch(_0x29acfd){utils['error'](util[_0x8f78('0x3')](_0x8f78('0x23'),_0x23ca19[_0x8f78('0x4')]),_0x29acfd);}};exports[_0x8f78('0x28')]=function(_0x4d0e9d){try{if(!_[_0x8f78('0x16')](dials[_0x4d0e9d[_0x8f78('0x4')]])){utils['debug'](util[_0x8f78('0x3')]('[%s][dials][hangup]',_0x4d0e9d[_0x8f78('0x4')]),_0x4d0e9d);utils[_0x8f78('0x2')](util[_0x8f78('0x3')](_0x8f78('0x29'),_0x4d0e9d['uniqueid'],_0x4d0e9d[_0x8f78('0x7')],_0x4d0e9d[_0x8f78('0x2a')],_0x4d0e9d[_0x8f78('0x2b')]));dials[_0x4d0e9d[_0x8f78('0x4')]]=_[_0x8f78('0x1c')](dials[_0x4d0e9d[_0x8f78('0x4')]],{'endtime':utils[_0x8f78('0x1e')](),'lastevent':_0x8f78('0x2c')});dials[_0x4d0e9d[_0x8f78('0x4')]][_0x8f78('0x2d')]=utils[_0x8f78('0x2e')](dials[_0x4d0e9d['uniqueid']]['endtime'],dials[_0x4d0e9d[_0x8f78('0x4')]]['starttime']);dials[_0x4d0e9d['uniqueid']]['holdtime']=utils[_0x8f78('0x2e')](dials[_0x4d0e9d['uniqueid']][_0x8f78('0x25')]||dials[_0x4d0e9d[_0x8f78('0x4')]][_0x8f78('0x2f')],dials[_0x4d0e9d[_0x8f78('0x4')]][_0x8f78('0x1d')]);dials[_0x4d0e9d['uniqueid']][_0x8f78('0x30')]=dials[_0x4d0e9d[_0x8f78('0x4')]][_0x8f78('0x25')]?utils[_0x8f78('0x2e')](dials[_0x4d0e9d[_0x8f78('0x4')]]['endtime'],dials[_0x4d0e9d['uniqueid']][_0x8f78('0x25')]):0x0;writeDB(dials[_0x4d0e9d[_0x8f78('0x4')]]);}}catch(_0x339ce0){utils[_0x8f78('0x13')](util[_0x8f78('0x3')]('[%s][dials][hangup]',_0x4d0e9d[_0x8f78('0x4')]),_0x339ce0);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 45f7fc4..949388c 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 _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 +var _0xf10b=['[%s][index][blindtransfer]','origtransfereruniqueid','attendedtransfer','[%s][index][attendedtransfer]','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','../../config/environment','./utils','util','xdr','disabled','env','production','local','asterisk','port','username','password','keepConnected','info','XDR\x20DISABLED','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','debug','format','device','[%s][index][devicestatechange]','uniqueid','agentcalled','[%s][index][agentcalled]','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][queuecallerabandon]','queuecallerabandon','[%s][index][queuecallerjoin]','queuecallerjoin','[%s][index][queuecallerleave]','queuecallerleave','[%s][index][musiconholdstart]','musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf10b,0x13b));var _0xbf10=function(_0x1c2784,_0x59d951){_0x1c2784=_0x1c2784-0x0;var _0x2506e9=_0xf10b[_0x1c2784];return _0x2506e9;};var AsteriskManager=require('asterisk-manager');var config=require(_0xbf10('0x0'));var utils=require(_0xbf10('0x1'));var util=require(_0xbf10('0x2'));var isXDREnabled=config[_0xbf10('0x3')]&&config[_0xbf10('0x3')][_0xbf10('0x4')]?!config[_0xbf10('0x3')][_0xbf10('0x4')]:!![];var isProduction=config[_0xbf10('0x5')]===_0xbf10('0x6')||![];var isLocalAsterisk=config[_0xbf10('0x3')]&&config[_0xbf10('0x3')][_0xbf10('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0xbf10('0x8')][_0xbf10('0x9')],config[_0xbf10('0x8')]['ip'],config[_0xbf10('0x8')][_0xbf10('0xa')],config[_0xbf10('0x8')][_0xbf10('0xb')],!![]);ami[_0xbf10('0xc')]();if(!isXDREnabled){utils[_0xbf10('0xd')](_0xbf10('0xe'));}else if(!isProduction&&!isLocalAsterisk){utils[_0xbf10('0xd')](_0xbf10('0xf'));}else{var agents=require(_0xbf10('0x10'));var calls=require(_0xbf10('0x11'));var queues=require(_0xbf10('0x12'));var recordings=require(_0xbf10('0x13'));var members=require(_0xbf10('0x14'));var dials=require(_0xbf10('0x15'));var transfers=require(_0xbf10('0x16'));var core=require(_0xbf10('0x17'));ami['on'](_0xbf10('0x18'),core[_0xbf10('0x18')]);ami['on']('shutdown',core[_0xbf10('0x19')]);ami['on'](_0xbf10('0x1a'),core['fullybooted']);ami['on'](_0xbf10('0x1b'),core[_0xbf10('0x1b')]);ami['on'](_0xbf10('0x1c'),core[_0xbf10('0x1c')]);ami['on'](_0xbf10('0x1d'),core[_0xbf10('0x1d')]);ami['on'](_0xbf10('0x1e'),function(_0x130e56){try{utils[_0xbf10('0x1f')](util[_0xbf10('0x20')]('[%s][index][devicestatechange]',_0x130e56[_0xbf10('0x21')]),_0x130e56);members[_0xbf10('0x1e')](_0x130e56);}catch(_0x530d0d){utils['error'](util[_0xbf10('0x20')](_0xbf10('0x22'),_0x130e56[_0xbf10('0x21')]),_0x530d0d);}});ami['on']('agentcalled',function(_0x242d48){try{utils[_0xbf10('0x1f')](util[_0xbf10('0x20')]('[%s][index][agentcalled]',_0x242d48[_0xbf10('0x23')]),_0x242d48);agents[_0xbf10('0x24')](_0x242d48);}catch(_0x1b7103){utils[_0xbf10('0x1b')](util[_0xbf10('0x20')](_0xbf10('0x25'),_0x242d48[_0xbf10('0x23')]),_0x1b7103);}});ami['on'](_0xbf10('0x26'),function(_0x3a30ca){try{utils[_0xbf10('0x1f')](util['format']('[%s][index][agentringnoanswer]',_0x3a30ca[_0xbf10('0x23')]),_0x3a30ca);agents[_0xbf10('0x26')](_0x3a30ca);}catch(_0x42884c){utils['error'](util[_0xbf10('0x20')](_0xbf10('0x27'),_0x3a30ca['uniqueid']),_0x42884c);}});ami['on'](_0xbf10('0x28'),function(_0x54a55b){try{utils[_0xbf10('0x1f')](util[_0xbf10('0x20')](_0xbf10('0x29'),_0x54a55b['uniqueid']),_0x54a55b);agents['agentconnect'](_0x54a55b);queues[_0xbf10('0x28')](_0x54a55b);}catch(_0x54f5f8){utils['error'](util[_0xbf10('0x20')](_0xbf10('0x29'),_0x54a55b[_0xbf10('0x23')]),_0x54f5f8);}});ami['on']('agentcomplete',function(_0x57a61d){try{utils[_0xbf10('0x1f')](util[_0xbf10('0x20')]('[%s][index][agentcomplete]',_0x57a61d[_0xbf10('0x23')]),_0x57a61d);agents[_0xbf10('0x2a')](_0x57a61d);queues[_0xbf10('0x2a')](_0x57a61d);members[_0xbf10('0x2a')](_0x57a61d);}catch(_0x3c3471){utils['error'](util['format']('[%s][index][agentcomplete]',_0x57a61d[_0xbf10('0x23')]),_0x3c3471);}});ami['on']('queuecallerabandon',function(_0x376c12){try{utils[_0xbf10('0x1f')](util['format'](_0xbf10('0x2b'),_0x376c12[_0xbf10('0x23')]),_0x376c12);agents[_0xbf10('0x2c')](_0x376c12);queues['queuecallerabandon'](_0x376c12);}catch(_0x38c844){utils[_0xbf10('0x1b')](util[_0xbf10('0x20')]('[%s][index][queuecallerabandon]',_0x376c12[_0xbf10('0x23')]),_0x38c844);}});ami['on']('queuecallerjoin',function(_0xf91f2){try{utils[_0xbf10('0x1f')](util[_0xbf10('0x20')](_0xbf10('0x2d'),_0xf91f2[_0xbf10('0x23')]),_0xf91f2);queues['queuecallerjoin'](_0xf91f2);recordings[_0xbf10('0x2e')](_0xf91f2);}catch(_0x5232b1){utils[_0xbf10('0x1b')](util[_0xbf10('0x20')](_0xbf10('0x2d'),_0xf91f2[_0xbf10('0x23')]),_0x5232b1);}});ami['on']('queuecallerleave',function(_0x496ae5){try{utils[_0xbf10('0x1f')](util['format'](_0xbf10('0x2f'),_0x496ae5[_0xbf10('0x23')]),_0x496ae5);queues[_0xbf10('0x30')](_0x496ae5);}catch(_0x2d2242){utils[_0xbf10('0x1b')](util[_0xbf10('0x20')](_0xbf10('0x2f'),_0x496ae5[_0xbf10('0x23')]),_0x2d2242);}});ami['on']('musiconholdstart',function(_0x5a1ae1){try{utils[_0xbf10('0x1f')](util[_0xbf10('0x20')](_0xbf10('0x31'),_0x5a1ae1[_0xbf10('0x23')]),_0x5a1ae1);queues[_0xbf10('0x32')](_0x5a1ae1);calls[_0xbf10('0x32')](_0x5a1ae1);}catch(_0x30e92a){utils[_0xbf10('0x1b')](util[_0xbf10('0x20')]('[%s][index][musiconholdstart]',_0x5a1ae1[_0xbf10('0x23')]),_0x30e92a);}});ami['on'](_0xbf10('0x33'),function(_0x262a2b){try{utils[_0xbf10('0x1f')](util[_0xbf10('0x20')](_0xbf10('0x34'),_0x262a2b['uniqueid']),_0x262a2b);queues['musiconholdstop'](_0x262a2b);calls[_0xbf10('0x33')](_0x262a2b);}catch(_0x77765e){utils[_0xbf10('0x1b')](util['format']('[%s][index][musiconholdstop]',_0x262a2b[_0xbf10('0x23')]),_0x77765e);}});ami['on'](_0xbf10('0x35'),function(_0x181c49){try{utils[_0xbf10('0x1f')](util[_0xbf10('0x20')]('[%s][index][newstate]',_0x181c49[_0xbf10('0x23')]),_0x181c49);calls[_0xbf10('0x35')](_0x181c49);recordings[_0xbf10('0x35')](_0x181c49);}catch(_0x308968){utils['error'](util[_0xbf10('0x20')](_0xbf10('0x36'),_0x181c49[_0xbf10('0x23')]),_0x308968);}});ami['on'](_0xbf10('0x37'),function(_0x429391){try{utils['debug'](util[_0xbf10('0x20')](_0xbf10('0x38'),_0x429391[_0xbf10('0x23')]),_0x429391);calls[_0xbf10('0x37')](_0x429391);recordings['hangup'](_0x429391);dials['hangup'](_0x429391);agents['hangup'](_0x429391);queues[_0xbf10('0x37')](_0x429391);}catch(_0x54d59d){utils['error'](util['format'](_0xbf10('0x38'),_0x429391['uniqueid']),_0x54d59d);}});ami['on'](_0xbf10('0x39'),function(_0x2527d2){try{utils[_0xbf10('0x1f')](util[_0xbf10('0x20')](_0xbf10('0x3a'),_0x2527d2[_0xbf10('0x23')]),_0x2527d2);members['cdr'](_0x2527d2);}catch(_0x2a9ff3){utils[_0xbf10('0x1b')](util[_0xbf10('0x20')](_0xbf10('0x3a'),_0x2527d2[_0xbf10('0x23')]),_0x2a9ff3);}});ami['on'](_0xbf10('0x3b'),function(_0x1170b7){try{utils[_0xbf10('0x1f')](util[_0xbf10('0x20')]('[%s][index][blindtransfer]',_0x1170b7[_0xbf10('0x23')]),_0x1170b7);queues[_0xbf10('0x3b')](_0x1170b7);agents[_0xbf10('0x3b')](_0x1170b7);transfers[_0xbf10('0x3b')](_0x1170b7);}catch(_0x666f6b){utils[_0xbf10('0x1b')](util[_0xbf10('0x20')](_0xbf10('0x3c'),_0x1170b7[_0xbf10('0x23')]),_0x666f6b);}});ami['on']('attendedtransfer',function(_0x18035a){try{utils['debug'](util['format']('[%s][index][attendedtransfer]',_0x18035a[_0xbf10('0x3d')]),_0x18035a);queues[_0xbf10('0x3e')](_0x18035a);transfers['attendedtransfer'](_0x18035a);agents['attendedtransfer'](_0x18035a);calls[_0xbf10('0x3e')](_0x18035a);}catch(_0x457630){utils[_0xbf10('0x1b')](util[_0xbf10('0x20')](_0xbf10('0x3f'),_0x18035a['origtransfereruniqueid']),_0x457630);}});ami['on'](_0xbf10('0x40'),function(_0x13b9db){try{utils[_0xbf10('0x1f')](util[_0xbf10('0x20')](_0xbf10('0x41'),_0x13b9db[_0xbf10('0x23')]),_0x13b9db);queues[_0xbf10('0x40')](_0x13b9db);recordings['varset'](_0x13b9db);calls[_0xbf10('0x40')](_0x13b9db);dials[_0xbf10('0x40')](_0x13b9db);}catch(_0x592252){utils[_0xbf10('0x1b')](util[_0xbf10('0x20')](_0xbf10('0x41'),_0x13b9db['uniqueid']),_0x592252);}});ami['on'](_0xbf10('0x42'),function(_0x348a91){try{utils[_0xbf10('0x1f')](util[_0xbf10('0x20')]('[%s][index][newexten]',_0x348a91[_0xbf10('0x23')]),_0x348a91);calls[_0xbf10('0x42')](_0x348a91);recordings[_0xbf10('0x42')](_0x348a91);dials['newexten'](_0x348a91);}catch(_0x1af7dd){utils[_0xbf10('0x1b')](util[_0xbf10('0x20')](_0xbf10('0x43'),_0x348a91[_0xbf10('0x23')]),_0x1af7dd);}});ami['on'](_0xbf10('0x44'),function(_0x221ca1){try{utils[_0xbf10('0x1f')](util['format'](_0xbf10('0x45'),_0x221ca1[_0xbf10('0x23')]),_0x221ca1);calls[_0xbf10('0x44')](_0x221ca1);recordings[_0xbf10('0x44')](_0x221ca1);}catch(_0x30506f){utils[_0xbf10('0x1b')](util[_0xbf10('0x20')](_0xbf10('0x45'),_0x221ca1['uniqueid']),_0x30506f);}});ami['on'](_0xbf10('0x46'),function(_0x1df017){try{utils[_0xbf10('0x1f')](util[_0xbf10('0x20')](_0xbf10('0x47'),_0x1df017['uniqueid']),_0x1df017);dials[_0xbf10('0x46')](_0x1df017);}catch(_0x555557){utils['error'](util[_0xbf10('0x20')](_0xbf10('0x48'),_0x1df017[_0xbf10('0x23')]),_0x555557);}});ami['on'](_0xbf10('0x49'),function(_0x4e7291){try{utils[_0xbf10('0x1f')](util['format'](_0xbf10('0x4a'),_0x4e7291[_0xbf10('0x23')]),_0x4e7291);dials[_0xbf10('0x49')](_0x4e7291);}catch(_0x23d982){utils[_0xbf10('0x1b')](util[_0xbf10('0x20')]('[%s][index][dialend]',_0x4e7291[_0xbf10('0x23')]),_0x23d982);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 4dc34bf..053605f 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 _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 +var _0x47d6=['[%s][members][cdr]','lodash','util','./utils','info','format','uniqueid','interface','channel','membername','type','getUserByInterface','then','name','internal','request','getUserByName','split','CreateMemberReport','catch','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','TALKING','agent','NOT_INUSE','isNil','exitAt','now','duration','diffTime','enterAt','error','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','data1','data2','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x47d6,0x1de));var _0x647d=function(_0x117715,_0x2035dd){_0x117715=_0x117715-0x0;var _0x1a89a5=_0x47d6[_0x117715];return _0x1a89a5;};'use strict';var _=require(_0x647d('0x0'));var util=require(_0x647d('0x1'));var utils=require(_0x647d('0x2'));var members={};var exclude=['Local/_attended@transfer','Queue:'];function writeDB(_0x3cd782){utils[_0x647d('0x3')](util[_0x647d('0x4')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x3cd782[_0x647d('0x5')],_0x3cd782[_0x647d('0x6')],_0x3cd782[_0x647d('0x7')],_0x3cd782['data2'],_0x3cd782[_0x647d('0x8')],_0x3cd782[_0x647d('0x9')]));if(_0x3cd782[_0x647d('0x6')]){utils[_0x647d('0xa')](_0x3cd782[_0x647d('0x6')])[_0x647d('0xb')](function(_0x96b6e2){if(_0x96b6e2){_0x3cd782[_0x647d('0x8')]=_0x96b6e2[_0x647d('0xc')];_0x3cd782[_0x647d('0xd')]=_0x96b6e2[_0x647d('0xd')];utils[_0x647d('0xe')]('CreateMemberReport',_0x3cd782);}else{utils[_0x647d('0xf')](_0x3cd782[_0x647d('0x6')][_0x647d('0x10')]('/')[0x1])[_0x647d('0xb')](function(_0x2db882){if(_0x2db882){_0x3cd782[_0x647d('0x8')]=_0x2db882[_0x647d('0xc')];_0x3cd782[_0x647d('0xd')]=_0x2db882[_0x647d('0xd')];utils[_0x647d('0xe')](_0x647d('0x11'),_0x3cd782);}});}})[_0x647d('0x12')](function(_0x2c1e9e){utils['error'](util[_0x647d('0x4')](_0x647d('0x13'),_0x3cd782[_0x647d('0x5')]),_0x2c1e9e);});}delete members[_0x3cd782['interface']];}function startsWith(_0x25fa4a,_0x4c175c){return _[_0x647d('0x14')](_0x25fa4a,function(_0x5740ff){return _[_0x647d('0x15')](_0x4c175c,_0x5740ff);});}exports[_0x647d('0x16')]=function(_0x598186){try{utils[_0x647d('0x17')](util['format'](_0x647d('0x18'),members[_0x598186[_0x647d('0x19')]]?members[_0x598186[_0x647d('0x19')]][_0x647d('0x5')]:_0x598186[_0x647d('0x19')]),_0x598186);utils[_0x647d('0x3')](util[_0x647d('0x4')](_0x647d('0x1a'),members[_0x598186[_0x647d('0x19')]]?members[_0x598186[_0x647d('0x19')]][_0x647d('0x5')]:_0x598186[_0x647d('0x19')],_0x598186[_0x647d('0x1b')],_0x598186[_0x647d('0x19')]));switch(_0x598186[_0x647d('0x1b')]){case _0x647d('0x1c'):case _0x647d('0x1d'):if(!startsWith(exclude,_0x598186[_0x647d('0x19')])){members[_0x598186[_0x647d('0x19')]]={'channel':'voice','interface':_0x598186[_0x647d('0x19')],'type':_0x647d('0x1e'),'enterAt':utils['now'](),'role':_0x647d('0x1f')};}break;case _0x647d('0x20'):if(!_[_0x647d('0x21')](members[_0x598186[_0x647d('0x19')]])){members[_0x598186['device']][_0x647d('0x22')]=utils[_0x647d('0x23')]();members[_0x598186[_0x647d('0x19')]][_0x647d('0x24')]=utils[_0x647d('0x25')](members[_0x598186['device']][_0x647d('0x22')],members[_0x598186[_0x647d('0x19')]][_0x647d('0x26')]);if(members[_0x598186[_0x647d('0x19')]][_0x647d('0x5')]){writeDB(members[_0x598186[_0x647d('0x19')]]);}}break;default:break;}}catch(_0xb67921){utils[_0x647d('0x27')](util['format']('[%s][members][devicestatechange]',members[_0x598186[_0x647d('0x19')]]?members[_0x598186[_0x647d('0x19')]][_0x647d('0x5')]:_0x598186[_0x647d('0x19')]),_0xb67921);}};exports[_0x647d('0x28')]=function(_0x17500f){try{if(!_[_0x647d('0x21')](members[_0x17500f[_0x647d('0x6')]])){utils[_0x647d('0x17')](util[_0x647d('0x4')](_0x647d('0x29'),_0x17500f[_0x647d('0x5')]),_0x17500f);utils[_0x647d('0x3')](util[_0x647d('0x4')](_0x647d('0x2a'),_0x17500f[_0x647d('0x5')],_0x17500f['interface'],_0x17500f[_0x647d('0x2b')]));members[_0x17500f[_0x647d('0x6')]]=_[_0x647d('0x2c')](members[_0x17500f[_0x647d('0x6')]],{'data4':_0x17500f[_0x647d('0x2b')],'uniqueid':_0x17500f[_0x647d('0x5')]});}}catch(_0x32cd97){utils[_0x647d('0x27')](util['format'](_0x647d('0x29'),_0x17500f[_0x647d('0x5')]),_0x32cd97);}};exports[_0x647d('0x2d')]=function(_0x5ea4fe){try{utils[_0x647d('0x17')](util[_0x647d('0x4')]('[%s][members][cdr]',_0x5ea4fe[_0x647d('0x5')]),_0x5ea4fe);if(_0x5ea4fe[_0x647d('0x7')]){var _0x12d45e=_0x5ea4fe[_0x647d('0x7')][_0x647d('0x10')]('-')[0x0];if(!_[_0x647d('0x21')](members[_0x12d45e])){members[_0x12d45e]=_[_0x647d('0x2c')](members[_0x12d45e],{'data1':members[_0x12d45e][_0x647d('0x2e')]||_0x5ea4fe[_0x647d('0x9')],'data2':members[_0x12d45e][_0x647d('0x2f')]||_0x5ea4fe[_0x647d('0x30')],'data3':members[_0x12d45e][_0x647d('0x31')]||_0x5ea4fe[_0x647d('0x32')],'uniqueid':members[_0x12d45e]['uniqueid']||_0x5ea4fe[_0x647d('0x5')]});utils['info'](util[_0x647d('0x4')](_0x647d('0x33'),_0x5ea4fe[_0x647d('0x5')],members[_0x12d45e]['data1'],members[_0x12d45e][_0x647d('0x2f')],members[_0x12d45e][_0x647d('0x31')]));if(members[_0x12d45e][_0x647d('0x22')]){writeDB(members[_0x12d45e]);}}}if(_0x5ea4fe['destinationchannel']){var _0x22c2a3=_0x5ea4fe['destinationchannel'][_0x647d('0x10')]('-')[0x0];if(!_['isNil'](members[_0x22c2a3])){members[_0x22c2a3]=_[_0x647d('0x2c')](members[_0x22c2a3],{'data1':members[_0x22c2a3][_0x647d('0x2e')]||_0x5ea4fe[_0x647d('0x9')],'data2':members[_0x22c2a3][_0x647d('0x2f')]||_0x5ea4fe[_0x647d('0x30')],'data3':members[_0x22c2a3][_0x647d('0x31')]||_0x5ea4fe[_0x647d('0x32')],'uniqueid':members[_0x22c2a3]['uniqueid']||_0x5ea4fe['uniqueid']});utils[_0x647d('0x3')](util[_0x647d('0x4')](_0x647d('0x33'),_0x5ea4fe['uniqueid'],members[_0x22c2a3][_0x647d('0x2e')],members[_0x22c2a3][_0x647d('0x2f')],members[_0x22c2a3][_0x647d('0x31')]));if(members[_0x22c2a3][_0x647d('0x22')]){writeDB(members[_0x22c2a3]);}}}}catch(_0x26f209){utils[_0x647d('0x27')](util[_0x647d('0x4')](_0x647d('0x34'),_0x5ea4fe[_0x647d('0x5')]),_0x26f209);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 67f55f5..fdf3ef8 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 _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 +var _0x8f1f=['transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','calleridnum','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','secondtransfereruniqueid','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','musiconholdstop','diffTime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','util','info','format','uniqueid','queue','lastAssignedTo','accountcode','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','error','hangup','debug','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallerexitreason','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','[%s][queues][hangup]','[%s][queues][varset]','isNil','variable','queuestatus','value','toUpperCase','CONTINUE','now','queueposition','queuecallerabandonAt','queuecallerexitAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','queuecallerjoinAt','count','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','agentcomplete','[%s][queues][agentcomplete]','queuecallercomplete','queuecallercompleteAt','reason','transfer','TRANSFER','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','secondtransfererlinkedid','ATTENDED','ATTENDEDTRANSFER','origtransfererlinkedid','transfereelinkedid','clone'];(function(_0x4c2bea,_0x3930ee){var _0x5466a9=function(_0x20586e){while(--_0x20586e){_0x4c2bea['push'](_0x4c2bea['shift']());}};_0x5466a9(++_0x3930ee);}(_0x8f1f,0x1aa));var _0xf8f1=function(_0x57f694,_0x2915b0){_0x57f694=_0x57f694-0x0;var _0x2262d0=_0x8f1f[_0x57f694];return _0x2262d0;};'use strict';var _=require('lodash');var util=require(_0xf8f1('0x0'));var utils=require('./utils');var queues={};function writeDB(_0x254062){utils[_0xf8f1('0x1')](util[_0xf8f1('0x2')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x254062[_0xf8f1('0x3')],_0x254062['channel'],_0x254062[_0xf8f1('0x4')],_0x254062[_0xf8f1('0x5')],_0x254062['calleridnum'],_0x254062[_0xf8f1('0x6')],_0x254062['queuecallerexitreason']));if(_0x254062[_0xf8f1('0x4')]){utils[_0xf8f1('0x7')](_0x254062[_0xf8f1('0x4')])[_0xf8f1('0x8')](function(_0x3cd2d3){if(_0x3cd2d3){_0x254062[_0xf8f1('0x9')]=_0x3cd2d3[_0xf8f1('0x9')];}utils[_0xf8f1('0xa')](_0xf8f1('0xb'),_0x254062);});}else{utils[_0xf8f1('0xa')](_0xf8f1('0xb'),_0x254062);}if(_0x254062[_0xf8f1('0xc')]){delete queues[_0x254062[_0xf8f1('0xc')]];}else{delete queues[_0x254062[_0xf8f1('0x3')]];}}exports[_0xf8f1('0xd')]=function(_0x1b0693){try{utils['debug'](util[_0xf8f1('0x2')](_0xf8f1('0xe'),_0x1b0693[_0xf8f1('0x3')]),_0x1b0693);utils[_0xf8f1('0x1')](util[_0xf8f1('0x2')](_0xf8f1('0xf'),_0x1b0693[_0xf8f1('0x3')],_0x1b0693[_0xf8f1('0x4')],_0x1b0693[_0xf8f1('0x10')]));queues[_0x1b0693[_0xf8f1('0x3')]]=_[_0xf8f1('0x11')](_0x1b0693,{'originalposition':_0x1b0693[_0xf8f1('0x10')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x40e445){utils[_0xf8f1('0x12')](util['format'](_0xf8f1('0xe'),_0x1b0693['uniqueid']),_0x40e445);}};exports[_0xf8f1('0x13')]=function(_0x11436e){try{if(!_['isNil'](queues[_0x11436e['uniqueid']])){utils[_0xf8f1('0x14')](util['format']('[%s][queues][hangup]',_0x11436e[_0xf8f1('0x3')]),_0x11436e);if(queues[_0x11436e['uniqueid']][_0xf8f1('0x15')]){if(!queues[_0x11436e[_0xf8f1('0x3')]][_0xf8f1('0x16')]&&!queues[_0x11436e[_0xf8f1('0x3')]][_0xf8f1('0x17')]){queues[_0x11436e[_0xf8f1('0x3')]]['queuecallercomplete']=!![];queues[_0x11436e[_0xf8f1('0x3')]]['queuecallercompleteAt']=utils['now']();queues[_0x11436e[_0xf8f1('0x3')]][_0xf8f1('0x18')]=_0xf8f1('0x19');}utils[_0xf8f1('0x1')](util[_0xf8f1('0x2')](_0xf8f1('0x1a'),_0x11436e[_0xf8f1('0x3')],queues[_0x11436e[_0xf8f1('0x3')]][_0xf8f1('0x1b')],queues[_0x11436e['uniqueid']][_0xf8f1('0x18')]));writeDB(queues[_0x11436e[_0xf8f1('0x3')]]);}else if(queues[_0x11436e[_0xf8f1('0x3')]][_0xf8f1('0xc')]){utils[_0xf8f1('0x1')](util[_0xf8f1('0x2')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x11436e[_0xf8f1('0x3')],queues[_0x11436e[_0xf8f1('0x3')]]['name'],queues[_0x11436e['uniqueid']][_0xf8f1('0xc')]));queues[queues[_0x11436e['uniqueid']]['transfereduniqueid']]=queues[_0x11436e[_0xf8f1('0x3')]];queues[queues[_0x11436e[_0xf8f1('0x3')]][_0xf8f1('0xc')]][_0xf8f1('0x1c')]=0x2;delete queues[_0x11436e[_0xf8f1('0x3')]];}}}catch(_0x55268c){utils[_0xf8f1('0x12')](util['format'](_0xf8f1('0x1d'),_0x11436e[_0xf8f1('0x3')]),_0x55268c);}};exports['varset']=function(_0x322735){try{utils[_0xf8f1('0x14')](util['format'](_0xf8f1('0x1e'),_0x322735[_0xf8f1('0x3')]),_0x322735);if(!_[_0xf8f1('0x1f')](_0x322735[_0xf8f1('0x20')][_0xf8f1('0x21')])&&_0x322735[_0xf8f1('0x22')][_0xf8f1('0x23')]()!==_0xf8f1('0x24')){if(!_['isNil'](queues[_0x322735['uniqueid']])){queues[_0x322735[_0xf8f1('0x3')]][_0xf8f1('0x16')]=![];queues[_0x322735[_0xf8f1('0x3')]]['queuecallerabandonAt']=null;queues[_0x322735[_0xf8f1('0x3')]][_0xf8f1('0x17')]=!![];queues[_0x322735[_0xf8f1('0x3')]]['queuecallerexitAt']=utils[_0xf8f1('0x25')]();queues[_0x322735[_0xf8f1('0x3')]][_0xf8f1('0x18')]=_0x322735['value'][_0xf8f1('0x23')]();utils[_0xf8f1('0x1')](util[_0xf8f1('0x2')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x322735[_0xf8f1('0x3')],queues[_0x322735['uniqueid']][_0xf8f1('0x1b')],_0x322735[_0xf8f1('0x22')],queues[_0x322735[_0xf8f1('0x3')]][_0xf8f1('0x18')]));writeDB(queues[_0x322735[_0xf8f1('0x3')]]);}}else if(!_[_0xf8f1('0x1f')](_0x322735['variable'][_0xf8f1('0x26')])){if(!_[_0xf8f1('0x1f')](queues[_0x322735[_0xf8f1('0x3')]])&&!queues[_0x322735[_0xf8f1('0x3')]]['queuecallerabandon']){queues[_0x322735[_0xf8f1('0x3')]]['queuecallerabandon']=![];queues[_0x322735[_0xf8f1('0x3')]][_0xf8f1('0x27')]=null;queues[_0x322735[_0xf8f1('0x3')]][_0xf8f1('0x17')]=!![];queues[_0x322735[_0xf8f1('0x3')]][_0xf8f1('0x28')]=utils[_0xf8f1('0x25')]();queues[_0x322735[_0xf8f1('0x3')]][_0xf8f1('0x18')]=_0xf8f1('0x29');utils[_0xf8f1('0x1')](util[_0xf8f1('0x2')](_0xf8f1('0x2a'),_0x322735['uniqueid'],queues[_0x322735[_0xf8f1('0x3')]][_0xf8f1('0x1b')],_0x322735['value'],queues[_0x322735[_0xf8f1('0x3')]]['queuecallerexitreason']));}}}catch(_0x4eb7bc){utils[_0xf8f1('0x12')](util[_0xf8f1('0x2')](_0xf8f1('0x1e'),_0x322735[_0xf8f1('0x3')]),_0x4eb7bc);}};exports[_0xf8f1('0x16')]=function(_0x159f6d){try{if(!_[_0xf8f1('0x1f')](queues[_0x159f6d[_0xf8f1('0x3')]])){utils[_0xf8f1('0x14')](util[_0xf8f1('0x2')](_0xf8f1('0x2b'),_0x159f6d[_0xf8f1('0x3')]),_0x159f6d);queues[_0x159f6d['uniqueid']][_0xf8f1('0x17')]=![];queues[_0x159f6d['uniqueid']][_0xf8f1('0x28')]=null;queues[_0x159f6d[_0xf8f1('0x3')]][_0xf8f1('0x16')]=!![];queues[_0x159f6d[_0xf8f1('0x3')]][_0xf8f1('0x27')]=utils[_0xf8f1('0x25')]();queues[_0x159f6d[_0xf8f1('0x3')]]['queuecallerexitreason']='ABANDONED';utils[_0xf8f1('0x1')](util[_0xf8f1('0x2')](_0xf8f1('0x2c'),_0x159f6d[_0xf8f1('0x3')],queues[_0x159f6d['uniqueid']][_0xf8f1('0x1b')],queues[_0x159f6d[_0xf8f1('0x3')]][_0xf8f1('0x18')]));}}catch(_0x13c47e){utils['error'](util[_0xf8f1('0x2')](_0xf8f1('0x2b'),_0x159f6d[_0xf8f1('0x3')]),_0x13c47e);}};exports[_0xf8f1('0x2d')]=function(_0xd74e88){try{if(!_[_0xf8f1('0x1f')](queues[_0xd74e88[_0xf8f1('0x3')]])){utils[_0xf8f1('0x14')](util[_0xf8f1('0x2')](_0xf8f1('0x2e'),_0xd74e88['uniqueid']),_0xd74e88);utils[_0xf8f1('0x1')](util['format'](_0xf8f1('0x2f'),_0xd74e88['uniqueid'],queues[_0xd74e88[_0xf8f1('0x3')]][_0xf8f1('0x1b')],_0xd74e88[_0xf8f1('0x30')],_0xd74e88[_0xf8f1('0x31')]));queues[_0xd74e88[_0xf8f1('0x3')]][_0xf8f1('0x2d')]=!![];queues[_0xd74e88['uniqueid']][_0xf8f1('0x15')]=utils[_0xf8f1('0x25')]();queues[_0xd74e88['uniqueid']][_0xf8f1('0x32')]=utils['diffTime'](queues[_0xd74e88['uniqueid']][_0xf8f1('0x15')],queues[_0xd74e88['uniqueid']][_0xf8f1('0x33')]);queues[_0xd74e88[_0xf8f1('0x3')]][_0xf8f1('0x10')]=_0xd74e88[_0xf8f1('0x10')];queues[_0xd74e88[_0xf8f1('0x3')]][_0xf8f1('0x34')]=_0xd74e88['count'];queues[_0xd74e88[_0xf8f1('0x3')]]['connectedlinenum']=_0xd74e88[_0xf8f1('0x30')];queues[_0xd74e88[_0xf8f1('0x3')]][_0xf8f1('0x31')]=_0xd74e88[_0xf8f1('0x31')];}}catch(_0x299ab8){utils[_0xf8f1('0x12')](util[_0xf8f1('0x2')](_0xf8f1('0x2e'),_0xd74e88['uniqueid']),_0x299ab8);}};exports['agentconnect']=function(_0x4a782a){try{if(!_['isNil'](queues[_0x4a782a[_0xf8f1('0x3')]])){utils[_0xf8f1('0x14')](util[_0xf8f1('0x2')](_0xf8f1('0x35'),_0x4a782a[_0xf8f1('0x3')]),_0x4a782a);utils[_0xf8f1('0x1')](util[_0xf8f1('0x2')](_0xf8f1('0x36'),_0x4a782a[_0xf8f1('0x3')],queues[_0x4a782a[_0xf8f1('0x3')]][_0xf8f1('0x1b')],_0x4a782a[_0xf8f1('0x37')],_0x4a782a[_0xf8f1('0x38')]));queues[_0x4a782a[_0xf8f1('0x3')]][_0xf8f1('0x16')]=![];queues[_0x4a782a[_0xf8f1('0x3')]][_0xf8f1('0x16')]=![];queues[_0x4a782a[_0xf8f1('0x3')]][_0xf8f1('0x27')]=null;queues[_0x4a782a[_0xf8f1('0x3')]][_0xf8f1('0x17')]=![];queues[_0x4a782a['uniqueid']][_0xf8f1('0x18')]=null;queues[_0x4a782a[_0xf8f1('0x3')]][_0xf8f1('0x28')]=null;queues[_0x4a782a[_0xf8f1('0x3')]][_0xf8f1('0x39')]=!![];queues[_0x4a782a[_0xf8f1('0x3')]]['accountcode']=_0x4a782a[_0xf8f1('0x38')];queues[_0x4a782a['uniqueid']][_0xf8f1('0x5')]=_0x4a782a['membername'];}}catch(_0xbb8761){utils['error'](util[_0xf8f1('0x2')](_0xf8f1('0x35'),_0x4a782a[_0xf8f1('0x3')]),_0xbb8761);}};exports[_0xf8f1('0x3a')]=function(_0x45cd59){try{if(!_[_0xf8f1('0x1f')](queues[_0x45cd59['uniqueid']])){if(queues[_0x45cd59[_0xf8f1('0x3')]]['queuecallerleaveAt']){utils[_0xf8f1('0x14')](util[_0xf8f1('0x2')](_0xf8f1('0x3b'),_0x45cd59[_0xf8f1('0x3')]),_0x45cd59);queues[_0x45cd59['uniqueid']]['queuecallerabandon']=![];queues[_0x45cd59[_0xf8f1('0x3')]][_0xf8f1('0x16')]=![];queues[_0x45cd59[_0xf8f1('0x3')]][_0xf8f1('0x27')]=null;queues[_0x45cd59[_0xf8f1('0x3')]][_0xf8f1('0x17')]=![];queues[_0x45cd59[_0xf8f1('0x3')]]['queuecallerexitAt']=null;queues[_0x45cd59[_0xf8f1('0x3')]][_0xf8f1('0x39')]=!![];queues[_0x45cd59['uniqueid']][_0xf8f1('0x5')]=_0x45cd59['membername'];queues[_0x45cd59['uniqueid']][_0xf8f1('0x3c')]=!![];queues[_0x45cd59[_0xf8f1('0x3')]][_0xf8f1('0x3d')]=utils['now']();if(_0x45cd59[_0xf8f1('0x3e')]==_0xf8f1('0x3f')){if(!queues[_0x45cd59['uniqueid']][_0xf8f1('0x3f')]){queues[_0x45cd59[_0xf8f1('0x3')]]['queuecallerexitreason']=_0xf8f1('0x40');}}else{queues[_0x45cd59['uniqueid']][_0xf8f1('0x18')]='COMPLETEDBY'+_0x45cd59['reason'][_0xf8f1('0x23')]();}utils[_0xf8f1('0x1')](util['format']('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x45cd59[_0xf8f1('0x3')],queues[_0x45cd59[_0xf8f1('0x3')]][_0xf8f1('0x1b')],_0x45cd59['membername'],queues[_0x45cd59[_0xf8f1('0x3')]][_0xf8f1('0x18')]));writeDB(queues[_0x45cd59[_0xf8f1('0x3')]]);}}}catch(_0x180236){utils[_0xf8f1('0x12')](util['format'](_0xf8f1('0x3b'),_0x45cd59[_0xf8f1('0x3')]),_0x180236);}};exports[_0xf8f1('0x41')]=function(_0x314339){try{if(!_[_0xf8f1('0x1f')](queues[_0x314339[_0xf8f1('0x42')]])){utils['debug'](util[_0xf8f1('0x2')](_0xf8f1('0x43'),_0x314339[_0xf8f1('0x3')]),_0x314339);queues[_0x314339[_0xf8f1('0x42')]][_0xf8f1('0x3f')]=!![];queues[_0x314339[_0xf8f1('0x42')]][_0xf8f1('0x44')]=_0xf8f1('0x45');queues[_0x314339[_0xf8f1('0x42')]][_0xf8f1('0x46')]=_0x314339[_0xf8f1('0x47')];queues[_0x314339[_0xf8f1('0x42')]][_0xf8f1('0x48')]=_0x314339[_0xf8f1('0x42')];queues[_0x314339[_0xf8f1('0x42')]][_0xf8f1('0x18')]=_0xf8f1('0x49');utils[_0xf8f1('0x1')](util[_0xf8f1('0x2')](_0xf8f1('0x4a'),_0x314339[_0xf8f1('0x3')],queues[_0x314339[_0xf8f1('0x42')]][_0xf8f1('0x1b')],_0x314339[_0xf8f1('0x42')],_0x314339[_0xf8f1('0x47')]));}}catch(_0x3a7581){utils[_0xf8f1('0x12')](util['format'](_0xf8f1('0x43'),_0x314339[_0xf8f1('0x3')]),_0x3a7581);}};exports[_0xf8f1('0x4b')]=function(_0x24645f){try{utils[_0xf8f1('0x14')](util['format'](_0xf8f1('0x4c'),_0x24645f[_0xf8f1('0x4d')]),_0x24645f);if(_0x24645f[_0xf8f1('0x4d')]==_0x24645f['origtransfererlinkedid']){if(!_[_0xf8f1('0x1f')](queues[_0x24645f[_0xf8f1('0x4e')]])){utils[_0xf8f1('0x1')](util[_0xf8f1('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x24645f[_0xf8f1('0x4d')],queues[_0x24645f[_0xf8f1('0x4e')]][_0xf8f1('0x1b')],_0x24645f['origtransfererexten']));queues[_0x24645f[_0xf8f1('0x4e')]][_0xf8f1('0x3f')]=!![];queues[_0x24645f[_0xf8f1('0x4e')]][_0xf8f1('0x44')]=_0xf8f1('0x4f');queues[_0x24645f['secondtransfererlinkedid']][_0xf8f1('0x46')]=_0x24645f['origtransfererexten'];queues[_0x24645f['secondtransfererlinkedid']][_0xf8f1('0x48')]=_0x24645f[_0xf8f1('0x4d')];queues[_0x24645f[_0xf8f1('0x4e')]][_0xf8f1('0x18')]=_0xf8f1('0x50');}if(!_[_0xf8f1('0x1f')](queues[_0x24645f[_0xf8f1('0x51')]])){if(_0x24645f['transfereelinkedid']&&queues[_0x24645f[_0xf8f1('0x52')]]){queues[_0x24645f[_0xf8f1('0x52')]]['queuecallerenterreason']=0x1;queues[_0x24645f[_0xf8f1('0x42')]]=_[_0xf8f1('0x53')](queues[_0x24645f[_0xf8f1('0x52')]]);queues[_0x24645f['transfereeuniqueid']][_0xf8f1('0xc')]=_0x24645f[_0xf8f1('0x54')];queues[_0x24645f[_0xf8f1('0x42')]]['queuecallerenterreason']=0x2;queues[_0x24645f[_0xf8f1('0x42')]]['calleridnum']=queues[_0x24645f[_0xf8f1('0x4e')]]['calleridnum'];queues[_0x24645f['transfereeuniqueid']][_0xf8f1('0x55')]=queues[_0x24645f['secondtransfererlinkedid']][_0xf8f1('0x55')];queues[_0x24645f[_0xf8f1('0x42')]][_0xf8f1('0x33')]=utils[_0xf8f1('0x25')]();queues[_0x24645f[_0xf8f1('0x42')]]['queuecallerleaveAt']=utils['now']();queues[_0x24645f[_0xf8f1('0x42')]]['holdtime']=0x0;queues[_0x24645f[_0xf8f1('0x42')]][_0xf8f1('0x56')]=0x0;utils[_0xf8f1('0x1')](util[_0xf8f1('0x2')](_0xf8f1('0x57'),_0x24645f[_0xf8f1('0x4d')],queues[_0x24645f['transfereeuniqueid']][_0xf8f1('0x1b')],queues[_0x24645f[_0xf8f1('0x42')]][_0xf8f1('0x58')],queues[_0x24645f['transfereeuniqueid']][_0xf8f1('0x55')]));}else{utils[_0xf8f1('0x1')](util[_0xf8f1('0x2')](_0xf8f1('0x59'),_0x24645f[_0xf8f1('0x4d')],queues[_0x24645f[_0xf8f1('0x51')]]['name'],_0x24645f['secondtransfererlinkedid']));queues[_0x24645f['origtransfererlinkedid']]['transfereduniqueid']=_0x24645f[_0xf8f1('0x4e')];}}}else if(_0x24645f['secondtransfereruniqueid']==_0x24645f[_0xf8f1('0x4e')]){if(!_[_0xf8f1('0x1f')](queues[_0x24645f[_0xf8f1('0x51')]])){utils[_0xf8f1('0x1')](util['format'](_0xf8f1('0x5a'),_0x24645f[_0xf8f1('0x4d')],queues[_0x24645f[_0xf8f1('0x51')]]['name'],_0x24645f['secondtransfereruniqueid'],_0x24645f['secondtransfererexten']));queues[_0x24645f[_0xf8f1('0x51')]]['transfer']=!![];queues[_0x24645f[_0xf8f1('0x51')]][_0xf8f1('0x44')]='ATTENDED';queues[_0x24645f[_0xf8f1('0x51')]][_0xf8f1('0x46')]=_0x24645f[_0xf8f1('0x5b')];queues[_0x24645f[_0xf8f1('0x51')]][_0xf8f1('0x48')]=_0x24645f[_0xf8f1('0x5c')];queues[_0x24645f[_0xf8f1('0x51')]][_0xf8f1('0x18')]=_0xf8f1('0x50');}if(!_[_0xf8f1('0x1f')](queues[_0x24645f['secondtransfererlinkedid']])){if(_0x24645f[_0xf8f1('0x5d')]&&queues[_0x24645f[_0xf8f1('0x5d')]]){queues[_0x24645f[_0xf8f1('0x5d')]][_0xf8f1('0x1c')]=0x1;queues[_0x24645f[_0xf8f1('0x54')]]=_[_0xf8f1('0x53')](queues[_0x24645f[_0xf8f1('0x5d')]]);queues[_0x24645f[_0xf8f1('0x54')]][_0xf8f1('0xc')]=_0x24645f[_0xf8f1('0x54')];queues[_0x24645f[_0xf8f1('0x54')]][_0xf8f1('0x1c')]=0x2;queues[_0x24645f[_0xf8f1('0x54')]][_0xf8f1('0x58')]=queues[_0x24645f[_0xf8f1('0x51')]]['calleridnum'];queues[_0x24645f[_0xf8f1('0x54')]][_0xf8f1('0x55')]=queues[_0x24645f[_0xf8f1('0x51')]][_0xf8f1('0x55')];queues[_0x24645f['transfertargetuniqueid']]['queuecallerjoinAt']=utils[_0xf8f1('0x25')]();queues[_0x24645f['transfertargetuniqueid']][_0xf8f1('0x15')]=utils[_0xf8f1('0x25')]();queues[_0x24645f[_0xf8f1('0x54')]][_0xf8f1('0x32')]=0x0;queues[_0x24645f[_0xf8f1('0x54')]][_0xf8f1('0x56')]=0x0;utils[_0xf8f1('0x1')](util[_0xf8f1('0x2')](_0xf8f1('0x5e'),_0x24645f[_0xf8f1('0x4d')],queues[_0x24645f[_0xf8f1('0x54')]][_0xf8f1('0x1b')],queues[_0x24645f[_0xf8f1('0x54')]]['transfereduniqueid'],queues[_0x24645f[_0xf8f1('0x54')]][_0xf8f1('0x58')],queues[_0x24645f[_0xf8f1('0x54')]][_0xf8f1('0x55')]));}else{utils[_0xf8f1('0x1')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x24645f[_0xf8f1('0x4d')],queues[_0x24645f['secondtransfererlinkedid']]['name'],_0x24645f[_0xf8f1('0x51')]));queues[_0x24645f['secondtransfererlinkedid']][_0xf8f1('0xc')]=_0x24645f[_0xf8f1('0x51')];}}}}catch(_0xd4f69d){utils[_0xf8f1('0x12')](util['format'](_0xf8f1('0x4c'),_0x24645f[_0xf8f1('0x4d')]),_0xd4f69d);}};exports[_0xf8f1('0x5f')]=function(_0x47f76f){try{if(!_['isNil'](queues[_0x47f76f['uniqueid']])){utils[_0xf8f1('0x14')](util['format'](_0xf8f1('0x60'),_0x47f76f['uniqueid']),_0x47f76f);queues[_0x47f76f['uniqueid']][_0xf8f1('0x61')]=utils[_0xf8f1('0x25')]();utils[_0xf8f1('0x1')](util[_0xf8f1('0x2')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x47f76f[_0xf8f1('0x3')],queues[_0x47f76f[_0xf8f1('0x3')]][_0xf8f1('0x1b')],queues[_0x47f76f[_0xf8f1('0x3')]][_0xf8f1('0x61')]));}}catch(_0x1d49d3){utils['error'](util[_0xf8f1('0x2')](_0xf8f1('0x60'),_0x47f76f[_0xf8f1('0x3')]),_0x1d49d3);}};exports[_0xf8f1('0x62')]=function(_0x5e1818){try{if(!_[_0xf8f1('0x1f')](queues[_0x5e1818['uniqueid']])){if(!_['isNil'](queues[_0x5e1818[_0xf8f1('0x3')]][_0xf8f1('0x61')])){utils[_0xf8f1('0x14')](util[_0xf8f1('0x2')]('[%s][queues][musiconholdstop]',_0x5e1818['uniqueid']),_0x5e1818);queues[_0x5e1818[_0xf8f1('0x3')]][_0xf8f1('0x56')]+=utils[_0xf8f1('0x63')](utils[_0xf8f1('0x25')](),queues[_0x5e1818[_0xf8f1('0x3')]][_0xf8f1('0x61')]);utils[_0xf8f1('0x1')](util[_0xf8f1('0x2')](_0xf8f1('0x64'),_0x5e1818['uniqueid'],queues[_0x5e1818[_0xf8f1('0x3')]][_0xf8f1('0x1b')],queues[_0x5e1818[_0xf8f1('0x3')]][_0xf8f1('0x56')]));delete queues[_0x5e1818[_0xf8f1('0x3')]][_0xf8f1('0x61')];}}}catch(_0x7bccd5){utils[_0xf8f1('0x12')](util[_0xf8f1('0x2')](_0xf8f1('0x65'),_0x5e1818[_0xf8f1('0x3')]),_0x7bccd5);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 5f43126..0c7b824 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 _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 +var _0x6614=['lodash','util','./utils','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','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','.WAV','find','monitors','push','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','outbound','newexten','[%s][recordings][newexten]','application','appdata','set','startsWith','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','queue'];(function(_0x4338f8,_0x19ed5c){var _0x152e07=function(_0x2edc48){while(--_0x2edc48){_0x4338f8['push'](_0x4338f8['shift']());}};_0x152e07(++_0x19ed5c);}(_0x6614,0x1b2));var _0x4661=function(_0xf1d988,_0x341f87){_0xf1d988=_0xf1d988-0x0;var _0x264fa0=_0x6614[_0xf1d988];return _0x264fa0;};'use strict';var _=require(_0x4661('0x0'));var util=require(_0x4661('0x1'));var utils=require(_0x4661('0x2'));var recordings={};function writeDB(_0x2a9e82){utils[_0x4661('0x3')](util[_0x4661('0x4')](_0x4661('0x5'),_0x2a9e82[_0x4661('0x6')]));if(_0x2a9e82[_0x4661('0x7')]){utils['getUserByInternal'](_0x2a9e82[_0x4661('0x7')])[_0x4661('0x8')](function(_0x2af48c){if(_0x2af48c){_0x2a9e82[_0x4661('0x9')]=_0x2af48c[_0x4661('0xa')];_0x2a9e82[_0x4661('0xb')]=_0x2af48c['id'];}utils['request']('CreateVoiceRecording',_0x2a9e82);});}else{utils[_0x4661('0xc')](_0x4661('0xd'),_0x2a9e82);}}exports[_0x4661('0xe')]=function(_0xa57a8){try{utils[_0x4661('0xf')](util[_0x4661('0x4')](_0x4661('0x10'),_0xa57a8[_0x4661('0x6')]),_0xa57a8);if(_0xa57a8[_0x4661('0x6')]==_0xa57a8[_0x4661('0x11')]){utils['info'](util[_0x4661('0x4')](_0x4661('0x12'),_0xa57a8[_0x4661('0x6')],_0xa57a8[_0x4661('0x13')],_0xa57a8['exten']));recordings[_0xa57a8[_0x4661('0x6')]]={'uniqueid':_0xa57a8[_0x4661('0x6')],'accountcode':_0xa57a8[_0x4661('0x7')],'exten':_0xa57a8[_0x4661('0x14')],'context':_0xa57a8[_0x4661('0x13')],'channel':_0xa57a8[_0x4661('0x15')],'monitors':[]};}}catch(_0x2fd33b){utils['error'](util['format']('[%s][recordings][newchannel]',_0xa57a8[_0x4661('0x6')]),_0x2fd33b);}};exports[_0x4661('0x16')]=function(_0xd276fd){try{utils['debug'](util[_0x4661('0x4')](_0x4661('0x17'),_0xd276fd[_0x4661('0x6')]),_0xd276fd);if(!_[_0x4661('0x18')](recordings[_0xd276fd[_0x4661('0x6')]])&&_0xd276fd[_0x4661('0x19')]==0x6){utils[_0x4661('0x3')](util[_0x4661('0x4')](_0x4661('0x1a'),_0xd276fd[_0x4661('0x6')],_0xd276fd[_0x4661('0x13')],_0xd276fd[_0x4661('0x15')]));}else if(!_['isNil'](recordings[_0xd276fd[_0x4661('0x11')]])&&_0xd276fd[_0x4661('0x19')]==0x6&&_0xd276fd[_0x4661('0x13')]!=_0x4661('0x1b')){utils[_0x4661('0x3')](util[_0x4661('0x4')](_0x4661('0x1c'),_0xd276fd[_0x4661('0x6')],_0xd276fd[_0x4661('0x11')],_0xd276fd[_0x4661('0x13')],_0xd276fd[_0x4661('0x15')]));recordings[_0xd276fd[_0x4661('0x11')]][_0x4661('0x7')]=_0xd276fd[_0x4661('0x7')];}}catch(_0x2fcd4c){utils[_0x4661('0x1d')](util[_0x4661('0x4')]('[%s][recordings][newstate]',_0xd276fd[_0x4661('0x6')]),_0x2fcd4c);}};exports[_0x4661('0x1e')]=function(_0xa07a2c){try{if(!_[_0x4661('0x18')](_0xa07a2c[_0x4661('0x1f')])&&!_[_0x4661('0x18')](_0xa07a2c[_0x4661('0x1f')][_0x4661('0x20')])){utils[_0x4661('0xf')](util[_0x4661('0x4')](_0x4661('0x21'),_0xa07a2c[_0x4661('0x6')]),_0xa07a2c);utils[_0x4661('0x3')](util[_0x4661('0x4')](_0x4661('0x22'),_0xa07a2c[_0x4661('0x6')],_0xa07a2c[_0x4661('0x1f')],_0xa07a2c[_0x4661('0x23')]));if(_[_0x4661('0x24')](_0xa07a2c[_0x4661('0x23')],'.wav49')){_0xa07a2c['value']=_0xa07a2c['value'][_0x4661('0x25')]('.wav49',_0x4661('0x26'));}if(recordings[_0xa07a2c[_0x4661('0x11')]]){var _0x1986e0=_[_0x4661('0x27')](recordings[_0xa07a2c[_0x4661('0x11')]][_0x4661('0x28')],{'value':_0xa07a2c[_0x4661('0x23')]});if(_[_0x4661('0x18')](_0x1986e0)){recordings[_0xa07a2c['linkedid']]['monitors'][_0x4661('0x29')]({'value':_0xa07a2c[_0x4661('0x23')]});}}}}catch(_0x18a799){utils[_0x4661('0x1d')](util[_0x4661('0x4')]('[%s][recordings][varset]',_0xa07a2c[_0x4661('0x6')]),_0x18a799);}};exports['hangup']=function(_0xb50e04){try{if(!_['isNil'](recordings[_0xb50e04[_0x4661('0x6')]])){utils[_0x4661('0xf')](util['format'](_0x4661('0x2a'),_0xb50e04[_0x4661('0x6')]),_0xb50e04);utils[_0x4661('0x3')](util['format'](_0x4661('0x2b'),_0xb50e04[_0x4661('0x6')],_0xb50e04[_0x4661('0x2c')],_0xb50e04[_0x4661('0x2d')],_0xb50e04[_0x4661('0x2e')]));recordings[_0xb50e04[_0x4661('0x6')]][_0x4661('0x2c')]=_0xb50e04[_0x4661('0x2c')];recordings[_0xb50e04[_0x4661('0x6')]][_0x4661('0x2d')]=_0xb50e04[_0x4661('0x2d')];recordings[_0xb50e04['uniqueid']][_0x4661('0x2f')]=_0xb50e04[_0x4661('0x2f')];recordings[_0xb50e04[_0x4661('0x6')]]['connectedlinename']=_0xb50e04[_0x4661('0x30')];if(recordings[_0xb50e04['uniqueid']]['type']==_0x4661('0x31')&&recordings[_0xb50e04[_0x4661('0x6')]][_0x4661('0x7')]){recordings[_0xb50e04['uniqueid']][_0x4661('0x2f')]=recordings[_0xb50e04[_0x4661('0x6')]][_0x4661('0x7')];recordings[_0xb50e04['uniqueid']]['connectedlinename']='';}recordings[_0xb50e04[_0x4661('0x6')]][_0x4661('0x28')]['forEach'](function(_0x47cddc){var _0xc92579=_['clone'](recordings[_0xb50e04['uniqueid']]);_0xc92579['value']=_0x47cddc[_0x4661('0x23')];writeDB(_0xc92579);});delete recordings[_0xb50e04[_0x4661('0x6')]];}}catch(_0x958507){utils[_0x4661('0x1d')](util[_0x4661('0x4')]('[%s][recordings][hangup]',_0xb50e04[_0x4661('0x6')]),_0x958507);}};exports[_0x4661('0x32')]=function(_0x34a37a){try{if(!_[_0x4661('0x18')](recordings[_0x34a37a[_0x4661('0x6')]])){utils[_0x4661('0xf')](util['format'](_0x4661('0x33'),_0x34a37a['uniqueid']),_0x34a37a);utils[_0x4661('0x3')](util[_0x4661('0x4')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x34a37a[_0x4661('0x6')],_0x34a37a[_0x4661('0x34')],_0x34a37a[_0x4661('0x35')]));if(_0x34a37a['application']['toLowerCase']()==_0x4661('0x36')&&_[_0x4661('0x37')](_0x34a37a[_0x4661('0x35')]['toLowerCase'](),'cdr')){var _0x4e1033=_0x34a37a[_0x4661('0x35')][_0x4661('0x38')]('=');var _0x4eb97f=_0x4e1033[0x0][_0x4661('0x39')](_0x4e1033[0x0][_0x4661('0x3a')]('(')+0x1,_0x4e1033[0x0][_0x4661('0x3a')](')'));var _0x5868af=_0x4e1033[0x1];recordings[_0x34a37a[_0x4661('0x6')]][_0x4eb97f]=_0x5868af;}}}catch(_0x527f56){utils[_0x4661('0x1d')](util[_0x4661('0x4')]('[%s][recordings][newexten]',_0x34a37a['uniqueid']),_0x527f56);}};exports[_0x4661('0x3b')]=function(_0x45b93c){try{if(!_[_0x4661('0x18')](recordings[_0x45b93c[_0x4661('0x6')]])){utils[_0x4661('0xf')](util['format'](_0x4661('0x3c'),_0x45b93c['uniqueid']),_0x45b93c);utils[_0x4661('0x3')](util['format']('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x45b93c[_0x4661('0x6')],_0x45b93c[_0x4661('0x3d')]));recordings[_0x45b93c[_0x4661('0x6')]]['queue']=_0x45b93c[_0x4661('0x3d')];}}catch(_0x32d797){utils[_0x4661('0x1d')](util[_0x4661('0x4')]('[%s][recordings][queuecallerjoin]',_0x45b93c['uniqueid']),_0x32d797);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 8f51aa1..820e0ff 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 _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 +var _0x8440=['origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','debug','[%s][transfers][blindtransfer]','info','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridname','blind','error','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','transfereechannel','transfertargetconnectedlinename','transfertargetexten','transfertargetlinkedid','lodash','util','format','[%s][transfers][writeDB]\x20type:%s','type','attended'];(function(_0x1dd85e,_0x31a303){var _0x1c7213=function(_0x23184d){while(--_0x23184d){_0x1dd85e['push'](_0x1dd85e['shift']());}};_0x1c7213(++_0x31a303);}(_0x8440,0x122));var _0x0844=function(_0xf96c59,_0x4a1f47){_0xf96c59=_0xf96c59-0x0;var _0x7cf1c4=_0x8440[_0xf96c59];return _0x7cf1c4;};'use strict';var _=require(_0x0844('0x0'));var util=require(_0x0844('0x1'));var utils=require('./utils');function writeDB(_0x265985){utils['info'](util[_0x0844('0x2')](_0x0844('0x3'),_0x265985[_0x0844('0x4')]===_0x0844('0x5')?_0x265985[_0x0844('0x6')]:_0x265985[_0x0844('0x7')],_0x265985[_0x0844('0x4')]));utils[_0x0844('0x8')](_0x0844('0x9'),_0x265985);}exports['blindtransfer']=function(_0x1184fb){try{utils[_0x0844('0xa')](util[_0x0844('0x2')](_0x0844('0xb'),_0x1184fb[_0x0844('0x7')]),_0x1184fb);utils[_0x0844('0xc')](util[_0x0844('0x2')](_0x0844('0xd'),_0x1184fb['uniqueid'],_0x1184fb[_0x0844('0xe')],_0x1184fb[_0x0844('0xf')],_0x1184fb['transfereecalleridnum'],_0x1184fb[_0x0844('0x10')]));_0x1184fb['type']=_0x0844('0x11');writeDB(_0x1184fb);}catch(_0x314033){utils[_0x0844('0x12')](util[_0x0844('0x2')]('[%s][transfers][blindtransfer]',_0x1184fb[_0x0844('0x7')]),_0x314033);}};exports['attendedtransfer']=function(_0x149957){try{utils[_0x0844('0xa')](util[_0x0844('0x2')](_0x0844('0x13'),_0x149957[_0x0844('0x6')]),_0x149957);utils[_0x0844('0xc')](util[_0x0844('0x2')](_0x0844('0x14'),_0x149957['origtransfereruniqueid'],_0x149957[_0x0844('0x15')],_0x149957[_0x0844('0x16')],_0x149957[_0x0844('0x17')],_0x149957[_0x0844('0x18')]));_0x149957=_[_0x0844('0x19')](_0x149957,{'transfererchannel':_0x149957[_0x0844('0x1a')],'transferercalleridnum':_0x149957[_0x0844('0x15')],'transferercalleridname':_0x149957[_0x0844('0x16')],'transfererconnectedlinenum':_0x149957['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x149957['secondtransfererconnectedlinename'],'transfereraccountcode':_0x149957[_0x0844('0x1b')],'transferercontext':_0x149957[_0x0844('0x1c')],'transfererexten':_0x149957[_0x0844('0x1d')],'transfererlinkedid':_0x149957[_0x0844('0x1e')],'context':_0x149957[_0x0844('0x1f')],'extension':_0x149957[_0x0844('0x20')],'type':'attended'});if(_['isNil'](_0x149957[_0x0844('0x21')])){_0x149957=_['assign'](_0x149957,{'transfereechannel':_0x149957['transfertargetchannel'],'transfereecalleridnum':_0x149957[_0x0844('0x17')],'transfereecalleridname':_0x149957[_0x0844('0x18')],'transfereeconnectedlinenum':_0x149957['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x149957[_0x0844('0x22')],'transfereeaccountcode':_0x149957['transfertargetaccountcode'],'transfereecontext':_0x149957['transfertargetcontext'],'transfereeexten':_0x149957[_0x0844('0x23')],'transfereelinkedid':_0x149957[_0x0844('0x24')]});}writeDB(_0x149957);}catch(_0x1c6216){utils[_0x0844('0x12')](util[_0x0844('0x2')](_0x0844('0x13'),_0x149957['origtransfereruniqueid']),_0x1c6216);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 30cda15..0070c01 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 _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 +var _0x72c3=['sumTime','now','isAfter','isBefore','bluebird','jayson/promise','util','client','http','../../config/logger','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','internal','name','interface','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','format','YYYY-MM-DD\x20HH:mm:ss','subtract','seconds','diff'];(function(_0x309cbc,_0x543e8f){var _0x2ac832=function(_0xfe43bc){while(--_0xfe43bc){_0x309cbc['push'](_0x309cbc['shift']());}};_0x2ac832(++_0x543e8f);}(_0x72c3,0x108));var _0x372c=function(_0x4324de,_0x3538ae){_0x4324de=_0x4324de-0x0;var _0x5419cf=_0x72c3[_0x4324de];return _0x5419cf;};'use strict';var BPromise=require(_0x372c('0x0'));var jayson=require(_0x372c('0x1'));var moment=require('moment');var util=require(_0x372c('0x2'));var client=jayson[_0x372c('0x3')][_0x372c('0x4')]({'port':0x2329});var logger=require(_0x372c('0x5'))(_0x372c('0x6'));exports['info']=function(_0x1f4c05,_0x10c107){logger[_0x372c('0x7')](_0x1f4c05,_0x10c107?util[_0x372c('0x8')](_0x10c107,{'showHidden':![],'depth':null}):'');};exports[_0x372c('0x9')]=function(_0x686537,_0x4c741b){logger[_0x372c('0x9')](_0x686537,_0x4c741b?util[_0x372c('0x8')](_0x4c741b,{'showHidden':![],'depth':null}):'');};exports[_0x372c('0xa')]=function(_0x3911b0,_0x504035){logger[_0x372c('0xa')](_0x3911b0,_0x504035?util[_0x372c('0x8')](_0x504035,{'showHidden':![],'depth':null}):'');};exports[_0x372c('0xb')]=function(_0x5591c1,_0x3187c9){return client[_0x372c('0xb')](_0x5591c1,{'body':_0x3187c9})[_0x372c('0xc')](function(_0x2fb4fa){logger[_0x372c('0x9')](_0x372c('0xd'),_0x5591c1,_0x2fb4fa?util['inspect'](_0x2fb4fa,{'showHidden':![],'depth':null}):'');})[_0x372c('0xe')](function(_0x3686bd){logger[_0x372c('0xa')]('[utils][request]\x20name:%s',_0x5591c1,_0x3686bd?util[_0x372c('0x8')](_0x3686bd,{'showHidden':![],'depth':null}):'');});};function getUser(_0x30a612){return client[_0x372c('0xb')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0x372c('0xf'),_0x372c('0x10'),_0x372c('0x11')],'where':_0x30a612,'limit':0x1}})[_0x372c('0xc')](function(_0x359510){logger[_0x372c('0x9')](_0x372c('0x12'),JSON[_0x372c('0x13')](_0x30a612),_0x359510?util[_0x372c('0x8')](_0x359510,{'showHidden':![],'depth':null}):'');return _0x359510[_0x372c('0x14')][_0x372c('0x15')]?_0x359510[_0x372c('0x14')][0x0]:null;});}exports[_0x372c('0x16')]=function(_0x2b1d73){return new BPromise(function(_0x212363,_0x416c9c){if(_0x2b1d73){return getUser({'internal':_0x2b1d73})['then'](function(_0x226222){logger[_0x372c('0x7')](_0x372c('0x17'),_0x2b1d73,_0x226222?_0x372c('0x18'):_0x372c('0x19'));return _0x212363(_0x226222);})['catch'](function(_0x56e805){logger[_0x372c('0xa')](_0x372c('0x1a'),_0x56e805?util[_0x372c('0x8')](_0x56e805,{'showHidden':![],'depth':null}):'');return _0x212363(null);});}return _0x212363(null);});};exports[_0x372c('0x1b')]=function(_0x4d947a){return new BPromise(function(_0x1cddae,_0x41a4e9){if(_0x4d947a){return getUser({'interface':_0x4d947a})[_0x372c('0xc')](function(_0x43796b){logger['info'](_0x372c('0x1c'),_0x4d947a,_0x43796b?'found':_0x372c('0x19'));return _0x1cddae(_0x43796b);})['catch'](function(_0x46ff79){logger['error'](_0x372c('0x1d'),_0x46ff79?util[_0x372c('0x8')](_0x46ff79,{'showHidden':![],'depth':null}):'');return _0x1cddae(null);});}return _0x1cddae(null);});};exports[_0x372c('0x1e')]=function(_0x50d0c1){return new BPromise(function(_0x4792e0,_0x32698c){if(_0x50d0c1){return getUser({'name':_0x50d0c1})[_0x372c('0xc')](function(_0x473ddd){logger['info'](_0x372c('0x1f'),_0x50d0c1,_0x473ddd?'found':_0x372c('0x19'));return _0x4792e0(_0x473ddd);})['catch'](function(_0x27b4f6){logger[_0x372c('0xa')](_0x372c('0x20'),_0x27b4f6?util[_0x372c('0x8')](_0x27b4f6,{'showHidden':![],'depth':null}):'');return _0x4792e0(null);});}return _0x4792e0(null);});};exports[_0x372c('0x21')]=function(_0x4563ef){return new BPromise(function(_0x56cc9d,_0x1f5123){if(_0x4563ef){return client[_0x372c('0xb')](_0x372c('0x22'),{'options':{'raw':!![],'attributes':['id',_0x372c('0x10'),_0x372c('0x23'),_0x372c('0x24'),_0x372c('0x25')],'where':{'name':_0x4563ef},'limit':0x1}})[_0x372c('0xc')](function(_0x13cc94){logger[_0x372c('0x9')](_0x372c('0x26'),_0x4563ef,_0x13cc94?util[_0x372c('0x8')](_0x13cc94,{'showHidden':![],'depth':null}):'');logger[_0x372c('0x7')](_0x372c('0x27'),_0x4563ef,_0x13cc94?_0x372c('0x18'):_0x372c('0x19'));return _0x56cc9d(_0x13cc94[_0x372c('0x14')]['length']?_0x13cc94[_0x372c('0x14')][0x0]:null);})[_0x372c('0xe')](function(_0x38cc52){logger[_0x372c('0xa')](_0x372c('0x28'),_0x38cc52?util['inspect'](_0x38cc52,{'showHidden':![],'depth':null}):'');return _0x56cc9d(null);});}return _0x56cc9d(null);});};exports[_0x372c('0x29')]=function(_0x565573,_0x35d70d){return moment(_0x565573)[_0x372c('0x2a')](_0x35d70d,'seconds')[_0x372c('0x2b')](_0x372c('0x2c'));};exports['subtractTime']=function(_0x5436d0,_0x4b3459){return moment(_0x5436d0)[_0x372c('0x2d')](_0x4b3459,_0x372c('0x2e'))[_0x372c('0x2b')](_0x372c('0x2c'));};exports['diffTime']=function(_0x320451,_0x5b4d18){return moment(_0x320451)[_0x372c('0x2f')](moment(_0x5b4d18),_0x372c('0x2e'));};exports[_0x372c('0x30')]=function(_0x1f9a64,_0x130ce3){return parseInt(_0x1f9a64,0xa)+parseInt(_0x130ce3,0xa);};exports[_0x372c('0x31')]=function(){return moment()[_0x372c('0x2b')](_0x372c('0x2c'));};exports['isAfter']=function(_0x2451a2,_0x5a9e6d){if(_0x5a9e6d){return moment(_0x2451a2)[_0x372c('0x32')](_0x5a9e6d);}return!![];};exports[_0x372c('0x33')]=function(_0x4babec,_0x17ad51){if(_0x17ad51){return moment(_0x4babec)[_0x372c('0x33')](_0x17ad51);}else if(_0x4babec){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 9deaa2c..9376fa1 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 _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 +var _0x40f7=['url','responseTime','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','connection','other','agent_name','test','setupLoggers','fs-extra','lodash','path','util','fileLogger','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var','log','xcally','client','role','name','ensureDir','then','user','data','timestamp','catch','error','api','set','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','body','\x20body=%s','method','headers','x-forwarded-for','remoteAddress'];(function(_0x522c1a,_0x1299ed){var _0x5807ee=function(_0x4e5601){while(--_0x4e5601){_0x522c1a['push'](_0x522c1a['shift']());}};_0x5807ee(++_0x1299ed);}(_0x40f7,0x185));var _0x740f=function(_0x1710c2,_0x5bedd9){_0x1710c2=_0x1710c2-0x0;var _0x1dfc99=_0x40f7[_0x1710c2];return _0x1dfc99;};var fs=require(_0x740f('0x0'));var _=require(_0x740f('0x1'));var ewinston=require('express-winston');var path=require(_0x740f('0x2'));var util=require(_0x740f('0x3'));var fileLogger=require('./loggers')[_0x740f('0x4')];var safeTemplate=require('./safe-template')[_0x740f('0x5')];var maskSensitiveData=require(_0x740f('0x6'))[_0x740f('0x7')];function ClientSideLogger(){function _0x56a5ce(_0x5a7f69){var _0x2773d4=path[_0x740f('0x8')](_0x740f('0x9'),_0x740f('0xa'),_0x740f('0xb'));var _0x901073=path[_0x740f('0x8')](_0x740f('0xc'),_0x5a7f69[_0x740f('0xd')]+'-'+_0x5a7f69[_0x740f('0xe')]);return fs[_0x740f('0xf')](path[_0x740f('0x8')](_0x2773d4,_0x901073))['then'](function(){var _0x4a29a7=fileLogger(_0x740f('0xc'),path[_0x740f('0x8')](_0x2773d4,_0x901073));return _0x4a29a7;})['catch'](function(_0x38f233){throw _0x38f233;});}this[_0x740f('0xa')]=function(_0x49a890,_0x36e9ce,_0xed34ef,_0x453b26){return _0x56a5ce(_0x49a890['user'])['then'](function(_0x3926fc){var _0x57436a=_0x3926fc[_0x36e9ce];return _0x57436a;})[_0x740f('0x10')](function(_0x2fa6dc){var _0x5cd06f=_0x49a890[_0x740f('0x11')]?_0x49a890[_0x740f('0x11')]['id']:'no-user';var _0x248146=_0x453b26[_0x740f('0x12')];var _0x254daf=_0x453b26[_0x740f('0x13')];var _0x150621=new Date(Number(_0x254daf));return _0x2fa6dc(_0x5cd06f,_0x150621,_0xed34ef,_0x248146);})[_0x740f('0x14')](function(_0x2810e9){fileLogger('client')[_0x740f('0x15')](_0x2810e9);});};}function setupLoggers(_0x2a2215){return new Promise(function(_0x366e50){var _0x17f993=new ClientSideLogger();var _0x22f2de=fileLogger(_0x740f('0x16'));var _0x584b00=fileLogger('auth');_0x2a2215[_0x740f('0x17')](_0x740f('0x18'),_0x17f993);_0x2a2215[_0x740f('0x19')](ewinston[_0x740f('0x1a')]({'winstonInstance':_0x22f2de,'meta':![],'statusLevels':!![],'msg':function(_0x55c7ba,_0x1d77f8){var _0x4856b9=_0x740f('0x1b');if(!_['isEmpty'](_0x55c7ba[_0x740f('0x1c')])){_0x4856b9+=_0x740f('0x1d');var _0x53a527=_0x55c7ba[_0x740f('0x1c')];maskSensitiveData(_0x53a527);}return safeTemplate(util['format'](_0x4856b9,_0x55c7ba[_0x740f('0x1e')],_0x55c7ba[_0x740f('0x1f')][_0x740f('0x20')]?_0x55c7ba['headers'][_0x740f('0x20')]:_0x55c7ba['connection'][_0x740f('0x21')]||_0x55c7ba['ip'],_0x55c7ba[_0x740f('0x22')],_0x1d77f8['statusCode'],_0x1d77f8[_0x740f('0x23')],_0x55c7ba[_0x740f('0x11')]?_0x55c7ba[_0x740f('0x11')]['id']:null,_0x55c7ba[_0x740f('0x11')]?_0x55c7ba[_0x740f('0x11')][_0x740f('0xe')]:null,_0x55c7ba[_0x740f('0x11')]?_0x55c7ba['user']['role']:null,_0x53a527?util[_0x740f('0x24')](_0x53a527,![],null):''));}}));_0x2a2215[_0x740f('0x19')](ewinston[_0x740f('0x1a')]({'winstonInstance':_0x584b00,'meta':![],'statusLevels':!![],'msg':function(_0x22eddb,_0x39e347){var _0xc028ae=_0x740f('0x25');if(_0x22eddb[_0x740f('0x1c')]&&_0x22eddb[_0x740f('0x1c')][_0x740f('0x26')]&&_0x22eddb[_0x740f('0x1c')][_0x740f('0x27')]){_0xc028ae=_0x740f('0x28');}return util[_0x740f('0x29')](_0xc028ae,_0x22eddb[_0x740f('0x1e')],_0x22eddb['headers'][_0x740f('0x20')]?_0x22eddb[_0x740f('0x1f')]['x-forwarded-for']:_0x22eddb[_0x740f('0x2a')][_0x740f('0x21')]||_0x22eddb['ip'],_0x22eddb[_0x740f('0x22')],_0x39e347['statusCode'],_0x39e347[_0x740f('0x23')],_0x22eddb[_0x740f('0x11')]?_0x22eddb[_0x740f('0x11')]['id']:null,_0x22eddb[_0x740f('0x11')]?_0x22eddb[_0x740f('0x11')][_0x740f('0xe')]:null,_0x22eddb['user']?_0x22eddb[_0x740f('0x11')][_0x740f('0xd')]:null,_0x22eddb[_0x740f('0x1c')]&&_0x22eddb[_0x740f('0x1c')][_0x740f('0x26')]?_0x22eddb['body'][_0x740f('0x26')]:_0x740f('0x2b'),_0x22eddb[_0x740f('0x1c')]&&_0x22eddb[_0x740f('0x1c')]['agent_id']?_0x22eddb['body']['agent_id']:'',_0x22eddb['body']&&_0x22eddb[_0x740f('0x1c')][_0x740f('0x2c')]?_0x22eddb[_0x740f('0x1c')][_0x740f('0x2c')]:'');},'ignoreRoute':function(_0x1a00aa){var _0x46fd09=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x46fd09[_0x740f('0x2d')](_0x1a00aa[_0x740f('0x22')]);}}));return _0x366e50();});}exports[_0x740f('0x2e')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index bf87e1a..38a107c 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0xb589=['max','domCompare','monthCompare','guess','test','isMoment','padStart','length','iftime','lodash','moment-timezone','map','source','join','isValid','split','locale','weekdaysShort','toLowerCase','indexOf','slice','concat','exports','circularDoWInterval','clone','hours','minutes','isBefore','day','endOf','isBetween','timeCompare','ddd','includes','dowCompare','date','daysInMonth'];(function(_0x341082,_0x124ed6){var _0x183dfd=function(_0x48673e){while(--_0x48673e){_0x341082['push'](_0x341082['shift']());}};_0x183dfd(++_0x124ed6);}(_0xb589,0x156));var _0x9b58=function(_0x4dda69,_0x2a0fe4){_0x4dda69=_0x4dda69-0x0;var _0x9014a9=_0xb589[_0x4dda69];return _0x9014a9;};var _=require(_0x9b58('0x0'));var moment=require(_0x9b58('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][_0x9b58('0x2')](function(_0x2e2301){return _0x2e2301[_0x9b58('0x3')];})[_0x9b58('0x4')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING='Interval\x20string\x20not\x20valid';var EINVALID_DATE='Date\x20not\x20valid';function throwIfDateNotValid(_0x34e1e0){if(!_0x34e1e0[_0x9b58('0x5')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x2a7f59){var _0x2ed0d9=_0x2a7f59[_0x9b58('0x6')](':')[_0x9b58('0x2')](function(_0x4800e6){return parseInt(_0x4800e6,0xa);});var _0x1eb9ee=_0x2ed0d9[0x0];var _0x25a16a=_0x2ed0d9[0x1];if(_0x1eb9ee<0x0||_0x1eb9ee>0x17||_0x25a16a<0x0||_0x25a16a>0x3b){throw new Error(EINVALID_DATE);}return[_0x1eb9ee,_0x25a16a];}function circularDoWInterval(_0xdf5536,_0x29d244){if(_0xdf5536===_0x29d244){return[_0xdf5536];}else{var _0xdaac85=moment[_0x9b58('0x7')]();moment[_0x9b58('0x7')]('en');var _0x1c33b6=moment[_0x9b58('0x8')]()['map'](function(_0x4c7f5d){return _0x4c7f5d[_0x9b58('0x9')]();});moment[_0x9b58('0x7')](_0xdaac85);var _0x1d7e44=_0x1c33b6['indexOf'](_0xdf5536);var _0x3da29c=_0x1c33b6[_0x9b58('0xa')](_0x29d244);if(_0x3da29c>_0x1d7e44){return _0x1c33b6[_0x9b58('0xb')](_0x1d7e44,_0x3da29c+0x1);}else{var _0x477f3f=_0x1c33b6[_0x9b58('0xb')](0x0,_0x3da29c+0x1);var _0x112c9b=_0x1c33b6[_0x9b58('0xb')](_0x1d7e44);return _0x112c9b[_0x9b58('0xc')](_0x477f3f);}}}module[_0x9b58('0xd')][_0x9b58('0xe')]=circularDoWInterval;function circularMonthInterval(_0x2a779f,_0x4fcaa1){if(_0x2a779f===_0x4fcaa1){return[_0x2a779f];}else{var _0x573473=moment[_0x9b58('0x7')]();moment[_0x9b58('0x7')]('en');var _0x58919b=moment['monthsShort']()['map'](function(_0x251c63){return _0x251c63[_0x9b58('0x9')]();});moment[_0x9b58('0x7')](_0x573473);var _0x1a5137=_0x58919b['indexOf'](_0x2a779f);var _0x37f417=_0x58919b[_0x9b58('0xa')](_0x4fcaa1);if(_0x37f417>_0x1a5137){return _0x58919b[_0x9b58('0xb')](_0x1a5137,_0x37f417+0x1);}else{var _0x41cd0c=_0x58919b[_0x9b58('0xb')](0x0,_0x37f417+0x1);var _0x1c80ca=_0x58919b[_0x9b58('0xb')](_0x1a5137);return _0x1c80ca[_0x9b58('0xc')](_0x41cd0c);}}}module[_0x9b58('0xd')]['circularMonthInterval']=circularMonthInterval;function parseDom(_0x34eb28){var _0x2ef648=parseInt(_0x34eb28,0xa);if(_0x2ef648<0x1||_0x2ef648>0x1f){throw new Error(EINVALID_DATE);}return _0x2ef648;}function timeCompare(_0x41900e,_0x3263d6,_0x2354ba){var _0x1b9daa=_0x41900e['clone']();var _0x4d0750=extractTime(_0x3263d6);var _0x3409e3=_0x4d0750[0x0];var _0x5e661f=_0x4d0750[0x1];var _0x21804f=_0x41900e[_0x9b58('0xf')]()[_0x9b58('0x10')](_0x3409e3)[_0x9b58('0x11')](_0x5e661f);throwIfDateNotValid(_0x21804f);var _0xaff3e6=extractTime(_0x2354ba);var _0x344592=_0xaff3e6[0x0];var _0x207494=_0xaff3e6[0x1];var _0x49f849=_0x41900e[_0x9b58('0xf')]()['hours'](_0x344592)[_0x9b58('0x11')](_0x207494);throwIfDateNotValid(_0x49f849);if(_0x49f849[_0x9b58('0x12')](_0x21804f)){var _0x379a2e=_0x1b9daa['clone']()['startOf'](_0x9b58('0x13'));var _0x155322=_0x1b9daa[_0x9b58('0xf')]()[_0x9b58('0x14')](_0x9b58('0x13'));return _0x1b9daa['isBetween'](_0x21804f,_0x155322,undefined,'[]')||_0x1b9daa[_0x9b58('0x15')](_0x379a2e,_0x49f849,undefined,'[]');}else{return _0x1b9daa[_0x9b58('0x15')](_0x21804f,_0x49f849,undefined,'[]');}}module[_0x9b58('0xd')][_0x9b58('0x16')]=timeCompare;function dowCompare(_0x419af1,_0x178de2,_0xa5b7c3){var _0x2b6a89=_0x419af1[_0x9b58('0x7')]('en')['format'](_0x9b58('0x17'))[_0x9b58('0x9')]();return circularDoWInterval(_0x178de2,_0xa5b7c3)[_0x9b58('0x18')](_0x2b6a89);}module[_0x9b58('0xd')][_0x9b58('0x19')]=dowCompare;function domCompare(_0x208a12,_0x312aae,_0x4cb88d){var _0x9262ee=_0x208a12[_0x9b58('0x1a')]();if(_0x312aae===_0x4cb88d){return _0x9262ee===_0x312aae;}else{var _0x2a132e=_0x208a12[_0x9b58('0x1b')]();var _0x16bb9f=_0x312aae<_0x4cb88d;let _0x40708a=![];var _0x438ffc=0x0;var _0x2c04b2=0x0;if(_0x16bb9f){_0x438ffc=Math[_0x9b58('0x1c')](0x1,_0x312aae);_0x2c04b2=Math['min'](_0x4cb88d,_0x2a132e);_0x40708a=_0x9262ee>=_0x438ffc&&_0x9262ee<=_0x2c04b2;}else{_0x438ffc=Math['min'](_0x312aae,_0x2a132e);_0x2c04b2=Math[_0x9b58('0x1c')](0x1,_0x4cb88d);_0x40708a=_0x9262ee>=_0x438ffc||_0x9262ee<=_0x2c04b2;}return _0x40708a;}}module[_0x9b58('0xd')][_0x9b58('0x1d')]=domCompare;function monthCompare(_0x3ccce1,_0x3f9ca2,_0x44b52e){var _0x9cf89f=_0x3ccce1['locale']('en')['format']('MMM')['toLowerCase']();return circularMonthInterval(_0x3f9ca2,_0x44b52e)['includes'](_0x9cf89f);}module['exports'][_0x9b58('0x1e')]=monthCompare;function iftime(_0x41df59,_0x4a307d=moment['tz'][_0x9b58('0x1f')](),_0x279d55=moment()){if(!validateRx[_0x9b58('0x20')](_0x41df59)){throw new Error(EINVALID_STRING);}else{var _0x2bc1cc=(moment[_0x9b58('0x21')](_0x279d55)?_0x279d55[_0x9b58('0xf')]():moment(_0x279d55))['tz'](_0x4a307d)[_0x9b58('0x7')]('en');throwIfDateNotValid(_0x2bc1cc);var _0x1f3a4c=_0x41df59[_0x9b58('0x6')](',');var _0x44e799=_0x1f3a4c[0x0];var _0x5421e6=_0x1f3a4c[0x1];var _0x347a6a=_0x1f3a4c[0x2];var _0x3fb431=_0x1f3a4c[0x3];let _0x1e42f1=!![];if(_0x44e799!=='*'){var _0x5b7f2b=_0x44e799[_0x9b58('0x6')]('-');var _0x2e14d9=_[_0x9b58('0x22')](_0x5b7f2b[0x0],0x5,'0');var _0x5b9872=_0x5b7f2b[_0x9b58('0x23')]===0x2?_[_0x9b58('0x22')](_0x5b7f2b[0x1],0x5,'0'):_0x2e14d9;_0x1e42f1=timeCompare(_0x2bc1cc,_0x2e14d9,_0x5b9872);}let _0x5f2756=!![];if(_0x5421e6!=='*'){var _0x36d82b=_0x5421e6['split']('-');var _0x2779d3=_0x36d82b[0x0];var _0x4ee9c0=_0x36d82b[_0x9b58('0x23')]===0x2?_0x36d82b[0x1]:_0x2779d3;_0x5f2756=dowCompare(_0x2bc1cc,_0x2779d3,_0x4ee9c0);}let _0x119570=!![];if(_0x347a6a!=='*'){var _0x4839ff=_0x347a6a['split']('-');var _0x5107a6=parseDom(_0x4839ff[0x0]);var _0xbe2f0f=_0x4839ff['length']===0x2?parseDom(_0x4839ff[0x1]):_0x5107a6;_0x119570=domCompare(_0x2bc1cc,_0x5107a6,_0xbe2f0f);}let _0x49a9a8=!![];if(_0x3fb431!=='*'){var _0x212154=_0x3fb431[_0x9b58('0x6')]('-');var _0x2dd79b=_0x212154[0x0];var _0x1aa4a5=_0x212154['length']===0x2?_0x212154[0x1]:_0x212154[0x0];_0x49a9a8=monthCompare(_0x2bc1cc,_0x2dd79b,_0x1aa4a5);}return _0x1e42f1&&_0x5f2756&&_0x119570&&_0x49a9a8;}}module[_0x9b58('0xd')][_0x9b58('0x24')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 30b8783..df269d1 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0xe493=['winston','../config/environment','toLowerCase','redBG\x20white','red','bold\x20white','gray','bold\x20magenta','bold\x20cyan','/var/log/xcally','format','message','replace','{{{','}}}','YYYY-MM-DD\x20HH:mm:ss','level','meta','length','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','toUpperCase','transports','Console','Logger','error','File','%s-%s','consoleLogger','fileLogger','path','util','moment'];(function(_0x52684f,_0xff73fc){var _0x4a55f0=function(_0x8ce37c){while(--_0x8ce37c){_0x52684f['push'](_0x52684f['shift']());}};_0x4a55f0(++_0xff73fc);}(_0xe493,0x7d));var _0x3e49=function(_0x4b25ff,_0x3c0230){_0x4b25ff=_0x4b25ff-0x0;var _0x498fe7=_0xe493[_0x4b25ff];return _0x498fe7;};'use strict';var path=require(_0x3e49('0x0'));var util=require(_0x3e49('0x1'));var moment=require(_0x3e49('0x2'));var winston=require(_0x3e49('0x3'));var config=require(_0x3e49('0x4'));var debugLevel=config['debugLevel']?config['debugLevel'][_0x3e49('0x5')]():'info';var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x3e49('0x6'),'error':_0x3e49('0x7'),'warn':'bold\x20yellow','info':'white','print':_0x3e49('0x8'),'success':'bold\x20green','http':_0x3e49('0x9'),'verbose':_0x3e49('0xa'),'debug':'bold\x20blue','silly':_0x3e49('0xb')};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x4d10ca,_0x3ac75c,_0x5d0a4e){var _0x2fc7ea=_0x4d10ca||_0x3e49('0xc');return path['join'](_0x2fc7ea,util[_0x3e49('0xd')]('%s-%s.log',_0x3ac75c,_0x5d0a4e));}function formatter(_0x8ea5b2,_0x1718f7){_0x1718f7[_0x3e49('0xe')]=_0x1718f7[_0x3e49('0xe')][_0x3e49('0xf')](/@@{/g,_0x3e49('0x10'))['replace'](/}@@/g,_0x3e49('0x11'))[_0x3e49('0xf')](/@{/g,'{{')[_0x3e49('0xf')](/}@/g,'}}');return util['format']('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0x3e49('0xd')](_0x3e49('0x12')),_0x1718f7[_0x3e49('0x13')]['toUpperCase'](),_0x8ea5b2,_0x1718f7[_0x3e49('0xe')]);}function fileFormat(_0x6ce7c0,_0x9005d6){_0x9005d6[_0x3e49('0xe')]=_0x9005d6['message'][_0x3e49('0xf')](/@@{/g,_0x3e49('0x10'))[_0x3e49('0xf')](/}@@/g,'}}}')[_0x3e49('0xf')](/@{/g,'{{')[_0x3e49('0xf')](/}@/g,'}}');var _0x26a024=_0x9005d6[_0x3e49('0x14')]&&Object['keys'](_0x9005d6[_0x3e49('0x14')])[_0x3e49('0x15')]?'\x0a\x09'+JSON['stringify'](_0x9005d6[_0x3e49('0x14')]):'';return util[_0x3e49('0xd')](_0x3e49('0x16'),moment()[_0x3e49('0xd')](_0x3e49('0x12')),_0x9005d6[_0x3e49('0x13')][_0x3e49('0x17')](),_0x6ce7c0,_0x9005d6[_0x3e49('0xe')],_0x26a024);}function consoleLogger(){var _0x10e23b=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x3e49('0x18'))][(_0x3e49('0x19'))]({'level':'warn','json':![],'formatter':function(_0x1d1d2a){return formatter('',_0x1d1d2a);}})]});return _0x10e23b;}function fileLogger(_0x1772d1,_0x597144){var _0x40b318=new winston[(_0x3e49('0x1a'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x3e49('0x18'))]['File']({'name':util[_0x3e49('0xd')]('%s-%s',_0x1772d1,_0x3e49('0x1b')),'filename':getLogFileName(_0x597144,_0x1772d1,_0x3e49('0x1b')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x19c75e){return fileFormat(_0x1772d1,_0x19c75e);}}),new winston[(_0x3e49('0x18'))][(_0x3e49('0x1c'))]({'name':util[_0x3e49('0xd')](_0x3e49('0x1d'),_0x1772d1,debugLevel),'filename':getLogFileName(_0x597144,_0x1772d1,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5b86c8){return fileFormat(_0x1772d1,_0x5b86c8);}}),new winston[(_0x3e49('0x18'))][(_0x3e49('0x19'))]({'level':'warn','json':![],'formatter':function(_0x415757){return fileFormat(_0x1772d1,_0x415757);}})]});return _0x40b318;}exports[_0x3e49('0x1e')]=consoleLogger;exports[_0x3e49('0x1f')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 9805159..859c1a7 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 _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 +var _0x7a54=['code','accessKey','token','authToken','consumerKey','membername','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','pass','accountSid','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray','length','replace','}@@','includes','exports','maskSensitiveData','lodash','username','password','apiKey','firstName','street','phone','mobile','fax','email','clientSecret'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7a54,0x106));var _0x47a5=function(_0xc1eeaf,_0x4879ca){_0xc1eeaf=_0xc1eeaf-0x0;var _0x196ea4=_0x7a54[_0xc1eeaf];return _0x196ea4;};var _=require(_0x47a5('0x0'));var sensitiveFields=[_0x47a5('0x1'),_0x47a5('0x2'),'newPassword',_0x47a5('0x3'),_0x47a5('0x4'),'lastName',_0x47a5('0x5'),_0x47a5('0x6'),_0x47a5('0x7'),_0x47a5('0x8'),_0x47a5('0x9'),'clientId',_0x47a5('0xa'),'securityToken',_0x47a5('0xb'),_0x47a5('0xc'),'tenantId',_0x47a5('0xd'),'channelSecret','accessToken','accessTokenSecret',_0x47a5('0xe'),_0x47a5('0xf'),'consumerSecret',_0x47a5('0x10'),'calleridname','calleridnum',_0x47a5('0x11'),_0x47a5('0x12'),_0x47a5('0x13'),_0x47a5('0x14'),_0x47a5('0x15'),_0x47a5('0x16'),_0x47a5('0x17'),'user',_0x47a5('0x18'),_0x47a5('0x19'),_0x47a5('0x1a'),_0x47a5('0x1b'),_0x47a5('0x1c'),_0x47a5('0x1d'),_0x47a5('0x1e')];function maskSensitiveData(_0x190faa){const _0x4e99a8=/(?!^)[\s\S](?!$)/g;if(_[_0x47a5('0x1f')](_0x190faa)){for(const _0x11faf5 in _0x190faa){if(_[_0x47a5('0x20')](_0x190faa[_0x11faf5])){for(let _0x2a2cbb=0x0;_0x2a2cbb<_0x190faa[_0x11faf5][_0x47a5('0x21')];_0x2a2cbb++){maskSensitiveData(_0x190faa[_0x11faf5][_0x2a2cbb]);}}else if(_['isPlainObject'](_0x190faa[_0x11faf5])){maskSensitiveData(_0x190faa[_0x11faf5]);}else if(_['isString'](_0x190faa[_0x11faf5])){_0x190faa[_0x11faf5]=_0x190faa[_0x11faf5][_0x47a5('0x22')](/{{{/g,'@@{')['replace'](/}}}/g,_0x47a5('0x23'))[_0x47a5('0x22')](/{{/g,'@{')[_0x47a5('0x22')](/}}/g,'}@');if(_[_0x47a5('0x24')](sensitiveFields,_0x11faf5)){_0x190faa[_0x11faf5]=_0x190faa[_0x11faf5][_0x47a5('0x22')](_0x4e99a8,'*');}}}}}module[_0x47a5('0x25')][_0x47a5('0x26')]=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/misc.js b/server/utils/misc.js index b2020a1..052b25f 100644 --- a/server/utils/misc.js +++ b/server/utils/misc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0x2ef3=['exports','replace','\x5c$&'];(function(_0x1dd997,_0x578bf5){var _0x440e4b=function(_0x55f83d){while(--_0x55f83d){_0x1dd997['push'](_0x1dd997['shift']());}};_0x440e4b(++_0x578bf5);}(_0x2ef3,0xba));var _0x32ef=function(_0x444ef5,_0x3c597f){_0x444ef5=_0x444ef5-0x0;var _0x29b36e=_0x2ef3[_0x444ef5];return _0x29b36e;};module[_0x32ef('0x0')]={'escapeRegExp'(_0x11c049,_0x47513a=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x11c049[_0x32ef('0x1')](_0x47513a,_0x32ef('0x2'));}}; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index d598c26..37301d0 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 _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 +var _0x4213=['{\x20{\x20','\x20}\x20}','string','isArray','isPlainObject','keys','reduce','exports','safeTemplate','lodash'];(function(_0x5de3b3,_0x4a33e4){var _0xaff588=function(_0x3a2257){while(--_0x3a2257){_0x5de3b3['push'](_0x5de3b3['shift']());}};_0xaff588(++_0x4a33e4);}(_0x4213,0x77));var _0x3421=function(_0x260ad2,_0x40c748){_0x260ad2=_0x260ad2-0x0;var _0x3e0ae3=_0x4213[_0x260ad2];return _0x3e0ae3;};var _=require(_0x3421('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x445ef6){return _0x445ef6==='{{'?_0x3421('0x1'):_0x3421('0x2');}function safeTemplate(_0x2613b6){var _0x153f3a=_0x2613b6;if(typeof _0x2613b6===_0x3421('0x3')){_0x153f3a=_0x2613b6['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x3421('0x4')](_0x2613b6)){_0x153f3a=_0x2613b6['map'](function(_0x459c5e){return safeTemplate(_0x459c5e);});}else if(_[_0x3421('0x5')](_0x2613b6)){_0x153f3a=Object[_0x3421('0x6')](_0x2613b6)[_0x3421('0x7')](function(_0x5469d8,_0x50e464){_0x5469d8[_0x50e464]=safeTemplate(_0x2613b6[_0x50e464]);return _0x5469d8;},{});}return _0x153f3a;}module[_0x3421('0x8')][_0x3421('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 0b5585c..23a62f8 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 _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 +var _0x8693=['updated','Updating\x20app.json','writeJSON','exports','fs-extra','path','root','resolve','isArray','apps','findIndex','name','motion2','NODE_PATH','env','then','readJSON'];(function(_0x50a05d,_0x5bc507){var _0x8de3fe=function(_0xd47463){while(--_0xd47463){_0x50a05d['push'](_0x50a05d['shift']());}};_0x8de3fe(++_0x5bc507);}(_0x8693,0x158));var _0x3869=function(_0x42683c,_0xc02448){_0x42683c=_0x42683c-0x0;var _0x39b762=_0x8693[_0x42683c];return _0x39b762;};var fs=require(_0x3869('0x0'));var path=require(_0x3869('0x1'));var config=require('../config/environment');var root=config[_0x3869('0x2')];var APP_JSON_PATH=path[_0x3869('0x3')](root,'server/app.json');var NODEPATH=path['resolve'](root,'legacy-libs');function setLegacyLibsNodeEnvPath(_0x4c6c3b){let _0x137cfd=![];if(Array[_0x3869('0x4')](_0x4c6c3b[_0x3869('0x5')])){var _0x44b1c9=_0x4c6c3b[_0x3869('0x5')][_0x3869('0x6')](function(_0x1179da){return _0x1179da[_0x3869('0x7')]===_0x3869('0x8');});if(_0x44b1c9>-0x1){var _0x5c3efe=_0x4c6c3b[_0x3869('0x5')][_0x44b1c9];if(typeof _0x5c3efe['env'][_0x3869('0x9')]!=='string'){_0x5c3efe[_0x3869('0xa')][_0x3869('0x9')]=NODEPATH;_0x137cfd=!![];}}return{'appConfig':_0x4c6c3b,'updated':_0x137cfd};}}function updateAppConfig(_0x59f1d9){return fs['pathExists'](APP_JSON_PATH)[_0x3869('0xb')](function(_0x13ba68){if(_0x13ba68){return fs[_0x3869('0xc')](APP_JSON_PATH)[_0x3869('0xb')](function(_0x4212df){var _0x2a224c=setLegacyLibsNodeEnvPath(_0x4212df);if(_0x2a224c[_0x3869('0xd')]){_0x59f1d9['info'](_0x3869('0xe'));return fs[_0x3869('0xf')](APP_JSON_PATH,_0x4212df,{'spaces':0x2});}else{return Promise[_0x3869('0x3')]();}});}else{return Promise[_0x3869('0x3')]();}});}module[_0x3869('0x10')]=updateAppConfig; \ No newline at end of file